aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-01-11 15:47:41 +0000
committerTorbjörn Andersson2004-01-11 15:47:41 +0000
commitcf0a73f913174599c7c28d910ecd87229fd62afd (patch)
tree7eabb5c16878d42f35d811ed13af5ed20b763f92
parent563d95c576c817a63ec64302e67b2ee5daa97c6e (diff)
downloadscummvm-rg350-cf0a73f913174599c7c28d910ecd87229fd62afd.tar.gz
scummvm-rg350-cf0a73f913174599c7c28d910ecd87229fd62afd.tar.bz2
scummvm-rg350-cf0a73f913174599c7c28d910ecd87229fd62afd.zip
Introduced new namespace, Sword1, removing the "Sword" and "Bs" prefixes in
the process, except for SwordEngine. Some minor cleanups along the wa, e.g. stdafx.h already includes <stdio.h>, <stdlib.h> and <math.h> so there shouldn't be any need to do it elsewhere. svn-id: r12320
-rw-r--r--sword1/collision.h19
-rw-r--r--sword1/control.cpp117
-rw-r--r--sword1/control.h26
-rw-r--r--sword1/debug.cpp31
-rw-r--r--sword1/debug.h6
-rw-r--r--sword1/eventman.cpp9
-rw-r--r--sword1/eventman.h10
-rw-r--r--sword1/logic.cpp498
-rw-r--r--sword1/logic.h270
-rw-r--r--sword1/memman.cpp17
-rw-r--r--sword1/memman.h24
-rw-r--r--sword1/menu.cpp114
-rw-r--r--sword1/menu.h30
-rw-r--r--sword1/mouse.cpp98
-rw-r--r--sword1/mouse.h25
-rw-r--r--sword1/music.cpp36
-rw-r--r--sword1/music.h20
-rw-r--r--sword1/object.h8
-rw-r--r--sword1/objectman.cpp8
-rw-r--r--sword1/objectman.h8
-rw-r--r--sword1/resman.cpp42
-rw-r--r--sword1/resman.h20
-rw-r--r--sword1/router.cpp178
-rw-r--r--sword1/router.h18
-rw-r--r--sword1/screen.cpp150
-rw-r--r--sword1/screen.h21
-rw-r--r--sword1/sound.cpp44
-rw-r--r--sword1/sound.h13
-rw-r--r--sword1/staticres.cpp16
-rw-r--r--sword1/sword1.cpp780
-rw-r--r--sword1/sword1.h42
-rw-r--r--sword1/sworddefs.h4
-rw-r--r--sword1/swordres.h4
-rw-r--r--sword1/text.cpp26
-rw-r--r--sword1/text.h15
35 files changed, 1419 insertions, 1328 deletions
diff --git a/sword1/collision.h b/sword1/collision.h
index 168c0a49cd..3885216236 100644
--- a/sword1/collision.h
+++ b/sword1/collision.h
@@ -24,12 +24,14 @@
/*#include "objectman.h"
-class SwordLogic;
+namespace Sword1 {
-class SwordCollision {
+class Logic;
+
+class Collision {
public:
- SwordCollision(ObjectMan *pObjMan, SwordLogic *pLogic);
- ~SwordCollision(void);
+ Collision(ObjectMan *pObjMan, Logic *pLogic);
+ ~Collision(void);
void checkCollisions(void);
void fnBumpOff(void);
void fnBumpOn(void);
@@ -37,8 +39,11 @@ private:
int32 getIntersect(int32 x0, int32 y0, int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3);
int noCol;
ObjectMan *_objMan;
- SwordLogic *_logic; // for CFN_preset_script
-};*/
-// maybe it's better to make this part of SwordRouter
+ Logic *_logic; // for CFN_preset_script
+};
+
+} // End of namespace Sword1
+*/
+// maybe it's better to make this part of Router
#endif // BSCOLLISION_H
diff --git a/sword1/control.cpp b/sword1/control.cpp
index 9d65a7af51..c7437100f9 100644
--- a/sword1/control.cpp
+++ b/sword1/control.cpp
@@ -32,8 +32,9 @@
#include "common/util.h"
#include "mouse.h"
#include "music.h"
-#include "sound.h"
-#include <math.h> // for sqrt()
+#include "sound.h"
+
+namespace Sword1 {
#define SAVEFILE_WRITE true
#define SAVEFILE_READ false
@@ -152,7 +153,7 @@ void ControlButton::setSelected(uint8 selected) {
draw();
}
-SwordControl::SwordControl(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, SwordMouse *pMouse, SwordSound *pSound, SwordMusic *pMusic, const char *savePath) {
+Control::Control(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic, const char *savePath) {
_resMan = pResMan;
_objMan = pObjMan;
_system = system;
@@ -163,7 +164,7 @@ SwordControl::SwordControl(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system,
_lStrings = _languageStrings + MIN(SwordEngine::_systemVars.language, (uint8)BS1_SPANISH) * 20;
}
-void SwordControl::askForCd(void) {
+void Control::askForCd(void) {
_screenBuf = (uint8*)malloc(640 * 480);
uint32 fontId = SR_FONT;
if (SwordEngine::_systemVars.language == BS1_CZECH)
@@ -217,7 +218,7 @@ void SwordControl::askForCd(void) {
free(_screenBuf);
}
-uint8 SwordControl::runPanel(void) {
+uint8 Control::runPanel(void) {
_mouseDown = false;
_restoreBuf = NULL;
_keyPressed = _numButtons = 0;
@@ -291,11 +292,11 @@ uint8 SwordControl::runPanel(void) {
_system->copy_rect(_screenBuf, 640, 0, 0, 640, 480);
free(_screenBuf);
_mouse->controlPanel(false);
- _music->startMusic(SwordLogic::_scriptVars[CURRENT_MUSIC], 1);
+ _music->startMusic(Logic::_scriptVars[CURRENT_MUSIC], 1);
return retVal;
}
-uint8 SwordControl::getClicks(uint8 mode, uint8 *retVal) {
+uint8 Control::getClicks(uint8 mode, uint8 *retVal) {
uint8 checkButtons = _numButtons;
if (mode == BUTTON_VOLUME_PANEL) {
handleVolumeClicks();
@@ -332,7 +333,7 @@ uint8 SwordControl::getClicks(uint8 mode, uint8 *retVal) {
return 0;
}
-uint8 SwordControl::handleButtonClick(uint8 id, uint8 mode, uint8 *retVal) {
+uint8 Control::handleButtonClick(uint8 id, uint8 mode, uint8 *retVal) {
switch(mode) {
case BUTTON_MAIN_PANEL:
if (id == BUTTON_RESTART) {
@@ -380,12 +381,12 @@ uint8 SwordControl::handleButtonClick(uint8 id, uint8 mode, uint8 *retVal) {
return 0;
}
-void SwordControl::deselectSaveslots(void) {
+void Control::deselectSaveslots(void) {
for (uint8 cnt = 0; cnt < 8; cnt++)
_buttons[cnt]->setSelected(0);
}
-void SwordControl::setupMainPanel(void) {
+void Control::setupMainPanel(void) {
uint32 panelId;
if (SwordEngine::_systemVars.deathScreenFlag == 1)
@@ -426,7 +427,7 @@ void SwordControl::setupMainPanel(void) {
}
}
-void SwordControl::setupSaveRestorePanel(bool saving) {
+void Control::setupSaveRestorePanel(bool saving) {
FrameHeader *savePanel = _resMan->fetchFrame(_resMan->openFetchRes(SR_WINDOW), 0);
uint16 panelX = (640 - FROM_LE_16(savePanel->width)) / 2;
uint16 panelY = (480 - FROM_LE_16(savePanel->height)) / 2;
@@ -446,7 +447,7 @@ void SwordControl::setupSaveRestorePanel(bool saving) {
showSavegameNames();
}
-void SwordControl::setupVolumePanel(void) {
+void Control::setupVolumePanel(void) {
ControlButton *panel = new ControlButton( 0, 0, SR_VOLUME, 0, _resMan, _screenBuf, _system);
panel->draw();
delete panel;
@@ -467,7 +468,7 @@ void SwordControl::setupVolumePanel(void) {
renderVolumeBar(3, volL, volR);
}
-void SwordControl::handleVolumeClicks(void) {
+void Control::handleVolumeClicks(void) {
if (_mouseDown) {
uint8 clickedId = 0;
for (uint8 cnt = 1; cnt < 4; cnt++)
@@ -511,7 +512,7 @@ void SwordControl::handleVolumeClicks(void) {
}
}
-void SwordControl::changeVolume(uint8 id, uint8 action) {
+void Control::changeVolume(uint8 id, uint8 action) {
// ids: 1 = music, 2 = speech, 3 = sfx
uint8 volL = 0, volR = 0;
if (id == 1)
@@ -552,7 +553,7 @@ void SwordControl::changeVolume(uint8 id, uint8 action) {
renderVolumeBar(id, volL, volR);
}
-bool SwordControl::getConfirm(const uint8 *title) {
+bool Control::getConfirm(const uint8 *title) {
ControlButton *panel = new ControlButton( 0, 0, SR_CONFIRM, 0, _resMan, _screenBuf, _system);
panel->draw();
delete panel;
@@ -592,7 +593,7 @@ bool SwordControl::getConfirm(const uint8 *title) {
return retVal == 1;
}
-bool SwordControl::keyAccepted(uint8 key) {
+bool Control::keyAccepted(uint8 key) {
// this routine needs changes for Czech keys... No idea how to do that, though.
static const char allowedSpecials[] = "éèáàúùäöüÄÖÜß,.:-()?! \"\'";
if (((key >= 'A') && (key <= 'Z')) ||
@@ -604,7 +605,7 @@ bool SwordControl::keyAccepted(uint8 key) {
return false;
}
-void SwordControl::handleSaveKey(uint8 key) {
+void Control::handleSaveKey(uint8 key) {
if (_selectedSavegame < 255) {
uint8 len = strlen((char*)_saveNames[_selectedSavegame]);
if ((key == 8) && len) // backspace
@@ -617,7 +618,7 @@ void SwordControl::handleSaveKey(uint8 key) {
}
}
-bool SwordControl::saveToFile(void) {
+bool Control::saveToFile(void) {
if ((_selectedSavegame == 255) || !strlen((char*)_saveNames[_selectedSavegame]))
return false; // no saveslot selected or no name entered
saveGameToFile(_selectedSavegame);
@@ -625,14 +626,14 @@ bool SwordControl::saveToFile(void) {
return true;
}
-bool SwordControl::restoreFromFile(void) {
+bool Control::restoreFromFile(void) {
if (_selectedSavegame < 255) {
return restoreGameFromFile(_selectedSavegame);
} else
return false;
}
-void SwordControl::readSavegameDescriptions(void) {
+void Control::readSavegameDescriptions(void) {
SaveFileManager *mgr = _system->get_savefile_manager();
SaveFile *inf;
inf = mgr->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_READ);
@@ -663,7 +664,7 @@ void SwordControl::readSavegameDescriptions(void) {
delete mgr;
}
-void SwordControl::writeSavegameDescriptions(void) {
+void Control::writeSavegameDescriptions(void) {
SaveFileManager *mgr = _system->get_savefile_manager();
SaveFile *outf;
outf = mgr->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_WRITE);
@@ -682,7 +683,7 @@ void SwordControl::writeSavegameDescriptions(void) {
delete mgr;
}
-bool SwordControl::savegamesExist(void) {
+bool Control::savegamesExist(void) {
bool retVal = false;
SaveFileManager *mgr = _system->get_savefile_manager();
SaveFile *inf;
@@ -694,7 +695,7 @@ bool SwordControl::savegamesExist(void) {
return retVal;
}
-void SwordControl::showSavegameNames(void) {
+void Control::showSavegameNames(void) {
for (uint8 cnt = 0; cnt < 8; cnt++) {
_buttons[cnt]->draw();
uint8 textMode = TEXT_LEFT_ALIGN;
@@ -707,7 +708,7 @@ void SwordControl::showSavegameNames(void) {
}
}
-void SwordControl::saveNameSelect(uint8 id, bool saving) {
+void Control::saveNameSelect(uint8 id, bool saving) {
deselectSaveslots();
_buttons[id - BUTTON_SAVE_SELECT1]->setSelected(1);
uint8 num = (id - BUTTON_SAVE_SELECT1) + _saveScrollPos;
@@ -729,7 +730,7 @@ void SwordControl::saveNameSelect(uint8 id, bool saving) {
showSavegameNames();
}
-void SwordControl::saveNameScroll(uint8 scroll, bool saving) {
+void Control::saveNameScroll(uint8 scroll, bool saving) {
uint16 maxScroll;
if (saving)
maxScroll = 64;
@@ -757,7 +758,7 @@ void SwordControl::saveNameScroll(uint8 scroll, bool saving) {
showSavegameNames();
}
-void SwordControl::createButtons(const ButtonInfo *buttons, uint8 num) {
+void Control::createButtons(const ButtonInfo *buttons, uint8 num) {
for (uint8 cnt = 0; cnt < num; cnt++) {
_buttons[cnt] = new ControlButton(buttons[cnt].x, buttons[cnt].y, buttons[cnt].resId, buttons[cnt].id, _resMan, _screenBuf, _system);
_buttons[cnt]->draw();
@@ -765,13 +766,13 @@ void SwordControl::createButtons(const ButtonInfo *buttons, uint8 num) {
_numButtons = num;
}
-void SwordControl::destroyButtons(void) {
+void Control::destroyButtons(void) {
for (uint8 cnt = 0; cnt < _numButtons; cnt++)
delete _buttons[cnt];
_numButtons = 0;
}
-uint16 SwordControl::getTextWidth(const uint8 *str) {
+uint16 Control::getTextWidth(const uint8 *str) {
uint16 width = 0;
while (*str) {
width += FROM_LE_16(_resMan->fetchFrame(_font, *str - 32)->width) - 3;
@@ -780,7 +781,7 @@ uint16 SwordControl::getTextWidth(const uint8 *str) {
return width;
}
-void SwordControl::renderText(const uint8 *str, uint16 x, uint16 y, uint8 mode) {
+void Control::renderText(const uint8 *str, uint16 x, uint16 y, uint8 mode) {
uint8 *font = _font;
if (mode & TEXT_RED_FONT)
font = _redFont;
@@ -811,7 +812,7 @@ void SwordControl::renderText(const uint8 *str, uint16 x, uint16 y, uint8 mode)
_system->copy_rect(_screenBuf + y * SCREEN_WIDTH + x, SCREEN_WIDTH, x, y, (destX - x) + 3, 28);
}
-void SwordControl::renderVolumeBar(uint8 id, uint8 volL, uint8 volR) {
+void Control::renderVolumeBar(uint8 id, uint8 volL, uint8 volR) {
uint16 destX = _volumeButtons[id].x + 20;
uint16 destY = _volumeButtons[id].y + 116;
@@ -831,7 +832,7 @@ void SwordControl::renderVolumeBar(uint8 id, uint8 volL, uint8 volR) {
}
}
-void SwordControl::saveGameToFile(uint8 slot) {
+void Control::saveGameToFile(uint8 slot) {
char fName[15];
uint16 cnt;
sprintf(fName, "SAVEGAME.%03d", slot);
@@ -846,17 +847,17 @@ void SwordControl::saveGameToFile(uint8 slot) {
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
outf->writeUint16LE(liveBuf[cnt]);
- BsObject *cpt = _objMan->fetchObject(PLAYER);
- SwordLogic::_scriptVars[CHANGE_DIR] = cpt->o_dir;
- SwordLogic::_scriptVars[CHANGE_X] = cpt->o_xcoord;
- SwordLogic::_scriptVars[CHANGE_Y] = cpt->o_ycoord;
- SwordLogic::_scriptVars[CHANGE_STANCE] = STAND;
- SwordLogic::_scriptVars[CHANGE_PLACE] = cpt->o_place;
+ Object *cpt = _objMan->fetchObject(PLAYER);
+ Logic::_scriptVars[CHANGE_DIR] = cpt->o_dir;
+ Logic::_scriptVars[CHANGE_X] = cpt->o_xcoord;
+ Logic::_scriptVars[CHANGE_Y] = cpt->o_ycoord;
+ Logic::_scriptVars[CHANGE_STANCE] = STAND;
+ Logic::_scriptVars[CHANGE_PLACE] = cpt->o_place;
for (cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++)
- outf->writeUint32LE(SwordLogic::_scriptVars[cnt]);
+ outf->writeUint32LE(Logic::_scriptVars[cnt]);
- uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
+ uint32 playerSize = (sizeof(Object) - 12000) / 4;
uint32 *playerRaw = (uint32*)cpt;
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++)
outf->writeUint32LE(playerRaw[cnt2]);
@@ -864,7 +865,7 @@ void SwordControl::saveGameToFile(uint8 slot) {
delete mgr;
}
-bool SwordControl::restoreGameFromFile(uint8 slot) {
+bool Control::restoreGameFromFile(uint8 slot) {
char fName[15];
uint16 cnt;
sprintf(fName, "SAVEGAME.%03d", slot);
@@ -880,7 +881,7 @@ bool SwordControl::restoreGameFromFile(uint8 slot) {
_restoreBuf = (uint8*)malloc(
TOTAL_SECTIONS * 2 +
NUM_SCRIPT_VARS * 4 +
- (sizeof(BsObject) - 12000));
+ (sizeof(Object) - 12000));
uint16 *liveBuf = (uint16*)_restoreBuf;
uint32 *scriptBuf = (uint32*)(_restoreBuf + 2 * TOTAL_SECTIONS);
@@ -892,7 +893,7 @@ bool SwordControl::restoreGameFromFile(uint8 slot) {
for (cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++)
scriptBuf[cnt] = inf->readUint32LE();
- uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
+ uint32 playerSize = (sizeof(Object) - 12000) / 4;
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++)
playerBuf[cnt2] = inf->readUint32LE();
@@ -901,32 +902,32 @@ bool SwordControl::restoreGameFromFile(uint8 slot) {
return true;
}
-void SwordControl::doRestore(void) {
+void Control::doRestore(void) {
uint8 *bufPos = _restoreBuf;
_objMan->loadLiveList((uint16*)bufPos);
bufPos += TOTAL_SECTIONS * 2;
for (uint16 cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++) {
- SwordLogic::_scriptVars[cnt] = *(uint32*)bufPos;
+ Logic::_scriptVars[cnt] = *(uint32*)bufPos;
bufPos += 4;
}
- uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
+ uint32 playerSize = (sizeof(Object) - 12000) / 4;
uint32 *playerRaw = (uint32*)_objMan->fetchObject(PLAYER);
- BsObject *cpt = _objMan->fetchObject(PLAYER);
+ Object *cpt = _objMan->fetchObject(PLAYER);
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++) {
*playerRaw = *(uint32*)bufPos;
playerRaw++;
bufPos += 4;
}
free(_restoreBuf);
- SwordLogic::_scriptVars[CHANGE_DIR] = cpt->o_dir;
- SwordLogic::_scriptVars[CHANGE_X] = cpt->o_xcoord;
- SwordLogic::_scriptVars[CHANGE_Y] = cpt->o_ycoord;
- SwordLogic::_scriptVars[CHANGE_STANCE] = STAND;
- SwordLogic::_scriptVars[CHANGE_PLACE] = cpt->o_place;
+ Logic::_scriptVars[CHANGE_DIR] = cpt->o_dir;
+ Logic::_scriptVars[CHANGE_X] = cpt->o_xcoord;
+ Logic::_scriptVars[CHANGE_Y] = cpt->o_ycoord;
+ Logic::_scriptVars[CHANGE_STANCE] = STAND;
+ Logic::_scriptVars[CHANGE_PLACE] = cpt->o_place;
SwordEngine::_systemVars.justRestoredGame = 1;
}
-void SwordControl::delay(uint32 msecs) {
+void Control::delay(uint32 msecs) {
OSystem::Event event;
uint32 endTime = _system->get_msecs() + msecs;
@@ -971,13 +972,13 @@ void SwordControl::delay(uint32 msecs) {
} while (_system->get_msecs() < endTime);
}
-const ButtonInfo SwordControl::_deathButtons[3] = {
+const ButtonInfo Control::_deathButtons[3] = {
{250, 224 + 40, SR_BUTTON, BUTTON_RESTORE_PANEL },
{250, 260 + 40, SR_BUTTON, BUTTON_RESTART },
{250, 296 + 40, SR_BUTTON, BUTTON_QUIT }
};
-const ButtonInfo SwordControl::_panelButtons[7] = {
+const ButtonInfo Control::_panelButtons[7] = {
{145, 188 + 40, SR_BUTTON, BUTTON_SAVE_PANEL },
{145, 224 + 40, SR_BUTTON, BUTTON_RESTORE_PANEL },
{145, 260 + 40, SR_BUTTON, BUTTON_RESTART },
@@ -987,7 +988,7 @@ const ButtonInfo SwordControl::_panelButtons[7] = {
{475, 332 + 40, SR_BUTTON, BUTTON_DONE }
};
-const ButtonInfo SwordControl::_saveButtons[16] = {
+const ButtonInfo Control::_saveButtons[16] = {
{114, 32 + 40, SR_SLAB1, BUTTON_SAVE_SELECT1 },
{114, 68 + 40, SR_SLAB2, BUTTON_SAVE_SELECT2 },
{114, 104 + 40, SR_SLAB3, BUTTON_SAVE_SELECT3 },
@@ -1006,14 +1007,14 @@ const ButtonInfo SwordControl::_saveButtons[16] = {
{462, 338 + 40, SR_BUTTON, BUTTON_SAVE_CANCEL}
};
-const ButtonInfo SwordControl::_volumeButtons[4] = {
+const ButtonInfo Control::_volumeButtons[4] = {
{ 478, 338 + 40, SR_BUTTON, BUTTON_MAIN_PANEL },
{ 138, 135, SR_VKNOB, 0 },
{ 273, 135, SR_VKNOB, 0 },
{ 404, 135, SR_VKNOB, 0 },
};
-const uint8 SwordControl::_languageStrings[8 * 20][43] = {
+const uint8 Control::_languageStrings[8 * 20][43] = {
// BS1_ENGLISH:
"PAUSED",
"PLEASE INSERT CD-",
@@ -1162,3 +1163,5 @@ const uint8 SwordControl::_languageStrings[8 * 20][43] = {
"Fim",
"UNIDADE CHEIA!",
};
+
+} // End of namespace Sword1
diff --git a/sword1/control.h b/sword1/control.h
index e83b0a6982..50697fc224 100644
--- a/sword1/control.h
+++ b/sword1/control.h
@@ -25,12 +25,15 @@
#include "scummsys.h"
#include "sworddefs.h"
+class OSystem;
+
+namespace Sword1 {
+
class ObjectMan;
class ResMan;
-class OSystem;
-class SwordMouse;
-class SwordMusic;
-class SwordSound;
+class Mouse;
+class Music;
+class Sound;
#define MAX_BUTTONS 16
@@ -62,10 +65,10 @@ struct ButtonInfo {
uint32 resId, id;
};
-class SwordControl {
+class Control {
public:
- SwordControl(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, SwordMouse *pMouse, SwordSound *pSound, SwordMusic *pMusic, const char *savePath);
- ~SwordControl(void);
+ Control(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic, const char *savePath);
+ ~Control(void);
uint8 runPanel(void);
void doRestore(void);
void askForCd(void);
@@ -115,9 +118,9 @@ private:
ObjectMan *_objMan;
ResMan *_resMan;
OSystem *_system;
- SwordMouse *_mouse;
- SwordMusic *_music;
- SwordSound *_sound;
+ Mouse *_mouse;
+ Music *_music;
+ Sound *_sound;
char _savePath[256];
uint8 *_font, *_redFont;
uint8 *_screenBuf;
@@ -127,6 +130,7 @@ private:
bool _mouseDown;
};
-
+} // End of namespace Sword1
+
#endif //BSCONTROL_H
diff --git a/sword1/debug.cpp b/sword1/debug.cpp
index 3f55a83c89..a2d98d4439 100644
--- a/sword1/debug.cpp
+++ b/sword1/debug.cpp
@@ -1,16 +1,39 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2003-2004 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ *
+ */
+
#include "stdafx.h"
#include "debug.h"
#include "common/util.h"
-void SwordDebug::interpretScript(uint32 id, uint32 level, uint32 script, uint32 pc) {
+namespace Sword1 {
+
+void Debug::interpretScript(uint32 id, uint32 level, uint32 script, uint32 pc) {
debug(8, "\nInterpreting %d@%d: script %X from %X", id, level, script, pc);
}
-void SwordDebug::callMCode(uint32 mcodeNum, uint32 paramCount, int32 a, int32 b, int32 c, int32 d, int32 e, int32 f) {
+void Debug::callMCode(uint32 mcodeNum, uint32 paramCount, int32 a, int32 b, int32 c, int32 d, int32 e, int32 f) {
debug(9, "mcode: %s(%d, %d, %d, %d, %d, %d) [%d]", _mCodeNames[mcodeNum], a, b, c, d, e, f, paramCount);
}
-const char SwordDebug::_mCodeNames[100][35] = {
+const char Debug::_mCodeNames[100][35] = {
"fnBackground",
"fnForeground",
"fnSort",
@@ -112,3 +135,5 @@ const char SwordDebug::_mCodeNames[100][35] = {
"fnPurple",
"fnBlack"
};
+
+} // End of namespace Sword1
diff --git a/sword1/debug.h b/sword1/debug.h
index e1d98aa934..292d6c12d7 100644
--- a/sword1/debug.h
+++ b/sword1/debug.h
@@ -24,7 +24,9 @@
#include "scummsys.h"
-class SwordDebug {
+namespace Sword1 {
+
+class Debug {
public:
static void interpretScript(uint32 id, uint32 level, uint32 script, uint32 pc);
static void callMCode(uint32 mcodeNum, uint32 paramCount, int32 a, int32 b, int32 c, int32 d, int32 e, int32 f);
@@ -33,5 +35,7 @@ private:
static const char _mCodeNames[100][35];
};
+} // End of namespace Sword1
+
#endif // BSDEBUG_H
diff --git a/sword1/eventman.cpp b/sword1/eventman.cpp
index 8dd20f6494..66a0bde566 100644
--- a/sword1/eventman.cpp
+++ b/sword1/eventman.cpp
@@ -24,6 +24,8 @@
#include "sworddefs.h"
#include "common/util.h"
+namespace Sword1 {
+
EventManager::EventManager(void) {
for (uint8 cnt = 0; cnt < TOTAL_EVENT_SLOTS; cnt++)
_eventPendingList[cnt].delay = _eventPendingList[cnt].eventNumber = 0;
@@ -35,7 +37,7 @@ void EventManager::serviceGlobalEventList(void) {
_eventPendingList[slot].delay--;
}
-void EventManager::checkForEvent(BsObject *compact) {
+void EventManager::checkForEvent(Object *compact) {
for (uint8 objCnt = 0; objCnt < O_TOTAL_EVENTS; objCnt++) {
if (compact->o_event_list[objCnt].o_event)
for (uint8 globCnt = 0; globCnt < TOTAL_EVENT_SLOTS; globCnt++) {
@@ -61,7 +63,7 @@ bool EventManager::eventValid(int32 event) {
return false;
}
-int EventManager::fnCheckForEvent(BsObject *cpt, int32 id, int32 pause) {
+int EventManager::fnCheckForEvent(Object *cpt, int32 id, int32 pause) {
if (pause) {
cpt->o_pause = pause;
cpt->o_logic = LOGIC_pause_for_event;
@@ -87,7 +89,7 @@ int EventManager::fnCheckForEvent(BsObject *cpt, int32 id, int32 pause) {
return SCRIPT_CONT;
}
-void EventManager::fnIssueEvent(BsObject *compact, int32 id, int32 event, int32 delay) {
+void EventManager::fnIssueEvent(Object *compact, int32 id, int32 event, int32 delay) {
uint8 evSlot = 0;
while (_eventPendingList[evSlot].delay)
evSlot++;
@@ -97,3 +99,4 @@ void EventManager::fnIssueEvent(BsObject *compact, int32 id, int32 event, int32
_eventPendingList[evSlot].eventNumber = event;
}
+} // End of namespace Sword1
diff --git a/sword1/eventman.h b/sword1/eventman.h
index 11a1078e25..3df88c74e4 100644
--- a/sword1/eventman.h
+++ b/sword1/eventman.h
@@ -24,6 +24,8 @@
#include "object.h"
+namespace Sword1 {
+
#define TOTAL_EVENT_SLOTS 20
struct GlobalEvent {
@@ -35,12 +37,14 @@ class EventManager {
public:
EventManager(void);
void serviceGlobalEventList(void);
- void checkForEvent(BsObject *compact);
- int fnCheckForEvent(BsObject *cpt, int32 id, int32 pause);
- void fnIssueEvent(BsObject *compact, int32 id, int32 event, int32 delay);
+ void checkForEvent(Object *compact);
+ int fnCheckForEvent(Object *cpt, int32 id, int32 pause);
+ void fnIssueEvent(Object *compact, int32 id, int32 event, int32 delay);
bool eventValid(int32 event);
private:
GlobalEvent _eventPendingList[TOTAL_EVENT_SLOTS];
};
+} // End of namespace Sword1
+
#endif // BSEVENTMAN_H
diff --git a/sword1/logic.cpp b/sword1/logic.cpp
index 997aa092a9..177e4e63c8 100644
--- a/sword1/logic.cpp
+++ b/sword1/logic.cpp
@@ -35,13 +35,15 @@
#include "debug.h"
+namespace Sword1 {
+
#define MAX_STACK_SIZE 10
#define SCRIPT_VERSION 13
#define LAST_FRAME 999
-uint32 SwordLogic::_scriptVars[NUM_SCRIPT_VARS];
+uint32 Logic::_scriptVars[NUM_SCRIPT_VARS];
-SwordLogic::SwordLogic(ObjectMan *pObjMan, ResMan *resMan, SwordScreen *pScreen, SwordMouse *pMouse, SwordSound *pSound, SwordMusic *pMusic, SwordMenu *pMenu) {
+Logic::Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu) {
_objMan = pObjMan;
_resMan = resMan;
_screen = pScreen;
@@ -51,11 +53,11 @@ SwordLogic::SwordLogic(ObjectMan *pObjMan, ResMan *resMan, SwordScreen *pScreen,
_menu = pMenu;
_textMan = NULL;
_screen->useTextManager(_textMan);
- _router = new SwordRouter(_objMan, _resMan);
+ _router = new Router(_objMan, _resMan);
_eventMan = NULL;
}
-void SwordLogic::initialize(void) {
+void Logic::initialize(void) {
memset(_scriptVars, 0, NUM_SCRIPT_VARS * sizeof(uint32));
for (uint8 cnt = 0; cnt < NON_ZERO_SCRIPT_VARS; cnt++)
_scriptVars[_scriptVarInit[cnt][0]] = _scriptVarInit[cnt][1];
@@ -64,7 +66,7 @@ void SwordLogic::initialize(void) {
_eventMan = new EventManager();
delete _textMan;
- _textMan = new SwordText(_objMan, _resMan,
+ _textMan = new Text(_objMan, _resMan,
(SwordEngine::_systemVars.language == BS1_CZECH) ? true : false);
_screen->useTextManager(_textMan);
_textRunning = _speechRunning = false;
@@ -72,8 +74,8 @@ void SwordLogic::initialize(void) {
_router->resetExtraData();
}
-void SwordLogic::newScreen(uint32 screen) {
- BsObject *compact = (BsObject*)_objMan->fetchObject(PLAYER);
+void Logic::newScreen(uint32 screen) {
+ Object *compact = (Object*)_objMan->fetchObject(PLAYER);
if (SwordEngine::_systemVars.justRestoredGame) { // if we've just restored a game - we want George to be exactly as saved
fnAddHuman(NULL, 0, 0, 0, 0, 0, 0, 0);
@@ -92,7 +94,7 @@ void SwordLogic::newScreen(uint32 screen) {
}
}
-void SwordLogic::engine(void) {
+void Logic::engine(void) {
debug(8, "\n\nNext logic cycle");
_eventMan->serviceGlobalEventList();
@@ -101,7 +103,7 @@ void SwordLogic::engine(void) {
uint32 numCpts = _objMan->fetchNoObjects(sectCnt);
for (uint32 cptCnt = 0; cptCnt < numCpts; cptCnt++) {
uint32 currentId = sectCnt * ITM_PER_SEC + cptCnt;
- BsObject *compact = _objMan->fetchObject(currentId);
+ Object *compact = _objMan->fetchObject(currentId);
if (compact->o_status & STAT_LOGIC) { // does the object want to be processed?
if (compact->o_status & STAT_EVENTS) {
@@ -114,7 +116,7 @@ void SwordLogic::engine(void) {
break;
}
}
- debug(7, "SwordLogic::engine: handling compact %d (%X)", currentId, currentId);
+ debug(7, "Logic::engine: handling compact %d (%X)", currentId, currentId);
processLogic(compact, currentId);
compact->o_sync = 0; // syncs are only available for 1 cycle.
}
@@ -137,7 +139,7 @@ void SwordLogic::engine(void) {
}
-void SwordLogic::processLogic(BsObject *compact, uint32 id) {
+void Logic::processLogic(Object *compact, uint32 id) {
int logicRet;
do {
switch(compact->o_logic) {
@@ -222,8 +224,8 @@ void SwordLogic::processLogic(BsObject *compact, uint32 id) {
} while(logicRet);
}
-int SwordLogic::logicWaitTalk(BsObject *compact) {
- BsObject *target = _objMan->fetchObject(compact->o_down_flag);
+int Logic::logicWaitTalk(Object *compact) {
+ Object *target = _objMan->fetchObject(compact->o_down_flag);
if (target->o_status & STAT_TALK_WAIT) {
compact->o_logic = LOGIC_script;
@@ -233,8 +235,8 @@ int SwordLogic::logicWaitTalk(BsObject *compact) {
}
}
-int SwordLogic::logicStartTalk(BsObject *compact) {
- BsObject *target = _objMan->fetchObject(compact->o_down_flag); //holds id of person we're waiting for
+int Logic::logicStartTalk(Object *compact) {
+ Object *target = _objMan->fetchObject(compact->o_down_flag); //holds id of person we're waiting for
if (target->o_status & STAT_TALK_WAIT) { //response?
compact->o_logic = LOGIC_script; //back to script again
return SCRIPT_CONT;
@@ -247,7 +249,7 @@ int SwordLogic::logicStartTalk(BsObject *compact) {
return SCRIPT_CONT;
}
-int SwordLogic::logicArAnimate(BsObject *compact, uint32 id) {
+int Logic::logicArAnimate(Object *compact, uint32 id) {
WalkData *route;
int32 walkPc;
if ((_scriptVars[GEORGE_WALKING] == 0) && (id == PLAYER))
@@ -298,7 +300,7 @@ int SwordLogic::logicArAnimate(BsObject *compact, uint32 id) {
return 0;
}
-int SwordLogic::speechDriver(BsObject *compact) {
+int Logic::speechDriver(Object *compact) {
if ((!_speechClickDelay) && (_mouse->testEvent() & BS1L_BUTTON_DOWN))
_speechFinished = true;
if (_speechClickDelay)
@@ -345,7 +347,7 @@ int SwordLogic::speechDriver(BsObject *compact) {
return 0;
}
-int SwordLogic::fullAnimDriver(BsObject *compact) {
+int Logic::fullAnimDriver(Object *compact) {
if (compact->o_sync) { // return to script immediately if we've received a sync
compact->o_logic = LOGIC_script;
return 1;
@@ -367,7 +369,7 @@ int SwordLogic::fullAnimDriver(BsObject *compact) {
return 0;
}
-int SwordLogic::animDriver(BsObject *compact) {
+int Logic::animDriver(Object *compact) {
if (compact->o_sync) {
compact->o_logic = LOGIC_script;
return 1;
@@ -390,18 +392,18 @@ int SwordLogic::animDriver(BsObject *compact) {
return 0;
}
-void SwordLogic::updateScreenParams(void) {
- BsObject *compact = (BsObject*)_objMan->fetchObject(PLAYER);
+void Logic::updateScreenParams(void) {
+ Object *compact = (Object*)_objMan->fetchObject(PLAYER);
_screen->setScrolling((int16)(compact->o_xcoord - _scriptVars[FEET_X]),
(int16)(compact->o_ycoord - _scriptVars[FEET_Y]));
}
-int SwordLogic::scriptManager(BsObject *compact, uint32 id) {
+int Logic::scriptManager(Object *compact, uint32 id) {
int ret;
do {
uint32 level = compact->o_tree.o_script_level;
uint32 script = compact->o_tree.o_script_id[level];
- SwordDebug::interpretScript(id, level, script, compact->o_tree.o_script_pc[level] & ITM_ID);
+ Debug::interpretScript(id, level, script, compact->o_tree.o_script_pc[level] & ITM_ID);
ret = interpretScript(compact, id, _resMan->lockScript(script), script, compact->o_tree.o_script_pc[level] & ITM_ID);
_resMan->unlockScript(script);
if (!ret) {
@@ -422,14 +424,14 @@ int SwordLogic::scriptManager(BsObject *compact, uint32 id) {
//an FN_quit becomes slightly more convoluted, but so what you might ask.
}
-void SwordLogic::runMouseScript(BsObject *cpt, int32 scriptId) {
+void Logic::runMouseScript(Object *cpt, int32 scriptId) {
Header *script = _resMan->lockScript(scriptId);
debug(9, "running mouse script %d", scriptId);
interpretScript(cpt, _scriptVars[SPECIAL_ITEM], script, scriptId, scriptId);
_resMan->unlockScript(scriptId);
}
-int SwordLogic::interpretScript(BsObject *compact, int id, Header *scriptModule, int scriptBase, int scriptNum) {
+int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int scriptBase, int scriptNum) {
int32 *scriptCode = (int32*)(((uint8*)scriptModule) + sizeof(Header));
int32 stack[MAX_STACK_SIZE];
int32 stackIdx = 0;
@@ -468,7 +470,7 @@ int SwordLogic::interpretScript(BsObject *compact, int id, Header *scriptModule,
case 2: b = stack[--stackIdx];
case 1: a = stack[--stackIdx];
case 0:
- SwordDebug::callMCode(mCodeNumber, mCodeArguments, a, b, c, d, e, f);
+ Debug::callMCode(mCodeNumber, mCodeArguments, a, b, c, d, e, f);
mCodeReturn = (this->*_mcodeTable[mCodeNumber])(compact, id, a, b, c, d, e, f);
break;
default:
@@ -641,140 +643,140 @@ int SwordLogic::interpretScript(BsObject *compact, int id, Header *scriptModule,
}
}
-BSMcodeTable SwordLogic::_mcodeTable[100] = {
- &SwordLogic::fnBackground,
- &SwordLogic::fnForeground,
- &SwordLogic::fnSort,
- &SwordLogic::fnNoSprite,
- &SwordLogic::fnMegaSet,
- &SwordLogic::fnAnim,
- &SwordLogic::fnSetFrame,
- &SwordLogic::fnFullAnim,
- &SwordLogic::fnFullSetFrame,
- &SwordLogic::fnFadeDown,
- &SwordLogic::fnFadeUp,
- &SwordLogic::fnCheckFade,
- &SwordLogic::fnSetSpritePalette,
- &SwordLogic::fnSetWholePalette,
- &SwordLogic::fnSetFadeTargetPalette,
- &SwordLogic::fnSetPaletteToFade,
- &SwordLogic::fnSetPaletteToCut,
- &SwordLogic::fnPlaySequence,
- &SwordLogic::fnIdle,
- &SwordLogic::fnPause,
- &SwordLogic::fnPauseSeconds,
- &SwordLogic::fnQuit,
- &SwordLogic::fnKillId,
- &SwordLogic::fnSuicide,
- &SwordLogic::fnNewScript,
- &SwordLogic::fnSubScript,
- &SwordLogic::fnRestartScript,
- &SwordLogic::fnSetBookmark,
- &SwordLogic::fnGotoBookmark,
- &SwordLogic::fnSendSync,
- &SwordLogic::fnWaitSync,
- &SwordLogic::cfnClickInteract,
- &SwordLogic::cfnSetScript,
- &SwordLogic::cfnPresetScript,
- &SwordLogic::fnInteract,
- &SwordLogic::fnIssueEvent,
- &SwordLogic::fnCheckForEvent,
- &SwordLogic::fnWipeHands,
- &SwordLogic::fnISpeak,
- &SwordLogic::fnTheyDo,
- &SwordLogic::fnTheyDoWeWait,
- &SwordLogic::fnWeWait,
- &SwordLogic::fnChangeSpeechText,
- &SwordLogic::fnTalkError,
- &SwordLogic::fnStartTalk,
- &SwordLogic::fnCheckForTextLine,
- &SwordLogic::fnAddTalkWaitStatusBit,
- &SwordLogic::fnRemoveTalkWaitStatusBit,
- &SwordLogic::fnNoHuman,
- &SwordLogic::fnAddHuman,
- &SwordLogic::fnBlankMouse,
- &SwordLogic::fnNormalMouse,
- &SwordLogic::fnLockMouse,
- &SwordLogic::fnUnlockMouse,
- &SwordLogic::fnSetMousePointer,
- &SwordLogic::fnSetMouseLuggage,
- &SwordLogic::fnMouseOn,
- &SwordLogic::fnMouseOff,
- &SwordLogic::fnChooser,
- &SwordLogic::fnEndChooser,
- &SwordLogic::fnStartMenu,
- &SwordLogic::fnEndMenu,
- &SwordLogic::cfnReleaseMenu,
- &SwordLogic::fnAddSubject,
- &SwordLogic::fnAddObject,
- &SwordLogic::fnRemoveObject,
- &SwordLogic::fnEnterSection,
- &SwordLogic::fnLeaveSection,
- &SwordLogic::fnChangeFloor,
- &SwordLogic::fnWalk,
- &SwordLogic::fnTurn,
- &SwordLogic::fnStand,
- &SwordLogic::fnStandAt,
- &SwordLogic::fnFace,
- &SwordLogic::fnFaceXy,
- &SwordLogic::fnIsFacing,
- &SwordLogic::fnGetTo,
- &SwordLogic::fnGetToError,
- &SwordLogic::fnGetPos,
- &SwordLogic::fnGetGamepadXy,
- &SwordLogic::fnPlayFx,
- &SwordLogic::fnStopFx,
- &SwordLogic::fnPlayMusic,
- &SwordLogic::fnStopMusic,
- &SwordLogic::fnInnerSpace,
- &SwordLogic::fnRandom,
- &SwordLogic::fnSetScreen,
- &SwordLogic::fnPreload,
- &SwordLogic::fnCheckCD,
- &SwordLogic::fnRestartGame,
- &SwordLogic::fnQuitGame,
- &SwordLogic::fnDeathScreen,
- &SwordLogic::fnSetParallax,
- &SwordLogic::fnTdebug,
- &SwordLogic::fnRedFlash,
- &SwordLogic::fnBlueFlash,
- &SwordLogic::fnYellow,
- &SwordLogic::fnGreen,
- &SwordLogic::fnPurple,
- &SwordLogic::fnBlack
+BSMcodeTable Logic::_mcodeTable[100] = {
+ &Logic::fnBackground,
+ &Logic::fnForeground,
+ &Logic::fnSort,
+ &Logic::fnNoSprite,
+ &Logic::fnMegaSet,
+ &Logic::fnAnim,
+ &Logic::fnSetFrame,
+ &Logic::fnFullAnim,
+ &Logic::fnFullSetFrame,
+ &Logic::fnFadeDown,
+ &Logic::fnFadeUp,
+ &Logic::fnCheckFade,
+ &Logic::fnSetSpritePalette,
+ &Logic::fnSetWholePalette,
+ &Logic::fnSetFadeTargetPalette,
+ &Logic::fnSetPaletteToFade,
+ &Logic::fnSetPaletteToCut,
+ &Logic::fnPlaySequence,
+ &Logic::fnIdle,
+ &Logic::fnPause,
+ &Logic::fnPauseSeconds,
+ &Logic::fnQuit,
+ &Logic::fnKillId,
+ &Logic::fnSuicide,
+ &Logic::fnNewScript,
+ &Logic::fnSubScript,
+ &Logic::fnRestartScript,
+ &Logic::fnSetBookmark,
+ &Logic::fnGotoBookmark,
+ &Logic::fnSendSync,
+ &Logic::fnWaitSync,
+ &Logic::cfnClickInteract,
+ &Logic::cfnSetScript,
+ &Logic::cfnPresetScript,
+ &Logic::fnInteract,
+ &Logic::fnIssueEvent,
+ &Logic::fnCheckForEvent,
+ &Logic::fnWipeHands,
+ &Logic::fnISpeak,
+ &Logic::fnTheyDo,
+ &Logic::fnTheyDoWeWait,
+ &Logic::fnWeWait,
+ &Logic::fnChangeSpeechText,
+ &Logic::fnTalkError,
+ &Logic::fnStartTalk,
+ &Logic::fnCheckForTextLine,
+ &Logic::fnAddTalkWaitStatusBit,
+ &Logic::fnRemoveTalkWaitStatusBit,
+ &Logic::fnNoHuman,
+ &Logic::fnAddHuman,
+ &Logic::fnBlankMouse,
+ &Logic::fnNormalMouse,
+ &Logic::fnLockMouse,
+ &Logic::fnUnlockMouse,
+ &Logic::fnSetMousePointer,
+ &Logic::fnSetMouseLuggage,
+ &Logic::fnMouseOn,
+ &Logic::fnMouseOff,
+ &Logic::fnChooser,
+ &Logic::fnEndChooser,
+ &Logic::fnStartMenu,
+ &Logic::fnEndMenu,
+ &Logic::cfnReleaseMenu,
+ &Logic::fnAddSubject,
+ &Logic::fnAddObject,
+ &Logic::fnRemoveObject,
+ &Logic::fnEnterSection,
+ &Logic::fnLeaveSection,
+ &Logic::fnChangeFloor,
+ &Logic::fnWalk,
+ &Logic::fnTurn,
+ &Logic::fnStand,
+ &Logic::fnStandAt,
+ &Logic::fnFace,
+ &Logic::fnFaceXy,
+ &Logic::fnIsFacing,
+ &Logic::fnGetTo,
+ &Logic::fnGetToError,
+ &Logic::fnGetPos,
+ &Logic::fnGetGamepadXy,
+ &Logic::fnPlayFx,
+ &Logic::fnStopFx,
+ &Logic::fnPlayMusic,
+ &Logic::fnStopMusic,
+ &Logic::fnInnerSpace,
+ &Logic::fnRandom,
+ &Logic::fnSetScreen,
+ &Logic::fnPreload,
+ &Logic::fnCheckCD,
+ &Logic::fnRestartGame,
+ &Logic::fnQuitGame,
+ &Logic::fnDeathScreen,
+ &Logic::fnSetParallax,
+ &Logic::fnTdebug,
+ &Logic::fnRedFlash,
+ &Logic::fnBlueFlash,
+ &Logic::fnYellow,
+ &Logic::fnGreen,
+ &Logic::fnPurple,
+ &Logic::fnBlack
};
-int SwordLogic::fnBackground(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnBackground(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status &= ~(STAT_FORE | STAT_SORT);
cpt->o_status |= STAT_BACK;
return SCRIPT_CONT;
}
-int SwordLogic::fnForeground(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnForeground(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status &= ~(STAT_BACK | STAT_SORT);
cpt->o_status |= STAT_FORE;
return SCRIPT_CONT;
}
-int SwordLogic::fnSort(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSort(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status &= ~(STAT_BACK | STAT_FORE);
cpt->o_status |= STAT_SORT;
return SCRIPT_CONT;
}
-int SwordLogic::fnNoSprite(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnNoSprite(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status &= ~(STAT_BACK | STAT_FORE | STAT_SORT);
return SCRIPT_CONT;
}
-int SwordLogic::fnMegaSet(BsObject *cpt, int32 id, int32 walk_data, int32 spr, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnMegaSet(Object *cpt, int32 id, int32 walk_data, int32 spr, int32 e, int32 f, int32 z, int32 x) {
cpt->o_mega_resource = walk_data;
cpt->o_walk_resource = spr;
return SCRIPT_CONT;
}
-int SwordLogic::fnAnim(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnAnim(Object *cpt, int32 id, int32 cdt, int32 spr, int32 e, int32 f, int32 z, int32 x) {
AnimSet *animTab;
if (cdt && (!spr)) {
@@ -808,7 +810,7 @@ int SwordLogic::fnAnim(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32 e, i
return SCRIPT_STOP;
}
-int SwordLogic::fnSetFrame(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
+int Logic::fnSetFrame(Object *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
AnimUnit *animPtr;
@@ -830,7 +832,7 @@ int SwordLogic::fnSetFrame(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32
return SCRIPT_CONT;
}
-int SwordLogic::fnFullAnim(BsObject *cpt, int32 id, int32 anim, int32 graphic, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnFullAnim(Object *cpt, int32 id, int32 anim, int32 graphic, int32 e, int32 f, int32 z, int32 x) {
cpt->o_logic = LOGIC_full_anim;
cpt->o_anim_pc = 0;
@@ -841,7 +843,7 @@ int SwordLogic::fnFullAnim(BsObject *cpt, int32 id, int32 anim, int32 graphic, i
return SCRIPT_STOP;
}
-int SwordLogic::fnFullSetFrame(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
+int Logic::fnFullSetFrame(Object *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
uint8 *data = (uint8*)_resMan->openFetchRes(cdt) + sizeof(Header);
if (frameNo == LAST_FRAME)
@@ -860,47 +862,47 @@ int SwordLogic::fnFullSetFrame(BsObject *cpt, int32 id, int32 cdt, int32 spr, in
return SCRIPT_CONT;
}
-int SwordLogic::fnFadeDown(BsObject *cpt, int32 id, int32 speed, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnFadeDown(Object *cpt, int32 id, int32 speed, int32 d, int32 e, int32 f, int32 z, int32 x) {
_screen->fadeDownPalette();
return SCRIPT_CONT;
}
-int SwordLogic::fnFadeUp(BsObject *cpt, int32 id, int32 speed, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnFadeUp(Object *cpt, int32 id, int32 speed, int32 d, int32 e, int32 f, int32 z, int32 x) {
_screen->fadeUpPalette();
return SCRIPT_CONT;
}
-int SwordLogic::fnCheckFade(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnCheckFade(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_scriptVars[RETURN_VALUE] = (uint8)_screen->stillFading();
return SCRIPT_CONT;
}
-int SwordLogic::fnSetSpritePalette(BsObject *cpt, int32 id, int32 spritePal, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetSpritePalette(Object *cpt, int32 id, int32 spritePal, int32 d, int32 e, int32 f, int32 z, int32 x) {
_screen->fnSetPalette(184, 72, spritePal, false);
return SCRIPT_CONT;
}
-int SwordLogic::fnSetWholePalette(BsObject *cpt, int32 id, int32 spritePal, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetWholePalette(Object *cpt, int32 id, int32 spritePal, int32 d, int32 e, int32 f, int32 z, int32 x) {
_screen->fnSetPalette(0, 256, spritePal, false);
return SCRIPT_CONT;
}
-int SwordLogic::fnSetFadeTargetPalette(BsObject *cpt, int32 id, int32 spritePal, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetFadeTargetPalette(Object *cpt, int32 id, int32 spritePal, int32 d, int32 e, int32 f, int32 z, int32 x) {
_screen->fnSetPalette(0, 184, spritePal, true);
return SCRIPT_CONT;
}
-int SwordLogic::fnSetPaletteToFade(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetPaletteToFade(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
SwordEngine::_systemVars.wantFade = true;
return SCRIPT_CONT;
}
-int SwordLogic::fnSetPaletteToCut(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetPaletteToCut(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
SwordEngine::_systemVars.wantFade = false;
return SCRIPT_CONT;
}
-int SwordLogic::fnPlaySequence(BsObject *cpt, int32 id, int32 sequenceId, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnPlaySequence(Object *cpt, int32 id, int32 sequenceId, int32 d, int32 e, int32 f, int32 z, int32 x) {
warning("fnPlaySequence(%d) called", sequenceId);
//_scriptVars[NEW_PALETTE] = 1;
/* the logic usually calls fnFadeDown before playing the sequence, so we have to
@@ -908,48 +910,48 @@ int SwordLogic::fnPlaySequence(BsObject *cpt, int32 id, int32 sequenceId, int32
return SCRIPT_CONT;
}
-int SwordLogic::fnIdle(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnIdle(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_tree.o_script_level = 0; // force to level 0
cpt->o_logic = LOGIC_idle;
return SCRIPT_STOP;
}
-int SwordLogic::fnPause(BsObject *cpt, int32 id, int32 pause, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnPause(Object *cpt, int32 id, int32 pause, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_pause = pause;
cpt->o_logic = LOGIC_pause;
return SCRIPT_STOP;
}
-int SwordLogic::fnPauseSeconds(BsObject *cpt, int32 id, int32 pause, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnPauseSeconds(Object *cpt, int32 id, int32 pause, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_pause = pause * FRAME_RATE;
cpt->o_logic = LOGIC_pause;
return SCRIPT_STOP;
}
-int SwordLogic::fnQuit(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnQuit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_logic = LOGIC_quit;
return SCRIPT_STOP;
}
-int SwordLogic::fnKillId(BsObject *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
- BsObject *targetObj = _objMan->fetchObject(target);
+int Logic::fnKillId(Object *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
+ Object *targetObj = _objMan->fetchObject(target);
targetObj->o_status = 0;
return SCRIPT_CONT;
}
-int SwordLogic::fnSuicide(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSuicide(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status = 0;
cpt->o_logic = LOGIC_quit;
return SCRIPT_STOP;
}
-int SwordLogic::fnNewScript(BsObject *cpt, int32 id, int32 script, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnNewScript(Object *cpt, int32 id, int32 script, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_logic = LOGIC_new_script;
_newScript = script;
return SCRIPT_STOP;
}
-int SwordLogic::fnSubScript(BsObject *cpt, int32 id, int32 script, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSubScript(Object *cpt, int32 id, int32 script, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_tree.o_script_level++;
if (cpt->o_tree.o_script_level == TOTAL_script_levels)
error("Compact %d: script level exceeded in fnSubScript.", id);
@@ -958,34 +960,34 @@ int SwordLogic::fnSubScript(BsObject *cpt, int32 id, int32 script, int32 d, int3
return SCRIPT_STOP;
}
-int SwordLogic::fnRestartScript(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnRestartScript(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_logic = LOGIC_restart;
return SCRIPT_STOP;
}
-int SwordLogic::fnSetBookmark(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetBookmark(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
memcpy(&cpt->o_bookmark.o_script_level, &cpt->o_tree.o_script_level, sizeof(ScriptTree));
return SCRIPT_CONT;
}
-int SwordLogic::fnGotoBookmark(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnGotoBookmark(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_logic = LOGIC_bookmark;
return SCRIPT_STOP;
}
-int SwordLogic::fnSendSync(BsObject *cpt, int32 id, int32 sendId, int32 syncValue, int32 e, int32 f, int32 z, int32 x) {
- BsObject *target = _objMan->fetchObject(sendId);
+int Logic::fnSendSync(Object *cpt, int32 id, int32 sendId, int32 syncValue, int32 e, int32 f, int32 z, int32 x) {
+ Object *target = _objMan->fetchObject(sendId);
target->o_sync = syncValue;
return SCRIPT_CONT;
}
-int SwordLogic::fnWaitSync(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnWaitSync(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_logic = LOGIC_wait_for_sync;
return SCRIPT_STOP;
}
-int SwordLogic::cfnClickInteract(BsObject *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
- BsObject *tar = _objMan->fetchObject(target);
+int Logic::cfnClickInteract(Object *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
+ Object *tar = _objMan->fetchObject(target);
cpt = _objMan->fetchObject(PLAYER);
cpt->o_tree.o_script_level = 0;
cpt->o_tree.o_script_pc[0] = tar->o_interact;
@@ -994,8 +996,8 @@ int SwordLogic::cfnClickInteract(BsObject *cpt, int32 id, int32 target, int32 d,
return SCRIPT_STOP;
}
-int SwordLogic::cfnSetScript(BsObject *cpt, int32 id, int32 target, int32 script, int32 e, int32 f, int32 z, int32 x) {
- BsObject *tar = _objMan->fetchObject(target);
+int Logic::cfnSetScript(Object *cpt, int32 id, int32 target, int32 script, int32 e, int32 f, int32 z, int32 x) {
+ Object *tar = _objMan->fetchObject(target);
tar->o_tree.o_script_level = 0;
tar->o_tree.o_script_pc[0] = script;
tar->o_tree.o_script_id[0] = script;
@@ -1003,8 +1005,8 @@ int SwordLogic::cfnSetScript(BsObject *cpt, int32 id, int32 target, int32 script
return SCRIPT_CONT;
}
-int SwordLogic::cfnPresetScript(BsObject *cpt, int32 id, int32 target, int32 script, int32 e, int32 f, int32 z, int32 x) {
- BsObject *tar = _objMan->fetchObject(target);
+int Logic::cfnPresetScript(Object *cpt, int32 id, int32 target, int32 script, int32 e, int32 f, int32 z, int32 x) {
+ Object *tar = _objMan->fetchObject(target);
tar->o_tree.o_script_level = 0;
tar->o_tree.o_script_pc[0] = script;
tar->o_tree.o_script_id[0] = script;
@@ -1013,11 +1015,11 @@ int SwordLogic::cfnPresetScript(BsObject *cpt, int32 id, int32 target, int32 scr
return SCRIPT_CONT;
}
-int SwordLogic::fnInteract(BsObject *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
- BsObject *tar = _objMan->fetchObject(target);
+int Logic::fnInteract(Object *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
+ Object *tar = _objMan->fetchObject(target);
cpt->o_place = tar->o_place;
- BsObject *floorObject = _objMan->fetchObject(tar->o_place);
+ Object *floorObject = _objMan->fetchObject(tar->o_place);
cpt->o_scale_a = floorObject->o_scale_a;
cpt->o_scale_b = floorObject->o_scale_b;
@@ -1028,23 +1030,23 @@ int SwordLogic::fnInteract(BsObject *cpt, int32 id, int32 target, int32 d, int32
return SCRIPT_STOP;
}
-int SwordLogic::fnIssueEvent(BsObject *cpt, int32 id, int32 event, int32 delay, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnIssueEvent(Object *cpt, int32 id, int32 event, int32 delay, int32 e, int32 f, int32 z, int32 x) {
_eventMan->fnIssueEvent(cpt, id, event, delay);
return SCRIPT_CONT;
}
-int SwordLogic::fnCheckForEvent(BsObject *cpt, int32 id, int32 pause, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnCheckForEvent(Object *cpt, int32 id, int32 pause, int32 d, int32 e, int32 f, int32 z, int32 x) {
return _eventMan->fnCheckForEvent(cpt, id, pause);
}
-int SwordLogic::fnWipeHands(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnWipeHands(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_scriptVars[OBJECT_HELD] = 0;
_mouse->setLuggage(0, 0);
_menu->refresh(MENU_TOP);
return SCRIPT_CONT;
}
-int SwordLogic::fnISpeak(BsObject *cpt, int32 id, int32 cdt, int32 textNo, int32 spr, int32 f, int32 z, int32 x) {
+int Logic::fnISpeak(Object *cpt, int32 id, int32 cdt, int32 textNo, int32 spr, int32 f, int32 z, int32 x) {
_speechClickDelay = 3;
if (((textNo & ~1) == 0x3f0012) && (!cdt) && (!spr)) {
cdt = GEOSTDLCDT; // workaround for missing animation when examining
@@ -1094,11 +1096,11 @@ int SwordLogic::fnISpeak(BsObject *cpt, int32 id, int32 cdt, int32 textNo, int32
uint32 textCptId = _textMan->lowTextManager((uint8*)text, cpt->o_speech_width, (uint8)cpt->o_speech_pen);
_objMan->unlockText(textNo);
- BsObject * textCpt = _objMan->fetchObject(textCptId);
+ Object * textCpt = _objMan->fetchObject(textCptId);
textCpt->o_screen = cpt->o_screen;
textCpt->o_target = textCptId;
- // the graphic is a property of SwordText, so we don't lock/unlock it.
+ // the graphic is a property of Text, so we don't lock/unlock it.
uint16 textSpriteWidth = FROM_LE_16(_textMan->giveSpriteData(textCpt->o_target)->width);
uint16 textSpriteHeight = FROM_LE_16(_textMan->giveSpriteData(textCpt->o_target)->height);
@@ -1136,8 +1138,8 @@ int SwordLogic::fnISpeak(BsObject *cpt, int32 id, int32 cdt, int32 textNo, int32
//send instructions to mega in conversation with player
//the instruction is interpreted by the script mega_interact
-int SwordLogic::fnTheyDo(BsObject *cpt, int32 id, int32 tar, int32 instruc, int32 param1, int32 param2, int32 param3, int32 x) {
- BsObject *target;
+int Logic::fnTheyDo(Object *cpt, int32 id, int32 tar, int32 instruc, int32 param1, int32 param2, int32 param3, int32 x) {
+ Object *target;
target = _objMan->fetchObject(tar);
target->o_down_flag = instruc; // instruction for the mega
target->o_ins1 = param1;
@@ -1148,8 +1150,8 @@ int SwordLogic::fnTheyDo(BsObject *cpt, int32 id, int32 tar, int32 instruc, int3
//send an instruction to mega we're talking to and wait
//until it has finished before returning to script
-int SwordLogic::fnTheyDoWeWait(BsObject *cpt, int32 id, int32 tar, int32 instruc, int32 param1, int32 param2, int32 param3, int32 x) {
- BsObject *target;
+int Logic::fnTheyDoWeWait(Object *cpt, int32 id, int32 tar, int32 instruc, int32 param1, int32 param2, int32 param3, int32 x) {
+ Object *target;
target = _objMan->fetchObject(tar);
target->o_down_flag = instruc; // instruction for the mega
target->o_ins1 = param1;
@@ -1162,8 +1164,8 @@ int SwordLogic::fnTheyDoWeWait(BsObject *cpt, int32 id, int32 tar, int32 instruc
return SCRIPT_STOP;
}
-int SwordLogic::fnWeWait(BsObject *cpt, int32 id, int32 tar, int32 d, int32 e, int32 f, int32 z, int32 x) {
- BsObject *target = _objMan->fetchObject(tar);
+int Logic::fnWeWait(Object *cpt, int32 id, int32 tar, int32 d, int32 e, int32 f, int32 z, int32 x) {
+ Object *target = _objMan->fetchObject(tar);
target->o_status &= ~STAT_TALK_WAIT;
cpt->o_logic = LOGIC_wait_for_talk;
@@ -1172,8 +1174,8 @@ int SwordLogic::fnWeWait(BsObject *cpt, int32 id, int32 tar, int32 d, int32 e, i
return SCRIPT_STOP;
}
-int SwordLogic::fnChangeSpeechText(BsObject *cpt, int32 id, int32 tar, int32 width, int32 pen, int32 f, int32 z, int32 x) {
- BsObject *target = _objMan->fetchObject(tar);
+int Logic::fnChangeSpeechText(Object *cpt, int32 id, int32 tar, int32 width, int32 pen, int32 f, int32 z, int32 x) {
+ Object *target = _objMan->fetchObject(tar);
target->o_speech_width = width;
target->o_speech_pen = pen;
return SCRIPT_STOP;
@@ -1181,123 +1183,123 @@ int SwordLogic::fnChangeSpeechText(BsObject *cpt, int32 id, int32 tar, int32 wid
//mega_interact has received an instruction it does not understand -
//The game is halted for debugging. Maybe we'll remove this later.
-int SwordLogic::fnTalkError(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnTalkError(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
error("fnTalkError for id %d, instruction %d", id, cpt->o_down_flag);
return SCRIPT_STOP;
}
-int SwordLogic::fnStartTalk(BsObject *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnStartTalk(Object *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_down_flag = target;
cpt->o_logic = LOGIC_start_talk;
return SCRIPT_STOP;
}
-int SwordLogic::fnCheckForTextLine(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnCheckForTextLine(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_scriptVars[RETURN_VALUE] = _objMan->fnCheckForTextLine(id);
return SCRIPT_CONT;
}
-int SwordLogic::fnAddTalkWaitStatusBit(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnAddTalkWaitStatusBit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status |= STAT_TALK_WAIT;
return SCRIPT_CONT;
}
-int SwordLogic::fnRemoveTalkWaitStatusBit(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnRemoveTalkWaitStatusBit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status &= ~STAT_TALK_WAIT;
return SCRIPT_CONT;
}
-int SwordLogic::fnNoHuman(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnNoHuman(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_mouse->fnNoHuman();
return SCRIPT_CONT;
}
-int SwordLogic::fnAddHuman(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnAddHuman(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_mouse->fnAddHuman();
return SCRIPT_CONT;
}
-int SwordLogic::fnBlankMouse(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnBlankMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_mouse->fnBlankMouse();
return SCRIPT_CONT;
}
-int SwordLogic::fnNormalMouse(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnNormalMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_mouse->fnNormalMouse();
return SCRIPT_CONT;
}
-int SwordLogic::fnLockMouse(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnLockMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_mouse->fnLockMouse();
return SCRIPT_CONT;
}
-int SwordLogic::fnUnlockMouse(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnUnlockMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_mouse->fnUnlockMouse();
return SCRIPT_CONT;
}
-int SwordLogic::fnSetMousePointer(BsObject *cpt, int32 id, int32 tag, int32 rate, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetMousePointer(Object *cpt, int32 id, int32 tag, int32 rate, int32 e, int32 f, int32 z, int32 x) {
_mouse->setPointer(tag, rate);
return SCRIPT_CONT;
}
-int SwordLogic::fnSetMouseLuggage(BsObject *cpt, int32 id, int32 tag, int32 rate, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnSetMouseLuggage(Object *cpt, int32 id, int32 tag, int32 rate, int32 e, int32 f, int32 z, int32 x) {
_mouse->setLuggage(tag, rate);
return SCRIPT_CONT;
}
-int SwordLogic::fnMouseOn(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnMouseOn(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status |= STAT_MOUSE;
return SCRIPT_CONT;
}
-int SwordLogic::fnMouseOff(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnMouseOff(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_status &= ~STAT_MOUSE;
return SCRIPT_CONT;
}
-int SwordLogic::fnChooser(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnChooser(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_menu->fnChooser(cpt);
return SCRIPT_STOP;
}
-int SwordLogic::fnEndChooser(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnEndChooser(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_menu->fnEndChooser();
return SCRIPT_CONT;
}
-int SwordLogic::fnStartMenu(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnStartMenu(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_menu->fnStartMenu();
return SCRIPT_CONT;
}
-int SwordLogic::fnEndMenu(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnEndMenu(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_menu->fnEndMenu();
return SCRIPT_CONT;
}
-int SwordLogic::cfnReleaseMenu(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::cfnReleaseMenu(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
_menu->cfnReleaseMenu();
return SCRIPT_STOP;
}
-int SwordLogic::fnAddSubject(BsObject *cpt, int32 id, int32 sub, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnAddSubject(Object *cpt, int32 id, int32 sub, int32 d, int32 e, int32 f, int32 z, int32 x) {
_menu->fnAddSubject(sub);
return SCRIPT_CONT;
}
-int SwordLogic::fnAddObject(BsObject *cpt, int32 id, int32 objectNo, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnAddObject(Object *cpt, int32 id, int32 objectNo, int32 d, int32 e, int32 f, int32 z, int32 x) {
_scriptVars[POCKET_1 + objectNo - 1] = 1; // basically means: carrying object objectNo = true;
return SCRIPT_CONT;
}
-int SwordLogic::fnRemoveObject(BsObject *cpt, int32 id, int32 objectNo, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnRemoveObject(Object *cpt, int32 id, int32 objectNo, int32 d, int32 e, int32 f, int32 z, int32 x) {
_scriptVars[POCKET_1 + objectNo - 1] = 0;
return SCRIPT_CONT;
}
-int SwordLogic::fnEnterSection(BsObject *cpt, int32 id, int32 screen, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnEnterSection(Object *cpt, int32 id, int32 screen, int32 d, int32 e, int32 f, int32 z, int32 x) {
if (screen >= TOTAL_SECTIONS)
error("mega %d tried entering section %d", id, screen);
@@ -1312,22 +1314,22 @@ int SwordLogic::fnEnterSection(BsObject *cpt, int32 id, int32 screen, int32 d, i
return SCRIPT_CONT;
}
-int SwordLogic::fnLeaveSection(BsObject *cpt, int32 id, int32 oldScreen, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnLeaveSection(Object *cpt, int32 id, int32 oldScreen, int32 d, int32 e, int32 f, int32 z, int32 x) {
if (oldScreen >= TOTAL_SECTIONS)
error("mega %d leaving section %d", id, oldScreen);
_objMan->megaLeaving(oldScreen, id);
return SCRIPT_CONT;
}
-int SwordLogic::fnChangeFloor(BsObject *cpt, int32 id, int32 floor, int32 d, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnChangeFloor(Object *cpt, int32 id, int32 floor, int32 d, int32 e, int32 f, int32 z, int32 x) {
cpt->o_place = floor;
- BsObject *floorCpt = _objMan->fetchObject(floor);
+ Object *floorCpt = _objMan->fetchObject(floor);
cpt->o_scale_a = floorCpt->o_scale_a;
cpt->o_scale_b = floorCpt->o_scale_b;
return SCRIPT_CONT;
}
-int SwordLogic::fnWalk(BsObject *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stance, int32 a, int32 b) {
+int Logic::fnWalk(Object *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stance, int32 a, int32 b) {
if (stance > 0)
dir = 9;
cpt->o_walk_pc = 0;
@@ -1371,7 +1373,7 @@ int SwordLogic::fnWalk(BsObject *cpt, int32 id, int32 x, int32 y, int32 dir, int
return SCRIPT_CONT;
}
-int SwordLogic::fnTurn(BsObject *cpt, int32 id, int32 dir, int32 stance, int32 c, int32 d, int32 a, int32 b) {
+int Logic::fnTurn(Object *cpt, int32 id, int32 dir, int32 stance, int32 c, int32 d, int32 a, int32 b) {
if (stance > 0)
dir = 9;
int route = _router->routeFinder(id, cpt, cpt->o_xcoord, cpt->o_ycoord, dir);
@@ -1387,7 +1389,7 @@ int SwordLogic::fnTurn(BsObject *cpt, int32 id, int32 dir, int32 stance, int32 c
return SCRIPT_STOP;
}
-int SwordLogic::fnStand(BsObject *cpt, int32 id, int32 dir, int32 stance, int32 c, int32 d, int32 a, int32 b) {
+int Logic::fnStand(Object *cpt, int32 id, int32 dir, int32 stance, int32 c, int32 d, int32 a, int32 b) {
if ((dir < 0) || (dir > 8)) {
warning("fnStand:: invalid direction %d", dir);
return SCRIPT_CONT;
@@ -1403,7 +1405,7 @@ int SwordLogic::fnStand(BsObject *cpt, int32 id, int32 dir, int32 stance, int32
return SCRIPT_STOP;
}
-int SwordLogic::fnStandAt(BsObject *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stance, int32 a, int32 b) {
+int Logic::fnStandAt(Object *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stance, int32 a, int32 b) {
if ((dir < 0) || (dir > 8)) {
warning("fnStandAt:: invalid direction %d", dir);
return SCRIPT_CONT;
@@ -1415,8 +1417,8 @@ int SwordLogic::fnStandAt(BsObject *cpt, int32 id, int32 x, int32 y, int32 dir,
return fnStand(cpt, id, dir, stance, 0, 0, 0, 0);
}
-int SwordLogic::fnFace(BsObject *cpt, int32 id, int32 targetId, int32 b, int32 c, int32 d, int32 a, int32 z) {
- BsObject *target = _objMan->fetchObject(targetId);
+int Logic::fnFace(Object *cpt, int32 id, int32 targetId, int32 b, int32 c, int32 d, int32 a, int32 z) {
+ Object *target = _objMan->fetchObject(targetId);
int32 x, y;
if ((target->o_type == TYPE_MEGA) || (target->o_type == TYPE_PLAYER)) {
x = target->o_xcoord;
@@ -1430,14 +1432,14 @@ int SwordLogic::fnFace(BsObject *cpt, int32 id, int32 targetId, int32 b, int32 c
return SCRIPT_STOP;
}
-int SwordLogic::fnFaceXy(BsObject *cpt, int32 id, int32 x, int32 y, int32 c, int32 d, int32 a, int32 b) {
+int Logic::fnFaceXy(Object *cpt, int32 id, int32 x, int32 y, int32 c, int32 d, int32 a, int32 b) {
int megaTarDir = whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
fnTurn(cpt, id, megaTarDir, 0, 0, 0, 0, 0);
return SCRIPT_STOP;
}
-int SwordLogic::fnIsFacing(BsObject *cpt, int32 id, int32 targetId, int32 b, int32 c, int32 d, int32 a, int32 z) {
- BsObject *target = _objMan->fetchObject(targetId);
+int Logic::fnIsFacing(Object *cpt, int32 id, int32 targetId, int32 b, int32 c, int32 d, int32 a, int32 z) {
+ Object *target = _objMan->fetchObject(targetId);
int32 x, y, dir;
if ((target->o_type == TYPE_MEGA) || (target->o_type == TYPE_PLAYER)) {
x = target->o_xcoord;
@@ -1457,8 +1459,8 @@ int SwordLogic::fnIsFacing(BsObject *cpt, int32 id, int32 targetId, int32 b, int
return SCRIPT_STOP;
}
-int SwordLogic::fnGetTo(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
- BsObject *place = _objMan->fetchObject(cpt->o_place);
+int Logic::fnGetTo(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+ Object *place = _objMan->fetchObject(cpt->o_place);
cpt->o_tree.o_script_level++;
cpt->o_tree.o_script_pc[cpt->o_tree.o_script_level] = place->o_get_to_script;
@@ -1466,18 +1468,18 @@ int SwordLogic::fnGetTo(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int3
return SCRIPT_STOP;
}
-int SwordLogic::fnGetToError(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnGetToError(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
debug(1, "fnGetToError: compact %d at place %d no get-to for target %d, click_id %d\n", id, cpt->o_place, cpt->o_target, _scriptVars[CLICK_ID]);
return SCRIPT_CONT;
}
-int SwordLogic::fnRandom(BsObject *compact, int32 id, int32 min, int32 max, int32 e, int32 f, int32 z, int32 x) {
+int Logic::fnRandom(Object *compact, int32 id, int32 min, int32 max, int32 e, int32 f, int32 z, int32 x) {
_scriptVars[RETURN_VALUE] = _rnd.getRandomNumberRng(min, max);
return SCRIPT_CONT;
}
-int SwordLogic::fnGetPos(BsObject *cpt, int32 id, int32 targetId, int32 b, int32 c, int32 d, int32 z, int32 x) {
- BsObject *target = _objMan->fetchObject(targetId);
+int Logic::fnGetPos(Object *cpt, int32 id, int32 targetId, int32 b, int32 c, int32 d, int32 z, int32 x) {
+ Object *target = _objMan->fetchObject(targetId);
if ((target->o_type == TYPE_MEGA) || (target->o_type == TYPE_PLAYER)) {
_scriptVars[RETURN_VALUE] = target->o_xcoord;
_scriptVars[RETURN_VALUE_2] = target->o_ycoord;
@@ -1503,23 +1505,23 @@ int SwordLogic::fnGetPos(BsObject *cpt, int32 id, int32 targetId, int32 b, int32
return SCRIPT_CONT;
}
-int SwordLogic::fnGetGamepadXy(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnGetGamepadXy(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
// playstation only
return SCRIPT_CONT;
}
-int SwordLogic::fnPlayFx(BsObject *cpt, int32 id, int32 fxNo, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnPlayFx(Object *cpt, int32 id, int32 fxNo, int32 b, int32 c, int32 d, int32 z, int32 x) {
_scriptVars[RETURN_VALUE] = _sound->addToQueue(fxNo);
return SCRIPT_CONT;
}
-int SwordLogic::fnStopFx(BsObject *cpt, int32 id, int32 fxNo, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnStopFx(Object *cpt, int32 id, int32 fxNo, int32 b, int32 c, int32 d, int32 z, int32 x) {
_sound->fnStopFx(fxNo);
//_sound->removeFromQueue(fxNo);
return SCRIPT_CONT;
}
-int SwordLogic::fnPlayMusic(BsObject *cpt, int32 id, int32 tuneId, int32 loopFlag, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnPlayMusic(Object *cpt, int32 id, int32 tuneId, int32 loopFlag, int32 c, int32 d, int32 z, int32 x) {
if (tuneId == 153)
return SCRIPT_CONT;
if (loopFlag == LOOPED)
@@ -1531,46 +1533,46 @@ int SwordLogic::fnPlayMusic(BsObject *cpt, int32 id, int32 tuneId, int32 loopFla
return SCRIPT_CONT;
}
-int SwordLogic::fnStopMusic(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnStopMusic(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
_scriptVars[CURRENT_MUSIC] = 0;
_music->fadeDown();
return SCRIPT_CONT;
}
-int SwordLogic::fnInnerSpace(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnInnerSpace(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
error("fnInnerSpace() not working.");
return SCRIPT_STOP;
}
-int SwordLogic::fnSetScreen(BsObject *cpt, int32 id, int32 target, int32 screen, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnSetScreen(Object *cpt, int32 id, int32 target, int32 screen, int32 c, int32 d, int32 z, int32 x) {
_objMan->fetchObject(target)->o_screen = screen;
return SCRIPT_CONT;
}
-int SwordLogic::fnPreload(BsObject *cpt, int32 id, int32 resId, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnPreload(Object *cpt, int32 id, int32 resId, int32 b, int32 c, int32 d, int32 z, int32 x) {
_resMan->resOpen(resId);
_resMan->resClose(resId);
return SCRIPT_CONT;
}
-int SwordLogic::fnCheckCD(BsObject *cpt, int32 id, int32 screen, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnCheckCD(Object *cpt, int32 id, int32 screen, int32 b, int32 c, int32 d, int32 z, int32 x) {
// only a dummy, here.
// the check is done in the mainloop
return SCRIPT_CONT;
}
-int SwordLogic::fnRestartGame(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnRestartGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
SwordEngine::_systemVars.forceRestart = true;
cpt->o_logic = LOGIC_quit;
return SCRIPT_STOP;
}
-int SwordLogic::fnQuitGame(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnQuitGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
error("fnQuitGame() called");
return SCRIPT_STOP;
}
-int SwordLogic::fnDeathScreen(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnDeathScreen(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
if (_scriptVars[FINALE_OPTION_FLAG] == 4) // successful end of game!
SwordEngine::_systemVars.deathScreenFlag = 2;
@@ -1581,51 +1583,51 @@ int SwordLogic::fnDeathScreen(BsObject *cpt, int32 id, int32 a, int32 b, int32 c
return SCRIPT_STOP;
}
-int SwordLogic::fnSetParallax(BsObject *cpt, int32 id, int32 screen, int32 resId, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnSetParallax(Object *cpt, int32 id, int32 screen, int32 resId, int32 c, int32 d, int32 z, int32 x) {
_screen->fnSetParallax(screen, resId);
return SCRIPT_CONT;
}
-int SwordLogic::fnTdebug(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnTdebug(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
debug(1, "Script TDebug id %d code %d, %d", id, a, b);
return SCRIPT_CONT;
}
-int SwordLogic::fnRedFlash(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnRedFlash(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
_screen->fnFlash(FLASH_RED);
return SCRIPT_CONT;
}
-int SwordLogic::fnBlueFlash(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnBlueFlash(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
_screen->fnFlash(FLASH_BLUE);
return SCRIPT_CONT;
}
-int SwordLogic::fnYellow(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnYellow(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
_screen->fnFlash(BORDER_YELLOW);
return SCRIPT_CONT;
}
-int SwordLogic::fnGreen(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnGreen(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
_screen->fnFlash(BORDER_GREEN);
return SCRIPT_CONT;
}
-int SwordLogic::fnPurple(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnPurple(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
_screen->fnFlash(BORDER_PURPLE);
return SCRIPT_CONT;
}
-int SwordLogic::fnBlack(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
+int Logic::fnBlack(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
_screen->fnFlash(BORDER_BLACK);
return SCRIPT_CONT;
}
-uint16 SwordLogic::inRange(uint16 a, uint16 b, uint16 c) {
+uint16 Logic::inRange(uint16 a, uint16 b, uint16 c) {
return (a > b)? a : (((b > c) ? c : b));
}
-const uint32 SwordLogic::_scriptVarInit[NON_ZERO_SCRIPT_VARS][2] = {
+const uint32 Logic::_scriptVarInit[NON_ZERO_SCRIPT_VARS][2] = {
{ 42, 448}, { 43, 378}, { 51, 1}, { 92, 1}, { 147, 71}, { 201, 1},
{ 209, 1}, { 215, 1}, { 242, 2}, { 244, 1}, { 246, 3}, { 247, 1},
{ 253, 1}, { 297, 1}, { 398, 1}, { 508, 1}, { 605, 1}, { 606, 1},
@@ -1643,3 +1645,5 @@ const uint32 SwordLogic::_scriptVarInit[NON_ZERO_SCRIPT_VARS][2] = {
{1116, 63}, {1117, 64}, {1118, 65}, {1119, 66}, {1120, 67}, {1121, 68},
{1122, 69}, {1123, 71}, {1124, 72}, {1125, 73}, {1126, 74}
};
+
+} // End of namespace Sword1
diff --git a/sword1/logic.h b/sword1/logic.h
index 9a1f98c21b..c49d12092b 100644
--- a/sword1/logic.h
+++ b/sword1/logic.h
@@ -27,175 +27,179 @@
#include "objectman.h"
#include "common/util.h"
+namespace Sword1 {
+
#define NON_ZERO_SCRIPT_VARS 95
#define NUM_SCRIPT_VARS 1179
-class SwordText;
-class SwordSound;
+class Text;
+class Sound;
class EventManager;
-class SwordMenu;
-class SwordRouter;
-class SwordScreen;
-class SwordMouse;
-class SwordMusic;
+class Menu;
+class Router;
+class Screen;
+class Mouse;
+class Music;
-class SwordLogic;
-typedef int (SwordLogic::*BSMcodeTable)(BsObject *, int32, int32, int32, int32, int32, int32, int32);
+class Logic;
+typedef int (Logic::*BSMcodeTable)(Object *, int32, int32, int32, int32, int32, int32, int32);
-class SwordLogic {
+class Logic {
public:
- SwordLogic(ObjectMan *pObjMan, ResMan *resMan, SwordScreen *pScreen, SwordMouse *pMouse, SwordSound *pSound, SwordMusic *pMusic, SwordMenu *pMenu);
- ~SwordLogic(void);
+ Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu);
+ ~Logic(void);
void initialize(void);
void newScreen(uint32 screen);
void engine(void);
void updateScreenParams(void);
- void runMouseScript(BsObject *cpt, int32 scriptId);
+ void runMouseScript(Object *cpt, int32 scriptId);
static uint32 _scriptVars[NUM_SCRIPT_VARS];
// public for startPositions()
- int fnAddObject (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnEnterSection (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPlaySequence (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnMegaSet (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnNoSprite (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAddObject (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnEnterSection (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPlaySequence (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnMegaSet (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnNoSprite (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
// public for mouse (menu looking)
- int cfnPresetScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int cfnPresetScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
private:
ObjectMan *_objMan;
ResMan *_resMan;
- SwordScreen *_screen;
- SwordSound *_sound;
- SwordMouse *_mouse;
- SwordRouter *_router;
- SwordText *_textMan;
+ Screen *_screen;
+ Sound *_sound;
+ Mouse *_mouse;
+ Router *_router;
+ Text *_textMan;
EventManager *_eventMan;
- SwordMenu *_menu;
- SwordMusic *_music;
+ Menu *_menu;
+ Music *_music;
uint32 _newScript; // <= ugly, but I can't avoid it.
bool _speechRunning, _speechFinished, _textRunning;
uint8 _speechClickDelay;
Common::RandomSource _rnd;
- int scriptManager(BsObject *compact, uint32 id);
- void processLogic(BsObject *compact, uint32 id);
- int interpretScript(BsObject *compact, int id, Header *scriptModule, int scriptBase, int scriptNum);
+ int scriptManager(Object *compact, uint32 id);
+ void processLogic(Object *compact, uint32 id);
+ int interpretScript(Object *compact, int id, Header *scriptModule, int scriptBase, int scriptNum);
- int logicWaitTalk(BsObject *compact);
- int logicStartTalk(BsObject *compact);
- int logicArAnimate(BsObject *compact, uint32 id);
- int speechDriver(BsObject *compact);
- int fullAnimDriver(BsObject *compact);
- int animDriver(BsObject *compact);
+ int logicWaitTalk(Object *compact);
+ int logicStartTalk(Object *compact);
+ int logicArAnimate(Object *compact, uint32 id);
+ int speechDriver(Object *compact);
+ int fullAnimDriver(Object *compact);
+ int animDriver(Object *compact);
static BSMcodeTable _mcodeTable[100];
uint16 inRange(uint16 a, uint16 b, uint16 c);
//- mcodeTable:
- int fnBackground (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnForeground (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSort (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnAnim (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetFrame (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFullAnim (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFullSetFrame (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFadeDown (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFadeUp (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnCheckFade (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetSpritePalette(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetWholePalette(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetFadeTargetPalette(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetPaletteToFade(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetPaletteToCut(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnIdle (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPause (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPauseSeconds (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnQuit (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnKillId (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSuicide (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnNewScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSubScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRestartScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetBookmark (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGotoBookmark (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSendSync (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWaitSync (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBackground (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnForeground (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSort (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAnim (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetFrame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFullAnim (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFullSetFrame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFadeDown (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFadeUp (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnCheckFade (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetSpritePalette(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetWholePalette(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetFadeTargetPalette(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetPaletteToFade(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetPaletteToCut(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnIdle (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPause (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPauseSeconds (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnQuit (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnKillId (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSuicide (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnNewScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSubScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRestartScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetBookmark (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGotoBookmark (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSendSync (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWaitSync (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int cfnClickInteract(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int cfnSetScript (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnInteract (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnIssueEvent (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnCheckForEvent (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWipeHands (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnISpeak (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTheyDo (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTheyDoWeWait (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWeWait (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnChangeSpeechText(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTalkError (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStartTalk (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnCheckForTextLine(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnAddTalkWaitStatusBit(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRemoveTalkWaitStatusBit(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnNoHuman (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnAddHuman (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnBlankMouse (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnNormalMouse (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnLockMouse (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnUnlockMouse (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetMousePointer(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetMouseLuggage(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnMouseOn (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnMouseOff (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnChooser (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnEndChooser (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStartMenu (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnEndMenu (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int cfnClickInteract(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int cfnSetScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnInteract (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnIssueEvent (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnCheckForEvent (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWipeHands (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnISpeak (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTheyDo (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTheyDoWeWait (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWeWait (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnChangeSpeechText(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTalkError (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStartTalk (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnCheckForTextLine(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAddTalkWaitStatusBit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRemoveTalkWaitStatusBit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnNoHuman (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAddHuman (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBlankMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnNormalMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnLockMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnUnlockMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetMousePointer(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetMouseLuggage(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnMouseOn (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnMouseOff (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnChooser (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnEndChooser (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStartMenu (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnEndMenu (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int cfnReleaseMenu (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int cfnReleaseMenu (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnAddSubject (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRemoveObject (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnLeaveSection (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnChangeFloor (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWalk (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTurn (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStand (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStandAt (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFace (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFaceXy (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnIsFacing (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetTo (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetToError (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetPos (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetGamepadXy (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPlayFx (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStopFx (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPlayMusic (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStopMusic (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnInnerSpace (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRandom (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetScreen (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPreload (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnCheckCD (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRestartGame (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnQuitGame (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnDeathScreen (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetParallax (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTdebug (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnRedFlash (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnBlueFlash (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnYellow (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGreen (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPurple (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnBlack (BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAddSubject (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRemoveObject (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnLeaveSection (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnChangeFloor (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWalk (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTurn (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStand (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStandAt (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFace (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFaceXy (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnIsFacing (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetTo (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetToError (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetPos (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetGamepadXy (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPlayFx (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStopFx (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPlayMusic (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStopMusic (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnInnerSpace (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRandom (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetScreen (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPreload (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnCheckCD (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRestartGame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnQuitGame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnDeathScreen (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetParallax (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTdebug (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnRedFlash (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBlueFlash (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnYellow (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGreen (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPurple (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBlack (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
static const uint32 _scriptVarInit[NON_ZERO_SCRIPT_VARS][2];
};
+} // End of namespace Sword1
+
#endif //BSLOGIC_H
diff --git a/sword1/memman.cpp b/sword1/memman.cpp
index 43cfdbf7eb..37c8574fbe 100644
--- a/sword1/memman.cpp
+++ b/sword1/memman.cpp
@@ -23,6 +23,8 @@
#include "memman.h"
#include "common/util.h"
+namespace Sword1 {
+
MemMan::MemMan(void) {
_alloced = 0;
_memListFree = _memListFreeEnd = NULL;
@@ -31,7 +33,7 @@ MemMan::MemMan(void) {
MemMan::~MemMan(void) {
}
-void MemMan::alloc(BsMemHandle *bsMem, uint32 pSize, uint16 pCond) {
+void MemMan::alloc(MemHandle *bsMem, uint32 pSize, uint16 pCond) {
_alloced += pSize;
bsMem->data = (void*)malloc(pSize);
if (!bsMem->data)
@@ -46,7 +48,7 @@ void MemMan::alloc(BsMemHandle *bsMem, uint32 pSize, uint16 pCond) {
checkMemoryUsage();
}
-void MemMan::freeNow(BsMemHandle *bsMem) {
+void MemMan::freeNow(MemHandle *bsMem) {
if (bsMem->cond != MEM_FREED) {
_alloced -= bsMem->size;
removeFromFreeList(bsMem);
@@ -55,7 +57,7 @@ void MemMan::freeNow(BsMemHandle *bsMem) {
}
}
-void MemMan::setCondition(BsMemHandle *bsMem, uint16 pCond) {
+void MemMan::setCondition(MemHandle *bsMem, uint16 pCond) {
if ((pCond == MEM_FREED) || (pCond > MEM_DONT_FREE))
error("MemMan::setCondition: program tried to set illegal memory condition");
if (bsMem->cond != pCond) {
@@ -89,7 +91,7 @@ void MemMan::checkMemoryUsage(void) {
}
}
-void MemMan::addToFreeList(BsMemHandle *bsMem) {
+void MemMan::addToFreeList(MemHandle *bsMem) {
if (bsMem->next || bsMem->prev) {
warning("addToFreeList: mem block is already in freeList");
return;
@@ -103,7 +105,7 @@ void MemMan::addToFreeList(BsMemHandle *bsMem) {
_memListFreeEnd = _memListFree;
}
-void MemMan::removeFromFreeList(BsMemHandle *bsMem) {
+void MemMan::removeFromFreeList(MemHandle *bsMem) {
if (_memListFree == bsMem)
_memListFree = bsMem->next;
if (_memListFreeEnd == bsMem)
@@ -116,7 +118,8 @@ void MemMan::removeFromFreeList(BsMemHandle *bsMem) {
bsMem->next = bsMem->prev = NULL;
}
-void MemMan::initHandle(BsMemHandle *bsMem) {
- memset(bsMem, 0, sizeof(BsMemHandle));
+void MemMan::initHandle(MemHandle *bsMem) {
+ memset(bsMem, 0, sizeof(MemHandle));
}
+} // End of namespace Sword1
diff --git a/sword1/memman.h b/sword1/memman.h
index d24a544e45..018164a5ad 100644
--- a/sword1/memman.h
+++ b/sword1/memman.h
@@ -24,12 +24,14 @@
#include "scummsys.h"
-struct BsMemHandle {
+namespace Sword1 {
+
+struct MemHandle {
void *data;
uint32 size;
uint32 refCount;
uint16 cond;
- BsMemHandle *next, *prev;
+ MemHandle *next, *prev;
};
// mem conditions:
#define MEM_FREED 0
@@ -42,18 +44,20 @@ class MemMan {
public:
MemMan(void);
~MemMan(void);
- void alloc(BsMemHandle *bsMem, uint32 pSize, uint16 pCond = MEM_DONT_FREE);
- void setCondition(BsMemHandle *bsMem, uint16 pCond);
- void freeNow(BsMemHandle *bsMem);
- void initHandle(BsMemHandle *bsMem);
+ void alloc(MemHandle *bsMem, uint32 pSize, uint16 pCond = MEM_DONT_FREE);
+ void setCondition(MemHandle *bsMem, uint16 pCond);
+ void freeNow(MemHandle *bsMem);
+ void initHandle(MemHandle *bsMem);
void flush(void);
private:
- void addToFreeList(BsMemHandle *bsMem);
- void removeFromFreeList(BsMemHandle *bsMem);
+ void addToFreeList(MemHandle *bsMem);
+ void removeFromFreeList(MemHandle *bsMem);
void checkMemoryUsage(void);
uint32 _alloced; //currently allocated memory
- BsMemHandle *_memListFree;
- BsMemHandle *_memListFreeEnd;
+ MemHandle *_memListFree;
+ MemHandle *_memListFreeEnd;
};
+} // End of namespace Sword1
+
#endif //MEMMAN_H
diff --git a/sword1/menu.cpp b/sword1/menu.cpp
index d643a22850..7eff49103a 100644
--- a/sword1/menu.cpp
+++ b/sword1/menu.cpp
@@ -29,6 +29,8 @@
#include "screen.h"
#include "logic.h"
+namespace Sword1 {
+
enum {
MENU_CLOSED,
MENU_CLOSING,
@@ -36,7 +38,7 @@ enum {
MENU_OPEN
};
-const byte SwordMenu::_fadeEffectTop[64] = {
+const byte Menu::_fadeEffectTop[64] = {
1, 7, 5, 3, 2, 4, 6, 0,
3, 1, 7, 5, 4, 6, 0, 2,
5, 3, 1, 7, 6, 0, 2, 4,
@@ -47,7 +49,7 @@ const byte SwordMenu::_fadeEffectTop[64] = {
1, 7, 5, 3, 2, 4, 6, 0
};
-const byte SwordMenu::_fadeEffectBottom[64] = {
+const byte Menu::_fadeEffectBottom[64] = {
7, 6, 5, 4, 3, 2, 1, 0,
0, 7, 6, 5, 4, 3, 2, 1,
1, 0, 7, 6, 5, 4, 3, 2,
@@ -58,7 +60,7 @@ const byte SwordMenu::_fadeEffectBottom[64] = {
6, 5, 4, 3, 2, 1, 0, 7
};
-SwordMenuIcon::SwordMenuIcon(uint8 menuType, uint8 menuPos, uint32 resId, uint32 frame, SwordScreen *screen) {
+MenuIcon::MenuIcon(uint8 menuType, uint8 menuPos, uint32 resId, uint32 frame, Screen *screen) {
_menuType = menuType;
_menuPos = menuPos;
_resId = resId;
@@ -67,7 +69,7 @@ SwordMenuIcon::SwordMenuIcon(uint8 menuType, uint8 menuPos, uint32 resId, uint32
_selected = false;
}
-bool SwordMenuIcon::wasClicked(uint16 mouseX, uint16 mouseY) {
+bool MenuIcon::wasClicked(uint16 mouseX, uint16 mouseY) {
if (((_menuType == MENU_TOP) && (mouseY >= 40)) || ((_menuType == MENU_BOT) && (mouseY < 440)))
return false;
if ((mouseX >= _menuPos * 40) && (mouseX < (_menuPos + 1) * 40))
@@ -76,17 +78,17 @@ bool SwordMenuIcon::wasClicked(uint16 mouseX, uint16 mouseY) {
return false;
}
-void SwordMenuIcon::setSelect(bool pSel) {
+void MenuIcon::setSelect(bool pSel) {
_selected = pSel;
}
-void SwordMenuIcon::draw(const byte *fadeMask, int8 fadeStatus) {
+void MenuIcon::draw(const byte *fadeMask, int8 fadeStatus) {
uint16 x = _menuPos * 40;
uint16 y = (_menuType == MENU_TOP)?(0):(440);
_screen->showFrame(x, y, _resId, _frame + (_selected ? 1 : 0), fadeMask, fadeStatus);
}
-SwordMenu::SwordMenu(SwordScreen *pScreen, SwordMouse *pMouse) {
+Menu::Menu(Screen *pScreen, Mouse *pMouse) {
uint8 cnt;
_screen = pScreen;
_mouse = pMouse;
@@ -101,7 +103,7 @@ SwordMenu::SwordMenu(SwordScreen *pScreen, SwordMouse *pMouse) {
_inMenu = 0;
}
-void SwordMenu::refreshMenus() {
+void Menu::refreshMenus() {
if (_objectBarStatus == MENU_OPEN) {
buildMenu();
for (uint8 cnt = 0; cnt < 16; cnt++) {
@@ -122,7 +124,7 @@ void SwordMenu::refreshMenus() {
}
}
-uint8 SwordMenu::checkMenuClick(uint8 menuType) {
+uint8 Menu::checkMenuClick(uint8 menuType) {
uint16 mouseEvent = _mouse->testEvent();
if (!mouseEvent)
return 0;
@@ -132,30 +134,30 @@ uint8 SwordMenu::checkMenuClick(uint8 menuType) {
// Conversation mode. Icons are highlighted on mouse-down, but
// the actual response is made on mouse-up.
if (menuType == MENU_BOT) {
- if (SwordLogic::_scriptVars[OBJECT_HELD] && (mouseEvent & BS1L_BUTTON_UP)) {
- for (uint8 cnt = 0; cnt < SwordLogic::_scriptVars[IN_SUBJECT]; cnt++) {
- if (_subjectBar[cnt] == SwordLogic::_scriptVars[OBJECT_HELD])
+ if (Logic::_scriptVars[OBJECT_HELD] && (mouseEvent & BS1L_BUTTON_UP)) {
+ for (uint8 cnt = 0; cnt < Logic::_scriptVars[IN_SUBJECT]; cnt++) {
+ if (_subjectBar[cnt] == Logic::_scriptVars[OBJECT_HELD])
return cnt + 1;
}
} else if (mouseEvent & BS1L_BUTTON_DOWN) {
- for (uint8 cnt = 0; cnt < SwordLogic::_scriptVars[IN_SUBJECT]; cnt++) {
+ for (uint8 cnt = 0; cnt < Logic::_scriptVars[IN_SUBJECT]; cnt++) {
if (_subjects[cnt]->wasClicked(x, y)) {
- SwordLogic::_scriptVars[OBJECT_HELD] = _subjectBar[cnt];
+ Logic::_scriptVars[OBJECT_HELD] = _subjectBar[cnt];
refreshMenus();
break;
}
}
}
} else {
- if (SwordLogic::_scriptVars[OBJECT_HELD] && (mouseEvent & BS1L_BUTTON_UP)) {
+ if (Logic::_scriptVars[OBJECT_HELD] && (mouseEvent & BS1L_BUTTON_UP)) {
for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
- if (_menuList[cnt] == SwordLogic::_scriptVars[OBJECT_HELD])
+ if (_menuList[cnt] == Logic::_scriptVars[OBJECT_HELD])
return cnt + 1;
}
} else if (mouseEvent & BS1L_BUTTON_DOWN) {
for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
if (_objects[cnt]->wasClicked(x, y)) {
- SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
+ Logic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
refreshMenus();
break;
}
@@ -168,21 +170,21 @@ uint8 SwordMenu::checkMenuClick(uint8 menuType) {
for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
if (_objects[cnt]->wasClicked(x, y)) {
if (mouseEvent & BS1R_BUTTON_DOWN) { // looking at item
- SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
- SwordLogic::_scriptVars[MENU_LOOKING] = 1;
- SwordLogic::_scriptVars[DEFAULT_ICON_TEXT] = _objectDefs[_menuList[cnt]].textDesc;
+ Logic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
+ Logic::_scriptVars[MENU_LOOKING] = 1;
+ Logic::_scriptVars[DEFAULT_ICON_TEXT] = _objectDefs[_menuList[cnt]].textDesc;
} else if (mouseEvent & BS1L_BUTTON_DOWN) {
- if (SwordLogic::_scriptVars[OBJECT_HELD]) {
- if (SwordLogic::_scriptVars[OBJECT_HELD] == _menuList[cnt]) {
+ if (Logic::_scriptVars[OBJECT_HELD]) {
+ if (Logic::_scriptVars[OBJECT_HELD] == _menuList[cnt]) {
_mouse->setLuggage(0, 0);
- SwordLogic::_scriptVars[OBJECT_HELD] = 0; // reselected => deselect it
+ Logic::_scriptVars[OBJECT_HELD] = 0; // reselected => deselect it
} else { // the player is clicking another item on this one.
// run its use-script, if there is one
- SwordLogic::_scriptVars[SECOND_ITEM] = _menuList[cnt];
+ Logic::_scriptVars[SECOND_ITEM] = _menuList[cnt];
_mouse->setLuggage(0, 0);
}
} else {
- SwordLogic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
+ Logic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
_mouse->setLuggage(_objectDefs[_menuList[cnt]].luggageIconRes, 0);
}
}
@@ -195,25 +197,25 @@ uint8 SwordMenu::checkMenuClick(uint8 menuType) {
return 0;
}
-void SwordMenu::buildSubjects(void) {
+void Menu::buildSubjects(void) {
uint8 cnt;
for (cnt = 0; cnt < 16; cnt++)
if (_subjects[cnt]) {
delete _subjects[cnt];
_subjects[cnt] = NULL;
}
- for (cnt = 0; cnt < SwordLogic::_scriptVars[IN_SUBJECT]; cnt++) {
+ for (cnt = 0; cnt < Logic::_scriptVars[IN_SUBJECT]; cnt++) {
uint32 res = _subjectList[(_subjectBar[cnt] & 65535) - BASE_SUBJECT].subjectRes;
uint32 frame = _subjectList[(_subjectBar[cnt] & 65535) - BASE_SUBJECT].frameNo;
- _subjects[cnt] = new SwordMenuIcon(MENU_BOT, cnt, res, frame, _screen);
- if (SwordLogic::_scriptVars[OBJECT_HELD])
- _subjects[cnt]->setSelect(_subjectBar[cnt] == SwordLogic::_scriptVars[OBJECT_HELD]);
+ _subjects[cnt] = new MenuIcon(MENU_BOT, cnt, res, frame, _screen);
+ if (Logic::_scriptVars[OBJECT_HELD])
+ _subjects[cnt]->setSelect(_subjectBar[cnt] == Logic::_scriptVars[OBJECT_HELD]);
else
_subjects[cnt]->setSelect(true);
}
}
-void SwordMenu::refresh(uint8 menuType) {
+void Menu::refresh(uint8 menuType) {
uint i;
if (menuType == MENU_TOP) {
@@ -259,7 +261,7 @@ void SwordMenu::refresh(uint8 menuType) {
if (_fadeSubject > 0)
_fadeSubject--;
else {
- for (i = 0; i < SwordLogic::_scriptVars[IN_SUBJECT]; i++) {
+ for (i = 0; i < Logic::_scriptVars[IN_SUBJECT]; i++) {
delete _subjects[i];
_subjects[i] = NULL;
}
@@ -269,8 +271,8 @@ void SwordMenu::refresh(uint8 menuType) {
}
}
-void SwordMenu::buildMenu(void) {
- uint32 *pockets = SwordLogic::_scriptVars + POCKET_1;
+void Menu::buildMenu(void) {
+ uint32 *pockets = Logic::_scriptVars + POCKET_1;
for (uint8 cnt = 0; cnt < _inMenu; cnt++)
if (_objects[cnt]) {
delete _objects[cnt];
@@ -283,15 +285,15 @@ void SwordMenu::buildMenu(void) {
_inMenu++;
}
for (uint32 menuSlot = 0; menuSlot < _inMenu; menuSlot++) {
- _objects[menuSlot] = new SwordMenuIcon(MENU_TOP, menuSlot, _objectDefs[_menuList[menuSlot]].bigIconRes, _objectDefs[_menuList[menuSlot]].bigIconFrame, _screen);
- uint32 objHeld = SwordLogic::_scriptVars[OBJECT_HELD];
+ _objects[menuSlot] = new MenuIcon(MENU_TOP, menuSlot, _objectDefs[_menuList[menuSlot]].bigIconRes, _objectDefs[_menuList[menuSlot]].bigIconFrame, _screen);
+ uint32 objHeld = Logic::_scriptVars[OBJECT_HELD];
// check highlighting
- if (SwordLogic::_scriptVars[MENU_LOOKING] || _subjectBarStatus == MENU_OPEN) { // either we're in the chooser or we're doing a 'LOOK AT'
+ if (Logic::_scriptVars[MENU_LOOKING] || _subjectBarStatus == MENU_OPEN) { // either we're in the chooser or we're doing a 'LOOK AT'
if ((!objHeld) || (objHeld == _menuList[menuSlot]))
_objects[menuSlot]->setSelect(true);
- } else if (SwordLogic::_scriptVars[SECOND_ITEM]) { // clicked luggage onto 2nd icon - we need to colour-highlight the 2 relevant icons & grey out the rest
- if ((_menuList[menuSlot] == objHeld) || (_menuList[menuSlot] == SwordLogic::_scriptVars[SECOND_ITEM]))
+ } else if (Logic::_scriptVars[SECOND_ITEM]) { // clicked luggage onto 2nd icon - we need to colour-highlight the 2 relevant icons & grey out the rest
+ if ((_menuList[menuSlot] == objHeld) || (_menuList[menuSlot] == Logic::_scriptVars[SECOND_ITEM]))
_objects[menuSlot]->setSelect(true);
} else { // this object is selected - ie. GREYED OUT
if (objHeld != _menuList[menuSlot])
@@ -300,7 +302,7 @@ void SwordMenu::buildMenu(void) {
}
}
-void SwordMenu::showMenu(uint8 menuType) {
+void Menu::showMenu(uint8 menuType) {
if (menuType == MENU_TOP) {
if (_objectBarStatus == MENU_OPEN) {
for (uint8 cnt = 0; cnt < 16; cnt++) {
@@ -317,21 +319,21 @@ void SwordMenu::showMenu(uint8 menuType) {
}
}
-void SwordMenu::fnStartMenu(void) {
- SwordLogic::_scriptVars[OBJECT_HELD] = 0; // icon no longer selected
- SwordLogic::_scriptVars[SECOND_ITEM] = 0; // second icon no longer selected (after using one on another)
- SwordLogic::_scriptVars[MENU_LOOKING] = 0; // no longer 'looking at' an icon
+void Menu::fnStartMenu(void) {
+ Logic::_scriptVars[OBJECT_HELD] = 0; // icon no longer selected
+ Logic::_scriptVars[SECOND_ITEM] = 0; // second icon no longer selected (after using one on another)
+ Logic::_scriptVars[MENU_LOOKING] = 0; // no longer 'looking at' an icon
buildMenu();
showMenu(MENU_TOP);
}
-void SwordMenu::fnEndMenu(void) {
+void Menu::fnEndMenu(void) {
if (_objectBarStatus != MENU_CLOSED)
_objectBarStatus = MENU_CLOSING;
}
-void SwordMenu::fnChooser(BsObject *compact) {
- SwordLogic::_scriptVars[OBJECT_HELD] = 0;
+void Menu::fnChooser(Object *compact) {
+ Logic::_scriptVars[OBJECT_HELD] = 0;
_mouse->setLuggage(0, 0);
buildSubjects();
compact->o_logic = LOGIC_choose;
@@ -339,20 +341,20 @@ void SwordMenu::fnChooser(BsObject *compact) {
_subjectBarStatus = MENU_OPENING;
}
-void SwordMenu::fnEndChooser(void) {
- SwordLogic::_scriptVars[OBJECT_HELD] = 0;
+void Menu::fnEndChooser(void) {
+ Logic::_scriptVars[OBJECT_HELD] = 0;
_subjectBarStatus = MENU_CLOSING;
_objectBarStatus = MENU_CLOSING;
_mouse->controlPanel(false);
_mouse->setLuggage(0, 0);
}
-void SwordMenu::checkTopMenu(void) {
+void Menu::checkTopMenu(void) {
if (_objectBarStatus == MENU_OPEN)
checkMenuClick(MENU_TOP);
}
-int SwordMenu::logicChooser(BsObject *compact) {
+int Menu::logicChooser(Object *compact) {
uint8 objSelected = 0;
if (_objectBarStatus == MENU_OPEN)
objSelected = checkMenuClick(MENU_TOP);
@@ -365,11 +367,13 @@ int SwordMenu::logicChooser(BsObject *compact) {
return 0;
}
-void SwordMenu::fnAddSubject(int32 sub) {
- _subjectBar[SwordLogic::_scriptVars[IN_SUBJECT]] = sub;
- SwordLogic::_scriptVars[IN_SUBJECT]++;
+void Menu::fnAddSubject(int32 sub) {
+ _subjectBar[Logic::_scriptVars[IN_SUBJECT]] = sub;
+ Logic::_scriptVars[IN_SUBJECT]++;
}
-void SwordMenu::cfnReleaseMenu(void) {
+void Menu::cfnReleaseMenu(void) {
_objectBarStatus = MENU_CLOSING;
}
+
+} // End of namespace Sword1
diff --git a/sword1/menu.h b/sword1/menu.h
index c5b87ed989..461d883248 100644
--- a/sword1/menu.h
+++ b/sword1/menu.h
@@ -25,8 +25,10 @@
#include "sworddefs.h"
#include "object.h"
-class SwordScreen;
-class SwordMouse;
+namespace Sword1 {
+
+class Screen;
+class Mouse;
class ResMan;
#define MENU_TOP 0
@@ -45,9 +47,9 @@ struct MenuObject {
uint32 useScript;
};
-class SwordMenuIcon {
+class MenuIcon {
public:
- SwordMenuIcon(uint8 menuType, uint8 menuPos, uint32 resId, uint32 frame, SwordScreen *screen);
+ MenuIcon(uint8 menuType, uint8 menuPos, uint32 resId, uint32 frame, Screen *screen);
bool wasClicked(uint16 mouseX, uint16 mouseY);
void setSelect(bool pSel);
void draw(const byte *fadeMask = NULL, int8 fadeStatus = 0);
@@ -56,17 +58,17 @@ private:
uint8 _menuType, _menuPos;
uint32 _resId, _frame;
bool _selected;
- SwordScreen *_screen;
+ Screen *_screen;
};
-class SwordMenu {
+class Menu {
public:
- SwordMenu(SwordScreen *pScreen, SwordMouse *pMouse);
- void fnChooser(BsObject *compact);
+ Menu(Screen *pScreen, Mouse *pMouse);
+ void fnChooser(Object *compact);
void fnEndChooser(void);
void fnAddSubject(int32 sub);
void cfnReleaseMenu(void);
- int logicChooser(BsObject *compact);
+ int logicChooser(Object *compact);
void engine(void);
void refresh(uint8 menuType);
void fnStartMenu(void);
@@ -85,19 +87,21 @@ private:
void refreshMenus(void);
uint8 checkMenuClick(uint8 menuType);
//- lower menu, speech subjects:
- SwordMenuIcon *_subjects[16];
+ MenuIcon *_subjects[16];
uint32 _subjectBar[16];
//- top menu, items
- SwordMenuIcon *_objects[TOTAL_pockets];
+ MenuIcon *_objects[TOTAL_pockets];
uint32 _menuList[TOTAL_pockets];
uint32 _inMenu;
- SwordScreen *_screen;
- SwordMouse *_mouse;
+ Screen *_screen;
+ Mouse *_mouse;
static const Subject _subjectList[TOTAL_subjects];
static const byte _fadeEffectTop[64];
static const byte _fadeEffectBottom[64];
};
+} // End of namespace Sword1
+
#endif //BSMENU_H
diff --git a/sword1/mouse.cpp b/sword1/mouse.cpp
index a42214ffc8..7add561ab7 100644
--- a/sword1/mouse.cpp
+++ b/sword1/mouse.cpp
@@ -31,16 +31,18 @@
#include "swordres.h"
#include "menu.h"
-SwordMouse::SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
+namespace Sword1 {
+
+Mouse::Mouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
_resMan = pResMan;
_objMan = pObjMan;
_system = system;
_currentPtr = NULL;
}
-void SwordMouse::initialize(void) {
+void Mouse::initialize(void) {
_numObjs = 0;
- SwordLogic::_scriptVars[MOUSE_STATUS] = 0; // mouse off and unlocked
+ Logic::_scriptVars[MOUSE_STATUS] = 0; // mouse off and unlocked
_getOff = 0;
_inTopMenu = false;
_mouseOverride = false;
@@ -53,7 +55,7 @@ void SwordMouse::initialize(void) {
createPointer(0, 0);
}
-void SwordMouse::controlPanel(bool on) { // true on entering cpanel, false when leaving
+void Mouse::controlPanel(bool on) { // true on entering cpanel, false when leaving
static uint32 savedPtrId = 0;
if (on) {
savedPtrId = _currentPtrId;
@@ -68,18 +70,18 @@ void SwordMouse::controlPanel(bool on) { // true on entering cpanel, false when
}
}
-void SwordMouse::useLogicAndMenu(SwordLogic *pLogic, SwordMenu *pMenu) {
+void Mouse::useLogicAndMenu(Logic *pLogic, Menu *pMenu) {
_logic = pLogic;
_menu = pMenu;
}
-void SwordMouse::addToList(int id, BsObject *compact) {
+void Mouse::addToList(int id, Object *compact) {
_objList[_numObjs].id = id;
_objList[_numObjs].compact = compact;
_numObjs++;
}
-void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
+void Mouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
_state = 0; // all mouse events are flushed after one cycle.
if (_lastState) { // delay all events by one cycle to notice L_button + R_button clicks correctly.
_state = _lastState | eventFlags;
@@ -96,22 +98,22 @@ void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
_mouseX = x;
_mouseY = y;
- if (!(SwordLogic::_scriptVars[MOUSE_STATUS] & 1)) { // no human?
+ if (!(Logic::_scriptVars[MOUSE_STATUS] & 1)) { // no human?
_numObjs = 0;
return; // no human, so we don't want the mouse engine
}
- if (!SwordLogic::_scriptVars[TOP_MENU_DISABLED]) {
+ if (!Logic::_scriptVars[TOP_MENU_DISABLED]) {
if (y < 40) { // okay, we are in the top menu.
if (!_inTopMenu) { // are we just entering it?
- if (!SwordLogic::_scriptVars[OBJECT_HELD])
+ if (!Logic::_scriptVars[OBJECT_HELD])
_menu->fnStartMenu();
setPointer(MSE_POINTER, 0);
}
_menu->checkTopMenu();
_inTopMenu = true;
} else if (_inTopMenu) { // we're not in the menu. did we just leave it?
- if (!SwordLogic::_scriptVars[OBJECT_HELD])
+ if (!Logic::_scriptVars[OBJECT_HELD])
_menu->fnEndMenu();
_inTopMenu = false;
}
@@ -120,8 +122,8 @@ void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
_inTopMenu = false;
}
- SwordLogic::_scriptVars[MOUSE_X] = SwordLogic::_scriptVars[SCROLL_OFFSET_X] + x + 128;
- SwordLogic::_scriptVars[MOUSE_Y] = SwordLogic::_scriptVars[SCROLL_OFFSET_Y] + y + 128 - 40;
+ Logic::_scriptVars[MOUSE_X] = Logic::_scriptVars[SCROLL_OFFSET_X] + x + 128;
+ Logic::_scriptVars[MOUSE_Y] = Logic::_scriptVars[SCROLL_OFFSET_Y] + y + 128 - 40;
//-
int32 touchedId = 0;
@@ -130,17 +132,17 @@ void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
for (uint16 priority = 0; (priority < 10) && (!touchedId); priority++) {
for (uint16 cnt = 0; (cnt < _numObjs) && (!touchedId); cnt++) {
if ((_objList[cnt].compact->o_priority == priority) &&
- (SwordLogic::_scriptVars[MOUSE_X] >= (uint32)_objList[cnt].compact->o_mouse_x1) &&
- (SwordLogic::_scriptVars[MOUSE_X] <= (uint32)_objList[cnt].compact->o_mouse_x2) &&
- (SwordLogic::_scriptVars[MOUSE_Y] >= (uint32)_objList[cnt].compact->o_mouse_y1) &&
- (SwordLogic::_scriptVars[MOUSE_Y] <= (uint32)_objList[cnt].compact->o_mouse_y2)) {
+ (Logic::_scriptVars[MOUSE_X] >= (uint32)_objList[cnt].compact->o_mouse_x1) &&
+ (Logic::_scriptVars[MOUSE_X] <= (uint32)_objList[cnt].compact->o_mouse_x2) &&
+ (Logic::_scriptVars[MOUSE_Y] >= (uint32)_objList[cnt].compact->o_mouse_y1) &&
+ (Logic::_scriptVars[MOUSE_Y] <= (uint32)_objList[cnt].compact->o_mouse_y2)) {
touchedId = _objList[cnt].id;
clicked = cnt;
}
}
}
- if (touchedId != (int)SwordLogic::_scriptVars[SPECIAL_ITEM]) { //the mouse collision situation has changed in one way or another
- SwordLogic::_scriptVars[SPECIAL_ITEM] = touchedId;
+ if (touchedId != (int)Logic::_scriptVars[SPECIAL_ITEM]) { //the mouse collision situation has changed in one way or another
+ Logic::_scriptVars[SPECIAL_ITEM] = touchedId;
if (_getOff) { // there was something else selected before, run its get-off script
_logic->runMouseScript(NULL, _getOff);
_getOff = 0;
@@ -153,29 +155,29 @@ void SwordMouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
}
}
} else
- SwordLogic::_scriptVars[SPECIAL_ITEM] = 0;
+ Logic::_scriptVars[SPECIAL_ITEM] = 0;
if (_state & MOUSE_DOWN_MASK) {
if (_inTopMenu) {
- if (SwordLogic::_scriptVars[SECOND_ITEM])
- _logic->runMouseScript(NULL, _menu->_objectDefs[SwordLogic::_scriptVars[SECOND_ITEM]].useScript);
- if (SwordLogic::_scriptVars[MENU_LOOKING])
+ if (Logic::_scriptVars[SECOND_ITEM])
+ _logic->runMouseScript(NULL, _menu->_objectDefs[Logic::_scriptVars[SECOND_ITEM]].useScript);
+ if (Logic::_scriptVars[MENU_LOOKING])
_logic->cfnPresetScript(NULL, -1, PLAYER, SCR_menu_look, 0, 0, 0, 0);
}
- SwordLogic::_scriptVars[MOUSE_BUTTON] = _state & MOUSE_DOWN_MASK;
- if (SwordLogic::_scriptVars[SPECIAL_ITEM]) {
- BsObject *compact = _objMan->fetchObject(SwordLogic::_scriptVars[SPECIAL_ITEM]);
+ Logic::_scriptVars[MOUSE_BUTTON] = _state & MOUSE_DOWN_MASK;
+ if (Logic::_scriptVars[SPECIAL_ITEM]) {
+ Object *compact = _objMan->fetchObject(Logic::_scriptVars[SPECIAL_ITEM]);
_logic->runMouseScript(compact, compact->o_mouse_click);
}
}
_numObjs = 0;
}
-uint16 SwordMouse::testEvent(void) {
+uint16 Mouse::testEvent(void) {
return _state;
}
-void SwordMouse::createPointer(uint32 ptrId, uint32 luggageId) {
+void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
if (_currentPtr) {
free(_currentPtr);
_currentPtr = NULL;
@@ -230,13 +232,13 @@ void SwordMouse::createPointer(uint32 ptrId, uint32 luggageId) {
}
}
-void SwordMouse::setPointer(uint32 resId, uint32 rate) {
+void Mouse::setPointer(uint32 resId, uint32 rate) {
_currentPtrId = resId;
_frame = 0;
createPointer(resId, _currentLuggageId);
- if ((resId == 0) || (!(SwordLogic::_scriptVars[MOUSE_STATUS] & 1) && (!_mouseOverride))) {
+ if ((resId == 0) || (!(Logic::_scriptVars[MOUSE_STATUS] & 1) && (!_mouseOverride))) {
_system->set_mouse_cursor(NULL, 0, 0, 0, 0);
_system->show_mouse(false);
} else {
@@ -245,14 +247,14 @@ void SwordMouse::setPointer(uint32 resId, uint32 rate) {
}
}
-void SwordMouse::setLuggage(uint32 resId, uint32 rate) {
+void Mouse::setLuggage(uint32 resId, uint32 rate) {
_currentLuggageId = resId;
_frame = 0;
createPointer(_currentPtrId, resId);
}
-void SwordMouse::animate(void) {
- if ((SwordLogic::_scriptVars[MOUSE_STATUS] == 1) || (_mouseOverride && _currentPtr)) {
+void Mouse::animate(void) {
+ if ((Logic::_scriptVars[MOUSE_STATUS] == 1) || (_mouseOverride && _currentPtr)) {
_frame = (_frame + 1) % _currentPtr->numFrames;
uint8 *ptrData = (uint8*)_currentPtr + sizeof(MousePtr);
ptrData += _frame * _currentPtr->sizeX * _currentPtr->sizeY;
@@ -260,40 +262,42 @@ void SwordMouse::animate(void) {
}
}
-void SwordMouse::fnNoHuman(void) {
- if (SwordLogic::_scriptVars[MOUSE_STATUS] & 2) // locked, can't do anything
+void Mouse::fnNoHuman(void) {
+ if (Logic::_scriptVars[MOUSE_STATUS] & 2) // locked, can't do anything
return ;
- SwordLogic::_scriptVars[MOUSE_STATUS] = 0; // off & unlocked
+ Logic::_scriptVars[MOUSE_STATUS] = 0; // off & unlocked
setLuggage(0, 0);
setPointer(0, 0);
}
-void SwordMouse::fnAddHuman(void) {
- if (SwordLogic::_scriptVars[MOUSE_STATUS] & 2) // locked, can't do anything
+void Mouse::fnAddHuman(void) {
+ if (Logic::_scriptVars[MOUSE_STATUS] & 2) // locked, can't do anything
return ;
- SwordLogic::_scriptVars[MOUSE_STATUS] = 1;
- SwordLogic::_scriptVars[SPECIAL_ITEM] = 0;
+ Logic::_scriptVars[MOUSE_STATUS] = 1;
+ Logic::_scriptVars[SPECIAL_ITEM] = 0;
_getOff = SCR_std_off;
setPointer(MSE_POINTER, 0);
}
-void SwordMouse::fnBlankMouse(void) {
+void Mouse::fnBlankMouse(void) {
setPointer(0, 0);
}
-void SwordMouse::fnNormalMouse(void) {
+void Mouse::fnNormalMouse(void) {
setPointer(MSE_POINTER, 0);
}
-void SwordMouse::fnLockMouse(void) {
- SwordLogic::_scriptVars[MOUSE_STATUS] |= 2;
+void Mouse::fnLockMouse(void) {
+ Logic::_scriptVars[MOUSE_STATUS] |= 2;
}
-void SwordMouse::fnUnlockMouse(void) {
- SwordLogic::_scriptVars[MOUSE_STATUS] &= 1;
+void Mouse::fnUnlockMouse(void) {
+ Logic::_scriptVars[MOUSE_STATUS] &= 1;
}
-void SwordMouse::giveCoords(uint16 *x, uint16 *y) {
+void Mouse::giveCoords(uint16 *x, uint16 *y) {
*x = _mouseX;
*y = _mouseY;
}
+
+} // End of namespace Sword1
diff --git a/sword1/mouse.h b/sword1/mouse.h
index 3683dfdce3..443698473e 100644
--- a/sword1/mouse.h
+++ b/sword1/mouse.h
@@ -26,6 +26,10 @@
#include "sworddefs.h"
#include "object.h"
+class OSystem;
+
+namespace Sword1 {
+
#define MAX_MOUSE 30
#define BS1L_BUTTON_DOWN 2
@@ -38,7 +42,7 @@
struct MouseObj {
int id;
- BsObject *compact;
+ Object *compact;
};
#if !defined(__GNUC__)
@@ -58,18 +62,17 @@ struct MousePtr {
#pragma END_PACK_STRUCTS
#endif
-class SwordLogic;
-class SwordMenu;
+class Logic;
+class Menu;
class ResMan;
class ObjectMan;
-class OSystem;
-class SwordMouse {
+class Mouse {
public:
- SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
+ Mouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
void initialize(void);
- void addToList(int id, BsObject *compact);
- void useLogicAndMenu(SwordLogic *pLogic, SwordMenu *pMenu);
+ void addToList(int id, Object *compact);
+ void useLogicAndMenu(Logic *pLogic, Menu *pMenu);
void setLuggage(uint32 resID, uint32 rate);
void setPointer(uint32 resID, uint32 rate);
void animate(void);
@@ -86,8 +89,8 @@ public:
private:
void createPointer(uint32 ptrId, uint32 luggageId);
OSystem *_system;
- SwordLogic *_logic;
- SwordMenu *_menu;
+ Logic *_logic;
+ Menu *_menu;
MouseObj _objList[MAX_MOUSE];
ResMan *_resMan;
ObjectMan *_objMan;
@@ -101,4 +104,6 @@ private:
bool _inTopMenu, _mouseOverride;
};
+} // End of namespace Sword1
+
#endif //BSMOUSE_H
diff --git a/sword1/music.cpp b/sword1/music.cpp
index 082583afdf..c002aed40d 100644
--- a/sword1/music.cpp
+++ b/sword1/music.cpp
@@ -25,13 +25,15 @@
#include "common/util.h"
#include "common/file.h"
+namespace Sword1 {
+
// This means fading takes 3 seconds.
#define FADE_LENGTH 3
-// These functions are only called from SwordMusic, so I'm just going to
+// These functions are only called from Music, so I'm just going to
// assume that if locking is needed it has already been taken care of.
-void SwordMusicHandle::fadeDown() {
+void MusicHandle::fadeDown() {
if (_fading < 0)
_fading = -_fading;
else if (_fading == 0)
@@ -39,7 +41,7 @@ void SwordMusicHandle::fadeDown() {
_fadeSamples = FADE_LENGTH * getRate();
}
-void SwordMusicHandle::fadeUp() {
+void MusicHandle::fadeUp() {
if (_fading > 0)
_fading = -_fading;
else if (_fading == 0)
@@ -47,11 +49,11 @@ void SwordMusicHandle::fadeUp() {
_fadeSamples = FADE_LENGTH * getRate();
}
-bool SwordMusicHandle::endOfData() const {
+bool MusicHandle::endOfData() const {
return !streaming();
}
-int SwordMusicHandle::readBuffer(int16 *buffer, const int numSamples) {
+int MusicHandle::readBuffer(int16 *buffer, const int numSamples) {
int samples;
for (samples = 0; samples < numSamples && !endOfData(); samples++) {
int16 sample = _file.readUint16LE();
@@ -80,7 +82,7 @@ int SwordMusicHandle::readBuffer(int16 *buffer, const int numSamples) {
return samples;
}
-bool SwordMusicHandle::play(const char *filename, bool loop) {
+bool MusicHandle::play(const char *filename, bool loop) {
uint8 wavHeader[WAVEHEADERSIZE];
stop();
_file.open(filename);
@@ -96,14 +98,14 @@ bool SwordMusicHandle::play(const char *filename, bool loop) {
return true;
}
-void SwordMusicHandle::stop() {
+void MusicHandle::stop() {
if (_file.isOpen())
_file.close();
_fading = 0;
_looping = false;
}
-SwordMusic::SwordMusic(OSystem *system, SoundMixer *pMixer) {
+Music::Music(OSystem *system, SoundMixer *pMixer) {
_system = system;
_mixer = pMixer;
_mixer->setupPremix(passMixerFunc, this);
@@ -113,7 +115,7 @@ SwordMusic::SwordMusic(OSystem *system, SoundMixer *pMixer) {
_volumeL = _volumeR = 192;
}
-SwordMusic::~SwordMusic() {
+Music::~Music() {
_mixer->setupPremix(0, 0);
delete _converter[0];
delete _converter[1];
@@ -121,28 +123,28 @@ SwordMusic::~SwordMusic() {
_system->delete_mutex(_mutex);
}
-void SwordMusic::passMixerFunc(void *param, int16 *buf, uint len) {
- ((SwordMusic*)param)->mixer(buf, len);
+void Music::passMixerFunc(void *param, int16 *buf, uint len) {
+ ((Music*)param)->mixer(buf, len);
}
-void SwordMusic::mixer(int16 *buf, uint32 len) {
+void Music::mixer(int16 *buf, uint32 len) {
Common::StackLock lock(_mutex);
for (int i = 0; i < ARRAYSIZE(_handles); i++)
if (_handles[i].streaming() && _converter[i])
_converter[i]->flow(_handles[i], buf, len, _volumeL, _volumeR);
}
-void SwordMusic::setVolume(uint8 volL, uint8 volR) {
+void Music::setVolume(uint8 volL, uint8 volR) {
_volumeL = (st_volume_t)volL;
_volumeR = (st_volume_t)volR;
}
-void SwordMusic::giveVolume(uint8 *volL, uint8 *volR) {
+void Music::giveVolume(uint8 *volL, uint8 *volR) {
*volL = (uint8)_volumeL;
*volR = (uint8)_volumeR;
}
-void SwordMusic::startMusic(int32 tuneId, int32 loopFlag) {
+void Music::startMusic(int32 tuneId, int32 loopFlag) {
Common::StackLock lock(_mutex);
if (strlen(_tuneList[tuneId]) > 0) {
int newStream = 0;
@@ -175,9 +177,11 @@ void SwordMusic::startMusic(int32 tuneId, int32 loopFlag) {
}
}
-void SwordMusic::fadeDown() {
+void Music::fadeDown() {
Common::StackLock lock(_mutex);
for (int i = 0; i < ARRAYSIZE(_handles); i++)
if (_handles[i].streaming())
_handles[i].fadeDown();
}
+
+} // End of namespace Sword1
diff --git a/sword1/music.h b/sword1/music.h
index c7a4fe2e30..c050da4b2b 100644
--- a/sword1/music.h
+++ b/sword1/music.h
@@ -28,13 +28,15 @@
#include "sound/audiostream.h"
#include "sound/rate.h"
+class SoundMixer;
+
+namespace Sword1 {
+
#define TOTAL_TUNES 270
#define WAVEHEADERSIZE 0x2C
-class SoundMixer;
-
-class SwordMusicHandle : public AudioStream {
+class MusicHandle : public AudioStream {
private:
File _file;
bool _looping;
@@ -43,7 +45,7 @@ private:
int _rate;
bool _stereo;
public:
- SwordMusicHandle() : _looping(false), _fading(0) {}
+ MusicHandle() : _looping(false), _fading(0) {}
virtual int readBuffer(int16 *buffer, const int numSamples);
bool play(const char *filename, bool loop);
void stop();
@@ -57,17 +59,17 @@ public:
int getRate() const { return _rate; }
};
-class SwordMusic {
+class Music {
public:
- SwordMusic(OSystem *system, SoundMixer *pMixer);
- ~SwordMusic();
+ Music(OSystem *system, SoundMixer *pMixer);
+ ~Music();
void startMusic(int32 tuneId, int32 loopFlag);
void fadeDown();
void setVolume(uint8 volL, uint8 volR);
void giveVolume(uint8 *volL, uint8 *volR);
private:
st_volume_t _volumeL, _volumeR;
- SwordMusicHandle _handles[2];
+ MusicHandle _handles[2];
RateConverter *_converter[2];
OSystem *_system;
SoundMixer *_mixer;
@@ -77,4 +79,6 @@ private:
static const char _tuneList[TOTAL_TUNES][8]; // in staticres.cpp
};
+} // End of namespace Sword1
+
#endif // BSMUSIC_H
diff --git a/sword1/object.h b/sword1/object.h
index 654d7289b6..fd7f3b8bb6 100644
--- a/sword1/object.h
+++ b/sword1/object.h
@@ -24,6 +24,8 @@
#include "scummsys.h"
+namespace Sword1 {
+
#define O_TOTAL_EVENTS 5
#define O_WALKANIM_SIZE 600 //max number of nodes in router output
#define O_GRID_SIZE 200
@@ -56,7 +58,7 @@ struct WalkData {
int32 dir;
} GCC_PACK; // size = 5*int32 = 20 bytes
-struct BsObject {
+struct Object {
int32 o_type; // 0 broad description of type - object, floor, etc.
int32 o_status; // 4 bit flags for logic, graphics, mouse, etc.
int32 o_logic; // 8 logic type
@@ -115,11 +117,13 @@ struct BsObject {
};
struct CollisionData {
- BsObject *compact;
+ Object *compact;
int32 w[24];
int32 h[24];
WalkData route[24];
};
+} // End of namespace Sword1
+
#endif //BSOBJECT_H
diff --git a/sword1/objectman.cpp b/sword1/objectman.cpp
index a5c8a453cf..aa46b2d132 100644
--- a/sword1/objectman.cpp
+++ b/sword1/objectman.cpp
@@ -27,6 +27,8 @@
#include "swordres.h"
#include "sword1.h"
+namespace Sword1 {
+
ObjectMan::ObjectMan(ResMan *pResourceMan) {
_resMan = pResourceMan;
}
@@ -117,13 +119,13 @@ uint32 ObjectMan::lastTextNumber(int section) {
return result;
}
-BsObject *ObjectMan::fetchObject(uint32 id) {
+Object *ObjectMan::fetchObject(uint32 id) {
uint8 *addr = _cptData[id / ITM_PER_SEC];
if (!addr)
error("fetchObject: section %d is not open!", id / ITM_PER_SEC);
id &= ITM_ID;
// DON'T do endian conversion here. it's already done.
- return (BsObject*)(addr + *(uint32*)(addr + (id + 1)*4));
+ return (Object*)(addr + *(uint32*)(addr + (id + 1)*4));
}
uint32 ObjectMan::fetchNoObjects(int section) {
@@ -152,3 +154,5 @@ void ObjectMan::loadLiveList(uint16 *src) {
void ObjectMan::saveLiveList(uint16 *dest) {
memcpy(dest, _liveList, TOTAL_SECTIONS * sizeof(uint16));
}
+
+} // End of namespace Sword1
diff --git a/sword1/objectman.h b/sword1/objectman.h
index 7207e99d3a..3df047d379 100644
--- a/sword1/objectman.h
+++ b/sword1/objectman.h
@@ -28,13 +28,15 @@
#include "sworddefs.h"
#include "object.h"
+namespace Sword1 {
+
class ObjectMan {
public:
ObjectMan(ResMan *pResourceMan);
~ObjectMan(void);
void initialize(void);
- BsObject *fetchObject(uint32 id);
+ Object *fetchObject(uint32 id);
uint32 fetchNoObjects(int section);
bool sectionAlive(uint16 section);
void megaEntering(uint16 section);
@@ -45,7 +47,7 @@ public:
void unlockText(uint32 textId);
uint32 lastTextNumber(int section);
- void closeSection(uint32 screen);
+ void closeSection(uint32 screen);
void saveLiveList(uint16 *dest); // for loading/saving
void loadLiveList(uint16 *src);
@@ -57,5 +59,7 @@ private:
uint8 *_cptData[TOTAL_SECTIONS];
};
+} // End of namespace Sword1
+
#endif //OBJECTMAN_H
diff --git a/sword1/resman.cpp b/sword1/resman.cpp
index a40faab659..09699305d0 100644
--- a/sword1/resman.cpp
+++ b/sword1/resman.cpp
@@ -21,8 +21,6 @@
#include "stdafx.h"
#include "scummsys.h"
-#include <stdio.h>
-#include <stdlib.h>
#include "memman.h"
#include "resman.h"
#include "sworddefs.h"
@@ -30,6 +28,8 @@
#include "common/util.h"
#include "swordres.h"
+namespace Sword1 {
+
#define MAX_PATH_LEN 260
ResMan::ResMan(const char *resFile, MemMan *pMemoMan) {
@@ -48,27 +48,27 @@ void ResMan::loadCluDescript(const char *fileName) {
error("ResMan::loadCluDescript(): File %s not found!", fileName);
_prj.noClu = resFile.readUint32LE();
- _prj.clu = new BsClu*[_prj.noClu];
+ _prj.clu = new Clu*[_prj.noClu];
uint32 *cluIndex = (uint32*)malloc(_prj.noClu * 4);
resFile.read(cluIndex, _prj.noClu * 4);
for (uint32 clusCnt = 0; clusCnt < _prj.noClu; clusCnt++)
if (cluIndex[clusCnt]) {
- BsClu *cluster = _prj.clu[clusCnt] = new BsClu;
+ Clu *cluster = _prj.clu[clusCnt] = new Clu;
resFile.read(cluster->label, MAX_LABEL_SIZE);
cluster->noGrp = resFile.readUint32LE();
- cluster->grp = new BsGrp*[cluster->noGrp];
+ cluster->grp = new Grp*[cluster->noGrp];
uint32 *grpIndex = (uint32*)malloc(cluster->noGrp * 4);
resFile.read(grpIndex, cluster->noGrp * 4);
for (uint32 grpCnt = 0; grpCnt < cluster->noGrp; grpCnt++)
if (grpIndex[grpCnt]) {
- BsGrp *group = cluster->grp[grpCnt] = new BsGrp;
+ Grp *group = cluster->grp[grpCnt] = new Grp;
group->noRes = resFile.readUint32LE();
- group->resHandle = new BsMemHandle[group->noRes];
+ group->resHandle = new MemHandle[group->noRes];
group->offset = new uint32[group->noRes];
group->length = new uint32[group->noRes];
uint32 *resIdIdx = (uint32*)malloc(group->noRes * 4);
@@ -101,9 +101,9 @@ void ResMan::loadCluDescript(const char *fileName) {
void ResMan::freeCluDescript(void) {
for (uint32 clusCnt = 0; clusCnt < _prj.noClu; clusCnt++)
- if (BsClu *cluster = _prj.clu[clusCnt]) {
+ if (Clu *cluster = _prj.clu[clusCnt]) {
for (uint32 grpCnt = 0; grpCnt < cluster->noGrp; grpCnt++)
- if (BsGrp *group = cluster->grp[grpCnt]) {
+ if (Grp *group = cluster->grp[grpCnt]) {
for (uint32 resCnt = 0; resCnt < group->noRes; resCnt++)
_memMan->freeNow(group->resHandle + resCnt);
delete[] group->resHandle;
@@ -119,9 +119,9 @@ void ResMan::freeCluDescript(void) {
void ResMan::flush(void) {
for (uint32 clusCnt = 0; clusCnt < _prj.noClu; clusCnt++)
- if (BsClu *cluster = _prj.clu[clusCnt])
+ if (Clu *cluster = _prj.clu[clusCnt])
for (uint32 grpCnt = 0; grpCnt < cluster->noGrp; grpCnt++)
- if (BsGrp *group = cluster->grp[grpCnt])
+ if (Grp *group = cluster->grp[grpCnt])
for (uint32 resCnt = 0; resCnt < group->noRes; resCnt++)
if (group->resHandle[resCnt].cond != MEM_FREED) {
_memMan->setCondition(group->resHandle + resCnt, MEM_CAN_FREE);
@@ -130,7 +130,7 @@ void ResMan::flush(void) {
}
void *ResMan::fetchRes(uint32 id) {
- BsMemHandle *memHandle = resHandle(id);
+ MemHandle *memHandle = resHandle(id);
if (!memHandle->data)
error("fetchRes:: resource %d is not open!", id);
return memHandle->data;
@@ -146,7 +146,7 @@ void ResMan::dumpRes(uint32 id) {
sprintf(outn, "DUMP%08X.BIN", id);
FILE *outf = fopen( outn, "wb");
resOpen(id);
- BsMemHandle *memHandle = resHandle(id);
+ MemHandle *memHandle = resHandle(id);
fwrite(memHandle->data, 1, memHandle->size, outf);
fclose(outf);
resClose(id);
@@ -157,7 +157,7 @@ Header *ResMan::lockScript(uint32 scrID) {
error("Script id %d not found.\n", scrID);
scrID = _scriptList[scrID / ITM_PER_SEC];
#ifdef SCUMM_BIG_ENDIAN
- BsMemHandle *memHandle = resHandle(scrID);
+ MemHandle *memHandle = resHandle(scrID);
if (memHandle->cond == MEM_FREED)
openScriptResourceBigEndian(scrID);
else
@@ -174,7 +174,7 @@ void ResMan::unlockScript(uint32 scrID) {
void *ResMan::cptResOpen(uint32 id) {
#ifdef SCUMM_BIG_ENDIAN
- BsMemHandle *memHandle = resHandle(id);
+ MemHandle *memHandle = resHandle(id);
if (memHandle->cond == MEM_FREED)
openCptResourceBigEndian(id);
else
@@ -186,7 +186,7 @@ void *ResMan::cptResOpen(uint32 id) {
}
void ResMan::resOpen(uint32 id) { // load resource ID into memory
- BsMemHandle *memHandle = resHandle(id);
+ MemHandle *memHandle = resHandle(id);
if (memHandle->cond == MEM_FREED) { // memory has been freed
uint32 size = resLength(id);
_memMan->alloc(memHandle, size);
@@ -206,7 +206,7 @@ void ResMan::resOpen(uint32 id) { // load resource ID into memory
}
void ResMan::resClose(uint32 id) {
- BsMemHandle *handle = resHandle(id);
+ MemHandle *handle = resHandle(id);
if (!handle->refCount) {
warning("Resource Manager fail: unlocking object with refCount 0. Id: %d\n", id);
} else {
@@ -235,7 +235,7 @@ File *ResMan::openClusterFile(uint32 id) {
return clusFile;
}
-BsMemHandle *ResMan::resHandle(uint32 id) {
+MemHandle *ResMan::resHandle(uint32 id) {
if ((id >> 16) == 0x0405)
id = _srIdList[id & 0xFFFF];
uint8 cluster = (uint8)((id >> 24) - 1);
@@ -264,7 +264,7 @@ uint32 ResMan::resOffset(uint32 id) {
void ResMan::openCptResourceBigEndian(uint32 id) {
resOpen(id);
- BsMemHandle *handle = resHandle(id);
+ MemHandle *handle = resHandle(id);
uint32 totSize = handle->size;
uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
totSize -= sizeof(Header);
@@ -279,7 +279,7 @@ void ResMan::openCptResourceBigEndian(uint32 id) {
void ResMan::openScriptResourceBigEndian(uint32 id) {
resOpen(id);
- BsMemHandle *handle = resHandle(id);
+ MemHandle *handle = resHandle(id);
// uint32 totSize = handle->size;
Header *head = (Header*)handle->data;
head->comp_length = FROM_LE_32(head->comp_length);
@@ -327,3 +327,5 @@ uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control pane
0x04050019, // SR_DEATHPANEL
0,
};
+
+} // End of namespace Sword1
diff --git a/sword1/resman.h b/sword1/resman.h
index 1a8c0fbc5b..44ddbd1dd1 100644
--- a/sword1/resman.h
+++ b/sword1/resman.h
@@ -26,24 +26,26 @@
#include "file.h"
#include "sworddefs.h"
+namespace Sword1 {
+
#define MAX_LABEL_SIZE (31+1)
-struct BsGrp {
+struct Grp {
uint32 noRes;
- BsMemHandle *resHandle;
+ MemHandle *resHandle;
uint32 *offset;
uint32 *length;
};
-struct BsClu {
+struct Clu {
char label[MAX_LABEL_SIZE];
uint32 noGrp;
- BsGrp **grp;
+ Grp **grp;
};
-struct BsPrj {
+struct Prj {
uint32 noClu;
- BsClu **clu;
+ Clu **clu;
};
class ResMan {
@@ -63,7 +65,7 @@ public:
private:
uint32 filesInGroup(uint32 id);
uint32 resLength(uint32 id);
- BsMemHandle *resHandle(uint32 id);
+ MemHandle *resHandle(uint32 id);
uint32 resOffset(uint32 id);
void openCptResourceBigEndian(uint32 id);
void openScriptResourceBigEndian(uint32 id);
@@ -71,10 +73,12 @@ private:
File *openClusterFile(uint32 id);
void loadCluDescript(const char *fileName);
void freeCluDescript(void);
- BsPrj _prj;
+ Prj _prj;
MemMan *_memMan;
static const uint32 _scriptList[TOTAL_SECTIONS]; //a table of resource tags
static uint32 _srIdList[29];
};
+} // End of namespace Sword1
+
#endif //RESMAN_H
diff --git a/sword1/router.cpp b/sword1/router.cpp
index 3e5bbfe9ea..82d3fdcd49 100644
--- a/sword1/router.cpp
+++ b/sword1/router.cpp
@@ -28,6 +28,8 @@
#include "objectman.h"
#include "resman.h"
+namespace Sword1 {
+
/****************************************************************************
* JROUTER.C polygon router with modular walks
* using a tree of modules
@@ -61,37 +63,6 @@
*
****************************************************************************/
-
-
-
-/*
- * Include Files
- */
-
-/*#include <stdio.h>
-#include <conio.h>
-#include <stdlib.h>
-#include <io.h>
-#include <dos.h>
-#include <string.h>
-
-#include "coredata.h"
-#include "utypes.h"
-#include "header.h"
-#include "object.h"
-#include "varnames.h"
-#include "jrouter.h"
-#include "svga.h"
-#include "protocol.h"
-#include "memman.h"
-#include "resman.h"
-#include "tdebug.h"
-#include "blit.h"
-#include "line.h"
-#include "pc.h"
-#include "vblank.h"*/
-
-//#define MAX_FRAMES_PER_CHAR 128
#define NO_DIRECTIONS 8
#define SLOW_IN 3
#define SLOW_OUT 7
@@ -99,7 +70,7 @@
//#define PLOT_PATHS 1
#undef PLOT_PATHS
-SwordRouter::SwordRouter(ObjectMan *pObjMan, ResMan *pResMan) {
+Router::Router(ObjectMan *pObjMan, ResMan *pResMan) {
_objMan = pObjMan;
_resMan = pResMan;
_numExtraBars = _numExtraNodes = 0;
@@ -109,20 +80,10 @@ SwordRouter::SwordRouter(ObjectMan *pObjMan, ResMan *pResMan) {
}
/*
- *
- */
-
-/*
* CODE
*/
-// **************************************************************************
-// **************************************************************************
-// **************************************************************************
-// **************************************************************************
-// **************************************************************************
-
-int32 SwordRouter::routeFinder(int32 id, BsObject *megaObject, int32 x, int32 y, int32 dir)
+int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32 dir)
{
/****************************************************************************
* RouteFinder.C polygon router with modular walks
@@ -242,14 +203,11 @@ int32 SwordRouter::routeFinder(int32 id, BsObject *megaObject, int32 x, int32 y,
return routeFlag; // send back null route
}
-/*******************************************************************************
- *******************************************************************************
- * GET A ROUTE
- *******************************************************************************
- *******************************************************************************/
+// ****************************************************************************
+// * GET A ROUTE
+// ****************************************************************************
-
-int32 SwordRouter::GetRoute()
+int32 Router::GetRoute()
{
/****************************************************************************
* GetRoute.C extract a path from walk grid
@@ -303,15 +261,11 @@ int32 SwordRouter::GetRoute()
return routeGot;
}
+// ****************************************************************************
+// * THE SLIDY PATH ROUTINES
+// ****************************************************************************
-/*******************************************************************************
- *******************************************************************************
- * THE SLIDY PATH ROUTINES
- *******************************************************************************
- *******************************************************************************/
-
-
-int32 SwordRouter::SmoothestPath()
+int32 Router::SmoothestPath()
{
/*
* This is the second big part of the route finder and the the only bit that tries to be clever
@@ -506,7 +460,7 @@ int32 SwordRouter::SmoothestPath()
-int32 SwordRouter::SmoothCheck(int32 best, int32 p, int32 dirS, int32 dirD)
+int32 Router::SmoothCheck(int32 best, int32 p, int32 dirS, int32 dirD)
/****************************************************************************
* Slip sliding away
* This path checker checks to see if a walk that exactly follows the path
@@ -667,7 +621,7 @@ int32 SwordRouter::SmoothCheck(int32 best, int32 p, int32 dirS, int32 dirD)
return tempK;
}
-int32 SwordRouter::SlidyPath()
+int32 Router::SlidyPath()
{
/****************************************************************************
* SlidyPath creates a path based on part steps with no sliding to get
@@ -734,7 +688,7 @@ int32 SwordRouter::SlidyPath()
}
-void SwordRouter::SlidyWalkAnimator(WalkData *walkAnim)
+void Router::SlidyWalkAnimator(WalkData *walkAnim)
/****************************************************************************
* Skidding every where HardWalk creates an animation that exactly fits the
* smoothPath and uses foot slipping to fit whole steps into the route
@@ -1143,14 +1097,11 @@ void SwordRouter::SlidyWalkAnimator(WalkData *walkAnim)
return;
}
+// ****************************************************************************
+// * THE SOLID PATH ROUTINES
+// ****************************************************************************
-/*******************************************************************************
- *******************************************************************************
- * THE SOLID PATH ROUTINES
- *******************************************************************************
- *******************************************************************************/
-
-int32 SwordRouter::SolidPath()
+int32 Router::SolidPath()
{
/****************************************************************************
* SolidPath creates a path based on whole steps with no sliding to get
@@ -1216,7 +1167,7 @@ int32 SwordRouter::SolidPath()
}
-int32 SwordRouter::SolidWalkAnimator(WalkData *walkAnim)
+int32 Router::SolidWalkAnimator(WalkData *walkAnim)
{
/****************************************************************************
* SolidWalk creates an animation based on whole steps with no sliding to get
@@ -1631,25 +1582,21 @@ int32 SwordRouter::SolidWalkAnimator(WalkData *walkAnim)
return p;
}
+// ****************************************************************************
+// * THE SCAN ROUTINES
+// ****************************************************************************
-/*******************************************************************************
- *******************************************************************************
- * THE SCAN ROUTINES
- *******************************************************************************
- *******************************************************************************/
-
-int32 SwordRouter::Scan(int32 level)
-/*******************************************************************************
+int32 Router::Scan(int32 level)
+/******************************************************************************
* Called successively from RouteFinder until no more changes take place in the
* grid array ie he best path has been found
*
* Scans through every point in the node array and checks if there is a route
* between each point and if this route gives a new route.
*
- * This routine could probably halve its processing time if it doubled up on the
- * checks after each route check
- *
- *******************************************************************************/
+ * This routine could probably halve its processing time if it doubled up on
+ * the checks after each route check
+ *****************************************************************************/
{
int32 i;
int32 k;
@@ -1708,8 +1655,8 @@ int32 SwordRouter::Scan(int32 level)
}
-int32 SwordRouter::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
-/*******************************************************************************
+int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
+/******************************************************************************
* NewCheck routine checks if the route between two points can be achieved
* without crossing any of the bars in the Bars array.
*
@@ -1719,7 +1666,7 @@ int32 SwordRouter::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32
* Note distance doesnt take account of shrinking ???
*
* Note Bars array must be properly calculated ie min max dx dy co
- *******************************************************************************/
+ *****************************************************************************/
{
int32 dx;
int32 dy;
@@ -1989,15 +1936,11 @@ int32 SwordRouter::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32
return status;
}
+// ****************************************************************************
+// * CHECK ROUTINES
+// ****************************************************************************
-/*******************************************************************************
- *******************************************************************************
- * CHECK ROUTINES
- *******************************************************************************
- *******************************************************************************/
-
-
-int32 SwordRouter::Check(int32 x1 , int32 y1 , int32 x2 ,int32 y2)
+int32 Router::Check(int32 x1 , int32 y1 , int32 x2 ,int32 y2)
{
//call the fastest line check for the given line
//returns 1 if line didn't cross any bars
@@ -2024,7 +1967,7 @@ int32 SwordRouter::Check(int32 x1 , int32 y1 , int32 x2 ,int32 y2)
}
-int32 SwordRouter::LineCheck(int32 x1 , int32 y1 , int32 x2 ,int32 y2)
+int32 Router::LineCheck(int32 x1 , int32 y1 , int32 x2 ,int32 y2)
{
int32 dirx;
int32 diry;
@@ -2108,8 +2051,7 @@ int32 SwordRouter::LineCheck(int32 x1 , int32 y1 , int32 x2 ,int32 y2)
return linesCrossed;
}
-
-int32 SwordRouter::HorizCheck(int32 x1 , int32 y , int32 x2)
+int32 Router::HorizCheck(int32 x1 , int32 y , int32 x2)
{
int32 dy;
int32 i;
@@ -2164,7 +2106,7 @@ int32 SwordRouter::HorizCheck(int32 x1 , int32 y , int32 x2)
}
-int32 SwordRouter::VertCheck(int32 x, int32 y1, int32 y2)
+int32 Router::VertCheck(int32 x, int32 y1, int32 y2)
{
int32 dx;
int32 i;
@@ -2216,9 +2158,7 @@ int32 SwordRouter::VertCheck(int32 x, int32 y1, int32 y2)
return linesCrossed;
}
-int32 SwordRouter::CheckTarget(int32 x , int32 y)
-/*******************************************************************************
- *******************************************************************************/
+int32 Router::CheckTarget(int32 x , int32 y)
{
int32 dx;
int32 dy;
@@ -2294,15 +2234,11 @@ int32 SwordRouter::CheckTarget(int32 x , int32 y)
return onLine;
}
-/*******************************************************************************
- *******************************************************************************
- * THE SETUP ROUTINES
- *******************************************************************************
- *******************************************************************************/
-
+// ****************************************************************************
+// * THE SETUP ROUTINES
+// ****************************************************************************
-
-int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int32 dir)
+int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
{
WalkGridHeader floorHeader;
int32 i;
@@ -2312,16 +2248,13 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
int32 floorId;
int32 walkGridResourceId;
- BsObject *floorObject;
+ Object *floorObject;
int32 cnt;
uint32 cntu;
-
-
// load in floor grid for current mega
-
floorId = megaObject->o_place;
//floorObject = (object *) Lock_object(floorId);
@@ -2415,7 +2348,6 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
nnodes += _numExtraNodes;
}
-
// copy the mega structure into the local variables for use in all subroutines
startX = megaObject->o_xcoord;
@@ -2471,7 +2403,6 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
// mega data ready
-
// finish setting grid by putting mega node at begining
// and target node at end and reset current values
node[0].x = startX;
@@ -2497,14 +2428,11 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
return 1;
}
+// ****************************************************************************
+// * THE ROUTE EXTRACTOR
+// ****************************************************************************
-/*******************************************************************************
- *******************************************************************************
- * THE ROUTE EXTRACTOR
- *******************************************************************************
- *******************************************************************************/
-
-void SwordRouter::ExtractRoute()
+void Router::ExtractRoute()
/****************************************************************************
* ExtractRoute gets route from the node data after a full scan, route is
* written with just the basic way points and direction options for heading
@@ -2611,13 +2539,13 @@ void SwordRouter::ExtractRoute()
#define screen_ad NULL
#define pixel_size_y 1
#define true_pixel_size_x 1
-void SwordRouter::RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour)
+void Router::RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour)
{
BresenhamLine(x1-128, y1-128, x2-128, y2-128, (uint8*)screen_ad, true_pixel_size_x, pixel_size_y, colour);
return;
}
-void SwordRouter::BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *screen, int32 width, int32 height, int32 colour) {
+void Router::BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *screen, int32 width, int32 height, int32 colour) {
}
@@ -2663,13 +2591,15 @@ int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
return tar_dir;
}
-void SwordRouter::resetExtraData(void) {
+void Router::resetExtraData(void) {
_numExtraBars = _numExtraNodes = 0;
}
-void SwordRouter::setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance) {
+void Router::setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance) {
_playerTargetX = x;
_playerTargetY = y;
_playerTargetDir = dir;
_playerTargetStance = stance;
}
+
+} // End of namespace Sword1
diff --git a/sword1/router.h b/sword1/router.h
index eb62e2dafb..d4c89bf2fe 100644
--- a/sword1/router.h
+++ b/sword1/router.h
@@ -25,6 +25,8 @@
#include "scummsys.h"
#include "object.h"
+namespace Sword1 {
+
#define EXTRA_GRID_SIZE 20
#define O_GRID_SIZE 200
@@ -87,19 +89,19 @@ struct PathData {
class ObjectMan;
class ResMan;
-class SwordScreen;
+class Screen;
extern int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY);
-class SwordRouter {
+class Router {
public:
- SwordRouter(ObjectMan *pObjMan, ResMan *pResMan);
- ~SwordRouter(void);
- int32 routeFinder(int32 id, BsObject *mega, int32 x, int32 y, int32 dir);
+ Router(ObjectMan *pObjMan, ResMan *pResMan);
+ ~Router(void);
+ int32 routeFinder(int32 id, Object *mega, int32 x, int32 y, int32 dir);
void setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance);
void resetExtraData(void);
- // these should be private but are read by SwordScreen for debugging:
+ // these should be private but are read by Screen for debugging:
BarData bars[O_GRID_SIZE+EXTRA_GRID_SIZE];
NodeData node[O_GRID_SIZE+EXTRA_GRID_SIZE];
int32 nbars, nnodes;
@@ -148,7 +150,7 @@ private:
int32 slowInFrames, slowOutFrames;
- int32 LoadWalkResources(BsObject *mega, int32 x, int32 y, int32 targetDir);
+ int32 LoadWalkResources(Object *mega, int32 x, int32 y, int32 targetDir);
int32 GetRoute(void);
int32 CheckTarget(int32 x, int32 y);
@@ -173,4 +175,6 @@ private:
void BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *screen, int32 width, int32 height, int32 colour);
};
+} // End of namespace Sword1
+
#endif //BSROUTER_H
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index 5496744919..400aa6a9c6 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -32,12 +32,14 @@
#include "menu.h"
#include "sword1.h"
+namespace Sword1 {
+
#define SCROLL_FRACTION 16
#define MAX_SCROLL_DISTANCE 8
#define FADE_UP 1
#define FADE_DOWN -1
-SwordScreen::SwordScreen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
+Screen::Screen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
_system = system;
_resMan = pResMan;
_objMan = pObjMan;
@@ -46,51 +48,51 @@ SwordScreen::SwordScreen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
_fadingStep = 0;
}
-void SwordScreen::useTextManager(SwordText *pTextMan) {
+void Screen::useTextManager(Text *pTextMan) {
_textMan = pTextMan;
}
-int32 SwordScreen::inRange(int32 a, int32 b, int32 c) { // return b(!) so that: a <= b <= c
+int32 Screen::inRange(int32 a, int32 b, int32 c) { // return b(!) so that: a <= b <= c
return (a > b) ? (a) : ((b < c) ? b : c);
}
-void SwordScreen::setScrolling(int16 offsetX, int16 offsetY) {
- if (!SwordLogic::_scriptVars[SCROLL_FLAG])
+void Screen::setScrolling(int16 offsetX, int16 offsetY) {
+ if (!Logic::_scriptVars[SCROLL_FLAG])
return ; // screen is smaller than 640x400 => no need for scrolling
- offsetX = inRange(0, offsetX, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X]);
- offsetY = inRange(0, offsetY, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
+ offsetX = inRange(0, offsetX, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
+ offsetY = inRange(0, offsetY, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
- if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) { // first time on this screen - need absolute scroll immediately!
- _oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X] = (uint32)offsetX;
- _oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y] = (uint32)offsetY;
- SwordLogic::_scriptVars[SCROLL_FLAG] = 1;
+ if (Logic::_scriptVars[SCROLL_FLAG] == 2) { // first time on this screen - need absolute scroll immediately!
+ _oldScrollX = Logic::_scriptVars[SCROLL_OFFSET_X] = (uint32)offsetX;
+ _oldScrollY = Logic::_scriptVars[SCROLL_OFFSET_Y] = (uint32)offsetY;
+ Logic::_scriptVars[SCROLL_FLAG] = 1;
_fullRefresh = true;
- } else if (SwordLogic::_scriptVars[SCROLL_FLAG] == 1) {
- _oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X];
- _oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y];
+ } else if (Logic::_scriptVars[SCROLL_FLAG] == 1) {
+ _oldScrollX = Logic::_scriptVars[SCROLL_OFFSET_X];
+ _oldScrollY = Logic::_scriptVars[SCROLL_OFFSET_Y];
int32 distX = inRange(-MAX_SCROLL_DISTANCE, _oldScrollX - offsetX, MAX_SCROLL_DISTANCE);
int32 distY = inRange(-MAX_SCROLL_DISTANCE, _oldScrollY - offsetY, MAX_SCROLL_DISTANCE);
if ((distX != 0) || (distY != 0))
_fullRefresh = true;
- SwordLogic::_scriptVars[SCROLL_OFFSET_X] -= distX;
- SwordLogic::_scriptVars[SCROLL_OFFSET_Y] -= distY;
+ Logic::_scriptVars[SCROLL_OFFSET_X] -= distX;
+ Logic::_scriptVars[SCROLL_OFFSET_Y] -= distY;
}
}
-void SwordScreen::fadeDownPalette(void) {
+void Screen::fadeDownPalette(void) {
if (!_isBlack) { // don't fade down twice
_fadingStep = 15;
_fadingDirection = FADE_DOWN;
}
}
-void SwordScreen::fadeUpPalette(void) {
+void Screen::fadeUpPalette(void) {
_fadingStep = 1;
_fadingDirection = FADE_UP;
}
-void SwordScreen::fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp) {
+void Screen::fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp) {
uint8 *palData = (uint8*)_resMan->openFetchRes(id);
if (start == 0) // force color 0 to black
palData[0] = palData[1] = palData[2] = 0;
@@ -110,45 +112,45 @@ void SwordScreen::fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeU
_system->set_palette(_targetPalette + 4 * start, start, length);
}
-void SwordScreen::fullRefresh(void) {
+void Screen::fullRefresh(void) {
_fullRefresh = true;
_system->set_palette(_targetPalette, 0, 256);
}
-bool SwordScreen::stillFading(void) {
+bool Screen::stillFading(void) {
return (_fadingStep != 0);
}
-bool SwordScreen::showScrollFrame(void) {
- if ((!_fullRefresh) || SwordLogic::_scriptVars[NEW_PALETTE] || (!SwordLogic::_scriptVars[SCROLL_FLAG]))
+bool Screen::showScrollFrame(void) {
+ if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE] || (!Logic::_scriptVars[SCROLL_FLAG]))
return false; // don't draw an additional frame if we aren't scrolling or have to change the palette
- if ((_oldScrollX == SwordLogic::_scriptVars[SCROLL_OFFSET_X]) &&
- (_oldScrollY == SwordLogic::_scriptVars[SCROLL_OFFSET_Y]))
+ if ((_oldScrollX == Logic::_scriptVars[SCROLL_OFFSET_X]) &&
+ (_oldScrollY == Logic::_scriptVars[SCROLL_OFFSET_Y]))
return false; // check again if we *really* are scrolling.
- uint16 avgScrlX = (uint16)(_oldScrollX + SwordLogic::_scriptVars[SCROLL_OFFSET_X]) / 2;
- uint16 avgScrlY = (uint16)(_oldScrollY + SwordLogic::_scriptVars[SCROLL_OFFSET_Y]) / 2;
+ uint16 avgScrlX = (uint16)(_oldScrollX + Logic::_scriptVars[SCROLL_OFFSET_X]) / 2;
+ uint16 avgScrlY = (uint16)(_oldScrollY + Logic::_scriptVars[SCROLL_OFFSET_Y]) / 2;
_system->copy_rect(_screenBuf + avgScrlY * _scrnSizeX + avgScrlX, _scrnSizeX, 0, 40, SCREEN_WIDTH, SCREEN_DEPTH);
_system->update_screen();
return true;
}
-void SwordScreen::updateScreen(void) {
- if (SwordLogic::_scriptVars[NEW_PALETTE]) {
+void Screen::updateScreen(void) {
+ if (Logic::_scriptVars[NEW_PALETTE]) {
_fadingStep = 1;
_fadingDirection = FADE_UP;
fnSetPalette(0, 184, _roomDefTable[_currentScreen].palettes[0], true);
fnSetPalette(184, 72, _roomDefTable[_currentScreen].palettes[1], true);
- SwordLogic::_scriptVars[NEW_PALETTE] = 0;
+ Logic::_scriptVars[NEW_PALETTE] = 0;
}
if (_fadingStep) {
fadePalette();
_system->set_palette(_currentPalette, 0, 256);
}
- uint16 scrlX = (uint16)SwordLogic::_scriptVars[SCROLL_OFFSET_X];
- uint16 scrlY = (uint16)SwordLogic::_scriptVars[SCROLL_OFFSET_Y];
+ uint16 scrlX = (uint16)Logic::_scriptVars[SCROLL_OFFSET_X];
+ uint16 scrlY = (uint16)Logic::_scriptVars[SCROLL_OFFSET_Y];
if (_fullRefresh) {
_fullRefresh = false;
uint16 copyWidth = SCREEN_WIDTH;
@@ -241,7 +243,7 @@ void SwordScreen::updateScreen(void) {
_system->update_screen();
}
-void SwordScreen::newScreen(uint32 screen) {
+void Screen::newScreen(uint32 screen) {
uint8 cnt;
// set sizes and scrolling, initialize/load screengrid, force screen refresh
_currentScreen = screen;
@@ -252,15 +254,15 @@ void SwordScreen::newScreen(uint32 screen) {
if ((_scrnSizeX % SCRNGRID_X) || (_scrnSizeY % SCRNGRID_Y))
error("Illegal screensize: %d: %d/%d", screen, _scrnSizeX, _scrnSizeY);
if ((_scrnSizeX > SCREEN_WIDTH) || (_scrnSizeY > SCREEN_DEPTH)) {
- SwordLogic::_scriptVars[SCROLL_FLAG] = 2;
- SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X] = _scrnSizeX - SCREEN_WIDTH;
- SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y] = _scrnSizeY - SCREEN_DEPTH;
+ Logic::_scriptVars[SCROLL_FLAG] = 2;
+ Logic::_scriptVars[MAX_SCROLL_OFFSET_X] = _scrnSizeX - SCREEN_WIDTH;
+ Logic::_scriptVars[MAX_SCROLL_OFFSET_Y] = _scrnSizeY - SCREEN_DEPTH;
} else {
- SwordLogic::_scriptVars[SCROLL_FLAG] = 0;
- SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X] = 0;
- SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y] = 0;
- SwordLogic::_scriptVars[SCROLL_OFFSET_X] = 0;
- SwordLogic::_scriptVars[SCROLL_OFFSET_Y] = 0;
+ Logic::_scriptVars[SCROLL_FLAG] = 0;
+ Logic::_scriptVars[MAX_SCROLL_OFFSET_X] = 0;
+ Logic::_scriptVars[MAX_SCROLL_OFFSET_Y] = 0;
+ Logic::_scriptVars[SCROLL_OFFSET_X] = 0;
+ Logic::_scriptVars[SCROLL_OFFSET_Y] = 0;
}
_screenBuf = (uint8*)malloc(_scrnSizeX * _scrnSizeY);
_screenGrid = (uint8*)malloc(_gridSizeX * _gridSizeY);
@@ -287,7 +289,7 @@ void SwordScreen::newScreen(uint32 screen) {
_fullRefresh = true;
}
-void SwordScreen::quitScreen(void) {
+void Screen::quitScreen(void) {
uint8 cnt;
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++)
_resMan->resClose(_roomDefTable[_currentScreen].layers[cnt]);
@@ -299,7 +301,7 @@ void SwordScreen::quitScreen(void) {
_resMan->resClose(_roomDefTable[_currentScreen].parallax[1]);
}
-void SwordScreen::draw(void) {
+void Screen::draw(void) {
uint8 cnt;
if (_currentScreen == 54) {
// rm54 has a BACKGROUND parallax layer in parallax[0]
@@ -339,8 +341,8 @@ void SwordScreen::draw(void) {
_backLength = _sortLength = _foreLength = 0;
}
-void SwordScreen::processImage(uint32 id) {
- BsObject *compact;
+void Screen::processImage(uint32 id) {
+ Object *compact;
FrameHeader *frameHead;
int scale;
@@ -419,7 +421,7 @@ void SwordScreen::processImage(uint32 id) {
free(tonyBuf);
}
-void SwordScreen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight) {
+void Screen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight) {
if (_roomDefTable[_currentScreen].totalLayers <= 1)
return;
@@ -457,7 +459,7 @@ void SwordScreen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight
}
}
-void SwordScreen::blitBlockClear(uint16 x, uint16 y, uint8 *data) {
+void Screen::blitBlockClear(uint16 x, uint16 y, uint8 *data) {
uint8 *dest = _screenBuf + (y * SCRNGRID_Y) * _scrnSizeX + (x * SCRNGRID_X);
for (uint8 cnty = 0; cnty < SCRNGRID_Y; cnty++) {
for (uint8 cntx = 0; cntx < SCRNGRID_X; cntx++)
@@ -468,7 +470,7 @@ void SwordScreen::blitBlockClear(uint16 x, uint16 y, uint8 *data) {
}
}
-void SwordScreen::renderParallax(uint8 *data) {
+void Screen::renderParallax(uint8 *data) {
ParallaxHeader *header = (ParallaxHeader*)data;
uint32 *lineIndexes = (uint32*)(data + sizeof(ParallaxHeader));
assert((FROM_LE_16(header->sizeX) >= SCREEN_WIDTH) && (FROM_LE_16(header->sizeY) >= SCREEN_DEPTH));
@@ -479,10 +481,10 @@ void SwordScreen::renderParallax(uint8 *data) {
uint16 scrnWidth, scrnHeight;
// we have to render more than the visible screen part for displaying scroll frames
- scrnScrlX = MIN((uint32)_oldScrollX, SwordLogic::_scriptVars[SCROLL_OFFSET_X]);
- scrnWidth = SCREEN_WIDTH + ABS((int32)_oldScrollX - (int32)SwordLogic::_scriptVars[SCROLL_OFFSET_X]);
- scrnScrlY = MIN((uint32)_oldScrollY, SwordLogic::_scriptVars[SCROLL_OFFSET_Y]);
- scrnHeight = SCREEN_DEPTH + ABS((int32)_oldScrollY - (int32)SwordLogic::_scriptVars[SCROLL_OFFSET_Y]);
+ scrnScrlX = MIN((uint32)_oldScrollX, Logic::_scriptVars[SCROLL_OFFSET_X]);
+ scrnWidth = SCREEN_WIDTH + ABS((int32)_oldScrollX - (int32)Logic::_scriptVars[SCROLL_OFFSET_X]);
+ scrnScrlY = MIN((uint32)_oldScrollY, Logic::_scriptVars[SCROLL_OFFSET_Y]);
+ scrnHeight = SCREEN_DEPTH + ABS((int32)_oldScrollY - (int32)Logic::_scriptVars[SCROLL_OFFSET_Y]);
if (_scrnSizeX != SCREEN_WIDTH) {
double scrlfx = (FROM_LE_16(header->sizeX) - SCREEN_WIDTH) / ((double)(_scrnSizeX - SCREEN_WIDTH));
@@ -549,7 +551,7 @@ void SwordScreen::renderParallax(uint8 *data) {
}
}
-void SwordScreen::drawSprite(uint8 *sprData, uint16 sprX, uint16 sprY, uint16 sprWidth, uint16 sprHeight, uint16 sprPitch) {
+void Screen::drawSprite(uint8 *sprData, uint16 sprX, uint16 sprY, uint16 sprWidth, uint16 sprHeight, uint16 sprPitch) {
uint8 *dest = _screenBuf + (sprY * _scrnSizeX) + sprX;
for (uint16 cnty = 0; cnty < sprHeight; cnty++) {
for (uint16 cntx = 0; cntx < sprWidth; cntx++)
@@ -561,7 +563,7 @@ void SwordScreen::drawSprite(uint8 *sprData, uint16 sprX, uint16 sprY, uint16 sp
}
// nearest neighbor filter:
-void SwordScreen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 scale, uint8 *dest) {
+void Screen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 scale, uint8 *dest) {
uint32 resHeight = (height * scale) >> 8;
uint32 resWidth = (width * scale) >> 8;
uint32 step = 0x10000 / scale;
@@ -600,14 +602,14 @@ void SwordScreen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 sca
}
}
-void SwordScreen::addToGraphicList(uint8 listId, uint32 objId) {
+void Screen::addToGraphicList(uint8 listId, uint32 objId) {
if (listId == 0) {
_foreList[_foreLength++] = objId;
if (_foreLength > MAX_FORE)
error("foreList exceeded!");
}
if (listId == 1) {
- BsObject *cpt = _objMan->fetchObject(objId);
+ Object *cpt = _objMan->fetchObject(objId);
_sortList[_sortLength].id = objId;
_sortList[_sortLength].y = cpt->o_anim_y; // gives feet coords if boxed mega, otherwise top of sprite box
if (!(cpt->o_status & STAT_SHRINK)) { // not a boxed mega using shrinking
@@ -627,7 +629,7 @@ void SwordScreen::addToGraphicList(uint8 listId, uint32 objId) {
}
}
-void SwordScreen::decompressTony(uint8 *src, uint32 compSize, uint8 *dest) {
+void Screen::decompressTony(uint8 *src, uint32 compSize, uint8 *dest) {
uint8 *endOfData = src + compSize;
while (src < endOfData) {
uint8 numFlat = *src++;
@@ -645,7 +647,7 @@ void SwordScreen::decompressTony(uint8 *src, uint32 compSize, uint8 *dest) {
}
}
-void SwordScreen::decompressRLE7(uint8 *src, uint32 compSize, uint8 *dest) {
+void Screen::decompressRLE7(uint8 *src, uint32 compSize, uint8 *dest) {
uint8 *compBufEnd = src + compSize;
while (src < compBufEnd) {
uint8 code = *src++;
@@ -659,7 +661,7 @@ void SwordScreen::decompressRLE7(uint8 *src, uint32 compSize, uint8 *dest) {
}
}
-void SwordScreen::decompressRLE0(uint8 *src, uint32 compSize, uint8 *dest) {
+void Screen::decompressRLE0(uint8 *src, uint32 compSize, uint8 *dest) {
uint8 *srcBufEnd = src + compSize;
while (src < srcBufEnd) {
uint8 color = *src++;
@@ -673,7 +675,7 @@ void SwordScreen::decompressRLE0(uint8 *src, uint32 compSize, uint8 *dest) {
}
}
-void SwordScreen::fadePalette(void) {
+void Screen::fadePalette(void) {
if (_fadingStep == 16)
memcpy(_currentPalette, _targetPalette, 256 * 4);
else if ((_fadingStep == 1) && (_fadingDirection == FADE_DOWN)) {
@@ -690,13 +692,13 @@ void SwordScreen::fadePalette(void) {
_isBlack = true;
}
-void SwordScreen::fnSetParallax(uint32 screen, uint32 resId) {
+void Screen::fnSetParallax(uint32 screen, uint32 resId) {
if ((screen == _currentScreen) && (resId != _roomDefTable[screen].parallax[0]))
warning("fnSetParallax: setting parallax for current room!!");
_roomDefTable[screen].parallax[0] = resId;
}
-void SwordScreen::spriteClipAndSet(uint16 *pSprX, uint16 *pSprY, uint16 *pSprWidth, uint16 *pSprHeight, uint16 *incr) {
+void Screen::spriteClipAndSet(uint16 *pSprX, uint16 *pSprY, uint16 *pSprWidth, uint16 *pSprHeight, uint16 *incr) {
int16 sprX = *pSprX - SCREEN_LEFT_EDGE;
int16 sprY = *pSprY - SCREEN_TOP_EDGE;
int16 sprW = *pSprWidth;
@@ -751,13 +753,13 @@ void SwordScreen::spriteClipAndSet(uint16 *pSprX, uint16 *pSprY, uint16 *pSprWid
}
}
-void SwordScreen::fnFlash(uint8 color) {
- warning("stub: SwordScreen::fnFlash(%d)", color);
+void Screen::fnFlash(uint8 color) {
+ warning("stub: Screen::fnFlash(%d)", color);
}
-// ------------------- SwordMenu screen interface ---------------------------
+// ------------------- Menu screen interface ---------------------------
-void SwordScreen::showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, const byte *fadeMask, int8 fadeStatus) {
+void Screen::showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, const byte *fadeMask, int8 fadeStatus) {
uint8 frame[40 * 40];
int i, j;
@@ -790,17 +792,17 @@ void SwordScreen::showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, co
// ------------------- router debugging code --------------------------------
-void SwordScreen::vline(uint16 x, uint16 y1, uint16 y2) {
+void Screen::vline(uint16 x, uint16 y1, uint16 y2) {
for (uint16 cnty = y1; cnty <= y2; cnty++)
_screenBuf[x + _scrnSizeX * cnty] = 0;
}
-void SwordScreen::hline(uint16 x1, uint16 x2, uint16 y) {
+void Screen::hline(uint16 x1, uint16 x2, uint16 y) {
for (uint16 cntx = x1; cntx <= x2; cntx++)
_screenBuf[y * _scrnSizeX + cntx] = 0;
}
-void SwordScreen::bsubline_1(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
+void Screen::bsubline_1(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
int x, y, ddx, ddy, e;
ddx = ABS(x2 - x1);
ddy = ABS(y2 - y1) << 1;
@@ -824,7 +826,7 @@ void SwordScreen::bsubline_1(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
}
}
-void SwordScreen::bsubline_2(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
+void Screen::bsubline_2(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
int x, y, ddx, ddy, e;
ddx = ABS(x2 - x1) << 1;
ddy = ABS(y2 - y1);
@@ -848,7 +850,7 @@ void SwordScreen::bsubline_2(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
}
}
-void SwordScreen::bsubline_3(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
+void Screen::bsubline_3(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
int x, y, ddx, ddy, e;
ddx = ABS(x1 - x2) << 1;
ddy = ABS(y2 - y1);
@@ -872,7 +874,7 @@ void SwordScreen::bsubline_3(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
}
}
-void SwordScreen::bsubline_4(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
+void Screen::bsubline_4(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
int x, y, ddx, ddy, e;
ddy = ABS(y2 - y1) << 1;
ddx = ABS(x1 - x2);
@@ -896,7 +898,7 @@ void SwordScreen::bsubline_4(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
}
}
-void SwordScreen::drawLine(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
+void Screen::drawLine(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
if ((x1 == x2) && (y1 == y2)) {
_screenBuf[x1 + y1 * _scrnSizeX] = 0;
}
@@ -922,3 +924,5 @@ void SwordScreen::drawLine(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
bsubline_3(x1, y1, x2, y2);
}
}
+
+} // End of namespace Sword1
diff --git a/sword1/screen.h b/sword1/screen.h
index 741eb4992f..3c7326e8f4 100644
--- a/sword1/screen.h
+++ b/sword1/screen.h
@@ -24,6 +24,10 @@
#include "sworddefs.h"
+class OSystem;
+
+namespace Sword1 {
+
#define MAX_FORE 20
#define MAX_BACK 20
#define MAX_SORT 20
@@ -57,15 +61,14 @@ struct RoomDef {
class ResMan;
class ObjectMan;
-class SwordText; // Text objects use sprites that are created internally at run-time
- // the buffer belongs to SwordText, so we need a reference here.
-class OSystem;
+class Text; // Text objects use sprites that are created internally at run-time
+ // the buffer belongs to Text, so we need a reference here.
-class SwordScreen {
+class Screen {
public:
- SwordScreen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
- void useTextManager(SwordText *pTextMan);
- ~SwordScreen(void);
+ Screen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
+ void useTextManager(Text *pTextMan);
+ ~Screen(void);
void draw(void);
void quitScreen(void);
@@ -114,7 +117,7 @@ private:
OSystem *_system;
ResMan *_resMan;
ObjectMan *_objMan;
- SwordText *_textMan;
+ Text *_textMan;
uint16 _currentScreen;
uint8 *_screenBuf;
@@ -143,5 +146,7 @@ private:
// mainloop that no further fading is necessary.
};
+} // End of namespace Sword1
+
#endif //BSSCREEN_H
diff --git a/sword1/sound.cpp b/sword1/sound.cpp
index 026c6eb954..8d496016a2 100644
--- a/sword1/sound.cpp
+++ b/sword1/sound.cpp
@@ -26,10 +26,12 @@
#include "logic.h"
#include "sword1.h"
+namespace Sword1 {
+
#define SOUND_SPEECH_ID 1
#define SPEECH_FLAGS (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN)
-SwordSound::SwordSound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan) {
+Sound::Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan) {
strcpy(_filePath, searchPath);
_mixer = mixer;
_resMan = pResMan;
@@ -39,7 +41,7 @@ SwordSound::SwordSound(const char *searchPath, SoundMixer *mixer, ResMan *pResMa
_speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192;
}
-int SwordSound::addToQueue(int32 fxNo) {
+int Sound::addToQueue(int32 fxNo) {
bool alreadyInQueue = false;
for (uint8 cnt = 0; (cnt < _endOfQueue) && (!alreadyInQueue); cnt++)
if (_fxQueue[cnt].id == (uint32)fxNo)
@@ -61,10 +63,10 @@ int SwordSound::addToQueue(int32 fxNo) {
return 0;
}
-void SwordSound::engine(void) {
+void Sound::engine(void) {
// first of all, add any random sfx to the queue...
for (uint16 cnt = 0; cnt < TOTAL_FX_PER_ROOM; cnt++) {
- uint16 fxNo = _roomsFixedFx[SwordLogic::_scriptVars[SCREEN]][cnt];
+ uint16 fxNo = _roomsFixedFx[Logic::_scriptVars[SCREEN]][cnt];
if (fxNo) {
if (_fxList[fxNo].type == FX_RANDOM) {
if (_rnd.getRandomNumber(_fxList[fxNo].delay) == 0)
@@ -90,8 +92,7 @@ void SwordSound::engine(void) {
}
}
-void SwordSound::fnStopFx(int32 fxNo) {
-
+void Sound::fnStopFx(int32 fxNo) {
_mixer->stopID(fxNo);
for (uint8 cnt = 0; cnt < _endOfQueue; cnt++)
if (_fxQueue[cnt].id == (uint32)fxNo) {
@@ -105,16 +106,16 @@ void SwordSound::fnStopFx(int32 fxNo) {
debug(8, "fnStopFx: id not found in queue");
}
-bool SwordSound::amISpeaking(void) {
+bool Sound::amISpeaking(void) {
_waveVolPos++;
return _waveVolume[_waveVolPos - 1];
}
-bool SwordSound::speechFinished(void) {
+bool Sound::speechFinished(void) {
return !_speechHandle.isActive();
}
-void SwordSound::newScreen(uint32 screen) {
+void Sound::newScreen(uint32 screen) {
if (_currentCowFile != SwordEngine::_systemVars.currentCD) {
if (_currentCowFile)
closeCowSystem();
@@ -122,17 +123,17 @@ void SwordSound::newScreen(uint32 screen) {
}
}
-void SwordSound::quitScreen(void) {
+void Sound::quitScreen(void) {
// stop all running SFX
while (_endOfQueue)
fnStopFx(_fxQueue[0].id);
}
-void SwordSound::playSample(QueueElement *elem) {
+void Sound::playSample(QueueElement *elem) {
uint8 *sampleData = (uint8*)_resMan->fetchRes(_fxList[elem->id].sampleId);
for (uint16 cnt = 0; cnt < MAX_ROOMS_PER_FX; cnt++) {
if (_fxList[elem->id].roomVolList[cnt].roomNo) {
- if ((_fxList[elem->id].roomVolList[cnt].roomNo == (int)SwordLogic::_scriptVars[SCREEN]) ||
+ if ((_fxList[elem->id].roomVolList[cnt].roomNo == (int)Logic::_scriptVars[SCREEN]) ||
(_fxList[elem->id].roomVolList[cnt].roomNo == -1)) {
uint8 volL = (_fxList[elem->id].roomVolList[cnt].leftVol * 10 * _sfxVolL) / 255;
@@ -154,9 +155,9 @@ void SwordSound::playSample(QueueElement *elem) {
}
}
-bool SwordSound::startSpeech(uint16 roomNo, uint16 localNo) {
+bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
if (_cowHeader == NULL) {
- warning("SwordSound::startSpeech: COW file isn't open!");
+ warning("Sound::startSpeech: COW file isn't open!");
return false;
}
@@ -176,7 +177,7 @@ bool SwordSound::startSpeech(uint16 roomNo, uint16 localNo) {
return false;
}
-int16 *SwordSound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
+int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
uint8 *fBuf = (uint8*)malloc(cSize);
_cowFile.seek(index);
_cowFile.read(fBuf, cSize);
@@ -210,13 +211,13 @@ int16 *SwordSound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
return dstData;
} else {
free(fBuf);
- warning("SwordSound::uncompressSpeech(): DATA tag not found in wave header");
+ warning("Sound::uncompressSpeech(): DATA tag not found in wave header");
*size = 0;
return NULL;
}
}
-void SwordSound::calcWaveVolume(int16 *data, uint32 length) {
+void Sound::calcWaveVolume(int16 *data, uint32 length) {
int16 *blkPos = data + 918;
for (uint32 cnt = 0; cnt < WAVE_VOL_TAB_LENGTH; cnt++)
_waveVolume[cnt] = false;
@@ -241,11 +242,11 @@ void SwordSound::calcWaveVolume(int16 *data, uint32 length) {
}
}
-void SwordSound::stopSpeech(void) {
+void Sound::stopSpeech(void) {
_mixer->stopID(SOUND_SPEECH_ID);
}
-void SwordSound::initCowSystem(void) {
+void Sound::initCowSystem(void) {
char cowName[25];
/* look for speech1/2.clu in the data dir
and speech/speech.clu (running from cd or using cd layout)
@@ -264,10 +265,10 @@ void SwordSound::initCowSystem(void) {
_cowHeader[cnt] = _cowFile.readUint32LE();
_currentCowFile = SwordEngine::_systemVars.currentCD;
} else
- warning("SwordSound::initCowSystem: Can't open SPEECH%d.CLU", SwordEngine::_systemVars.currentCD);
+ warning("Sound::initCowSystem: Can't open SPEECH%d.CLU", SwordEngine::_systemVars.currentCD);
}
-void SwordSound::closeCowSystem(void) {
+void Sound::closeCowSystem(void) {
if (_cowFile.isOpen())
_cowFile.close();
if (_cowHeader)
@@ -276,3 +277,4 @@ void SwordSound::closeCowSystem(void) {
_currentCowFile = 0;
}
+} // End of namespace Sword1
diff --git a/sword1/sound.h b/sword1/sound.h
index ad06a93daf..dcb2543653 100644
--- a/sword1/sound.h
+++ b/sword1/sound.h
@@ -28,6 +28,10 @@
#include "sound/mixer.h"
#include "common/util.h"
+class SoundMixer;
+
+namespace Sword1 {
+
#define TOTAL_FX_PER_ROOM 7 // total loop & random fx per room (see fx_list.c)
#define MAX_ROOMS_PER_FX 7 // max no. of rooms in the fx's room,vol list
#define MAX_FXQ_LENGTH 32 // max length of sound queue - ie. max number of fx that can be stored up/playing together
@@ -50,15 +54,14 @@ struct FxDef {
RoomVol roomVolList[MAX_ROOMS_PER_FX];
};
-class SoundMixer;
class ResMan;
#define WAVE_VOL_TAB_LENGTH 480
#define WAVE_VOL_THRESHOLD 190000 //120000
-class SwordSound {
+class Sound {
public:
- SwordSound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan);
- ~SwordSound(void);
+ Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan);
+ ~Sound(void);
void setSpeechVol(uint8 volL, uint8 volR) { _speechVolL = volL; _speechVolR = volR; };
void setSfxVol(uint8 volL, uint8 volR) { _sfxVolL = volL; _sfxVolR = volR; };
void giveSpeechVol(uint8 *volL, uint8 *volR) { *volL = _speechVolL; *volR = _speechVolR; };
@@ -103,4 +106,6 @@ private:
static const FxDef _fxList[312];
};
+} // End of namespace Sword1
+
#endif //BSSOUND_H
diff --git a/sword1/staticres.cpp b/sword1/staticres.cpp
index 049ff6824d..f8b039cbb8 100644
--- a/sword1/staticres.cpp
+++ b/sword1/staticres.cpp
@@ -30,6 +30,8 @@
#include "sound.h"
#include "sword1.h"
+namespace Sword1 {
+
const uint8 SwordEngine::_cdList[TOTAL_SECTIONS] = {
0, // 0 inventory
@@ -199,7 +201,7 @@ const uint8 SwordEngine::_cdList[TOTAL_SECTIONS] = {
1, // 146 ALBERT'S TEXT - on CD1
};
-const MenuObject SwordMenu::_objectDefs[TOTAL_pockets + 1] = {
+const MenuObject Menu::_objectDefs[TOTAL_pockets + 1] = {
{ // 0 can't use
0, 0, 0, 0, 0
},
@@ -569,7 +571,7 @@ const MenuObject SwordMenu::_objectDefs[TOTAL_pockets + 1] = {
}
};
-const Subject SwordMenu::_subjectList[TOTAL_subjects] = {
+const Subject Menu::_subjectList[TOTAL_subjects] = {
{ // 256
0, // subject_res
0 // subject_frame
@@ -1541,7 +1543,7 @@ const uint32 ObjectMan::_textList[TOTAL_SECTIONS][7] = {
};
-RoomDef SwordScreen::_roomDefTable[TOTAL_ROOMS] = { // these are NOT const
+RoomDef Screen::_roomDefTable[TOTAL_ROOMS] = { // these are NOT const
{
0, //total_layers --- room 0 NOT USED
0, //size_x = width
@@ -2584,7 +2586,7 @@ RoomDef SwordScreen::_roomDefTable[TOTAL_ROOMS] = { // these are NOT const
}
};
-const char SwordMusic::_tuneList[TOTAL_TUNES][8] = {
+const char Music::_tuneList[TOTAL_TUNES][8] = {
"", // 0 SPARE
"1m2", // DONE 1 George picks up the newspaper
"1m3", // DONE 2 In the alley for the first time
@@ -2887,7 +2889,7 @@ const char SwordMusic::_tuneList[TOTAL_TUNES][8] = {
"rm3d", // DONE 269 ONe the scene change after the Grand Master says, "George, we have watched you..." This one might need a bit of fiddling to get it to match to the fisticuffs.
};
-const FxDef SwordSound::_fxList[312] = {
+const FxDef Sound::_fxList[312] = {
// 0
{
0, // sampleId
@@ -6440,7 +6442,7 @@ const FxDef SwordSound::_fxList[312] = {
// NB. There must be a list for each room number, even if location doesn't exist in game
-const uint16 SwordSound::_roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM] =
+const uint16 Sound::_roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM] =
{
{0}, // 0
@@ -6561,3 +6563,5 @@ const uint16 SwordSound::_roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM] =
{0}, // 98
{0}, // 99
};
+
+} // End of namespace Sword1
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index c547291270..1d16a746ad 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -41,6 +41,8 @@
#include "music.h"
#include "control.h"
+using namespace Sword1;
+
/* Broken Sword 1 */
static const GameSettings sword1_setting =
{"sword1", "Broken Sword I", GF_DEFAULT_TO_1X_SCALER};
@@ -76,6 +78,8 @@ Engine *Engine_SWORD1_create(GameDetector *detector, OSystem *syst) {
REGISTER_PLUGIN("Broken Sword", Engine_SWORD1_gameList, Engine_SWORD1_create, Engine_SWORD1_detectGames)
+namespace Sword1 {
+
SystemVars SwordEngine::_systemVars;
void SwordEngine::errorString(const char *buf1, char *buf2) {
@@ -101,12 +105,12 @@ void SwordEngine::initialize(void) {
debug(5, "Starting object manager");
_objectMan = new ObjectMan(_resMan);
_mixer->setVolume(255);
- _mouse = new SwordMouse(_system, _resMan, _objectMan);
- _screen = new SwordScreen(_system, _resMan, _objectMan);
- _music = new SwordMusic(_system, _mixer);
- _sound = new SwordSound("", _mixer, _resMan);
- _menu = new SwordMenu(_screen, _mouse);
- _logic = new SwordLogic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu);
+ _mouse = new Mouse(_system, _resMan, _objectMan);
+ _screen = new Screen(_system, _resMan, _objectMan);
+ _music = new Music(_system, _mixer);
+ _sound = new Sound("", _mixer, _resMan);
+ _menu = new Menu(_screen, _mouse);
+ _logic = new Logic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu);
_mouse->useLogicAndMenu(_logic, _menu);
uint8 musicVol = (uint8)ConfMan.getInt("music_volume");
@@ -155,7 +159,7 @@ void SwordEngine::initialize(void) {
_logic->initialize();
_objectMan->initialize();
_mouse->initialize();
- _control = new SwordControl(_resMan, _objectMan, _system, _mouse, _sound, _music, getSavePath());
+ _control = new Control(_resMan, _objectMan, _system, _mouse, _sound, _music, getSavePath());
}
void SwordEngine::reinitialize(void) {
@@ -171,10 +175,10 @@ void SwordEngine::reinitialize(void) {
void SwordEngine::startPositions(int32 startNumber) {
// int32 sect;
- BsObject *compact;
+ Object *compact;
- SwordLogic::_scriptVars[CHANGE_STANCE] = STAND;
- SwordLogic::_scriptVars[GEORGE_CDT_FLAG] = GEO_TLK_TABLE;
+ Logic::_scriptVars[CHANGE_STANCE] = STAND;
+ Logic::_scriptVars[GEORGE_CDT_FLAG] = GEO_TLK_TABLE;
//-------------------------------------------------------------------------------------------------------
// START 0==intro; 1==without
@@ -192,137 +196,137 @@ void SwordEngine::startPositions(int32 startNumber) {
}
- SwordLogic::_scriptVars[CHANGE_X] = 481;
- SwordLogic::_scriptVars[CHANGE_Y] = 413;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_1;
+ Logic::_scriptVars[CHANGE_X] = 481;
+ Logic::_scriptVars[CHANGE_Y] = 413;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_1;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==2) // blind_alley
{
- SwordLogic::_scriptVars[CHANGE_X] = 480;
- SwordLogic::_scriptVars[CHANGE_Y] = 388;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_2;
+ Logic::_scriptVars[CHANGE_X] = 480;
+ Logic::_scriptVars[CHANGE_Y] = 388;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_2;
_logic->fnAddObject(0,0,LIFTING_KEYS,0,0,0,0,0);
_logic->fnAddObject(0,0,ROSSO_CARD,0,0,0,0,0);
- SwordLogic::_scriptVars[POCKET_1] = 1;
- SwordLogic::_scriptVars[POCKET_2] = 1;
- SwordLogic::_scriptVars[POCKET_3] = 1;
- SwordLogic::_scriptVars[POCKET_4] = 1;
- SwordLogic::_scriptVars[POCKET_5] = 1;
- SwordLogic::_scriptVars[POCKET_6] = 1;
- SwordLogic::_scriptVars[POCKET_7] = 1;
- SwordLogic::_scriptVars[POCKET_8] = 1;
- SwordLogic::_scriptVars[POCKET_9] = 1;
-
- SwordLogic::_scriptVars[POCKET_10] = 1;
- SwordLogic::_scriptVars[POCKET_11] = 1;
- SwordLogic::_scriptVars[POCKET_12] = 1;
- SwordLogic::_scriptVars[POCKET_13] = 1;
- SwordLogic::_scriptVars[POCKET_14] = 1;
- SwordLogic::_scriptVars[POCKET_15] = 1;
- SwordLogic::_scriptVars[POCKET_16] = 1;
- SwordLogic::_scriptVars[POCKET_17] = 1;
- SwordLogic::_scriptVars[POCKET_18] = 1;
- SwordLogic::_scriptVars[POCKET_19] = 1;
-
- SwordLogic::_scriptVars[POCKET_20] = 1;
- SwordLogic::_scriptVars[POCKET_21] = 1;
- SwordLogic::_scriptVars[POCKET_22] = 1;
- SwordLogic::_scriptVars[POCKET_23] = 1;
- SwordLogic::_scriptVars[POCKET_24] = 1;
- SwordLogic::_scriptVars[POCKET_25] = 1;
- SwordLogic::_scriptVars[POCKET_26] = 1;
- SwordLogic::_scriptVars[POCKET_27] = 1;
- SwordLogic::_scriptVars[POCKET_28] = 1;
- SwordLogic::_scriptVars[POCKET_29] = 1;
+ Logic::_scriptVars[POCKET_1] = 1;
+ Logic::_scriptVars[POCKET_2] = 1;
+ Logic::_scriptVars[POCKET_3] = 1;
+ Logic::_scriptVars[POCKET_4] = 1;
+ Logic::_scriptVars[POCKET_5] = 1;
+ Logic::_scriptVars[POCKET_6] = 1;
+ Logic::_scriptVars[POCKET_7] = 1;
+ Logic::_scriptVars[POCKET_8] = 1;
+ Logic::_scriptVars[POCKET_9] = 1;
+
+ Logic::_scriptVars[POCKET_10] = 1;
+ Logic::_scriptVars[POCKET_11] = 1;
+ Logic::_scriptVars[POCKET_12] = 1;
+ Logic::_scriptVars[POCKET_13] = 1;
+ Logic::_scriptVars[POCKET_14] = 1;
+ Logic::_scriptVars[POCKET_15] = 1;
+ Logic::_scriptVars[POCKET_16] = 1;
+ Logic::_scriptVars[POCKET_17] = 1;
+ Logic::_scriptVars[POCKET_18] = 1;
+ Logic::_scriptVars[POCKET_19] = 1;
+
+ Logic::_scriptVars[POCKET_20] = 1;
+ Logic::_scriptVars[POCKET_21] = 1;
+ Logic::_scriptVars[POCKET_22] = 1;
+ Logic::_scriptVars[POCKET_23] = 1;
+ Logic::_scriptVars[POCKET_24] = 1;
+ Logic::_scriptVars[POCKET_25] = 1;
+ Logic::_scriptVars[POCKET_26] = 1;
+ Logic::_scriptVars[POCKET_27] = 1;
+ Logic::_scriptVars[POCKET_28] = 1;
+ Logic::_scriptVars[POCKET_29] = 1;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==3) // cafe
{
- SwordLogic::_scriptVars[CHANGE_X] = 660;
- SwordLogic::_scriptVars[CHANGE_Y] = 368;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_3;
+ Logic::_scriptVars[CHANGE_X] = 660;
+ Logic::_scriptVars[CHANGE_Y] = 368;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_3;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==4) // ready to use phone
{
- SwordLogic::_scriptVars[CHANGE_X] = 463;
- SwordLogic::_scriptVars[CHANGE_Y] = 391;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_4;
+ Logic::_scriptVars[CHANGE_X] = 463;
+ Logic::_scriptVars[CHANGE_Y] = 391;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_4;
- SwordLogic::_scriptVars[MOUE_TEXT] = 1; // stop moue from entering ("Freeze...")
- SwordLogic::_scriptVars[MOUE_NICO_FLAG] = 1; // Moue gave George her number
+ Logic::_scriptVars[MOUE_TEXT] = 1; // stop moue from entering ("Freeze...")
+ Logic::_scriptVars[MOUE_NICO_FLAG] = 1; // Moue gave George her number
// paris_flag=2; // for Nico's phone script
- SwordLogic::_scriptVars[PARIS_FLAG] = 5; // to access room8 (cafe_repaired)
- SwordLogic::_scriptVars[NICO_PHONE_FLAG] = 1; // Nico's number is on envelope
- SwordLogic::_scriptVars[TAILOR_PHONE_FLAG] = 1; // Todryk's number is on envelope
- SwordLogic::_scriptVars[WORKMAN_GONE_FLAG] = 1; // Workman not here
- SwordLogic::_scriptVars[ALBERT_INFO_FLAG] = 1; // Albert has told us the tailor's number (for Nico's phone script)
- SwordLogic::_scriptVars[SEEN_SEWERS_FLAG] = 1;
-
- SwordLogic::_scriptVars[POCKET_30] = 1;
- SwordLogic::_scriptVars[POCKET_31] = 1;
- SwordLogic::_scriptVars[POCKET_32] = 1;
- SwordLogic::_scriptVars[POCKET_33] = 1;
- SwordLogic::_scriptVars[POCKET_34] = 1;
- SwordLogic::_scriptVars[POCKET_35] = 1;
- SwordLogic::_scriptVars[POCKET_36] = 1;
- SwordLogic::_scriptVars[POCKET_37] = 1;
- SwordLogic::_scriptVars[POCKET_38] = 1;
- SwordLogic::_scriptVars[POCKET_39] = 1;
-
- SwordLogic::_scriptVars[POCKET_40] = 1;
- SwordLogic::_scriptVars[POCKET_41] = 1;
- SwordLogic::_scriptVars[POCKET_42] = 1;
- SwordLogic::_scriptVars[POCKET_43] = 1;
- SwordLogic::_scriptVars[POCKET_44] = 1;
- SwordLogic::_scriptVars[POCKET_45] = 1;
- SwordLogic::_scriptVars[POCKET_46] = 1;
- SwordLogic::_scriptVars[POCKET_47] = 1;
- SwordLogic::_scriptVars[POCKET_48] = 1;
- SwordLogic::_scriptVars[POCKET_49] = 1;
-
- SwordLogic::_scriptVars[POCKET_50] = 1;
- SwordLogic::_scriptVars[POCKET_51] = 1;
- SwordLogic::_scriptVars[POCKET_52] = 1;
+ Logic::_scriptVars[PARIS_FLAG] = 5; // to access room8 (cafe_repaired)
+ Logic::_scriptVars[NICO_PHONE_FLAG] = 1; // Nico's number is on envelope
+ Logic::_scriptVars[TAILOR_PHONE_FLAG] = 1; // Todryk's number is on envelope
+ Logic::_scriptVars[WORKMAN_GONE_FLAG] = 1; // Workman not here
+ Logic::_scriptVars[ALBERT_INFO_FLAG] = 1; // Albert has told us the tailor's number (for Nico's phone script)
+ Logic::_scriptVars[SEEN_SEWERS_FLAG] = 1;
+
+ Logic::_scriptVars[POCKET_30] = 1;
+ Logic::_scriptVars[POCKET_31] = 1;
+ Logic::_scriptVars[POCKET_32] = 1;
+ Logic::_scriptVars[POCKET_33] = 1;
+ Logic::_scriptVars[POCKET_34] = 1;
+ Logic::_scriptVars[POCKET_35] = 1;
+ Logic::_scriptVars[POCKET_36] = 1;
+ Logic::_scriptVars[POCKET_37] = 1;
+ Logic::_scriptVars[POCKET_38] = 1;
+ Logic::_scriptVars[POCKET_39] = 1;
+
+ Logic::_scriptVars[POCKET_40] = 1;
+ Logic::_scriptVars[POCKET_41] = 1;
+ Logic::_scriptVars[POCKET_42] = 1;
+ Logic::_scriptVars[POCKET_43] = 1;
+ Logic::_scriptVars[POCKET_44] = 1;
+ Logic::_scriptVars[POCKET_45] = 1;
+ Logic::_scriptVars[POCKET_46] = 1;
+ Logic::_scriptVars[POCKET_47] = 1;
+ Logic::_scriptVars[POCKET_48] = 1;
+ Logic::_scriptVars[POCKET_49] = 1;
+
+ Logic::_scriptVars[POCKET_50] = 1;
+ Logic::_scriptVars[POCKET_51] = 1;
+ Logic::_scriptVars[POCKET_52] = 1;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==5) // court_yard
{
- SwordLogic::_scriptVars[CHANGE_X] = 400;
- SwordLogic::_scriptVars[CHANGE_Y] = 400;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_5;
+ Logic::_scriptVars[CHANGE_X] = 400;
+ Logic::_scriptVars[CHANGE_Y] = 400;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_5;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==7) // sewer_two
{
- SwordLogic::_scriptVars[CHANGE_X] = 520;
- SwordLogic::_scriptVars[CHANGE_Y] = 310;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_7;
+ Logic::_scriptVars[CHANGE_X] = 520;
+ Logic::_scriptVars[CHANGE_Y] = 310;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_7;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==8) // cafe_repaired
{
- SwordLogic::_scriptVars[CHANGE_X] = 481;
- SwordLogic::_scriptVars[CHANGE_Y] = 413;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_8;
+ Logic::_scriptVars[CHANGE_X] = 481;
+ Logic::_scriptVars[CHANGE_Y] = 413;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_8;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==11) // costumier
{
- SwordLogic::_scriptVars[CHANGE_X] = 264;
- SwordLogic::_scriptVars[CHANGE_Y] = 436;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_11;
+ Logic::_scriptVars[CHANGE_X] = 264;
+ Logic::_scriptVars[CHANGE_Y] = 436;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_11;
_logic->fnAddObject(0,0,TISSUE,0,0,0,0,0);
_logic->fnAddObject(0,0,PHOTOGRAPH,0,0,0,0,0);
@@ -331,29 +335,29 @@ void SwordEngine::startPositions(int32 startNumber) {
// HOTEL SECTION
else if (startNumber==12) // hotel_street
{
- SwordLogic::_scriptVars[CHANGE_X] = 730;
- SwordLogic::_scriptVars[CHANGE_Y] = 460;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_12;
+ Logic::_scriptVars[CHANGE_X] = 730;
+ Logic::_scriptVars[CHANGE_Y] = 460;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_12;
- SwordLogic::_scriptVars[PARIS_FLAG] = 6;
+ Logic::_scriptVars[PARIS_FLAG] = 6;
_logic->fnAddObject(0,0,PHOTOGRAPH,0,0,0,0,0);
- SwordLogic::_scriptVars[NICO_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[NICO_PHONE_FLAG] = 1;
- SwordLogic::_scriptVars[COSTUMES_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[HOTEL_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[AEROPORT_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[TAILOR_PHONE_FLAG] = 1;
+ Logic::_scriptVars[NICO_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[NICO_PHONE_FLAG] = 1;
+ Logic::_scriptVars[COSTUMES_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[HOTEL_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[AEROPORT_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[TAILOR_PHONE_FLAG] = 1;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==14) // hotel_corridor
{
- SwordLogic::_scriptVars[CHANGE_X] = 528;
- SwordLogic::_scriptVars[CHANGE_Y] = 484;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_14;
+ Logic::_scriptVars[CHANGE_X] = 528;
+ Logic::_scriptVars[CHANGE_Y] = 484;
+ Logic::_scriptVars[CHANGE_DIR] = UP;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_14;
_logic->fnAddObject(0,0,HOTEL_KEY,0,0,0,0,0);
_logic->fnAddObject(0,0,MANUSCRIPT,0,0,0,0,0);
@@ -361,43 +365,43 @@ void SwordEngine::startPositions(int32 startNumber) {
//-------------------------------------------------------------------------------------------------------
else if (startNumber==17) // hotel_assassin
{
- SwordLogic::_scriptVars[CHANGE_X] = 714;
- SwordLogic::_scriptVars[CHANGE_Y] = 484;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_17;
+ Logic::_scriptVars[CHANGE_X] = 714;
+ Logic::_scriptVars[CHANGE_Y] = 484;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_17;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==18) // gendarmerie
{
- SwordLogic::_scriptVars[CHANGE_X] = 446;
- SwordLogic::_scriptVars[CHANGE_Y] = 408;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_18;
+ Logic::_scriptVars[CHANGE_X] = 446;
+ Logic::_scriptVars[CHANGE_Y] = 408;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_18;
- SwordLogic::_scriptVars[PARIS_FLAG] = 5; // for Moue & Rosso
+ Logic::_scriptVars[PARIS_FLAG] = 5; // for Moue & Rosso
}
//-------------------------------------------------------------------------------------------------------
// MUSEUM RAID
else if (startNumber==27) // museum_street
{
- SwordLogic::_scriptVars[CHANGE_X] = 300;
- SwordLogic::_scriptVars[CHANGE_Y] = 510;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_27;
+ Logic::_scriptVars[CHANGE_X] = 300;
+ Logic::_scriptVars[CHANGE_Y] = 510;
+ Logic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_27;
- SwordLogic::_scriptVars[PARIS_FLAG] = 12; // for Lobineau in Museum
- SwordLogic::_scriptVars[MANUSCRIPT_ON_TABLE_10_FLAG] = 1;
+ Logic::_scriptVars[PARIS_FLAG] = 12; // for Lobineau in Museum
+ Logic::_scriptVars[MANUSCRIPT_ON_TABLE_10_FLAG] = 1;
}
//-------------------------------------------------------------------------------------------------------
// HOSPITAL SECTION
else if (startNumber==31) // hospital_street
{
- SwordLogic::_scriptVars[CHANGE_X] = 400;
- SwordLogic::_scriptVars[CHANGE_Y] = 500;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_31;
+ Logic::_scriptVars[CHANGE_X] = 400;
+ Logic::_scriptVars[CHANGE_Y] = 500;
+ Logic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_31;
- SwordLogic::_scriptVars[PARIS_FLAG] = 11;
+ Logic::_scriptVars[PARIS_FLAG] = 11;
_logic->fnAddObject(0,0,PHOTOGRAPH,0,0,0,0,0);
_logic->fnAddObject(0,0,LAB_PASS,0,0,0,0,0);
@@ -405,28 +409,28 @@ void SwordEngine::startPositions(int32 startNumber) {
//-------------------------------------------------------------------------------------------------------
else if (startNumber==32) // hospital_desk (after we've found out where Marquet is)
{
- SwordLogic::_scriptVars[CHANGE_X] = 405;
- SwordLogic::_scriptVars[CHANGE_Y] = 446;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_32;
+ Logic::_scriptVars[CHANGE_X] = 405;
+ Logic::_scriptVars[CHANGE_Y] = 446;
+ Logic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_32;
- SwordLogic::_scriptVars[PARIS_FLAG] = 11;
+ Logic::_scriptVars[PARIS_FLAG] = 11;
- SwordLogic::_scriptVars[EVA_TEXT] = 1; // talked to eva
- SwordLogic::_scriptVars[EVA_MARQUET_FLAG] = 2;
- SwordLogic::_scriptVars[EVA_NURSE_FLAG] = 4;
- SwordLogic::_scriptVars[FOUND_WARD_FLAG] = 1;
- SwordLogic::_scriptVars[CONSULTANT_HERE] = 1;
+ Logic::_scriptVars[EVA_TEXT] = 1; // talked to eva
+ Logic::_scriptVars[EVA_MARQUET_FLAG] = 2;
+ Logic::_scriptVars[EVA_NURSE_FLAG] = 4;
+ Logic::_scriptVars[FOUND_WARD_FLAG] = 1;
+ Logic::_scriptVars[CONSULTANT_HERE] = 1;
- compact = (BsObject*)_objectMan->fetchObject(PLAYER);
+ compact = (Object*)_objectMan->fetchObject(PLAYER);
_logic->fnMegaSet(compact,PLAYER,GEORGE_WLK,MEGA_WHITE,0,0,0,0);
- SwordLogic::_scriptVars[GEORGE_CDT_FLAG] = WHT_TLK_TABLE;
- SwordLogic::_scriptVars[GEORGE_TALK_FLAG] = 0;
- SwordLogic::_scriptVars[WHITE_COAT_FLAG] = 1;
- SwordLogic::_scriptVars[GEORGE_ALLOWED_REST_ANIMS] = 0; // because wearing white coat now
+ Logic::_scriptVars[GEORGE_CDT_FLAG] = WHT_TLK_TABLE;
+ Logic::_scriptVars[GEORGE_TALK_FLAG] = 0;
+ Logic::_scriptVars[WHITE_COAT_FLAG] = 1;
+ Logic::_scriptVars[GEORGE_ALLOWED_REST_ANIMS] = 0; // because wearing white coat now
- SwordLogic::_scriptVars[GOT_BENOIR_FLAG] = 1;
+ Logic::_scriptVars[GOT_BENOIR_FLAG] = 1;
_logic->fnAddObject(0,0,PHOTOGRAPH,0,0,0,0,0);
_logic->fnAddObject(0,0,LAB_PASS,0,0,0,0,0);
@@ -434,53 +438,53 @@ void SwordEngine::startPositions(int32 startNumber) {
//-------------------------------------------------------------------------------------------------------
else if (startNumber==35) // hospital_jacques
{
- SwordLogic::_scriptVars[CHANGE_X] = 640;
- SwordLogic::_scriptVars[CHANGE_Y] = 500;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_35;
+ Logic::_scriptVars[CHANGE_X] = 640;
+ Logic::_scriptVars[CHANGE_Y] = 500;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_35;
- SwordLogic::_scriptVars[PARIS_FLAG] = 11;
+ Logic::_scriptVars[PARIS_FLAG] = 11;
- SwordLogic::_scriptVars[EVA_TEXT] = 1; // talked to eva
- SwordLogic::_scriptVars[EVA_MARQUET_FLAG] = 2;
- SwordLogic::_scriptVars[EVA_NURSE_FLAG] = 4;
- SwordLogic::_scriptVars[FOUND_WARD_FLAG] = 1;
- SwordLogic::_scriptVars[CONSULTANT_HERE] = 1;
+ Logic::_scriptVars[EVA_TEXT] = 1; // talked to eva
+ Logic::_scriptVars[EVA_MARQUET_FLAG] = 2;
+ Logic::_scriptVars[EVA_NURSE_FLAG] = 4;
+ Logic::_scriptVars[FOUND_WARD_FLAG] = 1;
+ Logic::_scriptVars[CONSULTANT_HERE] = 1;
- compact = (BsObject*)_objectMan->fetchObject(PLAYER);
+ compact = (Object*)_objectMan->fetchObject(PLAYER);
_logic->fnMegaSet(compact,PLAYER,GEORGE_WLK,MEGA_WHITE,0,0,0,0);
- SwordLogic::_scriptVars[GEORGE_CDT_FLAG] = WHT_TLK_TABLE;
- SwordLogic::_scriptVars[GEORGE_TALK_FLAG] = 0;
- SwordLogic::_scriptVars[WHITE_COAT_FLAG] = 1;
- SwordLogic::_scriptVars[GEORGE_ALLOWED_REST_ANIMS] = 0; // because wearing white coat now
- SwordLogic::_scriptVars[DOOR_34_OPEN] = 1;
+ Logic::_scriptVars[GEORGE_CDT_FLAG] = WHT_TLK_TABLE;
+ Logic::_scriptVars[GEORGE_TALK_FLAG] = 0;
+ Logic::_scriptVars[WHITE_COAT_FLAG] = 1;
+ Logic::_scriptVars[GEORGE_ALLOWED_REST_ANIMS] = 0; // because wearing white coat now
+ Logic::_scriptVars[DOOR_34_OPEN] = 1;
- SwordLogic::_scriptVars[GOT_BENOIR_FLAG] = 2;
- SwordLogic::_scriptVars[HOS_POS_FLAG] = 26;
- SwordLogic::_scriptVars[BENOIR_FLAG] = 24; // for 'george_enters_ward' script
+ Logic::_scriptVars[GOT_BENOIR_FLAG] = 2;
+ Logic::_scriptVars[HOS_POS_FLAG] = 26;
+ Logic::_scriptVars[BENOIR_FLAG] = 24; // for 'george_enters_ward' script
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==36) // montfaucon
{
- SwordLogic::_scriptVars[CHANGE_X] = 300;
- SwordLogic::_scriptVars[CHANGE_Y] = 480;
- SwordLogic::_scriptVars[CHANGE_DIR] = RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_36;
+ Logic::_scriptVars[CHANGE_X] = 300;
+ Logic::_scriptVars[CHANGE_Y] = 480;
+ Logic::_scriptVars[CHANGE_DIR] = RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_36;
_logic->fnAddObject(0,0,LENS,0,0,0,0,0);
_logic->fnAddObject(0,0,RED_NOSE,0,0,0,0,0);
_logic->fnAddObject(0,0,LIFTING_KEYS,0,0,0,0,0);
- SwordLogic::_scriptVars[MONTFAUCON_CONTROL_FLAG] = 1;
+ Logic::_scriptVars[MONTFAUCON_CONTROL_FLAG] = 1;
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==37) // catacomb_sewer
{
- SwordLogic::_scriptVars[CHANGE_X] = 592;
- SwordLogic::_scriptVars[CHANGE_Y] = 386;
- SwordLogic::_scriptVars[CHANGE_DIR] = RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_37;
+ Logic::_scriptVars[CHANGE_X] = 592;
+ Logic::_scriptVars[CHANGE_Y] = 386;
+ Logic::_scriptVars[CHANGE_DIR] = RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_37;
_logic->fnAddObject(0,0,LIFTING_KEYS,0,0,0,0,0);
_logic->fnAddObject(0,0,TRIPOD,0,0,0,0,0);
@@ -489,10 +493,10 @@ void SwordEngine::startPositions(int32 startNumber) {
//-------------------------------------------------------------------------------------------------------
else if (startNumber==38) // catacomb_room
{
- SwordLogic::_scriptVars[CHANGE_X] = 200;
- SwordLogic::_scriptVars[CHANGE_Y] = 390;
- SwordLogic::_scriptVars[CHANGE_DIR] = RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_38;
+ Logic::_scriptVars[CHANGE_X] = 200;
+ Logic::_scriptVars[CHANGE_Y] = 390;
+ Logic::_scriptVars[CHANGE_DIR] = RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_38;
_logic->fnAddObject(0,0,TRIPOD,0,0,0,0,0);
_logic->fnAddObject(0,0,GEM,0,0,0,0,0);
@@ -500,12 +504,12 @@ void SwordEngine::startPositions(int32 startNumber) {
//-------------------------------------------------------------------------------------------------------
else if (startNumber==39) // catacomb_meeting
{
- SwordLogic::_scriptVars[CHANGE_X] = 636;
- SwordLogic::_scriptVars[CHANGE_Y] = 413;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_39;
+ Logic::_scriptVars[CHANGE_X] = 636;
+ Logic::_scriptVars[CHANGE_Y] = 413;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_39;
- SwordLogic::_scriptVars[MEETING_FLAG] = 3; // meeting finished
+ Logic::_scriptVars[MEETING_FLAG] = 3; // meeting finished
_logic->fnAddObject(0,0,TRIPOD,0,0,0,0,0);
_logic->fnAddObject(0,0,GEM,0,0,0,0,0);
@@ -513,13 +517,13 @@ void SwordEngine::startPositions(int32 startNumber) {
//-------------------------------------------------------------------------------------------------------
else if (startNumber==40) // excavation_exterior
{
- SwordLogic::_scriptVars[CHANGE_X] = 648;
- SwordLogic::_scriptVars[CHANGE_Y] = 492;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_40;
+ Logic::_scriptVars[CHANGE_X] = 648;
+ Logic::_scriptVars[CHANGE_Y] = 492;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_40;
- SwordLogic::_scriptVars[NICO_PHONE_FLAG] = 1;
- SwordLogic::_scriptVars[PARIS_FLAG] = 16;
+ Logic::_scriptVars[NICO_PHONE_FLAG] = 1;
+ Logic::_scriptVars[PARIS_FLAG] = 16;
_logic->fnAddObject(0,0,PLASTER,0,0,0,0,0);
_logic->fnAddObject(0,0,POLISHED_CHALICE,0,0,0,0,0);
@@ -527,70 +531,70 @@ void SwordEngine::startPositions(int32 startNumber) {
//-------------------------------------------------------------------------------------------------------
else if (startNumber==48) // templar_church
{
- SwordLogic::_scriptVars[CHANGE_X] = 315;
- SwordLogic::_scriptVars[CHANGE_Y] = 392;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_48;
+ Logic::_scriptVars[CHANGE_X] = 315;
+ Logic::_scriptVars[CHANGE_Y] = 392;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_48;
_logic->fnAddObject(0,0,CHALICE,0,0,0,0,0);
_logic->fnAddObject(0,0,LENS,0,0,0,0,0);
- SwordLogic::_scriptVars[CHALICE_FLAG] = 2; // from end of Spain1, when George gets chalice
- SwordLogic::_scriptVars[NEJO_TEXT] = 1; // so priest is there
+ Logic::_scriptVars[CHALICE_FLAG] = 2; // from end of Spain1, when George gets chalice
+ Logic::_scriptVars[NEJO_TEXT] = 1; // so priest is there
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==99) // test text+speech on blank screen (sc99)
{
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_99;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_99;
// if (testingText)
if (1)
{
// lastLineNo = testTextSection*65536 + LastTextNumber(testTextSection);
- SwordLogic::_scriptVars[LASTLINENO] = 146*65536 + _objectMan->lastTextNumber(146); // don't finished until at last line in last section
+ Logic::_scriptVars[LASTLINENO] = 146*65536 + _objectMan->lastTextNumber(146); // don't finished until at last line in last section
}
}
//-------------------------------------------------------------------------------------------------------
else if (startNumber==80) // Paris Map
{
- SwordLogic::_scriptVars[CHANGE_X] = 645;
- SwordLogic::_scriptVars[CHANGE_Y] = 160;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_80;
+ Logic::_scriptVars[CHANGE_X] = 645;
+ Logic::_scriptVars[CHANGE_Y] = 160;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_80;
- SwordLogic::_scriptVars[PARIS_FLAG] = 3; // for Nico's appartment
- SwordLogic::_scriptVars[NICO_CLOWN_FLAG] = 3;
+ Logic::_scriptVars[PARIS_FLAG] = 3; // for Nico's appartment
+ Logic::_scriptVars[NICO_CLOWN_FLAG] = 3;
- SwordLogic::_scriptVars[NICO_DOOR_FLAG] = 2; // for instant access to Nico's appartment
+ Logic::_scriptVars[NICO_DOOR_FLAG] = 2; // for instant access to Nico's appartment
_logic->fnAddObject(0,0,RED_NOSE,0,0,0,0,0);
_logic->fnAddObject(0,0,PHOTOGRAPH,0,0,0,0,0);
_logic->fnAddObject(0,0,PLASTER,0,0,0,0,0);
_logic->fnAddObject(0,0,LAB_PASS,0,0,0,0,0); // for hospital
- SwordLogic::_scriptVars[MANUSCRIPT_FLAG] = 1;
+ Logic::_scriptVars[MANUSCRIPT_FLAG] = 1;
- SwordLogic::_scriptVars[NICO_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[NICO_PHONE_FLAG] = 1;
- SwordLogic::_scriptVars[COSTUMES_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[HOTEL_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[MUSEUM_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[HOSPITAL_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[MONTFACN_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[AEROPORT_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[NERVAL_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[NICO_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[NICO_PHONE_FLAG] = 1;
+ Logic::_scriptVars[COSTUMES_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[HOTEL_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[MUSEUM_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[HOSPITAL_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[MONTFACN_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[AEROPORT_ADDRESS_FLAG] = 1;
+ Logic::_scriptVars[NERVAL_ADDRESS_FLAG] = 1;
- SwordLogic::_scriptVars[IRELAND_MAP_FLAG] = 1;
- SwordLogic::_scriptVars[SPAIN_MAP_FLAG] = 1;
- SwordLogic::_scriptVars[SYRIA_FLAG] = 2;
+ Logic::_scriptVars[IRELAND_MAP_FLAG] = 1;
+ Logic::_scriptVars[SPAIN_MAP_FLAG] = 1;
+ Logic::_scriptVars[SYRIA_FLAG] = 2;
- SwordLogic::_scriptVars[TAILOR_PHONE_FLAG] = 1;
+ Logic::_scriptVars[TAILOR_PHONE_FLAG] = 1;
}
//-------------------------------------------------------------------------------------------------------
// IRELAND
else if ((startNumber>=19)&&(startNumber<=26))
{
- SwordLogic::_scriptVars[PARIS_FLAG] = 9;
+ Logic::_scriptVars[PARIS_FLAG] = 9;
// already carrying these objects by the time we reach Ireland...
_logic->fnAddObject(0,0,RED_NOSE,0,0,0,0,0);
@@ -606,93 +610,93 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 19: // ireland_street
{
- SwordLogic::_scriptVars[CHANGE_X] = 256;
- SwordLogic::_scriptVars[CHANGE_Y] = 966;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_19;
+ Logic::_scriptVars[CHANGE_X] = 256;
+ Logic::_scriptVars[CHANGE_Y] = 966;
+ Logic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_19;
}
break;
//---------------------------
case 20: // macdevitts
{
- SwordLogic::_scriptVars[CHANGE_X] = 194;
- SwordLogic::_scriptVars[CHANGE_Y] = 417;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_20;
+ Logic::_scriptVars[CHANGE_X] = 194;
+ Logic::_scriptVars[CHANGE_Y] = 417;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_20;
- SwordLogic::_scriptVars[FARMER_MOVED_FLAG] = 1;
- SwordLogic::_scriptVars[FARMER_SEAN_FLAG] = 5;
+ Logic::_scriptVars[FARMER_MOVED_FLAG] = 1;
+ Logic::_scriptVars[FARMER_SEAN_FLAG] = 5;
- SwordLogic::_scriptVars[PUB_FLAP_FLAG] = 1;
- SwordLogic::_scriptVars[PUB_TRAP_DOOR] = 2;
- SwordLogic::_scriptVars[KNOWS_PEAGRAM_FLAG] = 1;
+ Logic::_scriptVars[PUB_FLAP_FLAG] = 1;
+ Logic::_scriptVars[PUB_TRAP_DOOR] = 2;
+ Logic::_scriptVars[KNOWS_PEAGRAM_FLAG] = 1;
}
break;
//---------------------------
case 21: // pub_cellar
{
- SwordLogic::_scriptVars[CHANGE_X] = 291;
- SwordLogic::_scriptVars[CHANGE_Y] = 444;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_21;
+ Logic::_scriptVars[CHANGE_X] = 291;
+ Logic::_scriptVars[CHANGE_Y] = 444;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_21;
_logic->fnAddObject(0,0,BEER_TOWEL,0,0,0,0,0);
- SwordLogic::_scriptVars[FARMER_MOVED_FLAG] = 1;
- SwordLogic::_scriptVars[FLEECY_STUCK] = 1;
- SwordLogic::_scriptVars[LIFTING_KEYS_IN_HOLE_23] = 1;
+ Logic::_scriptVars[FARMER_MOVED_FLAG] = 1;
+ Logic::_scriptVars[FLEECY_STUCK] = 1;
+ Logic::_scriptVars[LIFTING_KEYS_IN_HOLE_23] = 1;
}
break;
//---------------------------
case 22: // castle_gate
{
- SwordLogic::_scriptVars[CHANGE_X] = 547;
- SwordLogic::_scriptVars[CHANGE_Y] = 500;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_22;
+ Logic::_scriptVars[CHANGE_X] = 547;
+ Logic::_scriptVars[CHANGE_Y] = 500;
+ Logic::_scriptVars[CHANGE_DIR] = UP_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_22;
- SwordLogic::_scriptVars[IRELAND_FLAG] = 4; // so we can get rid of farmer
+ Logic::_scriptVars[IRELAND_FLAG] = 4; // so we can get rid of farmer
}
break;
//---------------------------
case 23: // castle_hay_top
{
- SwordLogic::_scriptVars[CHANGE_X] = 535;
- SwordLogic::_scriptVars[CHANGE_Y] = 510;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_23;
+ Logic::_scriptVars[CHANGE_X] = 535;
+ Logic::_scriptVars[CHANGE_Y] = 510;
+ Logic::_scriptVars[CHANGE_DIR] = UP;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_23;
}
break;
//---------------------------
case 24: // castle_yard
{
- SwordLogic::_scriptVars[CHANGE_X] = 815;
- SwordLogic::_scriptVars[CHANGE_Y] = 446;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_24;
+ Logic::_scriptVars[CHANGE_X] = 815;
+ Logic::_scriptVars[CHANGE_Y] = 446;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_24;
}
break;
//---------------------------
case 25: // castle_dig
{
- SwordLogic::_scriptVars[CHANGE_X] = 369;
- SwordLogic::_scriptVars[CHANGE_Y] = 492;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_25;
+ Logic::_scriptVars[CHANGE_X] = 369;
+ Logic::_scriptVars[CHANGE_Y] = 492;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_25;
_logic->fnAddObject(0,0,BEER_TOWEL,0,0,0,0,0);
- SwordLogic::_scriptVars[BEER_TOWEL_BEEN_WET] = 1;
- SwordLogic::_scriptVars[WET_BEER_TOWEL_TIMER] = 1000;
+ Logic::_scriptVars[BEER_TOWEL_BEEN_WET] = 1;
+ Logic::_scriptVars[WET_BEER_TOWEL_TIMER] = 1000;
}
break;
//---------------------------
case 26: // cellar_dark
{
- SwordLogic::_scriptVars[CHANGE_X] = 291;
- SwordLogic::_scriptVars[CHANGE_Y] = 444;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_26;
+ Logic::_scriptVars[CHANGE_X] = 291;
+ Logic::_scriptVars[CHANGE_Y] = 444;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_26;
}
break;
//---------------------------
@@ -703,7 +707,7 @@ void SwordEngine::startPositions(int32 startNumber) {
else if ((startNumber >= 45) && (startNumber <= 55))
{
- SwordLogic::_scriptVars[PARIS_FLAG] = 1;
+ Logic::_scriptVars[PARIS_FLAG] = 1;
// already carrying these objects by the time we reach Syria...
_logic->fnAddObject(0,0,BALL,0,0,0,0,0);
@@ -714,35 +718,35 @@ void SwordEngine::startPositions(int32 startNumber) {
_logic->fnAddObject(0,0,BUZZER,0,0,0,0,0);
_logic->fnAddObject(0,0,TISSUE,0,0,0,0,0);
- SwordLogic::_scriptVars[CHANGE_STANCE] = STAND; // use STAND for all starts
+ Logic::_scriptVars[CHANGE_STANCE] = STAND; // use STAND for all starts
switch (startNumber)
{
//---------------------------
case 45: // syria_stall
{
- SwordLogic::_scriptVars[CHANGE_X] = 410;
- SwordLogic::_scriptVars[CHANGE_Y] = 490;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_45;
+ Logic::_scriptVars[CHANGE_X] = 410;
+ Logic::_scriptVars[CHANGE_Y] = 490;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_45;
}
break;
//---------------------------
case 47: // syria_carpet
{
- SwordLogic::_scriptVars[CHANGE_X] = 225;
- SwordLogic::_scriptVars[CHANGE_Y] = 775;
- SwordLogic::_scriptVars[CHANGE_DIR] = RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_47;
+ Logic::_scriptVars[CHANGE_X] = 225;
+ Logic::_scriptVars[CHANGE_Y] = 775;
+ Logic::_scriptVars[CHANGE_DIR] = RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_47;
}
break;
//---------------------------
case 49: // syria_club
{
- SwordLogic::_scriptVars[CHANGE_X] = 438;
- SwordLogic::_scriptVars[CHANGE_Y] = 400;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_49;
+ Logic::_scriptVars[CHANGE_X] = 438;
+ Logic::_scriptVars[CHANGE_Y] = 400;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_49;
_logic->fnAddObject(0,0,TOILET_BRUSH,0,0,0,0,0);
}
@@ -750,10 +754,10 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 50: // syria_toilet
{
- SwordLogic::_scriptVars[CHANGE_X] = 313;
- SwordLogic::_scriptVars[CHANGE_Y] = 440;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_50;
+ Logic::_scriptVars[CHANGE_X] = 313;
+ Logic::_scriptVars[CHANGE_Y] = 440;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_50;
_logic->fnAddObject(0,0,TOILET_KEY,0,0,0,0,0);
}
@@ -761,7 +765,7 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 53: // bull_head pan
{
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_53;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_53;
_logic->fnAddObject(0,0,TOWEL_CUT,0,0,0,0,0);
}
@@ -769,10 +773,10 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 54: // bull_head
{
- SwordLogic::_scriptVars[CHANGE_X] = 680;
- SwordLogic::_scriptVars[CHANGE_Y] = 425;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_54;
+ Logic::_scriptVars[CHANGE_X] = 680;
+ Logic::_scriptVars[CHANGE_Y] = 425;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_54;
_logic->fnAddObject(0,0,TOWEL_CUT,0,0,0,0,0);
}
@@ -780,10 +784,10 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 55: // bull_secret
{
- SwordLogic::_scriptVars[CHANGE_X] = 825;
- SwordLogic::_scriptVars[CHANGE_Y] = 373;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_55;
+ Logic::_scriptVars[CHANGE_X] = 825;
+ Logic::_scriptVars[CHANGE_Y] = 373;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_55;
}
break;
//---------------------------
@@ -801,15 +805,15 @@ void SwordEngine::startPositions(int32 startNumber) {
else if ( ((startNumber >= 56) && (startNumber <= 62)) ||
((startNumber >=956) && (startNumber <= 962)) )
{
- SwordLogic::_scriptVars[PARIS_FLAG] = 1;
+ Logic::_scriptVars[PARIS_FLAG] = 1;
if (startNumber > 900) // SPAIN 2
{
startNumber -= 900; // set to correct start location
- SwordLogic::_scriptVars[SPAIN_VISIT] = 2; // set my own script flag to indicate 2nd visit
+ Logic::_scriptVars[SPAIN_VISIT] = 2; // set my own script flag to indicate 2nd visit
}
else
- SwordLogic::_scriptVars[SPAIN_VISIT] = 1; // set my own script flag to indicate 1st visit
+ Logic::_scriptVars[SPAIN_VISIT] = 1; // set my own script flag to indicate 1st visit
// already carrying these objects by the time we reach Spain...
_logic->fnAddObject(0,0,RED_NOSE,0,0,0,0,0);
@@ -821,7 +825,7 @@ void SwordEngine::startPositions(int32 startNumber) {
_logic->fnAddObject(0,0,BALL,0,0,0,0,0);
_logic->fnAddObject(0,0,MATCHBOOK,0,0,0,0,0);
- if (SwordLogic::_scriptVars[SPAIN_VISIT] == 1) // 1st visit
+ if (Logic::_scriptVars[SPAIN_VISIT] == 1) // 1st visit
_logic->fnAddObject(0,0,PRESSURE_GAUGE,0,0,0,0,0);
else // 2nd visit
_logic->fnAddObject(0,0,POLISHED_CHALICE,0,0,0,0,0);
@@ -831,55 +835,55 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 56: // Countess' room
{
- SwordLogic::_scriptVars[CHANGE_X] = 572;
- SwordLogic::_scriptVars[CHANGE_Y] = 443;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_56;
+ Logic::_scriptVars[CHANGE_X] = 572;
+ Logic::_scriptVars[CHANGE_Y] = 443;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_56;
}
break;
//---------------------------
case 57: // Spain Drive
{
- SwordLogic::_scriptVars[CHANGE_X] = 1630;
- SwordLogic::_scriptVars[CHANGE_Y] = 460;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_57;
+ Logic::_scriptVars[CHANGE_X] = 1630;
+ Logic::_scriptVars[CHANGE_Y] = 460;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_57;
}
break;
//---------------------------
case 58: // Mausoleum Exterior
{
- SwordLogic::_scriptVars[CHANGE_X] = SC58_PATH_X;
- SwordLogic::_scriptVars[CHANGE_Y] = SC58_PATH_Y;
- SwordLogic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_58;
+ Logic::_scriptVars[CHANGE_X] = SC58_PATH_X;
+ Logic::_scriptVars[CHANGE_Y] = SC58_PATH_Y;
+ Logic::_scriptVars[CHANGE_DIR] = UP_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_58;
}
break;
//---------------------------
case 59: // Mausoleum Interior
{
- SwordLogic::_scriptVars[CHANGE_X] = 750;
- SwordLogic::_scriptVars[CHANGE_Y] = 455;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_59;
+ Logic::_scriptVars[CHANGE_X] = 750;
+ Logic::_scriptVars[CHANGE_Y] = 455;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_59;
}
break;
//---------------------------
case 60: // Spain Reception
{
- SwordLogic::_scriptVars[CHANGE_X] = 750;
- SwordLogic::_scriptVars[CHANGE_Y] = 475;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_60;
+ Logic::_scriptVars[CHANGE_X] = 750;
+ Logic::_scriptVars[CHANGE_Y] = 475;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_60;
}
break;
//---------------------------
case 61: // Spain Well
{
- SwordLogic::_scriptVars[CHANGE_X] = 400;
- SwordLogic::_scriptVars[CHANGE_Y] = 345;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = LEFT_FLOOR_61;
+ Logic::_scriptVars[CHANGE_X] = 400;
+ Logic::_scriptVars[CHANGE_Y] = 345;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = LEFT_FLOOR_61;
_logic->fnAddObject(0,0,STONE_KEY,0,0,0,0,0);
_logic->fnAddObject(0,0,MIRROR,0,0,0,0,0);
@@ -888,12 +892,12 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 62: // CHESS PUZZLE
{
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_62; // so it doesn't crash!!
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_62; // so it doesn't crash!!
_logic->_scriptVars[TOP_MENU_DISABLED] = 1; // because it's irrelevant to the chess puzzle
_logic->_scriptVars[GEORGE_ALLOWED_REST_ANIMS] = 0; // because it's irrelevant to the chess puzzle
- compact = (BsObject*)_objectMan->fetchObject(PLAYER);
+ compact = (Object*)_objectMan->fetchObject(PLAYER);
_logic->fnNoSprite(compact, PLAYER, 0, 0, 0, 0, 0, 0);
}
break;
@@ -905,58 +909,58 @@ void SwordEngine::startPositions(int32 startNumber) {
else if ((startNumber >= 63) && (startNumber <= 70))
{
- SwordLogic::_scriptVars[PARIS_FLAG] = 18;
+ Logic::_scriptVars[PARIS_FLAG] = 18;
switch (startNumber)
{
//---------------------------
case 63: // train_one
{
- SwordLogic::_scriptVars[CHANGE_X] = 710;
- SwordLogic::_scriptVars[CHANGE_Y] = 450;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_63;
- SwordLogic::_scriptVars[DOOR_SC65_FLAG] = 2;
- SwordLogic::_scriptVars[DOOR_ONE_63_OPEN] = 0;
- SwordLogic::_scriptVars[DOOR_65_OPEN] = 1;
- SwordLogic::_scriptVars[VAIL_TEXT] = 1;
+ Logic::_scriptVars[CHANGE_X] = 710;
+ Logic::_scriptVars[CHANGE_Y] = 450;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_63;
+ Logic::_scriptVars[DOOR_SC65_FLAG] = 2;
+ Logic::_scriptVars[DOOR_ONE_63_OPEN] = 0;
+ Logic::_scriptVars[DOOR_65_OPEN] = 1;
+ Logic::_scriptVars[VAIL_TEXT] = 1;
}
break;
//---------------------------
case 65: // compt_one
{
- SwordLogic::_scriptVars[CHANGE_X] = 460;
- SwordLogic::_scriptVars[CHANGE_Y] = 430;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_65;
+ Logic::_scriptVars[CHANGE_X] = 460;
+ Logic::_scriptVars[CHANGE_Y] = 430;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_65;
}
//---------------------------
case 66: // compt_two
{
- SwordLogic::_scriptVars[CHANGE_X] = 460;
- SwordLogic::_scriptVars[CHANGE_Y] = 430;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_66;
+ Logic::_scriptVars[CHANGE_X] = 460;
+ Logic::_scriptVars[CHANGE_Y] = 430;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_66;
- SwordLogic::_scriptVars[WINDOW_66_OPEN] = 1;
+ Logic::_scriptVars[WINDOW_66_OPEN] = 1;
}
break;
//---------------------------
case 67: // compt_three
{
- SwordLogic::_scriptVars[CHANGE_X] = 460;
- SwordLogic::_scriptVars[CHANGE_Y] = 430;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_67;
+ Logic::_scriptVars[CHANGE_X] = 460;
+ Logic::_scriptVars[CHANGE_Y] = 430;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_67;
}
break;
//---------------------------
case 69: // train_guard
{
- SwordLogic::_scriptVars[CHANGE_X] = 310;
- SwordLogic::_scriptVars[CHANGE_Y] = 430;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_69;
+ Logic::_scriptVars[CHANGE_X] = 310;
+ Logic::_scriptVars[CHANGE_Y] = 430;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_69;
}
break;
//---------------------------
@@ -973,7 +977,7 @@ void SwordEngine::startPositions(int32 startNumber) {
else if ((startNumber >= 71) && (startNumber <= 73))
{
- SwordLogic::_scriptVars[PARIS_FLAG] = 1;
+ Logic::_scriptVars[PARIS_FLAG] = 1;
// already carrying these objects by the time we reach Scotland...
_logic->fnAddObject(0,0,RED_NOSE,0,0,0,0,0);
@@ -987,36 +991,36 @@ void SwordEngine::startPositions(int32 startNumber) {
//---------------------------
case 71: // churchyard
{
- SwordLogic::_scriptVars[CHANGE_X] = 1538;
- SwordLogic::_scriptVars[CHANGE_Y] = 444;
- SwordLogic::_scriptVars[CHANGE_DIR] = LEFT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = RIGHT_FLOOR_71;
+ Logic::_scriptVars[CHANGE_X] = 1538;
+ Logic::_scriptVars[CHANGE_Y] = 444;
+ Logic::_scriptVars[CHANGE_DIR] = LEFT;
+ Logic::_scriptVars[CHANGE_PLACE] = RIGHT_FLOOR_71;
- SwordLogic::_scriptVars[NICO_SCOT_SCREEN] = 71;
- SwordLogic::_scriptVars[NICO_POSITION_71] = 1;
+ Logic::_scriptVars[NICO_SCOT_SCREEN] = 71;
+ Logic::_scriptVars[NICO_POSITION_71] = 1;
}
break;
//---------------------------
case 72: // church_tower
{
- SwordLogic::_scriptVars[CHANGE_X] = 150;
- SwordLogic::_scriptVars[CHANGE_Y] = 503;
- SwordLogic::_scriptVars[CHANGE_DIR] = RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_72;
+ Logic::_scriptVars[CHANGE_X] = 150;
+ Logic::_scriptVars[CHANGE_Y] = 503;
+ Logic::_scriptVars[CHANGE_DIR] = RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_72;
- SwordLogic::_scriptVars[NICO_SCOT_SCREEN] = 72;
+ Logic::_scriptVars[NICO_SCOT_SCREEN] = 72;
}
break;
//---------------------------
case 73: // crypt
{
- SwordLogic::_scriptVars[CHANGE_X] = 250;
- SwordLogic::_scriptVars[CHANGE_Y] = 390;
- SwordLogic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
- SwordLogic::_scriptVars[CHANGE_PLACE] = FLOOR_73;
+ Logic::_scriptVars[CHANGE_X] = 250;
+ Logic::_scriptVars[CHANGE_Y] = 390;
+ Logic::_scriptVars[CHANGE_DIR] = DOWN_RIGHT;
+ Logic::_scriptVars[CHANGE_PLACE] = FLOOR_73;
- SwordLogic::_scriptVars[NICO_SCOT_SCREEN] = 73;
- SwordLogic::_scriptVars[NICO_POSITION_73] = 1;
+ Logic::_scriptVars[NICO_SCOT_SCREEN] = 73;
+ Logic::_scriptVars[NICO_POSITION_73] = 1;
}
break;
//---------------------------
@@ -1027,7 +1031,7 @@ void SwordEngine::startPositions(int32 startNumber) {
error("Can't start in location %d", startNumber);
}
- compact = (BsObject*)_objectMan->fetchObject(PLAYER);
+ compact = (Object*)_objectMan->fetchObject(PLAYER);
_logic->fnEnterSection(compact, PLAYER, startNumber, 0, 0, 0, 0, 0); // (automatically opens the compact resource for that section)
_systemVars.deathScreenFlag = 0;
_systemVars.wantFade = true;
@@ -1096,7 +1100,7 @@ void SwordEngine::go(void) {
}
void SwordEngine::checkCd(void) {
- uint8 needCd = _cdList[SwordLogic::_scriptVars[NEW_SCREEN]];
+ uint8 needCd = _cdList[Logic::_scriptVars[NEW_SCREEN]];
if (_systemVars.runningFromCd) { // are we running from cd?
if (needCd == 0) { // needCd == 0 means we can use either CD1 or CD2.
if (_systemVars.currentCD == 0) {
@@ -1109,8 +1113,8 @@ void SwordEngine::checkCd(void) {
_systemVars.currentCD = needCd; // askForCd will ask the player to insert _systemVars.currentCd,
_control->askForCd(); // so it has to be updated before calling it.
}
- } else { // we're running from HDD, we don't have to care about music files and SwordSound will take care of
- if (needCd) // switching sound.clu files on SwordSound::newScreen by itself, so there's nothing to be done.
+ } else { // we're running from HDD, we don't have to care about music files and Sound will take care of
+ if (needCd) // switching sound.clu files on Sound::newScreen by itself, so there's nothing to be done.
_systemVars.currentCD = needCd;
else if (_systemVars.currentCD == 0)
_systemVars.currentCD = 1;
@@ -1125,10 +1129,10 @@ uint8 SwordEngine::mainLoop(void) {
// do we need the section45-hack from sword.c here?
checkCd();
- _screen->newScreen(SwordLogic::_scriptVars[NEW_SCREEN]);
- _logic->newScreen(SwordLogic::_scriptVars[NEW_SCREEN]);
- _sound->newScreen(SwordLogic::_scriptVars[NEW_SCREEN]);
- SwordLogic::_scriptVars[SCREEN] = SwordLogic::_scriptVars[NEW_SCREEN];
+ _screen->newScreen(Logic::_scriptVars[NEW_SCREEN]);
+ _logic->newScreen(Logic::_scriptVars[NEW_SCREEN]);
+ _sound->newScreen(Logic::_scriptVars[NEW_SCREEN]);
+ Logic::_scriptVars[SCREEN] = Logic::_scriptVars[NEW_SCREEN];
do {
uint32 newTime;
@@ -1168,7 +1172,7 @@ uint8 SwordEngine::mainLoop(void) {
if (_systemVars.forceRestart)
retCode = CONTROL_RESTART_GAME;
- else if (((_keyPressed == 63) && (SwordLogic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.deathScreenFlag)) {
+ else if (((_keyPressed == 63) && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.deathScreenFlag)) {
retCode = _control->runPanel();
if (!retCode)
_screen->fullRefresh();
@@ -1176,9 +1180,9 @@ uint8 SwordEngine::mainLoop(void) {
_keyPressed = 0;
// do something smart here to implement pausing the game. If we even want that, that is.
- } while ((SwordLogic::_scriptVars[SCREEN] == SwordLogic::_scriptVars[NEW_SCREEN]) && (retCode == 0));
+ } while ((Logic::_scriptVars[SCREEN] == Logic::_scriptVars[NEW_SCREEN]) && (retCode == 0));
- if ((retCode == 0) && (SwordLogic::_scriptVars[SCREEN] != 53) && _systemVars.wantFade) {
+ if ((retCode == 0) && (Logic::_scriptVars[SCREEN] != 53) && _systemVars.wantFade) {
_screen->fadeDownPalette();
while (_screen->stillFading()) {
_screen->updateScreen();
@@ -1188,7 +1192,7 @@ uint8 SwordEngine::mainLoop(void) {
_sound->quitScreen();
_screen->quitScreen(); // close graphic resources
- _objectMan->closeSection(SwordLogic::_scriptVars[SCREEN]); // close the section that PLAYER has just left, if it's empty now
+ _objectMan->closeSection(Logic::_scriptVars[SCREEN]); // close the section that PLAYER has just left, if it's empty now
}
return retCode;
}
@@ -1258,3 +1262,5 @@ void SwordEngine::delay(uint amount) { //copied and mutilated from sky.cpp
cur = _system->get_msecs();
} while (cur < start + amount);
}
+
+} // End of namespace Sword1
diff --git a/sword1/sword1.h b/sword1/sword1.h
index ff4a822239..29cab3bf9d 100644
--- a/sword1/sword1.h
+++ b/sword1/sword1.h
@@ -19,22 +19,26 @@
*
*/
-#include <stdio.h>
+#ifndef BSSWORD1_H
+#define BSSWORD1_H
+
#include "base/engine.h"
#include "common/util.h"
#include "base/gameDetector.h"
#include "sworddefs.h"
-class SwordScreen;
-class SwordSound;
-class SwordLogic;
-class SwordMouse;
+namespace Sword1 {
+
+class Screen;
+class Sound;
+class Logic;
+class Mouse;
class ResMan;
class MemMan;
class ObjectMan;
-class SwordMenu;
-class SwordMusic;
-class SwordControl;
+class Menu;
+class Music;
+class Control;
struct SystemVars {
bool runningFromCd;
@@ -46,8 +50,8 @@ struct SystemVars {
bool forceRestart;
bool wantFade; // when true => fade during scene change, else cut.
uint8 playSpeech;
- uint8 showText;
- uint8 language;
+ uint8 showText;
+ uint8 language;
};
class SwordEngine : public Engine {
@@ -74,12 +78,16 @@ private:
MemMan *_memMan;
ResMan *_resMan;
ObjectMan *_objectMan;
- SwordScreen *_screen;
- SwordMouse *_mouse;
- SwordLogic *_logic;
- SwordSound *_sound;
- SwordMenu *_menu;
- SwordMusic *_music;
- SwordControl *_control;
+ Screen *_screen;
+ Mouse *_mouse;
+ Logic *_logic;
+ Sound *_sound;
+ Menu *_menu;
+ Music *_music;
+ Control *_control;
static const uint8 _cdList[TOTAL_SECTIONS];
};
+
+} // End of namespace Sword1
+
+#endif //BSSWORD1_H
diff --git a/sword1/sworddefs.h b/sword1/sworddefs.h
index 45cbaace0f..7a2074511e 100644
--- a/sword1/sworddefs.h
+++ b/sword1/sworddefs.h
@@ -3,6 +3,8 @@
#include "scummsys.h"
+namespace Sword1 {
+
#define LOOPED 1
#define FRAME_RATE 12 // number of frames per second (max rate)
@@ -1554,4 +1556,6 @@ enum ScriptVariableNames {
#define SCR_menu_look (0*0x10000 + 24)
#define SCR_icon_combine_script (0*0x10000 + 25)
+} // End of namespace Sword1
+
#endif //SWORDDEFS_H
diff --git a/sword1/swordres.h b/sword1/swordres.h
index 67ec0a4114..6d506c20f1 100644
--- a/sword1/swordres.h
+++ b/sword1/swordres.h
@@ -22,6 +22,8 @@
#ifndef SWORDRES_H
#define SWORDRES_H
+namespace Sword1 {
+
// scripts
// standard
#define SCRIPT0 0x01000000
@@ -5215,4 +5217,6 @@
#define ROSTLK79CDT 0x0E090011
// 18 entities in TXTs, 18 in datafiles.
+} // End of namespace Sword1
+
#endif //SWORDRES_H
diff --git a/sword1/text.cpp b/sword1/text.cpp
index e0b6141efd..e72cf3c999 100644
--- a/sword1/text.cpp
+++ b/sword1/text.cpp
@@ -27,6 +27,8 @@
#include "swordres.h"
#include "sworddefs.h"
+namespace Sword1 {
+
#define OVERLAP 3
#define SPACE ' '
#define BORDER_COL 200
@@ -35,7 +37,7 @@
#define MAX_LINES 30
-SwordText::SwordText(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion) {
+Text::Text(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion) {
_objMan = pObjMan;
_resMan = pResMan;
_textCount = 0;
@@ -48,17 +50,17 @@ SwordText::SwordText(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion) {
_textBlocks[0] = _textBlocks[1] = NULL;
}
-SwordText::~SwordText(void) {
+Text::~Text(void) {
if (_textBlocks[0])
free(_textBlocks[0]);
if (_textBlocks[1])
free(_textBlocks[1]);
}
-uint32 SwordText::lowTextManager(uint8 *ascii, int32 width, uint8 pen) {
+uint32 Text::lowTextManager(uint8 *ascii, int32 width, uint8 pen) {
_textCount++;
if (_textCount > MAX_TEXT_OBS)
- error("SwordText::lowTextManager: MAX_TEXT_OBS exceeded!");
+ error("Text::lowTextManager: MAX_TEXT_OBS exceeded!");
uint32 textObjId = (TEXT_sect * ITM_PER_SEC) - 1;
do {
textObjId++;
@@ -71,7 +73,7 @@ uint32 SwordText::lowTextManager(uint8 *ascii, int32 width, uint8 pen) {
return textObjId;
}
-void SwordText::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 pen) {
+void Text::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 pen) {
LineInfo lines[MAX_LINES];
uint16 numLines = analyzeSentence(text, maxWidth, lines);
@@ -82,7 +84,7 @@ void SwordText::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 p
sprWidth = lines[lineCnt].width;
uint16 sprHeight = _charHeight * numLines;
uint32 sprSize = sprWidth * sprHeight;
- assert(!_textBlocks[slot]); // if this triggers, the speechDriver failed to call SwordText::releaseText.
+ assert(!_textBlocks[slot]); // if this triggers, the speechDriver failed to call Text::releaseText.
_textBlocks[slot] = (FrameHeader*)malloc(sprSize + sizeof(FrameHeader));
memcpy( _textBlocks[slot]->runTimeComp, "Nu ", 4);
@@ -103,13 +105,13 @@ void SwordText::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 p
}
}
-uint16 SwordText::charWidth(uint8 ch) {
+uint16 Text::charWidth(uint8 ch) {
if (ch < SPACE)
ch = 64;
return FROM_LE_16(_resMan->fetchFrame(_font, ch - SPACE)->width);
}
-uint16 SwordText::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line) {
+uint16 Text::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line) {
uint16 lineNo = 0;
bool firstWord = true;
@@ -149,7 +151,7 @@ uint16 SwordText::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line)
return lineNo+1; // return no of lines
}
-uint16 SwordText::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen) {
+uint16 Text::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen) {
FrameHeader *chFrame = _resMan->fetchFrame(_font, ch - SPACE);
uint8 *chData = ((uint8*)chFrame) + sizeof(FrameHeader);
uint8 *dest = sprPtr;
@@ -166,7 +168,7 @@ uint16 SwordText::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen)
return FROM_LE_16(chFrame->width);
}
-FrameHeader *SwordText::giveSpriteData(uint32 textTarget) {
+FrameHeader *Text::giveSpriteData(uint32 textTarget) {
// textTarget is the resource ID of the Compact linking the textdata.
// that's 0x950000 for slot 0 and 0x950001 for slot 1. easy, huh? :)
textTarget &= ITM_ID;
@@ -175,7 +177,7 @@ FrameHeader *SwordText::giveSpriteData(uint32 textTarget) {
return _textBlocks[textTarget];
}
-void SwordText::releaseText(uint32 id) {
+void Text::releaseText(uint32 id) {
id &= ITM_ID;
assert(id <= 1);
if (_textBlocks[id]) {
@@ -184,3 +186,5 @@ void SwordText::releaseText(uint32 id) {
_textCount--;
}
}
+
+} // End of namespace Sword1
diff --git a/sword1/text.h b/sword1/text.h
index 1cd180a464..5056421889 100644
--- a/sword1/text.h
+++ b/sword1/text.h
@@ -22,10 +22,13 @@
#ifndef BSTEXT_H
#define BSTEXT_H
-#define MAX_TEXT_OBS 2
-
#include "object.h"
#include "sworddefs.h"
+
+namespace Sword1 {
+
+#define MAX_TEXT_OBS 2
+
class ObjectMan;
class ResMan;
@@ -34,10 +37,10 @@ struct LineInfo {
uint16 length; // length of line in characters
};
-class SwordText {
+class Text {
public:
- SwordText(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion);
- ~SwordText(void);
+ Text(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion);
+ ~Text(void);
FrameHeader *giveSpriteData(uint32 textTarget);
uint32 lowTextManager(uint8 *text, int32 width, uint8 pen);
void releaseText(uint32 id);
@@ -55,4 +58,6 @@ private:
FrameHeader *_textBlocks[MAX_TEXT_OBS];
};
+} // End of namespace Sword1
+
#endif //BSTEXT_H