Skip to content

Commit

Permalink
HOPKINS: Renaming in ScriptManager and DialogManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Feb 6, 2013
1 parent 7d40d1e commit 2e47d8f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 47 deletions.
67 changes: 33 additions & 34 deletions engines/hopkins/script.cpp
Expand Up @@ -2429,42 +2429,41 @@ int ScriptManager::handleGoto(const byte *dataP) {
}

int ScriptManager::handleIf(const byte *dataP, int a2) {
int v2;
int v3;
int v4;
int v6;
bool v7;
int v20;

v2 = a2;
LABEL_2:
v3 = v2;
do {
if (_vm->shouldQuit())
return 0; // Exiting game

++v3;
v4 = checkOpcode(dataP + 20 * v3);
if (v3 > 400)
error("Control if failed");
} while (v4 != 4); // EIF
v20 = v3;
v6 = v2;
v7 = false;
int v2 = a2;
bool loopFl;
do {
if (_vm->shouldQuit())
return 0; // Exiting game

++v6;
if (checkOpcode(dataP + 20 * v6) == 3) // IIF
v7 = true;
if (v6 > 400)
error("Control if failed ");
if (v7) {
v2 = v20;
goto LABEL_2;
}
} while (v20 != v6);
loopFl = false;
int v3 = v2;
int opcodeType;
do {
if (_vm->shouldQuit())
return 0; // Exiting game

++v3;
opcodeType = checkOpcode(dataP + 20 * v3);
if (v3 > 400)
error("Control if failed");
} while (opcodeType != 4); // EIF
v20 = v3;
int v6 = v2;
bool v7 = false;
do {
if (_vm->shouldQuit())
return 0; // Exiting game

++v6;
if (checkOpcode(dataP + 20 * v6) == 3) // IIF
v7 = true;
if (v6 > 400)
error("Control if failed ");
if (v7) {
v2 = v20;
loopFl = true;
break;
}
} while (v20 != v6);
} while (loopFl);

const byte *buf = dataP + 20 * a2;
byte oper = buf[13];
Expand Down
26 changes: 13 additions & 13 deletions engines/hopkins/talk.cpp
Expand Up @@ -770,10 +770,10 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int animId,
void TalkManager::REPONSE(int zone, int verb) {
uint16 v7;
byte *v8;
int v10;
int opcodeType;
uint16 v11;
int v12;
int v13;
int lastOpcodeResult;
bool tagFound;
bool v16;
bool loopCond;
Expand Down Expand Up @@ -836,29 +836,29 @@ void TalkManager::REPONSE(int zone, int verb) {
v7 = 0;
} while (!loopCond);
loopCond = false;
v13 = 1;
lastOpcodeResult = 1;
do {
v10 = _vm->_scriptManager.handleOpcode(ptr + 20 * v13);
opcodeType = _vm->_scriptManager.handleOpcode(ptr + 20 * lastOpcodeResult);
if (_vm->shouldQuit())
return;

if (v10 == 2)
if (opcodeType == 2)
// GOTO
v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13);
else if (v10 == 3)
lastOpcodeResult = _vm->_scriptManager.handleGoto(ptr + 20 * lastOpcodeResult);
else if (opcodeType == 3)
// IF
v13 = _vm->_scriptManager.handleIf(ptr, v13);
lastOpcodeResult = _vm->_scriptManager.handleIf(ptr, lastOpcodeResult);

if (v13 == -1)
if (lastOpcodeResult == -1)
error("Invalid IFF function");

if (v10 == 1 || v10 == 4)
if (opcodeType == 1 || opcodeType == 4)
// Already handled opcode or END IF
++v13;
else if (!v10 || v10 == 5)
++lastOpcodeResult;
else if (!opcodeType || opcodeType == 5)
// EXIT
loopCond = true;
else if (v10 == 6) {
else if (opcodeType == 6) {
// JUMP
_vm->_globals.freeMemory(ptr);
zoneObj = _vm->_objectsManager._jumpZone;
Expand Down

0 comments on commit 2e47d8f

Please sign in to comment.