aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
authorStrangerke2013-08-15 07:57:07 +0200
committerStrangerke2013-08-15 07:57:07 +0200
commit563e62d625e0b287a7eca1bb2f09c9a034a1a48b (patch)
treebe11bd27865811a67bf6eb86cbcf9c8b61bd4d4b /engines/mortevielle
parent019f7e59fdbcc6bdd2ad49dc5ab7e87c84cf4093 (diff)
downloadscummvm-rg350-563e62d625e0b287a7eca1bb2f09c9a034a1a48b.tar.gz
scummvm-rg350-563e62d625e0b287a7eca1bb2f09c9a034a1a48b.tar.bz2
scummvm-rg350-563e62d625e0b287a7eca1bb2f09c9a034a1a48b.zip
MORTEVIELLE: Use verb order stored in mort.dat
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/actions.cpp2
-rw-r--r--engines/mortevielle/menu.cpp107
-rw-r--r--engines/mortevielle/menu.h57
-rw-r--r--engines/mortevielle/mortevielle.cpp6
-rw-r--r--engines/mortevielle/outtext.cpp2
-rw-r--r--engines/mortevielle/utils.cpp60
6 files changed, 178 insertions, 56 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 2a66100e17..1b1e10daa2 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -584,7 +584,7 @@ void MortevielleEngine::fctOpen() {
if (_caff == ROOM26) {
if (_roomDoorId != OWN_ROOM) {
- _currAction = OPCODE_ENTER;
+ _currAction = _menu.OPCODE_ENTER;
_syn = true;
} else
_crep = 997;
diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp
index f32c551ddb..c8f34991bd 100644
--- a/engines/mortevielle/menu.cpp
+++ b/engines/mortevielle/menu.cpp
@@ -48,6 +48,109 @@ const byte menuConstants[8][4] = {
{62, 46, 13, 10}
};
+Menu::Menu() {
+ OPCODE_ATTACH = OPCODE_WAIT = OPCODE_FORCE = OPCODE_SLEEP = OPCODE_NONE;
+ OPCODE_LISTEN = OPCODE_ENTER = OPCODE_CLOSE = OPCODE_SEARCH = OPCODE_NONE;
+ OPCODE_KNOCK = OPCODE_SCRATCH = OPCODE_READ = OPCODE_EAT = OPCODE_NONE;
+ OPCODE_PLACE = OPCODE_OPEN = OPCODE_TAKE = OPCODE_LOOK = OPCODE_NONE;
+ OPCODE_SMELL = OPCODE_SOUND = OPCODE_LEAVE = OPCODE_LIFT = OPCODE_NONE;
+ OPCODE_TURN = OPCODE_SHIDE = OPCODE_SSEARCH = OPCODE_SREAD = OPCODE_NONE;
+ OPCODE_SPUT = OPCODE_SLOOK = OPCODE_NONE;
+}
+
+void Menu::readVerbNums(Common::File &f, int dataSize) {
+ // Figure out what language Id is needed
+ byte desiredLanguageId;
+ switch(_vm->getLanguage()) {
+ case Common::EN_ANY:
+ desiredLanguageId = MORTDAT_LANG_ENGLISH;
+ break;
+ case Common::FR_FRA:
+ desiredLanguageId = MORTDAT_LANG_FRENCH;
+ break;
+ case Common::DE_DEU:
+ desiredLanguageId = MORTDAT_LANG_GERMAN;
+ break;
+ default:
+ warning("Language not supported, switching to English");
+ desiredLanguageId = MORTDAT_LANG_ENGLISH;
+ break;
+ }
+ // Read in the language
+ byte languageId = f.readByte();
+ --dataSize;
+
+ // If the language isn't correct, then skip the entire block
+ if (languageId != desiredLanguageId) {
+ f.skip(dataSize);
+ return;
+ }
+
+ assert(dataSize == 52);
+ OPCODE_ATTACH = f.readUint16LE();
+ OPCODE_WAIT = f.readUint16LE();
+ OPCODE_FORCE = f.readUint16LE();
+ OPCODE_SLEEP = f.readUint16LE();
+ OPCODE_LISTEN = f.readUint16LE();
+ OPCODE_ENTER = f.readUint16LE();
+ OPCODE_CLOSE = f.readUint16LE();
+ OPCODE_SEARCH = f.readUint16LE();
+ OPCODE_KNOCK = f.readUint16LE();
+ OPCODE_SCRATCH = f.readUint16LE();
+ OPCODE_READ = f.readUint16LE();
+ OPCODE_EAT = f.readUint16LE();
+ OPCODE_PLACE = f.readUint16LE();
+ OPCODE_OPEN = f.readUint16LE();
+ OPCODE_TAKE = f.readUint16LE();
+ OPCODE_LOOK = f.readUint16LE();
+ OPCODE_SMELL = f.readUint16LE();
+ OPCODE_SOUND = f.readUint16LE();
+ OPCODE_LEAVE = f.readUint16LE();
+ OPCODE_LIFT = f.readUint16LE();
+ OPCODE_TURN = f.readUint16LE();
+ OPCODE_SHIDE = f.readUint16LE();
+ OPCODE_SSEARCH = f.readUint16LE();
+ OPCODE_SREAD = f.readUint16LE();
+ OPCODE_SPUT = f.readUint16LE();
+ OPCODE_SLOOK = f.readUint16LE();
+
+ _actionMenu[0]._menuId = OPCODE_NONE >> 8;
+ _actionMenu[0]._actionId = OPCODE_NONE & 0xFF;
+
+ _actionMenu[1]._menuId = OPCODE_SHIDE >> 8;
+ _actionMenu[1]._actionId = OPCODE_SHIDE & 0xFF;
+
+ _actionMenu[2]._menuId = OPCODE_ATTACH >> 8;
+ _actionMenu[2]._actionId = OPCODE_ATTACH & 0xFF;
+
+ _actionMenu[3]._menuId = OPCODE_FORCE >> 8;
+ _actionMenu[3]._actionId = OPCODE_FORCE & 0xFF;
+
+ _actionMenu[4]._menuId = OPCODE_SLEEP >> 8;
+ _actionMenu[4]._actionId = OPCODE_SLEEP & 0xFF;
+
+ _actionMenu[5]._menuId = OPCODE_ENTER >> 8;
+ _actionMenu[5]._actionId = OPCODE_ENTER & 0xFF;
+
+ _actionMenu[6]._menuId = OPCODE_CLOSE >> 8;
+ _actionMenu[6]._menuId = OPCODE_CLOSE & 0xFF;
+
+ _actionMenu[7]._menuId = OPCODE_KNOCK >> 8;
+ _actionMenu[7]._menuId = OPCODE_KNOCK & 0xFF;
+
+ _actionMenu[8]._menuId = OPCODE_EAT >> 8;
+ _actionMenu[8]._menuId = OPCODE_EAT & 0xFF;
+
+ _actionMenu[9]._menuId = OPCODE_PLACE >> 8;
+ _actionMenu[9]._menuId = OPCODE_PLACE & 0xFF;
+
+ _actionMenu[10]._menuId = OPCODE_OPEN >> 8;
+ _actionMenu[10]._menuId = OPCODE_OPEN & 0xFF;
+
+ _actionMenu[11]._menuId = OPCODE_LEAVE >> 8;
+ _actionMenu[11]._menuId = OPCODE_LEAVE & 0xFF;
+}
+
/**
* Setup a menu's contents
* @remarks Originally called 'menut'
@@ -486,9 +589,11 @@ void Menu::updateMenu() {
}
}
-void Menu::initMenu(MortevielleEngine *vm) {
+void Menu::setParent(MortevielleEngine *vm) {
_vm = vm;
+}
+void Menu::initMenu() {
int i;
Common::File f;
diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h
index 2428d8917b..a1b654ccaf 100644
--- a/engines/mortevielle/menu.h
+++ b/engines/mortevielle/menu.h
@@ -40,33 +40,13 @@ enum {
MENU_LOAD = 8
};
-enum verbs {OPCODE_NONE = 0, 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, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404,
-OPCODE_SLOOK = 0x405};
+const int OPCODE_NONE = 0;
struct menuItem {
int _menuId;
int _actionId;
};
-static const menuItem _actionMenu[12] = {
- {OPCODE_NONE >> 8, OPCODE_NONE & 0xFF},
- {OPCODE_SHIDE >> 8, OPCODE_SHIDE & 0xFF},
- {OPCODE_ATTACH >> 8, OPCODE_ATTACH & 0xFF},
- {OPCODE_FORCE >> 8, OPCODE_FORCE & 0xFF},
- {OPCODE_SLEEP >> 8, OPCODE_SLEEP & 0xFF},
- {OPCODE_ENTER >> 8, OPCODE_ENTER & 0xFF},
- {OPCODE_CLOSE >> 8, OPCODE_CLOSE & 0xFF},
- {OPCODE_KNOCK >> 8, OPCODE_KNOCK & 0xFF},
- {OPCODE_EAT >> 8, OPCODE_EAT & 0xFF},
- {OPCODE_PLACE >> 8, OPCODE_PLACE & 0xFF},
- {OPCODE_OPEN >> 8, OPCODE_OPEN & 0xFF},
- {OPCODE_LEAVE >> 8, OPCODE_LEAVE & 0xFF}
-};
-
class Menu {
private:
MortevielleEngine *_vm;
@@ -78,7 +58,10 @@ private:
void util(Common::Point pos);
void invert(int indx);
void menuDown(int ii);
+
public:
+ Menu();
+
bool _menuActive;
bool _menuSelected;
bool _multiTitle;
@@ -92,6 +75,36 @@ public:
menuItem _inventoryMenu[9];
menuItem _moveMenu[8];
+ int OPCODE_ATTACH;
+ int OPCODE_WAIT;
+ int OPCODE_FORCE;
+ int OPCODE_SLEEP;
+ int OPCODE_LISTEN;
+ int OPCODE_ENTER;
+ int OPCODE_CLOSE;
+ int OPCODE_SEARCH;
+ int OPCODE_KNOCK;
+ int OPCODE_SCRATCH;
+ int OPCODE_READ;
+ int OPCODE_EAT;
+ int OPCODE_PLACE;
+ int OPCODE_OPEN;
+ int OPCODE_TAKE;
+ int OPCODE_LOOK;
+ int OPCODE_SMELL;
+ int OPCODE_SOUND;
+ int OPCODE_LEAVE;
+ int OPCODE_LIFT;
+ int OPCODE_TURN;
+ int OPCODE_SHIDE;
+ int OPCODE_SSEARCH;
+ int OPCODE_SREAD;
+ int OPCODE_SPUT;
+ int OPCODE_SLOOK;
+ menuItem _actionMenu[12];
+
+ void setParent(MortevielleEngine *vm);
+ void readVerbNums(Common::File &f, int dataSize);
void setText(int menuId, int actionId, Common::String name);
void setDestinationText(int roomId);
void setInventoryText();
@@ -102,7 +115,7 @@ public:
void menuUp(int msgId);
void eraseMenu();
void updateMenu();
- void initMenu(MortevielleEngine *vm);
+ void initMenu();
void setSearchMenu();
void unsetSearchMenu();
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index 7b2a648221..059bde4614 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -57,6 +57,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr
_text.setParent(this);
_soundManager.setParent(this);
_savegameManager.setParent(this);
+ _menu.setParent(this);
_lastGameFrame = 0;
_mouseClick = false;
@@ -273,6 +274,8 @@ Common::ErrorCode MortevielleEngine::loadMortDat() {
readStaticStrings(f, dataSize, kStaticStrings);
} else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) {
readStaticStrings(f, dataSize, kGameStrings);
+ } else if (!strncmp(dataType, "VERB", 4)) {
+ _menu.readVerbNums(f, dataSize);
} else {
// Unknown section
f.skip(dataSize);
@@ -286,6 +289,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() {
return Common::kNoError;
}
+
/**
* Read in a static strings block, and if the language matches, load up the static strings
*/
@@ -400,7 +404,7 @@ void MortevielleEngine::mainGame() {
for (_crep = 1; _crep <= _x26KeyCount; ++_crep)
decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64);
- _menu.initMenu(this);
+ _menu.initMenu();
charToHour();
initGame();
diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp
index 99c06c7c4c..9451e655dd 100644
--- a/engines/mortevielle/outtext.cpp
+++ b/engines/mortevielle/outtext.cpp
@@ -314,7 +314,7 @@ void TextHandler::taffich() {
loadAniFile(filename, drawingStartPos, drawingSize);
}
_vm->_mouse.showMouse();
- if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != OPCODE_ENTER)) {
+ if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu.OPCODE_ENTER)) {
if ((a == ATTIC) || (a == CELLAR))
_vm->displayAloneText();
else if (!_vm->_blo)
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index fff53dbc30..3cacbec630 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -327,9 +327,9 @@ void MortevielleEngine::handleAction() {
if (_mouse._pos.y < 12)
return;
- if ((_currAction == OPCODE_SOUND) || (_currAction == OPCODE_LIFT)) {
+ if ((_currAction == _menu.OPCODE_SOUND) || (_currAction == _menu.OPCODE_LIFT)) {
handledOpcodeFl = true;
- if ((_currAction == OPCODE_LIFT) || (_obpart)) {
+ if ((_currAction == _menu.OPCODE_LIFT) || (_obpart)) {
endSearch();
_caff = _coreVar._currPlace;
_crep = 998;
@@ -1536,7 +1536,7 @@ void MortevielleEngine::handleOpcode() {
_keyPressedEsc = false;
if (!_anyone) {
if (_uptodatePresence) {
- if ((_currMenu == MENU_MOVE) || (_currAction == OPCODE_LEAVE) || (_currAction == OPCODE_SLEEP) || (_currAction == OPCODE_EAT)) {
+ if ((_currMenu == MENU_MOVE) || (_currAction == _menu.OPCODE_LEAVE) || (_currAction == _menu.OPCODE_SLEEP) || (_currAction == _menu.OPCODE_EAT)) {
_controlMenu = 4;
menuUp();
return;
@@ -1548,59 +1548,59 @@ void MortevielleEngine::handleOpcode() {
fctDiscuss();
if (_currMenu == MENU_INVENTORY)
fctInventoryTake();
- if (_currAction == OPCODE_ATTACH)
+ if (_currAction == _menu.OPCODE_ATTACH)
fctAttach();
- if (_currAction == OPCODE_WAIT)
+ if (_currAction == _menu.OPCODE_WAIT)
fctWait();
- if (_currAction == OPCODE_FORCE)
+ if (_currAction == _menu.OPCODE_FORCE)
fctForce();
- if (_currAction == OPCODE_SLEEP)
+ if (_currAction == _menu.OPCODE_SLEEP)
fctSleep();
- if (_currAction == OPCODE_LISTEN)
+ if (_currAction == _menu.OPCODE_LISTEN)
fctListen();
- if (_currAction == OPCODE_ENTER)
+ if (_currAction == _menu.OPCODE_ENTER)
fctEnter();
- if (_currAction == OPCODE_CLOSE)
+ if (_currAction == _menu.OPCODE_CLOSE)
fctClose();
- if (_currAction == OPCODE_SEARCH)
+ if (_currAction == _menu.OPCODE_SEARCH)
fctSearch();
- if (_currAction == OPCODE_KNOCK)
+ if (_currAction == _menu.OPCODE_KNOCK)
fctKnock();
- if (_currAction == OPCODE_SCRATCH)
+ if (_currAction == _menu.OPCODE_SCRATCH)
fctScratch();
- if (_currAction == OPCODE_READ)
+ if (_currAction == _menu.OPCODE_READ)
fctRead();
- if (_currAction == OPCODE_EAT)
+ if (_currAction == _menu.OPCODE_EAT)
fctEat();
- if (_currAction == OPCODE_PLACE)
+ if (_currAction == _menu.OPCODE_PLACE)
fctPlace();
- if (_currAction == OPCODE_OPEN)
+ if (_currAction == _menu.OPCODE_OPEN)
fctOpen();
- if (_currAction == OPCODE_TAKE)
+ if (_currAction == _menu.OPCODE_TAKE)
fctTake();
- if (_currAction == OPCODE_LOOK)
+ if (_currAction == _menu.OPCODE_LOOK)
fctLook();
- if (_currAction == OPCODE_SMELL)
+ if (_currAction == _menu.OPCODE_SMELL)
fctSmell();
- if (_currAction == OPCODE_SOUND)
+ if (_currAction == _menu.OPCODE_SOUND)
fctSound();
- if (_currAction == OPCODE_LEAVE)
+ if (_currAction == _menu.OPCODE_LEAVE)
fctLeave();
- if (_currAction == OPCODE_LIFT)
+ if (_currAction == _menu.OPCODE_LIFT)
fctLift();
- if (_currAction == OPCODE_TURN)
+ if (_currAction == _menu.OPCODE_TURN)
fctTurn();
- if (_currAction == OPCODE_SSEARCH)
+ if (_currAction == _menu.OPCODE_SSEARCH)
fctSelfSearch();
- if (_currAction == OPCODE_SREAD)
+ if (_currAction == _menu.OPCODE_SREAD)
fctSelfRead();
- if (_currAction == OPCODE_SPUT)
+ if (_currAction == _menu.OPCODE_SPUT)
fctSelfPut();
- if (_currAction == OPCODE_SLOOK)
+ if (_currAction == _menu.OPCODE_SLOOK)
fctSelftLook();
_hiddenHero = false;
- if (_currAction == OPCODE_SHIDE)
+ if (_currAction == _menu.OPCODE_SHIDE)
fctSelfHide();
} else {
if (_anyone) {
@@ -3400,7 +3400,7 @@ void MortevielleEngine::displayLookScreen(int objId) {
int mdes = _caff;
_caff = objId;
- if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == OPCODE_SLOOK)) {
+ if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu.OPCODE_SLOOK)) {
drawPictureWithText();
if ((_caff > 29) && (_caff < 33))
handleDescriptionText(2, _caff);