VM_REPLACE_TILE draws the tiles in the wrong position on screen in LOGO scenes
Describe the bug The operation VM_REPLACE_TILE draws the background tiles in the incorrect position, inside a LOGO SCENE, when the game is busy with other functions. If the game is not busy, the operation works as expected, drawing the tiles in the correct position. By busy I mean, there are other actors working on their updates or even if you place VM_REPLACE_TILE inside a IF statement. For example, if we set the TARGET_TILE_IDX of the operation as 0, it will draw the tiles at the very top of the screen, in tile 0. But if the game is busy, it will draw them in another place enterily, usually in the position 0 of the next block of VRAM (either the one reserved for sprites/background or the block exclusively reserved for background tiles). When it does this, it doesnt matter if the TARGET_TILE_IDX is any other number. It appears to draw them in the first tile space of the incorrect block in memory. This can also happen when the operation is inside an IF statement. One way I have found to mitigate this is to place an IDLE event inside between the IF and VM_REPLACE_TILE to give the operation a frame "to breathe". Then it draws the tiles correctly. Ive not manage to replicate this problem in any other scene type except the LOGO SCENE, so as far as im aware, its not an issue anywhere else.
To Reproduce Steps to reproduce the behavior:
- Write the VM_REPLACE_TILE inside a GBVM event.
- Place it inside an IF statement with an expression.
- Without an IDLE event inbetween them, it will draw the tiles at the incorrect position. (Another way to test it is by placing the operation inside an Attach to Button and having another actor do something in its update. While the game is busy this way, there is a chance that the operation will fail as well.)
Expected behavior VM_REPLACE_TILE should place the desired tiles in the correct position on screen. Treating 0 as the very first background tile at the top of the screen.
Screenshots
Platform (please complete the following information):
- Windows 10. GBStudio [4.3.2]
Source: chrismaltby/gb-studio