[Scummvm-cvs-logs] CVS: scummvm/queen bankman.cpp,1.9,1.10 bankman.h,1.6,1.7 command.cpp,1.80,1.81 cutaway.cpp,1.144,1.145 debug.cpp,1.13,1.14 debug.h,1.8,1.9 display.cpp,1.86,1.87 input.cpp,1.34,1.35 logic.cpp,1.216,1.217 logic.h,1.125,1.126

Gregory Montoir cyx at users.sourceforge.net
Mon May 9 11:27:07 CEST 2005


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

Modified Files:
	bankman.cpp bankman.h command.cpp cutaway.cpp debug.cpp 
	debug.h display.cpp input.cpp logic.cpp logic.h 
Log Message:
fixed debug areas display ; some minor cleanup

Index: bankman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/bankman.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- bankman.cpp	1 Jan 2005 16:09:07 -0000	1.9
+++ bankman.cpp	9 May 2005 18:25:24 -0000	1.10
@@ -28,7 +28,9 @@
 
 BankManager::BankManager(Resource *res) 
 	: _res(res) {
-	flush();
+	memset(_frames, 0, sizeof(_frames));
+	memset(_banks, 0, sizeof(_banks));
+	memset(_loadedBanks, 0, sizeof(_loadedBanks));
 }
 
 BankManager::~BankManager() {
@@ -112,12 +114,6 @@
 	_loadedBanks[bankslot][0] = '\0';
 }
 
-void BankManager::flush() {
-	memset(_frames, 0, sizeof(_frames));
-	memset(_banks, 0, sizeof(_banks));
-	memset(_loadedBanks, 0, sizeof(_loadedBanks));
-}
-
 BobFrame *BankManager::fetchFrame(uint32 index) {
 	debug(9, "BankManager::fetchFrame(%d)", index);
 	assert(index < MAX_FRAMES_NUMBER);

Index: bankman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/bankman.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- bankman.h	1 Jan 2005 16:09:07 -0000	1.6
+++ bankman.h	9 May 2005 18:25:24 -0000	1.7
@@ -47,9 +47,6 @@
 	//! close a bank
 	void close(uint32 bankslot);
 	
-	//! reset this BankManager
-	void flush();
-
 	//! get a reference to unpacked frame
 	BobFrame *fetchFrame(uint32 index);
 	

Index: command.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/command.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- command.cpp	8 May 2005 21:49:42 -0000	1.80
+++ command.cpp	9 May 2005 18:25:24 -0000	1.81
@@ -161,7 +161,7 @@
 		_cmdText.addObject(_vm->logic()->objectName(od->name));
 	}
 
-	// make sure that command is always highlighted when actioned!
+	// always highlight the current command when actioned
 	_cmdText.display(INK_CMD_SELECT);
 
 	_state.selNoun = _state.noun;
@@ -172,7 +172,7 @@
 		return;
 	}
 
-	// get the commands associated with object/item
+	// get the commands associated with this object/item
 	uint16 comMax = 0;
 	uint16 matchingCmds[MAX_MATCHING_CMDS];
 	CmdListData *cmdList = &_cmdList[1];
@@ -253,10 +253,6 @@
 			_state.verb = _vm->input()->keyVerb();
 			if (isVerbInv(_state.verb)) {
 				_state.noun = _state.selNoun = 0;
-				// Clear old noun and old verb in case we're pointing at an
-				// object (noun) or item (verb) and we want to use an item
-				// on it. This was the command will be redisplayed with the
-				// object/item that the cursor is currently on.
 				_state.oldNoun = 0;
 				_state.oldVerb = VERB_NONE;
 				grabSelectedItem();
@@ -361,7 +357,7 @@
 		setAreas(comId);
 	}
 
