[Scummvm-cvs-logs] CVS: scummvm/sword2 controls.cpp,1.86,1.87 controls.h,1.18,1.19 mouse.cpp,1.67,1.68 resman.h,1.24,1.25 sword2.cpp,1.136,1.137

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Mon Feb 21 00:17:29 CET 2005


Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30793

Modified Files:
	controls.cpp controls.h mouse.cpp resman.h sword2.cpp 
Log Message:
Some cleanup and renaming. (It was confusing to see "load" sometimes and
"restore" other times.) The save/restore dialog now has two separate
classes, though they both inherit from the old combined class of course.


Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/controls.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- controls.cpp	20 Feb 2005 15:38:47 -0000	1.86
+++ controls.cpp	21 Feb 2005 08:16:45 -0000	1.87
@@ -251,6 +251,9 @@
 	_vm->_screen->setFullPalette(CONTROL_PANEL_PALETTE);
 	_vm->_screen->clearScene();
 
+	// Usually the mouse pointer will already be "normal", but not always.
+	_vm->_mouse->setMouse(NORMAL_MOUSE_ID);
+
 	// HACK: Since the dialogs don't do normal scene updates we need to
 	// trigger a full redraw manually.
 
@@ -829,9 +832,9 @@
 		if (_vm->_quit)
 			return 0;
 
-		SaveLoadDialog loadDialog(_vm, kLoadDialog);
+		RestoreDialog restoreDialog(_vm);
 
-		if (loadDialog.runModal())
+		if (restoreDialog.runModal())
 			return 0;
 
 		if (_vm->_quit)
@@ -1097,7 +1100,7 @@
 				_parent->onAction(this, kSelectSlot);
 				if (_mode == kSaveDialog)
 					_parent->onAction(this, kStartEditing);
-			} else if (_mode == kLoadDialog) {
+			} else if (_mode == kRestoreDialog) {
 				setState(0);
 				_parent->onAction(this, kDeselectSlot);
 			}
@@ -1141,7 +1144,7 @@
 	}
 };
 
