added store/restore display buffer
This commit is contained in:
parent
d2a4376c73
commit
80f7bc8e2a
7 changed files with 13 additions and 43 deletions
3
driver.h
3
driver.h
|
@ -84,7 +84,7 @@ public:
|
||||||
|
|
||||||
virtual Bitmap *getScreenshot(int w, int h) = 0;
|
virtual Bitmap *getScreenshot(int w, int h) = 0;
|
||||||
virtual void storeDisplay() = 0;
|
virtual void storeDisplay() = 0;
|
||||||
virtual void flushStoredDisplay() = 0;
|
virtual void copyStoredToDisplay() = 0;
|
||||||
virtual void enableDim(int x, int y, int w, int h) = 0;
|
virtual void enableDim(int x, int y, int w, int h) = 0;
|
||||||
virtual void disableDim(int x, int y, int w, int h) = 0;
|
virtual void disableDim(int x, int y, int w, int h) = 0;
|
||||||
|
|
||||||
|
@ -104,7 +104,6 @@ protected:
|
||||||
int _screenWidth, _screenHeight, _screenBPP;
|
int _screenWidth, _screenHeight, _screenBPP;
|
||||||
bool _isFullscreen;
|
bool _isFullscreen;
|
||||||
bool _dim;
|
bool _dim;
|
||||||
byte *_storedDisplay;
|
|
||||||
|
|
||||||
virtual void drawDim() = 0;
|
virtual void drawDim() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,6 @@ DriverGL::DriverGL(int screenW, int screenH, int screenBPP, bool fullscreen) {
|
||||||
loadEmergFont();
|
loadEmergFont();
|
||||||
|
|
||||||
_smushNumTex = 0;
|
_smushNumTex = 0;
|
||||||
_storedDisplay = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverGL::toggleFullscreenMode() {
|
void DriverGL::toggleFullscreenMode() {
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
Bitmap *getScreenshot(int w, int h);
|
Bitmap *getScreenshot(int w, int h);
|
||||||
void storeDisplay() {}
|
void storeDisplay() {}
|
||||||
void flushStoredDisplay() {}
|
void copyStoredToDisplay() {}
|
||||||
void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
|
void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
|
||||||
void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
|
void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
|
||||||
|
|
||||||
|
|
|
@ -108,10 +108,12 @@ DriverTinyGL::DriverTinyGL(int screenW, int screenH, int screenBPP, bool fullscr
|
||||||
_zb = ZB_open(screenW, screenH, ZB_MODE_5R6G5B, 0, NULL, NULL, _screen->pixels);
|
_zb = ZB_open(screenW, screenH, ZB_MODE_5R6G5B, 0, NULL, NULL, _screen->pixels);
|
||||||
tglInit(_zb);
|
tglInit(_zb);
|
||||||
|
|
||||||
_storedDisplay = NULL;
|
_storedDisplay = new byte[640 * 480 * 2];
|
||||||
|
memset(_storedDisplay, 0, 640 * 480 * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverTinyGL::~DriverTinyGL() {
|
DriverTinyGL::~DriverTinyGL() {
|
||||||
|
delete []_storedDisplay;
|
||||||
tglClose();
|
tglClose();
|
||||||
ZB_close(_zb);
|
ZB_close(_zb);
|
||||||
}
|
}
|
||||||
|
@ -490,14 +492,11 @@ Bitmap *DriverTinyGL::getScreenshot(int w, int h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverTinyGL::storeDisplay() {
|
void DriverTinyGL::storeDisplay() {
|
||||||
_storedDisplay = new byte[640 * 480 * 2];
|
|
||||||
assert(_storedDisplay);
|
|
||||||
memcpy(_storedDisplay, _zb->pbuf, 640 * 480 * 2);
|
memcpy(_storedDisplay, _zb->pbuf, 640 * 480 * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverTinyGL::flushStoredDisplay() {
|
void DriverTinyGL::copyStoredToDisplay() {
|
||||||
delete []_storedDisplay;
|
memcpy(_zb->pbuf, _storedDisplay, 640 * 480 * 2);
|
||||||
_storedDisplay = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriverTinyGL::drawDim() {
|
void DriverTinyGL::drawDim() {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
|
|
||||||
Bitmap *getScreenshot(int w, int h);
|
Bitmap *getScreenshot(int w, int h);
|
||||||
void storeDisplay();
|
void storeDisplay();
|
||||||
void flushStoredDisplay();
|
void copyStoredToDisplay();
|
||||||
void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
|
void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
|
||||||
void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
|
void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ private:
|
||||||
byte *_smushBitmap;
|
byte *_smushBitmap;
|
||||||
int _smushWidth;
|
int _smushWidth;
|
||||||
int _smushHeight;
|
int _smushHeight;
|
||||||
|
byte *_storedDisplay;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -270,6 +270,8 @@ void Engine::updateDisplayScene() {
|
||||||
// The overlay objects should be drawn on top of everything else,
|
// The overlay objects should be drawn on top of everything else,
|
||||||
// including 3D objects such as Manny and the message tube
|
// including 3D objects such as Manny and the message tube
|
||||||
_currScene->drawBitmaps(ObjectState::OBJSTATE_OVERLAY);
|
_currScene->drawBitmaps(ObjectState::OBJSTATE_OVERLAY);
|
||||||
|
|
||||||
|
g_driver->storeDisplay();
|
||||||
} else if (_mode == ENGINE_MODE_DRAW) {
|
} else if (_mode == ENGINE_MODE_DRAW) {
|
||||||
if (_refreshDrawNeeded) {
|
if (_refreshDrawNeeded) {
|
||||||
lua_beginblock();
|
lua_beginblock();
|
||||||
|
|
34
lua.cpp
34
lua.cpp
|
@ -2261,10 +2261,6 @@ void getTextObjectParams(TextObject *textObject, lua_Object table_obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean the buffer of text objects and primitives
|
|
||||||
* this is known to be used when changing between menus
|
|
||||||
* and when loading some cutscenes
|
|
||||||
*/
|
|
||||||
static void CleanBuffer() {
|
static void CleanBuffer() {
|
||||||
DEBUG_FUNCTION();
|
DEBUG_FUNCTION();
|
||||||
g_engine->killPrimitiveObjects();
|
g_engine->killPrimitiveObjects();
|
||||||
|
@ -2272,36 +2268,9 @@ static void CleanBuffer() {
|
||||||
// Cleanup references to deleted text objects
|
// Cleanup references to deleted text objects
|
||||||
for (Engine::ActorListType::const_iterator i = g_engine->actorsBegin(); i != g_engine->actorsEnd(); i++)
|
for (Engine::ActorListType::const_iterator i = g_engine->actorsBegin(); i != g_engine->actorsEnd(); i++)
|
||||||
(*i)->lineCleanup();
|
(*i)->lineCleanup();
|
||||||
|
//g_driver->copyStoredToDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check to see if the menu item at a specific index has
|
|
||||||
* the "disabled" flag set
|
|
||||||
*/
|
|
||||||
bool itemDisabled(lua_Object itemTable, int menuItem) {
|
|
||||||
lua_Object table = getTableValue(itemTable, "items");
|
|
||||||
lua_Object item = getIndexedTableValue(table, menuItem);
|
|
||||||
lua_Object itemdata = getTableValue(item, "props");
|
|
||||||
lua_Object disabled = getTableValue(itemdata, "disabled");
|
|
||||||
|
|
||||||
if (!lua_isnil(disabled) && atoi(lua_getstring(disabled)) == 1)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the text representing an item in the menu
|
|
||||||
*/
|
|
||||||
char *itemText(lua_Object itemTable, int menuItem) {
|
|
||||||
lua_Object table = getTableValue(itemTable, "items");
|
|
||||||
lua_Object item = getIndexedTableValue(table, menuItem);
|
|
||||||
lua_Object itemtext = getTableValue(item, "text");
|
|
||||||
|
|
||||||
if (!lua_isnil(itemtext) && lua_isstring(itemtext))
|
|
||||||
return lua_getstring(itemtext);
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function sends the SDL signal to
|
/* This function sends the SDL signal to
|
||||||
* go ahead and exit the game
|
* go ahead and exit the game
|
||||||
*/
|
*/
|
||||||
|
@ -2958,6 +2927,7 @@ static void RenderModeUser() {
|
||||||
g_smush->pause(false);
|
g_smush->pause(false);
|
||||||
g_engine->refreshDrawMode();
|
g_engine->refreshDrawMode();
|
||||||
g_engine->setMode(g_engine->getPreviousMode());
|
g_engine->setMode(g_engine->getPreviousMode());
|
||||||
|
CleanBuffer();
|
||||||
} else {
|
} else {
|
||||||
error("RenderModeUser() Unknown type of param");
|
error("RenderModeUser() Unknown type of param");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue