From 4c3a68027f7f84a58664f77c847d24ab5b9757e4 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 17 Mar 2004 09:03:15 +0000 Subject: 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 --- sword2/function.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sword2/function.cpp') diff --git a/sword2/function.cpp b/sword2/function.cpp index 831411691c..2f95fd564b 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -58,7 +58,7 @@ int32 Logic::fnNewScript(int32 *params) { // params: 0 id of script // must clear this - PLAYER_ACTION = 0; + _scriptVars[PLAYER_ACTION] = 0; logicReplace(params[0]); return IR_TERMINATE; @@ -72,7 +72,7 @@ int32 Logic::fnInteract(int32 *params) { // reference // must clear this - PLAYER_ACTION = 0; + _scriptVars[PLAYER_ACTION] = 0; // 3rd script of clicked on id logicUp((params[0] < 16) + 2); @@ -127,12 +127,12 @@ int32 Logic::fnRelease(int32 *params) { int32 Logic::fnRandom(int32 *params) { // Generates a random number between 'min' & 'max' inclusive, and - // sticks it in the script flag 'result' + // sticks it in _scriptVars[RESULT] // params: 0 min // 1 max - RESULT = _vm->_rnd.getRandomNumberRng(params[0], params[1]); + _scriptVars[RESULT] = _vm->_rnd.getRandomNumberRng(params[0], params[1]); return IR_CONT; } @@ -176,7 +176,7 @@ int32 Logic::fnRandomPause(int32 *params) { pars[1] = params[2]; fnRandom(pars); - pars[1] = RESULT; + pars[1] = _scriptVars[RESULT]; } pars[0] = params[0]; @@ -396,7 +396,7 @@ int32 Logic::fnPlayCredits(int32 *params) { // params: none - if (DEMO) { + if (_scriptVars[DEMO]) { _vm->closeGame(); return IR_STOP; } @@ -619,7 +619,7 @@ int32 Logic::fnPlayCredits(int32 *params) { // credits. Note that musicTimeRemaining() will return 0 if the music // is muted, so we need a sensible fallback for that case. - uint32 musicLength = MAX((int32)(1000 * (_vm->_sound->musicTimeRemaining() - 3)), 25 * (int32)scrollSteps); + uint32 musicLength = MAX((int32) (1000 * (_vm->_sound->musicTimeRemaining() - 3)), 25 * (int32) scrollSteps); while (scrollPos < scrollSteps && !_vm->_quit) { bool foundStartLine = false; @@ -734,7 +734,7 @@ int32 Logic::fnPlayCredits(int32 *params) { if (!_vm->_mouseStatus || _choosing) _vm->setMouse(NORMAL_MOUSE_ID); - if (DEAD) + if (_scriptVars[DEAD]) _vm->buildSystemMenu(); return IR_CONT; -- cgit v1.2.3