mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 15:40:57 +00:00
EMI: Over-draw some actors in Set::drawForeground
EMI draws portions of the background over actors with sortOrder >= 15.
This commit is contained in:
parent
0d2089d5a1
commit
bde37f96a8
@ -409,6 +409,14 @@ void Bitmap::draw(int x, int y) {
|
||||
g_driver->drawBitmap(this, x, y);
|
||||
}
|
||||
|
||||
void Bitmap::drawForeground() {
|
||||
_data->load();
|
||||
if (_currImage == 0)
|
||||
return;
|
||||
|
||||
g_driver->drawBitmap(this, _data->_x, _data->_y, false);
|
||||
}
|
||||
|
||||
void Bitmap::setActiveImage(int n) {
|
||||
assert(n >= 0);
|
||||
_data->load();
|
||||
|
@ -146,6 +146,8 @@ public:
|
||||
void draw();
|
||||
void draw(int x, int y);
|
||||
|
||||
void drawForeground();
|
||||
|
||||
/**
|
||||
* Set which image in an animated bitmap to use
|
||||
*
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
* @see createBitmap
|
||||
* @see destroyBitmap
|
||||
*/
|
||||
virtual void drawBitmap(const Bitmap *bitmap, int x, int y) = 0;
|
||||
virtual void drawBitmap(const Bitmap *bitmap, int x, int y, bool initialDraw = true) = 0;
|
||||
|
||||
/**
|
||||
* Deletes any internal references and representations of a bitmap
|
||||
|
@ -805,10 +805,14 @@ void GfxOpenGL::createBitmap(BitmapData *bitmap) {
|
||||
}
|
||||
}
|
||||
|
||||
void GfxOpenGL::drawBitmap(const Bitmap *bitmap, int dx, int dy) {
|
||||
void GfxOpenGL::drawBitmap(const Bitmap *bitmap, int dx, int dy, bool initialDraw) {
|
||||
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(-1, 1, -1, 1, 0, 1);
|
||||
|
||||
@ -823,17 +827,28 @@ void GfxOpenGL::drawBitmap(const Bitmap *bitmap, int dx, int dy) {
|
||||
BitmapData *data = bitmap->_data;
|
||||
GLuint *textures = (GLuint *)bitmap->getTexIds();
|
||||
float *texc = data->_texc;
|
||||
uint32 offset = data->_offsets[data->_curOffset]._offset;
|
||||
for (uint32 i = offset; i < offset + data->_offsets[data->_curOffset]._numImages; ++i) {
|
||||
glBindTexture(GL_TEXTURE_2D, textures[data->_verts[i]._texid]);
|
||||
glBegin(GL_QUADS);
|
||||
uint32 ntex = data->_verts[i]._pos * 4;
|
||||
for (uint32 x = 0; x < data->_verts[i]._verts; ++x) {
|
||||
glTexCoord2f(texc[ntex + 2], texc[ntex + 3]);
|
||||
glVertex2f(texc[ntex + 0], texc[ntex + 1]);
|
||||
ntex += 4;
|
||||
int startOffset, endOffset;
|
||||
if (initialDraw) {
|
||||
startOffset = endOffset = data->_curOffset;
|
||||
} else {
|
||||
startOffset = data->_curOffset - 1;
|
||||
endOffset = 0;
|
||||
}
|
||||
|
||||
while (endOffset <= startOffset) {
|
||||
uint32 offset = data->_offsets[startOffset]._offset;
|
||||
for (uint32 i = offset; i < offset + data->_offsets[startOffset]._numImages; ++i) {
|
||||
glBindTexture(GL_TEXTURE_2D, textures[data->_verts[i]._texid]);
|
||||
glBegin(GL_QUADS);
|
||||
uint32 ntex = data->_verts[i]._pos * 4;
|
||||
for (uint32 x = 0; x < data->_verts[i]._verts; ++x) {
|
||||
glTexCoord2f(texc[ntex + 2], texc[ntex + 3]);
|
||||
glVertex2f(texc[ntex + 0], texc[ntex + 1]);
|
||||
ntex += 4;
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glEnd();
|
||||
startOffset--;
|
||||
}
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
@ -841,6 +856,10 @@ void GfxOpenGL::drawBitmap(const Bitmap *bitmap, int dx, int dy) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
void destroyMaterial(Texture *material);
|
||||
|
||||
void createBitmap(BitmapData *bitmap);
|
||||
void drawBitmap(const Bitmap *bitmap, int x, int y);
|
||||
void drawBitmap(const Bitmap *bitmap, int x, int y, bool initialDraw = true);
|
||||
void destroyBitmap(BitmapData *bitmap);
|
||||
|
||||
void createFont(Font *font);
|
||||
|
@ -873,7 +873,7 @@ void GfxTinyGL::blit(const Graphics::PixelFormat &format, BlitImage *image, byte
|
||||
}
|
||||
}
|
||||
|
||||
void GfxTinyGL::drawBitmap(const Bitmap *bitmap, int x, int y) {
|
||||
void GfxTinyGL::drawBitmap(const Bitmap *bitmap, int x, int y, bool initialDraw) {
|
||||
int format = bitmap->getFormat();
|
||||
if ((format == 1 && !_renderBitmaps) || (format == 5 && !_renderZBitmaps)) {
|
||||
return;
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
void destroyMaterial(Texture *material);
|
||||
|
||||
void createBitmap(BitmapData *bitmap);
|
||||
void drawBitmap(const Bitmap *bitmap, int x, int y);
|
||||
void drawBitmap(const Bitmap *bitmap, int x, int y, bool initialDraw = true);
|
||||
void destroyBitmap(BitmapData *bitmap);
|
||||
|
||||
void createFont(Font *font);
|
||||
|
@ -528,11 +528,24 @@ void GrimEngine::updateDisplayScene() {
|
||||
|
||||
// Draw actors
|
||||
buildActiveActorsList();
|
||||
foreach (Actor *a, _activeActors) {
|
||||
if (a->isVisible())
|
||||
a->draw();
|
||||
if (g_grim->getGameType() == GType_GRIM) {
|
||||
foreach (Actor *a, _activeActors) {
|
||||
if (a->isVisible())
|
||||
a->draw();
|
||||
}
|
||||
} else {
|
||||
bool drewForeground = false;
|
||||
foreach (Actor *a, _activeActors) {
|
||||
if (a->getSortOrder() < 15 && !drewForeground) {
|
||||
drewForeground = true;
|
||||
_currSet->drawForeground();
|
||||
}
|
||||
if (a->isVisible() && a->getSortOrder() < 100)
|
||||
a->draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
flagRefreshShadowMask(false);
|
||||
|
||||
// Draw overlying scene components
|
||||
|
@ -549,6 +549,11 @@ void Set::setSetup(int num) {
|
||||
g_grim->flagRefreshShadowMask(true);
|
||||
}
|
||||
|
||||
void Set::drawForeground() const {
|
||||
assert(g_grim->getGameType() == GType_MONKEY4);
|
||||
_currSetup->_bkgndBm->drawForeground();
|
||||
}
|
||||
|
||||
void Set::drawBackground() const {
|
||||
if (_currSetup->_bkgndZBm) // Some screens have no zbuffer mask (eg, Alley)
|
||||
_currSetup->_bkgndZBm->draw();
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
int _maxVolume;
|
||||
|
||||
void drawBackground() const;
|
||||
void drawForeground() const;
|
||||
void drawBitmaps(ObjectState::Position stage);
|
||||
void setupCamera() {
|
||||
_currSetup->setupCamera();
|
||||
|
Loading…
x
Reference in New Issue
Block a user