diff options
author | Filippos Karapetis | 2008-06-06 14:50:19 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-06-06 14:50:19 +0000 |
commit | 7c4e375b397fec0ae76db2682e4f33d2eadc9160 (patch) | |
tree | e5f4ae0527c4e4a414084c73ffbb0da1f7969af0 /engines/drascula | |
parent | 0ee152fbb9b73d44f143792789b23cdbdc68a347 (diff) | |
download | scummvm-rg350-7c4e375b397fec0ae76db2682e4f33d2eadc9160.tar.gz scummvm-rg350-7c4e375b397fec0ae76db2682e4f33d2eadc9160.tar.bz2 scummvm-rg350-7c4e375b397fec0ae76db2682e4f33d2eadc9160.zip |
- Cleaned up the code that makes the in-game screensaver pop up
- Grouped all the frame_* variables
- Removed the unused mouseY_ant variable
Renamed:
x_dr/y_dr -> drasculaX/drasculaY
x_bj/y_bj -> bjX/bjY
vb -> VonBraun
wolf -> werewolf
pos_cabina -> cabinPos
dir_lectura -> pal
plt -> colorCount
palNegra -> blackPalette
cont_sv -> framesWithoutAction
svn-id: r32577
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/animation.cpp | 230 | ||||
-rw-r--r-- | engines/drascula/drascula.cpp | 170 | ||||
-rw-r--r-- | engines/drascula/drascula.h | 43 | ||||
-rw-r--r-- | engines/drascula/rooms.cpp | 113 | ||||
-rw-r--r-- | engines/drascula/talk.cpp | 32 |
5 files changed, 276 insertions, 312 deletions
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 13425f7250..f55a388b92 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -186,8 +186,8 @@ void DrasculaEngine::animation_1_1() { loadPic("auxigor.alg", frontSurface); loadPic("auxdr.alg", backSurface); trackDrascula = 0; - x_dr = 129; - y_dr = 95; + drasculaX = 129; + drasculaY = 95; trackIgor = 1; igorX = 66; igorY = 97; @@ -461,8 +461,8 @@ void DrasculaEngine::animation_2_1() { break; for (l = 0; l < 200; l++) factor_red[l] = 99; - x_bj = 170; - y_bj = 90; + bjX = 170; + bjY = 90; trackBJ = 0; curX = 91; curY = 95; @@ -810,28 +810,28 @@ void DrasculaEngine::animation_10_2() { } void DrasculaEngine::animation_14_2() { - int n, pos_cabina[6]; + int cabinPos[6]; int l = 0; loadPic("an14_2.alg", backSurface); - pos_cabina[0] = 150; - pos_cabina[1] = 6; - pos_cabina[2] = 69; - pos_cabina[3] = -160; - pos_cabina[4] = 158; - pos_cabina[5] = 161; + cabinPos[0] = 150; + cabinPos[1] = 6; + cabinPos[2] = 69; + cabinPos[3] = -160; + cabinPos[4] = 158; + cabinPos[5] = 161; - for (n = -160; n <= 0; n = n + 5 + l) { + for (int n = -160; n <= 0; n = n + 5 + l) { copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); updateRefresh_pre(); moveCharacters(); - moveVB(); - pos_cabina[3] = n; - copyRectClip(pos_cabina, backSurface, screenSurface); + moveVonBraun(); + cabinPos[3] = n; + copyRectClip(cabinPos, backSurface, screenSurface); updateRefresh(); updateScreen(); - l = l + 1; + l++; } flags[24] = 1; @@ -855,8 +855,6 @@ void DrasculaEngine::animation_15_2() { } void DrasculaEngine::animation_16_2() { - int l; - talk_drunk(12); talk(371); @@ -979,7 +977,7 @@ void DrasculaEngine::animation_16_2() { if (key != 0) goto asco; - for (l = 1; l < 200; l++) { + for (int l = 1; l < 200; l++) { copyBackground(0, 0, 0, l, 320, 200 - l, drawSurface3, screenSurface); copyBackground(0, 200 - l, 0, 0, 320, l, drawSurface1, screenSurface); updateScreen(); @@ -1012,24 +1010,24 @@ void DrasculaEngine::animation_17_2() { } void DrasculaEngine::animation_19_2() { - talk_vbpuerta(5); + talk_vonBraunpuerta(5); } void DrasculaEngine::animation_20_2() { - talk_vbpuerta(7); - talk_vbpuerta(8); + talk_vonBraunpuerta(7); + talk_vonBraunpuerta(8); talk(383); - talk_vbpuerta(9); + talk_vonBraunpuerta(9); talk(384); - talk_vbpuerta(10); + talk_vonBraunpuerta(10); talk(385); - talk_vbpuerta(11); + talk_vonBraunpuerta(11); if (flags[23] == 0) { talk(350); - talk_vbpuerta(57); + talk_vonBraunpuerta(57); } else { talk(386); - talk_vbpuerta(12); + talk_vonBraunpuerta(12); flags[18] = 0; flags[14] = 1; openDoor(15, 1); @@ -1038,15 +1036,15 @@ void DrasculaEngine::animation_20_2() { exitRoom(0); flags[21] = 0; flags[24] = 0; - trackVB = 1; - vbX = 120; + trackVonBraun = 1; + vonBraunX = 120; breakOut = 1; } } void DrasculaEngine::animation_21_2() { - talk_vbpuerta(6); + talk_vonBraunpuerta(6); } void DrasculaEngine::animation_23_2() { @@ -1055,40 +1053,40 @@ void DrasculaEngine::animation_23_2() { flags[21] = 1; if (flags[25] == 0) { - talk_vb(13); - talk_vb(14); + talk_vonBraun(13); + talk_vonBraun(14); pause(10); talk(387); } - talk_vb(15); - placeVB(42); - trackVB = 1; - talk_vb(16); - trackVB = 2; + talk_vonBraun(15); + placeVonBraun(42); + trackVonBraun = 1; + talk_vonBraun(16); + trackVonBraun = 2; gotoObject(157, 147); gotoObject(131, 149); trackProtagonist = 0; animation_14_2(); if (flags[25] == 0) - talk_vb(17); + talk_vonBraun(17); pause(8); - trackVB = 1; - talk_vb(18); + trackVonBraun = 1; + talk_vonBraun(18); if (flags[29] == 0) animation_23_joined(); else animation_23_joined2(); - trackVB = 2; + trackVonBraun = 2; animation_25_2(); - placeVB(99); + placeVonBraun(99); if (flags[29] == 0) { - talk_vb(19); + talk_vonBraun(19); if (flags[25] == 0) { - talk_vb(20); + talk_vonBraun(20); if (removeObject(kItemMoney) == 0) flags[30] = 1; if (removeObject(kItemTwoCoins) == 0) @@ -1096,7 +1094,7 @@ void DrasculaEngine::animation_23_2() { if (removeObject(kItemOneCoin) == 0) flags[32] = 1; } - talk_vb(21); + talk_vonBraun(21); } else animation_27_2(); @@ -1105,7 +1103,7 @@ void DrasculaEngine::animation_23_2() { } void DrasculaEngine::animation_23_joined() { - int n, p_x = curX + 2, p_y = curY - 3; + int p_x = curX + 2, p_y = curY - 3; int x[] = {1, 38, 75, 112, 75, 112, 75, 112, 149, 112, 149, 112, 149, 186, 223, 260, 1, 38, 75, 112, 149, 112, 149, 112, 149, 112, 149, 186, 223, 260, 260, 260, 260, 223}; int y[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 76, 76, 76, 76, 76, 76, 76, @@ -1113,7 +1111,7 @@ void DrasculaEngine::animation_23_joined() { loadPic("an23.alg", backSurface); - for (n = 0; n < 34; n++) { + for (int n = 0; n < 34; n++) { copyRect(p_x, p_y, p_x, p_y, 36, 74, drawSurface1, screenSurface); copyRect(x[n], y[n], p_x, p_y, 36, 74, backSurface, screenSurface); updateRefresh(); @@ -1125,7 +1123,7 @@ void DrasculaEngine::animation_23_joined() { } void DrasculaEngine::animation_23_joined2() { - int n, p_x = curX + 4, p_y = curY; + int p_x = curX + 4, p_y = curY; int x[] = {1, 35, 69, 103, 137, 171, 205, 239, 273, 1, 35, 69, 103, 137}; int y[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 73, 73, 73, 73, 73}; @@ -1133,7 +1131,7 @@ void DrasculaEngine::animation_23_joined2() { loadPic("an23_2.alg", backSurface); - for (n = 0; n < 14; n++) { + for (int n = 0; n < 14; n++) { copyRect(p_x, p_y, p_x, p_y, 33, 71, drawSurface1, screenSurface); copyRect(x[n], y[n], p_x, p_y, 33, 71, backSurface, screenSurface); updateRefresh(); @@ -1145,32 +1143,32 @@ void DrasculaEngine::animation_23_joined2() { } void DrasculaEngine::animation_25_2() { - int n, pos_cabina[6]; + int cabinPos[6]; loadPic("an14_2.alg", backSurface); loadPic(18, drawSurface1); - pos_cabina[0] = 150; - pos_cabina[1] = 6; - pos_cabina[2] = 69; - pos_cabina[3] = 0; - pos_cabina[4] = 158; - pos_cabina[5] = 161; + cabinPos[0] = 150; + cabinPos[1] = 6; + cabinPos[2] = 69; + cabinPos[3] = 0; + cabinPos[4] = 158; + cabinPos[5] = 161; flags[24] = 0; playSound(6); - for (n = 0; n >= -160; n = n - 8) { + for (int n = 0; n >= -160; n = n - 8) { copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); updateRefresh_pre(); moveCharacters(); - moveVB(); + moveVonBraun(); - pos_cabina[3] = n; + cabinPos[3] = n; - copyRectClip(pos_cabina, backSurface, screenSurface); + copyRectClip(cabinPos, backSurface, screenSurface); updateRefresh(); updateScreen(); @@ -1188,46 +1186,46 @@ void DrasculaEngine::animation_27_2() { removeObject(kItemEarWithEarPlug); addObject(kItemEarplugs); - talk_vb(23); - talk_vb(24); + talk_vonBraun(23); + talk_vonBraun(24); if (flags[30] == 1) addObject(kItemMoney); if (flags[31] == 1) addObject(kItemTwoCoins); if (flags[32] == 1) addObject(kItemOneCoin); - talk_vb(25); - talk_vb(26); + talk_vonBraun(25); + talk_vonBraun(26); } void DrasculaEngine::animation_28_2() { for(int i = 27; i <= 30; i++) - talk_vb(i); + talk_vonBraun(i); } void DrasculaEngine::animation_29_2() { if (flags[33] == 0) { - talk_vb(32); + talk_vonBraun(32); talk(398); - talk_vb(33); + talk_vonBraun(33); talk(399); - talk_vb(34); - talk_vb(35); + talk_vonBraun(34); + talk_vonBraun(35); talk(400); - talk_vb(36); - talk_vb(37); + talk_vonBraun(36); + talk_vonBraun(37); talk(386); - talk_vb(38); - talk_vb(39); + talk_vonBraun(38); + talk_vonBraun(39); talk(401); - talk_vb(40); - talk_vb(41); + talk_vonBraun(40); + talk_vonBraun(41); flags[33] = 1; } else - talk_vb(43); + talk_vonBraun(43); talk(402); - talk_vb(42); + talk_vonBraun(42); if (flags[38] == 0) { talk(403); @@ -1237,13 +1235,13 @@ void DrasculaEngine::animation_29_2() { } void DrasculaEngine::animation_30_2() { - talk_vb(31); + talk_vonBraun(31); talk(396); } void DrasculaEngine::animation_31_2() { - talk_vb(44); - placeVB(-50); + talk_vonBraun(44); + placeVonBraun(-50); pause(15); gotoObject(159, 140); loadPic(99, backSurface); @@ -1256,24 +1254,24 @@ void DrasculaEngine::animation_31_2() { updateScreen(); pause(22); talk(406); - placeVB(98); - talk_vb(45); - talk_vb(46); - talk_vb(47); + placeVonBraun(98); + talk_vonBraun(45); + talk_vonBraun(46); + talk_vonBraun(47); talk(407); - talk_vb(48); - talk_vb(49); + talk_vonBraun(48); + talk_vonBraun(49); talk(408); - talk_vb(50); - talk_vb(51); + talk_vonBraun(50); + talk_vonBraun(51); talk(409); - talk_vb(52); - talk_vb(53); + talk_vonBraun(52); + talk_vonBraun(53); pause(12); - talk_vb(54); - talk_vb(55); + talk_vonBraun(54); + talk_vonBraun(55); talk(410); - talk_vb(56); + talk_vonBraun(56); breakOut = 1; @@ -1537,20 +1535,20 @@ void DrasculaEngine::animation_4_5() { updateRoom(); updateScreen(); talk(228); - talk_wolf(1); - talk_wolf(2); + talk_werewolf(1); + talk_werewolf(2); pause(23); talk(229); - talk_wolf(3); - talk_wolf(4); + talk_werewolf(3); + talk_werewolf(4); talk(230); - talk_wolf(5); + talk_werewolf(5); talk(231); - talk_wolf(6); - talk_wolf(7); + talk_werewolf(6); + talk_werewolf(7); pause(33); talk(232); - talk_wolf(8); + talk_werewolf(8); } void DrasculaEngine::animation_5_5(){ @@ -1629,24 +1627,24 @@ void DrasculaEngine::animation_5_5(){ } void DrasculaEngine::animation_6_5() { - talk_wolf(9); + talk_werewolf(9); talk(234); } void DrasculaEngine::animation_7_5() { - talk_wolf(10); + talk_werewolf(10); talk(236); - talk_wolf(11); - talk_wolf(12); - talk_wolf(13); + talk_werewolf(11); + talk_werewolf(12); + talk_werewolf(13); pause(34); - talk_wolf(14); + talk_werewolf(14); } void DrasculaEngine::animation_8_5() { - talk_wolf(15); + talk_werewolf(15); talk(238); - talk_wolf(16); + talk_werewolf(16); } void DrasculaEngine::animation_9_5() { @@ -2289,7 +2287,7 @@ void DrasculaEngine::animation_13_2() { void DrasculaEngine::animation_18_2() { talk(378); - talk_vbpuerta(4); + talk_vonBraunpuerta(4); converse(3); } @@ -2303,11 +2301,11 @@ void DrasculaEngine::animation_22_2() { finishSound(); trackProtagonist = 1; - talk_vbpuerta(1); + talk_vonBraunpuerta(1); talk(375); - talk_vbpuerta(2); + talk_vonBraunpuerta(2); talk(376); - talk_vbpuerta(3); + talk_vonBraunpuerta(3); flags[18] = 1; } @@ -2328,7 +2326,7 @@ void DrasculaEngine::animation_24_2() { flags[21] = 1; - talk_vb(22); + talk_vonBraun(22); if (flags[22] == 0) converse(4); @@ -2338,8 +2336,8 @@ void DrasculaEngine::animation_24_2() { exitRoom(0); flags[21] = 0; flags[24] = 0; - trackVB = 1; - vbX = 120; + trackVonBraun = 1; + vonBraunX = 120; } void DrasculaEngine::animation_32_2() { diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 9d38d28887..4f4910e304 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -130,22 +130,20 @@ int DrasculaEngine::go() { savedTime = 0; changeColor = 0; breakOut = 0; - vbX = 120; trackVB = 1; vbHasMoved = 0; frame_vb = 1; - frame_piano = 0; - frame_drunk = 0; - frame_candles = 0; - cont_sv = 0; + vonBraunX = 120; trackVonBraun = 1; vonBraunHasMoved = 0; + framesWithoutAction = 0; term_int = 0; musicStopped = 0; selectionMade = 0; UsingMem = 0; globalSpeed = 0; - frame_blind = 0; - frame_snore = 0; - frame_bat = 0; curExcuseLook = 0; curExcuseAction = 0; + for (i = 0; i < 8; i++) + actorFrames[i] = 0; + actorFrames[kFrameVonBraun] = 1; + allocMemory(); withVoices = 0; @@ -180,8 +178,8 @@ int DrasculaEngine::go() { loadPic(99, backSurface); } else if (currentChapter == 6) { igorX = 105, igorY = 85, trackIgor = 1; - x_dr = 62, y_dr = 99, trackDrascula = 1; - frame_pen = 0; + drasculaX = 62, drasculaY = 99, trackDrascula = 1; + actorFrames[kFramePendulum] = 0; flag_tv = 0; pendulumSurface = drawSurface3; @@ -287,30 +285,30 @@ void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int color setRGB((byte *)cPal, colorCount); } -void DrasculaEngine::setRGB(byte *dir_lectura, int plt) { +void DrasculaEngine::setRGB(byte *pal, int colorCount) { int x, cnt = 0; - for (x = 0; x < plt; x++) { - gamePalette[x][0] = dir_lectura[cnt++] / 4; - gamePalette[x][1] = dir_lectura[cnt++] / 4; - gamePalette[x][2] = dir_lectura[cnt++] / 4; + for (x = 0; x < colorCount; x++) { + gamePalette[x][0] = pal[cnt++] / 4; + gamePalette[x][1] = pal[cnt++] / 4; + gamePalette[x][2] = pal[cnt++] / 4; } setPalette((byte *)&gamePalette); } void DrasculaEngine::black() { int color, component; - DacPalette256 palNegra; + DacPalette256 blackPalette; for (color = 0; color < 256; color++) for (component = 0; component < 3; component++) - palNegra[color][component] = 0; + blackPalette[color][component] = 0; - palNegra[254][0] = 0x3F; - palNegra[254][1] = 0x3F; - palNegra[254][2] = 0x15; + blackPalette[254][0] = 0x3F; + blackPalette[254][1] = 0x3F; + blackPalette[254][2] = 0x15; - setPalette((byte *)&palNegra); + setPalette((byte *)&blackPalette); } void DrasculaEngine::setPalette(byte *PalBuf) { @@ -568,7 +566,7 @@ bool DrasculaEngine::runCurrentChapter() { if (menuScreen == 0 && takeObject == 1) checkObjects(); - + if (rightMouseButton == 1 && menuScreen == 1) { delay(100); if (currentChapter == 2) @@ -578,8 +576,6 @@ bool DrasculaEngine::runCurrentChapter() { setPalette((byte *)&gamePalette); menuScreen = 0; updateEvents(); - if (currentChapter != 3) - cont_sv = 0; } if (rightMouseButton == 1 && menuScreen == 0) { delay(100); @@ -597,26 +593,18 @@ bool DrasculaEngine::runCurrentChapter() { menuScreen = 1; updateEvents(); withoutVerb(); - if (currentChapter != 3) - cont_sv = 0; } if (leftMouseButton == 1 && menuBar == 1) { delay(100); selectVerbFromBar(); - if (currentChapter != 3) - cont_sv = 0; } else if (leftMouseButton == 1 && takeObject == 0) { delay(100); if (verify1()) return true; - if (currentChapter != 3) - cont_sv = 0; } else if (leftMouseButton == 1 && takeObject == 1) { if (verify2()) return true; - if (currentChapter != 3) - cont_sv = 0; } menuBar = (mouseY < 24 && menuScreen == 0) ? 1 : 0; @@ -624,69 +612,53 @@ bool DrasculaEngine::runCurrentChapter() { Common::KeyCode key = getScan(); if (key == Common::KEYCODE_F1 && menuScreen == 0) { selectVerb(1); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_F2 && menuScreen == 0) { selectVerb(2); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_F3 && menuScreen == 0) { selectVerb(3); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_F4 && menuScreen == 0) { selectVerb(4); - cont_sv = 0; } else if (key == Common::KEYCODE_F5 && menuScreen == 0) { selectVerb(5); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_F6 && menuScreen == 0) { selectVerb(6); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_F9) { - volumeControls(); - if (currentChapter != 3) - cont_sv = 0; + volumeControls(); } else if (key == Common::KEYCODE_F10) { if (!saveLoadScreen()) return true; - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_F8) { withoutVerb(); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_v) { withVoices = 1; print_abc(_textsys[_lang][2], 96, 86); updateScreen(); delay(1410); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_t) { withVoices = 0; print_abc(_textsys[_lang][3], 94, 86); updateScreen(); delay(1460); - if (currentChapter != 3) - cont_sv = 0; } else if (key == Common::KEYCODE_ESCAPE) { if (!confirmExit()) return false; - if (currentChapter != 3) - cont_sv = 0; } else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) { loadPic("alcbar.alg", drawSurface1, 255); - } else if (cont_sv == 15000) { - screenSaver(); + } + + if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0) if (currentChapter != 3) - cont_sv = 0; - } else { + framesWithoutAction = 0; + + if (framesWithoutAction == 15000) { + screenSaver(); if (currentChapter != 3) - cont_sv++; + framesWithoutAction = 0; } + + if (currentChapter != 3) + framesWithoutAction++; + } } @@ -1908,8 +1880,8 @@ void DrasculaEngine::placeDrascula() { else if (trackDrascula == 3 && currentChapter == 1) pos_dr[0] = 93; pos_dr[1] = 122; - pos_dr[2] = x_dr; - pos_dr[3] = y_dr; + pos_dr[2] = drasculaX; + pos_dr[3] = drasculaY; pos_dr[4] = 45; pos_dr[5] = 77; @@ -1927,8 +1899,8 @@ void DrasculaEngine::placeBJ() { else if (trackBJ == 0) pos_bj[0] = 37; pos_bj[1] = 99; - pos_bj[2] = x_bj; - pos_bj[3] = y_bj; + pos_bj[2] = bjX; + pos_bj[3] = bjY; pos_bj[4] = 26; pos_bj[5] = 76; @@ -3022,14 +2994,10 @@ int DrasculaEngine::whichObject() { } bool DrasculaEngine::checkMenuFlags() { - int h, n; - - for (n = 0; n < 43; n++) { + for (int n = 0; n < 43; n++) { if (whichObject() == n) { - h = inventoryObjects[n]; - if (h != 0) - if (checkAction(h)) - return true; + if (inventoryObjects[n] != 0 && checkAction(inventoryObjects[n])) + return true; } } @@ -3431,8 +3399,8 @@ void DrasculaEngine::updateVisible() { isDoor[1] = 0; if (roomNumber == 60) { trackDrascula = 0; - x_dr = 155; - y_dr = 69; + drasculaX = 155; + drasculaY = 69; } } } @@ -3449,62 +3417,56 @@ void DrasculaEngine::walkUp() { stepX = 0; } -void DrasculaEngine::moveVB() { +void DrasculaEngine::moveVonBraun() { int pos_vb[6]; - if (vbHasMoved == 0) { + if (vonBraunHasMoved == 0) { pos_vb[0] = 256; pos_vb[1] = 129; - pos_vb[2] = vbX; + pos_vb[2] = vonBraunX; pos_vb[3] = 66; pos_vb[4] = 33; pos_vb[5] = 69; - if (trackVB == 0) + if (trackVonBraun == 0) pos_vb[0] = 222; - else if (trackVB == 1) + else if (trackVonBraun == 1) pos_vb[0] = 188; } else { - pos_vb[2] = vbX; + pos_vb[0] = actorFrames[kFrameVonBraun]; + pos_vb[1] = (trackVonBraun == 0) ? 62 : 131; + pos_vb[2] = vonBraunX; pos_vb[3] = 66; pos_vb[4] = 28; pos_vb[5] = 68; - if (trackVB == 0) { - pos_vb[0] = frame_vb; - pos_vb[1] = 62; - } else { - pos_vb[0] = frame_vb; - pos_vb[1] = 131; - } - - frame_vb = frame_vb + 29; - if (frame_vb > 146) - frame_vb = 1; + actorFrames[kFrameVonBraun] += 29; + if (actorFrames[kFrameVonBraun] > 146) + actorFrames[kFrameVonBraun] = 1; } copyRectClip(pos_vb, frontSurface, screenSurface); } -void DrasculaEngine::placeVB(int pointX) { - trackVB = (pointX < vbX) ? 0 : 1; - vbHasMoved = 1; +void DrasculaEngine::placeVonBraun(int pointX) { + trackVonBraun = (pointX < vonBraunX) ? 0 : 1; + vonBraunHasMoved = 1; for (;;) { updateRoom(); updateScreen(); - if (trackVB == 0) { - vbX = vbX - 5; - if (vbX <= pointX) + if (trackVonBraun == 0) { + vonBraunX = vonBraunX - 5; + if (vonBraunX <= pointX) break; } else { - vbX = vbX + 5; - if (vbX >= pointX) + vonBraunX = vonBraunX + 5; + if (vonBraunX >= pointX) break; } pause(5); } - vbHasMoved = 0; + vonBraunHasMoved = 0; } void DrasculaEngine::hipo_sin_nadie(int counter){ @@ -3565,20 +3527,16 @@ void DrasculaEngine::openDoor(int nflag, int doorNum) { } void DrasculaEngine::showMap() { - int l, veo = 0; + hasName = 0; - for (l = 0; l < numRoomObjs; l++) { + for (int l = 0; l < numRoomObjs; l++) { if (mouseX > x1[l] && mouseY > y1[l] && mouseX < x2[l] && mouseY < y2[l] && visible[l] == 1) { strcpy(textName, objName[l]); hasName = 1; - veo = 1; } } - - if (veo == 0) - hasName = 0; } void DrasculaEngine::grr() { diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 23df79485d..38c2e88ea3 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -132,6 +132,17 @@ enum IgorTalkerTypes { kIgorWig = 4 }; +enum AnimFrameTypes { + kFrameBlind = 0, + kFrameSnore = 1, + kFrameBat = 2, + kFrameVonBraun = 3, + kFramePianist = 4, + kFrameDrunk = 5, + kFrameCandles = 6, + kFramePendulum = 7 +}; + #define TEXTD_START 68 struct DrasculaGameDescription; @@ -234,7 +245,7 @@ public: typedef char DacPalette256[256][3]; - void setRGB(byte *dir_lectura, int plt); + void setRGB(byte *pal, int plt); void assignDefaultPalette(); void setPalette(byte *PalBuf); void copyBackground(int xorg, int yorg, int xdes, int ydes, int width, @@ -280,6 +291,8 @@ public: Common::ArjFile _arj; + int actorFrames[8]; + int previousMusic, roomMusic; int roomNumber; char roomDisk[20]; @@ -300,9 +313,6 @@ public: int withVoices; int menuBar, menuScreen, hasName; char textName[20]; - int frame_blind; - int frame_snore; - int frame_bat; int curExcuseLook; int curExcuseAction; @@ -324,18 +334,15 @@ public: int savedTime; int changeColor; int breakOut; - int vbX, trackVB, vbHasMoved, frame_vb; + int vonBraunX, trackVonBraun, vonBraunHasMoved; float newHeight, newWidth; int factor_red[202]; - int frame_piano; - int frame_drunk; - int frame_candles; int color_solo; int blinking; int igorX, igorY, trackIgor; - int x_dr, y_dr, trackDrascula; - int x_bj, y_bj, trackBJ; - int cont_sv; + int drasculaX, drasculaY, trackDrascula; + int bjX, bjY, trackBJ; + int framesWithoutAction; int term_int; int currentChapter; int hay_que_load; @@ -346,7 +353,6 @@ public: int selectionMade; int mouseX; int mouseY; - int mouseY_ant; int leftMouseButton; int rightMouseButton; @@ -355,8 +361,8 @@ public: void pickObject(int); void walkUp(); void walkDown(); - void moveVB(); - void placeVB(int pointX); + void moveVonBraun(); + void placeVonBraun(int pointX); void hipo_sin_nadie(int counter); void openDoor(int nflag, int doorNum); void showMap(); @@ -386,12 +392,12 @@ public: int removeObject(int osj); void playFLI(const char *filefli, int vel); void fadeFromBlack(int fadeSpeed); + void fadeToBlack(int fadeSpeed); char adjustToVGA(char value); void color_abc(int cl); void centerText(const char *,int,int); void playSound(int soundNum); bool animate(const char *animation, int FPS); - void fadeToBlack(int fadeSpeed); void pause(int); void placeIgor(); void placeBJ(); @@ -413,11 +419,11 @@ public: void talk_sync(const char *, const char *, const char *); void talk_drunk(int); void talk_pianist(int); - void talk_wolf(int); + void talk_werewolf(int); void talk_mus(int); void talk_dr_grande(int); - void talk_vb(int); - void talk_vbpuerta(int); + void talk_vonBraun(int); + void talk_vonBraunpuerta(int); void talk_blind(int); void talk_hacker(const char *, const char *); @@ -471,7 +477,6 @@ public: int globalSpeed; uint32 LastFrame; - int frame_pen; int flag_tv; byte *loadPCX(byte *NamePcc); diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index f57b4140c4..7aec2e3adb 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -1122,16 +1122,16 @@ void DrasculaEngine::update_2() { 41, 41, 41, 41, 4, 4, 4, 4}; - if (frame_bat == 41) - frame_bat = 0; + if (actorFrames[kFrameBat] == 41) + actorFrames[kFrameBat] = 0; - batPos[0] = batX[frame_bat]; - batPos[1] = batY[frame_bat]; + batPos[0] = batX[actorFrames[kFrameBat]]; + batPos[1] = batY[actorFrames[kFrameBat]]; - if (frame_bat < 22) { + if (actorFrames[kFrameBat] < 22) { batPos[4] = 37; batPos[5] = 21; - } else if (frame_bat > 27) { + } else if (actorFrames[kFrameBat] > 27) { batPos[4] = 57; batPos[5] = 36; } else { @@ -1145,7 +1145,7 @@ void DrasculaEngine::update_2() { copyRectClip(batPos, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference >= 6) { - frame_bat++; + actorFrames[kFrameBat]++; savedTime = getTime(); } @@ -1185,17 +1185,18 @@ void DrasculaEngine::update_9_pre() { int blindY[] = {51, 51, 51, 51, 51, 51, 51, 127, 127}; int difference; - copyRect(blindX[frame_blind], blindY[frame_blind], 122, 57, 41, 72, drawSurface3, screenSurface); + copyRect(blindX[actorFrames[kFrameBlind]], blindY[actorFrames[kFrameBlind]], + 122, 57, 41, 72, drawSurface3, screenSurface); if (flags[9] == 0) { difference = getTime() - savedTime; if (difference >= 11) { - frame_blind++; + actorFrames[kFrameBlind]++; savedTime = getTime(); } - if (frame_blind == 9) - frame_blind = 0; + if (actorFrames[kFrameBlind] == 9) + actorFrames[kFrameBlind] = 0; } else - frame_blind = 3; + actorFrames[kFrameBlind] = 3; } void DrasculaEngine::update_13() { @@ -1216,39 +1217,39 @@ void DrasculaEngine::update_14_pre() { int drunkX[] = {1, 42, 83, 124, 165, 206, 247, 1}; int difference; - copyBackground(123, candleY[frame_candles], 142, 14, 39, 13, drawSurface3, screenSurface); - copyBackground(candleX[frame_candles], 146, 311, 80, 4, 8, drawSurface3, screenSurface); + copyBackground(123, candleY[actorFrames[kFrameCandles]], 142, 14, 39, 13, drawSurface3, screenSurface); + copyBackground(candleX[actorFrames[kFrameCandles]], 146, 311, 80, 4, 8, drawSurface3, screenSurface); if (blinking == 5) copyBackground(1, 149, 127, 52, 9, 5, drawSurface3, screenSurface); if (curX > 101 && curX < 155) copyBackground(31, 138, 178, 51, 18, 16, drawSurface3, screenSurface); if (flags[11] == 0) - copyBackground(pianistX[frame_piano], 157, 245, 130, 29, 42, drawSurface3, screenSurface); + copyBackground(pianistX[actorFrames[kFramePianist]], 157, 245, 130, 29, 42, drawSurface3, screenSurface); else if (flags[5] == 0) copyBackground(145, 139, 228, 112, 47, 60, extraSurface, screenSurface); else copyBackground(165, 140, 229, 117, 43, 59, drawSurface3, screenSurface); if (flags[12] == 1) - copyBackground(drunkX[frame_drunk], 82, 170, 50, 40, 53, drawSurface3, screenSurface); + copyBackground(drunkX[actorFrames[kFrameDrunk]], 82, 170, 50, 40, 53, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference > 6) { if (flags[12] == 1) { - frame_drunk++; - if (frame_drunk == 8) { - frame_drunk = 0; + actorFrames[kFrameDrunk]++; + if (actorFrames[kFrameDrunk] == 8) { + actorFrames[kFrameDrunk] = 0; flags[12] = 0; } } else if ((_rnd->getRandomNumber(94) == 15) && (flags[13] == 0)) flags[12] = 1; - frame_candles++; - if (frame_candles == 3) - frame_candles = 0; - frame_piano++; - if (frame_piano == 9) - frame_piano = 0; + actorFrames[kFrameCandles]++; + if (actorFrames[kFrameCandles] == 3) + actorFrames[kFrameCandles] = 0; + actorFrames[kFramePianist]++; + if (actorFrames[kFramePianist] == 9) + actorFrames[kFramePianist] = 0; blinking = _rnd->getRandomNumber(10); savedTime = getTime(); } @@ -1273,15 +1274,17 @@ void DrasculaEngine::update_18_pre() { if (flags[21] == 0) { copyBackground(1, 69, 120, 58, 56, 61, drawSurface3, screenSurface); - copyBackground(snore_x[frame_snore], snore_y[frame_snore], 124, 59, 40, 37, drawSurface3, screenSurface); + copyBackground(snore_x[actorFrames[kFrameSnore]], + snore_y[actorFrames[kFrameSnore]], + 124, 59, 40, 37, drawSurface3, screenSurface); } else - moveVB(); + moveVonBraun(); difference = getTime() - savedTime; if (difference > 9) { - frame_snore++; - if (frame_snore == 16) - frame_snore = 0; + actorFrames[kFrameSnore]++; + if (actorFrames[kFrameSnore] == 16) + actorFrames[kFrameSnore] = 0; savedTime = getTime(); } } @@ -1361,7 +1364,7 @@ void DrasculaEngine::update_60_pre() { if (flags[5] == 0) placeDrascula(); - copyBackground(123, candleY[frame_candles], 142, 14, 39, 13, drawSurface3, screenSurface); + copyBackground(123, candleY[actorFrames[kFrameCandles]], 142, 14, 39, 13, drawSurface3, screenSurface); if (flag_tv == 1) copyBackground(114, 158, 8, 30, 8, 23, drawSurface3, screenSurface); @@ -1373,15 +1376,15 @@ void DrasculaEngine::update_60_pre() { else if (blinking == 5 && flag_tv == 1) flag_tv = 0; if (difference > 6) { - frame_candles++; - if (frame_candles == 3) - frame_candles = 0; + actorFrames[kFrameCandles]++; + if (actorFrames[kFrameCandles] == 3) + actorFrames[kFrameCandles] = 0; savedTime = getTime(); } } void DrasculaEngine::update_60() { - if (curY - 10 < y_dr && flags[5] == 0) + if (curY - 10 < drasculaY && flags[5] == 0) placeDrascula(); } @@ -1392,8 +1395,8 @@ void DrasculaEngine::update_62_pre() { int drunkX[] = {1, 42, 83, 124, 165, 206, 247, 1 }; int difference; - copyBackground(123, candleY[frame_candles], 142, 14, 39, 13, drawSurface3, screenSurface); - copyBackground(candleX[frame_candles], 146, 311, 80, 4, 8, drawSurface3, screenSurface); + copyBackground(123, candleY[actorFrames[kFrameCandles]], 142, 14, 39, 13, drawSurface3, screenSurface); + copyBackground(candleX[actorFrames[kFrameCandles]], 146, 311, 80, 4, 8, drawSurface3, screenSurface); if (blinking == 5) copyBackground(1, 149, 127, 52, 9, 5, drawSurface3, screenSurface); @@ -1402,32 +1405,32 @@ void DrasculaEngine::update_62_pre() { copyBackground(31, 138, 178, 51, 18, 16, drawSurface3, screenSurface); if (flags[11] == 0) - copyBackground(pianistX[frame_piano], 157, 245, 130, 29, 42, drawSurface3, screenSurface); + copyBackground(pianistX[actorFrames[kFramePianist]], 157, 245, 130, 29, 42, drawSurface3, screenSurface); else if (flags[5] == 0) copyBackground(145, 139, 228, 112, 47, 60, extraSurface, screenSurface); else copyBackground(165, 140, 229, 117, 43, 59, drawSurface3, screenSurface); if (flags[12] == 1) - copyBackground(drunkX[frame_drunk], 82, 170, 50, 40, 53, drawSurface3, screenSurface); + copyBackground(drunkX[actorFrames[kFrameDrunk]], 82, 170, 50, 40, 53, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference > 6) { if (flags[12] == 1) { - frame_drunk++; - if (frame_drunk == 8) { - frame_drunk = 0; + actorFrames[kFrameDrunk]++; + if (actorFrames[kFrameDrunk] == 8) { + actorFrames[kFrameDrunk] = 0; flags[12] = 0; } } else if ((_rnd->getRandomNumber(94) == 15) && (flags[13] == 0)) flags[12] = 1; - frame_candles++; - if (frame_candles == 3) - frame_candles = 0; - frame_piano++; - if (frame_piano == 9) - frame_piano = 0; + actorFrames[kFrameCandles]++; + if (actorFrames[kFrameCandles] == 3) + actorFrames[kFrameCandles] = 0; + actorFrames[kFramePianist]++; + if (actorFrames[kFramePianist] == 9) + actorFrames[kFramePianist] = 0; blinking = _rnd->getRandomNumber(10); savedTime = getTime(); } @@ -1440,7 +1443,7 @@ void DrasculaEngine::update_62() { if (curY + curHeight < 89) { copyRect(205, 1, 180, 9, 82, 80, drawSurface3, screenSurface); - copyBackground(drunkX[frame_drunk], 82, 170, 50, 40, 53, drawSurface3, screenSurface); + copyBackground(drunkX[actorFrames[kFrameDrunk]], 82, 170, 50, 40, 53, drawSurface3, screenSurface); } } @@ -1448,14 +1451,14 @@ void DrasculaEngine::update_102() { int pendulum_x[] = {40, 96, 152, 208, 264, 40, 96, 152, 208, 208, 152, 264, 40, 96, 152, 208, 264}; int difference; - if (frame_pen <= 4) + if (actorFrames[kFramePendulum] <= 4) pendulumSurface = drawSurface3; - else if (frame_pen <= 11) + else if (actorFrames[kFramePendulum] <= 11) pendulumSurface = extraSurface; else pendulumSurface = frontSurface; - copyBackground(pendulum_x[frame_pen], 19, 152, 0, 55, 125, pendulumSurface, screenSurface); + copyBackground(pendulum_x[actorFrames[kFramePendulum]], 19, 152, 0, 55, 125, pendulumSurface, screenSurface); if (flags[1] == 2) copyRect(18, 145, 145, 105, 25, 29, drawSurface3, screenSurface); @@ -1465,9 +1468,9 @@ void DrasculaEngine::update_102() { difference = getTime() - savedTime; if (difference > 8) { - frame_pen++; - if (frame_pen == 17) - frame_pen = 0; + actorFrames[kFramePendulum]++; + if (actorFrames[kFramePendulum] == 17) + actorFrames[kFramePendulum] = 0; savedTime = getTime(); } } diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index a6d06a4107..d013186beb 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -161,16 +161,16 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) { if (currentChapter == 6) moveCharacters(); - copyBackground(x_dr, y_dr, x_dr, y_dr, 38 + offset, 31, drawSurface1, screenSurface); + copyBackground(drasculaX, drasculaY, drasculaX, drasculaY, 38 + offset, 31, drawSurface1, screenSurface); if (currentChapter == 6) - copyRect(x_talk[face], offset2, x_dr + offset, y_dr, 38, 31, drawSurface2, screenSurface); + copyRect(x_talk[face], offset2, drasculaX + offset, drasculaY, 38, 31, drawSurface2, screenSurface); else - copyRect(x_talk[face], offset2, x_dr + offset, y_dr, 38, 31, backSurface, screenSurface); + copyRect(x_talk[face], offset2, drasculaX + offset, drasculaY, 38, 31, backSurface, screenSurface); updateRefresh(); if (withVoices == 0) - centerText(said, x_dr + 19, y_dr); + centerText(said, drasculaX + 19, drasculaY); updateScreen(); @@ -303,16 +303,16 @@ void DrasculaEngine::talk_bj(int index) { updateRefresh_pre(); - copyBackground(x_bj + 2, y_bj - 1, x_bj + 2, y_bj - 1, 27, 40, + copyBackground(bjX + 2, bjY - 1, bjX + 2, bjY - 1, 27, 40, drawSurface1, screenSurface); - copyRect(x_talk[face], 99, x_bj + 2, y_bj - 1, 27, 40, + copyRect(x_talk[face], 99, bjX + 2, bjY - 1, 27, 40, drawSurface3, screenSurface); moveCharacters(); updateRefresh(); if (withVoices == 0) - centerText(said, x_bj + 7, y_bj); + centerText(said, bjX + 7, bjY); updateScreen(); @@ -546,7 +546,7 @@ void DrasculaEngine::talk_drunk(int index) { } } -void DrasculaEngine::talk_vb(int index) { +void DrasculaEngine::talk_vonBraun(int index) { char filename[20]; sprintf(filename, "VB%i.als", index); const char *said = _textvb[_lang][index]; @@ -558,23 +558,23 @@ void DrasculaEngine::talk_vb(int index) { talkInit(filename); - copyBackground(vbX + 5, 64, OBJWIDTH + 1, 0, 25, 27, drawSurface1, drawSurface3); + copyBackground(vonBraunX + 5, 64, OBJWIDTH + 1, 0, 25, 27, drawSurface1, drawSurface3); do { - if (trackVB == 1) { + if (trackVonBraun == 1) { face = _rnd->getRandomNumber(5); copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); moveCharacters(); - moveVB(); + moveVonBraun(); - copyBackground(OBJWIDTH + 1, 0, vbX + 5, 64, 25, 27, drawSurface3, screenSurface); - copyRect(x_talk[face], 34, vbX + 5, 64, 25, 27, frontSurface, screenSurface); + copyBackground(OBJWIDTH + 1, 0, vonBraunX + 5, 64, 25, 27, drawSurface3, screenSurface); + copyRect(x_talk[face], 34, vonBraunX + 5, 64, 25, 27, frontSurface, screenSurface); updateRefresh(); } if (withVoices == 0) - centerText(said, vbX, 66); + centerText(said, vonBraunX, 66); updateScreen(); @@ -587,7 +587,7 @@ void DrasculaEngine::talk_vb(int index) { playMusic(roomMusic); } -void DrasculaEngine::talk_vbpuerta(int index) { +void DrasculaEngine::talk_vonBraunpuerta(int index) { char filename[20]; sprintf(filename, "VB%i.als", index); const char *said = _textvb[_lang][index]; @@ -688,7 +688,7 @@ void DrasculaEngine::talk_hacker(const char *said, const char *filename) { } while (!isTalkFinished(&length)); } -void DrasculaEngine::talk_wolf(int index) { +void DrasculaEngine::talk_werewolf(int index) { char filename[20]; sprintf(filename, "L%i.als", index); const char *said = _textl[_lang][index]; |