From d0ec6e9b32249a81606594c4d77c5baf29061550 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 20 Feb 2012 08:28:06 +0100 Subject: MORTEVIELLE: rename verbs and associated opcodes, use enum for opcodes --- engines/mortevielle/actions.cpp | 140 +++++++++++++++++++++++++++++------- engines/mortevielle/actions.h | 46 ++++++------ engines/mortevielle/menu.cpp | 38 +++++----- engines/mortevielle/menu.h | 2 +- engines/mortevielle/mor2.cpp | 18 ++--- engines/mortevielle/mortevielle.cpp | 6 +- engines/mortevielle/prog.cpp | 73 ++++++++++++------- engines/mortevielle/taffich.cpp | 2 +- engines/mortevielle/var_mor.h | 35 +++------ 9 files changed, 229 insertions(+), 131 deletions(-) (limited to 'engines') diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 5aa91f80df..caaeb07638 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -42,7 +42,11 @@ namespace Mortevielle { -void taller() { +/** + * Engine function - Move + * @remarks Originally called 'taller' + */ +void fctMove() { //int mx, cx, cy; int cx; @@ -171,7 +175,11 @@ L2: tmlieu(s.mlieu); } -void tprendre() { +/** + * Engine function - Take + * @remarks Originally called 'tprendre' + */ +void fctTake() { //int cx, cy, cz; int cx; @@ -305,7 +313,11 @@ void tsprendre() { clsf2(); } -void tsoulever() { +/** + * Engine function - Lift + * @remarks Originally called 'tsoulever' + */ +void fctLift() { int cx; if (!syn) @@ -337,7 +349,11 @@ void tsoulever() { crep = 997; } -void tlire() { +/** + * Engine function - Read + * @remarks Originally called 'tlire' + */ +void fctRead() { // int iaff; if (caff > 99) @@ -361,7 +377,11 @@ void tslire() { st4(s.derobj); } -void tregarder() { +/** + * Engine function - Look + * @remarks Originally called 'tregarder' + */ +void fctLook() { int cx; if (caff > 99) { @@ -442,7 +462,11 @@ void tsregarder() { crep = 186; } -void tfouiller() { +/** + * Engine function - Search + * @remarks Originally called 'tfouiller' + */ +void fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; int cx; @@ -531,14 +555,18 @@ void tsfouiller() { crep = 186; } -void touvrir() { +/** + * Engine function - Open + * @remarks Originally called 'touvrir' + */ +void fctOpen() { int cx, haz; if (!syn) ecr3(g_vm->getString(S_OPEN)); if (caff == 26) { if (ment != 0) { - msg[4] = entrer; + msg[4] = OPCODE_ENTER; syn = true; } else crep = 997; @@ -588,7 +616,11 @@ void touvrir() { } } -void tmettre() { +/** + * Engine function - Place + * @remarks Originally called 'tmettre' + */ +void fctPlace() { int quel; bool entre; char st[1410]; @@ -708,7 +740,11 @@ void tmettre() { } } -void ttourner() { +/** + * Engine function - Turn + * @remarks Originally called 'ttourner' + */ +void fctTurn() { int quel; if (caff > 99) { @@ -746,7 +782,11 @@ void ttourner() { } } -void tcacher() { +/** + * Engine function - Hide Self + * @remarks Originally called 'tcacher' + */ +void fctHideSelf() { if (!syn) ecr3(g_vm->getString(S_HIDE_SELF)); tfleche(); @@ -761,7 +801,11 @@ void tcacher() { } } -void tattacher() { +/** + * Engine function - Attach + * @remarks Originally called 'tattacher' + */ +void fctAttach() { if (s.derobj == 0) crep = 186; else { @@ -784,7 +828,11 @@ void tattacher() { } } -void tfermer() { +/** + * Engine function - Close + * @remarks Originally called 'tfermer' + */ +void fctClose() { int cx, chai; if (!syn) @@ -819,7 +867,11 @@ void tfermer() { crep = 999; } -void tfrapper() { +/** + * Engine function - Knock + * @remarks Originally called 'tfrapper' + */ +void fctKnock() { int l, p, haz; if (!syn) @@ -942,7 +994,11 @@ void tposer() { } } -void tecouter() { +/** + * Engine function - Listen + * @remarks Originally called 'tecouter' + */ +void fctListen() { int l, p, haz, j, h, m; if (s.mlieu != 26) @@ -976,7 +1032,11 @@ void tecouter() { } } -void tmanger() { +/** + * Engine function - Eat + * @remarks Originally called 'tmanger' + */ +void fctEat() { int j, h, m; if ((s.mlieu > 15) && (s.mlieu < 26)) @@ -1008,7 +1068,11 @@ void tmanger() { } } -void tentrer() { +/** + * Engine function - Enter + * @remarks Originally called 'tentrer' + */ +void fctEnter() { int x, z = 0; if ((s.mlieu == 21) || (s.mlieu == 22)) { @@ -1064,7 +1128,11 @@ void tentrer() { } } -void tdormir() { +/** + * Engine function - Sleep + * @remarks Originally called 'tdormir' + */ +void fctSleep() { int z, j, h, m, quel; if ((s.mlieu > 15) && (s.mlieu < 26)) { @@ -1105,7 +1173,11 @@ void tdormir() { num = 0; } -void tdefoncer() { +/** + * Engine function - Force + * @remarks Originally called 'tdefoncer' + */ +void fctForce() { if (!syn) ecr3(g_vm->getString(S_SMASH)); if (caff < 25) @@ -1119,7 +1191,11 @@ void tdefoncer() { } } -void tsortir() { +/** + * Engine function - Leave + * @remarks Originally called 'tsortir' + */ +void fctLeave() { int lx = 0; tsort(); @@ -1151,7 +1227,11 @@ void tsortir() { } } -void tattendre() { +/** + * Engine function - Wait + * @remarks Originally called 'tattendre' + */ +void fctWait() { int quel; mpers = 0; @@ -1180,7 +1260,11 @@ void tattendre() { tinke(); } -void tsonder() { +/** + * Engine function - Sound + * @remarks Originally called 'tsonder' + */ +void fctSound() { if (!syn) ecr3(g_vm->getString(S_PROBE2)); if (caff < 27) { @@ -1387,7 +1471,11 @@ void tparler() { clsf3(); } -void tsentir() { +/** + * Engine function - Smell + * @remarks Originally called 'tsentir' + */ +void fctSmell() { crep = 119; if (caff < 26) { if (!syn) @@ -1401,7 +1489,11 @@ void tsentir() { num = 0; } -void tgratter() { +/** + * Engine function - Scratch + * @remarks Originally called 'tgratter' + */ +void fctScratch() { crep = 155; if (caff < 27) { if (!syn) diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h index 196e5a5de6..d96b712835 100644 --- a/engines/mortevielle/actions.h +++ b/engines/mortevielle/actions.h @@ -31,35 +31,35 @@ namespace Mortevielle { /* NIVEAU 4 */ -extern void taller(); -extern void tprendre(); +extern void fctMove(); +extern void fctTake(); extern void tsprendre(); -extern void tsoulever(); -extern void tlire(); +extern void fctLift(); +extern void fctRead(); extern void tslire(); -extern void tregarder(); +extern void fctLook(); extern void tsregarder(); -extern void tfouiller(); +extern void fctSearch(); extern void tsfouiller(); -extern void touvrir(); -extern void tmettre(); -extern void ttourner(); -extern void tcacher(); -extern void tattacher(); -extern void tfermer(); -extern void tfrapper(); +extern void fctOpen(); +extern void fctPlace(); +extern void fctTurn(); +extern void fctHideSelf(); +extern void fctAttach(); +extern void fctClose(); +extern void fctKnock(); extern void tposer(); -extern void tecouter(); -extern void tmanger(); -extern void tentrer(); -extern void tdormir(); -extern void tdefoncer(); -extern void tsortir(); -extern void tattendre(); -extern void tsonder(); +extern void fctListen(); +extern void fctEat(); +extern void fctEnter(); +extern void fctSleep(); +extern void fctForce(); +extern void fctLeave(); +extern void fctWait(); +extern void fctSound(); extern void tparler(); -extern void tsentir(); -extern void tgratter(); +extern void fctSmell(); +extern void fctScratch(); /* NIVEAU 2 */ extern void endGame(); extern void loseGame(); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 7da2eefb0f..51fad3f651 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -63,7 +63,7 @@ void Menu::menut(int no, Common::String nom) { _inv[l].insertChar(' ', 0); } break; - case depla: + case MENU_MOVE: _dep[l] = s; break; case action: @@ -96,7 +96,7 @@ void Menu::disableMenuItem(int no) { _inv[l].setChar('*', 0); } break; - case depla: + case MENU_MOVE: _dep[l].setChar('*', 0); break; case action: @@ -126,7 +126,7 @@ void Menu::enableMenuItem(int no) { _inv[l].setChar(' ', 21); } break; - case depla: + case MENU_MOVE: _dep[l].setChar(' ', 0); break; case action: @@ -189,8 +189,8 @@ void Menu::menu_aff() { void Menu::drawMenu() { menu_aff(); _menuActive = true; - msg4 = no_choice; - msg3 = no_choice; + msg4 = OPCODE_NONE; + msg3 = OPCODE_NONE; choisi = false; g_vm->setMouseClick(false); test0 = false; @@ -199,7 +199,7 @@ void Menu::drawMenu() { void Menu::invers(int ix) { Common::String s; - if (msg4 == no_choice) return; + if (msg4 == OPCODE_NONE) return; g_vm->_screenSurface.putxy(don[msg3][1] << 3, succ(void, lo(msg4)) << 3); switch (msg3) { case 1 : @@ -238,7 +238,7 @@ void Menu::invers(int ix) { if ((s[0] != '*') && (s[0] != '<')) g_vm->_screenSurface.writeg(s, ix); else - msg4 = no_choice; + msg4 = OPCODE_NONE; } void Menu::util(int x, int y) { @@ -258,9 +258,9 @@ void Menu::util(int x, int y) { msg4 = ix; invers(0); } - } else if (msg4 != no_choice) { + } else if (msg4 != OPCODE_NONE) { invers(1); - msg4 = no_choice; + msg4 = OPCODE_NONE; } } @@ -401,7 +401,7 @@ void Menu::mdn() { || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { if (x < 76 * res) ix = invent; - else if (x < 124 * res) ix = depla; + else if (x < 124 * res) ix = MENU_MOVE; else if (x < 172 * res) ix = action; else if (x < 220 * res) ix = saction; else if (x < 268 * res) ix = discut; @@ -411,13 +411,13 @@ void Menu::mdn() { menuUp(msg3); menuDown(ix); msg3 = ix; - msg4 = no_choice; + msg4 = OPCODE_NONE; } } else { /* Not in the MenuTitle line */ if ((y > 11) && (test0)) util(x, y); } } else { /* There was a click */ - if ((msg3 == fichier) && (msg4 != no_choice)) { + if ((msg3 == fichier) && (msg4 != OPCODE_NONE)) { // Another menu to be _displayed g_vm->setMouseClick(false); menuUp(msg3); @@ -428,12 +428,12 @@ void Menu::mdn() { g_vm->setMouseClick(false); } else { // A menu was clicked on - choisi = (test0) && (msg4 != no_choice); + choisi = (test0) && (msg4 != OPCODE_NONE); menuUp(msg3); msg[4] = msg4; msg[3] = msg3; - msg3 = no_choice; - msg4 = no_choice; + msg3 = OPCODE_NONE; + msg4 = OPCODE_NONE; g_vm->setMouseClick(false); } @@ -486,10 +486,10 @@ void Menu::initMenu() { if (i > 6) g_vm->_menu.disableMenuItem(_invt[i]); } - msg3 = no_choice; - msg4 = no_choice; - msg[3] = no_choice; - msg[4] = no_choice; + msg3 = OPCODE_NONE; + msg4 = OPCODE_NONE; + msg[3] = OPCODE_NONE; + msg[4] = OPCODE_NONE; g_vm->setMouseClick(false); } diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index 8779d51298..d4aecbcbd9 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -60,7 +60,7 @@ public: }; enum { - invent = 1, depla = 2, action = 3, saction = 4, + invent = 1, MENU_MOVE = 2, action = 3, saction = 4, discut = 5, fichier = 6, sauve = 7, charge = 8 }; diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 7a49456197..15d413d119 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -39,10 +39,10 @@ namespace Mortevielle { -const int men[12] = { 0, - scacher, attacher, defoncer, dormir, - entrer, fermer, frapper, manger, - mettre, ouvrir, sortir +const int men[12] = { OPCODE_NONE, + OPCODE_HIDE_SELF, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP, + OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT, + OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE }; void tinke() { @@ -251,7 +251,7 @@ void tlu(int af, int ob) { repon(2, 999); tkey1(true); caff = af; - msg[3] = no_choice; + msg[3] = OPCODE_NONE; crep = 998; } @@ -276,8 +276,8 @@ void mfouen() for (cx = 1; cx <= 11; cx ++) g_vm->_menu.enableMenuItem(men[cx]); - g_vm->_menu.menut(sonder, g_vm->getString(S_PROBE)); - g_vm->_menu.menut(soulever, g_vm->getString(S_RAISE)); + g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_PROBE)); + g_vm->_menu.menut(OPCODE_LIFT, g_vm->getString(S_RAISE)); } /* NIVEAU 6 */ @@ -415,8 +415,8 @@ void mfoudi() { for (cx = 1; cx <= 11; cx ++) g_vm->_menu.disableMenuItem(men[cx]); - g_vm->_menu.menut(sonder, g_vm->getString(S_SUITE)); - g_vm->_menu.menut(soulever, g_vm->getString(S_STOP)); + g_vm->_menu.menut(OPCODE_SOUND, g_vm->getString(S_SUITE)); + g_vm->_menu.menut(OPCODE_LIFT, g_vm->getString(S_STOP)); } void mennor() { diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 256b8551ed..82eb1179f1 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -571,7 +571,7 @@ void MortevielleEngine::handleAction() { temps = Alert::show(stpou, 1); return; } else if (inkey == '\77') { - if ((mnumo != no_choice) && ((msg[3] == action) || (msg[3] == saction))) { + if ((mnumo != OPCODE_NONE) && ((msg[3] == action) || (msg[3] == saction))) { msg[4] = mnumo; ecr3(g_vm->getString(S_IDEM)); } else return; @@ -594,9 +594,9 @@ void MortevielleEngine::handleAction() { if (! anyone) { if ((fouil) || (obpart)) { if (y_s < 12) return; - if ((msg[4] == sonder) || (msg[4] == soulever)) { + if ((msg[4] == OPCODE_SOUND) || (msg[4] == OPCODE_LIFT)) { oo = true; - if ((msg[4] == soulever) || (obpart)) { + if ((msg[4] == OPCODE_LIFT) || (obpart)) { finfouil(); caff = s.mlieu; crep = 998; diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 737ec6602e..2ee26a9392 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -157,37 +157,58 @@ void tsitu() iesc = false; if (anyone) goto L1; if (brt) - if ((msg[3] == depla) || (msg[4] == sortir) || (msg[4] == dormir) || - (msg[4] == manger)) { + if ((msg[3] == MENU_MOVE) || (msg[4] == OPCODE_LEAVE) || (msg[4] == OPCODE_SLEEP) || (msg[4] == OPCODE_EAT)) { ctrm = 4; goto L2; } - if (msg[3] == depla) taller(); //Translation: go to + if (msg[3] == MENU_MOVE) + fctMove(); if (msg[3] == discut) tparler(); //Translation: talk if (msg[3] == invent) tsprendre(); //Translation: inventory/take - if (msg[4] == attacher) tattacher(); //Translation: tie - if (msg[4] == attendre) tattendre(); //Translation: wait - if (msg[4] == defoncer) tdefoncer(); //Translation: smash - if (msg[4] == dormir) tdormir(); //Translation: sleep - if (msg[4] == ecouter) tecouter(); //Translation: listen - if (msg[4] == entrer) tentrer(); //Translation: enter - if (msg[4] == fermer) tfermer(); //Translation: close - if (msg[4] == fouiller) tfouiller(); //Translation: search - if (msg[4] == frapper) tfrapper(); //Translation: hit - if (msg[4] == gratter) tgratter(); //Translation: scratch - if (msg[4] == lire) tlire(); //Translation: read - if (msg[4] == manger) tmanger(); //Translation: eat - if (msg[4] == mettre) tmettre(); //Translation: put - if (msg[4] == ouvrir) touvrir(); //Translation: open - if (msg[4] == prendre) tprendre(); //Translation: take - if (msg[4] == regarder) tregarder(); //Translation: look - if (msg[4] == sentir) tsentir(); //Translation: smell - if (msg[4] == sonder) tsonder(); //Translation: probe - if (msg[4] == sortir) tsortir(); //Translation: exit - if (msg[4] == soulever) tsoulever(); //Translation: lift - if (msg[4] == tourner) ttourner(); //Translation: turn - if (msg[4] == scacher) { //Translation: hide - tcacher(); + if (msg[4] == OPCODE_ATTACH) + fctAttach(); + if (msg[4] == OPCODE_WAIT) + fctWait(); + if (msg[4] == OPCODE_FORCE) + fctForce(); + if (msg[4] == OPCODE_SLEEP) + fctSleep(); + if (msg[4] == OPCODE_LISTEN) + fctListen(); + if (msg[4] == OPCODE_ENTER) + fctEnter(); + if (msg[4] == OPCODE_CLOSE) + fctClose(); + if (msg[4] == OPCODE_SEARCH) + fctSearch(); + if (msg[4] == OPCODE_KNOCK) + fctKnock(); + if (msg[4] == OPCODE_SCRATCH) + fctScratch(); + if (msg[4] == OPCODE_READ) + fctRead(); + if (msg[4] == OPCODE_EAT) + fctEat(); + if (msg[4] == OPCODE_PLACE) + fctPlace(); + if (msg[4] == OPCODE_OPEN) + fctOpen(); + if (msg[4] == OPCODE_TAKE) + fctTake(); + if (msg[4] == OPCODE_LOOK) + fctLook(); + if (msg[4] == OPCODE_SMELL) + fctSmell(); + if (msg[4] == OPCODE_SOUND) + fctSound(); + if (msg[4] == OPCODE_LEAVE) + fctLeave(); + if (msg[4] == OPCODE_LIFT) + fctLift(); + if (msg[4] == OPCODE_TURN) + fctTurn(); + if (msg[4] == OPCODE_HIDE_SELF) { //Translation: hide + fctHideSelf(); goto L1; } if (msg[4] == sfouiller) tsfouiller();//Translation: search diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 9402f3fec5..08aaa2a1f1 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -244,7 +244,7 @@ void taffich() { charani(filename, lgt, handle); } showMouse(); - if ((a < 27) && ((_maff < 27) || (s.mlieu == 15)) && (msg[4] != entrer)) { + if ((a < 27) && ((_maff < 27) || (s.mlieu == 15)) && (msg[4] != OPCODE_ENTER)) { if ((a == 13) || (a == 14)) person(); else if (! blo) diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index bfccd66e34..7a3249dee0 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -128,31 +128,16 @@ const int arep = 1314; const int amzon = 1650; const int fleche = 1758; -const int no_choice = 0; - -const int attacher = 0x301; -const int attendre = 0x302; -const int defoncer = 0x303; -const int dormir = 0x304; -const int ecouter = 0x305; -const int entrer = 0x306; -const int fermer = 0x307; -const int fouiller = 0x308; -const int frapper = 0x309; -const int gratter = 0x30a; -const int lire = 0x30b; -const int manger = 0x30c; -const int mettre = 0x30d; -const int ouvrir = 0x30e; -const int prendre = 0x30f; -const int regarder = 0x310; -const int sentir = 0x311; -const int sonder = 0x312; -const int sortir = 0x313; -const int soulever = 0x314; -const int tourner = 0x315; - -const int scacher = 0x401; +const int OPCODE_NONE = 0; + +enum verbs {OPCODE_ATTACH = 0x301, OPCODE_WAIT = 0x302, OPCODE_FORCE = 0x303, OPCODE_SLEEP = 0x304, OPCODE_LISTEN = 0x305, + OPCODE_ENTER = 0x306, OPCODE_CLOSE = 0x307, OPCODE_SEARCH = 0x308, OPCODE_KNOCK = 0x309, OPCODE_SCRATCH = 0x30a, + OPCODE_READ = 0x30b, OPCODE_EAT = 0x30c, OPCODE_PLACE = 0x30d, OPCODE_OPEN = 0x30e, OPCODE_TAKE = 0x30f, + OPCODE_LOOK = 0x310, OPCODE_SMELL = 0x311, OPCODE_SOUND = 0x312, OPCODE_LEAVE = 0x313, OPCODE_LIFT = 0x314, + OPCODE_TURN = 0x315}; + +enum verbs2 {OPCODE_HIDE_SELF = 0x401}; + const int sfouiller = 0x402; const int slire = 0x403; const int sposer = 0x404; -- cgit v1.2.3