-SaveLoadDialog::SaveLoadDialog(Sword2Engine *vm, int mode) : Dialog(vm) {
+SaveRestoreDialog::SaveRestoreDialog(Sword2Engine *vm, int mode) : Dialog(vm) {
 	int i;
 
 	_mode = mode;
@@ -1198,7 +1201,7 @@
 	registerWidget(_cancelButton);
 }
 
-SaveLoadDialog::~SaveLoadDialog() {
+SaveRestoreDialog::~SaveRestoreDialog() {
 	delete _fr1;
 	delete _fr2;
 }
@@ -1206,7 +1209,7 @@
 // There aren't really a hundred different button objects of course, there are
 // only eight. Re-arrange them to simulate scrolling.
 
-void SaveLoadDialog::updateSlots() {
+void SaveRestoreDialog::updateSlots() {
 	for (int i = 0; i < 8; i++) {
 		Slot *slot = _slotButton[(baseSlot + i) % 8];
 		FontRendererGui *fr;
@@ -1239,7 +1242,7 @@
 	}
 }
 
-void SaveLoadDialog::drawEditBuffer(Slot *slot) {
+void SaveRestoreDialog::drawEditBuffer(Slot *slot) {
 	if (_selectedSlot == -1)
 		return;
 
@@ -1250,7 +1253,7 @@
 	_fr2->drawText(_editBuffer, 130, 78 + (_selectedSlot - baseSlot) * 36);
 }
 
-void SaveLoadDialog::onAction(Widget *widget, int result) {
+void SaveRestoreDialog::onAction(Widget *widget, int result) {
 	if (widget == _zupButton) {
 		if (baseSlot > 0) {
 			if (baseSlot >= 8)
@@ -1362,14 +1365,14 @@
 	}
 }
 
-void SaveLoadDialog::paint() {
+void SaveRestoreDialog::paint() {
 	Dialog::paint();
 
-	_fr1->drawText((_mode == kLoadDialog) ? TEXT_RESTORE : TEXT_SAVE, 165, 377);
+	_fr1->drawText((_mode == kRestoreDialog) ? TEXT_RESTORE : TEXT_SAVE, 165, 377);
 	_fr1->drawText(TEXT_CANCEL, 382, 377);
 }
 
-void SaveLoadDialog::setResult(int result) {
+void SaveRestoreDialog::setResult(int result) {
 	if (result) {
 		if (_selectedSlot == -1)
 			return;
@@ -1385,7 +1388,7 @@
 	Dialog::setResult(result);
 }
 
-int SaveLoadDialog::runModal() {
+int SaveRestoreDialog::runModal() {
 	if (_mode == kSaveDialog)
 		_vm->_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
 
@@ -1400,7 +1403,7 @@
 			if (_vm->saveGame(_selectedSlot, (byte *) &_editBuffer[_firstPos]) != SR_OK)
 				result = 0;
 			break;
-		case kLoadDialog:
+		case kRestoreDialog:
 			if (_vm->restoreGame(_selectedSlot) != SR_OK)
 				result = 0;
 			break;

Index: controls.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/controls.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- controls.h	20 Feb 2005 15:38:47 -0000	1.18
+++ controls.h	21 Feb 2005 08:16:47 -0000	1.19
@@ -38,7 +38,7 @@
 
 enum {
 	kSaveDialog,
-	kLoadDialog
+	kRestoreDialog
 };
 
 /**
@@ -96,7 +96,7 @@
 	virtual void onAction(Widget *widget, int result = 0);
 };
 
-class SaveLoadDialog : public Dialog {
+class SaveRestoreDialog : public Dialog {
 private:
 	int _mode, _selectedSlot;
 	byte _editBuffer[SAVE_DESCRIPTION_LEN];
@@ -115,8 +115,8 @@
 	Button *_cancelButton;
 
 public:
-	SaveLoadDialog(Sword2Engine *vm, int mode);
-	~SaveLoadDialog();
+	SaveRestoreDialog(Sword2Engine *vm, int mode);
+	~SaveRestoreDialog();
 
 	void updateSlots();
 	void drawEditBuffer(Slot *slot);
@@ -166,6 +166,16 @@
 	QuitDialog(Sword2Engine *vm);
 	virtual int runModal();
 };
+
+class SaveDialog : public SaveRestoreDialog {
+public:
+	SaveDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kSaveDialog) {}
+};
+
+class RestoreDialog : public SaveRestoreDialog {
+public:
+	RestoreDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kRestoreDialog) {}
+};
  
 } // End of namespace Sword2
 

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/mouse.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- mouse.cpp	20 Feb 2005 15:38:47 -0000	1.67
+++ mouse.cpp	21 Feb 2005 08:16:47 -0000	1.68
@@ -339,13 +339,13 @@
 		break;
 	case 2:
 		{
-			SaveLoadDialog dialog(_vm, kSaveDialog);
+			SaveDialog dialog(_vm);
 			dialog.runModal();
 		}
 		break;
 	case 3:
 		{
-			SaveLoadDialog dialog(_vm, kLoadDialog);
+			RestoreDialog dialog(_vm);
 			dialog.runModal();
 		}
 		break;

Index: resman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- resman.h	21 Feb 2005 02:29:17 -0000	1.24
+++ resman.h	21 Feb 2005 08:16:49 -0000	1.25
@@ -26,7 +26,7 @@
 namespace Sword2 {
 
 #define MAX_MEM_CACHE (8 * 1024 * 1024) // we keep up to 8 megs of resource data files in memory
-#define	MAX_res_files	20
+#define	MAX_res_files 20
 
 class Sword2Engine;
 
@@ -90,7 +90,7 @@
 	ResourceFile _resFiles[MAX_res_files];
 	Resource *_resList;
 
-    Resource *_cacheStart, *_cacheEnd;
+	Resource *_cacheStart, *_cacheEnd;
 	uint32 _usedMem; // amount of used memory in bytes
 };
 

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- sword2.cpp	21 Feb 2005 02:29:18 -0000	1.136
+++ sword2.cpp	21 Feb 2005 08:16:50 -0000	1.137
@@ -235,7 +235,7 @@
 	_system->endGFXTransaction();
 
 	// Create the debugger as early as possible (but not before the
-	// graphics object!) so that errors can be displayed in it. In
+	// screen object!) so that errors can be displayed in it. In
 	// particular, we want errors about missing files to be clearly
 	// visible to the user.
 
@@ -273,10 +273,7 @@
 		if (saveExists(_saveSlot))
 			restoreGame(_saveSlot);
 		else {
-			SaveLoadDialog dialog(this, kLoadDialog);
-
-			_mouse->setMouse(NORMAL_MOUSE_ID);
-
+			RestoreDialog dialog(this);
 			if (!dialog.runModal())
 				startGame();
 		}





More information about the Scummvm-git-logs mailing list