diff options
author | Filippos Karapetis | 2008-06-04 09:02:23 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-06-04 09:02:23 +0000 |
commit | e7f8ef11a9901f157aa81ec2d53a246439edc08b (patch) | |
tree | 4063bc1dcd252a541a9f4a21931816f071dde656 /engines | |
parent | c0621fcc4e7851e6045df87a5c901c95dce8e6a2 (diff) | |
download | scummvm-rg350-e7f8ef11a9901f157aa81ec2d53a246439edc08b.tar.gz scummvm-rg350-e7f8ef11a9901f157aa81ec2d53a246439edc08b.tar.bz2 scummvm-rg350-e7f8ef11a9901f157aa81ec2d53a246439edc08b.zip |
carga_escoba -> enterNewRoom
talk_sinc -> talk_sync
n_ejec2 -> savedChapter
Removed updatePalette()
Simplified enterNewRoom()
Merged para_cargar() and loadGame()
Slight cleanup to withoutVerb()
Removed set_dac and set_dacSSN
svn-id: r32528
Diffstat (limited to 'engines')
-rw-r--r-- | engines/drascula/animation.cpp | 12 | ||||
-rw-r--r-- | engines/drascula/drascula.cpp | 126 | ||||
-rw-r--r-- | engines/drascula/drascula.h | 8 | ||||
-rw-r--r-- | engines/drascula/rooms.cpp | 8 | ||||
-rw-r--r-- | engines/drascula/talk.cpp | 2 |
5 files changed, 63 insertions, 93 deletions
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index f3ea1a3114..88bcc1d24d 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -1762,7 +1762,7 @@ void DrasculaEngine::animation_12_5() { animate("frel.bin", 16); clearRoom(); setBrightPalette(); - updatePalette(); + setPalette((byte *)&gamePalette); flags[1] = 1; @@ -1785,7 +1785,7 @@ void DrasculaEngine::animation_12_5() { curX = -1; objExit = 104; withoutVerb(); - carga_escoba("57.ald"); + enterNewRoom(57); } void DrasculaEngine::animation_13_5() { @@ -1940,7 +1940,7 @@ void DrasculaEngine::animation_1_6() { textSurface = extraSurface; clearRoom(); - carga_escoba("102.ald"); + enterNewRoom(102); activatePendulum(); } @@ -1996,7 +1996,7 @@ void DrasculaEngine::animation_6_6() { objExit = 104; curX = -1; withoutVerb(); - carga_escoba("58.ald"); + enterNewRoom(58); hare_se_ve = 1; trackProtagonist = 1; animate("hbp.bin", 14); @@ -2023,7 +2023,7 @@ void DrasculaEngine::animation_9_6() { clearRoom(); curX = -1; objExit = 108; - carga_escoba("59.ald"); + enterNewRoom(59); // The room number was originally changed here to "nada.alg", // which is a non-existant file. In reality, this was just a // hack to set the room number to a non-existant one, so that @@ -2503,7 +2503,7 @@ void DrasculaEngine::animation_5_2() { loadPic("aux5.alg", drawSurface3, 1); flags[8] = 1; curX = curX - 4; - talk_sinc(_text[_lang][46], "46.als", "4442444244244"); + talk_sync(_text[_lang][46], "46.als", "4442444244244"); withoutVerb(); } diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 4322cbbda1..b6db1bf74f 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -301,7 +301,7 @@ void DrasculaEngine::setRGB(byte *dir_lectura, int plt) { gamePalette[x][1] = dir_lectura[cnt++] / 4; gamePalette[x][2] = dir_lectura[cnt++] / 4; } - updatePalette(); + setPalette((byte *)&gamePalette); } void DrasculaEngine::black() { @@ -319,10 +319,6 @@ void DrasculaEngine::black() { setPalette((byte *)&palNegra); } -void DrasculaEngine::updatePalette() { - setPalette((byte *)&gamePalette); -} - void DrasculaEngine::setPalette(byte *PalBuf) { byte pal[256 * 4]; int i; @@ -453,11 +449,11 @@ bool DrasculaEngine::escoba() { trackProtagonist = 1; objExit = 104; if (hay_que_load != 0) { - if (!para_cargar(saveName)) { + if (!loadGame(saveName)) { return true; } } else { - carga_escoba("62.ald"); + enterNewRoom(62); curX = -20; curY = 56; gotoObject(65, 145); @@ -467,9 +463,9 @@ bool DrasculaEngine::escoba() { trackProtagonist = 3; objExit = 162; if (hay_que_load == 0) - carga_escoba("14.ald"); + enterNewRoom(14); else { - if (!para_cargar(saveName)) { + if (!loadGame(saveName)) { return true; } } @@ -485,9 +481,9 @@ bool DrasculaEngine::escoba() { trackProtagonist = 1; objExit = 99; if (hay_que_load == 0) - carga_escoba("20.ald"); + enterNewRoom(20); else { - if (!para_cargar(saveName)) { + if (!loadGame(saveName)) { return true; } } @@ -498,12 +494,12 @@ bool DrasculaEngine::escoba() { addObject(22); objExit = 100; if (hay_que_load == 0) { - carga_escoba("21.ald"); + enterNewRoom(21); trackProtagonist = 0; curX = 235; curY = 164; } else { - if (!para_cargar(saveName)) { + if (!loadGame(saveName)) { return true; } } @@ -520,9 +516,9 @@ bool DrasculaEngine::escoba() { trackProtagonist = 1; objExit = 100; if (hay_que_load == 0) { - carga_escoba("45.ald"); + enterNewRoom(45); } else { - if (!para_cargar(saveName)) { + if (!loadGame(saveName)) { return true; } } @@ -533,10 +529,10 @@ bool DrasculaEngine::escoba() { trackProtagonist = 1; objExit = 104; if (hay_que_load == 0) { - carga_escoba("58.ald"); + enterNewRoom(58); animation_1_6(); } else { - if (!para_cargar(saveName)) { + if (!loadGame(saveName)) { return true; } loadPic("auxdr.alg", drawSurface2, 1); @@ -743,9 +739,8 @@ int DrasculaEngine::removeObject(int osj) { } void DrasculaEngine::withoutVerb() { - int c = 171; - if (menuScreen == 1) - c = 0; + int c = (menuScreen == 1) ? 0 : 171; + if (currentChapter == 5) { if (takeObject == 1 && pickedObject != 16) addObject(pickedObject); @@ -759,22 +754,6 @@ void DrasculaEngine::withoutVerb() { hasName = 0; } -bool DrasculaEngine::para_cargar(char gameName[]) { - previousMusic = roomMusic; - menuScreen = 0; - if (currentChapter != 1) - clearRoom(); - if (!loadGame(gameName)) - return false; - if (currentChapter == 2 || currentChapter == 3 || currentChapter == 5) { - // - } - carga_escoba(currentData); - withoutVerb(); - - return true; -} - char *DrasculaEngine::getLine(char *buf, int len) { byte c; char *b; @@ -808,7 +787,9 @@ void DrasculaEngine::getStringFromLine(char *buf, int len, char* result) { sscanf(buf, "%s", result); } -void DrasculaEngine::carga_escoba(const char *fileName) { +void DrasculaEngine::enterNewRoom(int index) { + char fileName[20]; + sprintf(fileName, "%d.ald", index); int soc, l, martin = 0, objIsExit = 0; float chiquez = 0, pequegnez = 0; char pant1[20], pant2[20], pant3[20], pant4[20]; @@ -1445,7 +1426,7 @@ bool DrasculaEngine::saves() { } if (mouseX > 125 && mouseY > 123 && mouseX < 199 && mouseY < 149 && selectionMade == 1) { - if (!para_cargar(file)) + if (!loadGame(file)) return false; break; } else if (mouseX > 208 && mouseY > 123 && mouseX < 282 && mouseY < 149 && selectionMade == 1) { @@ -1851,7 +1832,7 @@ bool DrasculaEngine::animate(const char *animationFile, int FPS) { memcpy(VGA, AuxBuffDes, 64000); _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); _system->updateScreen(); - set_dac(cPal); + setPalette(cPal); memcpy(AuxBuffLast, AuxBuffDes, 64000); WaitForNext(FPS); while (cnt < NFrames) { @@ -2033,17 +2014,22 @@ void DrasculaEngine::updateRoom() { } bool DrasculaEngine::loadGame(const char *gameName) { - int l, n_ejec2; + int l, savedChapter, roomNum = 0; Common::InSaveFile *sav; + previousMusic = roomMusic; + menuScreen = 0; + if (currentChapter != 1) + clearRoom(); + if (!(sav = _saveFileMan->openForLoading(gameName))) { error("missing savegame file"); } - n_ejec2 = sav->readSint32LE(); - if (n_ejec2 != currentChapter) { + savedChapter = sav->readSint32LE(); + if (savedChapter != currentChapter) { strcpy(saveName, gameName); - currentChapter = n_ejec2 - 1; + currentChapter = savedChapter - 1; hay_que_load = 1; return false; } @@ -2063,6 +2049,9 @@ bool DrasculaEngine::loadGame(const char *gameName) { takeObject = sav->readSint32LE(); pickedObject = sav->readSint32LE(); hay_que_load = 0; + sscanf(currentData, "%d.ald", &roomNum); + enterNewRoom(roomNum); + withoutVerb(); return true; } @@ -2153,7 +2142,7 @@ void DrasculaEngine::setDefaultPalette() { gamePalette[color][component] = defaultPalette[color][component]; } } - updatePalette(); + setPalette((byte *)&gamePalette); } void DrasculaEngine::setBrightPalette() { @@ -2164,7 +2153,7 @@ void DrasculaEngine::setBrightPalette() { gamePalette[color][component] = brightPalette[color][component]; } - updatePalette(); + setPalette((byte *)&gamePalette); } void DrasculaEngine::setDarkPalette() { @@ -2174,7 +2163,7 @@ void DrasculaEngine::setDarkPalette() { for (component = 0; component < 3; component++) gamePalette[color][component] = darkPalette[color][component]; - updatePalette(); + setPalette((byte *)&gamePalette); } void DrasculaEngine::setPaletteBase(int darkness) { @@ -2188,7 +2177,7 @@ void DrasculaEngine::setPaletteBase(int darkness) { } } - updatePalette(); + setPalette((byte *)&gamePalette); } void DrasculaEngine::startWalking() { @@ -2422,7 +2411,7 @@ void DrasculaEngine::removeObject() { } bool DrasculaEngine::exitRoom(int l) { - char roomExit[13]; + int roomNum = 0; if (currentChapter == 1) { if (objectNum[l] == 105 && flags[0] == 0) @@ -2445,10 +2434,9 @@ bool DrasculaEngine::exitRoom(int l) { return true; } clearRoom(); - strcpy(roomExit, _targetSurface[l]); - strcat(roomExit, ".ald"); + sscanf(_targetSurface[l], "%d", &roomNum); curX = -1; - carga_escoba(roomExit); + enterNewRoom(roomNum); } } } else if (currentChapter == 2) { @@ -2477,11 +2465,9 @@ bool DrasculaEngine::exitRoom(int l) { addObject(11); } clearRoom(); - - strcpy(roomExit, _targetSurface[l]); - strcat(roomExit, ".ald"); + sscanf(_targetSurface[l], "%d", &roomNum); curX =- 1; - carga_escoba(roomExit); + enterNewRoom(roomNum); } } else if (currentChapter == 3) { updateDoor(l); @@ -2496,10 +2482,9 @@ bool DrasculaEngine::exitRoom(int l) { doBreak = 1; previousMusic = roomMusic; clearRoom(); - strcpy(roomExit, _targetSurface[l]); - strcat(roomExit, ".ald"); + sscanf(_targetSurface[l], "%d", &roomNum); curX =- 1; - carga_escoba(roomExit); + enterNewRoom(roomNum); } } else if (currentChapter == 4) { updateDoor(l); @@ -2517,10 +2502,9 @@ bool DrasculaEngine::exitRoom(int l) { if (objectNum[l] == 108) gotoObject(171, 78); clearRoom(); - strcpy(roomExit, _targetSurface[l]); - strcat(roomExit, ".ald"); + sscanf(_targetSurface[l], "%d", &roomNum); curX = -1; - carga_escoba(roomExit); + enterNewRoom(roomNum); } } else if (currentChapter == 5) { updateDoor(l); @@ -2536,10 +2520,9 @@ bool DrasculaEngine::exitRoom(int l) { previousMusic = roomMusic; hare_se_ve = 1; clearRoom(); - strcpy(roomExit, _targetSurface[l]); - strcat(roomExit, ".ald"); + sscanf(_targetSurface[l], "%d", &roomNum); curX = -1; - carga_escoba(roomExit); + enterNewRoom(roomNum); } } else if (currentChapter == 6) { updateDoor(l); @@ -2554,10 +2537,9 @@ bool DrasculaEngine::exitRoom(int l) { doBreak = 1; previousMusic = roomMusic; clearRoom(); - strcpy(roomExit, _targetSurface[l]); - strcat(roomExit, ".ald"); + sscanf(_targetSurface[l], "%d", &roomNum); curX = -1; - carga_escoba(roomExit); + enterNewRoom(roomNum); if (objExit == 105) animation_19_6(); @@ -2690,7 +2672,7 @@ int DrasculaEngine::playFrameSSN() { memcpy(dacSSN, mSession, 768); mSession += 768; } - set_dacSSN(dacSSN); + setPalette(dacSSN); break; case kFrameEmptyFrame: WaitFrameSSN(); @@ -2789,10 +2771,6 @@ byte *DrasculaEngine::TryInMem() { return pointer; } -void DrasculaEngine::set_dacSSN(byte *PalBuf) { - setPalette((byte *)PalBuf); -} - void DrasculaEngine::Des_OFF(byte *BufferOFF, byte *MiVideoOFF, int Lenght) { int x = 0; unsigned char Reps; @@ -2867,10 +2845,6 @@ byte *DrasculaEngine::loadPCX(byte *NamePcc) { return AuxBuffDes; } -void DrasculaEngine::set_dac(byte *dac) { - setPalette((byte *)dac); -} - void DrasculaEngine::WaitForNext(int FPS) { _system->delayMillis(1000 / FPS); } diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 2194b50fc0..a28e095bdd 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -185,7 +185,6 @@ public: void setRGB(byte *dir_lectura, int plt); void assignDefaultPalette(); - void updatePalette(); void setPalette(byte *PalBuf); void copyBackground(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *src, byte *dest); @@ -315,8 +314,7 @@ public: void setDarkPalette(); void withoutVerb(); - bool para_cargar(char[]); - void carga_escoba(const char *); + void enterNewRoom(int); void clearRoom(); void gotoObject(int, int); void moveCursor(); @@ -361,7 +359,7 @@ public: void talk_baul(int); void talk(int); void talk(const char *, const char *); - void talk_sinc(const char *, const char *, const char *); + void talk_sync(const char *, const char *, const char *); void talk_drunk(int); void talk_pianist(int); void talk_wolf(int); @@ -406,7 +404,6 @@ public: void MixVideo(byte *OldScreen, byte *NewScreen); void Des_RLE(byte *BufferRLE, byte *MiVideoRLE); void Des_OFF(byte *BufferOFF, byte *MiVideoOFF, int Lenght); - void set_dacSSN(byte *dacSSN); byte *TryInMem(); void EndSSN(); int playFrameSSN(); @@ -429,7 +426,6 @@ public: int flag_tv; byte *loadPCX(byte *NamePcc); - void set_dac(byte *dac); void WaitForNext(int FPS); int getTime(); void reduce_hare_chico(int, int, int, int, int, int, int, byte *, byte *); diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 87b1b4f4e6..b52979a0de 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -99,9 +99,9 @@ void DrasculaEngine::room_3(int fl) { if (pickedObject == kVerbTalk && fl == 129) { talk(23); pause(6); - talk_sinc(_text[_lang][50], "50.als", "11111111111144432554433"); + talk_sync(_text[_lang][50], "50.als", "11111111111144432554433"); } else if (pickedObject == kVerbTalk && fl == 133) { - talk_sinc(_text[_lang][322], "322.als", "13333334125433333333"); + talk_sync(_text[_lang][322], "322.als", "13333334125433333333"); updateRoom(); updateScreen(); pause(25); @@ -326,7 +326,7 @@ void DrasculaEngine::room_15(int fl) { talk(336); trackProtagonist = 3; talk(337); - talk_sinc(_text[_lang][46], "46.als", "4442444244244"); + talk_sync(_text[_lang][46], "46.als", "4442444244244"); trackProtagonist = 1; } else if (pickedObject == 18 && fl == 188 && flags[26] == 0) { copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); @@ -361,7 +361,7 @@ void DrasculaEngine::room_16(int fl) { else if (pickedObject == kVerbTalk && fl == 183) { talk(341); pause(10); - talk_sinc(_text[_lang][50], "50.als", "11111111111144432554433"); + talk_sync(_text[_lang][50], "50.als", "11111111111144432554433"); pause(3); talk_baul(83); } else if (pickedObject == kVerbOpen && fl == 183) { diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index 8e71254cf1..c3861524d4 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -901,7 +901,7 @@ void DrasculaEngine::talk_htel(int index) { updateScreen(); } -void DrasculaEngine::talk_sinc(const char *said, const char *filename, const char *syncChar) { +void DrasculaEngine::talk_sync(const char *said, const char *filename, const char *syncChar) { int talkOffset = 1; int y_mask_talk = 170; int p, face = 0; |