aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2006-01-27 19:35:55 +0000
committerGregory Montoir2006-01-27 19:35:55 +0000
commit45727596b9ab99eaf53485755217dc63a668e3f8 (patch)
treede1a4d3725e5e7956de668ea65a527fd08eb0756 /queen
parent04d7bb1d5545e4b2cf40b780bc6a08caf796dd07 (diff)
downloadscummvm-rg350-45727596b9ab99eaf53485755217dc63a668e3f8.tar.gz
scummvm-rg350-45727596b9ab99eaf53485755217dc63a668e3f8.tar.bz2
scummvm-rg350-45727596b9ab99eaf53485755217dc63a668e3f8.zip
Minor cleanup.
svn-id: r20242
Diffstat (limited to 'queen')
-rw-r--r--queen/defs.h7
-rw-r--r--queen/display.cpp60
-rw-r--r--queen/display.h3
-rw-r--r--queen/logic.cpp52
4 files changed, 65 insertions, 57 deletions
diff --git a/queen/defs.h b/queen/defs.h
index 3f2f978b40..ba2add4021 100644
--- a/queen/defs.h
+++ b/queen/defs.h
@@ -254,9 +254,12 @@ enum {
//! 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
};
diff --git a/queen/display.cpp b/queen/display.cpp
index ebf06c4a36..50bbb7d855 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -151,20 +151,17 @@ void Display::dynalumUpdate(int16 x, int16 y) {
}
}
-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::blankScreen() {
}
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::blankScreenEffect1() {
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 @@ void Display::blankScreenEffect3() {
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;
diff --git a/queen/display.h b/queen/display.h
index fb2dc4a96c..cb3937dd25 100644
--- a/queen/display.h
+++ b/queen/display.h
@@ -44,9 +44,6 @@ public:
//! 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);
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 4af6d70540..1789ccba7f 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -815,7 +815,7 @@ void Logic::joeUseDress(bool showCut) {
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 @@ void Logic::joeUseDress(bool showCut) {
_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 @@ void Logic::joeUseClothes(bool showCut) {
_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::inventoryScroll(uint16 count, bool up) {
}
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 @@ void Logic::handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataN
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 @@ void Logic::handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataN
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 @@ void Logic::handleSpecialArea(Direction facing, uint16 areaNum, uint16 walkDataN
}
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::loadState(uint32 ver, byte *&ptr) {
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::asmPanToJoe() {
}
void Logic::asmTurnGuardOn() {
- gameState(85, 1);
+ gameState(VAR_GUARDS_TURNED_ON, 1);
}
void Logic::asmPanLeft320To144() {