hex007 / freej2me

A free J2ME emulator with libretro, awt and sdl2 frontends.
Other
469 stars 72 forks source link

Graphical glitches in Universomo's WALL-E #122

Closed Nokia64 closed 2 years ago

Nokia64 commented 2 years ago

The game WALL-E (tested version v1.0.67 240x320, md5: aaff3da38cb5f8cc1210fae07e180870) by Universomo experiences an issue under FreeJ2ME where the tile-based level stops properly displaying after a certain feature (trash piles) is drawn onscreen. WALL-E_issue The Trash Pile of Death

The game appears to be using translate(int x, int y) (from javax.microedition.lcdui.Graphics) to set the offset of the camera on the level. When drawing a trash pile it reads the original clip area, uses clipRect() to delimit the drawing area for the sprite, and setClip() to restore back the original area when done.

After such original area is set back again the level is no longer properly displayed, though. After some investigation, found out the translate() calls affect the values of the clip area, but FreeJ2ME is not updating its clipX, clipY, clipWidth and clipHeight variables when it is called (at src/org/recompile/mobile/PlatformGraphics.java). So when the game reads the clip area, it gets the values from the last setClip() or clipRect() call but not as changed by translate() prior to drawing the level, restoring some wrong values.

Refreshing the values of such variables on translate() calls makes the game work properly. I'll open a tiny pull request with this proposed fix.

WALL-E_fixed

Thanks to TwoSpacesSG for providing very useful information about the different available versions of this game and a handy hint that helped a lot hunting down this bug