aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle/mortevielle.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mortevielle/mortevielle.h')
-rw-r--r--engines/mortevielle/mortevielle.h512
1 files changed, 285 insertions, 227 deletions
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index 6e55bebd7e..514b929a22 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -38,9 +38,32 @@
#include "mortevielle/saveload.h"
#include "mortevielle/sound.h"
#include "mortevielle/speech.h"
+#include "mortevielle/outtext.h"
namespace Mortevielle {
+/*---------------------------------------------------------------------------*/
+/*------------------- MEMORY MAP ------------------------*/
+/*---------------------------------------------------------------------------*/
+/* The following is a list of physical addresses in memory currently used
+ * by the game.
+ *
+ * Address
+ * -------
+ * 5000:0 - Music data
+ * 6000:0 - Decompressed current image
+ * 7000:0+ - Compressed images
+ * 7000:2 - 16 words representing palette map
+ * 7000:4138 - width, height, x/y offset of decoded image
+ */
+
+#define ord(v) ((int) v)
+#define chr(v) ((unsigned char) v)
+#define lo(v) ((v) & 0xff)
+#define hi(v) (((v) >> 8) & 0xff)
+#define swap(v) (((lo(v)) << 8) | ((hi(v)) >> 8))
+#define odd(v) (((v) % 2) == 1)
+
// Debug channels
enum {
kMortevielleCore = 1 << 0,
@@ -73,12 +96,6 @@ enum DataType {
kGameStrings = 1
};
-static const int _actionMenu[12] = { OPCODE_NONE,
- OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP,
- OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT,
- OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE
-};
-
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 400
#define SCREEN_ORIG_HEIGHT 200
@@ -101,6 +118,51 @@ const int arep = 1314;
const int amzon = 1650;
const int arega = 0;
+const int kMaxTi = 7975;
+const int kMaxTd = 600;
+
+const int kDescriptionStringIndex = 0; // Unused
+const int kInventoryStringIndex = 186;
+const int kQuestionStringIndex = 247;
+const int kDialogStringIndex = 292;
+const int kMenuPlaceStringIndex = 435;
+const int kMenuActionStringIndex = 476;
+const int kMenuSelfStringIndex = 497;
+const int kMenuSayStringIndex = 502;
+const int kSecretPassageQuestionStringIndex = 510; // Unusued?
+const int kMaxPatt = 20;
+
+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, OPCODE_SHIDE = 0x401, OPCODE_SSEARCH = 0x402, OPCODE_SREAD = 0x403, OPCODE_SPUT = 0x404,
+ OPCODE_SLOOK = 0x405};
+
+static const int _actionMenu[12] = { OPCODE_NONE,
+ OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP,
+ OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT,
+ OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE
+};
+
+/*
+9 "A glance at the forbidden$",
+18 "It's already open$",
+26 "A photograph$",
+27 "The coat of arms$",
+*/
+enum places {
+ OWN_ROOM = 0, GREEN_ROOM = 1, PURPLE_ROOM = 2, TOILETS = 3, DARKBLUE_ROOM = 4,
+ BLUE_ROOM = 5, RED_ROOM = 6, BATHROOM = 7, GREEN_ROOM2 = 8, ROOM9 = 9,
+ DINING_ROOM = 10, BUREAU = 11, KITCHEN = 12, ATTIC = 13, CELLAR = 14,
+ LANDING = 15, CRYPT = 16, SECRET_PASSAGE = 17, ROOM18 = 18, MOUNTAIN = 19,
+ CHAPEL = 20, MANOR_FRONT = 21, MANOR_BACK = 22, INSIDE_WELL = 23, WELL = 24,
+ DOOR = 25, ROOM26 = 26, ROOM27 = 27
+};
+
+enum GraphicModes { MODE_AMSTRAD1512 = 0, MODE_CGA = 1, MODE_EGA = 2, MODE_HERCULES = 3, MODE_TANDY = 4 };
+
struct nhom {
byte _id; /* number between 0 and 32 */
byte _hom[4];
@@ -144,15 +206,79 @@ private:
const ADGameDescription *_gameDescription;
Common::Stack<int> _keypresses;
uint32 _lastGameFrame;
- bool _mouseClick;
Common::Point _mousePos;
- bool _inMainGameLoop; // Flag when the main game loop is active
Common::StringArray _engineStrings;
Common::StringArray _gameStrings;
Pattern _patternArr[15];
int _menuOpcode;
+ bool _mouseClick;
+ bool _inMainGameLoop; // Flag when the main game loop is active
+ bool _quitGame; // Quit game flag. Originally called 'arret'
+ bool _endGame; // End game flag. Originally called 'solu'
+ bool _loseGame; // Lose game flag. Originally called 'perdu'
+ bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file
+ bool _roomPresenceLuc;
+ bool _roomPresenceIda;
+ bool _purpleRoomPresenceLeo;
+ bool _roomPresenceGuy;
+ bool _roomPresenceEva;
+ bool _roomPresenceMax;
+ bool _roomPresenceBob;
+ bool _roomPresencePat;
+ bool _toiletsPresenceBobMax;
+ bool _bathRoomPresenceBobMax;
+ bool _room9PresenceLeo;
+ bool _hiddenHero;
+ bool _heroSearching;
+ bool _keyPressedEsc;
+ bool _reloadCFIEC;
+ bool _col;
+ bool _syn;
+ bool _obpart;
+ bool _anyone;
+ bool _brt;
+
+ int _textColor;
+ int _place;
+ int _manorDistance;
+ int _currBitIndex;
+ int _currDay;
+ int _currHour;
+ int _currHalfHour;
+ int _day;
+ int _hour;
+ int _minute;
+ int _mchai;
+ int _controlMenu;
+ int _startHour;
+ int _endHour;
+ Common::Point _stdPal[91][17];
+ t_pcga _cgaPal[91];
+
+ int _c_zzz;
+ int _ment;
+ int _iouv;
+ int _dobj;
+ int _num;
+ int _cs;
+ int _prebru;
+ int _t;
+ int _x;
+ int _y;
+ int _jh;
+ int _mh;
+
+
+ Common::String _hintPctMessage;
+ byte _cfiecBuffer[822 * 128];
+ byte _touv[8];
+ int _nbrep[9];
+ int _nbrepm[9];
+ uint16 _inpBuffer[kMaxTi + 1];
+ Hint _ntpBuffer[kMaxTd + 1];
+
Common::ErrorCode initialise();
Common::ErrorCode loadMortDat();
void readStaticStrings(Common::File &f, int dataSize, DataType dataType);
@@ -164,8 +290,6 @@ private:
void mainGame();
void playGame();
void handleAction();
- void cinq_huit(char &c, int &idx, byte &pt, bool &the_end);
- void copcha();
void displayCGAPattern(int n, Pattern p, nhom *pal);
void loadPalette();
void loadTexts();
@@ -177,7 +301,122 @@ private:
void palette(int v1);
int checkLeoMaxRandomPresence();
void interactNPC();
+ void initCaveOrCellar();
+ void displayControlMenu();
+ void displayItemInHand(int objId);
+ void resetRoomVariables(int roomId);
+ int getPresenceStats(int &rand, int cf, int roomId);
+ void setPresenceFlags(int roomId);
+ void testKey(bool d);
+ void exitRoom();
+ void getReadDescription(int objId);
+ void getSearchDescription(int objId);
+ int checkLeaveSecretPassage();
+ void changeGraphicalDevice(int newDevice);
+ void startDialog(int16 rep);
+ void endSearch();
+ int convertCharacterIndexToBitIndex(int characterIndex);
+ int convertBitIndexToCharacterIndex(int bitIndex);
+ void clearScreenType1();
+ void clearScreenType2();
+ void clearScreenType3();
+ void clearScreenType10();
+ int getRandomNumber(int minval, int maxval);
+ void showMoveMenuAlert();
+ void showConfigScreen();
+ void decodeNumber(byte *pStart, int count);
+ void resetVariables();
+ void music();
+ void drawRightFrame();
+ void prepareRoom();
+ void drawClock();
+ void checkManorDistance();
+ void gotoManorFront();
+ void gotoManorBack();
+ void gotoDiningRoom();
+ bool checkInventory(int objectId);
+ void loseGame();
+ void floodedInWell();
+ void displayDiningRoom();
+ void startMusicOrSpeech(int so);
+ void setTextColor(int col);
+ void prepareScreenType1();
+ void prepareScreenType2();
+ void prepareScreenType3();
+ void updateHour(int &day, int &hour, int &minute);
+ void getKnockAnswer();
+ int getPresenceStatsGreenRoom();
+ int getPresenceStatsPurpleRoom();
+ int getPresenceStatsToilets();
+ int getPresenceStatsBlueRoom();
+ int getPresenceStatsRedRoom();
+ int getPresenceStatsDiningRoom(int &hour);
+ int getPresenceStatsBureau(int &hour);
+ int getPresenceStatsKitchen();
+ int getPresenceStatsAttic();
+ int getPresenceStatsLanding();
+ int getPresenceStatsChapel(int &hour);
+ int getPresenceBitIndex(int roomId);
+ void setPresenceGreenRoom(int roomId);
+ void setPresencePurpleRoom();
+ void setPresenceBlueRoom();
+ void setPresenceRedRoom(int roomId);
+ int setPresenceDiningRoom(int hour);
+ int setPresenceBureau(int hour);
+ int setPresenceKitchen();
+ int setPresenceLanding();
+ int setPresenceChapel(int hour);
+ void setRandomPresenceGreenRoom(int cf);
+ void setRandomPresencePurpleRoom(int cf);
+ void setRandomPresenceBlueRoom(int cf);
+ void setRandomPresenceRedRoom(int cf);
+ void setRandomPresenceRoom9(int cf);
+ void setRandomPresenceDiningRoom(int cf);
+ void setRandomPresenceBureau(int cf);
+ void setRandomPresenceKitchen(int cf);
+ void setRandomPresenceAttic(int cf);
+ void setRandomPresenceLanding(int cf);
+ void setRandomPresenceChapel(int cf);
+ void loadPlaces();
+ void resetPresenceInRooms(int roomId);
+ void showPeoplePresent(int bitIndex);
+ int selectCharacters(int min, int max);
+ 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();
+ void endGame();
+ void askRestart();
+ void delay(int amount);
+ void handleOpcode();
+ void cinq_huit(char &c, int &idx, byte &pt, bool &the_end);
+ void copcha();
void adzon();
void text1(int x, int y, int nb, int m);
void modif(int &nu);
@@ -188,90 +427,45 @@ private:
void ajchai();
void tfleche();
void setCoordinates(int sx);
+ void ecr2(Common::String text);
+ void ecr3(Common::String text);
+ void init_nbrepm();
+ void aniof(int ouf, int num);
+ void dessin();
+ void afdes();
+ void tlu(int af, int ob);
+ void affrep();
+ void mennor();
+ void ajjer(int ob);
+ void tsuiv();
+ void treg(int objId);
+ void avpoing(int &objId);
+ void rechai(int &ch);
+ void fenat(char ans);
public:
- Common::String _hintPctMessage;
Common::Point _prevPos;
-
- byte _tabdon[4001];
- byte _cfiecBuffer[822 * 128];
- int _fxxBuffer[108];
- byte _touv[8];
int _msg[5];
- int _nbrep[9];
- int _nbrepm[9];
- uint16 _inpBuffer[kMaxTi + 1];
- Hint _ntpBuffer[kMaxTd + 1];
-
- bool _roomPresenceLuc;
- bool _roomPresenceIda;
- bool _purpleRoomPresenceLeo;
- bool _roomPresenceGuy;
- bool _roomPresenceEva;
- bool _roomPresenceMax;
- bool _roomPresenceBob;
- bool _roomPresencePat;
- bool _toiletsPresenceBobMax;
- bool _bathRoomPresenceBobMax;
- bool _room9PresenceLeo;
+ int _fxxBuffer[108];
+ byte _tabdon[4001];
bool _soundOff;
- bool _largestClearScreen;
- bool _hiddenHero;
- bool _heroSearching;
- bool _keyPressedEsc;
- bool _reloadCFIEC;
-
bool _blo;
- bool _col;
- bool _syn;
- bool _obpart;
bool _okdes;
- bool _anyone;
- bool _brt;
-
- int _textColor;
- int _currGraphicalDevice;
- int _newGraphicalDevice;
- int _place;
- int _manorDistance;
- int _currBitIndex;
- int _savedBitIndex;
- int _currDay;
- int _currHour;
- int _currHalfHour;
- int _day;
- int _hour;
- int _minute;
- int _mchai;
+ bool _largestClearScreen;
+ int _currGraphicalDevice;
+ int _newGraphicalDevice;
float _addFix;
+ int _savedBitIndex;
+ int _numpal;
+ int _key;
SaveStruct _coreVar, _saveStruct;
- Common::Point _stdPal[91][17];
- t_pcga _cgaPal[91];
- int _key;
- int _controlMenu;
- int _startHour;
- int _endHour;
- int _c_zzz;
- int ptr_word;
- byte _v_lieu[7][25];
- byte _is;
- int _numpal;
- int _ment;
- int _iouv;
- int _caff;
int _maff;
- int _dobj;
- int _num;
- int _crep;
- int _cs;
int _res;
- int _prebru;
- int _t;
- int _x;
- int _y;
- int _jh;
- int _mh;
+ int _caff;
+ int _crep;
+ byte _is;
+ byte _v_lieu[7][25];
// TODO: Replace the following with proper implementations, or refactor out the code using them
byte _mem[65536 * 16];
@@ -285,11 +479,7 @@ public:
SpeechManager _speechManager;
Menu _menu;
MouseHandler _mouse;
-
- bool _quitGame; // Quit game flag. Originally called 'arret'
- bool _endGame; // End game flag. Originally called 'solu'
- bool _loseGame; // Lose game flag. Originally called 'perdu'
- bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file
+ TextHandler _text;
MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc);
~MortevielleEngine();
@@ -302,165 +492,33 @@ public:
uint32 getGameFlags() const;
Common::Language getLanguage() const;
- bool keyPressed();
int getChar();
+ bool keyPressed();
Common::Point getMousePos() const { return _mousePos; }
void setMousePos(const Common::Point &pt);
bool getMouseClick() const { return _mouseClick; }
void setMouseClick(bool v) { _mouseClick = v; }
- 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 askRestart();
void gameLoaded();
-
- 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();
-
- int getPresenceStatsGreenRoom();
- int getPresenceStatsPurpleRoom();
- int getPresenceStatsToilets();
- int getPresenceStatsBlueRoom();
- int getPresenceStatsRedRoom();
- int getPresenceStatsDiningRoom(int &hour);
- int getPresenceStatsBureau(int &hour);
- int getPresenceStatsKitchen();
- int getPresenceStatsAttic();
- int getPresenceStatsLanding();
- int getPresenceStatsChapel(int &hour);
- int getPresenceBitIndex(int roomId);
- void setPresenceGreenRoom(int roomId);
- void setPresencePurpleRoom();
- void setPresenceBlueRoom();
- void setPresenceRedRoom(int roomId);
- int setPresenceDiningRoom(int hour);
- int setPresenceBureau(int hour);
- int setPresenceKitchen();
- int setPresenceLanding();
- int setPresenceChapel(int hour);
- void setRandomPresenceGreenRoom(int cf);
- void setRandomPresencePurpleRoom(int cf);
- void setRandomPresenceBlueRoom(int cf);
- void setRandomPresenceRedRoom(int cf);
- void setRandomPresenceRoom9(int cf);
- void setRandomPresenceDiningRoom(int cf);
- void setRandomPresenceBureau(int cf);
- void setRandomPresenceKitchen(int cf);
- void setRandomPresenceAttic(int cf);
- void setRandomPresenceLanding(int cf);
- void setRandomPresenceChapel(int cf);
-
- void loadPlaces();
void initGame();
- void resetPresenceInRooms(int roomId);
- void showPeoplePresent(int bitIndex);
- int selectCharacters(int min, int max);
void displayAloneText();
-
- void checkManorDistance();
- void gotoManorFront();
- void gotoManorBack();
- void gotoDiningRoom();
- bool checkInventory(int objectId);
- void loseGame();
- void floodedInWell();
- void displayDiningRoom();
- void startMusicOrSpeech(int so);
- void setTextColor(int col);
- void prepareScreenType1();
- void prepareScreenType2();
- void prepareScreenType3();
- void updateHour(int &day, int &hour, int &minute);
- void getKnockAnswer();
+ void draw(int ad, int x, int y);
void charToHour();
void hourToChar();
-
- void changeGraphicalDevice(int newDevice);
- void startDialog(int16 rep);
- void endSearch();
- int convertCharacterIndexToBitIndex(int characterIndex);
- int convertBitIndexToCharacterIndex(int bitIndex);
- void clearScreenType1();
- void clearScreenType2();
- void clearScreenType3();
- void clearScreenType10();
- int getRandomNumber(int minval, int maxval);
- void showMoveMenuAlert();
- void showConfigScreen();
- void decodeNumber(byte *pStart, int count);
Common::String getString(int num);
- void resetVariables();
void setPal(int n);
- void music();
- void draw(int ad, int x, int y);
- void drawRightFrame();
- void prepareRoom();
- void drawClock();
Common::String copy(const Common::String &s, int idx, size_t size);
- void hirs();
- void initCaveOrCellar();
- void displayControlMenu();
- void displayItemInHand(int objId);
- void displayEmptyHand();
- void resetRoomVariables(int roomId);
- int getPresenceStats(int &rand, int cf, int roomId);
- void setPresenceFlags(int roomId);
+ void testKeyboard();
int getPresence(int roomId);
- void testKey(bool d);
- void exitRoom();
- void getReadDescription(int objId);
- void getSearchDescription(int objId);
- int checkLeaveSecretPassage();
+ void displayEmptyHand();
- void pictout(int seg, int dep, int x, int y);
- int animof(int ouf, int num);
+ void hirs();
+ int testou();
void repon(int f, int m);
- void ecr2(Common::String text);
- void ecr3(Common::String text);
- void init_nbrepm();
- void aniof(int ouf, int num);
- void dessin();
- void afdes();
- void tlu(int af, int ob);
- void affrep();
- void mennor();
- void ajjer(int ob);
- void tsuiv();
- void treg(int objId);
- void avpoing(int &objId);
- void rechai(int &ch);
- void fenat(char ans);
-
+ int animof(int ouf, int num);
+ void pictout(int seg, int dep, int x, int y);
void sauvecr(int y, int dy);
void charecr(int y, int dy);