aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-10-19 22:51:37 +0000
committerMax Horn2009-10-19 22:51:37 +0000
commit03953bf2925240401677cbda428209fd4b49c54a (patch)
tree88aae68e20a24de12f45d8c55e44cbbda40befb3 /engines
parentebff7dbb1a5d1846a91f8862c0f8e655553e37ad (diff)
downloadscummvm-rg350-03953bf2925240401677cbda428209fd4b49c54a.tar.gz
scummvm-rg350-03953bf2925240401677cbda428209fd4b49c54a.tar.bz2
scummvm-rg350-03953bf2925240401677cbda428209fd4b49c54a.zip
AGI: Remove some global vars
svn-id: r45255
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/op_cmd.cpp21
-rw-r--r--engines/agi/op_dbg.cpp8
2 files changed, 10 insertions, 19 deletions
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 1034d5d8c4..d6c8f14400 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -23,7 +23,6 @@
*
*/
-
#include "base/version.h"
#include "agi/agi.h"
@@ -46,7 +45,6 @@ namespace Agi {
#define game g_agi->_game
#define g_sprites g_agi->_sprites
#define g_sound g_agi->_sound
-#define g_text g_agi->_text
#define g_gfx g_agi->_gfx
#define g_picture g_agi->_picture
@@ -55,12 +53,11 @@ namespace Agi {
#define vt_v game.viewTable[game.vars[p0]]
static struct AgiLogic *curLogic;
-static AgiEngine *g_agi;
int timerHack; // Workaround for timer loop in MH1
#define _v game.vars
-#define cmd(x) static void cmd_##x (uint8 *p)
+#define cmd(x) static void cmd_##x (AgiEngine *g_agi, uint8 *p)
cmd(increment) {
if (_v[p0] != 0xff)
@@ -622,7 +619,7 @@ cmd(set_simple) {
// Show the picture. Similar to cmd(show_pic).
g_agi->setflag(fOutputMode, false);
- cmd_close_window(NULL);
+ cmd_close_window(g_agi, NULL);
g_picture->showPic();
game.pictureShown = 1;
@@ -747,7 +744,7 @@ cmd(call) {
}
cmd(call_f) {
- cmd_call(&_v[p0]);
+ cmd_call(g_agi, &_v[p0]);
}
cmd(draw_pic) {
@@ -781,7 +778,7 @@ cmd(show_pic) {
debugC(6, kDebugLevelScripts, "=== show pic ===");
g_agi->setflag(fOutputMode, false);
- cmd_close_window(NULL);
+ cmd_close_window(g_agi, NULL);
g_picture->showPic();
game.pictureShown = 1;
@@ -1586,7 +1583,7 @@ cmd(shake_screen) {
game.inputEnabled = originalValue;
}
-static void (*agiCommand[183])(uint8 *) = {
+static void (*agiCommand[183])(AgiEngine *, uint8 *) = {
NULL, // 0x00
cmd_increment,
cmd_decrement,
@@ -1780,7 +1777,6 @@ int AgiEngine::runLogic(int n) {
uint8 op = 0;
uint8 p[CMD_BSIZE] = { 0 };
uint8 *code = NULL;
- g_agi = this;
int num = 0;
ScriptPos sp;
@@ -1795,7 +1791,7 @@ int AgiEngine::runLogic(int n) {
}
_game.lognum = n;
- curLogic = &_game.logics[game.lognum];
+ curLogic = &_game.logics[_game.lognum];
code = curLogic->data;
curLogic->cIP = curLogic->sIP;
@@ -1844,7 +1840,7 @@ int AgiEngine::runLogic(int n) {
memset(p + num, 0, CMD_BSIZE - num);
debugC(2, kDebugLevelScripts, "%s(%d %d %d)", logicNamesCmd[op].name, p[0], p[1], p[2]);
- agiCommand[op](p);
+ agiCommand[op](this, p);
ip += num;
}
@@ -1859,9 +1855,8 @@ int AgiEngine::runLogic(int n) {
void AgiEngine::executeAgiCommand(uint8 op, uint8 *p) {
debugC(2, kDebugLevelScripts, "%s(%d %d %d)", logicNamesCmd[op].name, p[0], p[1], p[2]);
- g_agi = this;
- agiCommand[op] (p);
+ agiCommand[op] (this, p);
}
} // End of namespace Agi
diff --git a/engines/agi/op_dbg.cpp b/engines/agi/op_dbg.cpp
index 7ed8e2bd17..be10f6ee75 100644
--- a/engines/agi/op_dbg.cpp
+++ b/engines/agi/op_dbg.cpp
@@ -28,11 +28,8 @@
namespace Agi {
-static AgiEngine *g_agi;
-#define game g_agi->_game
-
-#define ip (game.logics[lognum].cIP)
-#define code (game.logics[lognum].data)
+#define ip (_game.logics[lognum].cIP)
+#define code (_game.logics[lognum].data)
#ifdef _L
#undef _L
@@ -274,7 +271,6 @@ struct AgiLogicnames logicNamesCmd[] = {
};
void AgiEngine::debugConsole(int lognum, int mode, const char *str) {
- g_agi = this;
AgiLogicnames *x;
uint8 a, c, z;