[Scummvm-cvs-logs] CVS: scummvm/sword1 collision.h,1.2,1.3 control.cpp,1.24,1.25 control.h,1.11,1.12 debug.cpp,1.2,1.3 debug.h,1.3,1.4 eventman.cpp,1.3,1.4 eventman.h,1.2,1.3 logic.cpp,1.31,1.32 logic.h,1.9,1.10 memman.cpp,1.4,1.5 memman.h,1.3,1.4 menu.cpp,1.19,1.20 menu.h,1.7,1.8 mouse.cpp,1.21,1.22 mouse.h,1.11,1.12 music.cpp,1.19,1.20 music.h,1.10,1.11 object.h,1.4,1.5 objectman.cpp,1.5,1.6 objectman.h,1.4,1.5 resman.cpp,1.14,1.15 resman.h,1.7,1.8 router.cpp,1.9,1.10 router.h,1.5,1.6 screen.cpp,1.35,1.36 screen.h,1.14,1.15 sound.cpp,1.24,1.25 sound.h,1.12,1.13 staticres.cpp,1.6,1.7 sword1.cpp,1.36,1.37 sword1.h,1.12,1.13 sworddefs.h,1.12,1.13 swordres.h,1.4,1.5 text.cpp,1.7,1.8 text.h,1.2,1.3

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Jan 11 07:48:02 CET 2004


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv31892

Modified Files:
	collision.h control.cpp control.h debug.cpp debug.h 
	eventman.cpp eventman.h logic.cpp logic.h memman.cpp memman.h 
	menu.cpp menu.h mouse.cpp mouse.h music.cpp music.h object.h 
	objectman.cpp objectman.h resman.cpp resman.h router.cpp 
	router.h screen.cpp screen.h sound.cpp sound.h staticres.cpp 
	sword1.cpp sword1.h sworddefs.h swordres.h text.cpp text.h 
Log Message:
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.


Index: collision.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/collision.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- collision.h	6 Jan 2004 12:45:34 -0000	1.2
+++ collision.h	11 Jan 2004 15:47:41 -0000	1.3
@@ -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 @@
 	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

Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- control.cpp	7 Jan 2004 18:08:24 -0000	1.24
+++ control.cpp	11 Jan 2004 15:47:41 -0000	1.25
@@ -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 @@
 	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 @@
 	_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 @@
 	free(_screenBuf);
 }
 
-uint8 SwordControl::runPanel(void) {
+uint8 Control::runPanel(void) {
 	_mouseDown = false;
 	_restoreBuf = NULL;
 	_keyPressed = _numButtons = 0;
@@ -291,11 +292,11 @@
 	_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 @@
 	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 @@
 	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::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 @@
 	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 @@
 	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::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 @@
 	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 @@
 	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 @@
 		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 @@
 	}
 }
 
-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 @@
 	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 @@
 	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 @@
 	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 @@
 	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::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 @@
 	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 @@
 	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 @@
 	_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 @@
 	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 @@
 	_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::saveGameToFile(uint8 slot) {
+void Control::saveGameToFile(uint8 slot) {
 	char fName[15];
 	uint16 cnt;
 	sprintf(fName, "SAVEGAME.%03d", slot);
@@ -846,17 +847,17 @@
 	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 @@
 	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 @@
 	_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 @@
 	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 @@
 	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 @@
 	} 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 @@
 	{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 @@
 	{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 @@
 	"Fim",
 	"UNIDADE CHEIA!",
 };
+
+} // End of namespace Sword1

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- control.h	7 Jan 2004 17:47:46 -0000	1.11
+++ control.h	11 Jan 2004 15:47:41 -0000	1.12
@@ -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 @@
 	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 @@
 	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 @@
 	bool _mouseDown;
 };
 
