[Scummvm-cvs-logs] CVS: scummvm/sword1 screen.cpp,1.33,1.34 screen.h,1.13,1.14 sword1.cpp,1.34,1.35
Robert G?ffringmann
lavosspawn at users.sourceforge.net
Wed Jan 7 11:10:01 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword1 menu.cpp,1.18,1.19 mouse.cpp,1.20,1.21 screen.cpp,1.32,1.33 screen.h,1.12,1.13
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv23156/sword1
Modified Files:
screen.cpp screen.h sword1.cpp
Log Message:
implemented drawing of additional scrolling frames
Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- screen.cpp 7 Jan 2004 19:03:29 -0000 1.33
+++ screen.cpp 7 Jan 2004 19:08:59 -0000 1.34
@@ -119,6 +119,21 @@
return (_fadingStep != 0);
}
+bool SwordScreen::showScrollFrame(void) {
+ if ((!_fullRefresh) || SwordLogic::_scriptVars[NEW_PALETTE] || (!SwordLogic::_scriptVars[SCROLL_FLAG]))
+ return false; // don't draw an additional frame if we aren't scrolling or have to change the palette
+ if ((_oldScrollX == SwordLogic::_scriptVars[SCROLL_OFFSET_X]) &&
+ (_oldScrollY == SwordLogic::_scriptVars[SCROLL_OFFSET_Y]))
+ return false; // check again if we *really* are scrolling.
+
+ uint16 avgScrlX = (uint16)(_oldScrollX + SwordLogic::_scriptVars[SCROLL_OFFSET_X]) / 2;
+ uint16 avgScrlY = (uint16)(_oldScrollY + SwordLogic::_scriptVars[SCROLL_OFFSET_Y]) / 2;
+
+ _system->copy_rect(_screenBuf + avgScrlY * _scrnSizeX + avgScrlX, _scrnSizeX, 0, 40, SCREEN_WIDTH, SCREEN_DEPTH);
+ _system->update_screen();
+ return true;
+}
+
void SwordScreen::updateScreen(void) {
if (SwordLogic::_scriptVars[NEW_PALETTE]) {
_fadingStep = 1;
@@ -653,7 +668,9 @@
void SwordScreen::fadePalette(void) {
if (_fadingStep == 16)
memcpy(_currentPalette, _targetPalette, 256 * 4);
- else
+ else if ((_fadingStep == 1) && (_fadingDirection == FADE_DOWN)) {
+ memset(_currentPalette, 0, 4 * 256);
+ } else
for (uint16 cnt = 0; cnt < 256 * 4; cnt++)
_currentPalette[cnt] = (_targetPalette[cnt] * _fadingStep) >> 4;
Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- screen.h 7 Jan 2004 19:03:30 -0000 1.13
+++ screen.h 7 Jan 2004 19:08:59 -0000 1.14
@@ -80,6 +80,7 @@
bool stillFading(void);
void fullRefresh(void);
+ bool showScrollFrame(void);
void updateScreen(void);
void showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, const byte *fadeMask = NULL, int8 fadeStatus = 0);
Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- sword1.cpp 7 Jan 2004 17:47:46 -0000 1.34
+++ sword1.cpp 7 Jan 2004 19:08:59 -0000 1.35
@@ -1119,6 +1119,7 @@
uint8 SwordEngine::mainLoop(void) {
uint8 retCode = 0;
+ _keyPressed = 0;
while (retCode == 0) {
// do we need the section45-hack from sword.c here?
@@ -1130,6 +1131,9 @@
SwordLogic::_scriptVars[SCREEN] = SwordLogic::_scriptVars[NEW_SCREEN];
do {
+ uint32 newTime;
+ bool scrollFrameShown = false;
+
uint32 frameTime = _system->get_msecs();
_logic->engine();
_logic->updateScreenParams(); // sets scrolling
@@ -1138,15 +1142,24 @@
_mouse->animate();
_sound->engine();
- _screen->updateScreen();
-
_menu->refresh(MENU_TOP);
_menu->refresh(MENU_BOT);
- uint32 newTime = _system->get_msecs();
+ newTime = _system->get_msecs();
+ if (newTime - frameTime < 1000 / FRAME_RATE) {
+ scrollFrameShown = _screen->showScrollFrame();
+ int32 restDelay = (1000 / (FRAME_RATE * 2)) - (_system->get_msecs() - frameTime);
+ if (restDelay > 0)
+ delay((uint)restDelay);
+ }
- if (newTime - frameTime < 80)
- delay(80 - (newTime - frameTime));
+ newTime = _system->get_msecs();
+ if ((newTime - frameTime < 1000 / FRAME_RATE) || (!scrollFrameShown))
+ _screen->updateScreen();
+
+ int32 frameDelay = (1000 / FRAME_RATE) - (_system->get_msecs() - frameTime);
+ if (frameDelay > 0)
+ delay((uint)frameDelay);
else
delay(0);
@@ -1160,6 +1173,7 @@
if (!retCode)
_screen->fullRefresh();
}
+ _keyPressed = 0;
// do something smart here to implement pausing the game. If we even want that, that is.
} while ((SwordLogic::_scriptVars[SCREEN] == SwordLogic::_scriptVars[NEW_SCREEN]) && (retCode == 0));
@@ -1185,7 +1199,6 @@
uint32 start = _system->get_msecs();
uint32 cur = start;
- _keyPressed = 0;
do {
while (_system->poll_event(&event)) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sword1 menu.cpp,1.18,1.19 mouse.cpp,1.20,1.21 screen.cpp,1.32,1.33 screen.h,1.12,1.13
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list