[Scummvm-cvs-logs] SF.net SVN: scummvm:[49513] scummvm/trunk/engines/sci/engine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Jun 8 20:44:27 CEST 2010
Revision: 49513
http://scummvm.svn.sourceforge.net/scummvm/?rev=49513&view=rev
Author: thebluegr
Date: 2010-06-08 18:44:27 +0000 (Tue, 08 Jun 2010)
Log Message:
-----------
Merged _game_run() inside game_run(). Some cleanup
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kevent.cpp
scummvm/trunk/engines/sci/engine/vm.cpp
scummvm/trunk/engines/sci/engine/vm.h
Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp 2010-06-08 18:23:38 UTC (rev 49512)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp 2010-06-08 18:44:27 UTC (rev 49513)
@@ -79,7 +79,9 @@
switch (curEvent.type) {
case SCI_EVENT_QUIT:
- quit_vm(s);
+ s->script_abort_flag = 1; // Terminate VM
+ g_debugState.seeking = kDebugSeekNothing;
+ g_debugState.runningStep = 0;
break;
case SCI_EVENT_KEYBOARD:
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2010-06-08 18:23:38 UTC (rev 49512)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-06-08 18:44:27 UTC (rev 49513)
@@ -1687,17 +1687,31 @@
s->stack_base[1] = NULL_REG;
}
-static EngineState *_game_run(EngineState *&s) {
- bool restoring = false;
+void game_run(EngineState **_s) {
+ EngineState *s = *_s;
+ debugC(2, kDebugLevelVM, "Calling %s::play()", g_sci->getGameID());
+ _init_stack_base_with_selector(s, g_sci->getKernel()->_selectorCache.play); // Call the play selector
+
+ // Now: Register the first element on the execution stack
+ if (!send_selector(s, s->_gameObj, s->_gameObj, s->stack_base, 2, s->stack_base)) {
+ g_sci->getSciDebugger()->printObject(s->_gameObj);
+ error("Failed to run the game! Aborting...");
+ return;
+ }
+
+ // and ENGAGE!
+
+ // Attach the debug console on game startup, if requested
if (DebugMan.isDebugChannelEnabled(kDebugLevelOnStartup))
g_sci->getSciDebugger()->attach();
do {
s->_executionStackPosChanged = false;
- run_vm(s, restoring);
+ run_vm(s, s->restoring);
+
if (s->restarting_flags & SCI_GAME_IS_RESTARTING_NOW) { // Restart was requested?
- restoring = false;
+ s->restoring = false;
s->_executionStack.clear();
s->_executionStackPosChanged = false;
@@ -1715,8 +1729,7 @@
s->restarting_flags = SCI_GAME_WAS_RESTARTED;
} else {
- restoring = s->restoring;
- if (restoring) {
+ if (s->restoring) {
game_exit(s);
s->restoring = false;
if (s->script_abort_flag == 2) {
@@ -1735,36 +1748,9 @@
}
} while (true);
- return s;
-}
-
-int game_run(EngineState **_s) {
- EngineState *s = *_s;
-
- debugC(2, kDebugLevelVM, "Calling %s::play()", g_sci->getGameID());
- _init_stack_base_with_selector(s, g_sci->getKernel()->_selectorCache.play); // Call the play selector
-
- // Now: Register the first element on the execution stack-
- if (!send_selector(s, s->_gameObj, s->_gameObj, s->stack_base, 2, s->stack_base)) {
- Console *con = g_sci->getSciDebugger();
- con->printObject(s->_gameObj);
- warning("Failed to run the game! Aborting...");
- return 1;
- }
- // and ENGAGE!
- _game_run(*_s);
-
debugC(2, kDebugLevelVM, "Game::play() finished.");
-
- return 0;
}
-void quit_vm(EngineState *s) {
- s->script_abort_flag = 1; // Terminate VM
- g_debugState.seeking = kDebugSeekNothing;
- g_debugState.runningStep = 0;
-}
-
reg_t *ObjVarRef::getPointer(SegManager *segMan) const {
Object *o = segMan->getObject(obj);
return o ? &o->getVariableRef(varindex) : 0;
Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h 2010-06-08 18:23:38 UTC (rev 49512)
+++ scummvm/trunk/engines/sci/engine/vm.h 2010-06-08 18:44:27 UTC (rev 49513)
@@ -375,9 +375,8 @@
* Note that, EngineState *s may be changed during the game, e.g. if a game
* state is restored.
* @param[in] s Pointer to the pointer of the state to operate on
- * @return 0 on success, 1 if an error occured.
- */
-int game_run(EngineState **s);
+ */
+void game_run(EngineState **s);
/**
* Restores an SCI game state and runs the game
@@ -398,11 +397,6 @@
int game_exit(EngineState *s);
/**
- * Instructs the virtual machine to abort
- */
-void quit_vm(EngineState *s);
-
-/**
* Read a PMachine instruction from a memory buffer and return its length.
*
* @param[in] src address from which to start parsing
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