-
+} // End of namespace Sword1
+ 
 #endif //BSCONTROL_H
 

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/debug.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- debug.cpp	16 Dec 2003 02:27:53 -0000	1.2
+++ debug.cpp	11 Jan 2004 15:47:41 -0000	1.3
@@ -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 @@
 	"fnPurple",
 	"fnBlack"
 };
+
+} // End of namespace Sword1

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/debug.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- debug.h	6 Jan 2004 12:45:34 -0000	1.3
+++ debug.h	11 Jan 2004 15:47:41 -0000	1.4
@@ -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);
@@ -32,6 +34,8 @@
 private:
 	static const char _mCodeNames[100][35];
 };
+
+} // End of namespace Sword1 
 
 #endif // BSDEBUG_H
 

Index: eventman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/eventman.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- eventman.cpp	6 Jan 2004 12:45:34 -0000	1.3
+++ eventman.cpp	11 Jan 2004 15:47:41 -0000	1.4
@@ -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 @@
 			_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 @@
 	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 @@
 	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 @@
 	_eventPendingList[evSlot].eventNumber = event;
 }
 
+} // End of namespace Sword1

Index: eventman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/eventman.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- eventman.h	6 Jan 2004 12:45:34 -0000	1.2
+++ eventman.h	11 Jan 2004 15:47:41 -0000	1.3
@@ -24,6 +24,8 @@
 
 #include "object.h"
 
