GRIM: Implemented L1_PreRender().

This commit is contained in:
Giulio Camuffo 2011-07-29 23:02:52 +02:00
parent 1c62f04688
commit b83d432dd7
7 changed files with 40 additions and 2 deletions

View File

@ -26,6 +26,12 @@
namespace Grim {
GfxBase::GfxBase() :
_renderBitmaps(true),
_renderZBitmaps(true) {
}
void GfxBase::saveState(SaveGame *state) {
state->beginSection('DRVR');
@ -34,6 +40,8 @@ void GfxBase::saveState(SaveGame *state) {
state->writeByte(r),
state->writeByte(g),
state->writeByte(b),
// state->writeLEBool(_renderBitmaps);
// state->writeLEBool(_renderZBitmaps);
state->endSection();
}
@ -46,8 +54,18 @@ void GfxBase::restoreState(SaveGame *state) {
g = state->readByte();
b = state->readByte();
setShadowColor(r, g ,b);
// _renderBitmaps = state->readLEBool();
// _renderZBitmaps = state->readLEBool();
state->endSection();
}
void GfxBase::renderBitmaps(bool render) {
_renderBitmaps = render;
}
void GfxBase::renderZBitmaps(bool render) {
_renderZBitmaps = render;
}
}

View File

@ -51,7 +51,7 @@ enum colorFormat {
};
class GfxBase {
public:
GfxBase() { ; }
GfxBase();
virtual ~GfxBase() { ; }
virtual byte *setupScreen(int screenW, int screenH, bool fullscreen) = 0;
@ -133,6 +133,9 @@ public:
virtual void saveState(SaveGame *state);
virtual void restoreState(SaveGame *state);
void renderBitmaps(bool render);
void renderZBitmaps(bool render);
protected:
int _screenWidth, _screenHeight, _screenBPP;
bool _isFullscreen;
@ -140,6 +143,8 @@ protected:
unsigned char _shadowColorR;
unsigned char _shadowColorG;
unsigned char _shadowColorB;
bool _renderBitmaps;
bool _renderZBitmaps;
};
// Factory-like functions:

View File

@ -689,6 +689,11 @@ void GfxOpenGL::createBitmap(BitmapData *bitmap) {
}
void GfxOpenGL::drawBitmap(const Bitmap *bitmap) {
int format = bitmap->getFormat();
if ((format == 1 && !_renderBitmaps) || (format == 5 && !_renderZBitmaps)) {
return;
}
GLuint *textures;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

View File

@ -688,6 +688,11 @@ void TinyGLBlit(byte *dst, byte *src, int x, int y, int width, int height, bool
}
void GfxTinyGL::drawBitmap(const Bitmap *bitmap) {
int format = bitmap->getFormat();
if ((format == 1 && !_renderBitmaps) || (format == 5 && !_renderZBitmaps)) {
return;
}
assert(bitmap->getCurrentImage() > 0);
if (bitmap->getFormat() == 1)
TinyGLBlit((byte *)_zb->pbuf, (byte *)bitmap->getData(bitmap->getCurrentImage() - 1),

View File

@ -277,6 +277,7 @@ void L1_SetLightIntensity();
void L1_SetLightPosition();
void L1_TurnLightOn();
void L1_RenderModeUser();
void L1_PreRender();
void L1_IrisUp();
void L1_IrisDown();
void L1_SetGamma();

View File

@ -1292,7 +1292,6 @@ STUB_FUNC(L1_SetCameraRoll)
STUB_FUNC(L1_SetCameraInterest)
STUB_FUNC(L1_GetCameraPosition)
STUB_FUNC(L1_SpewStartup)
STUB_FUNC(L1_PreRender)
STUB_FUNC(L1_PreviousSetup)
STUB_FUNC(L1_NextSetup)
STUB_FUNC(L1_WorldToScreen)

View File

@ -556,4 +556,9 @@ void L1_IrisDown() {
g_grim->playIrisAnimation(Iris::Close, (int)lua_getnumber(xObj), (int)lua_getnumber(yObj), (int)lua_getnumber(timeObj));
}
void L1_PreRender() {
g_driver->renderBitmaps(getbool(1));
g_driver->renderZBitmaps(getbool(2));
}
} // end of namespace Grim