diff options
Diffstat (limited to 'engines/parallaction')
26 files changed, 135 insertions, 131 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index 64885c7ff3..c1720a1a8e 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -275,7 +275,7 @@ void Parallaction_ns::_c_contaFoglie(void *parm) { if (num_foglie != 6) return; - _globalFlags |= 0x1000; + g_globalFlags |= 0x1000; return; } @@ -286,7 +286,7 @@ void Parallaction_ns::_c_zeroFoglie(void *parm) { } void Parallaction_ns::_c_trasformata(void *parm) { - _engineFlags ^= kEngineTransformedDonna; + g_engineFlags ^= kEngineTransformedDonna; // No need to invoke changeCharacter here, as // transformation happens on a location switch // and character change is automatically triggered. @@ -295,11 +295,11 @@ void Parallaction_ns::_c_trasformata(void *parm) { void Parallaction_ns::_c_offMouse(void *parm) { _input->setMouseState(MOUSE_DISABLED); - _engineFlags |= kEngineBlockInput; + g_engineFlags |= kEngineBlockInput; } void Parallaction_ns::_c_onMouse(void *parm) { - _engineFlags &= ~kEngineBlockInput; + g_engineFlags &= ~kEngineBlockInput; _input->setMouseState(MOUSE_ENABLED_SHOW); } @@ -389,7 +389,7 @@ void Parallaction_ns::_c_finito(void *parm) { } void Parallaction_ns::_c_ridux(void *parm) { - changeCharacter(_minidinoName); + changeCharacter(g_minidinoName); return; } @@ -444,7 +444,7 @@ void Parallaction_ns::_c_startIntro(void *parm) { _soundManI->playMusic(); } - _engineFlags |= kEngineBlockInput; + g_engineFlags |= kEngineBlockInput; _input->setMouseState(MOUSE_DISABLED); _intro = true; } diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp index 0cb329e0f0..25acac9b06 100644 --- a/engines/parallaction/debug.cpp +++ b/engines/parallaction/debug.cpp @@ -103,7 +103,7 @@ bool Debugger::Cmd_Locations(int argc, const char **argv) { bool Debugger::Cmd_GlobalFlags(int argc, const char **argv) { - uint32 flags = _globalFlags; + uint32 flags = g_globalFlags; DebugPrintf("+------------------------------+---------+\n" "| flag name | value |\n" @@ -128,10 +128,10 @@ bool Debugger::Cmd_ToggleGlobalFlag(int argc, const char **argv) { DebugPrintf("invalid flag '%s'\n", argv[1]); } else { i--; - if ((_globalFlags & (1 << i)) == 0) - _globalFlags |= (1 << i); + if ((g_globalFlags & (1 << i)) == 0) + g_globalFlags |= (1 << i); else - _globalFlags &= ~(1 << i); + g_globalFlags &= ~(1 << i); } break; diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index e0bd6a6677..78cc23311f 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -192,7 +192,7 @@ void DialogueManager::transitionToState(DialogueState newState) { bool DialogueManager::testAnswerFlags(Answer *a) { uint32 flags = _vm->getLocationFlags(); if (a->_yesFlags & kFlagsGlobal) - flags = _globalFlags | kFlagsGlobal; + flags = g_globalFlags | kFlagsGlobal; return ((a->_yesFlags & flags) == a->_yesFlags) && ((a->_noFlags & ~flags) == a->_noFlags); } @@ -370,9 +370,9 @@ protected: bool _askPassword; bool checkPassword() { - return ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && _vm->_password.hasPrefix("1732461")) || - (!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && _vm->_password.hasPrefix("1622")) || - (!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && _vm->_password.hasPrefix("179"))); + return ((!scumm_stricmp(_vm->_char.getBaseName(), g_doughName) && _vm->_password.hasPrefix("1732461")) || + (!scumm_stricmp(_vm->_char.getBaseName(), g_donnaName) && _vm->_password.hasPrefix("1622")) || + (!scumm_stricmp(_vm->_char.getBaseName(), g_dinoName) && _vm->_password.hasPrefix("179"))); } void resetPassword() { diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index ee981a2c7d..8988897456 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -31,7 +31,7 @@ namespace Parallaction { -extern byte _braAmigaFramesDefaultPalette[]; +extern byte braAmigaFramesDefaultPalette[]; struct Sprite { uint16 size; @@ -475,7 +475,7 @@ void AmigaDisk_br::loadBackground(BackgroundInfo& info, const char *filename) { } delete stream; } else { - p = _braAmigaFramesDefaultPalette; + p = braAmigaFramesDefaultPalette; for (i = 0; i < 16; i++) { r = *p >> 2; p++; diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 8d4afd6847..718265664f 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -328,7 +328,7 @@ GfxObj* DosDisk_ns::loadTalk(const char *name) { } char v20[30]; - if (_engineFlags & kEngineTransformedDonna) { + if (g_engineFlags & kEngineTransformedDonna) { sprintf(v20, "%stta.cnv", name); } else { sprintf(v20, "%stal.cnv", name); diff --git a/engines/parallaction/exec.cpp b/engines/parallaction/exec.cpp index 8594d02641..122abf9e0e 100644 --- a/engines/parallaction/exec.cpp +++ b/engines/parallaction/exec.cpp @@ -56,7 +56,7 @@ void ProgramExec::runScript(ProgramPtr script, AnimationPtr a) { } void ProgramExec::runScripts(ProgramList::iterator first, ProgramList::iterator last) { - if (_engineFlags & kEnginePauseJobs) { + if (g_engineFlags & kEnginePauseJobs) { return; } @@ -110,7 +110,7 @@ void CommandExec::runList(CommandList::iterator first, CommandList::iterator las } if (cmd->_flagsOn & kFlagsGlobal) { - useFlags = _globalFlags | kFlagsGlobal; + useFlags = g_globalFlags | kFlagsGlobal; useLocalFlags = false; } else { useFlags = _vm->getLocationFlags(); @@ -182,7 +182,7 @@ void CommandExec::suspend() { } void CommandExec::runSuspended() { - if (_engineFlags & kEngineWalking) { + if (g_engineFlags & kEngineWalking) { return; } diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index 658ef5af82..985ea29311 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -307,7 +307,7 @@ DECLARE_COMMAND_OPCODE(testsfx) { DECLARE_COMMAND_OPCODE(ret) { - _engineFlags |= kEngineReturn; + g_engineFlags |= kEngineReturn; } @@ -327,7 +327,7 @@ DECLARE_INSTRUCTION_OPCODE(invalid) { DECLARE_COMMAND_OPCODE(clear) { if (ctxt._cmd->_flags & kFlagsGlobal) { ctxt._cmd->_flags &= ~kFlagsGlobal; - _globalFlags &= ~ctxt._cmd->_flags; + g_globalFlags &= ~ctxt._cmd->_flags; } else { _vm->clearLocationFlags(ctxt._cmd->_flags); } @@ -356,7 +356,7 @@ DECLARE_COMMAND_OPCODE(get) { DECLARE_COMMAND_OPCODE(toggle) { if (ctxt._cmd->_flags & kFlagsGlobal) { ctxt._cmd->_flags &= ~kFlagsGlobal; - _globalFlags ^= ctxt._cmd->_flags; + g_globalFlags ^= ctxt._cmd->_flags; } else { _vm->toggleLocationFlags(ctxt._cmd->_flags); } @@ -373,7 +373,7 @@ DECLARE_COMMAND_OPCODE(invalid) { DECLARE_COMMAND_OPCODE(set) { if (ctxt._cmd->_flags & kFlagsGlobal) { ctxt._cmd->_flags &= ~kFlagsGlobal; - _globalFlags |= ctxt._cmd->_flags; + g_globalFlags |= ctxt._cmd->_flags; } else { _vm->setLocationFlags(ctxt._cmd->_flags); } diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index d8fbdea971..3ea4332e50 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -151,7 +151,7 @@ DECLARE_INSTRUCTION_OPCODE(call) { DECLARE_INSTRUCTION_OPCODE(wait) { - if (_engineFlags & kEngineWalking) { + if (g_engineFlags & kEngineWalking) { ctxt._ip--; ctxt._suspend = true; } @@ -198,7 +198,7 @@ DECLARE_COMMAND_OPCODE(invalid) { DECLARE_COMMAND_OPCODE(set) { if (ctxt._cmd->_flags & kFlagsGlobal) { ctxt._cmd->_flags &= ~kFlagsGlobal; - _globalFlags |= ctxt._cmd->_flags; + g_globalFlags |= ctxt._cmd->_flags; } else { _vm->setLocationFlags(ctxt._cmd->_flags); } @@ -208,7 +208,7 @@ DECLARE_COMMAND_OPCODE(set) { DECLARE_COMMAND_OPCODE(clear) { if (ctxt._cmd->_flags & kFlagsGlobal) { ctxt._cmd->_flags &= ~kFlagsGlobal; - _globalFlags &= ~ctxt._cmd->_flags; + g_globalFlags &= ~ctxt._cmd->_flags; } else { _vm->clearLocationFlags(ctxt._cmd->_flags); } @@ -267,7 +267,7 @@ DECLARE_COMMAND_OPCODE(call) { DECLARE_COMMAND_OPCODE(toggle) { if (ctxt._cmd->_flags & kFlagsGlobal) { ctxt._cmd->_flags &= ~kFlagsGlobal; - _globalFlags ^= ctxt._cmd->_flags; + g_globalFlags ^= ctxt._cmd->_flags; } else { _vm->toggleLocationFlags(ctxt._cmd->_flags); } diff --git a/engines/parallaction/font.cpp b/engines/parallaction/font.cpp index d4c9aefd32..3b40960381 100644 --- a/engines/parallaction/font.cpp +++ b/engines/parallaction/font.cpp @@ -29,7 +29,7 @@ namespace Parallaction { -extern byte _amigaTopazFont[]; +extern byte amigaTopazFont[]; class BraFont : public Font { @@ -675,7 +675,7 @@ void Parallaction_ns::initFonts() { _introFont = _disk->loadFont("slide"); } else { _dialogueFont = _disk->loadFont("comic"); - Common::MemoryReadStream stream(_amigaTopazFont, 2600, DisposeAfterUse::NO); + Common::MemoryReadStream stream(amigaTopazFont, 2600, DisposeAfterUse::NO); _labelFont = new AmigaFont(stream); _menuFont = _disk->loadFont("slide"); _introFont = _disk->loadFont("intro"); diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp index 852235ce34..8ef3c0fabf 100644 --- a/engines/parallaction/gfxbase.cpp +++ b/engines/parallaction/gfxbase.cpp @@ -152,22 +152,22 @@ void Gfx::freeCharacterObjects() { freeDialogueObjects(); } -void BackgroundInfo::loadGfxObjMask(const char *name, GfxObj *obj) { +void BackgroundInfo::loadGfxObjMask(Parallaction *vm, const char *name, GfxObj *obj) { debugC(1, kDebugGraphics, "BackgroundInfo::loadGfxObjMask(\"%s\")", name); Common::Rect rect; obj->getRect(0, rect); - MaskBuffer *buf = _vm->_disk->loadMask(name, rect.width(), rect.height()); + MaskBuffer *buf = vm->_disk->loadMask(name, rect.width(), rect.height()); obj->_maskId = addMaskPatch(buf); obj->_hasMask = true; } -void BackgroundInfo::loadGfxObjPath(const char *name, GfxObj *obj) { +void BackgroundInfo::loadGfxObjPath(Parallaction *vm, const char *name, GfxObj *obj) { Common::Rect rect; obj->getRect(0, rect); - PathBuffer *buf = _vm->_disk->loadPath(name, rect.width(), rect.height()); + PathBuffer *buf = vm->_disk->loadPath(name, rect.width(), rect.height()); obj->_pathId = addPathPatch(buf); obj->_hasPath = true; diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 9855830478..59cd02e6ef 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -80,11 +80,11 @@ void drawCircle(int xCenter, int yCenter, int radius, int color, void (*plotProc Palette::Palette() { - int gameType = _vm->getGameType(); + int gameType = g_vm->getGameType(); if (gameType == GType_Nippon) { _colors = 32; - _hb = (_vm->getPlatform() == Common::kPlatformAmiga); + _hb = (g_vm->getPlatform() == Common::kPlatformAmiga); } else if (gameType == GType_BRA) { _colors = 256; diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index f8cb4b3647..e9daabb194 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -377,14 +377,14 @@ public: void toggleMaskPatch(uint id, int x, int y, bool apply); uint16 getMaskLayer(uint16 z) const; void finalizeMask(); - void loadGfxObjMask(const char *name, GfxObj *obj); + void loadGfxObjMask(Parallaction *vm, const char *name, GfxObj *obj); // path management bool hasPath(); uint addPathPatch(PathBuffer *patch); void togglePathPatch(uint id, int x, int y, bool apply); void finalizePath(); - void loadGfxObjPath(const char *name, GfxObj *obj); + void loadGfxObjPath(Parallaction *vm, const char *name, GfxObj *obj); }; diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp index 3794aeae29..082c37f666 100644 --- a/engines/parallaction/gui_ns.cpp +++ b/engines/parallaction/gui_ns.cpp @@ -787,7 +787,7 @@ public: } destroyLabels(); - _engineFlags &= ~kEngineBlockInput; + g_engineFlags &= ~kEngineBlockInput; return _helper->getState("selectcharacter"); } diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index 453bf9849d..4fbd9b99cc 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -188,15 +188,15 @@ int Input::updateGameInput() { int event = kEvNone; if (!isMouseEnabled() || - (_engineFlags & kEngineBlockInput) || - (_engineFlags & kEngineWalking) || - (_engineFlags & kEngineChangeLocation)) { + (g_engineFlags & kEngineBlockInput) || + (g_engineFlags & kEngineWalking) || + (g_engineFlags & kEngineChangeLocation)) { debugC(3, kDebugInput, "updateGameInput: input flags (mouse: %i, block: %i, walking: %i, changeloc: %i)", isMouseEnabled(), - (_engineFlags & kEngineBlockInput) == 0, - (_engineFlags & kEngineWalking) == 0, - (_engineFlags & kEngineChangeLocation) == 0 + (g_engineFlags & kEngineBlockInput) == 0, + (g_engineFlags & kEngineWalking) == 0, + (g_engineFlags & kEngineChangeLocation) == 0 ); return event; @@ -289,7 +289,7 @@ void Input::walkTo(const Common::Point &dest) { bool Input::translateGameInput() { - if (_engineFlags & kEnginePauseJobs) { + if (g_engineFlags & kEnginePauseJobs) { return false; } @@ -312,7 +312,7 @@ bool Input::translateGameInput() { // test if mouse is hovering on an interactive zone for the currently selected inventory item ZonePtr z = _vm->hitZone(_activeItem._id, mousePos.x, mousePos.y); - if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((!z) || (ACTIONTYPE(z) != kZoneCommand))) { + if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((g_engineFlags & kEngineWalking) == 0)) && ((!z) || (ACTIONTYPE(z) != kZoneCommand))) { walkTo(mousePos); return true; } @@ -361,7 +361,7 @@ void Input::enterInventoryMode() { if (hitCharacter) { if (_activeItem._id != 0) { _activeItem._index = (_activeItem._id >> 16) & 0xFFFF; - _engineFlags |= kEngineDragging; + g_engineFlags |= kEngineDragging; } else { setArrowCursor(); } @@ -384,9 +384,9 @@ void Input::exitInventoryMode() { int pos = _vm->getHoverInventoryItem(mousePos.x, mousePos.y); _vm->highlightInventoryItem(-1); // disable - if ((_engineFlags & kEngineDragging)) { + if ((g_engineFlags & kEngineDragging)) { - _engineFlags &= ~kEngineDragging; + g_engineFlags &= ~kEngineDragging; ZonePtr z = _vm->hitZone(kZoneMerge, _activeItem._index, _vm->getInventoryItemIndex(pos)); if (z) { diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index d3529c5dd9..50556c3ec4 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -203,7 +203,7 @@ Zone::Zone() { } Zone::~Zone() { - _vm->_gfx->unregisterLabel(_label); + g_vm->_gfx->unregisterLabel(_label); delete _label; } @@ -325,7 +325,7 @@ int16 ScriptVar::getValue() { } if (_flags & kParaRandom) { - return (_vm->_rnd.getRandomNumber(65536) * _value) >> 16; + return (g_vm->_rnd.getRandomNumber(65536) * _value) >> 16; } error("Parameter is not an r-value"); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index d70ded3cf9..e6ef53aa78 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -33,12 +33,12 @@ #include "parallaction/walk.h" namespace Parallaction { -Parallaction *_vm = NULL; +Parallaction *g_vm = NULL; // public stuff -char _saveData1[30] = { '\0' }; -uint32 _engineFlags = 0; -uint32 _globalFlags = 0; +char g_saveData1[30] = { '\0' }; +uint32 g_engineFlags = 0; +uint32 g_globalFlags = 0; // private stuff @@ -48,7 +48,7 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam // Setup mixer syncSoundSettings(); - _vm = this; + g_vm = this; DebugMan.addDebugChannel(kDebugDialogue, "dialogue", "Dialogues debug level"); DebugMan.addDebugChannel(kDebugParser, "parser", "Parser debug level"); DebugMan.addDebugChannel(kDebugDisk, "disk", "Disk debug level"); @@ -87,7 +87,7 @@ Parallaction::~Parallaction() { Common::Error Parallaction::init() { _gameType = getGameType(); - _engineFlags = 0; + g_engineFlags = 0; _objectsNames = NULL; _globalFlagsNames = NULL; _location._hasSound = false; @@ -131,7 +131,7 @@ GUI::Debugger *Parallaction::getDebugger() { void Parallaction::updateView() { - if ((_engineFlags & kEnginePauseJobs) && (_input->_inputMode != Input::kInputModeInventory)) { + if ((g_engineFlags & kEnginePauseJobs) && (_input->_inputMode != Input::kInputModeInventory)) { return; } @@ -143,14 +143,14 @@ void Parallaction::updateView() { void Parallaction::pauseJobs() { debugC(9, kDebugExec, "pausing jobs execution"); - _engineFlags |= kEnginePauseJobs; + g_engineFlags |= kEnginePauseJobs; return; } void Parallaction::resumeJobs() { debugC(9, kDebugExec, "resuming jobs execution"); - _engineFlags &= ~kEnginePauseJobs; + g_engineFlags &= ~kEnginePauseJobs; return; } @@ -261,7 +261,7 @@ void Parallaction::runGameFrame(int event) { if (shouldQuit()) return; - if (_engineFlags & kEngineChangeLocation) { + if (g_engineFlags & kEngineChangeLocation) { changeLocation(); } @@ -896,14 +896,14 @@ void CharacterName::bind(const char *name) { if (!_dummy) { if (!strcmp(name, "donna")) { - _engineFlags &= ~kEngineTransformedDonna; + g_engineFlags &= ~kEngineTransformedDonna; } else { - if (_engineFlags & kEngineTransformedDonna) { + if (g_engineFlags & kEngineTransformedDonna) { _suffix = _suffixTras; } else { const char *s = strstr(name, "tras"); if (s) { - _engineFlags |= kEngineTransformedDonna; + g_engineFlags |= kEngineTransformedDonna; _suffix = _suffixTras; end = s; } @@ -949,7 +949,7 @@ void Parallaction::beep() { void Parallaction::scheduleLocationSwitch(const char *location) { debugC(9, kDebugExec, "scheduleLocationSwitch(%s)\n", location); _newLocationName = location; - _engineFlags |= kEngineChangeLocation; + g_engineFlags |= kEngineChangeLocation; } } // End of namespace Parallaction diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 0d56b62e2f..2dbb0227d6 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -104,17 +104,17 @@ struct PARALLACTIONGameDescription; -extern uint32 _engineFlags; -extern char _saveData1[]; -extern uint32 _globalFlags; -extern const char *_dinoName; -extern const char *_donnaName; -extern const char *_doughName; -extern const char *_drkiName; -extern const char *_minidinoName; -extern const char *_minidonnaName; -extern const char *_minidoughName; -extern const char *_minidrkiName; +extern uint32 g_engineFlags; +extern char g_saveData1[]; +extern uint32 g_globalFlags; +extern const char *g_dinoName; +extern const char *g_donnaName; +extern const char *g_doughName; +extern const char *g_drkiName; +extern const char *g_minidinoName; +extern const char *g_minidonnaName; +extern const char *g_minidoughName; +extern const char *g_minidrkiName; @@ -601,7 +601,7 @@ private: void _c_password(void *); }; -extern Parallaction *_vm; +extern Parallaction *g_vm; } // End of namespace Parallaction diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 658a8e8795..07755fac5f 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -79,7 +79,7 @@ Common::Error Parallaction_br::init() { _cmdExec = new CommandExec_br(this); _programExec = new ProgramExec_br(this); - _walker = new PathWalker_BR; + _walker = new PathWalker_BR(this); _part = -1; _nextPart = -1; @@ -161,10 +161,10 @@ Common::Error Parallaction_br::go() { // initCharacter(); - while (((_engineFlags & kEngineReturn) == 0) && (!shouldQuit())) { + while (((g_engineFlags & kEngineReturn) == 0) && (!shouldQuit())) { runGame(); } - _engineFlags &= ~kEngineReturn; + g_engineFlags &= ~kEngineReturn; cleanupGame(); } @@ -259,7 +259,7 @@ void Parallaction_br::cleanupGame() { _countersNames = 0; _numLocations = 0; - _globalFlags = 0; + g_globalFlags = 0; memset(_localFlags, 0, sizeof(_localFlags)); memset(_locationNames, 0, sizeof(_locationNames)); memset(_zoneFlags, 0, sizeof(_zoneFlags)); @@ -275,7 +275,7 @@ void Parallaction_br::changeLocation() { cleanupGame(); // more cleanup needed for part changes (see also saveload) - _globalFlags = 0; + g_globalFlags = 0; cleanInventory(true); strcpy(_characterName1, "null"); @@ -358,7 +358,7 @@ void Parallaction_br::changeLocation() { // TODO: implement the music commands which control music execution _soundMan->execute(SC_PLAYMUSIC); - _engineFlags &= ~kEngineChangeLocation; + g_engineFlags &= ~kEngineChangeLocation; _newLocationName.clear(); _nextPart = -1; } @@ -548,7 +548,7 @@ void Parallaction_br::scheduleWalk(int16 x, int16 y, bool fromUser) { } } - _engineFlags |= kEngineWalking; + g_engineFlags |= kEngineWalking; } void Parallaction_br::setFollower(const Common::String &name) { diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 0b92db1f0a..2a22e77410 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -182,7 +182,7 @@ Common::Error Parallaction_ns::init() { _cmdExec = new CommandExec_ns(this); _programExec = new ProgramExec_ns(this); - _walker = new PathWalker_NS; + _walker = new PathWalker_NS(this); _sarcophagusDeltaX = 0; _movingSarcophagus = false; @@ -382,8 +382,8 @@ void Parallaction_ns::changeLocation() { changeCharacter(locname.character()); } - strcpy(_saveData1, locname.location()); - parseLocation(_saveData1); + strcpy(g_saveData1, locname.location()); + parseLocation(g_saveData1); if (_location._startPosition.x != -1000) { _char._ani->setX(_location._startPosition.x); @@ -399,7 +399,7 @@ void Parallaction_ns::changeLocation() { // BUG #1837503: kEngineChangeLocation flag must be cleared *before* commands // and acommands are executed, so that it can be set again if needed. - _engineFlags &= ~kEngineChangeLocation; + g_engineFlags &= ~kEngineChangeLocation; _cmdExec->run(_location._commands); @@ -526,10 +526,10 @@ void Parallaction_ns::cleanupGame() { _soundManI->stopMusic(); _inTestResult = false; - _engineFlags &= ~kEngineTransformedDonna; + g_engineFlags &= ~kEngineTransformedDonna; _numLocations = 0; - _globalFlags = 0; + g_globalFlags = 0; memset(_localFlags, 0, sizeof(_localFlags)); memset(_locationNames, 0, sizeof(_locationNames)); @@ -553,7 +553,7 @@ void Parallaction_ns::scheduleWalk(int16 x, int16 y, bool fromUser) { } _walker->buildPath(a, x, y); - _engineFlags |= kEngineWalking; + g_engineFlags |= kEngineWalking; } }// namespace Parallaction diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index 0904dbf655..e7f1b1b1ed 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -767,10 +767,10 @@ void LocationParser_br::parseGetData(ZonePtr z) { data->_gfxobj = obj; } else if (!scumm_stricmp(_tokens[0], "mask")) { - _out->_info->loadGfxObjMask(_tokens[1], data->_gfxobj); + _out->_info->loadGfxObjMask(_vm, _tokens[1], data->_gfxobj); } else if (!scumm_stricmp(_tokens[0], "path")) { - _out->_info->loadGfxObjPath(_tokens[1], data->_gfxobj); + _out->_info->loadGfxObjPath(_vm, _tokens[1], data->_gfxobj); } else if (!scumm_stricmp(_tokens[0], "icon")) { data->_getIcon = 4 + _vm->_objectsNames->lookup(_tokens[1]); diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index f1d1db53e9..41ff74f0b4 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -246,7 +246,7 @@ DECLARE_ANIM_PARSER(file) { char vC8[200]; strcpy(vC8, _tokens[1]); - if (_engineFlags & kEngineTransformedDonna) { + if (g_engineFlags & kEngineTransformedDonna) { if (!scumm_stricmp(_tokens[1], "donnap") || !scumm_stricmp(_tokens[1], "donnapa")) { strcat(vC8, "tras"); } diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index 8de2d89b18..2ecc5377a4 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -88,7 +88,7 @@ void SaveLoad_ns::doLoadGame(uint16 slot) { _vm->_score = atoi(s.c_str()); s = f->readLine(); - _globalFlags = atoi(s.c_str()); + g_globalFlags = atoi(s.c_str()); s = f->readLine(); _vm->_numLocations = atoi(s.c_str()); @@ -151,7 +151,7 @@ void SaveLoad_ns::doSaveGame(uint16 slot, const char* name) { sprintf(s, "%s\n", _vm->_char.getFullName()); f->writeString(s); - sprintf(s, "%s\n", _saveData1); + sprintf(s, "%s\n", g_saveData1); f->writeString(s); sprintf(s, "%d\n", _vm->_char._ani->getX()); f->writeString(s); @@ -159,7 +159,7 @@ void SaveLoad_ns::doSaveGame(uint16 slot, const char* name) { f->writeString(s); sprintf(s, "%d\n", _vm->_score); f->writeString(s); - sprintf(s, "%u\n", _globalFlags); + sprintf(s, "%u\n", g_globalFlags); f->writeString(s); sprintf(s, "%d\n", _vm->_numLocations); diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp index dcc71e4f2f..0ee3d73556 100644 --- a/engines/parallaction/sound_ns.cpp +++ b/engines/parallaction/sound_ns.cpp @@ -168,13 +168,13 @@ void DosSoundMan_ns::playCharacterMusic(const char *character) { char *name = const_cast<char *>(character); const char *newMusicFile = 0; - if (!scumm_stricmp(name, _dinoName)) { + if (!scumm_stricmp(name, g_dinoName)) { newMusicFile = "dino"; } else - if (!scumm_stricmp(name, _donnaName)) { + if (!scumm_stricmp(name, g_donnaName)) { newMusicFile = "donna"; } else - if (!scumm_stricmp(name, _doughName)) { + if (!scumm_stricmp(name, g_doughName)) { newMusicFile = "nuts"; } else { warning("unknown character '%s' in DosSoundMan_ns_ns::playCharacterMusic", character); diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp index 73e78cae3c..f09b1241bc 100644 --- a/engines/parallaction/staticres.cpp +++ b/engines/parallaction/staticres.cpp @@ -89,14 +89,14 @@ byte Input::_resMouseArrow_BR_Amiga[512] = { /* This palette snippet is used for animations in Big Red Adventure. */ -byte _braAmigaFramesDefaultPalette[48] = { +byte braAmigaFramesDefaultPalette[48] = { 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0xFF, 0xE0, 0xCF, 0x7F, 0x7F, 0x7F, 0xD9, 0x9C, 0x84, 0x00, 0x9E, 0xF0, 0x91, 0xCC, 0x36, 0xFF, 0x6A, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0x11, 0xB0, 0xEE, 0xF0, 0xFF, 0x17, 0x3D, 0x18, 0xAC, 0x3A, 0xB0, 0x00, 0x00, 0x7D, 0x00, 0x00, 0xFF, 0xA8, 0xFF, }; -byte _amigaTopazFont[2600] = { +byte amigaTopazFont[2600] = { 0x00, 0x00, 0x03, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x79, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x02, 0x79, 0x70, 0xff, 0x4e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, @@ -263,7 +263,7 @@ byte _amigaTopazFont[2600] = { }; -const char *_callableNamesRes_ns[] = { +const char *callableNamesRes_ns[] = { "Projector", "HBOff", "StartIntro", @@ -292,7 +292,7 @@ const char *_callableNamesRes_ns[] = { }; -const char *_callableNamesRes_br[] = { +const char *callableNamesRes_br[] = { "blufade", "resetpalette", "ferrcycle", @@ -301,15 +301,15 @@ const char *_callableNamesRes_br[] = { "password" }; -const char *_dinoName = "dino"; -const char *_donnaName = "donna"; -const char *_doughName = "dough"; -const char *_drkiName = "drki"; +const char *g_dinoName = "dino"; +const char *g_donnaName = "donna"; +const char *g_doughName = "dough"; +const char *g_drkiName = "drki"; -const char *_minidinoName = "minidino"; -const char *_minidonnaName = "minidonna"; -const char *_minidoughName = "minidough"; -const char *_minidrkiName = "minidrki"; +const char *g_minidinoName = "minidino"; +const char *g_minidonnaName = "minidonna"; +const char *g_minidoughName = "minidough"; +const char *g_minidrkiName = "minidrki"; #define CALLABLE_NS(x) &Parallaction_ns::x @@ -391,7 +391,7 @@ const Parallaction_br::Callable Parallaction_br::_amigaCallables[] = { void Parallaction_ns::initResources() { - _callableNames = new Table(ARRAYSIZE(_callableNamesRes_ns), _callableNamesRes_ns); + _callableNames = new Table(ARRAYSIZE(callableNamesRes_ns), callableNamesRes_ns); _localFlagNames = new FixedTable(NUM_LOCATIONS, 1); _localFlagNames->addData("visited"); @@ -406,7 +406,7 @@ void Parallaction_ns::initResources() { void Parallaction_br::initResources() { - _callableNames = new Table(ARRAYSIZE(_callableNamesRes_br), _callableNamesRes_br); + _callableNames = new Table(ARRAYSIZE(callableNamesRes_br), callableNamesRes_br); _localFlagNames = new FixedTable(NUM_LOCATIONS, 2); _localFlagNames->addData("visited"); diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 53237db4ef..19162cd7db 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -55,27 +55,27 @@ WalkFrames _char24WalkFrames_NS = { }; static int getPathWidth() { - if (!_vm->_gfx->_backgroundInfo->_path) { + if (!g_vm->_gfx->_backgroundInfo->_path) { warning("getPathWidth() _path is NULL!"); return 0; } else - return _vm->_gfx->_backgroundInfo->_path->w; + return g_vm->_gfx->_backgroundInfo->_path->w; } static int getPathHeight() { - if (!_vm->_gfx->_backgroundInfo->_path) { + if (!g_vm->_gfx->_backgroundInfo->_path) { warning("getPathHeight() _path is NULL!"); return 0; } else - return _vm->_gfx->_backgroundInfo->_path->h; + return g_vm->_gfx->_backgroundInfo->_path->h; } static bool isPathClear(uint16 x, uint16 y) { - if (!_vm->_gfx->_backgroundInfo->_path) { + if (!g_vm->_gfx->_backgroundInfo->_path) { warning("isPathClear() _path is NULL!"); return false; } else - return (_vm->_gfx->_backgroundInfo->_path->getValue(x, y) ? true : false); + return (g_vm->_gfx->_backgroundInfo->_path->getValue(x, y) ? true : false); } // adjusts position towards nearest walkable point @@ -306,7 +306,7 @@ void PathWalker_NS::checkDoor(const Common::Point &foot) { } void PathWalker_NS::finalizeWalk() { - _engineFlags &= ~kEngineWalking; + g_engineFlags &= ~kEngineWalking; Common::Point foot; _a->getFoot(foot); @@ -316,7 +316,7 @@ void PathWalker_NS::finalizeWalk() { } void PathWalker_NS::walk() { - if ((_engineFlags & kEngineWalking) == 0) { + if ((g_engineFlags & kEngineWalking) == 0) { return; } @@ -382,7 +382,7 @@ void PathWalker_NS::updateDirection(const Common::Point& pos, const Common::Poin _a->setF(frames->firstWalkFrame[_direction] + (_step / frames->frameRepeat[_direction]) % frames->numWalkFrames[_direction]); } -PathWalker_NS::PathWalker_NS() : _direction(WALK_DOWN), _step(0) { +PathWalker_NS::PathWalker_NS(Parallaction *vm) : _direction(WALK_DOWN), _step(0), _vm(vm) { } bool PathWalker_BR::directPathExists(const Common::Point &from, const Common::Point &to) { @@ -481,7 +481,7 @@ void PathWalker_BR::buildPath(State &s, uint16 x, uint16 y) { } void PathWalker_BR::finalizeWalk(State &s) { - _engineFlags &= ~kEngineWalking; + g_engineFlags &= ~kEngineWalking; Common::Point foot; _character._a->getFoot(foot); @@ -508,8 +508,8 @@ void PathWalker_BR::finalizeWalk(State &s) { #if 0 // TODO: Input::walkTo must be extended to support destination frame in addition to coordinates - if (_engineFlags & FINAL_WALK_FRAME) { // this flag is set in readInput() - _engineFlags &= ~FINAL_WALK_FRAME; + if (g_engineFlags & FINAL_WALK_FRAME) { // this flag is set in readInput() + g_engineFlags &= ~FINAL_WALK_FRAME; _ch._a->_frame = _moveToF; // from readInput()... } else { _ch._a->_frame = _dirFrame; // from walk() @@ -523,7 +523,7 @@ void PathWalker_BR::finalizeWalk(State &s) { } void PathWalker_BR::walk() { - if ((_engineFlags & kEngineWalking) == 0) { + if ((g_engineFlags & kEngineWalking) == 0) { return; } @@ -714,7 +714,7 @@ void PathWalker_BR::doWalk(State &s) { } } -PathWalker_BR::PathWalker_BR() { +PathWalker_BR::PathWalker_BR(Parallaction *vm) : _vm(vm) { _character._active = false; _character._step = 0; _follower._active = false; diff --git a/engines/parallaction/walk.h b/engines/parallaction/walk.h index 6796991f9d..ae6db6eaf1 100644 --- a/engines/parallaction/walk.h +++ b/engines/parallaction/walk.h @@ -49,8 +49,10 @@ class PathWalker_NS { void checkDoor(const Common::Point &foot); void updateDirection(const Common::Point& pos, const Common::Point& to); + Parallaction *_vm; + public: - PathWalker_NS(); + PathWalker_NS(Parallaction *vm); void buildPath(AnimationPtr a, uint16 x, uint16 y); void walk(); @@ -79,8 +81,10 @@ class PathWalker_BR { void doWalk(State &s); void checkTrap(const Common::Point &p); + Parallaction *_vm; + public: - PathWalker_BR(); + PathWalker_BR(Parallaction *vm); ~PathWalker_BR() { } void setCharacterPath(AnimationPtr a, uint16 x, uint16 y); |