+namespace Sword1 {
+
 #define TOTAL_EVENT_SLOTS 20
 
 struct GlobalEvent {
@@ -35,12 +37,14 @@
 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

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/logic.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- logic.cpp	6 Jan 2004 12:45:34 -0000	1.31
+++ logic.cpp	11 Jan 2004 15:47:41 -0000	1.32
@@ -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];
[...1135 lines suppressed...]
 	_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 @@
 	{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

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/logic.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- logic.h	6 Jan 2004 12:45:34 -0000	1.9
+++ logic.h	11 Jan 2004 15:47:41 -0000	1.10
@@ -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 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			(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 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 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		(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 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		(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 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 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		(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 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

Index: memman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/memman.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- memman.cpp	6 Jan 2004 12:45:34 -0000	1.4
+++ memman.cpp	11 Jan 2004 15:47:41 -0000	1.5
@@ -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) {
 }
 
-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 @@
 	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::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::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 @@
 		_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 @@
 	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

Index: memman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/memman.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- memman.h	6 Jan 2004 12:45:34 -0000	1.3
+++ memman.h	11 Jan 2004 15:47:41 -0000	1.4
@@ -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 @@
 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

Index: menu.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/menu.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- menu.cpp	7 Jan 2004 19:03:29 -0000	1.19
+++ menu.cpp	11 Jan 2004 15:47:41 -0000	1.20
@@ -29,6 +29,8 @@
 #include "screen.h"
 #include "logic.h"
 
+namespace Sword1 {
+
 enum {
 	MENU_CLOSED,
 	MENU_CLOSING,
@@ -36,7 +38,7 @@
 	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 @@
 	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 @@
 	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 @@
 	_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 @@
 		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 @@
 	_inMenu = 0;
 }
 
-void SwordMenu::refreshMenus() {
+void Menu::refreshMenus() {
 	if (_objectBarStatus == MENU_OPEN) {
 		buildMenu();
 		for (uint8 cnt = 0; cnt < 16; cnt++) {
@@ -122,7 +124,7 @@
 	}
 }
 
-uint8 SwordMenu::checkMenuClick(uint8 menuType) {
+uint8 Menu::checkMenuClick(uint8 menuType) {
 	uint16 mouseEvent = _mouse->testEvent();
 	if (!mouseEvent)
 		return 0;
@@ -132,30 +134,30 @@
 		// 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 @@
 			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 @@
 	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 @@
 			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::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 @@
 			_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::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::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 @@
 	_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 @@
 	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

Index: menu.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/menu.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- menu.h	6 Jan 2004 12:45:34 -0000	1.7
+++ menu.h	11 Jan 2004 15:47:41 -0000	1.8
@@ -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 @@
 	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 @@
 	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 @@
 	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

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mouse.cpp	7 Jan 2004 19:03:29 -0000	1.21
+++ mouse.cpp	11 Jan 2004 15:47:41 -0000	1.22
@@ -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 @@
 	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::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 @@
 
 	_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 @@
 		_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 @@
 		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 @@
 			}
 		}
 	} 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::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::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::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

Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mouse.h	6 Jan 2004 12:45:34 -0000	1.11
+++ mouse.h	11 Jan 2004 15:47:41 -0000	1.12
@@ -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 @@
 	#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 @@
 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 @@
 	bool _inTopMenu, _mouseOverride;
 };
 
+} // End of namespace Sword1
+ 
 #endif //BSMOUSE_H

Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- music.cpp	8 Jan 2004 13:05:32 -0000	1.19
+++ music.cpp	11 Jan 2004 15:47:41 -0000	1.20
@@ -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 @@
 	_fadeSamples = FADE_LENGTH * getRate();
 }
 
-void SwordMusicHandle::fadeUp() {
+void MusicHandle::fadeUp() {
 	if (_fading > 0)
 		_fading = -_fading;
 	else if (_fading == 0)
@@ -47,11 +49,11 @@
 	_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 @@
 	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 @@
 	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 @@
 	_volumeL = _volumeR = 192;
 }
 
-SwordMusic::~SwordMusic() {
+Music::~Music() {
 	_mixer->setupPremix(0, 0);
 	delete _converter[0];
 	delete _converter[1];
@@ -121,28 +123,28 @@
 		_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::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

Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/music.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- music.h	8 Jan 2004 13:05:32 -0000	1.10
+++ music.h	11 Jan 2004 15:47:41 -0000	1.11
@@ -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 @@
 	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 @@
 	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;
@@ -76,5 +78,7 @@
 	void mixer(int16 *buf, uint32 len);
 	static const char _tuneList[TOTAL_TUNES][8]; // in staticres.cpp
 };
+
+} // End of namespace Sword1 
 
 #endif // BSMUSIC_H

Index: object.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/object.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- object.h	6 Jan 2004 12:45:34 -0000	1.4
+++ object.h	11 Jan 2004 15:47:41 -0000	1.5
@@ -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 @@
 	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 CollisionData {
-	BsObject  *compact;
+	Object  *compact;
 	int32	w[24];
 	int32	h[24];
 	WalkData route[24];
 };
+
+} // End of namespace Sword1 
 
 #endif //BSOBJECT_H
 

Index: objectman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/objectman.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- objectman.cpp	6 Jan 2004 12:45:34 -0000	1.5
+++ objectman.cpp	11 Jan 2004 15:47:41 -0000	1.6
@@ -27,6 +27,8 @@
 #include "swordres.h"
 #include "sword1.h"
 
+namespace Sword1 {
+
 ObjectMan::ObjectMan(ResMan *pResourceMan) {
 	_resMan = pResourceMan;
 }
@@ -117,13 +119,13 @@
 	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::saveLiveList(uint16 *dest) {
 	memcpy(dest, _liveList, TOTAL_SECTIONS * sizeof(uint16));
 }
+
+} // End of namespace Sword1

Index: objectman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/objectman.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- objectman.h	6 Jan 2004 12:45:34 -0000	1.4
+++ objectman.h	11 Jan 2004 15:47:41 -0000	1.5
@@ -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 @@
 	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);
@@ -56,6 +58,8 @@
 	uint16	_liveList[TOTAL_SECTIONS]; 					//which sections are active
 	uint8 *_cptData[TOTAL_SECTIONS];
 };
+
+} // End of namespace Sword1 
 
 #endif //OBJECTMAN_H
 

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- resman.cpp	6 Jan 2004 12:45:34 -0000	1.14
+++ resman.cpp	11 Jan 2004 15:47:41 -0000	1.15
@@ -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 @@
 		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::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::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::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 @@
 	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 @@
 		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::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::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::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 @@
 	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 @@
 
 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::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 @@
 	0x04050019,			// SR_DEATHPANEL
 	0,
 };
