I'm using the stable build of 3.3.0 : Build 3.3.0.1156
The following scenario is extremely easy to reproduce.
1) Create a 32-bit game
2) import a sprite with alpha into it
3) in your room's or module's repeatedly[_execute_always], put the following code :
int MYSPRITE = 6; //whatever sprite slot was given for the sprite.
//We assume the sprite is larger than 20x20
DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
ds.DrawImage(0, 0, MYSPRITE , 0, 20, 20);
ds.Release();
PROBLEM 1: The game crashes with following error:
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x00000000 ; program pointer is +1004, ACI version 3.3.0.1156, gtags (6,37)
This is fixed by using "DrawImage" with a transparency of 1 instead of 0. That's a lame hack but it works.
PROBLEM 2: Corrupted sprite drawn
Even after the hack described above, no image gets drawn. Just a pattern of vertical stripes. That drawing has the expected size (20x20 in the example above).
Please note that I tried in both DX5 and D3D9. But I have an old notebook running XP, with an integrated chipset, so I'm not sure how much is hardware-accelerated and how much is software in the process. Anyway it looks like a wrong pointer gets involved in the process, inside the Engine.
SOLUTION: your room must have a background set in the editor. If there's no background, AGS doesn't create an image for it, neither a surface, therefore any attempt to draw onto that surface creates unexpected issues.
AGS should really be raising a warning
Strike that. AGS shouldn't even have to raise a warning for this situation. The default room template should have some background defined, even if it is just a blank, black one.
Template or not, I'd say a room should provide a blank (black) bitmap if none is assigned and drawing surface is requested.
Afaik, the default background of a new room has a color depth of 8 bit. This is a remnant from DOS days, I guess.
I noticed this a few years ago and have been importing a blank 16bit background first whenever I created a new game to test something.