[Scummvm-cvs-logs] CVS: scummvm/bs2 anims.cpp,1.22,1.23 controls.cpp,1.23,1.24 controls.h,1.3,1.4 mem_view.cpp,1.12,1.13 memory.cpp,1.10,1.11 memory.h,1.4,1.5 mouse.cpp,1.20,1.21 mouse.h,1.2,1.3 resman.cpp,1.47,1.48 resman.h,1.6,1.7 speech.cpp,1.26,1.27 sword2.cpp,1.45,1.46

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Thu Oct 2 23:55:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv1864

Modified Files:
	anims.cpp controls.cpp controls.h mem_view.cpp memory.cpp 
	memory.h mouse.cpp mouse.h resman.cpp resman.h speech.cpp 
	sword2.cpp 
Log Message:
Some renaming (ironic in the light of Fingolfin's recent namespace
suggestion, but I prepared the patch long before reading the mail :-).

Also, the remaining parts of the control panel etc. have been moved into a
class of their own.

This is still work in progress. I'm well aware that some of the classes
aren't as well separated as they ought to be, and that using global
variables to keep track of the different classes probably isn't pretty.


Index: anims.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/anims.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- anims.cpp	1 Oct 2003 06:36:24 -0000	1.22
+++ anims.cpp	3 Oct 2003 06:54:44 -0000	1.23
@@ -547,7 +547,7 @@
 		sequence_text_list[line].speech_mem = NULL;
 		sequenceText[line]->speech = NULL;
 
