mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
Merge pull request #702 from Akz-/spritefix
GRIM: Fix regression in sprite drawing
This commit is contained in:
commit
024f273a26
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user