Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
514 stars 131 forks source link

View-Cropped Tilemaps fail when offset from origin. #123

Closed sorlok closed 8 years ago

sorlok commented 8 years ago

I'm using a simple script (NEO Save) that provides a screenshot of the map where you saved the game. This is done using the following code:

@viewport = Viewport.new(178, 107, 348,156)   #Position a Viewport absolutely
@tilemap = Tilemap.new(@viewport)                  #Make a Tilemap based on this viewport.
#...etc.

On RPG Maker VX, we get this: http://i.imgur.com/5AqEyeI.png On MKXP (Linux or Windows), we get a cropped image: http://i.imgur.com/KFa8sHw.png

Tracing the script, it seems like the bounds (12x6 tiles) are calculated correctly. However, I have a theory: since the Viewport is offset from the origin, it is not taking its own position into account. Here, the red box represents the full image at (0,0). http://i.imgur.com/gPiaPZp.png

...there is some overlap, but it's within the 32 pixel tile size.

My guess is that, somewhere in the OpenGL or shader code, MKXP is setting the size assuming that it will always be from origin. However, my OpenGL knowledge is sufficiently weak that I am having trouble tracking this further. Any thoughts?

Ancurio commented 8 years ago

Please test with fe6799d00bae75c6d2ef9f9a6911f49acd983e0b

sorlok commented 8 years ago

Works fine with fe6799d. Thanks!