-	// Don't grab if action is TALK or WALK
+	// don't try to grab if action is TALK or WALK
 	if (_state.selAction != VERB_TALK_TO && _state.selAction != VERB_WALK_TO) {
 		int i;
 		for  (i = 0; i < 2; ++i) {
@@ -953,15 +949,11 @@
 
 int16 Command::setConditions(uint16 command, bool lastCmd) {
 	debug(9, "Command::setConditions(%d, %d)", command, lastCmd);
-	// Test conditions, if FAIL write &&  exit, Return -1
-	// if (Joe speaks before he returns, -2 is returned
-	// This way a -1 return will allow Joe to speak normal description
-
-	uint16 temp[21];
-	memset(temp, 0, sizeof(temp));
-	uint16 tempInd = 0;
-
+	
 	int16 ret = 0;
+	uint16 cmdState[21];
+	memset(cmdState, 0, sizeof(cmdState));
+	uint16 cmdStateCount = 0;
 	uint16 i;
 	CmdGameState *cmdGs = &_cmdGameState[1];
 	for (i = 1; i <= _numCmdGameState; ++i, ++cmdGs) {
@@ -974,8 +966,8 @@
 					break;
 				}
 			} else {
-				temp[tempInd] = i;
-				++tempInd;
+				cmdState[cmdStateCount] = i;
+				++cmdStateCount;
 			}
 		}
 	}
