[Scummvm-cvs-logs] scummvm master -> 839ac0a6a45b269cbcf33654d76edfa3d36a297f
m-kiewitz
m_kiewitz at users.sourceforge.net
Mon Feb 1 16:20:09 CET 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
839ac0a6a4 AGI: Rename _game.lognum to _game.curLogicNr
Commit: 839ac0a6a45b269cbcf33654d76edfa3d36a297f
https://github.com/scummvm/scummvm/commit/839ac0a6a45b269cbcf33654d76edfa3d36a297f
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-01T16:21:13+01:00
Commit Message:
AGI: Rename _game.lognum to _game.curLogicNr
Also a bit of cleanup
Changed paths:
engines/agi/agi.h
engines/agi/console.cpp
engines/agi/op_cmd.cpp
engines/agi/saveload.cpp
engines/agi/text.cpp
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index e7ca9d3..fc73c58 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -439,7 +439,7 @@ struct AgiGame {
uint16 specialMenuTriggerKey; /**< key to trigger menu for platforms except PC */
- int lognum; /**< current logic number */
+ int16 curLogicNr; /**< current logic number */
Common::Array<ScriptPos> execStack;
// internal flags
@@ -866,7 +866,7 @@ private:
public:
int decodeLogic(int16 logicNr);
void unloadLogic(int16 logicNr);
- int runLogic(int);
+ int runLogic(int16 logicNr);
void debugConsole(int, int, const char *);
int testIfCode(int);
void executeAgiCommand(uint8, uint8 *);
diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp
index 0e2101c..c5f657b 100644
--- a/engines/agi/console.cpp
+++ b/engines/agi/console.cpp
@@ -391,7 +391,7 @@ bool Console::Cmd_Room(int argc, const char **argv) {
}
bool Console::Cmd_BT(int argc, const char **argv) {
- debugPrintf("Current script: %d\nStack depth: %d\n", _vm->_game.lognum, _vm->_game.execStack.size());
+ debugPrintf("Current script: %d\nStack depth: %d\n", _vm->_game.curLogicNr, _vm->_game.execStack.size());
uint8 *code = NULL;
uint8 op = 0;
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 3636f31..e0c03d6 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1123,12 +1123,12 @@ void cmdCall(AgiGame *state, uint8 *parameter) {
// CM: we don't save sIP because set.scan.start can be
// used in a called script (fixes xmas demo)
oldCIP = state->_curLogic->cIP;
- oldLognum = state->lognum;
+ oldLognum = state->curLogicNr;
state->_vm->runLogic(logicNr);
- state->lognum = oldLognum;
- state->_curLogic = &state->logics[state->lognum];
+ state->curLogicNr = oldLognum;
+ state->_curLogic = &state->logics[state->curLogicNr];
state->_curLogic->cIP = oldCIP;
}
@@ -2355,7 +2355,7 @@ void cmdUnknown(AgiGame *state, uint8 *parameter) {
* Execute a logic script
* @param n Number of the logic resource to execute
*/
-int AgiEngine::runLogic(int n) {
+int AgiEngine::runLogic(int16 logicNr) {
AgiGame *state = &_game;
uint8 op = 0;
uint8 p[CMD_BSIZE] = { 0 };
@@ -2367,24 +2367,24 @@ int AgiEngine::runLogic(int n) {
state->max_logics = 0;
debugC(2, kDebugLevelScripts, "=================");
- debugC(2, kDebugLevelScripts, "runLogic(%d)", n);
+ debugC(2, kDebugLevelScripts, "runLogic(%d)", logicNr);
- sp.script = n;
+ sp.script = logicNr;
sp.curIP = 0;
_game.execStack.push_back(sp);
// If logic not loaded, load it
- if (~_game.dirLogic[n].flags & RES_LOADED) {
- debugC(4, kDebugLevelScripts, "logic %d not loaded!", n);
- agiLoadResource(RESOURCETYPE_LOGIC, n);
+ if (~_game.dirLogic[logicNr].flags & RES_LOADED) {
+ debugC(4, kDebugLevelScripts, "logic %d not loaded!", logicNr);
+ agiLoadResource(RESOURCETYPE_LOGIC, logicNr);
}
- _game.lognum = n;
- _game._curLogic = &_game.logics[_game.lognum];
+ _game.curLogicNr = logicNr;
+ _game._curLogic = &_game.logics[_game.curLogicNr];
_game._curLogic->cIP = _game._curLogic->sIP;
- while (state->_curLogic->cIP < _game.logics[n].size && !(shouldQuit() || _restartGame)) {
+ while (state->_curLogic->cIP < _game.logics[logicNr].size && !(shouldQuit() || _restartGame)) {
// TODO: old code, needs to be adjusted
#if 0
if (_debug.enabled) {
@@ -2413,14 +2413,14 @@ int AgiEngine::runLogic(int n) {
switch (op = *(state->_curLogic->data + state->_curLogic->cIP++)) {
case 0xff: // if (open/close)
- testIfCode(n);
+ testIfCode(logicNr);
break;
case 0xfe: // goto
// +2 covers goto size
state->_curLogic->cIP += 2 + ((int16)READ_LE_UINT16(state->_curLogic->data + state->_curLogic->cIP));
break;
case 0x00: // return
- debugC(2, kDebugLevelScripts, "%sreturn() // Logic %d", st, n);
+ debugC(2, kDebugLevelScripts, "%sreturn() // Logic %d", st, logicNr);
debugC(2, kDebugLevelScripts, "=================");
// if (getVersion() < 0x2000) {
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 3d67db7..e711390 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -148,7 +148,7 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
out->writeSint16BE((int16)_text->getWindowRowMin());
out->writeSint16BE((int16)_game.inputMode);
- out->writeSint16BE((int16)_game.lognum);
+ out->writeSint16BE((int16)_game.curLogicNr);
out->writeSint16BE((int16)_game.playerControl);
out->writeSint16BE((int16)shouldQuit());
@@ -473,7 +473,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
_game.inputMode = INPUTMODE_NORMAL;
}
- _game.lognum = in->readSint16BE();
+ _game.curLogicNr = in->readSint16BE();
_game.playerControl = in->readSint16BE();
if (in->readSint16BE())
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index c6c0f93..34dd4a9 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -976,7 +976,7 @@ char *TextMgr::stringPrintf(const char *originalText) {
Common::String resultString;
char z[16];
- debugC(3, kDebugLevelText, "logic %d, '%s'", _vm->_game.lognum, originalText);
+ debugC(3, kDebugLevelText, "logic %d, '%s'", _vm->_game.curLogicNr, originalText);
while (*originalText) {
switch (*originalText) {
@@ -1026,8 +1026,8 @@ char *TextMgr::stringPrintf(const char *originalText) {
break;
case 'm':
i = strtoul(originalText, NULL, 10) - 1;
- if (_vm->_game.logics[_vm->_game.lognum].numTexts > i)
- safeStrcat(resultString, stringPrintf(_vm->_game.logics[_vm->_game.lognum].texts[i]));
+ if (_vm->_game.logics[_vm->_game.curLogicNr].numTexts > i)
+ safeStrcat(resultString, stringPrintf(_vm->_game.logics[_vm->_game.curLogicNr].texts[i]));
break;
}
More information about the Scummvm-git-logs
mailing list