[Scummvm-cvs-logs] CVS: scummvm/queen defs.h,1.49,1.50 display.cpp,1.95,1.96 display.h,1.55,1.56 logic.cpp,1.223,1.224

Gregory Montoir cyx at users.sourceforge.net
Fri Jan 27 11:37:01 CET 2006


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

Modified Files:
	defs.h display.cpp display.h logic.cpp 
Log Message:
Minor cleanup.

Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- defs.h	18 Jan 2006 17:39:37 -0000	1.49
+++ defs.h	27 Jan 2006 19:35:55 -0000	1.50
@@ -254,9 +254,12 @@
 
 //! GameState vars
 enum {
-	VAR_DRESSING_MODE             =  19,
+	VAR_HOTEL_ITEMS_REMOVED       =   3,
+	VAR_JOE_DRESSING_MODE         =  19,
+	VAR_BYPASS_ZOMBIES            =  21,
 	VAR_BYPASS_FLODA_RECEPTIONIST =  35,
-	VAR_ESCAPE_FROM_HOTEL_COUNT   =  93,
+	VAR_GUARDS_TURNED_ON          =  85,
+	VAR_HOTEL_ESCAPE_STATE        =  93,
 	VAR_INTRO_PLAYED              = 117,
 	VAR_AZURA_IN_LOVE             = 167
 };

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- display.cpp	18 Jan 2006 17:39:37 -0000	1.95
+++ display.cpp	27 Jan 2006 19:35:55 -0000	1.96
@@ -151,20 +151,17 @@
 	}
 }
 
