[Scummvm-cvs-logs] SF.net SVN: scummvm:[45604] scummvm/trunk/engines/draci
spalek at users.sourceforge.net
spalek at users.sourceforge.net
Mon Nov 2 00:04:56 CET 2009
Revision: 45604
http://scummvm.svn.sourceforge.net/scummvm/?rev=45604&view=rev
Author: spalek
Date: 2009-11-01 23:04:56 +0000 (Sun, 01 Nov 2009)
Log Message:
-----------
Commented on loop() before refactoring.
Modified Paths:
--------------
scummvm/trunk/engines/draci/animation.h
scummvm/trunk/engines/draci/game.cpp
scummvm/trunk/engines/draci/script.cpp
Modified: scummvm/trunk/engines/draci/animation.h
===================================================================
--- scummvm/trunk/engines/draci/animation.h 2009-11-01 22:27:10 UTC (rev 45603)
+++ scummvm/trunk/engines/draci/animation.h 2009-11-01 23:04:56 UTC (rev 45604)
@@ -104,8 +104,11 @@
void markDirtyRect(Surface *surface) const;
- // Animation callbacks
-
+ // Animation callbacks. They can only do simple things, such as
+ // setting the value of some variable or stopping an animation. In
+ // particular, they cannot run sub-loops or anything like that, because
+ // the callback is called at an arbitrary time without much control
+ // over what the state of the rest of the program is.
void registerCallback(AnimationCallback callback) { _callback = callback; }
void doNothing() {}
Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp 2009-11-01 22:27:10 UTC (rev 45603)
+++ scummvm/trunk/engines/draci/game.cpp 2009-11-01 23:04:56 UTC (rev 45604)
@@ -164,6 +164,7 @@
continue;
}
+ // Call the outer loop doing all the hard job.
loop();
}
}
@@ -240,6 +241,11 @@
}
void Game::loop() {
+ // Can run both as an outer and inner loop. In both mode it updates
+ // the screen according to the timer. It the outer mode it also reacts
+ // to user events. In the inner mode, the loop runs until its stopping
+ // condition, possibly stopping earlier if the user interrupts it,
+ // however no other user intervention is allowed.
Surface *surface = _vm->_screen->getSurface();
do {
@@ -838,6 +844,8 @@
_oldObjUnderCursor = kObjectNotFound;
if (_dialogueLinesNum > 1) {
+ // Call the game loop to enable interactivity until the user
+ // selects his choice.
_vm->_mouse->cursorOn();
setExitLoop(false);
loop();
Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp 2009-11-01 22:27:10 UTC (rev 45603)
+++ scummvm/trunk/engines/draci/script.cpp 2009-11-01 23:04:56 UTC (rev 45604)
@@ -357,6 +357,8 @@
return;
}
+ // Runs just one phase of the loop and exits. Used when waiting for a
+ // particular animation phase to come.
_vm->_game->setLoopSubstatus(kSubstatusStrange);
_vm->_game->setExitLoop(true);
_vm->_game->loop();
@@ -469,6 +471,7 @@
_vm->_anims->play(animID);
}
+ // Runs an inner loop until the animation ends.
_vm->_game->loop();
_vm->_game->setExitLoop(false);
_vm->_anims->stop(animID);
@@ -675,6 +678,7 @@
SightDirection dir = static_cast<SightDirection> (params.pop());
// HACK: This should be an onDest action when hero walking is properly implemented
+ // For now, we just go throught the loop-body once to redraw the screen.
_vm->_game->setExitLoop(true);
_vm->_game->walkHero(x, y, dir);
@@ -776,7 +780,7 @@
// "exit immediately" state
_vm->_game->setExitLoop(false);
- // Call the game loop to enable interactivity until the text expires
+ // Call the game loop to enable interactivity until the text expires.
_vm->_game->loop();
// Delete the text
@@ -871,6 +875,10 @@
params.pop(); // unused first and last
params.pop();
int phases = params.pop();
+
+ // Let the palette fade in the background while the game continues.
+ // Since we don't set substatus to kSubstatusFade, the outer loop will
+ // just continue rather than exit.
_vm->_game->initializeFading(phases);
}
@@ -880,6 +888,7 @@
int phases = params.pop();
_vm->_game->initializeFading(phases);
+ // Call the game loop to enable interactivity until the fading is done.
_vm->_game->setLoopSubstatus(kSubstatusFade);
_vm->_game->loop();
_vm->_game->setExitLoop(false);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list