MORTEVIELLE: Rename more globals and move functions to MortevielleEngine. Remove ovd1 files.

This commit is contained in:
Strangerke 2012-03-22 00:13:11 +01:00
parent 76f7858096
commit c1e8ff3ada
13 changed files with 368 additions and 434 deletions

View File

@ -455,7 +455,7 @@ void f3f8::aff50(bool drawAni50Fl) {
g_caff = 50;
g_maff = 0;
taffich();
dessine(g_ades, 63, 12);
g_vm->draw(g_ades, 63, 12);
if (drawAni50Fl)
ani50();
else

View File

@ -33,7 +33,6 @@
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ovd1.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
@ -568,7 +567,7 @@ void Menu::setSearchMenu() {
* @remarks Originally called 'mfouen'
*/
void Menu::unsetSearchMenu() {
setDestinationMenuText(g_s._currPlace);
setDestinationMenuText(g_vm->g_s._currPlace);
for (int i = 1; i <= 11; ++i)
enableMenuItem(_actionMenu[i]);

View File

@ -11,7 +11,6 @@ MODULE_OBJS := \
mortevielle.o \
mouse.o \
outtext.o \
ovd1.o \
saveload.o \
sound.o \
speech.o \

View File

@ -44,19 +44,6 @@
namespace Mortevielle {
void outbloc(int n, Pattern p, nhom *pal) {
int ad = n * 404 + 0xd700;
WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax);
WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad + 2], p._tay);
ad += 4;
for (int i = 1; i <= p._tax; ++i) {
for (int j = 1; j <= p._tay; ++j)
g_mem[(0x6000 * 16) + ad + (j - 1) * p._tax + i - 1] = pal[n]._hom[p._des[i][j]];
}
}
void pictout(int seg, int dep, int x, int y) {
GfxSurface surface;
surface.decode(&g_mem[seg * 16 + dep]);
@ -159,28 +146,6 @@ void modif(int &nu) {
nu -= 3976;
}
void dessine(int ad, int x, int y) {
g_vm->_mouse.hideMouse();
g_vm->setPal(g_numpal);
pictout(ad, 0, x, y);
g_vm->_mouse.showMouse();
}
/**
* Draw right frame
* @remarks Originally called 'dessine_rouleau'
*/
void drawRightFrame() {
g_vm->setPal(89);
if (g_vm->_currGraphicalDevice == MODE_HERCULES) {
g_mem[0x7000 * 16 + 14] = 15;
}
g_vm->_mouse.hideMouse();
pictout(0x73a2, 0, 0, 0);
g_vm->_mouse.showMouse();
}
/* NIVEAU 13 */
@ -280,12 +245,12 @@ void repon(int f, int m) {
g_vm->prepareScreenType2();
text1(8, 182, 103, m);
if ((m == 68) || (m == 69))
g_s._teauto[40] = '*';
g_vm->g_s._teauto[40] = '*';
if ((m == 104) && (g_caff == 14)) {
g_s._teauto[36] = '*';
if (g_s._teauto[39] == '*') {
g_s._pourc[3] = '*';
g_s._teauto[38] = '*';
g_vm->g_s._teauto[36] = '*';
if (g_vm->g_s._teauto[39] == '*') {
g_vm->g_s._pourc[3] = '*';
g_vm->g_s._teauto[38] = '*';
}
}
break;
@ -302,9 +267,9 @@ void repon(int f, int m) {
displayStr(tmpStr, 80, 40, 60, 25, i);
if (m == 180)
g_s._pourc[6] = '*';
g_vm->g_s._pourc[6] = '*';
else if (m == 179)
g_s._pourc[10] = '*';
g_vm->g_s._pourc[10] = '*';
}
break;
default:
@ -461,7 +426,7 @@ int t11(int roomId) {
int retVal = 0;
int p, rand;
ecfren(p, rand, g_s._faithScore, roomId);
ecfren(p, rand, g_vm->g_s._faithScore, roomId);
g_vm->_place = roomId;
if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) {
if (p != -500) {
@ -493,7 +458,7 @@ int t11(int roomId) {
p = g_vm->getPresenceStatsLanding();
else if (roomId == CHAPEL)
p = g_vm->getPresenceStatsChapel(h);
p += g_s._faithScore;
p += g_vm->g_s._faithScore;
rand = g_vm->getRandomNumber(1, 100);
if (rand > p) {
g_vm->displayAloneText();
@ -518,9 +483,9 @@ int t11(int roomId) {
}
void cavegre() {
g_s._faithScore += 2;
if (g_s._faithScore > 69)
g_s._faithScore += (g_s._faithScore / 10);
g_vm->g_s._faithScore += 2;
if (g_vm->g_s._faithScore > 69)
g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10);
g_vm->clearScreenType3();
g_vm->prepareScreenType2();
ecr3(g_vm->getEngineString(S_SOMEONE_ENTERS));
@ -567,17 +532,17 @@ void aniof(int ouf, int num) {
/* NIVEAU 9 */
void dessin(int ad) {
if (ad != 0)
dessine(g_ades, ((ad % 160) * 2), (ad / 160));
g_vm->draw(g_ades, ((ad % 160) * 2), (ad / 160));
else {
g_vm->clearScreenType1();
if (g_caff > 99) {
dessine(g_ades, 60, 33);
g_vm->draw(g_ades, 60, 33);
g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box
} else if (g_caff > 69) {
dessine(g_ades, 112, 48); // Heads
g_vm->draw(g_ades, 112, 48); // Heads
g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15);
} else {
dessine(g_ades, 0, 12);
g_vm->draw(g_ades, 0, 12);
g_vm->prepareScreenType1();
if ((g_caff < 30) || (g_caff > 32)) {
for (int cx = 1; cx <= 6; ++cx) {
@ -586,16 +551,16 @@ void dessin(int ad) {
}
if (g_caff == 13) {
if (g_s._atticBallHoleObjectId == 141)
if (g_vm->g_s._atticBallHoleObjectId == 141)
aniof(1, 7);
if (g_s._atticRodHoleObjectId == 159)
if (g_vm->g_s._atticRodHoleObjectId == 159)
aniof(1, 6);
} else if ((g_caff == 14) && (g_s._cellarObjectId == 151))
} else if ((g_caff == 14) && (g_vm->g_s._cellarObjectId == 151))
aniof(1, 2);
else if ((g_caff == 17) && (g_s._secretPassageObjectId == 143))
else if ((g_caff == 17) && (g_vm->g_s._secretPassageObjectId == 143))
aniof(1, 1);
else if ((g_caff == 24) && (g_s._wellObjectId != 0))
else if ((g_caff == 24) && (g_vm->g_s._wellObjectId != 0))
aniof(1, 1);
}
@ -633,7 +598,7 @@ void tinke() {
drawClock();
cf = 0;
for (int i = 1; i <= 10; ++i) {
if (g_s._pourc[i] == '*')
if (g_vm->g_s._pourc[i] == '*')
++cf;
}
@ -667,7 +632,7 @@ void tinke() {
g_t = kTime2;
else
g_t = kTime1;
cf = g_s._faithScore;
cf = g_vm->g_s._faithScore;
if ((cf > 33) && (cf < 66))
g_t -= (g_t / 3);
@ -723,7 +688,7 @@ void tinke() {
g_mpers = g_vm->_currBitIndex;
if ((g_mpers == 0) && (g_vm->_currBitIndex > 0)) {
if ((g_s._currPlace == ATTIC) || (g_s._currPlace == CELLAR)) {
if ((g_vm->g_s._currPlace == ATTIC) || (g_vm->g_s._currPlace == CELLAR)) {
cavegre();
} else if (g_vm->_currBitIndex == 10) {
g_vm->_currBitIndex = 0;
@ -751,7 +716,7 @@ void tinke() {
g_vm->getPresenceBitIndex(g_vm->_place);
g_vm->_brt = false;
g_hdb = 0;
if ((g_s._currPlace > OWN_ROOM) && (g_s._currPlace < DINING_ROOM))
if ((g_vm->g_s._currPlace > OWN_ROOM) && (g_vm->g_s._currPlace < DINING_ROOM))
g_vm->_anyone = true;
}
}
@ -822,17 +787,17 @@ void tlu(int af, int ob) {
}
void affrep() {
g_caff = g_s._currPlace;
g_crep = g_s._currPlace;
g_caff = g_vm->g_s._currPlace;
g_crep = g_vm->g_s._currPlace;
}
void tsort() {
if ((g_iouv > 0) && (g_s._currPlace != 0)) {
if (g_s._faithScore < 50)
g_s._faithScore += 2;
if ((g_iouv > 0) && (g_vm->g_s._currPlace != 0)) {
if (g_vm->g_s._faithScore < 50)
g_vm->g_s._faithScore += 2;
else
g_s._faithScore += (g_s._faithScore / 10);
g_vm->g_s._faithScore += (g_vm->g_s._faithScore / 10);
}
for (int cx = 1; cx <= 7; ++cx)
@ -840,7 +805,7 @@ void tsort() {
g_ment = 0;
g_iouv = 0;
g_mchai = 0;
debloc(g_s._currPlace);
debloc(g_vm->g_s._currPlace);
}
void st4(int ob) {
@ -879,9 +844,9 @@ void modinv() {
int cy = 0;
for (int i = 1; i <= 6; ++i) {
if (g_s._sjer[i] != chr(0)) {
if (g_vm->g_s._sjer[i] != chr(0)) {
++cy;
r = (ord(g_s._sjer[i]) + 400);
r = (ord(g_vm->g_s._sjer[i]) + 400);
nomp = g_vm->getString(r - 501 + kInventoryStringIndex);
g_vm->_menu.setText(g_vm->_menu._inventoryMenu[cy], nomp);
g_vm->_menu.enableMenuItem(g_vm->_menu._inventoryMenu[i]);
@ -901,7 +866,7 @@ void mennor() {
}
void premtet() {
dessine(g_ades, 10, 80);
g_vm->draw(g_ades, 10, 80);
g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15);
}
@ -914,7 +879,7 @@ void ajchai() {
} while ((cx <= 9) && (g_tabdon[cy + cx] != 0));
if (g_tabdon[cy + cx] == 0)
g_tabdon[cy + cx] = g_s._selectedObjectId;
g_tabdon[cy + cx] = g_vm->g_s._selectedObjectId;
else
g_crep = 192;
}
@ -923,10 +888,10 @@ void ajjer(int ob) {
int cx = 0;
do {
++cx;
} while ((cx <= 5) && (ord(g_s._sjer[cx]) != 0));
} while ((cx <= 5) && (ord(g_vm->g_s._sjer[cx]) != 0));
if (ord(g_s._sjer[cx]) == 0) {
g_s._sjer[(cx)] = chr(ob);
if (ord(g_vm->g_s._sjer[cx]) == 0) {
g_vm->g_s._sjer[(cx)] = chr(ob);
modinv();
} else
g_crep = 139;
@ -955,11 +920,11 @@ L1:
g_vm->_speechManager.startSpeech(4, 4, 1);
if (g_iouv == 0)
g_s._faithScore += 2;
else if (g_s._faithScore < 50)
g_s._faithScore += 4;
g_vm->g_s._faithScore += 2;
else if (g_vm->g_s._faithScore < 50)
g_vm->g_s._faithScore += 4;
else
g_s._faithScore += 3 * (g_s._faithScore / 10);
g_vm->g_s._faithScore += 3 * (g_vm->g_s._faithScore / 10);
tsort();
g_vm->_menu.setDestinationMenuText(LANDING);
int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex);
@ -1002,11 +967,11 @@ void tsuiv() {
} while ((tbcl == 0) && (g_cs <= 9));
if ((tbcl != 0) && (g_cs < 11)) {
++g_is;
++g_vm->g_is;
g_caff = tbcl;
g_crep = g_caff + 400;
if (g_vm->_currBitIndex != 0)
g_s._faithScore += 2;
g_vm->g_s._faithScore += 2;
} else {
affrep();
g_vm->endSearch();
@ -1147,20 +1112,20 @@ void treg(int ob) {
void avpoing(int &ob) {
g_crep = 999;
if (g_s._selectedObjectId != 0)
ajjer(g_s._selectedObjectId);
if (g_vm->g_s._selectedObjectId != 0)
ajjer(g_vm->g_s._selectedObjectId);
if (g_crep != 139) {
modobj(ob + 400);
g_s._selectedObjectId = ob;
g_vm->g_s._selectedObjectId = ob;
ob = 0;
}
}
void rechai(int &ch) {
int tmpPlace = g_s._currPlace;
int tmpPlace = g_vm->g_s._currPlace;
if (g_s._currPlace == CRYPT)
if (g_vm->g_s._currPlace == CRYPT)
tmpPlace = CELLAR;
ch = g_tabdon[achai + (tmpPlace * 7) + g_num - 1];
}
@ -1175,7 +1140,7 @@ int t23coul() {
}
void maivid() {
g_s._selectedObjectId = 0;
g_vm->g_s._selectedObjectId = 0;
modobj(500);
}

View File

@ -42,7 +42,6 @@ static const int _actionMenu[12] = { OPCODE_NONE,
OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE
};
extern void outbloc(int n, Pattern p, nhom *pal);
extern void pictout(int seg, int dep, int x, int y);
extern void sauvecr(int y, int dy);
extern void charecr(int y, int dy);
@ -51,8 +50,6 @@ extern int animof(int ouf, int num);
/* Niveau 14 suite */
extern int readclock();
extern void modif(int &nu);
extern void dessine(int ad, int x, int y);
extern void drawRightFrame();
/* NIVEAU 13 */
extern void text1(int x, int y, int nb, int m);
extern void initouv();

View File

@ -35,7 +35,6 @@
#include "mortevielle/mor.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ovd1.h"
#include "mortevielle/saveload.h"
#include "mortevielle/outtext.h"
#include "mortevielle/var_mor.h"
@ -180,7 +179,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
_txxFileFl = false;
// Load texts from TXX files
chartex();
loadTexts();
// Load the mort.dat resource
Common::ErrorCode result = loadMortDat();
@ -198,7 +197,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
_currGraphicalDevice = MODE_EGA;
_newGraphicalDevice = _currGraphicalDevice;
charpal();
loadPalette();
loadCFIPH();
loadCFIEC();
decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
@ -211,7 +210,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
_largestClearScreen = false;
teskbd();
dialpre();
showConfigScreen();
_newGraphicalDevice = _currGraphicalDevice;
teskbd();
if (_newGraphicalDevice != _currGraphicalDevice)
@ -551,7 +550,7 @@ void MortevielleEngine::showIntroduction() {
CHECK_QUIT;
// TODO: Once music is implemented, only use the below delay if music is turned off
suite();
showTitleScreen();
delay(3000);
music();
}
@ -2125,6 +2124,15 @@ void MortevielleEngine::showMoveMenuAlert() {
Alert::show(getEngineString(S_USE_DEP_MENU), 1);
}
/**
* The original engine used this method to display a starting text screen letting the player
* select the graphics mode to use
* @remarks Originally called 'dialpre'
*/
void MortevielleEngine::showConfigScreen() {
g_crep = 998;
}
/**
* Decodes a number of 64 byte blocks
* @param pStart Start of data
@ -2206,8 +2214,8 @@ Common::String MortevielleEngine::getString(int num) {
if (num < 0) {
warning("deline: num < 0! Skipping");
} else if (!g_vm->_txxFileFl) {
wrkStr = g_vm->getGameString(num);
} else if (!_txxFileFl) {
wrkStr = getGameString(num);
} else {
int i = g_t_rec[num]._hintId;
byte k = g_t_rec[num]._point;
@ -2253,7 +2261,7 @@ void MortevielleEngine::resetVariables() {
g_s._secretPassageObjectId = 0;
g_s._purpleRoomObjectId = 136;
g_s._cryptObjectId = 141;
g_s._faithScore = g_vm->getRandomNumber(4, 10);
g_s._faithScore = getRandomNumber(4, 10);
g_s._currPlace = MANOR_FRONT;
for (int i = 2; i <= 6; ++i)
@ -2290,7 +2298,7 @@ void MortevielleEngine::resetVariables() {
* @remarks Originally called 'writepal'
*/
void MortevielleEngine::setPal(int n) {
switch (g_vm->_currGraphicalDevice) {
switch (_currGraphicalDevice) {
case MODE_TANDY:
case MODE_EGA:
case MODE_AMSTRAD1512:
@ -2302,14 +2310,14 @@ void MortevielleEngine::setPal(int n) {
case MODE_CGA: {
nhom pal[16];
for (int i = 0; i < 16; ++i) {
pal[i] = g_vm->_cgaPal[n]._a[i];
pal[i] = _cgaPal[n]._a[i];
}
if (n < 89)
palette(g_vm->_cgaPal[n]._p);
palette(_cgaPal[n]._p);
for (int i = 0; i <= 15; ++i)
outbloc(i, _patternArr[pal[i]._id], pal);
displayCGAPattern(i, _patternArr[pal[i]._id], pal);
}
break;
default:
@ -2317,4 +2325,230 @@ void MortevielleEngine::setPal(int n) {
}
}
/**
* Engine function - Display a CGA pattern, using a specified palette
* @remarks Originally called 'outbloc'
*/
void MortevielleEngine::displayCGAPattern(int n, Pattern p, nhom *pal) {
int addr = n * 404 + 0xd700;
WRITE_LE_UINT16(&g_mem[0x6000 * 16 + addr], p._tax);
WRITE_LE_UINT16(&g_mem[0x6000 * 16 + addr + 2], p._tay);
addr += 4;
for (int i = 0; i < p._tax; ++i) {
for (int j = 0; j < p._tay; ++j)
g_mem[(0x6000 * 16) + addr + j * p._tax + i] = pal[n]._hom[p._des[i + 1][j + 1]];
}
}
/**
* Engine function - Load Palette from File
* @remarks Originally called 'charpal'
*/
void MortevielleEngine::loadPalette() {
Common::File f;
byte b;
if (!f.open("fxx.mor"))
error("Missing file - fxx.mor");
for (int i = 0; i < 108; ++i)
g_l[i] = f.readSint16LE();
f.close();
if (!f.open("plxx.mor"))
error("Missing file - plxx.mor");
for (int i = 0; i <= 90; ++i) {
for (int j = 1; j <= 16; ++j) {
_stdPal[i][j].x = f.readByte();
_stdPal[i][j].y = f.readByte();
}
}
f.close();
if (!f.open("cxx.mor"))
error("Missing file - cxx.mor");
for (int j = 0; j <= 90; ++j) {
_cgaPal[j]._p = f.readByte();
for (int i = 0; i <= 15; ++i) {
nhom &with = _cgaPal[j]._a[i];
b = f.readByte();
with._id = (uint)b >> 4;
with._hom[0] = ((uint)b >> 2) & 3;
with._hom[1] = b & 3;
}
}
_cgaPal[10]._a[9] = _cgaPal[10]._a[5];
for (int j = 0; j <= 14; ++j) {
_patternArr[j]._tax = f.readByte();
_patternArr[j]._tay = f.readByte();
for (int i = 1; i <= 20; ++i) {
for (int k = 1; k <= 20; ++k)
_patternArr[j]._des[i][k] = f.readByte();
}
}
f.close();
}
/**
* Engine function - Load Texts from File
* @remarks Originally called 'chartex'
*/
void MortevielleEngine::loadTexts() {
Common::File inpFile;
Common::File ntpFile;
_txxFileFl = false;
if (getLanguage() == Common::EN_ANY) {
warning("English version expected - Switching to DAT file");
return;
}
if (!inpFile.open("TXX.INP")) {
if (!inpFile.open("TXX.MOR")) {
warning("Missing file - TXX.INP or .MOR - Switching to DAT file");
return;
}
}
if (!ntpFile.open("TXX.NTP")) {
warning("Missing file - TXX.INP or .MOR - Switching to DAT file");
return;
}
if ((inpFile.size() > (kMaxTi * 2)) || (ntpFile.size() > (kMaxTd * 3))) {
warning("TXX file - Unexpected format - Switching to DAT file");
return;
}
for (int i = 0; i < inpFile.size() / 2; ++i)
g_t_mot[i] = inpFile.readUint16LE();
inpFile.close();
_txxFileFl = true;
for (int i = 0; i < (ntpFile.size() / 3); ++i) {
g_t_rec[i]._hintId = ntpFile.readSint16LE();
g_t_rec[i]._point = ntpFile.readByte();
}
ntpFile.close();
}
void MortevielleEngine::loadBRUIT5() {
Common::File f;
if (!f.open("bruit5"))
error("Missing file - bruit5");
f.read(&g_mem[kAdrNoise5 * 16 + 0], 149 * 128);
f.close();
}
void MortevielleEngine::loadCFIEC() {
Common::File f;
if (!f.open("cfiec.mor"))
error("Missing file - cfiec.mor");
f.read(&g_adcfiec[0], 822 * 128);
f.close();
_reloadCFIEC = false;
}
void MortevielleEngine::loadCFIPH() {
Common::File f;
if (!f.open("cfiph.mor"))
error("Missing file - cfiph.mor");
for (int i = 0; i < (f.size() / 2); ++i)
g_t_cph[i] = f.readSint16LE();
f.close();
}
/**
* Engine function - Play Music
* @remarks Originally called 'music'
*/
void MortevielleEngine::music() {
if (_soundOff)
return;
_reloadCFIEC = true;
Common::File fic;
if (!fic.open("mort.img"))
error("Missing file - mort.img");
fic.read(&g_mem[0x3800 * 16 + 0], 500);
fic.read(&g_mem[0x47a0 * 16 + 0], 123);
fic.close();
_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623);
_addfix = (float)((kTempoMusic - g_addv[1])) / 256;
_speechManager.cctable(g_tbi);
bool fin = false;
int k = 0;
do {
fin = keyPressed();
_soundManager.musyc(g_tbi, 9958, kTempoMusic);
++k;
fin = fin | keyPressed() | (k >= 5);
} while (!fin);
while (keyPressed())
getChar();
}
/**
* Engine function - Show title screen
* @remarks Originally called 'suite'
*/
void MortevielleEngine::showTitleScreen() {
hirs();
repon(7, 2035);
g_caff = 51;
taffich();
teskbd();
if (_newGraphicalDevice != _currGraphicalDevice)
_currGraphicalDevice = _newGraphicalDevice;
hirs();
g_vm->draw(g_ades, 0, 0);
Common::String cpr = "COPYRIGHT 1989 : LANKHOR";
_screenSurface.putxy(104 + 72 * g_res, 185);
_screenSurface.drawString(cpr, 0);
}
/**
* Draw picture
* @remarks Originally called 'dessine'
*/
void MortevielleEngine::draw(int ad, int x, int y) {
g_vm->_mouse.hideMouse();
g_vm->setPal(g_numpal);
pictout(ad, 0, x, y);
g_vm->_mouse.showMouse();
}
/**
* Draw right frame
* @remarks Originally called 'dessine_rouleau'
*/
void MortevielleEngine::drawRightFrame() {
g_vm->setPal(89);
if (g_vm->_currGraphicalDevice == MODE_HERCULES) {
g_mem[0x7000 * 16 + 14] = 15;
}
g_vm->_mouse.hideMouse();
pictout(0x73a2, 0, 0, 0);
g_vm->_mouse.showMouse();
}
} // End of namespace Mortevielle

View File

@ -90,6 +90,16 @@ const int amzon = 1650;
const int fleche = 1758;
const int arega = 0;
struct nhom {
byte _id; /* number between 0 and 32 */
byte _hom[4];
};
struct t_pcga {
byte _p;
nhom _a[16];
};
class MortevielleEngine : public Engine {
private:
const ADGameDescription *_gameDescription;
@ -101,6 +111,8 @@ private:
Common::StringArray _engineStrings;
Common::StringArray _gameStrings;
Pattern _patternArr[15];
Common::ErrorCode initialise();
Common::ErrorCode loadMortDat();
void readStaticStrings(Common::File &f, int dataSize, DataType dataType);
@ -114,6 +126,14 @@ private:
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();
void loadBRUIT5();
void loadCFIEC();
void loadCFIPH();
void showTitleScreen();
public:
Common::String _hintPctMessage;
Common::Point _prevPos;
@ -163,6 +183,8 @@ public:
int _c_zzz;
int ptr_word;
byte _v_lieu[7][25];
SaveStruct g_s, g_s1;
byte g_is;
ScreenSurface _screenSurface;
PaletteManager _paletteManager;
@ -304,11 +326,14 @@ public:
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();
};

View File

@ -196,37 +196,37 @@ void taffich() {
switch (a) {
case 16:
g_s._pourc[9] = '*';
g_s._teauto[42] = '*';
g_vm->g_s._pourc[9] = '*';
g_vm->g_s._teauto[42] = '*';
break;
case 20:
g_s._teauto[39] = '*';
if (g_s._teauto[36] == '*') {
g_s._pourc[3] = '*';
g_s._teauto[38] = '*';
g_vm->g_s._teauto[39] = '*';
if (g_vm->g_s._teauto[36] == '*') {
g_vm->g_s._pourc[3] = '*';
g_vm->g_s._teauto[38] = '*';
}
break;
case 24:
g_s._teauto[37] = '*';
g_vm->g_s._teauto[37] = '*';
break;
case 30:
g_s._teauto[9] = '*';
g_vm->g_s._teauto[9] = '*';
break;
case 31:
g_s._pourc[4] = '*';
g_s._teauto[35] = '*';
g_vm->g_s._pourc[4] = '*';
g_vm->g_s._teauto[35] = '*';
break;
case 118:
g_s._teauto[41] = '*';
g_vm->g_s._teauto[41] = '*';
break;
case 143:
g_s._pourc[1] = '*';
g_vm->g_s._pourc[1] = '*';
break;
case 150:
g_s._teauto[34] = '*';
g_vm->g_s._teauto[34] = '*';
break;
case 151:
g_s._pourc[2] = '*';
g_vm->g_s._pourc[2] = '*';
break;
default:
break;
@ -249,7 +249,7 @@ void taffich() {
m = 2018;
if (a > 99) {
if ((g_is == 1) || (g_is == 0))
if ((g_vm->g_is == 1) || (g_vm->g_is == 0))
m = 2031;
else
m = 2032;
@ -258,7 +258,7 @@ void taffich() {
if (((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149))
m = 2030;
if (((a < 27) && (((g_maff > 69) && (!g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33)))
if (((a < 27) && (((g_maff > 69) && (!g_vm->g_s._alreadyEnteredManor)) || (g_maff > 99))) || ((g_maff > 29) && (g_maff < 33)))
m = 2033;
g_maff = a;
@ -333,11 +333,11 @@ void taffich() {
charani(filename, lgt, handle);
}
g_vm->_mouse.showMouse();
if ((a < 27) && ((g_maff < 27) || (g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) {
if ((a < 27) && ((g_maff < 27) || (g_vm->g_s._currPlace == LANDING)) && (g_msg[4] != OPCODE_ENTER)) {
if ((a == 13) || (a == 14))
g_vm->displayAloneText();
else if (!g_vm->_blo)
cx = t11(g_s._currPlace);
cx = t11(g_vm->g_s._currPlace);
g_mpers = 0;
}
}

View File

@ -1,221 +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
*/
#include "common/file.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/ovd1.h"
#include "mortevielle/speech.h"
#include "mortevielle/sound.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
void charpal() {
Common::File f;
byte b;
if (!f.open("fxx.mor"))
error("Missing file - fxx.mor");
for (int i = 0; i < 108; ++i)
g_l[i] = f.readSint16LE();
f.close();
if (!f.open("plxx.mor"))
error("Missing file - plxx.mor");
for (int i = 0; i <= 90; ++i) {
for (int j = 1; j <= 16; ++j) {
g_vm->_stdPal[i][j].x = f.readByte();
g_vm->_stdPal[i][j].y = f.readByte();
}
}
f.close();
if (!f.open("cxx.mor"))
error("Missing file - cxx.mor");
for (int j = 0; j <= 90; ++j) {
g_vm->_cgaPal[j]._p = f.readByte();
for (int i = 0; i <= 15; ++i) {
nhom &with = g_vm->_cgaPal[j]._a[i];
b = f.readByte();
with._id = (uint)b >> 4;
with._hom[0] = ((uint)b >> 2) & 3;
with._hom[1] = b & 3;
}
}
g_vm->_cgaPal[10]._a[9] = g_vm->_cgaPal[10]._a[5];
for (int j = 0; j <= 14; ++j) {
_patternArr[j]._tax = f.readByte();
_patternArr[j]._tay = f.readByte();
for (int i = 1; i <= 20; ++i)
for (int k = 1; k <= 20; ++k)
_patternArr[j]._des[i][k] = f.readByte();
}
f.close();
}
void chartex() {
Common::File inpFile;
Common::File ntpFile;
g_vm->_txxFileFl = false;
if (g_vm->getLanguage() == Common::EN_ANY) {
warning("English version expected - Switching to DAT file");
return;
}
if (!inpFile.open("TXX.INP")) {
if (!inpFile.open("TXX.MOR")) {
warning("Missing file - TXX.INP or .MOR - Switching to DAT file");
return;
}
}
if (!ntpFile.open("TXX.NTP")) {
warning("Missing file - TXX.INP or .MOR - Switching to DAT file");
return;
}
if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) {
warning("TXX file - Unexpected format - Switching to DAT file");
return;
}
for (int i = 0; i < inpFile.size() / 2; ++i)
g_t_mot[i] = inpFile.readUint16LE();
inpFile.close();
g_vm->_txxFileFl = true;
for (int i = 0; i < (ntpFile.size() / 3); ++i) {
g_t_rec[i]._hintId = ntpFile.readSint16LE();
g_t_rec[i]._point = ntpFile.readByte();
}
ntpFile.close();
}
/**
* The original engine used this method to display a starting text screen letting the player
* select the graphics mode to use
*/
void dialpre() {
/* debug('o3 dialpre'); */
g_crep = 998;
}
void music() {
if (g_vm->_soundOff)
return;
g_vm->_reloadCFIEC = true;
Common::File fic;
if (!fic.open("mort.img"))
error("Missing file - mort.img");
fic.read(&g_mem[0x3800 * 16 + 0], 500);
fic.read(&g_mem[0x47a0 * 16 + 0], 123);
fic.close();
g_vm->_soundManager.decodeMusic(&g_mem[0x3800 * 16], &g_mem[0x5000 * 16], 623);
g_vm->_addfix = (float)((kTempoMusic - g_addv[1])) / 256;
g_vm->_speechManager.cctable(g_tbi);
bool fin = false;
int k = 0;
do {
fin = g_vm->keyPressed();
g_vm->_soundManager.musyc(g_tbi, 9958, kTempoMusic);
++k;
fin = fin | g_vm->keyPressed() | (k >= 5);
} while (!fin);
while (g_vm->keyPressed())
g_vm->getChar();
}
void loadBRUIT5() {
Common::File f;
if (!f.open("bruit5"))
error("Missing file - bruit5");
f.read(&g_mem[kAdrNoise5 * 16 + 0], 149 * 128);
f.close();
}
void loadCFIEC() {
Common::File f;
if (!f.open("cfiec.mor"))
error("Missing file - cfiec.mor");
f.read(&g_adcfiec[0], 822 * 128);
f.close();
g_vm->_reloadCFIEC = false;
}
void loadCFIPH() {
Common::File f;
if (!f.open("cfiph.mor"))
error("Missing file - cfiph.mor");
for (int i = 0; i < (f.size() / 2); ++i)
g_t_cph[i] = f.readSint16LE();
f.close();
}
void suite() {
hirs();
repon(7, 2035);
g_caff = 51;
taffich();
teskbd();
if (g_vm->_newGraphicalDevice != g_vm->_currGraphicalDevice)
g_vm->_currGraphicalDevice = g_vm->_newGraphicalDevice;
hirs();
dessine(g_ades, 0, 0);
Common::String cpr = "COPYRIGHT 1989 : LANKHOR";
g_vm->_screenSurface.putxy(104 + 72 * g_res, 185);
g_vm->_screenSurface.drawString(cpr, 0);
}
} // End of namespace Mortevielle

View File

@ -1,43 +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_OVD1_H
#define MORTEVIELLE_OVD1_H
namespace Mortevielle {
extern void charpal();
extern void chartex();
extern void dialpre();
extern void music();
extern void loadBRUIT5();
extern void loadCFIEC();
extern void loadCFIPH();
extern void suite();
} // End of namespace Mortevielle
#endif

View File

@ -31,7 +31,6 @@
#include "mortevielle/mor.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/ovd1.h"
#include "mortevielle/saveload.h"
#include "mortevielle/var_mor.h"
@ -47,25 +46,25 @@ Common::String SavegameManager::generateSaveName(int slotNumber) {
* Handle saving or loading savegame data
*/
void SavegameManager::sync_save(Common::Serializer &sz) {
sz.syncAsSint16LE(g_s1._faithScore);
sz.syncAsSint16LE(g_vm->g_s1._faithScore);
for (int i = 0; i < 11; ++i)
sz.syncAsByte(g_s1._pourc[i]);
sz.syncAsByte(g_vm->g_s1._pourc[i]);
for (int i = 0; i < 43; ++i)
sz.syncAsByte(g_s1._teauto[i]);
sz.syncAsByte(g_vm->g_s1._teauto[i]);
for (int i = 0; i < 31; ++i)
sz.syncAsByte(g_s1._sjer[i]);
sz.syncAsByte(g_vm->g_s1._sjer[i]);
sz.syncAsSint16LE(g_s1._currPlace);
sz.syncAsSint16LE(g_s1._atticBallHoleObjectId);
sz.syncAsSint16LE(g_s1._atticRodHoleObjectId);
sz.syncAsSint16LE(g_s1._cellarObjectId);
sz.syncAsSint16LE(g_s1._secretPassageObjectId);
sz.syncAsSint16LE(g_s1._wellObjectId);
sz.syncAsSint16LE(g_s1._selectedObjectId);
sz.syncAsSint16LE(g_s1._purpleRoomObjectId);
sz.syncAsSint16LE(g_s1._cryptObjectId);
sz.syncAsByte(g_s1._alreadyEnteredManor);
sz.syncAsByte(g_s1._fullHour);
sz.syncAsSint16LE(g_vm->g_s1._currPlace);
sz.syncAsSint16LE(g_vm->g_s1._atticBallHoleObjectId);
sz.syncAsSint16LE(g_vm->g_s1._atticRodHoleObjectId);
sz.syncAsSint16LE(g_vm->g_s1._cellarObjectId);
sz.syncAsSint16LE(g_vm->g_s1._secretPassageObjectId);
sz.syncAsSint16LE(g_vm->g_s1._wellObjectId);
sz.syncAsSint16LE(g_vm->g_s1._selectedObjectId);
sz.syncAsSint16LE(g_vm->g_s1._purpleRoomObjectId);
sz.syncAsSint16LE(g_vm->g_s1._cryptObjectId);
sz.syncAsByte(g_vm->g_s1._alreadyEnteredManor);
sz.syncAsByte(g_vm->g_s1._fullHour);
sz.syncBytes(g_bufcha, 391);
}
@ -107,7 +106,7 @@ void SavegameManager::loadSavegame(int n) {
Common::Serializer sz(stream, NULL);
sync_save(sz);
g_s = g_s1;
g_vm->g_s = g_vm->g_s1;
for (int i = 0; i <= 389; ++i)
g_tabdon[i + kAcha] = g_bufcha[i];
@ -143,9 +142,9 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) {
for (i = 0; i <= 389; ++i)
g_bufcha[i] = g_tabdon[i + kAcha];
g_s1 = g_s;
if (g_s1._currPlace == 26)
g_s1._currPlace = 15;
g_vm->g_s1 = g_vm->g_s;
if (g_vm->g_s1._currPlace == 26)
g_vm->g_s1._currPlace = 15;
Common::String filename = generateSaveName(n);
f = g_system->getSavefileManager()->openForSaving(filename);

View File

@ -101,7 +101,6 @@ int g_x,
int g_t_cph[6401];
byte g_tabdon[4001];
byte g_is;
int g_nbrep[9];
int g_nbrepm[9];
@ -112,13 +111,11 @@ byte g_bufcha[391];
byte g_lettres[7][24];
uint16 g_t_mot[maxti + 1];
uint16 g_t_mot[kMaxTi + 1];
int g_tay_tchar;
Hint g_t_rec[maxtd + 1];
Hint g_t_rec[kMaxTd + 1];
int g_l[108];
int g_tbi[256];
t_pcga g_palcga[91];
Pattern _patternArr[15];
byte g_adcfiec[(4088 * 16) + (311 * 0x80)];

View File

@ -64,8 +64,8 @@ namespace Mortevielle {
/*------------------------- CONSTANTS ----------------------------------*/
/*---------------------------------------------------------------------------*/
const int maxti = 7975;
const int maxtd = 600;
const int kMaxTi = 7975;
const int kMaxTd = 600;
const int kDescriptionStringIndex = 0; // Unused
const int kInventoryStringIndex = 186;
@ -150,16 +150,6 @@ struct Pattern {
byte _des[kMaxPatt + 1][kMaxPatt + 1];
};
struct nhom {
byte _id; /* number between 0 and 32 */
byte _hom[4];
};
struct t_pcga {
byte _p;
nhom _a[16];
};
typedef int tablint[256];
//typedef Common::Point tabdb[17];
typedef int tfxx[108];
@ -210,23 +200,19 @@ extern int g_x,
extern int g_t_cph[6401]; // Speech
extern byte g_tabdon[4001];
extern byte g_is;
extern int g_nbrep[9];
extern int g_nbrepm[9];
extern int g_msg[5];
extern byte g_touv[8];
extern SaveStruct g_s, g_s1;
extern byte g_bufcha[391];
extern byte g_lettres[7][24];
extern uint16 g_t_mot[maxti + 1];
extern uint16 g_t_mot[kMaxTi + 1];
extern int g_tay_tchar;
extern Hint g_t_rec[maxtd + 1];
extern Hint g_t_rec[kMaxTd + 1];
extern int g_l[108];
extern int g_tbi[256];
extern Pattern _patternArr[15];
extern byte g_adcfiec[822 * 128];
@ -245,9 +231,6 @@ void Val(const Common::String &s, int &V, int Code);
extern int g_port[0xfff];
extern byte g_mem[65536 * 16];
#define hires {}
extern void palette(int v1);
} // End of namespace Mortevielle