+
+} // End of namespace Sword1

Index: resman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- resman.h	6 Jan 2004 12:45:34 -0000	1.7
+++ resman.h	11 Jan 2004 15:47:41 -0000	1.8
@@ -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 @@
 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 @@
 	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

Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/router.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- router.cpp	6 Jan 2004 12:45:34 -0000	1.9
+++ router.cpp	11 Jan 2004 15:47:41 -0000	1.10
@@ -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 @@
 }
 
 /*
- * 
- */
-
-/*
  *    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 @@
 	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 @@
 	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::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 @@
 	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 @@
 
 }
 
-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 @@
 	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::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 @@
 	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::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 @@
  * 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 @@
 	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::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 @@
 	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::VertCheck(int32 x, int32 y1, int32 y2)
+int32 Router::VertCheck(int32 x, int32 y1, int32 y2)
 {
 	int32   dx;
 	int32   i;
@@ -2216,9 +2158,7 @@
 	return linesCrossed;
 }
 
-int32 SwordRouter::CheckTarget(int32 x , int32 y)
-/*******************************************************************************
- *******************************************************************************/
+int32 Router::CheckTarget(int32 x , int32 y)
 {
 	int32   dx;
 	int32   dy;
@@ -2294,15 +2234,11 @@
 	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 	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 @@
 		nnodes += _numExtraNodes;
 	}
 
-
 // copy the mega structure into the local variables for use in all subroutines
 
 	startX = megaObject->o_xcoord;
@@ -2471,7 +2403,6 @@
 
 // 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 @@
 	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 @@
 #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 @@
 	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

Index: router.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/router.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- router.h	20 Dec 2003 09:12:54 -0000	1.5
+++ router.h	11 Jan 2004 15:47:41 -0000	1.6
@@ -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 @@
 
 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 @@
 	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);
 	
@@ -172,5 +174,7 @@
 	void RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour);
 	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

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- screen.cpp	9 Jan 2004 05:11:10 -0000	1.35
+++ screen.cpp	11 Jan 2004 15:47:41 -0000	1.36
@@ -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 @@
 	_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 @@
 		_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 @@
 	_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 @@
 	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 @@
 	_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 @@
 		_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 @@
 	_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 @@
 		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::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::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 @@
 	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::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 @@
 }
 
 // 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::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::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::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::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::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 @@
 		_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::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 @@
 
 // ------------------- 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_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_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_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::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 @@
 		bsubline_3(x1, y1, x2, y2);
 	}
 }
+
+} // End of namespace Sword1

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- screen.h	7 Jan 2004 19:08:59 -0000	1.14
+++ screen.h	11 Jan 2004 15:47:41 -0000	1.15
@@ -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 @@
 
 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 @@
 	OSystem *_system;
 	ResMan *_resMan;
 	ObjectMan *_objMan;
-	SwordText *_textMan;
+	Text *_textMan;
 
 	uint16 _currentScreen;
 	uint8  *_screenBuf;
@@ -142,6 +145,8 @@
 	bool _isBlack; // if the logic already faded down the palette, this is set to show the
 				   // mainloop that no further fading is necessary.
 };
+
+} // End of namespace Sword1 
 
 #endif //BSSCREEN_H
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sound.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- sound.cpp	7 Jan 2004 17:47:46 -0000	1.24
+++ sound.cpp	11 Jan 2004 15:47:41 -0000	1.25
@@ -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 @@
 	_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 @@
 	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::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 @@
 	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::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 @@
 	}
 }
 
-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 @@
 		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 @@
 		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::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 @@
 			_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 @@
 	_currentCowFile = 0;
 }
 