-void Display::palConvert(uint8 *outPal, const uint8 *inPal, int start, int end) {
-	for (int i = start; i <= end; i++) {
-		outPal[4 * i + 0] = inPal[3 * i + 0];
-		outPal[4 * i + 1] = inPal[3 * i + 1];
-		outPal[4 * i + 2] = inPal[3 * i + 2];
-		outPal[4 * i + 3] = 0;
-	}
-}
-
 void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) {
 	debug(9, "Display::palSet(%d, %d)", start, end);
+	const int numColors = end - start + 1;
 	uint8 tempPal[256 * 4];
-	palConvert(tempPal, pal, start, end);
-	_system->setPalette(tempPal + start * 4, start, end - start + 1);
+	for (int i = 0; i < numColors; i++) {
+		tempPal[4 * i + 0] = *pal++;
+		tempPal[4 * i + 1] = *pal++;
+		tempPal[4 * i + 2] = *pal++;
+		tempPal[4 * i + 3] = 0;
+	}
+	_system->setPalette(tempPal, start, numColors);
 	if (updateScreen) {
 		_system->updateScreen();
 		_vm->input()->delay(20);
@@ -933,22 +930,26 @@
 }
 
 void Display::blankScreenEffect1() {
-	static const int inc[] = { -1, 1 };
 	uint8 buf[32 * 32];
 	while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
 		for (int i = 0; i < 2; ++i) {
-			uint16 x = _rnd.getRandomNumber(SCREEN_W - 32 - 2) + 1;
-			uint16 y = _rnd.getRandomNumber(SCREEN_H - 32 - 2) + 1;
-			uint8 *p = _screenBuf + SCREEN_W * y + x;
-			uint8 *q = buf;
-			uint16 h = 32;
-			while (h--) {
-				memcpy(q, p, 32);
+			int x = _rnd.getRandomNumber(SCREEN_W - 32 - 2) + 1;
+			int y = _rnd.getRandomNumber(SCREEN_H - 32 - 2) + 1;
+			const uint8 *p = _screenBuf + SCREEN_W * y + x;
+			for (int j = 0; j < 32; ++j) {
+				memcpy(buf + j * 32, p, 32);
 				p += SCREEN_W;
-				q += 32;
 			}
-			x += inc[_rnd.getRandomNumber(1)];
-			y += inc[_rnd.getRandomNumber(1)];
+			if (_rnd.getRandomNumber(1)) {
+				++x;
+			} else {
+				--x;
+			}
+			if (_rnd.getRandomNumber(1)) {
+				++y;
+			} else {
+				--y;
+			}
 			_system->copyRectToScreen(buf, 32, x, y, 32, 32);
 			_system->updateScreen();
 			_vm->input()->delay(10);
@@ -958,8 +959,8 @@
 
 void Display::blankScreenEffect2() {
 	while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
-		uint16 x = _rnd.getRandomNumber(SCREEN_W - 2);
-		uint16 y = _rnd.getRandomNumber(SCREEN_H - 2);
+		int x = _rnd.getRandomNumber(SCREEN_W - 2);
+		int y = _rnd.getRandomNumber(SCREEN_H - 2);
 		uint8 *p = _screenBuf + y * SCREEN_W + x;
 		uint8 c = 0;
 		switch (_rnd.getRandomNumber(3)) {
@@ -991,14 +992,11 @@
 			memset(_screenBuf, 0, SCREEN_W * SCREEN_H);
 			_system->copyRectToScreen(_screenBuf, SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
 		} else {
-			uint16 x = _rnd.getRandomNumber(SCREEN_W - 2);
-			uint16 y = _rnd.getRandomNumber(SCREEN_H - 2);
+			int x = _rnd.getRandomNumber(SCREEN_W - 2);
+			int y = _rnd.getRandomNumber(SCREEN_H - 2);
 			uint8 *p = _screenBuf + SCREEN_W * y + x;
-			uint8 p0 = *p;
-			uint8 p1 = *(p + 1);
-			uint8 p2 = *(p + SCREEN_W);
-			uint8 p3 = *(p + SCREEN_W + 1);
-			uint8 c = (p0 + p1 + p2 + p3) / 4;
+			int sum = *p + *(p + 1) + *(p + SCREEN_W) + *(p + SCREEN_W + 1);
+			uint8 c = (uint8)(sum / 4);
 			memset(p, c, 2);
 			memset(p + SCREEN_W, c, 2);
 			++i;

Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- display.h	18 Jan 2006 17:39:37 -0000	1.55
+++ display.h	27 Jan 2006 19:35:55 -0000	1.56
@@ -44,9 +44,6 @@
 	//! update dynalum for the current room
 	void dynalumUpdate(int16 x, int16 y);
 
-	//! convert palette from RGB to RGBA (used before uploading to the backend)
-	void palConvert(uint8 *outPal, const uint8 *inPal, int start, int end);
-
 	//! update the palette
 	void palSet(const uint8 *pal, int start, int end, bool updateScreen = false);
 

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.223
retrieving revision 1.224
diff -u -d -r1.223 -r1.224
--- logic.cpp	18 Jan 2006 17:39:37 -0000	1.223
+++ logic.cpp	27 Jan 2006 19:35:55 -0000	1.224
@@ -815,7 +815,7 @@
 	if (showCut) {
 		joeFacing(DIR_FRONT);
 		joeFace();
-		if (gameState(VAR_DRESSING_MODE) == 0) {
+		if (gameState(VAR_JOE_DRESSING_MODE) == 0) {
 			playCutaway("cdres.CUT");
 			inventoryInsertItem(ITEM_CLOTHES);
 		} else {
@@ -825,7 +825,7 @@
 	_vm->display()->palSetJoeDress();
 	loadJoeBanks("JoeD_A.BBK", "JoeD_B.BBK");
 	inventoryDeleteItem(ITEM_DRESS);
-	gameState(VAR_DRESSING_MODE, 2);
+	gameState(VAR_JOE_DRESSING_MODE, 2);
 }
 
 void Logic::joeUseClothes(bool showCut) {
@@ -838,13 +838,13 @@
 	_vm->display()->palSetJoeNormal();
 	loadJoeBanks("Joe_A.BBK", "Joe_B.BBK");
 	inventoryDeleteItem(ITEM_CLOTHES);
-	gameState(VAR_DRESSING_MODE, 0);
+	gameState(VAR_JOE_DRESSING_MODE, 0);
 }
 
 void Logic::joeUseUnderwear() {
 	_vm->display()->palSetJoeNormal();
 	loadJoeBanks("JoeU_A.BBK", "JoeU_B.BBK");
-	gameState(VAR_DRESSING_MODE, 1);
+	gameState(VAR_JOE_DRESSING_MODE, 1);
 }
 
 void Logic::makePersonSpeak(const char *sentence, Person *person, const char *voiceFilePrefix) {
@@ -1018,14 +1018,14 @@
 }
 
 void Logic::removeHotelItemsFromInventory() {
-	if (currentRoom() == 1 && gameState(3) == 0) {
+	if (currentRoom() == 1 && gameState(VAR_HOTEL_ITEMS_REMOVED) == 0) {
 		inventoryDeleteItem(ITEM_CROWBAR, false);
 		inventoryDeleteItem(ITEM_DRESS, false);
 		inventoryDeleteItem(ITEM_CLOTHES, false);
 		inventoryDeleteItem(ITEM_HAY, false);
 		inventoryDeleteItem(ITEM_OIL, false);
 		inventoryDeleteItem(ITEM_CHICKEN, false);
-		gameState(3, 1);
+		gameState(VAR_HOTEL_ITEMS_REMOVED, 1);
 		inventoryRefresh();
 	}
 }
@@ -1137,14 +1137,17 @@
 		break;
 	case ROOM_TEMPLE_ZOMBIES:
 		if (areaNum == 6) {
-			if (_gameState[21] == 0) {
+			switch (gameState(VAR_BYPASS_ZOMBIES)) {
+			case 0:
 				playCutaway("c50d.CUT", nextCut);
 				while (nextCut[0] != '\0') {
 					playCutaway(nextCut, nextCut);
 				}
-				_gameState[21] = 1;
-			} else {
+				gameState(VAR_BYPASS_ZOMBIES, 1);
+				break;
+			case 1:
 				playCutaway("c50h.CUT", nextCut);
+				break;
 			}
 		}
 		break;
@@ -1158,16 +1161,20 @@
 		makeJoeSpeak(21);
 		break;
 	case ROOM_HOTEL_LOBBY:
-		if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 0) {
+		switch (gameState(VAR_HOTEL_ESCAPE_STATE)) {
+		case 0:
 			playCutaway("c73a.CUT");
-			_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] = 1;
 			joeUseUnderwear();
 			joeFace();
-		} else if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 1) {
+			gameState(VAR_HOTEL_ESCAPE_STATE, 1);
+			break;
+		case 1:
 			playCutaway("c73b.CUT");
-			_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] = 2;
-		} else if (_gameState[VAR_ESCAPE_FROM_HOTEL_COUNT] == 2) {
+			gameState(VAR_HOTEL_ESCAPE_STATE, 2);
+			break;
+		case 2:
 			playCutaway("c73c.CUT");
+			break;
 		}
 		break;
 	case ROOM_TEMPLE_MAZE_5:
@@ -1176,17 +1183,20 @@
 		}
 		break;
 	case ROOM_TEMPLE_MAZE_6:
-		if (areaNum == 5 && _gameState[187] == 0) {
+		if (areaNum == 5 && gameState(187) == 0) {
 			playCutaway("c101b.CUT", nextCut);
 		}
 		break;
 	case ROOM_FLODA_FRONTDESK:
 		if (areaNum == 3) {
-			if (_gameState[VAR_BYPASS_FLODA_RECEPTIONIST] == 1) {
-				playCutaway("c103e.CUT", nextCut);
-			} else if (_gameState[VAR_BYPASS_FLODA_RECEPTIONIST] == 0) {
+			switch (gameState(VAR_BYPASS_FLODA_RECEPTIONIST)) {
+			case 0:
 				playCutaway("c103b.CUT", nextCut);
-				_gameState[VAR_BYPASS_FLODA_RECEPTIONIST] = 1;
+				gameState(VAR_BYPASS_FLODA_RECEPTIONIST, 1);
+				break;
+			case 1:
+				playCutaway("c103e.CUT", nextCut);
+				break;
 			}
 		}
 		break;
@@ -1377,7 +1387,7 @@
 void Logic::setupRestoredGame() {
 	_vm->sound()->playLastSong();
 
-	switch (gameState(VAR_DRESSING_MODE)) {
+	switch (gameState(VAR_JOE_DRESSING_MODE)) {
 	case 0:
 		_vm->display()->palSetJoeNormal();
 		loadJoeBanks("Joe_A.BBK", "Joe_B.BBK");
@@ -1675,7 +1685,7 @@
 }
 
 void Logic::asmTurnGuardOn() {
-	gameState(85, 1);
+	gameState(VAR_GUARDS_TURNED_ON, 1);
 }
 
 void Logic::asmPanLeft320To144() {





More information about the Scummvm-git-logs mailing list