aboutsummaryrefslogtreecommitdiff
path: root/sword2/walker.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-03-17 09:03:15 +0000
committerTorbjörn Andersson2004-03-17 09:03:15 +0000
commit4c3a68027f7f84a58664f77c847d24ab5b9757e4 (patch)
treebf20e888b9ea1cc2045df84aad12ef1cd54ec7de /sword2/walker.cpp
parent03200025dfb030d887ff9b07d180a8f9e2f225bc (diff)
downloadscummvm-rg350-4c3a68027f7f84a58664f77c847d24ab5b9757e4.tar.gz
scummvm-rg350-4c3a68027f7f84a58664f77c847d24ab5b9757e4.tar.bz2
scummvm-rg350-4c3a68027f7f84a58664f77c847d24ab5b9757e4.zip
Use the same syntax for accessing script variables as BS1 does, i.e. now
it's Logic::_scriptVars[ID] instead of just ID. Apart from looking cool, it makes it much easier to tell the difference between variables and constants when looking at the code. Of course, this sort of sweeping changes is jolly good for introducing truly weird regressions, which is why I waited until after 0.6.0. svn-id: r13331
Diffstat (limited to 'sword2/walker.cpp')
-rw-r--r--sword2/walker.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/sword2/walker.cpp b/sword2/walker.cpp
index df6206b992..13485b5da2 100644
--- a/sword2/walker.cpp
+++ b/sword2/walker.cpp
@@ -78,7 +78,8 @@ int32 Logic::fnWalk(int32 *params) {
// anim.
if (ob_mega->feet_x == target_x && ob_mega->feet_y == target_y && ob_mega->current_dir == target_dir) {
- RESULT = 0; // 0 means ok - finished walk
+ // 0 means ok - finished walk
+ _scriptVars[RESULT] = 0;
return IR_CONT; // may as well continue the script
}
@@ -119,7 +120,7 @@ int32 Logic::fnWalk(int32 *params) {
_router->freeRouteMem();
// 1 means error, no walk created
- RESULT = 1;
+ _scriptVars[RESULT] = 1;
// may as well continue the script
return IR_CONT;
@@ -129,7 +130,7 @@ int32 Logic::fnWalk(int32 *params) {
// resource
ob_graph->anim_resource = ob_mega->megaset_res;
- } else if (EXIT_FADING && _vm->_graphics->getFadeStatus() == RDFADE_BLACK) {
+ } else if (_scriptVars[EXIT_FADING] && _vm->_graphics->getFadeStatus() == RDFADE_BLACK) {
// double clicked an exit so quit the walk when screen is black
// ok, thats it - back to script and change screen
@@ -139,18 +140,18 @@ int32 Logic::fnWalk(int32 *params) {
// must clear in-case on the new screen there's a walk
// instruction (which would get cut short)
- EXIT_CLICK_ID = 0;
+ _scriptVars[EXIT_CLICK_ID] = 0;
// this will be reset when we change screens, so we can use
// it in script to check if a 2nd-click came along
- // EXIT_FADING = 0;
+ // _scriptVars[EXIT_FADING] = 0;
// finished walk
ob_mega->currently_walking = 0;
// (see fnGetPlayerSaveData() in save_rest.cpp
- RESULT = 0; // 0 means ok
+ _scriptVars[RESULT] = 0; // 0 means ok
// continue the script so that RESULT can be checked!
return IR_CONT;
@@ -206,10 +207,12 @@ int32 Logic::fnWalk(int32 *params) {
if (checkEventWaiting()) {
startEvent();
- RESULT = 1; // 1 means didn't finish walk
+ // 1 means didn't finish walk
+ _scriptVars[RESULT] = 1;
return IR_TERMINATE;
} else {
- RESULT = 0; // 0 means ok - finished walk
+ // 0 means ok - finished walk
+ _scriptVars[RESULT] = 0;
// CONTINUE the script so that RESULT can be checked!
// Also, if an anim command follows the fnWalk command,
@@ -724,7 +727,7 @@ int32 Logic::fnAddWalkGrid(int32 *params) {
// re-enter a location
// DON'T EVER KILL GEORGE!
- if (ID != 8) {
+ if (_scriptVars[ID] != 8) {
// need to call this in case it wasn't called in script!
// ('params' just used as dummy param)
fnAddToKillList(params);