+} // End of namespace Sword1

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sound.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- sound.h	7 Jan 2004 17:47:46 -0000	1.12
+++ sound.h	11 Jan 2004 15:47:41 -0000	1.13
@@ -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 @@
 	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; };
@@ -102,5 +105,7 @@
 	static const uint16 _roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM];
 	static const FxDef _fxList[312];
 };
+
+} // End of namespace Sword1 
 
 #endif //BSSOUND_H

Index: staticres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/staticres.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- staticres.cpp	6 Jan 2004 12:45:34 -0000	1.6
+++ staticres.cpp	11 Jan 2004 15:47:41 -0000	1.7
@@ -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 @@
 	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 Subject SwordMenu::_subjectList[TOTAL_subjects] = {
+const Subject Menu::_subjectList[TOTAL_subjects] = {
 	{	// 256
 		0,								// subject_res
 		0									// subject_frame
@@ -1541,7 +1543,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 @@
 	}
 };
 
-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 @@
 	"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 @@
 
 // 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 @@
 	{0},											// 98
 	{0},											// 99
 };
+
+} // End of namespace Sword1

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- sword1.cpp	8 Jan 2004 08:29:55 -0000	1.36
+++ sword1.cpp	11 Jan 2004 15:47:41 -0000	1.37
@@ -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 @@
 
 REGISTER_PLUGIN("Broken Sword", Engine_SWORD1_gameList, Engine_SWORD1_create, Engine_SWORD1_detectGames)
[...1248 lines suppressed...]
-		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 @@
 
 		_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 @@
 		cur = _system->get_msecs();
 	} while (cur < start + amount);
 }
+
+} // End of namespace Sword1

Index: sword1.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- sword1.h	6 Jan 2004 12:45:34 -0000	1.12
+++ sword1.h	11 Jan 2004 15:47:41 -0000	1.13
@@ -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 @@
 	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 @@
 	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

Index: sworddefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sworddefs.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- sworddefs.h	1 Jan 2004 18:00:34 -0000	1.12
+++ sworddefs.h	11 Jan 2004 15:47:41 -0000	1.13
@@ -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 @@
 #define SCR_menu_look (0*0x10000 + 24)
 #define SCR_icon_combine_script (0*0x10000 + 25)
 
+} // End of namespace Sword1
+ 
 #endif //SWORDDEFS_H

Index: swordres.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/swordres.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- swordres.h	6 Jan 2004 12:45:34 -0000	1.4
+++ swordres.h	11 Jan 2004 15:47:41 -0000	1.5
@@ -22,6 +22,8 @@
 #ifndef SWORDRES_H
 #define SWORDRES_H
 
+namespace Sword1 {
+
 // scripts
 	// standard
 #define SCRIPT0 				 0x01000000
@@ -5214,5 +5216,7 @@
 #define ROSTLK79 				 0x0E090010
 #define ROSTLK79CDT 			 0x0E090011
 	// 18 entities in TXTs, 18 in datafiles.
+
+} // End of namespace Sword1
 
 #endif //SWORDRES_H

Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/text.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- text.cpp	6 Jan 2004 12:45:34 -0000	1.7
+++ text.cpp	11 Jan 2004 15:47:41 -0000	1.8
@@ -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 @@
 	_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 @@
 	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 @@
 			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 @@
 	}
 }
 
-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 @@
 	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 @@
 	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 @@
 	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 @@
 		_textCount--;
 	}
 }
+
+} // End of namespace Sword1

Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/text.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- text.h	6 Jan 2004 12:45:34 -0000	1.2
+++ text.h	11 Jan 2004 15:47:41 -0000	1.3
@@ -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 @@
 	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);
@@ -54,5 +57,7 @@
 	ResMan *_resMan;
 	FrameHeader *_textBlocks[MAX_TEXT_OBS];
 };
+
+} // End of namespace Sword1 
 
 #endif //BSTEXT_H





More information about the Scummvm-git-logs mailing list