-		if (speechSelected) {
+		if (gui._speechSelected) {
 			// speech is selected, so try that first
 
 			// set up path to speech cluster
@@ -572,7 +572,7 @@
 
 		// if we want subtitles, or speech failed to load
 
-		if (subtitles || !speechRunning) {
+		if (gui._subtitles || !speechRunning) {
 			// open text resource & get the line
 			text = FetchTextLine(res_man.open(text_res), local_text);
 			// make the sprite

Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/controls.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- controls.cpp	2 Oct 2003 17:43:00 -0000	1.23
+++ controls.cpp	3 Oct 2003 06:54:44 -0000	1.24
@@ -39,20 +39,11 @@
 #define	MAX_STRING_LEN		64	// 20 was too low; better to be safe ;)
 #define CHARACTER_OVERLAP	 2	// overlap characters by 3 pixels
 
-uint8 subtitles;
-uint8 speechSelected;
-uint8 stereoReversed = 0;
-
-int baseSlot = 0;
-
-uint8 current_graphics_level;
-
-int32 WriteOptionSettings(void);
-void Control_error(char* text);
-
 // our fonts start on SPACE character (32)
 #define SIZE_OF_CHAR_SET (256 - 32)
 
+Sword2Gui gui;
+
 enum {
 	kAlignLeft,
 	kAlignRight,
@@ -725,6 +716,8 @@
 	Sword2Button *_okButton;
 	Sword2Button *_cancelButton;
 
+	int32 writeOptionSettings(void);
+
 public:
 	Sword2OptionsDialog() {
 		_fontRenderer = new Sword2FontRenderer(controls_font_id);
@@ -782,11 +775,11 @@
 		registerWidget(_okButton);
 		registerWidget(_cancelButton);
 
-		ReadOptionSettings();
+		gui.readOptionSettings();
 
-		_objectLabelsSwitch->setValue(pointerTextSelected != 0);
-		_subtitlesSwitch->setValue(subtitles != 0);
-		_reverseStereoSwitch->setValue(stereoReversed != 0);
+		_objectLabelsSwitch->setValue(gui._pointerTextSelected != 0);
+		_subtitlesSwitch->setValue(gui._subtitles != 0);
+		_reverseStereoSwitch->setValue(gui._stereoReversed != 0);
 		_musicSwitch->setValue(g_sound->isMusicMute() == 0);
 		_speechSwitch->setValue(g_sound->isSpeechMute() == 0);
 		_fxSwitch->setValue(g_sound->isFxMute() == 0);
@@ -850,9 +843,9 @@
 		// is handled when the dialog is terminated.
 
 		if (widget == _reverseStereoSwitch) {
-			if (result != stereoReversed)
+			if (result != gui._stereoReversed)
 				g_sound->reverseStereo();
-			stereoReversed = result;
+			gui._stereoReversed = result;
 		} else if (widget == _musicSwitch) {
 			g_sound->muteMusic(result);
 		} else if (widget == _musicSlider) {
@@ -865,7 +858,7 @@
 			_fxSwitch->setValue(result != 0);
 		} else if (widget == _gfxSlider) {
 			_gfxPreview->setState(result);
-			UpdateGraphicsLevel(result);
+			gui.updateGraphicsLevel(result);
 		} else if (widget == _okButton) {
 			// Apply the changes
 			g_sound->muteMusic(_musicSwitch->getValue() == 0);
@@ -875,23 +868,56 @@
 			g_sound->setSpeechVolume(_speechSlider->getValue());
 			g_sound->setFxVolume(_fxSlider->getValue());
 
-			UpdateGraphicsLevel(_gfxSlider->getValue());
+			gui.updateGraphicsLevel(_gfxSlider->getValue());
 
-			subtitles = _subtitlesSwitch->getValue();
-			pointerTextSelected = _objectLabelsSwitch->getValue();
-			speechSelected = _speechSwitch->getValue();
-			stereoReversed = _reverseStereoSwitch->getValue();
+			gui._subtitles = _subtitlesSwitch->getValue();
+			gui._pointerTextSelected = _objectLabelsSwitch->getValue();
+			gui._speechSelected = _speechSwitch->getValue();
+			gui._stereoReversed = _reverseStereoSwitch->getValue();
 
-			WriteOptionSettings();
+			writeOptionSettings();
 			setResult(1);
 		} else if (widget == _cancelButton) {
 			// Revert the changes
-			ReadOptionSettings();
+			gui.readOptionSettings();
 			setResult(0);
 		}
 	}
 };
 
+int32 Sword2OptionsDialog::writeOptionSettings(void) {
+	uint8 buff[10];
+	char filename[256];
+	SaveFile *fp;
+	SaveFileManager *mgr = g_system->get_savefile_manager();
+	
+	sprintf(filename, "%s-settings.dat", g_sword2->_game_name);
+
+	buff[0] = g_sound->getMusicVolume();
+	buff[1] = g_sound->getSpeechVolume();
+	buff[2] = g_sound->getFxVolume();
+	buff[3] = g_sound->isMusicMute();
+	buff[4] = g_sound->isSpeechMute();
+	buff[5] = g_sound->isFxMute();
+	buff[6] = GetRenderType();
+	buff[7] = gui._subtitles;
+	buff[8] = gui._pointerTextSelected;
+	buff[9] = gui._stereoReversed;
+	
+	if (!(fp = mgr->open_savefile(filename, g_sword2->getSavePath(), true)))
+		return 1;
+
+	if (fp->write(buff, 10) != 10) {
+		delete fp;
+		delete mgr;
+		return 2;
+	}
+
+	delete fp;
+	delete mgr;
+	return 0;
+}
+
 enum {
 	kSaveDialog,
 	kLoadDialog
@@ -1015,6 +1041,8 @@
 	Sword2Button *_okButton;
 	Sword2Button *_cancelButton;
 
+	void saveLoadError(char *text);
+
 public:
 	Sword2SaveLoadDialog(int mode) : _mode(mode), _selectedSlot(-1) {
 		int i;
@@ -1080,13 +1108,13 @@
 
 	void updateSlots() {
 		for (int i = 0; i < 8; i++) {
-			Sword2Slot *slot = _slotButton[(baseSlot + i) % 8];
+			Sword2Slot *slot = _slotButton[(gui._baseSlot + i) % 8];
 			Sword2FontRenderer *fr;
 			uint8 description[SAVE_DESCRIPTION_LEN];
 
 			slot->setY(72 + i * 36);
 
-			if (baseSlot + i == _selectedSlot) {
+			if (gui._baseSlot + i == _selectedSlot) {
 				slot->setEditable(_mode == kSaveDialog);
 				slot->setState(1);
 				fr = _fontRenderer2;
@@ -1096,11 +1124,11 @@
 				fr = _fontRenderer1;
 			}
 
-			if (GetSaveDescription(baseSlot + i, description) == SR_OK) {
-				slot->setText(fr, baseSlot + i, (char *) description);
+			if (GetSaveDescription(gui._baseSlot + i, description) == SR_OK) {
+				slot->setText(fr, gui._baseSlot + i, (char *) description);
 				slot->setClickable(true);
 			} else {
-				slot->setText(fr, baseSlot + i, NULL);
+				slot->setText(fr, gui._baseSlot + i, NULL);
 				slot->setClickable(_mode == kSaveDialog);
 			}
 
@@ -1113,29 +1141,29 @@
 
 	virtual void onAction(Sword2Widget *widget, int result = 0) {
 		if (widget == _zupButton) {
-			if (baseSlot > 0) {
-				if (baseSlot >= 8)
-					baseSlot -= 8;
+			if (gui._baseSlot > 0) {
+				if (gui._baseSlot >= 8)
+					gui._baseSlot -= 8;
 				else
-					baseSlot = 0;
+					gui._baseSlot = 0;
 				updateSlots();
 			}
 		} else if (widget == _upButton) {
-			if (baseSlot > 0) {
-				baseSlot--;
+			if (gui._baseSlot > 0) {
+				gui._baseSlot--;
 				updateSlots();
 			}
 		} else if (widget == _downButton) {
-			if (baseSlot < 92) {
-				baseSlot++;
+			if (gui._baseSlot < 92) {
+				gui._baseSlot++;
 				updateSlots();
 			}
 		} else if (widget == _zdownButton) {
-			if (baseSlot < 92) {
-				if (baseSlot <= 84)
-					baseSlot += 8;
+			if (gui._baseSlot < 92) {
+				if (gui._baseSlot <= 84)
+					gui._baseSlot += 8;
 				else
-					baseSlot = 92;
+					gui._baseSlot = 92;
 				updateSlots();
 			}
 		} else if (widget == _okButton) {
@@ -1193,7 +1221,7 @@
 				}
 			} else {
 				if (result == kSelectSlot)
-					_selectedSlot = baseSlot + (slot->getY() - 72) / 35;
+					_selectedSlot = gui._baseSlot + (slot->getY() - 72) / 35;
 				else if (result == kDeselectSlot)
 					_selectedSlot = -1;
 
@@ -1221,7 +1249,7 @@
 		// but I doubt that will make any noticeable difference.
 
 		slot->paint();
-		_fontRenderer2->drawText(_editBuffer, 130, 78 + (_selectedSlot - baseSlot) * 36);
+		_fontRenderer2->drawText(_editBuffer, 130, 78 + (_selectedSlot - gui._baseSlot) * 36);
 	}
 
 	virtual void paint() {
@@ -1271,7 +1299,7 @@
 					break;
 				}
 
-				Control_error((char*) (FetchTextLine(res_man.open(textId / SIZE), textId & 0xffff) + 2));
+				saveLoadError((char*) (FetchTextLine(res_man.open(textId / SIZE), textId & 0xffff) + 2));
 				result = 0;
 			}
 		} else {
@@ -1292,7 +1320,7 @@
 					break;
 				}
 
-				Control_error((char *) (FetchTextLine(res_man.open(textId / SIZE), textId & 0xffff) + 2));
+				saveLoadError((char *) (FetchTextLine(res_man.open(textId / SIZE), textId & 0xffff) + 2));
 				result = 0;
 			} else {
 				// Prime system with a game cycle
@@ -1314,7 +1342,36 @@
 	}
 };
 
-uint32 Restore_control(void) {
+void Sword2SaveLoadDialog::saveLoadError(char* text) {
+	// Print a message on screen. Second parameter is duration.
+	DisplayMsg((uint8 *) text, 0);
+
+	// Wait for ESC or mouse click
+	while (1) {
+		_mouseEvent *me;
+
+		ServiceWindows();
+
+		if (KeyWaiting()) {
+			_keyboardEvent ke;
+
+			ReadKey(&ke);
+			if (ke.keycode == 27)
+				break;
+		}
+
+		me = MouseEvent();
+		if (me && (me->buttons & RD_LEFTBUTTONDOWN))
+			break;
+
+		g_system->delay_msecs(20);
+	}
+
+	// Remove the message.
+	RemoveMsg();
+}
+
+uint32 Sword2Gui::restoreControl(void) {
 	// returns 0 for no restore
 	//         1 for restored ok
 
@@ -1322,12 +1379,12 @@
 	return loadDialog.run();
 }
 
-void Save_control(void) {
+void Sword2Gui::saveControl(void) {
 	Sword2SaveLoadDialog saveDialog(kSaveDialog);
 	saveDialog.run();
 }
 
-void Quit_control(void) {
+void Sword2Gui::quitControl(void) {
 	Sword2MiniDialog quitDialog(149618692);	// quit text
 
 	if (!quitDialog.run()) {
@@ -1341,7 +1398,7 @@
 	exit(0);
 }
 
-void Restart_control(void) {
+void Sword2Gui::restartControl(void) {
 	uint32 temp_demo_flag;
 
 	Sword2MiniDialog restartDialog(149618693);	// restart text
@@ -1407,36 +1464,7 @@
  	this_screen.new_palette = 99;
 }
 
-void Control_error(char* text) {
-	// Print a message on screen. Second parameter is duration.
-	DisplayMsg((uint8 *) text, 0);
-
-	// Wait for ESC or mouse click
-	while (1) {
-		_mouseEvent *me;
-
-		ServiceWindows();
-
-		if (KeyWaiting()) {
-			_keyboardEvent ke;
-
-			ReadKey(&ke);
-			if (ke.keycode == 27)
-				break;
-		}
-
-		me = MouseEvent();
-		if (me && (me->buttons & RD_LEFTBUTTONDOWN))
-			break;
-
-		g_system->delay_msecs(20);
-	}
-
-	// Remove the message.
-	RemoveMsg();
-}
-
-int32 ReadOptionSettings(void) {
+int32 Sword2Gui::readOptionSettings(void) {
 	// settings file is 9 bytes long:
 	//   1 music volume
 	//   2 speech volume
@@ -1474,60 +1502,27 @@
 	g_sound->muteSpeech(buff[4]);
 	g_sound->muteFx(buff[5]);
 
-	UpdateGraphicsLevel(buff[6]);
+	updateGraphicsLevel(buff[6]);
 
-	speechSelected = !buff[4];
-	subtitles = buff[7];
-	pointerTextSelected = buff[8];
+	_speechSelected = !buff[4];
+	_subtitles = buff[7];
+	_pointerTextSelected = buff[8];
 
-	if (buff[9] != stereoReversed)
+	if (buff[9] != _stereoReversed)
 		g_sound->reverseStereo();
 
-	stereoReversed = buff[9];
-	return 0;
-}
-
-int32 WriteOptionSettings(void) {
-	uint8 buff[10];
-	char filename[256];
-	SaveFile *fp;
-	SaveFileManager *mgr = g_system->get_savefile_manager();
-	
-	sprintf(filename, "%s-settings.dat", g_sword2->_game_name);
-
-	buff[0] = g_sound->getMusicVolume();
-	buff[1] = g_sound->getSpeechVolume();
-	buff[2] = g_sound->getFxVolume();
-	buff[3] = g_sound->isMusicMute();
-	buff[4] = g_sound->isSpeechMute();
-	buff[5] = g_sound->isFxMute();
-	buff[6] = GetRenderType();
-	buff[7] = subtitles;
-	buff[8] = pointerTextSelected;
-	buff[9] = stereoReversed;
-	
-	if (!(fp = mgr->open_savefile(filename, g_sword2->getSavePath(), true)))
-		return 1;
-
-	if (fp->write(buff, 10) != 10) {
-		delete fp;
-		delete mgr;
-		return 2;
-	}
-
-	delete fp;
-	delete mgr;
+	gui._stereoReversed = buff[9];
 	return 0;
 }
 
-void Option_control(void) {
+void Sword2Gui::optionControl(void) {
 	Sword2OptionsDialog optionsDialog;
 
 	optionsDialog.run();
 	return;
 }
 
-void UpdateGraphicsLevel(uint8 newLevel) {
+void Sword2Gui::updateGraphicsLevel(uint8 newLevel) {
 	switch (newLevel) {
 	case 0:
 		// Lowest setting: no graphics fx
@@ -1561,5 +1556,5 @@
 	// cannot be done with dimmed palette so we turn down one notch while
 	// dimmed, if at top level)
 
-	current_graphics_level = newLevel;
+	_currentGraphicsLevel = newLevel;
 }

Index: controls.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/controls.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- controls.h	20 Sep 2003 16:39:17 -0000	1.3
+++ controls.h	3 Oct 2003 06:54:44 -0000	1.4
@@ -20,16 +20,28 @@
 #ifndef	_CONTROL_S
 #define	_CONTROL_S
 
-uint32 Restore_control(void);
-void Save_control(void);
-void Quit_control(void);
-void Restart_control(void);
-void Option_control(void);
-int32 ReadOptionSettings(void);
-void UpdateGraphicsLevel(uint8 newLevel);
+class Sword2Gui {
+public:
+	int _baseSlot;
+	uint8 _currentGraphicsLevel;
 
-extern uint8 subtitles;			// text selected
-extern uint8 speechSelected;
-extern uint8 current_graphics_level;
+	uint8 _subtitles;
+	uint8 _speechSelected;
+	uint8 _stereoReversed;
+	uint8 _pointerTextSelected;
+
+	Sword2Gui() : _baseSlot(0), _stereoReversed(0),
+		_pointerTextSelected(0) {}
+
+	uint32 restoreControl(void);
+	void saveControl(void);
+	void quitControl(void);
+	void restartControl(void);
+	void optionControl(void);
+	int32 readOptionSettings(void);
+	void updateGraphicsLevel(uint8 newLevel);
+};
+
+extern Sword2Gui gui;
 
 #endif

Index: mem_view.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mem_view.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mem_view.cpp	30 Sep 2003 14:37:42 -0000	1.12
+++ mem_view.cpp	3 Oct 2003 06:54:44 -0000	1.13
@@ -27,7 +27,7 @@
 // has to be global because a local in Fetch_mem_owner is destroyed on exit
 char buf[50];
 
-void MemoryManager::displayMemory(void) {
+void Sword2MemoryManager::displayMemory(void) {
 	int pass, found_end, k, j, free = 0;
 	_standardHeader	*file_header;
 	int scrolls = 0;
@@ -120,7 +120,7 @@
 		(free * 100) / _totalFreeMemory);
 }
 
-const char *MemoryManager::fetchOwner(uint32 uid) {
+const char *Sword2MemoryManager::fetchOwner(uint32 uid) {
 	switch (uid) {
 	case UID_memman:
 		return "MEMMAN";
@@ -146,7 +146,7 @@
 	}
 }
 
-void MemoryManager::memoryString(char *string) {
+void Sword2MemoryManager::memoryString(char *string) {
 	int blockNo = _baseMemBlock;
 	int blocksUsed = 0;
 	int mem_free = 0;

Index: memory.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/memory.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- memory.cpp	30 Sep 2003 14:37:42 -0000	1.10
+++ memory.cpp	3 Oct 2003 06:54:44 -0000	1.11
@@ -43,17 +43,17 @@
 #include "memory.h"
 #include "resman.h"
 
-MemoryManager memory;
+Sword2MemoryManager memory;
 
 #define MEMORY_POOL (1024 * 12000)
 
 // #define MEMDEBUG 1
 
-void MemoryManager::exit(void) {
+void Sword2MemoryManager::exit(void) {
 	free(_freeMemman);
 }
 
-void MemoryManager::init(void) {
+void Sword2MemoryManager::init(void) {
 	uint32 j;
 	uint8 *memory_base;
 
@@ -89,7 +89,7 @@
 	_baseMemBlock = 0;			// for now
 }
 
-mem *MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id) {
+mem *Sword2MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id) {
 	// allocate a block of memory - locked or float
 
 	// returns 0 if fails to allocate the memory
@@ -223,7 +223,7 @@
 	return &_memList[nu_block];
 }
 
-void MemoryManager::freeMemory(mem *block) {
+void Sword2MemoryManager::freeMemory(mem *block) {
 	// kill a block of memory - which was presumably floating or locked
 	// once you've done this the memory may be recycled
 
@@ -235,7 +235,7 @@
 #endif
 }
 
-void MemoryManager::floatMemory(mem *block) {
+void Sword2MemoryManager::floatMemory(mem *block) {
 	// set a block to float
 	// wont be trashed but will move around in memory
 
@@ -246,7 +246,7 @@
 #endif
 }
 
-void MemoryManager::lockMemory(mem *block) {
+void Sword2MemoryManager::lockMemory(mem *block) {
 	// set a block to lock
 	// wont be moved - don't lock memory for any longer than necessary
 	// unless you know the locked memory is at the bottom of the heap
@@ -261,7 +261,7 @@
 #endif
 }
 
-int32 MemoryManager::defragMemory(uint32 req_size) {
+int32 Sword2MemoryManager::defragMemory(uint32 req_size) {
 	// moves floating blocks down and/or merges free blocks until a large
 	// enough space is found or there is nothing left to do and a big
 	// enough block cannot be found we stop when we find/create a large
@@ -420,7 +420,7 @@
 	return -1;	//no luck, couldn't find a big enough block
 }
 
-void MemoryManager::debugMemory(void) {
+void Sword2MemoryManager::debugMemory(void) {
 	// gets called with lowLevelAlloc, Mem_free, Mem_lock & Mem_float if
 	// MEMDEBUG has been #defined otherwise can be called at any time
 	// anywhere else
@@ -458,7 +458,7 @@
 	} while (j != -1);
 }
 
-mem *MemoryManager::allocMemory(uint32 size, uint32 type, uint32 unique_id) {
+mem *Sword2MemoryManager::allocMemory(uint32 size, uint32 type, uint32 unique_id) {
 	// the high level allocator
 
 	// can ask the resman to remove old resources to make space - will
@@ -497,7 +497,7 @@
 // Maximum allowed wasted memory.
 #define MAX_WASTAGE 51200
 
-int32 MemoryManager::virtualDefrag(uint32 size) {
+int32 Sword2MemoryManager::virtualDefrag(uint32 size) {
 	// Virutually defrags memory...
 	//
 	// Used to determine if there is potentially are large enough free

Index: memory.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/memory.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- memory.h	30 Sep 2003 14:37:42 -0000	1.4
+++ memory.h	3 Oct 2003 06:54:44 -0000	1.5
@@ -60,7 +60,7 @@
 #define	UID_savegame_buffer		0xfffffff6
 #define UID_restoregame_buffer		0xfffffff5
 
-class MemoryManager {
+class Sword2MemoryManager {
 private:
 	// Address of init malloc to be freed later
 	uint8 *_freeMemman;
@@ -100,6 +100,6 @@
 	void displayMemory(void);
 };
 
-extern MemoryManager memory;
+extern Sword2MemoryManager memory;
 
 #endif

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mouse.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mouse.cpp	1 Oct 2003 06:36:25 -0000	1.20
+++ mouse.cpp	3 Oct 2003 06:54:44 -0000	1.21
@@ -99,7 +99,6 @@
 uint32 button_click = 0;
 
 uint32 pointer_text_bloc_no = 0;
-uint32 pointerTextSelected = 0;
 
 uint32 player_activity_delay = 0;	// player activity delay counter
 
@@ -241,19 +240,19 @@
 				// call the relevent screen
 				switch (hit) {
 				case 0:
-					Option_control();
+					gui.optionControl();
 					break;
 				case 1:
-					Quit_control();
+					gui.quitControl();
 					break;
 				case 2:
-					Save_control();
+					gui.saveControl();
 					break;
 				case 3:
-					Restore_control();
+					gui.restoreControl();
 					break;
 				case 4:
-					Restart_control();
+					gui.restartControl();
 					break;
 				}
 
@@ -880,7 +879,7 @@
 	int16 xOffset, yOffset;
 	uint8 justification;
 
-	if (pointerTextSelected) {
+	if (gui._pointerTextSelected) {
 		if (textId) {
 			// check what the pointer is, to set offsets
 			// correctly for text position

Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mouse.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mouse.h	19 Sep 2003 16:08:54 -0000	1.2
+++ mouse.h	3 Oct 2003 06:54:44 -0000	1.3
@@ -80,8 +80,6 @@
 //last minute for pause mode
 extern uint32 real_luggage_item;
 
-extern uint32 pointerTextSelected;
-
 void Reset_mouse_list(void);
 
 void Normal_mouse(void);

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- resman.cpp	30 Sep 2003 14:37:42 -0000	1.47
+++ resman.cpp	3 Oct 2003 06:54:44 -0000	1.48
@@ -59,7 +59,7 @@
 
 #define BUFFERSIZE	4096
 
-ResourceManager	res_man;	//declare the object global
+Sword2ResourceManager	res_man;	//declare the object global
 
 // ---------------------------------------------------------------------------
 //
@@ -90,7 +90,7 @@
 
 // FIXME: Should init() / exit() be moved to constructor / destructor instead?
 
-void ResourceManager::init(void) {
+void Sword2ResourceManager::init(void) {
 	// We read in the resource info which tells us the names of the
 	// resource cluster files ultimately, although there might be groups
 	// within the clusters at this point it makes no difference. We only
@@ -240,7 +240,7 @@
 		file.close();
 }
 
-void ResourceManager::exit(void) {
+void Sword2ResourceManager::exit(void) {
 	// free up our mallocs
 	free(_resList);
 	free(_age);
@@ -433,7 +433,7 @@
 	}
 }
 
-uint8 *ResourceManager::open(uint32 res) {
+uint8 *Sword2ResourceManager::open(uint32 res) {
 	// returns ad of resource. Loads if not in memory
 	// retains a count
 	// resource can be aged out of memory if count = 0
@@ -563,7 +563,7 @@
 	return (uint8 *) _resList[res]->ad;
 }
 
-uint8 ResourceManager::checkValid(uint32 res) {
+uint8 Sword2ResourceManager::checkValid(uint32 res) {
 	// returns '1' if resource is valid, otherwise returns '0'
 	// used in startup.cpp to ignore invalid screen-manager resources
 
@@ -584,7 +584,7 @@
 	return 1;
 }
 
-void ResourceManager::nextCycle(void) {
+void Sword2ResourceManager::nextCycle(void) {
 	// increment the cycle and calculate actual per-cycle memory useage
 
 #ifdef _SWORD2_DEBUG
@@ -614,12 +614,12 @@
 		_resTime++;
 }
 
-uint32 ResourceManager::fetchUsage(void) {
+uint32 Sword2ResourceManager::fetchUsage(void) {
 	// returns memory usage previous cycle
 	return _currentMemoryUsage;
 }
 
-void ResourceManager::close(uint32 res) {
+void Sword2ResourceManager::close(uint32 res) {
 	// decrements the count
 	// resource floats when count = 0
 
@@ -642,7 +642,7 @@
 	}
 }
 
-uint32 ResourceManager::fetchLen(uint32 res) {
+uint32 Sword2ResourceManager::fetchLen(uint32 res) {
 	// returns the total file length of a resource - i.e. all headers are
 	// included too
 
@@ -675,23 +675,23 @@
 	return len;
 }
 
-char *ResourceManager::fetchCluster(uint32 res) {
+char *Sword2ResourceManager::fetchCluster(uint32 res) {
 	// returns a pointer to the ascii name of the cluster file which
 	// contains resource res
 	return _resourceFiles[_resConvTable[res * 2]];
 }
 
-uint32 ResourceManager::fetchAge(uint32 res) {
+uint32 Sword2ResourceManager::fetchAge(uint32 res) {
 	// return the age of res
 	return _age[res];
 }
 
-uint32 ResourceManager::fetchCount(uint32 res) {
+uint32 Sword2ResourceManager::fetchCount(uint32 res) {
 	// return the open count of res
 	return _count[res];
 }
 
-uint32 ResourceManager::helpTheAgedOut(void) {
+uint32 Sword2ResourceManager::helpTheAgedOut(void) {
 	// remove from memory the oldest closed resource
 
 	uint32 oldest_res;	// holds id of oldest found so far when we have to chuck stuff out of memory
@@ -733,7 +733,7 @@
 	return _resList[oldest_res]->size;	// return bytes freed
 }
 
-void ResourceManager::printConsoleClusters(void) {
+void Sword2ResourceManager::printConsoleClusters(void) {
 	uint32 j;
 
 	if (_totalClusters) {
@@ -746,7 +746,7 @@
 	Scroll_console();
 }
 
-void ResourceManager::examine(uint8 *input) {
+void Sword2ResourceManager::examine(uint8 *input) {
 	uint32 j = 0;
 	uint32 res;
 	_standardHeader	*file_header;
@@ -859,7 +859,7 @@
 	}
 }
 
-void ResourceManager::kill(uint8 *input) {
+void Sword2ResourceManager::kill(uint8 *input) {
 	int j = 0;
 	uint32 res;
 
@@ -897,7 +897,7 @@
 	}
 }
 
-void ResourceManager::remove(uint32 res) {
+void Sword2ResourceManager::remove(uint32 res) {
 	if (_age[res]) {
 		_age[res] = 0;			// effectively gone from _resList
 		memory.freeMemory(_resList[res]);	// release the memory too
@@ -906,7 +906,7 @@
 		debug(5, "remove(%d) not even in memory!", res);
 }
 
-void ResourceManager::removeAll(void) {
+void Sword2ResourceManager::removeAll(void) {
 	// remove all res files from memory - ready for a total restart
 	// including player object & global variables resource
 
@@ -926,7 +926,7 @@
 	} while	(j != -1);
 }
 
-void ResourceManager::killAll(uint8 wantInfo) {
+void Sword2ResourceManager::killAll(uint8 wantInfo) {
 	// remove all res files from memory
 	// its quicker to search the mem blocs for res files than search
 	// resource lists for those in memory
@@ -999,7 +999,7 @@
 // disappear forever, or some plaster-filled holes in sand to crash the game &
 // get James in trouble again.
 
-void ResourceManager::killAllObjects(uint8 wantInfo) {
+void Sword2ResourceManager::killAllObjects(uint8 wantInfo) {
 	// remove all object res files from memory, excluding George
 	// its quicker to search the mem blocs for res files than search
 	// resource lists for those in memory
@@ -1063,7 +1063,7 @@
 		Print_to_console(" expelled %d object resource(s)", nuked);
 }
 
-void ResourceManager::cacheNewCluster(uint32 newCluster) {
+void Sword2ResourceManager::cacheNewCluster(uint32 newCluster) {
 	// Stop any music from streaming off the CD before we start the
 	// cluster-copy!
 	//
@@ -1298,7 +1298,7 @@
 	fclose(file);
 }
 
-void ResourceManager::getCd(int cd) {
+void Sword2ResourceManager::getCd(int cd) {
 	// TODO support a seperate path for cd data?
 	
 	bool done = false;

Index: resman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- resman.h	30 Sep 2003 14:37:42 -0000	1.6
+++ resman.h	3 Oct 2003 06:54:44 -0000	1.7
@@ -24,7 +24,7 @@
 
 #define	MAX_res_files	20
 
-class ResourceManager {
+class Sword2ResourceManager {
 public:
 	void init(void);		// read in the config file
 	void exit(void);
@@ -103,6 +103,6 @@
 	char _cdDrives[24];
 };							
 
-extern ResourceManager res_man;	//declare the object global
+extern Sword2ResourceManager res_man;	//declare the object global
 
 #endif

Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/speech.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- speech.cpp	1 Oct 2003 06:36:25 -0000	1.26
+++ speech.cpp	3 Oct 2003 06:54:44 -0000	1.27
@@ -976,7 +976,7 @@
 		// for this line either, then just quit back to script right
 		// now!
 
-		if (subtitles == 0 && WantSpeechForLine(params[S_WAV]) == 0)
+		if (gui._subtitles == 0 && WantSpeechForLine(params[S_WAV]) == 0)
 			return IR_CONT;
 
 		if (cycle_skip == 0) {
@@ -1143,7 +1143,7 @@
 		// if speech is selected, and this line is allowed speech
 		// (not if it's an fx subtitle!)
 
-		if (speechSelected && WantSpeechForLine(officialTextNumber)) {
+		if (gui._speechSelected && WantSpeechForLine(officialTextNumber)) {
 			// if the wavId paramter is zero because not yet
 			// compiled into speech command, we can still get it
 			// from the 1st 2 chars of the text line
@@ -1214,7 +1214,7 @@
 		}
 
 		// if we want subtitles, or speech failed to load
-		if (subtitles || speechRunning == 0) {
+		if (gui._subtitles || speechRunning == 0) {
 			// then we're going to show the text
 			textRunning = 1;
 

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- sword2.cpp	30 Sep 2003 14:37:42 -0000	1.45
+++ sword2.cpp	3 Oct 2003 06:54:44 -0000	1.46
@@ -287,8 +287,8 @@
 		return;
 	}
 
-	debug(5, "CALLING: ReadOptionSettings");
-	ReadOptionSettings();	//restore the menu settings
+	debug(5, "CALLING: readOptionSettings");
+	gui.readOptionSettings();
 
 	debug(5, "CALLING: InitialiseGame");
 	if (InitialiseGame()) {
@@ -301,7 +301,7 @@
 			RestoreGame(_saveSlot);
 		else { // show restore menu
 			Set_mouse(NORMAL_MOUSE_ID);
-			if (!Restore_control())
+			if (!gui.restoreControl())
 				Start_game();
 		}
 	} else
@@ -508,8 +508,8 @@
 	// if level at max, turn down because palette-matching won't work
 	// when dimmed
 
-	if (current_graphics_level == 3) {
-		UpdateGraphicsLevel(2);
+	if (gui._currentGraphicsLevel == 3) {
+		gui.updateGraphicsLevel(2);
 		graphics_level_fudged = 1;
 	}
 
@@ -531,12 +531,12 @@
 
 	UnpauseAllSound();
 
-	// put back game screen palette; see Build_display.cpp (James26jun97)
+	// put back game screen palette; see Build_display.cpp
 	SetFullPalette(0xffffffff);
 
 	// If graphics level at max, turn up again
  	if (graphics_level_fudged) {
-		UpdateGraphicsLevel(3);
+		gui.updateGraphicsLevel(3);
 		graphics_level_fudged = 0;
 	}
 





More information about the Scummvm-git-logs mailing list