@@ -991,13 +983,14 @@
 			}
 			ret = -2;
 		} else {
+			// return -1 so Joe will be able to speak a normal description
 			ret = -1;
 		}
 	} else {
 		ret = 0;
 		// all tests were okay, now set gamestates
-		for (i = 0; i < tempInd; ++i) {
-			cmdGs = &_cmdGameState[temp[i]];
+		for (i = 0; i < cmdStateCount; ++i) {
+			cmdGs = &_cmdGameState[cmdState[i]];
 			_vm->logic()->gameState(ABS(cmdGs->gameStateSlot), cmdGs->gameStateValue);
 			// set return value for Joe to say something
 			ret = cmdGs->speakValue;
@@ -1010,8 +1003,7 @@
 	debug(9, "Command::setAreas(%d)", command);
 
 	CmdArea *cmdArea = &_cmdArea[1];
-	uint16 i;
-	for (i = 1; i <= _numCmdArea; ++i, ++cmdArea) {
+	for (uint16 i = 1; i <= _numCmdArea; ++i, ++cmdArea) {
 		if (cmdArea->id == command) {
 			uint16 areaNum = ABS(cmdArea->area);
 			Area *area = _vm->grid()->area(cmdArea->room, areaNum);
@@ -1030,8 +1022,7 @@
 	debug(9, "Command::setObjects(%d)", command);
 
 	CmdObject *cmdObj = &_cmdObject[1];
-	uint16 i;
-	for (i = 1; i <= _numCmdObject; ++i, ++cmdObj) {
+	for (uint16 i = 1; i <= _numCmdObject; ++i, ++cmdObj) {
 		if (cmdObj->id == command) {
 
 			// found an object
@@ -1101,10 +1092,9 @@
 void Command::setItems(uint16 command) {
 	debug(9, "Command::setItems(%d)", command);
 
-	CmdInventory *cmdInv = &_cmdInventory[1];
 	ItemData *items = _vm->logic()->itemData(0);
-	uint16 i;
-	for (i = 1; i <= _numCmdInventory; ++i, ++cmdInv) {
+	CmdInventory *cmdInv = &_cmdInventory[1];
+	for (uint16 i = 1; i <= _numCmdInventory; ++i, ++cmdInv) {
 		if (cmdInv->id == command) {
 			uint16 dstItem = ABS(cmdInv->dstItem);
 			// found an item

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- cutaway.cpp	8 May 2005 21:49:42 -0000	1.144
+++ cutaway.cpp	9 May 2005 18:25:25 -0000	1.145
@@ -151,8 +151,6 @@
 }
 
 void Cutaway::loadStrings(uint16 offset) {
-	int i,j;
-
 	int bankNameCount = READ_BE_UINT16(_fileData + offset);
 	offset += 2;
 
@@ -163,7 +161,7 @@
 		 the original source code.
 	 */
 
-	for (i = 0, j = 0; i < bankNameCount; i++) {
+	for (int i = 0, j = 0; i < bankNameCount; i++) {
 		Talk::getString(_fileData, offset, _bankNames[j], MAX_FILENAME_LENGTH);
 		if (_bankNames[j][0]) {
 			debug(6, "Bank name %i = '%s'", j, _bankNames[j]);

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/debug.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- debug.cpp	1 Jan 2005 16:09:07 -0000	1.13
+++ debug.cpp	9 May 2005 18:25:27 -0000	1.14
@@ -36,7 +36,7 @@
 namespace Queen {
 
 Debugger::Debugger(QueenEngine *vm) 
-	: _drawAreas(false), _vm(vm) {
+	: _vm(vm), _flags(0) {
 		
 	DCmd_Register("exit", &Debugger::Cmd_Exit);
 	DCmd_Register("help", &Debugger::Cmd_Help);
@@ -96,8 +96,8 @@
 }
 
 bool Debugger::Cmd_Areas(int argc, const char **argv) {
-	_drawAreas = !_drawAreas;
-	DebugPrintf("Room areas display %s\n", _drawAreas ? "on" : "off");
+	_flags ^= DF_DRAW_AREAS;
+	DebugPrintf("Room areas display %s\n", (_flags & DF_DRAW_AREAS) != 0 ? "on" : "off");
 	return true;
 }
 

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/debug.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- debug.h	1 Jan 2005 16:09:07 -0000	1.8
+++ debug.h	9 May 2005 18:25:27 -0000	1.9
@@ -33,7 +33,11 @@
 
 	Debugger(QueenEngine *vm);
 
-	bool _drawAreas;
+	int flags() const { return _flags; }
+	
+	enum {
+		DF_DRAW_AREAS = 1 << 0
+	};
 
 protected:
 
@@ -55,6 +59,7 @@
 private:
 
 	QueenEngine *_vm;
+	int _flags;
 };
 
 } // End of namespace Queen

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- display.cpp	8 May 2005 21:49:43 -0000	1.86
+++ display.cpp	9 May 2005 18:25:27 -0000	1.87
@@ -756,7 +756,7 @@
 void Display::readPCX(uint8 *dst, uint16 dstPitch, const uint8 *src, uint16 w, uint16 h) {
 	while (h--) {
 		uint8 *p = dst;
-		while (p < dst + w ) {
+		while (p < dst + w) {
 			uint8 col = *src++;
 			if ((col & 0xC0) == 0xC0) {
 				uint8 len = col & 0x3F;
@@ -939,14 +939,17 @@
 }
 
 void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) {
-	uint8 *p = _screenBuf;
 	int i;
 	for (i = y1; i <= y2; ++i) {
-		*(p + i * SCREEN_W + x1) = *(p + i * SCREEN_W + x2) = col;
+		_screenBuf[i * SCREEN_W + x1] = _screenBuf[i * SCREEN_W + x2] = col;
 	}
+	setDirtyBlock(x1, y1, 1, y2 - y1);
+	setDirtyBlock(x2, y1, 1, y2 - y1);
 	for (i = x1; i <= x2; ++i) {
-		*(p + y1 * SCREEN_W + i) = *(p + y2 * SCREEN_W + i) = col;
+		_screenBuf[y1 * SCREEN_W + i] = _screenBuf[y2 * SCREEN_W + i] = col;
 	}
+	setDirtyBlock(x1, y1, x2 - x1, 1);
+	setDirtyBlock(x1, y2, x2 - x1, 1);
 }
 
 void Display::shake(bool reset) {
@@ -1010,13 +1013,9 @@
 			c = *(p + SCREEN_W + 1);
 			break;
 		}
-		uint8 *buf = p;
-		int j = 2;
-		while (j--) {
-			memset(p, c, 2);
-			p += SCREEN_W;
-		}
-		_system->copyRectToScreen(buf, SCREEN_W, x, y, 2, 2);
+		memset(p, c, 2);
+		memset(p + SCREEN_W, c, 2);
+		_system->copyRectToScreen(p, SCREEN_W, x, y, 2, 2);
 		_system->updateScreen();
 		_vm->input()->delay(10);
 	}
@@ -1037,14 +1036,10 @@
 			uint8 p2 = *(p + SCREEN_W);
 			uint8 p3 = *(p + SCREEN_W + 1);
 			uint8 c = (p0 + p1 + p2 + p3) / 4;
-			uint8 *buf = p;
-			int j = 2;
-			while (j--) {
-				memset(p, c, 2);
-				p += SCREEN_W;
-			}
+			memset(p, c, 2);
+			memset(p + SCREEN_W, c, 2);
 			++i;
-			_system->copyRectToScreen(buf, SCREEN_W, x, y, 2, 2);
+			_system->copyRectToScreen(p, SCREEN_W, x, y, 2, 2);
 		}
 		_system->updateScreen();
 		_vm->input()->delay(10);

Index: input.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/input.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- input.cpp	1 Jan 2005 16:09:08 -0000	1.34
+++ input.cpp	9 May 2005 18:25:27 -0000	1.35
@@ -109,6 +109,7 @@
 					_inKey = event.kbd.keycode;
 				}
 				break;
+			
 			case OSystem::EVENT_MOUSEMOVE:
 				_mouse_x = event.mouse.x;
 				_mouse_y = event.mouse.y;

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -d -r1.216 -r1.217
--- logic.cpp	1 Jan 2005 16:09:08 -0000	1.216
+++ logic.cpp	9 May 2005 18:25:27 -0000	1.217
@@ -919,8 +919,8 @@
 	for (int i = 0; i < 4; ++i) {
 		uint16 itemNum = _inventoryItem[i];
 		if (itemNum != 0) {
-			// 1st object in inventory uses frame 8, 
-			// whereas 2nd, 3rd and 4th uses frame 9
+			// 1st object in inventory uses frame 9, 
+			// whereas 2nd, 3rd and 4th uses frame 8
 			uint16 dstFrame = (itemNum != 0) ? 8 : 9;
 			// unpack frame for object and draw it
 			_vm->bankMan()->unpack(_itemData[itemNum].frame, dstFrame, 14);
@@ -1213,7 +1213,7 @@
 	joe->frameNum = _vm->input()->mousePosX() / 36 + 45;
 
 	// bobs have been unpacked from animating objects, we don't need them
-	// to animate anymore ; so turn animating off
+	// to animate anymore ; so turn animation off
 	joe->animating = piton->animating = false;
 
 	_vm->update();
@@ -1297,7 +1297,7 @@
 	if (_credits)
 		_credits->update();
 
-	if (_vm->debugger()->_drawAreas) {
+	if (_vm->debugger()->flags() & Debugger::DF_DRAW_AREAS) {
 		_vm->grid()->drawZones();
 	}
 }

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- logic.h	1 Jan 2005 16:09:09 -0000	1.125
+++ logic.h	9 May 2005 18:25:28 -0000	1.126
@@ -159,6 +159,7 @@
 	//! play the specified cutaway
 	void playCutaway(const char *cutFile, char *next = NULL);
 
+	//! initialize the inventory
 	void inventorySetup();
 	
 	//! get the inventory item for the specified inventory slot
@@ -181,7 +182,7 @@
 	//! handle a particular event when Joe walks on this area
 	void handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataNum);
 
-	//! handle the pinnacle room (in jungle)
+	//! handle the pinnacle room (== room chooser in the jungle)
 	void handlePinnacleRoom();
 
 	void update();
@@ -189,6 +190,7 @@
 	void saveState(byte *&ptr);
 	void loadState(uint32 ver, byte *&ptr);
 
+	//! called after a save state has been loaded
 	void setupRestoredGame();
 
 	//! ugly hack from original code





More information about the Scummvm-git-logs mailing list