diff --git a/engines/grim/gfx_opengl.cpp b/engines/grim/gfx_opengl.cpp index 1395aff001d..ab9aacd0fc4 100644 --- a/engines/grim/gfx_opengl.cpp +++ b/engines/grim/gfx_opengl.cpp @@ -595,19 +595,37 @@ void GfxOpenGL::drawSprite(const Sprite *sprite) { glEnable(GL_ALPHA_TEST); glDisable(GL_LIGHTING); - float halfWidth = (sprite->_width / 2) * _scaleW; - float halfHeight = (sprite->_height / 2) * _scaleH; + if (g_grim->getGameType() == GType_MONKEY4) { + float halfWidth = (sprite->_width / 2) * _scaleW; + float halfHeight = (sprite->_height / 2) * _scaleH; - glBegin(GL_POLYGON); - glTexCoord2f(0.0f, 1.0f); - glVertex3f(-halfWidth, -halfHeight, 0.0f); - glTexCoord2f(0.0f, 0.0f); - glVertex3f(-halfWidth, +halfHeight, 0.0f); - glTexCoord2f(1.0f, 0.0f); - glVertex3f(+halfWidth, +halfHeight, 0.0f); - glTexCoord2f(1.0f, 1.0f); - glVertex3f(+halfWidth, -halfHeight, 0.0f); - glEnd(); + glBegin(GL_POLYGON); + glTexCoord2f(0.0f, 1.0f); + glVertex3f(-halfWidth, -halfHeight, 0.0f); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(-halfWidth, +halfHeight, 0.0f); + glTexCoord2f(1.0f, 0.0f); + glVertex3f(+halfWidth, +halfHeight, 0.0f); + glTexCoord2f(1.0f, 1.0f); + glVertex3f(+halfWidth, -halfHeight, 0.0f); + glEnd(); + } else { + // In Grim, the bottom edge of the sprite is at y=0 and + // the texture is flipped along the X-axis. + float halfWidth = (sprite->_width / 2) * _scaleW; + float height = sprite->_height * _scaleH; + + glBegin(GL_POLYGON); + glTexCoord2f(0.0f, 1.0f); + glVertex3f(+halfWidth, 0.0f, 0.0f); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(+halfWidth, +height, 0.0f); + glTexCoord2f(1.0f, 0.0f); + glVertex3f(-halfWidth, +height, 0.0f); + glTexCoord2f(1.0f, 1.0f); + glVertex3f(-halfWidth, 0.0f, 0.0f); + glEnd(); + } glEnable(GL_LIGHTING); glDisable(GL_ALPHA_TEST); diff --git a/engines/grim/gfx_tinygl.cpp b/engines/grim/gfx_tinygl.cpp index f26d92ef5d1..4be4163efaa 100644 --- a/engines/grim/gfx_tinygl.cpp +++ b/engines/grim/gfx_tinygl.cpp @@ -685,20 +685,37 @@ void GfxTinyGL::drawSprite(const Sprite *sprite) { tglDisable(TGL_LIGHTING); - float halfWidth = (sprite->_width / 2) * _scaleW; - float halfHeight = (sprite->_height / 2) * _scaleH; + if (g_grim->getGameType() == GType_MONKEY4) { + float halfWidth = (sprite->_width / 2) * _scaleW; + float halfHeight = (sprite->_height / 2) * _scaleH; + tglBegin(TGL_POLYGON); + tglTexCoord2f(0.0f, 1.0f); + tglVertex3f(-halfWidth, -halfHeight, 0.0f); + tglTexCoord2f(0.0f, 0.0f); + tglVertex3f(-halfWidth, +halfHeight, 0.0f); + tglTexCoord2f(1.0f, 0.0f); + tglVertex3f(+halfWidth, +halfHeight, 0.0f); + tglTexCoord2f(1.0f, 1.0f); + tglVertex3f(+halfWidth, -halfHeight, 0.0f); + tglEnd(); + } else { + // In Grim, the bottom edge of the sprite is at y=0 and + // the texture is flipped along the X-axis. + float halfWidth = (sprite->_width / 2) * _scaleW; + float height = sprite->_height * _scaleH; - tglBegin(TGL_POLYGON); - tglTexCoord2f(0.0f, 1.0f); - tglVertex3f(-halfWidth, -halfHeight, 0.0f); - tglTexCoord2f(0.0f, 0.0f); - tglVertex3f(-halfWidth, +halfHeight, 0.0f); - tglTexCoord2f(1.0f, 0.0f); - tglVertex3f(+halfWidth, +halfHeight, 0.0f); - tglTexCoord2f(1.0f, 1.0f); - tglVertex3f(+halfWidth, -halfHeight, 0.0f); - tglEnd(); + tglBegin(TGL_POLYGON); + tglTexCoord2f(0.0f, 1.0f); + tglVertex3f(+halfWidth, 0.0f, 0.0f); + tglTexCoord2f(0.0f, 0.0f); + tglVertex3f(+halfWidth, +height, 0.0f); + tglTexCoord2f(1.0f, 0.0f); + tglVertex3f(-halfWidth, +height, 0.0f); + tglTexCoord2f(1.0f, 1.0f); + tglVertex3f(-halfWidth, 0.0f, 0.0f); + tglEnd(); + } tglEnable(TGL_LIGHTING);