diff options
author | Strangerke | 2012-03-11 23:06:33 +0100 |
---|---|---|
committer | Strangerke | 2012-04-06 08:23:12 +0200 |
commit | aa184ef1b44832365886eaa9e364b03457f8feee (patch) | |
tree | 11bd8ead887c220f169eb62825c2e6c5e111c880 | |
parent | 28eaf257038f6ecc86b4138eb683e3fb29d6ed74 (diff) | |
download | scummvm-rg350-aa184ef1b44832365886eaa9e364b03457f8feee.tar.gz scummvm-rg350-aa184ef1b44832365886eaa9e364b03457f8feee.tar.bz2 scummvm-rg350-aa184ef1b44832365886eaa9e364b03457f8feee.zip |
MORTEVIELLE: move couple of functions to menu class, more renaming
-rw-r--r-- | engines/mortevielle/actions.cpp | 30 | ||||
-rw-r--r-- | engines/mortevielle/menu.cpp | 50 | ||||
-rw-r--r-- | engines/mortevielle/menu.h | 4 | ||||
-rw-r--r-- | engines/mortevielle/mor.cpp | 58 | ||||
-rw-r--r-- | engines/mortevielle/mor.h | 3 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 20 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.h | 4 | ||||
-rw-r--r-- | engines/mortevielle/ovd1.cpp | 40 | ||||
-rw-r--r-- | engines/mortevielle/ovd1.h | 1 | ||||
-rw-r--r-- | engines/mortevielle/speech.cpp | 40 | ||||
-rw-r--r-- | engines/mortevielle/speech.h | 7 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.cpp | 3 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.h | 7 |
13 files changed, 141 insertions, 126 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 49496e8daf..e7e1fddd1a 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -61,10 +61,10 @@ void MortevielleEngine::fctMove() { return; if (g_num == 1) { g_s._currPlace = OWN_ROOM; - tmlieu(0); + g_vm->_menu.setDestinationMenuText(OWN_ROOM); } else if (g_num == 7) { g_s._currPlace = ATTIC; - tmlieu(13); + g_vm->_menu.setDestinationMenuText(ATTIC); } else if (g_num != 6) g_s._currPlace = 26; if ((g_num > 1) && (g_num < 6)) @@ -88,7 +88,7 @@ void MortevielleEngine::fctMove() { t1deva(); if (cx == 2) t1neig(); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); return; } @@ -97,7 +97,7 @@ void MortevielleEngine::fctMove() { t1deau(); if (cx == 2) t1derr(); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); return; } @@ -170,7 +170,7 @@ void MortevielleEngine::fctMove() { if ((cx < 5) || (cx == 13) || (cx == 14)) affrep(); debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); } /** @@ -201,7 +201,7 @@ void MortevielleEngine::fctTake() { g_s._secretPassageObjectId = 0; if (g_s._currPlace == WELL) g_s._wellObjectId = 0; - unsetSearchMenu(); + g_vm->_menu.unsetSearchMenu(); g_vm->_obpart = false; affrep(); } else { @@ -509,7 +509,7 @@ void MortevielleEngine::fctSearch() { g_cs = 0; g_is = 0; g_vm->_heroSearching = true; - setSearchMenu(); + g_vm->_menu.setSearchMenu(); tsuiv(); } else g_crep = 997; @@ -708,9 +708,9 @@ void MortevielleEngine::fctPlace() { g_vm->_menu.displayMenu(); if (enterPassageFl) { g_s._currPlace = SECRET_PASSAGE; - tmlieu(17); + g_vm->_menu.setDestinationMenuText(SECRET_PASSAGE); } else { - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); writepal(14); dessin(0); aniof(1, 2); @@ -1085,7 +1085,7 @@ void MortevielleEngine::fctEat() { g_s._currPlace = DINING_ROOM; g_caff = 10; debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); int j, h, m; updateHour(j, h, m); @@ -1121,7 +1121,7 @@ void MortevielleEngine::fctEat() { void MortevielleEngine::fctEnter() { if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { t1sama(); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); } else if (g_s._currPlace == LANDING) aldepl(); else if (g_ment == 0) @@ -1165,7 +1165,7 @@ void MortevielleEngine::fctEnter() { g_s._currPlace = g_ment; affrep(); debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); g_ment = 0; g_mpers = 0; g_ipers = 0; @@ -1190,7 +1190,7 @@ void MortevielleEngine::fctSleep() { affrep(); afdes(0); debloc(g_s._currPlace); - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); } clsf3(); clearScreenType2(); @@ -1272,7 +1272,7 @@ void MortevielleEngine::fctLeave() { if (g_crep == 0) g_crep = lx; debloc(lx); - tmlieu(lx); + g_vm->_menu.setDestinationMenuText(lx); } } @@ -1518,7 +1518,7 @@ void MortevielleEngine::fctDiscuss() { drawClock(); affrep(); /* chech;*/ - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); clsf3(); } diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 6604b1bee5..a28df25634 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -77,6 +77,28 @@ void Menu::setText(int menuId, Common::String name) { } /** + * Init destination menu + * @remarks Originally called 'tmlieu' + */ +void Menu::setDestinationMenuText(int roomId) { + Common::String nomp; + + if (roomId == 26) + roomId = LANDING; + + int destinationId = 0; + for (; (destinationId < 7) && (g_vm->_v_lieu[destinationId][roomId]); ++destinationId) { + nomp = deline(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex); + while (nomp.size() < 20) + nomp += ' '; + setText(_moveMenu[destinationId + 1], nomp); + } + nomp = "* "; + for (int i = 7; i >= destinationId + 1; --i) + setText(_moveMenu[i], nomp); +} + +/** * _disable a menu item * @param menuId Hi byte represents menu number, lo byte reprsents item index */ @@ -516,4 +538,32 @@ void Menu::initMenu() { g_vm->setMouseClick(false); } +/** + * Engine function - Switch action menu to "Search" mode + * @remarks Originally called 'mfoudi' + */ +void Menu::setSearchMenu() { + for (int i = 1; i <= 7; ++i) + disableMenuItem(_moveMenu[i]); + + for (int i = 1; i <= 11; ++i) + disableMenuItem(_actionMenu[i]); + + setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); + setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); +} + +/** + * Engine function - Switch action menu from "Search" mode back to normal mode + * @remarks Originally called 'mfouen' + */ +void Menu::unsetSearchMenu() { + setDestinationMenuText(g_s._currPlace); + for (int i = 1; i <= 11; ++i) + enableMenuItem(_actionMenu[i]); + + setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); + setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 5672ef7864..adfe35981e 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -52,6 +52,7 @@ public: int _moveMenu[8]; void setText(int menuId, Common::String name); + void setDestinationMenuText(int roomId); void disableMenuItem(int menuId); void enableMenuItem(int menuId); void displayMenu(); @@ -60,6 +61,9 @@ public: void eraseMenu(); void mdn(); void initMenu(); + + void setSearchMenu(); + void unsetSearchMenu(); }; enum { diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index a19bb2dccd..4e56300074 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -1849,26 +1849,6 @@ void tkey1(bool d) { showMouse(); } -void tmlieu(int roomId) { - Common::String nomp; - - if (roomId == 26) - roomId = 15; - - int i = 1; - while ((i < 8) && (g_v_lieu[i][roomId] != 0)) { - nomp = deline(g_v_lieu[i][roomId] + kMenuPlaceStringIndex); - while (nomp.size() < 20) - nomp += ' '; - g_vm->_menu.setText(g_vm->_menu._moveMenu[i], nomp); - ++i; - } - nomp = "* "; - for (int cx = 7; cx >= i; --cx) - g_vm->_menu.setText(g_vm->_menu._moveMenu[cx], nomp); -} - - /* NIVEAU 7 */ void tlu(int af, int ob) { g_caff = 32; @@ -1886,19 +1866,6 @@ void affrep() { g_crep = g_s._currPlace; } -/** - * Engine function - Switch action menu from "Search" mode back to normal mode - * @remarks Originally called 'mfouen' - */ -void unsetSearchMenu() { - tmlieu(g_s._currPlace); - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.enableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_PROBE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE)); -} - /* NIVEAU 6 */ void tperd() { @@ -1906,7 +1873,7 @@ void tperd() { g_ment = 0; g_iouv = 0; g_mchai = 0; - unsetSearchMenu(); + g_vm->_menu.unsetSearchMenu(); if (!g_vm->_blo) t11(21); @@ -2033,22 +2000,7 @@ void endSearch() { g_vm->_obpart = false; g_cs = 0; g_is = 0; - unsetSearchMenu(); -} - -/** - * Engine function - Switch action menu to "Search" mode - * @remarks Originally called 'mfoudi' - */ -void setSearchMenu() { - for (int cx = 1; cx <= 7; ++cx) - g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]); - - for (int cx = 1; cx <= 11; ++cx) - g_vm->_menu.disableMenuItem(_actionMenu[cx]); - - g_vm->_menu.setText(OPCODE_SOUND, g_vm->getEngineString(S_SUITE)); - g_vm->_menu.setText(OPCODE_LIFT, g_vm->getEngineString(S_STOP)); + g_vm->_menu.unsetSearchMenu(); } void mennor() { @@ -2189,7 +2141,7 @@ L1: else g_s._faithScore += 3 * (g_s._faithScore / 10); tsort(); - tmlieu(15); + g_vm->_menu.setDestinationMenuText(LANDING); int cx = convertBitIndexToCharacterIndex(g_ipers); g_caff = 69 + cx; g_crep = g_caff; @@ -2369,7 +2321,7 @@ void treg(int ob) { } else { g_vm->_obpart = true; g_crep = g_caff + 400; - setSearchMenu(); + g_vm->_menu.setSearchMenu(); } } @@ -2495,7 +2447,7 @@ void MortevielleEngine::gameLoaded() { repon(2, g_crep); clsf3(); _endGame = false; - tmlieu(g_s._currPlace); + g_vm->_menu.setDestinationMenuText(g_s._currPlace); modinv(); if (g_s._selectedObjectId != 0) modobj(g_s._selectedObjectId + 400); diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index 5f47a17360..269a566b4b 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -142,11 +142,9 @@ extern void fenat(char ans); /* NIVEAU 8 */ extern void afdes(int ad); extern void tkey1(bool d); -extern void tmlieu(int roomId); /* NIVEAU 7 */ extern void tlu(int af, int ob); extern void affrep(); -extern void unsetSearchMenu(); /* NIVEAU 6 */ extern void tperd(); extern void tsort(); @@ -156,7 +154,6 @@ extern void st1sama(); extern void modinv(); extern void sparl(float adr, float rep); extern void endSearch(); -extern void setSearchMenu(); extern void mennor(); extern void premtet(); /* NIVEAU 5 */ diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 1ef69a6b5b..b328271fc9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -181,7 +181,7 @@ Common::ErrorCode MortevielleEngine::initialise() { init_nbrepm(); initMouse(); - init_lieu(); + loadPlaces(); _soundOff = false; _largestClearScreen = false; @@ -677,4 +677,22 @@ void MortevielleEngine::handleAction() { } } +/** + * Engine function - Init Places + * @remarks Originally called 'init_lieu' + */ +void MortevielleEngine::loadPlaces() { + Common::File f; + + if (!f.open("MXX.mor")) + error("Missing file - MXX.mor"); + + for (int i = 0; i < 7; ++i) { + for (int j = 0; j < 25; ++j) + _v_lieu[i][j] = f.readByte(); + } + + f.close(); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 345db2c724..84a739ea03 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -146,6 +146,8 @@ public: int _c_zzz; int ptr_word; + byte _v_lieu[7][25]; + ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; @@ -215,6 +217,8 @@ public: void fctDiscuss(); void fctSmell(); void fctScratch(); + + void loadPlaces(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 058a880a41..b81c817edf 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -41,16 +41,14 @@ namespace Mortevielle { void charpal() { - Common::File f; // tabdb records - Common::File ft; // tfxx - Common::File fb; // byte values + Common::File f; byte b; - if (!ft.open("fxx.mor")) + if (!f.open("fxx.mor")) error("Missing file - fxx.mor"); for (int i = 0; i < 108; ++i) - g_l[i] = ft.readSint16LE(); - ft.close(); + g_l[i] = f.readSint16LE(); + f.close(); if (!f.open("plxx.mor")) error("Missing file - plxx.mor"); @@ -62,29 +60,30 @@ void charpal() { } f.close(); - if (!fb.open("cxx.mor")) + if (!f.open("cxx.mor")) error("Missing file - cxx.mor"); for (int j = 0; j <= 90; ++j) { - g_palcga[j]._p = fb.readByte(); + g_palcga[j]._p = f.readByte(); for (int i = 0; i <= 15; ++i) { nhom &with = g_palcga[j]._a[i]; - b = fb.readByte(); + b = f.readByte(); with._id = (uint)b >> 4; with._hom[0] = ((uint)b >> 2) & 3; with._hom[1] = b & 3; } } + g_palcga[10]._a[9] = g_palcga[10]._a[5]; for (int j = 0; j <= 14; ++j) { - g_tpt[j]._tax = fb.readByte(); - g_tpt[j]._tay = fb.readByte(); + g_tpt[j]._tax = f.readByte(); + g_tpt[j]._tay = f.readByte(); for (int i = 1; i <= 20; ++i) for (int k = 1; k <= 20; ++k) - g_tpt[j]._des[i][k] = fb.readByte(); + g_tpt[j]._des[i][k] = f.readByte(); } - fb.close(); + f.close(); } void chartex() { @@ -138,21 +137,6 @@ void dialpre() { int_m = true; } -void init_lieu() { - Common::File f; - - if (!f.open("MXX.mor")) - error("Missing file - MXX.mor"); - - for (int i = 1; i < 8; ++i) { - for (int j = 0; j < 25; ++j) - g_v_lieu[i][j] = f.readByte(); - } - - f.close(); -} - - void music() { if (g_vm->_soundOff) return; diff --git a/engines/mortevielle/ovd1.h b/engines/mortevielle/ovd1.h index ef9f401232..90f9c0d235 100644 --- a/engines/mortevielle/ovd1.h +++ b/engines/mortevielle/ovd1.h @@ -33,7 +33,6 @@ namespace Mortevielle { extern void charpal(); extern void chartex(); extern void dialpre(); -extern void init_lieu(); extern void music(); extern void loadBRUIT5(); extern void loadCFIEC(); diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp index dae6e83ae3..2fb933b74f 100644 --- a/engines/mortevielle/speech.cpp +++ b/engines/mortevielle/speech.cpp @@ -49,7 +49,7 @@ void spfrac(int wor) { void charg_car(int &currWordNumb) { int wor = swap(READ_LE_UINT16(&g_mem[kAdrWord + currWordNumb])); - int int_ = wor & 0x3f; + int int_ = wor & 0x3f; // 63 if ((int_ >= 0) && (int_ <= 13)) { g_c3._val = int_; @@ -464,43 +464,53 @@ void trait_car() { } // switch c2.code } -void rot_chariot() { +/** + * Make the queue evolve by 1 value + * @remarks Originally called 'rot_chariot' + */ +void moveQueue() { g_c1 = g_c2; g_c2 = g_c3; g_c3._val = 32; g_c3._code = 9; } -void init_chariot() { +/** + * initialize the queue + * @remarks Originally called 'init_chariot' + */ +void initQueue() { g_c3._rep = 0; g_c3._freq = 0; g_c3._acc = 0; - rot_chariot(); - rot_chariot(); + moveQueue(); + moveQueue(); } - -void trait_ph() { +/** + * Handle a phoneme + * @remarks Originally called 'trait_ph' + */ +void handlePhoneme() { const int deca[3] = {300, 30, 40}; - int ptr_tcph = g_num_ph - 1; - int startPos = swap(g_t_cph[ptr_tcph]) + deca[g_typlec]; - int endPos = swap(g_t_cph[ptr_tcph + 1]) + deca[g_typlec]; + int startPos = swap(g_t_cph[g_phonemeNumb - 1]) + deca[g_typlec]; + int endPos = swap(g_t_cph[g_phonemeNumb]) + deca[g_typlec]; int wordCount = endPos - startPos; for (int i = (uint)startPos >> 1, currWord = 0; i < (int)((uint)endPos >> 1); i++, currWord += 2) WRITE_LE_UINT16(&g_mem[kAdrWord + currWord], g_t_cph[i]); g_ptr_oct = 0; int currWord = 0; - init_chariot(); + initQueue(); do { - rot_chariot(); + moveQueue(); charg_car(currWord); trait_car(); } while (currWord < wordCount); - rot_chariot(); + moveQueue(); trait_car(); entroct(ord('#')); } @@ -516,7 +526,7 @@ void startSpeech(int rep, int ht, int typ) { if (g_vm->_soundOff) return; - g_num_ph = rep; + g_phonemeNumb = rep; g_haut = ht; g_typlec = typ; if (g_typlec != 0) { @@ -542,7 +552,7 @@ void startSpeech(int rep, int ht, int typ) { default: break; } - trait_ph(); + handlePhoneme(); g_vm->_soundManager.litph(g_tbi, typ, tempo); if (g_typlec != 0) for (int i = 0; i <= 500; ++i) { diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h index 7947ee4472..03caa83afa 100644 --- a/engines/mortevielle/speech.h +++ b/engines/mortevielle/speech.h @@ -49,7 +49,6 @@ const int kTempoNoise = 78; const int kTempoF = 80; const int kTempoM = 89; - // Useless constants //const int segdon = 0x6c00; //const int adbruit2 = 0x6b30;/*3A80;*/ @@ -69,9 +68,9 @@ extern void loadPhonemeSounds(); extern void loadNoise(); extern void trait_car(); -extern void rot_chariot(); -extern void init_chariot(); -extern void trait_ph(); +extern void moveQueue(); +extern void initQueue(); +extern void handlePhoneme(); extern void startSpeech(int rep, int ht, int typ); } // End of namespace Mortevielle diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index 62f983458f..78ff6ef0bd 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -119,7 +119,7 @@ int g_x, g_perdep, g_prebru, g_typlec, - g_num_ph, + g_phonemeNumb, g_numpal, g_ptr_oct, g_k_tempo; @@ -142,7 +142,6 @@ byte g_lettres[7][24]; uint16 g_t_mot[maxti + 1]; int g_tay_tchar; ind g_t_rec[maxtd + 1]; -byte g_v_lieu[8][25]; int g_l[108]; int g_tbi[256]; chariot g_c1, g_c2, g_c3; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index 9d81a8e16e..26131c7e66 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -224,13 +224,13 @@ extern int g_x, g_yprec, g_perdep, g_prebru, - g_typlec, - g_num_ph, + g_typlec, // Speech + g_phonemeNumb, // Speech g_numpal, g_ptr_oct, g_k_tempo; -extern int g_t_cph[6401]; +extern int g_t_cph[6401]; // Speech extern byte g_tabdon[4001]; extern Common::String g_hintPctMessage; // gives the pct of hints found @@ -248,7 +248,6 @@ extern byte g_lettres[7][24]; extern uint16 g_t_mot[maxti + 1]; extern int g_tay_tchar; extern ind g_t_rec[maxtd + 1]; -extern byte g_v_lieu[8][25]; extern int g_l[108]; extern int g_tbi[256]; extern chariot g_c1, g_c2, g_c3; |