diff options
author | Strangerke | 2012-03-10 14:17:05 +0100 |
---|---|---|
committer | Strangerke | 2012-04-06 08:23:09 +0200 |
commit | 1ff2cb051d035f587314bf4e312d759bbfd036f9 (patch) | |
tree | ad799707f41d2b382a73eb317e790242b00e8422 /engines/mortevielle | |
parent | b5d2fa7e5f11ed02bc8b52459265a07c9d61440b (diff) | |
download | scummvm-rg350-1ff2cb051d035f587314bf4e312d759bbfd036f9.tar.gz scummvm-rg350-1ff2cb051d035f587314bf4e312d759bbfd036f9.tar.bz2 scummvm-rg350-1ff2cb051d035f587314bf4e312d759bbfd036f9.zip |
MORTEVIELLE: Move opcode functions to MortevielleEngine class
Diffstat (limited to 'engines/mortevielle')
-rw-r--r-- | engines/mortevielle/actions.cpp | 61 | ||||
-rw-r--r-- | engines/mortevielle/actions.h | 68 | ||||
-rw-r--r-- | engines/mortevielle/mor.cpp | 37 | ||||
-rw-r--r-- | engines/mortevielle/mor.h | 1 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 5 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.h | 32 | ||||
-rw-r--r-- | engines/mortevielle/mouse.cpp | 4 | ||||
-rw-r--r-- | engines/mortevielle/mouse.h | 2 |
8 files changed, 87 insertions, 123 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 59a99ef811..49496e8daf 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -26,7 +26,6 @@ */ #include "common/scummsys.h" -#include "mortevielle/actions.h" #include "mortevielle/dialogs.h" #include "mortevielle/menu.h" #include "mortevielle/mor.h" @@ -42,7 +41,7 @@ namespace Mortevielle { * Engine function - Move * @remarks Originally called 'taller' */ -void fctMove() { +void MortevielleEngine::fctMove() { if ((g_s._currPlace == 26) && (g_msg[4] == g_vm->_menu._moveMenu[6])) { g_s._currPlace = LANDING; g_caff = g_s._currPlace; @@ -178,7 +177,7 @@ void fctMove() { * Engine function - Take * @remarks Originally called 'tprendre' */ -void fctTake() { +void MortevielleEngine::fctTake() { if (g_caff > 99) { int cx = g_caff; avpoing(cx); @@ -291,7 +290,7 @@ void fctTake() { * Engine function - Inventory / Take * @remarks Originally called 'tsprendre' */ -void fctInventoryTake() { +void MortevielleEngine::fctInventoryTake() { int cx, cy, cz; cx = 0; @@ -317,7 +316,7 @@ void fctInventoryTake() { * Engine function - Lift * @remarks Originally called 'tsoulever' */ -void fctLift() { +void MortevielleEngine::fctLift() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_LIFT)); tfleche(); @@ -351,7 +350,7 @@ void fctLift() { * Engine function - Read * @remarks Originally called 'tlire' */ -void fctRead() { +void MortevielleEngine::fctRead() { if (g_caff > 99) st4(g_caff); else { @@ -370,7 +369,7 @@ void fctRead() { * Engine function - Self / Read * @remarks Originally called 'tslire' */ -void fctSelfRead() { +void MortevielleEngine::fctSelfRead() { if (g_s._selectedObjectId == 0) g_crep = 186; else @@ -381,7 +380,7 @@ void fctSelfRead() { * Engine function - Look * @remarks Originally called 'tregarder' */ -void fctLook() { +void MortevielleEngine::fctLook() { int cx; if (g_caff > 99) { @@ -459,7 +458,7 @@ void fctLook() { * Engine function - Self / Look * @remarks Originally called 'tsregarder' */ -void fctSelftLook() { +void MortevielleEngine::fctSelftLook() { if (g_s._selectedObjectId != 0) treg(g_s._selectedObjectId); else @@ -470,7 +469,7 @@ void fctSelftLook() { * Engine function - Search * @remarks Originally called 'tfouiller' */ -void fctSearch() { +void MortevielleEngine::fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; if (g_caff > 99) { @@ -563,7 +562,7 @@ void fctSearch() { * Engine function - Self / Search * @remarks Originally called 'tsfouiller' */ -void fctSelfSearch() { +void MortevielleEngine::fctSelfSearch() { if (g_s._selectedObjectId != 0) st7(g_s._selectedObjectId); else @@ -574,7 +573,7 @@ void fctSelfSearch() { * Engine function - Open * @remarks Originally called 'touvrir' */ -void fctOpen() { +void MortevielleEngine::fctOpen() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_OPEN)); @@ -636,7 +635,7 @@ void fctOpen() { * Engine function - Place * @remarks Originally called 'tmettre' */ -void fctPlace() { +void MortevielleEngine::fctPlace() { if (g_s._selectedObjectId == 0) { g_crep = 186; return; @@ -770,7 +769,7 @@ void fctPlace() { * Engine function - Turn * @remarks Originally called 'ttourner' */ -void fctTurn() { +void MortevielleEngine::fctTurn() { if (g_caff > 99) { g_crep = 149; return; @@ -810,7 +809,7 @@ void fctTurn() { * Engine function - Hide Self * @remarks Originally called 'tcacher' */ -void fctSelfHide() { +void MortevielleEngine::fctSelfHide() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_HIDE_SELF)); tfleche(); @@ -829,7 +828,7 @@ void fctSelfHide() { * Engine function - Attach * @remarks Originally called 'tattacher' */ -void fctAttach() { +void MortevielleEngine::fctAttach() { if (g_s._selectedObjectId == 0) g_crep = 186; else { @@ -856,7 +855,7 @@ void fctAttach() { * Engine function - Close * @remarks Originally called 'tfermer' */ -void fctClose() { +void MortevielleEngine::fctClose() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_CLOSE)); @@ -896,7 +895,7 @@ void fctClose() { * Engine function - Knock * @remarks Originally called 'tfrapper' */ -void fctKnock() { +void MortevielleEngine::fctKnock() { warning("Knock - _currPlace %d", g_s._currPlace); if (!g_vm->_syn) @@ -946,7 +945,7 @@ void fctKnock() { * Engine function - Self / Put * @remarks Originally called 'tposer' */ -void fctSelfPut() { +void MortevielleEngine::fctSelfPut() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_POSE)); if (g_s._selectedObjectId == 0) @@ -1040,7 +1039,7 @@ void fctSelfPut() { * Engine function - Listen * @remarks Originally called 'tecouter' */ -void fctListen() { +void MortevielleEngine::fctListen() { if (g_s._currPlace != 26) g_crep = 101; else { @@ -1078,7 +1077,7 @@ void fctListen() { * Engine function - Eat * @remarks Originally called 'tmanger' */ -void fctEat() { +void MortevielleEngine::fctEat() { if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { g_crep = 148; } else { @@ -1119,7 +1118,7 @@ void fctEat() { * Engine function - Enter * @remarks Originally called 'tentrer' */ -void fctEnter() { +void MortevielleEngine::fctEnter() { if ((g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK)) { t1sama(); tmlieu(g_s._currPlace); @@ -1178,7 +1177,7 @@ void fctEnter() { * Engine function - Sleep * @remarks Originally called 'tdormir' */ -void fctSleep() { +void MortevielleEngine::fctSleep() { int z, j, h, m; if ((g_s._currPlace > LANDING) && (g_s._currPlace < 26)) { @@ -1225,7 +1224,7 @@ void fctSleep() { * Engine function - Force * @remarks Originally called 'tdefoncer' */ -void fctForce() { +void MortevielleEngine::fctForce() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_SMASH)); if (g_caff < 25) @@ -1245,7 +1244,7 @@ void fctForce() { * Engine function - Leave * @remarks Originally called 'tsortir' */ -void fctLeave() { +void MortevielleEngine::fctLeave() { tsort(); g_crep = 0; if ((g_s._currPlace == MOUNTAIN) || (g_s._currPlace == MANOR_FRONT) || (g_s._currPlace == MANOR_BACK) || (g_s._currPlace == WELL)) @@ -1281,7 +1280,7 @@ void fctLeave() { * Engine function - Wait * @remarks Originally called 'tattendre' */ -void fctWait() { +void MortevielleEngine::fctWait() { g_mpers = 0; clsf3(); @@ -1314,7 +1313,7 @@ void fctWait() { * Engine function - Sound * @remarks Originally called 'tsonder' */ -void fctSound() { +void MortevielleEngine::fctSound() { if (!g_vm->_syn) ecr3(g_vm->getEngineString(S_PROBE2)); if (g_caff < 27) { @@ -1329,7 +1328,7 @@ void fctSound() { * Engine function - Discuss * @remarks Originally called 'tparler' */ -void fctDiscuss() { +void MortevielleEngine::fctDiscuss() { bool te[47]; int cy, cx, max, suj, co, lig, icm, i, choi, x, y, c; char tou; @@ -1394,7 +1393,7 @@ void fctDiscuss() { moveMouse(f, tou); CHECK_QUIT; - getMousePos(x, y, c); + getMousePos_(x, y, c); x *= (3 - g_res); if (x > 319) cx = 41; @@ -1527,7 +1526,7 @@ void fctDiscuss() { * Engine function - Smell * @remarks Originally called 'tsentir' */ -void fctSmell() { +void MortevielleEngine::fctSmell() { g_crep = 119; if (g_caff < 26) { if (!g_vm->_syn) @@ -1545,7 +1544,7 @@ void fctSmell() { * Engine function - Scratch * @remarks Originally called 'tgratter' */ -void fctScratch() { +void MortevielleEngine::fctScratch() { g_crep = 155; if (g_caff < 27) { if (!g_vm->_syn) diff --git a/engines/mortevielle/actions.h b/engines/mortevielle/actions.h deleted file mode 100644 index 74d4e5c046..0000000000 --- a/engines/mortevielle/actions.h +++ /dev/null @@ -1,68 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1988-1989 Lankhor - */ - -#ifndef MORTEVIELLE_ACTIONS_H -#define MORTEVIELLE_ACTIONS_H - -namespace Mortevielle { - -/* NIVEAU 4 */ -extern void fctMove(); -extern void fctTake(); -extern void fctInventoryTake(); -extern void fctLift(); -extern void fctRead(); -extern void fctSelfRead(); -extern void fctLook(); -extern void fctSelftLook(); -extern void fctSearch(); -extern void fctSelfSearch(); -extern void fctOpen(); -extern void fctPlace(); -extern void fctTurn(); -extern void fctSelfHide(); -extern void fctAttach(); -extern void fctClose(); -extern void fctKnock(); -extern void fctSelfPut(); -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 fctDiscuss(); -extern void fctSmell(); -extern void fctScratch(); -/* NIVEAU 2 */ -extern void endGame(); -extern void loseGame(); - -} // End of namespace Mortevielle -#endif diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index ef55e316a8..c973fabc0a 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -30,7 +30,6 @@ #include "common/str.h" #include "common/system.h" #include "common/textconsole.h" -#include "mortevielle/actions.h" #include "mortevielle/dialogs.h" #include "mortevielle/graphics.h" #include "mortevielle/menu.h" @@ -61,7 +60,7 @@ void copcha() { bool isMouseIn(rectangle r) { int x, y, c; - getMousePos(x, y, c); + getMousePos_(x, y, c); if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2)) return true; @@ -91,12 +90,11 @@ void writepal(int n) { } break; case MODE_CGA: { - warning("TODO: If this code is needed, resolve the incompatible types"); nhom pal[16]; for (int i = 0; i < 16; ++i) { pal[i] = g_palcga[n]._a[i]; } -// nhom pal[16] = palcga[n]._a; + if (n < 89) palette(g_palcga[n]._p); @@ -1833,7 +1831,7 @@ void tkey1(bool d) { while (keypressed()) g_key = testou(); do { - getMousePos(x, y, c); + getMousePos_(x, y, c); keypressed(); } while (c != 0); @@ -1842,7 +1840,7 @@ void tkey1(bool d) { if (d) tinke(); quest = keypressed(); - getMousePos(x, y, c); + getMousePos_(x, y, c); CHECK_QUIT; } while (!(quest || (c != 0) || (d && g_vm->_anyone))); if (quest) @@ -2518,18 +2516,23 @@ void tmaj3() { g_s._heure = chr(minute); } -void tsitu() { - if (!g_vm->_col) +/** + * Engine function - Handle OpCodes + * @remarks Originally called 'tsitu' + */ +void MortevielleEngine::handleOpcode() { + if (!_col) clearScreenType2(); - g_vm->_syn = false; - g_vm->_keyPressedEsc = false; - if (!g_vm->_anyone) { - if (g_vm->_brt) + _syn = false; + _keyPressedEsc = false; + if (!_anyone) { + if (_brt) { if ((g_msg[3] == MENU_MOVE) || (g_msg[4] == OPCODE_LEAVE) || (g_msg[4] == OPCODE_SLEEP) || (g_msg[4] == OPCODE_EAT)) { g_ctrm = 4; mennor(); return; } + } if (g_msg[3] == MENU_MOVE) fctMove(); if (g_msg[3] == MENU_DISCUSS) @@ -2586,14 +2589,14 @@ void tsitu() { fctSelfPut(); if (g_msg[4] == OPCODE_SLOOK) fctSelftLook(); - g_vm->_hiddenHero = false; + _hiddenHero = false; if (g_msg[4] == OPCODE_SHIDE) fctSelfHide(); } else { - if (g_vm->_anyone) { + if (_anyone) { quelquun(); - g_vm->_anyone = false; + _anyone = false; mennor(); return; } @@ -2604,7 +2607,7 @@ void tsitu() { ((hour > 0) && (hour < 6) && (g_s._currPlace != 0))) ++g_s._faithScore; if (((g_s._currPlace < CRYPT) || (g_s._currPlace > MOUNTAIN)) && (g_s._currPlace != 23) - && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) { + && (g_s._currPlace != 0) && (g_s._selectedObjectId != 152) && (!_loseGame)) { if ((g_s._faithScore > 99) && (hour > 8) && (hour < 16)) { g_crep = 1501; tperd(); @@ -2613,7 +2616,7 @@ void tsitu() { g_crep = 1508; tperd(); } - if ((day > 1) && (hour > 8) && (!g_vm->_loseGame)) { + if ((day > 1) && (hour > 8) && (!_loseGame)) { g_crep = 1502; tperd(); } diff --git a/engines/mortevielle/mor.h b/engines/mortevielle/mor.h index d7d5c8739f..2336bc4022 100644 --- a/engines/mortevielle/mor.h +++ b/engines/mortevielle/mor.h @@ -184,7 +184,6 @@ extern void changeGraphicalDevice(int newDevice); /* NIVEAU 3 */ /* procedure PROGRAMME */ extern void tmaj3(); -extern void tsitu(); /* NIVEAU 1 */ extern void theure(); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4b8c2678b3..1ef69a6b5b 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -29,7 +29,6 @@ #include "graphics/palette.h" #include "graphics/pixelformat.h" #include "mortevielle/mortevielle.h" -#include "mortevielle/actions.h" #include "mortevielle/dialogs.h" #include "mortevielle/asm.h" #include "mortevielle/keyboard.h" @@ -552,7 +551,7 @@ void MortevielleEngine::mainGame() { /** * This method handles playing a loaded game - * @remarks Originally called tojouer + * @remarks Originally called tjouer */ void MortevielleEngine::playGame() { gameLoaded(); @@ -660,7 +659,7 @@ void MortevielleEngine::handleAction() { } do { if (! oo) - tsitu(); + handleOpcode(); if ((g_ctrm == 0) && (! _loseGame) && (! _endGame)) { taffich(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 0d1f5670ca..c1ed2ad855 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -169,10 +169,42 @@ public: void delay(int amount); Common::String getEngineString(int idx) const { return _engineStrings[idx]; } Common::String getGameString(int idx) const { return _gameStrings[idx]; } + void handleOpcode(); void endGame(); void loseGame(); void gameLoaded(); + +/* NIVEAU 4 */ + void fctMove(); + void fctTake(); + void fctInventoryTake(); + void fctLift(); + void fctRead(); + void fctSelfRead(); + void fctLook(); + void fctSelftLook(); + void fctSearch(); + void fctSelfSearch(); + void fctOpen(); + void fctPlace(); + void fctTurn(); + void fctSelfHide(); + void fctAttach(); + void fctClose(); + void fctKnock(); + void fctSelfPut(); + void fctListen(); + void fctEat(); + void fctEnter(); + void fctSleep(); + void fctForce(); + void fctLeave(); + void fctWait(); + void fctSound(); + void fctDiscuss(); + void fctSmell(); + void fctScratch(); }; extern MortevielleEngine *g_vm; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 1240fa4165..2eec6ab2b5 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -278,7 +278,7 @@ void setMousePos(int x, int y) { * Get mouse poisition * @remarks Originally called 'read_pos_mouse' */ -void getMousePos(int &x, int &y, int &c) { +void getMousePos_(int &x, int &y, int &c) { x = g_vm->getMousePos().x; y = g_vm->getMousePos().y; c = g_vm->getMouseClick() ? 1 : 0; @@ -307,7 +307,7 @@ void moveMouse(bool &funct, char &key) { CHECK_QUIT; in1 = get_ch(); - getMousePos(cx, cy, cd); + getMousePos_(cx, cy, cd); switch (toupper(in1)) { case '4': cx = cx - 8; diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index d17654c19e..532644a255 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -44,7 +44,7 @@ void initMouse(); extern void hideMouse(); extern void showMouse(); extern void setMousePos(int x, int y); -extern void getMousePos(int &x, int &y, int &c); +extern void getMousePos_(int &x, int &y, int &c); extern void moveMouse(bool &funct, char &key); } // End of namespace Mortevielle |