aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sword2/anims.cpp2
-rw-r--r--sword2/console.cpp18
-rw-r--r--sword2/controls.cpp77
-rw-r--r--sword2/debug.cpp14
-rw-r--r--sword2/events.cpp2
-rw-r--r--sword2/icons.cpp2
-rw-r--r--sword2/logic.cpp2
-rw-r--r--sword2/logic.h2
-rw-r--r--sword2/mouse.cpp18
-rw-r--r--sword2/resman.cpp19
-rw-r--r--sword2/save_rest.cpp16
-rw-r--r--sword2/startup.cpp2
-rw-r--r--sword2/sword2.cpp18
-rw-r--r--sword2/sword2.h2
14 files changed, 89 insertions, 105 deletions
diff --git a/sword2/anims.cpp b/sword2/anims.cpp
index 1e2d9a0263..e7e0c82521 100644
--- a/sword2/anims.cpp
+++ b/sword2/anims.cpp
@@ -174,7 +174,7 @@ int32 Logic::animate(int32 *params, bool reverse) {
ob_graphic->anim_pc = anim_head->noAnimFrames - 1;
else
ob_graphic->anim_pc = 0;
- } else if (g_logic->getSync()) {
+ } else if (getSync()) {
// We've received a sync - return to script immediately
debug(5, "**sync stopped %d**", ID);
diff --git a/sword2/console.cpp b/sword2/console.cpp
index e6939ddb8e..de7cf085e4 100644
--- a/sword2/console.cpp
+++ b/sword2/console.cpp
@@ -196,7 +196,7 @@ bool Debugger::Cmd_Res(int argc, const char **argv) {
}
bool Debugger::Cmd_Starts(int argc, const char **argv) {
- g_logic->conPrintStartMenu();
+ _vm->_logic->conPrintStartMenu();
return true;
}
@@ -208,7 +208,7 @@ bool Debugger::Cmd_Start(int argc, const char **argv) {
return true;
}
- g_logic->conStart(atoi(argv[1]));
+ _vm->_logic->conStart(atoi(argv[1]));
g_graphics->setPalette(187, 1, pal, RDPAL_INSTANT);
return true;
}
@@ -271,7 +271,7 @@ bool Debugger::Cmd_CurrentInfo(int argc, const char **argv) {
}
bool Debugger::Cmd_RunList(int argc, const char **argv) {
- g_logic->examineRunList();
+ _vm->_logic->examineRunList();
return true;
}
@@ -611,7 +611,7 @@ bool Debugger::Cmd_AnimTest(int argc, const char **argv) {
}
// Automatically do "s 32" to run the animation testing start script
- g_logic->conStart(32);
+ _vm->_logic->conStart(32);
// Same as typing "VAR 912 <value>" at the console
varSet(912, atoi(argv[1]));
@@ -627,7 +627,7 @@ bool Debugger::Cmd_TextTest(int argc, const char **argv) {
}
// Automatically do "s 33" to run the text/speech testing start script
- g_logic->conStart(33);
+ _vm->_logic->conStart(33);
// Same as typing "VAR 1230 <value>" at the console
varSet(1230, atoi(argv[1]));
@@ -646,7 +646,7 @@ bool Debugger::Cmd_LineTest(int argc, const char **argv) {
}
// Automatically do "s 33" to run the text/speech testing start script
- g_logic->conStart(33);
+ _vm->_logic->conStart(33);
// Same as typing "VAR 1230 <value>" at the console
varSet(1230, atoi(argv[1]));
@@ -681,9 +681,9 @@ bool Debugger::Cmd_Events(int argc, const char **argv) {
DebugPrintf("EVENT LIST:\n");
for (uint32 i = 0; i < MAX_events; i++) {
- if (g_logic->_eventList[i].id) {
- uint32 target = g_logic->_eventList[i].id;
- uint32 script = g_logic->_eventList[i].interact_id;
+ if (_vm->_logic->_eventList[i].id) {
+ uint32 target = _vm->_logic->_eventList[i].id;
+ uint32 script = _vm->_logic->_eventList[i].interact_id;
DebugPrintf("slot %d: id = %s (%d)\n", i, _vm->fetchObjectName(target), target);
DebugPrintf(" script = %s (%d) pos %d\n", _vm->fetchObjectName(script / 65536), script / 65536, script % 65536);
diff --git a/sword2/controls.cpp b/sword2/controls.cpp
index d05e26d44d..f95f08db88 100644
--- a/sword2/controls.cpp
+++ b/sword2/controls.cpp
@@ -656,6 +656,7 @@ public:
class MiniDialog : public Dialog {
private:
+ Sword2Engine *_vm;
int _textId;
FontRendererGui *_fr;
Widget *_panel;
@@ -663,8 +664,8 @@ private:
Button *_cancelButton;
public:
- MiniDialog(uint32 textId) : _textId(textId) {
- _fr = new FontRendererGui(g_sword2->_controlsFontId);
+ MiniDialog(int fontId, uint32 textId) : _textId(textId) {
+ _fr = new FontRendererGui(fontId);
_panel = new Widget(this, 1);
_panel->createSurfaceImages(1996, 203, 104);
@@ -987,6 +988,8 @@ public:
class SaveLoadDialog : public Dialog {
private:
+ Sword2Engine *_vm;
+
int _mode, _selectedSlot;
char _editBuffer[SAVE_DESCRIPTION_LEN];
int _editPos, _firstPos;
@@ -1006,14 +1009,15 @@ private:
void saveLoadError(char *text);
public:
- SaveLoadDialog(int mode) : _mode(mode), _selectedSlot(-1) {
+ SaveLoadDialog(Sword2Engine *vm, int mode)
+ : _vm(vm), _mode(mode), _selectedSlot(-1) {
int i;
// FIXME: The "control font" and the "red font" are currently
// always the same font, so one should be eliminated.
- _fr1 = new FontRendererGui(g_sword2->_controlsFontId);
- _fr2 = new FontRendererGui(g_sword2->_redFontId);
+ _fr1 = new FontRendererGui(_vm->_controlsFontId);
+ _fr2 = new FontRendererGui(_vm->_redFontId);
_panel = new Widget(this, 1);
_panel->createSurfaceImages(2016, 0, 40);
@@ -1086,7 +1090,7 @@ public:
fr = _fr1;
}
- if (g_sword2->getSaveDescription(gui->_baseSlot + i, description) == SR_OK) {
+ if (_vm->getSaveDescription(gui->_baseSlot + i, description) == SR_OK) {
slot->setText(fr, gui->_baseSlot + i, (char *) description);
slot->setClickable(true);
} else {
@@ -1247,7 +1251,7 @@ public:
_editBuffer[_editPos] = 0;
- uint32 rv = g_sword2->saveGame(_selectedSlot, (uint8 *) &_editBuffer[_firstPos]);
+ uint32 rv = _vm->saveGame(_selectedSlot, (uint8 *) &_editBuffer[_firstPos]);
if (rv != SR_OK) {
uint32 textId;
@@ -1265,7 +1269,7 @@ public:
result = 0;
}
} else {
- uint32 rv = g_sword2->restoreGame(_selectedSlot);
+ uint32 rv = _vm->restoreGame(_selectedSlot);
if (rv != SR_OK) {
uint32 textId;
@@ -1289,13 +1293,13 @@ public:
// Reset the graphic 'buildit' list before a
// new logic list (see fnRegisterFrame)
- g_sword2->resetRenderLists();
+ _vm->resetRenderLists();
// Reset the mouse hot-spot list (see
// fnRegisterMouse and fnRegisterFrame)
- g_sword2->resetMouseList();
+ _vm->resetMouseList();
- if (g_logic->processSession())
+ if (_vm->_logic->processSession())
error("restore 1st cycle failed??");
}
}
@@ -1395,74 +1399,67 @@ uint32 Gui::restoreControl(void) {
// returns 0 for no restore
// 1 for restored ok
- SaveLoadDialog loadDialog(kLoadDialog);
+ SaveLoadDialog loadDialog(_vm, kLoadDialog);
return loadDialog.run();
}
void Gui::saveControl(void) {
- SaveLoadDialog saveDialog(kSaveDialog);
+ SaveLoadDialog saveDialog(_vm, kSaveDialog);
saveDialog.run();
}
void Gui::quitControl(void) {
- MiniDialog quitDialog(149618692); // quit text
-
- if (!quitDialog.run()) {
- // just return to game
- return;
- }
+ MiniDialog quitDialog(_vm->_controlsFontId, 149618692);
- // close engine systems down
- _vm->closeGame();
+ if (quitDialog.run())
+ _vm->closeGame();
}
void Gui::restartControl(void) {
uint32 temp_demo_flag;
- MiniDialog restartDialog(149618693); // restart text
+ MiniDialog restartDialog(_vm->_controlsFontId, 149618693);
- if (!restartDialog.run()) {
- // just return to game
+ if (!restartDialog.run())
return;
- }
+
+ // Restart the game. To do this, we must...
// Stop music instantly!
_vm->killMusic();
- //in case we were dead - well we're not anymore!
+ // In case we were dead - well we're not anymore!
DEAD = 0;
g_graphics->clearScene();
- // restart the game
- // clear all memory and reset the globals
-
+ // Restart the game. Clear all memory and reset the globals
temp_demo_flag = DEMO;
- // remove all resources from memory, including player object and
+ // Remove all resources from memory, including player object and
// global variables
res_man->removeAll();
- // reopen global variables resource & send address to interpreter -
+ // Reopen global variables resource & send address to interpreter -
// it won't be moving
- g_logic->setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
+ _vm->_logic->setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
res_man->closeResource(1);
DEMO = temp_demo_flag;
- // free all the route memory blocks from previous game
- g_logic->_router->freeAllRouteMem();
+ // Rree all the route memory blocks from previous game
+ _vm->_logic->_router->freeAllRouteMem();
- // call the same function that first started us up
+ // Call the same function that first started us up
_vm->startGame();
- // prime system with a game cycle
+ // Prime system with a game cycle
- // reset the graphic 'buildit' list before a new logic list
+ // Reset the graphic 'buildit' list before a new logic list
// (see fnRegisterFrame)
_vm->resetRenderLists();
- // reset the mouse hot-spot list (see fnRegisterMouse and
+ // Reset the mouse hot-spot list (see fnRegisterMouse and
// fnRegisterFrame)
_vm->resetMouseList();
@@ -1471,15 +1468,13 @@ void Gui::restartControl(void) {
// FOR THE DEMO - FORCE THE SCROLLING TO BE RESET!
// - this is taken from fnInitBackground
// switch on scrolling (2 means first time on screen)
-
_vm->_thisScreen.scroll_flag = 2;
- if (g_logic->processSession())
+ if (_vm->_logic->processSession())
error("restart 1st cycle failed??");
// So palette not restored immediately after control panel - we want
// to fade up instead!
-
_vm->_thisScreen.new_palette = 99;
}
diff --git a/sword2/debug.cpp b/sword2/debug.cpp
index fde2ce3b5b..669a2dc94c 100644
--- a/sword2/debug.cpp
+++ b/sword2/debug.cpp
@@ -151,7 +151,7 @@ void Debugger::buildDebugText(void) {
sprintf(buf, "pos: %d", _textNumber & 0xffff);
makeDebugTextBlock(buf, 0, 370);
- sprintf(buf, "TEXT: %d", g_logic->_officialTextNumber);
+ sprintf(buf, "TEXT: %d", _vm->_logic->_officialTextNumber);
makeDebugTextBlock(buf, 0, 385);
}
}
@@ -233,7 +233,7 @@ void Debugger::buildDebugText(void) {
// no. of events in event list
- sprintf(buf, "events=%d", g_logic->countEvents());
+ sprintf(buf, "events=%d", _vm->_logic->countEvents());
makeDebugTextBlock(buf, 440, 45);
// sprite list usage
@@ -268,10 +268,10 @@ void Debugger::buildDebugText(void) {
// "waiting for person" indicator - set form fnTheyDo and
// fnTheyDoWeWait
- if (g_logic->_speechScriptWaiting) {
+ if (_vm->_logic->_speechScriptWaiting) {
sprintf(buf, "script waiting for %s (%d)",
- _vm->fetchObjectName(g_logic->_speechScriptWaiting),
- g_logic->_speechScriptWaiting);
+ _vm->fetchObjectName(_vm->_logic->_speechScriptWaiting),
+ _vm->_logic->_speechScriptWaiting);
makeDebugTextBlock(buf, 0, 90);
}
@@ -309,7 +309,7 @@ void Debugger::drawDebugGraphics(void) {
// walk-grid
if (_displayWalkGrid)
- g_logic->_router->plotWalkGrid();
+ _vm->_logic->_router->plotWalkGrid();
// player feet coord marker
@@ -359,7 +359,7 @@ void Debugger::printCurrentInfo(void) {
Debug_Printf("%d wide, %d high\n", _vm->_thisScreen.screen_wide, _vm->_thisScreen.screen_deep);
Debug_Printf("%d normal layers\n", _vm->_thisScreen.number_of_layers);
- g_logic->examineRunList();
+ _vm->_logic->examineRunList();
} else
Debug_Printf("No screen\n");
}
diff --git a/sword2/events.cpp b/sword2/events.cpp
index 95f1654a63..8da448fdb4 100644
--- a/sword2/events.cpp
+++ b/sword2/events.cpp
@@ -82,7 +82,7 @@ void Logic::startEvent(void) {
for (int i = 0; i < MAX_events; i++) {
if (_eventList[i].id == ID) {
// run 3rd script of target object on level 1
- g_logic->logicOne(_eventList[i].interact_id);
+ logicOne(_eventList[i].interact_id);
// clear the slot
_eventList[i].id = 0;
diff --git a/sword2/icons.cpp b/sword2/icons.cpp
index e3e9412208..48750ea890 100644
--- a/sword2/icons.cpp
+++ b/sword2/icons.cpp
@@ -88,7 +88,7 @@ void Sword2Engine::buildMenu(void) {
// objects. Run the 'build_menu' script in the 'menu_master' object
head = res_man->openResource(MENU_MASTER_OBJECT);
- g_logic->runScript((char*) head, (char*) head, &null_pc);
+ _logic->runScript((char*) head, (char*) head, &null_pc);
res_man->closeResource(MENU_MASTER_OBJECT);
// Compare new with old. Anything in master thats not in new gets
diff --git a/sword2/logic.cpp b/sword2/logic.cpp
index e786f24f86..7814407084 100644
--- a/sword2/logic.cpp
+++ b/sword2/logic.cpp
@@ -30,8 +30,6 @@
namespace Sword2 {
-Logic *g_logic = NULL;
-
#define LEVEL (_curObjectHub->logic_level)
/**
diff --git a/sword2/logic.h b/sword2/logic.h
index 2ed05f8f6f..0b4a99433b 100644
--- a/sword2/logic.h
+++ b/sword2/logic.h
@@ -389,8 +389,6 @@ public:
void resetKillList(void);
};
-extern Logic *g_logic;
-
} // End of namespace Sword2
#endif
diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp
index 24a6e439bd..5d1fc65dcd 100644
--- a/sword2/mouse.cpp
+++ b/sword2/mouse.cpp
@@ -196,7 +196,7 @@ void Sword2Engine::systemMenuMouse(void) {
pars[0] = 221;
pars[1] = FX_LOOP;
- g_logic->fnPlayMusic(pars);
+ _logic->fnPlayMusic(pars);
// restore proper looping_music_id
_loopingMusicId = safe_looping_music_id;
@@ -263,13 +263,13 @@ void Sword2Engine::systemMenuMouse(void) {
if (_loopingMusicId) {
pars[0] = _loopingMusicId;
pars[1] = FX_LOOP;
- g_logic->fnPlayMusic(pars);
+ _logic->fnPlayMusic(pars);
// cross-fades into the required music: either a restored game
// tune, or music playing prior to entering control panels
} else {
// stop the control panel music
- g_logic->fnStopMusic(NULL);
+ _logic->fnStopMusic(NULL);
}
}
@@ -342,7 +342,7 @@ void Sword2Engine::dragMouse(void) {
CLICKED_ID = _mouseTouching;
- g_logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
+ _logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
debug(5, "Used \"%s\" on \"%s\"", fetchObjectName(OBJECT_HELD), fetchObjectName(CLICKED_ID));
@@ -376,7 +376,7 @@ void Sword2Engine::dragMouse(void) {
// Otherwise, combine the two icons
COMBINE_BASE = _masterMenuList[hit].icon_resource;
- g_logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
+ _logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
// Turn off mouse now, to prevent player trying to click
// elsewhere BUT leave the bottom menu open
@@ -427,7 +427,7 @@ void Sword2Engine::menuMouse(void) {
EXIT_CLICK_ID = 0;
- g_logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
+ _logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
// Refresh the menu
@@ -636,8 +636,8 @@ void Sword2Engine::normalMouse(void) {
// interaction continue and start fading down. Switch the human
// off too
- g_logic->fnNoHuman(NULL);
- g_logic->fnFadeDown(NULL);
+ _logic->fnNoHuman(NULL);
+ _logic->fnFadeDown(NULL);
// Tell the walker
@@ -660,7 +660,7 @@ void Sword2Engine::normalMouse(void) {
EXIT_CLICK_ID = 0;
EXIT_FADING = 0;
- g_logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
+ _logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
if (OBJECT_HELD)
debug(2, "Used \"%s\" on \"%s\"", fetchObjectName(OBJECT_HELD), fetchObjectName(CLICKED_ID));
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 0ecfcc1e78..0bc3c2b5dc 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -458,10 +458,11 @@ uint8 *ResourceManager::openResource(uint32 res) {
// for the CD until we do.
while (!file.open(_resourceFiles[parent_res_file])) {
- // Is the file supposed to be on the hard disk? Then
- // we're in trouble if we can't find it!
+ // If the file is supposed to be on hard disk, or we're
+ // playing a demo, then we're in trouble if the file
+ // can't be found!
- if (_cdTab[parent_res_file] & LOCAL_PERM)
+ if ((_vm->_features & GF_DEMO) || (_cdTab[parent_res_file] & LOCAL_PERM))
error("Could not find '%s'", _resourceFiles[parent_res_file]);
getCd(_cdTab[parent_res_file] & 3);
@@ -948,21 +949,11 @@ void ResourceManager::killAllObjects(bool wantInfo) {
void ResourceManager::getCd(int cd) {
uint8 *textRes;
- // don't ask for CD's in the playable demo downloaded from our
- // web-site!
- if (_vm->_features & GF_DEMO)
- return;
-
-#ifdef _PCGUIDE
- // don't ask for CD in the patch for the demo on "PC Guide" magazine
- return;
-#endif
-
// stop any music from playing - so the system no longer needs the
// current CD - otherwise when we take out the CD, Windows will
// complain!
- g_logic->fnStopMusic(NULL);
+ _vm->_logic->fnStopMusic(NULL);
textRes = openResource(2283);
_vm->displayMsg(_vm->fetchTextLine(textRes, 5 + cd) + 2, 0);
diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp
index 0389bba16f..2c19335406 100644
--- a/sword2/save_rest.cpp
+++ b/sword2/save_rest.cpp
@@ -145,7 +145,7 @@ void Sword2Engine::fillSaveBuffer(mem *buffer, uint32 size, uint8 *desc) {
g_header.screenId = _thisScreen.background_layer_id;
// resource id of current run-list
- g_header.runListId = g_logic->getRunList();
+ g_header.runListId = _logic->getRunList();
// those scroll position control things
g_header.feet_x = _thisScreen.feet_x;
@@ -343,7 +343,7 @@ uint32 Sword2Engine::restoreFromBuffer(mem *buffer, uint32 size) {
res_man->killAll(false);
// clean out the system kill list (no more objects to kill)
- g_logic->resetKillList();
+ _logic->resetKillList();
// get player character data from savegame buffer
@@ -380,7 +380,7 @@ uint32 Sword2Engine::restoreFromBuffer(mem *buffer, uint32 size) {
pars[0] = g_header.screenId;
pars[1] = 1;
- g_logic->fnInitBackground(pars);
+ _logic->fnInitBackground(pars);
// So palette not restored immediately after control panel - we want to
// fade up instead!
@@ -393,7 +393,7 @@ uint32 Sword2Engine::restoreFromBuffer(mem *buffer, uint32 size) {
_thisScreen.feet_y = g_header.feet_y;
// start the new run list
- g_logic->expressChangeSession(g_header.runListId);
+ _logic->expressChangeSession(g_header.runListId);
// Force in the new scroll position, so unsightly scroll-catch-up does
// not occur when screen first draws after returning from restore panel
@@ -481,7 +481,7 @@ void Sword2Engine::getPlayerStructures(void) {
error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID);
raw_script_ad = (char *) head;
- g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
+ _logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
res_man->closeResource(CUR_PLAYER_ID);
}
@@ -504,12 +504,12 @@ void Sword2Engine::putPlayerStructures(void) {
// script no. 8 - 'george_savedata_return' calls fnGetPlayerSaveData
null_pc = 8;
- g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
+ _logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
// script no. 14 - 'set_up_nico_anim_tables'
null_pc = 14;
- g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
+ _logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
// which megaset was the player at the time of saving?
@@ -531,7 +531,7 @@ void Sword2Engine::putPlayerStructures(void) {
break;
}
- g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
+ _logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
res_man->closeResource(CUR_PLAYER_ID);
}
diff --git a/sword2/startup.cpp b/sword2/startup.cpp
index 9ecd7ba8c3..c215e6cab4 100644
--- a/sword2/startup.cpp
+++ b/sword2/startup.cpp
@@ -212,7 +212,7 @@ void Logic::conStart(int start) {
res_man->closeResource(1);
// free all the route memory blocks from previous game
- g_logic->_router->freeAllRouteMem();
+ _router->freeAllRouteMem();
// if there was speech text, kill the text block
if (_speechTextBlocNo) {
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index 16ac6bec58..b55bfad139 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -128,7 +128,7 @@ Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst)
memory = new MemoryManager();
res_man = new ResourceManager(this);
- g_logic = new Logic(this);
+ _logic = new Logic(this);
fontRenderer = new FontRenderer();
gui = new Gui(this);
g_input = _input = new Input();
@@ -194,7 +194,7 @@ Sword2Engine::~Sword2Engine() {
delete _input;
delete gui;
delete fontRenderer;
- delete g_logic;
+ delete _logic;
delete res_man;
delete memory;
}
@@ -225,7 +225,7 @@ int32 Sword2Engine::InitialiseGame(void) {
// res 1 is the globals list
file = res_man->openResource(1);
debug(5, "CALLING: SetGlobalInterpreterVariables");
- g_logic->setGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
+ _logic->setGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
// DON'T CLOSE VARIABLES RESOURCE - KEEP IT OPEN AT VERY START OF
// MEMORY SO IT CAN'T MOVE!
@@ -264,7 +264,7 @@ void Sword2Engine::gameCycle(void) {
// do one game cycle
// got a screen to run?
- if (g_logic->getRunList()) {
+ if (_logic->getRunList()) {
//run the logic session UNTIL a full loop has been performed
do {
// reset the graphic 'buildit' list before a new
@@ -277,7 +277,7 @@ void Sword2Engine::gameCycle(void) {
// keep going as long as new lists keep getting put in
// - i.e. screen changes
- } while (g_logic->processSession());
+ } while (_logic->processSession());
} else {
// start the console and print the start options perhaps?
_debugger->attach("AWAITING START COMMAND: (Enter 's 1' then 'q' to start from beginning)");
@@ -393,7 +393,7 @@ void Sword2Engine::go() {
// 'P' while not paused = pause!
pauseGame();
} else if (c == 'C' && !(_features & GF_DEMO)) {
- g_logic->fnPlayCredits(NULL);
+ _logic->fnPlayCredits(NULL);
}
#ifdef _SWORD2_DEBUG
else if (c == 'S') {
@@ -464,7 +464,7 @@ void Sword2Engine::startGame(void) {
raw_script = (char *) res_man->openResource(screen_manager_id);
// run the start script now (because no console)
- g_logic->runScript(raw_script, raw_data_ad, &null_pc);
+ _logic->runScript(raw_script, raw_data_ad, &null_pc);
// close the ScreenManager object
res_man->closeResource(screen_manager_id);
@@ -552,10 +552,10 @@ void Sword2Engine::unpauseGame(void) {
}
_gamePaused = false;
- g_logic->_unpauseZone = 2;
+ _logic->_unpauseZone = 2;
// if mouse is about or we're in a chooser menu
- if (!_mouseStatus || g_logic->_choosing)
+ if (!_mouseStatus || _logic->_choosing)
setMouse(NORMAL_MOUSE_ID);
}
diff --git a/sword2/sword2.h b/sword2/sword2.h
index 94c1e0838f..13ce8b5a55 100644
--- a/sword2/sword2.h
+++ b/sword2/sword2.h
@@ -30,6 +30,7 @@
#include "sword2/header.h"
#include "sword2/icons.h"
#include "sword2/layers.h"
+#include "sword2/logic.h"
#include "sword2/memory.h"
#include "sword2/mouse.h"
#include "sword2/object.h"
@@ -139,6 +140,7 @@ public:
Input *_input;
Sound *_sound;
Graphics *_graphics;
+ Logic *_logic;
Debugger *_debugger;