[Scummvm-cvs-logs] SF.net SVN: scummvm:[43072] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Wed Aug 5 19:58:14 CEST 2009


Revision: 43072
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43072&view=rev
Author:   dkasak13
Date:     2009-08-05 17:58:14 +0000 (Wed, 05 Aug 2009)

Log Message:
-----------
* Made some type changes to struct/class members in game.cpp (uint -> int and uint16 -> uint)
* Added enum constant kNoEscRoom for rooms that have no escape room defined
* Fixed crash when ESC is pressed in rooms which have no escape room defined
* Renamed kNotFound (used as a return value for Game::getObjectWithAnimation) to kObjectNotFound for clarity.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/game.h

Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-08-05 17:29:02 UTC (rev 43071)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp	2009-08-05 17:58:14 UTC (rev 43072)
@@ -202,9 +202,14 @@
 				_game->_roomChange = true;
 			}
 			else if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
-				_game->setRoomNum(_game->getEscRoom());
-				_game->setGateNum(0);
-				_game->_roomChange = true;
+				int escRoom = _game->getEscRoom();
+
+				// Check if there is an escape room defined for the current room
+				if (escRoom != kNoEscRoom) {				
+					_game->setRoomNum(_game->getEscRoom());
+					_game->setGateNum(0);
+					_game->_roomChange = true;
+				}
 			}
 			// Show walking map toggle
 			else if (event.kbd.keycode == Common::KEYCODE_w) { 

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp	2009-08-05 17:29:02 UTC (rev 43071)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp	2009-08-05 17:58:14 UTC (rev 43072)
@@ -264,7 +264,7 @@
 
 			// If there is an object under the cursor, display its title and enable
 			// executing its look and use scripts
-			if (curObject != kNotFound) {					
+			if (curObject != kObjectNotFound) {					
 				// Mark dirty rectangle to update the text
 				titleAnim->markDirtyRect(surface);	
 
@@ -337,7 +337,7 @@
 		}
 	}
 
-	return kNotFound;
+	return kObjectNotFound;
 }
 	
 void Game::walkHero(int x, int y) {

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-08-05 17:29:02 UTC (rev 43071)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-08-05 17:58:14 UTC (rev 43072)
@@ -43,10 +43,19 @@
 	personSize = sizeof(uint16) * 2 + sizeof(byte)
 };
 
+
+// Used as a return value for Game::getObjectWithAnimation() if no object
+// owns the animation in question
 enum {
-	kNotFound = -1
+	kObjectNotFound = -1
 };
 
+// Used as the value of the _escRoom field of the current room if there is 
+// no escape room defined
+enum {
+	kNoEscRoom = -1
+};
+
 enum SpeechConstants {
 	kBaseSpeechDuration = 200,
 	kSpeechTimeUnit = 400
@@ -95,9 +104,9 @@
 	bool _imInit, _imLook, _imUse;
 	byte _walkDir;
 	byte _z;
-	uint16 _lookX, _lookY, _useX, _useY;
+	uint _lookX, _lookY, _useX, _useY;
 	byte _lookDir, _useDir;
-	uint16 _absNum;
+	uint _absNum;
 	Common::Array<int> _anims;
 	GPL2Program _program;
 	Common::String _title;
@@ -106,26 +115,26 @@
 };
 
 struct GameInfo {
-	byte _startRoom;
-	byte _mapRoom;
-	uint16 _numObjects;
-	uint16 _numIcons;
+	int _startRoom;
+	int _mapRoom;
+	uint _numObjects;
+	uint _numIcons;
 	byte _numVariables;
 	byte _numPersons;
 	byte _numDialogs;
-	uint16 _maxIconWidth, _maxIconHeight;
-	uint16 _musicLength;
-	uint16 _crc[4];
-	uint16 _numDialogBlocks;
+	uint _maxIconWidth, _maxIconHeight;
+	uint _musicLength;
+	uint _crc[4];
+	uint _numDialogBlocks;
 };
 
 struct Person {
-	uint16 _x, _y;
+	uint _x, _y;
 	byte _fontColour;
 };
 
 struct Room {
-	byte _roomNum;	
+	int _roomNum;	
 	byte _music;
 	WalkingMap _walkingMap;
 	byte _palette;
@@ -134,7 +143,7 @@
 	bool _imInit, _imLook, _imUse;
 	bool _mouseOn, _heroOn;
 	double _pers0, _persStep;
-	byte _escRoom;
+	int _escRoom;
 	byte _numGates;
 	Common::Array<int> _gates;
 	GPL2Program _program;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list