MORTEVIELLE: More renaming

This commit is contained in:
Strangerke 2012-03-21 08:32:36 +01:00
parent d09561e0c4
commit 76f7858096
20 changed files with 285 additions and 363 deletions

View File

@ -209,7 +209,7 @@ void MortevielleEngine::fctTake() {
_obpart = false;
affrep();
} else {
g_tabdon[acha + ((g_mchai - 1) * 10) + g_cs - 1] = 0;
g_tabdon[kAcha + ((g_mchai - 1) * 10) + g_cs - 1] = 0;
tsuiv();
++g_dobj;
if (g_dobj > 6) {
@ -699,7 +699,7 @@ void MortevielleEngine::fctPlace() {
// Do you want to enter the hidden passage?
int answer = Alert::show(getEngineString(S_YES_NO), 1);
if (answer == 1) {
Common::String alertTxt = deline(582);
Common::String alertTxt = g_vm->getString(582);
Alert::show(alertTxt, 1);
bool enterPassageFl = KnowledgeCheck::show();
@ -722,11 +722,11 @@ void MortevielleEngine::fctPlace() {
_menu.setDestinationMenuText(SECRET_PASSAGE);
} else {
_menu.setDestinationMenuText(g_s._currPlace);
writepal(14);
setPal(14);
dessin(0);
aniof(1, 2);
aniof(1, 1);
alertTxt = deline(577);
alertTxt = g_vm->getString(577);
Alert::show(alertTxt, 1);
aniof(2, 1);
g_crep = 166;
@ -1368,7 +1368,7 @@ void MortevielleEngine::fctDiscuss() {
for (int ix = 1; ix <= 46; ++ix)
te[ix] = false;
for (int ix = 1; ix <= 45; ++ix) {
lib[ix] = deline(ix + kQuestionStringIndex);
lib[ix] = g_vm->getString(ix + kQuestionStringIndex);
for (i = lib[ix].size(); i <= 40; ++i)
lib[ix] = lib[ix] + ' ';
}
@ -1403,7 +1403,7 @@ void MortevielleEngine::fctDiscuss() {
_mouse.moveMouse(f, tou);
CHECK_QUIT;
_mouse.getMousePos_(x, y, c);
_mouse.getMousePosition(x, y, c);
x *= (3 - g_res);
if (x > 319)
cx = 41;

View File

@ -1,52 +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/scummsys.h"
namespace Mortevielle {
/**
* Decodes a number of 64 byte blocks
* @param pStart Start of data
* @param count Number of 64 byte blocks
*/
void zzuul(byte *pStart, int count) {
while (count-- > 0) {
for (int idx = 0; idx < 64; ++pStart, ++idx) {
uint16 v = ((*pStart - 0x80) << 1) + 0x80;
if (v & 0x8000)
*pStart = 0;
else if (v & 0xff00)
*pStart = 0xff;
else
*pStart = (byte)v;
}
}
}
} // End of namespace Mortevielle

View File

@ -1,36 +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_ASM_H
#define MORTEVIELLE_ASM_H
namespace Mortevielle {
extern void zzuul(byte *pStart, int count);
} // End of namespace Mortevielle
#endif

View File

@ -291,7 +291,7 @@ bool KnowledgeCheck::show() {
int rep;
int firstOption, lastOption;
char key;
rectangle coor[kMaxRect];
Rect coor[kMaxRect];
Common::String choiceArray[15];
int currChoice, prevChoice;
@ -307,7 +307,7 @@ bool KnowledgeCheck::show() {
else
dialogHeight = 23;
g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight));
Common::String tmpStr = deline(textIndexArr[indx]);
Common::String tmpStr = g_vm->getString(textIndexArr[indx]);
displayStr(tmpStr, 20, 15, 100, 2, 0);
if (indx != 9) {
@ -322,7 +322,7 @@ bool KnowledgeCheck::show() {
prevChoice = 1;
for (int j = firstOption; j <= lastOption; ++j, ++prevChoice) {
tmpStr = deline(j);
tmpStr = g_vm->getString(j);
if ((int) tmpStr.size() > maxLength)
maxLength = tmpStr.size();
displayStr(tmpStr, 100, optionPosY, 100, 1, 0);

View File

@ -28,7 +28,6 @@
#include "mortevielle/mortevielle.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/var_mor.h"
#include "mortevielle/asm.h"
namespace Mortevielle {
@ -47,7 +46,7 @@ int testou() {
break;
case '\26' :
if ((g_vm->_c_zzz == 1) || (g_vm->_c_zzz == 2)) {
zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
g_vm->decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
++g_vm->_c_zzz;
return 61;

View File

@ -97,7 +97,7 @@ void Menu::setDestinationMenuText(int roomId) {
int destinationId = 0;
for (; (destinationId < 7) && (g_vm->_v_lieu[destinationId][roomId]); ++destinationId) {
nomp = deline(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex);
nomp = g_vm->getString(g_vm->_v_lieu[destinationId][roomId] + kMenuPlaceStringIndex);
while (nomp.size() < 20)
nomp += ' ';
setText(_moveMenu[destinationId + 1], nomp);
@ -518,18 +518,18 @@ void Menu::initMenu() {
_moveStringArray[i] = "* ";
i = 1;
do {
_actionStringArray[i] = deline(i + kMenuActionStringIndex);
_actionStringArray[i] = g_vm->getString(i + kMenuActionStringIndex);
while (_actionStringArray[i].size() < 10)
_actionStringArray[i] += ' ';
if (i < 9) {
if (i < 6) {
_selfStringArray[i] = deline(i + kMenuSelfStringIndex);
_selfStringArray[i] = g_vm->getString(i + kMenuSelfStringIndex);
while (_selfStringArray[i].size() < 10)
_selfStringArray[i] += ' ';
}
_discussStringArray[i] = deline(i + kMenuSayStringIndex) + ' ';
_discussStringArray[i] = g_vm->getString(i + kMenuSayStringIndex) + ' ';
}
++i;
} while (i != 22);

View File

@ -2,7 +2,6 @@ MODULE := engines/mortevielle
MODULE_OBJS := \
actions.o \
asm.o \
detection.o \
dialogs.o \
graphics.o \

View File

@ -44,16 +44,7 @@
namespace Mortevielle {
/* NIVEAU 15 */
void copcha() {
int i = acha;
do {
g_tabdon[i] = g_tabdon[i + 390];
++i;
} while (i != acha + 390);
}
void outbloc(int n, pattern p, nhom *pal) {
void outbloc(int n, Pattern p, nhom *pal) {
int ad = n * 404 + 0xd700;
WRITE_LE_UINT16(&g_mem[0x6000 * 16 + ad], p._tax);
@ -65,34 +56,6 @@ void outbloc(int n, pattern p, nhom *pal) {
}
}
void writepal(int n) {
switch (g_vm->_currGraphicalDevice) {
case MODE_TANDY:
case MODE_EGA:
case MODE_AMSTRAD1512:
for (int i = 1; i <= 16; ++i) {
g_mem[(0x7000 * 16) + (2 * i)] = g_tabpal[n][i].x;
g_mem[(0x7000 * 16) + (2 * i) + 1] = g_tabpal[n][i].y;
}
break;
case MODE_CGA: {
nhom pal[16];
for (int i = 0; i < 16; ++i) {
pal[i] = g_palcga[n]._a[i];
}
if (n < 89)
palette(g_palcga[n]._p);
for (int i = 0; i <= 15; ++i)
outbloc(i, g_tpt[pal[i]._id], pal);
}
break;
default:
break;
}
}
void pictout(int seg, int dep, int x, int y) {
GfxSurface surface;
@ -199,7 +162,7 @@ void modif(int &nu) {
void dessine(int ad, int x, int y) {
g_vm->_mouse.hideMouse();
writepal(g_numpal);
g_vm->setPal(g_numpal);
pictout(ad, 0, x, y);
g_vm->_mouse.showMouse();
}
@ -209,7 +172,7 @@ void dessine(int ad, int x, int y) {
* @remarks Originally called 'dessine_rouleau'
*/
void drawRightFrame() {
writepal(89);
g_vm->setPal(89);
if (g_vm->_currGraphicalDevice == MODE_HERCULES) {
g_mem[0x7000 * 16 + 14] = 15;
}
@ -228,7 +191,7 @@ void text1(int x, int y, int nb, int m) {
co = 10;
else
co = 6;
Common::String tmpStr = deline(m);
Common::String tmpStr = g_vm->getString(m);
if ((y == 182) && ((int) tmpStr.size() * co > nb * 6))
y = 176;
displayStr(tmpStr, x, y, nb, 20, g_vm->_textColor);
@ -291,7 +254,7 @@ void modobj(int m) {
Common::String strp = Common::String(' ');
if (m != 500)
strp = deline(m - 501 + kInventoryStringIndex);
strp = g_vm->getString(m - 501 + kInventoryStringIndex);
g_vm->_menu.setText(g_vm->_menu._inventoryMenu[8], strp);
g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[8]);
@ -299,7 +262,7 @@ void modobj(int m) {
void repon(int f, int m) {
if ((m > 499) && (m < 563)) {
Common::String tmpStr = deline(m - 501 + kInventoryStringIndex);
Common::String tmpStr = g_vm->getString(m - 501 + kInventoryStringIndex);
if ((int) tmpStr.size() > ((58 + (g_res - 1) * 37) << 1))
g_vm->_largestClearScreen = true;
@ -335,7 +298,7 @@ void repon(int f, int m) {
else
i = 5;
Common::String tmpStr = deline(m);
Common::String tmpStr = g_vm->getString(m);
displayStr(tmpStr, 80, 40, 60, 25, i);
if (m == 180)
@ -494,54 +457,6 @@ void phaz(int &rand, int &p, int cf) {
rand = g_vm->getRandomNumber(1, 100);
}
/**
* Engine function - When restarting the game, reset the main variables used by the engine
* @remarks Originally called 'inzon'
*/
void resetVariables() {
copcha();
g_s._alreadyEnteredManor = false;
g_s._selectedObjectId = 0;
g_s._cellarObjectId = 0;
g_s._atticBallHoleObjectId = 0;
g_s._atticRodHoleObjectId = 0;
g_s._wellObjectId = 0;
g_s._secretPassageObjectId = 0;
g_s._purpleRoomObjectId = 136;
g_s._cryptObjectId = 141;
g_s._faithScore = g_vm->getRandomNumber(4, 10);
g_s._currPlace = MANOR_FRONT;
for (int i = 2; i <= 6; ++i)
g_s._sjer[i] = chr(0);
g_s._sjer[1] = chr(113);
g_s._fullHour = chr(20);
for (int i = 1; i <= 10; ++i)
g_s._pourc[i] = ' ';
for (int i = 1; i <= 6; ++i)
g_s._teauto[i] = '*';
for (int i = 7; i <= 9; ++i)
g_s._teauto[i] = ' ';
for (int i = 10; i <= 28; ++i)
g_s._teauto[i] = '*';
for (int i = 29; i <= 42; ++i)
g_s._teauto[i] = ' ';
g_s._teauto[33] = '*';
for (int i = 1; i <= 8; ++i)
g_nbrep[i] = 0;
init_nbrepm();
}
int t11(int roomId) {
int retVal = 0;
int p, rand;
@ -876,7 +791,7 @@ void tkey1(bool d) {
while (g_vm->keyPressed())
g_key = testou();
do {
g_vm->_mouse.getMousePos_(x, y, c);
g_vm->_mouse.getMousePosition(x, y, c);
g_vm->keyPressed();
} while (c != 0);
@ -885,7 +800,7 @@ void tkey1(bool d) {
if (d)
tinke();
quest = g_vm->keyPressed();
g_vm->_mouse.getMousePos_(x, y, c);
g_vm->_mouse.getMousePosition(x, y, c);
CHECK_QUIT;
} while (!(quest || (c != 0) || (d && g_vm->_anyone)));
if (quest)
@ -967,7 +882,7 @@ void modinv() {
if (g_s._sjer[i] != chr(0)) {
++cy;
r = (ord(g_s._sjer[i]) + 400);
nomp = deline(r - 501 + kInventoryStringIndex);
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]);
}
@ -992,7 +907,7 @@ void premtet() {
/* NIVEAU 5 */
void ajchai() {
int cy = acha + ((g_mchai - 1) * 10) - 1;
int cy = kAcha + ((g_mchai - 1) * 10) - 1;
int cx = 0;
do {
++cx;
@ -1077,7 +992,7 @@ void tsuiv() {
int tbcl;
int cl;
int cy = acha + ((g_mchai - 1) * 10) - 1;
int cy = kAcha + ((g_mchai - 1) * 10) - 1;
int cx = 0;
do {
++cx;

View File

@ -42,9 +42,7 @@ static const int _actionMenu[12] = { OPCODE_NONE,
OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE
};
extern void copcha();
extern void outbloc(int n, pattern p, nhom *pal);
extern void writepal(int n);
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);
@ -76,7 +74,6 @@ extern void becfren(int roomId);
/* NIVEAU 10 */
extern void init_nbrepm();
extern void phaz(int &rand, int &p, int cf);
extern void resetVariables();
extern int t11(int roomId);
extern void cavegre();
extern void writetp(Common::String s, int t);

View File

@ -30,7 +30,6 @@
#include "graphics/pixelformat.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/asm.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
@ -43,6 +42,31 @@
namespace Mortevielle {
const byte tabdr[32] = {
32, 101, 115, 97, 114, 105, 110,
117, 116, 111, 108, 13, 100, 99,
112, 109, 46, 118, 130, 39, 102,
98, 44, 113, 104, 103, 33, 76,
85, 106, 30, 31
};
const byte tab30[32] = {
69, 67, 74, 138, 133, 120, 77, 122,
121, 68, 65, 63, 73, 80, 83, 82,
156, 45, 58, 79, 49, 86, 78, 84,
71, 81, 64, 66, 135, 34, 136, 91
};
const byte tab31[32]= {
93, 47, 48, 53, 50, 70, 124, 75,
72, 147, 140, 150, 151, 57, 56, 51,
107, 139, 55, 89, 131, 37, 54, 88,
119, 0, 0, 0, 0, 0, 0, 0
};
MortevielleEngine *g_vm;
MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc):
@ -164,7 +188,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
return result;
// Load some error messages (was previously in chartex())
_hintPctMessage = deline(580); // You should have noticed %d hints
_hintPctMessage = getString(580); // You should have noticed %d hints
// Set default EGA palette
_paletteManager.setDefaultPalette();
@ -177,7 +201,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
charpal();
loadCFIPH();
loadCFIEC();
zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
_c_zzz = 1;
init_nbrepm();
initMouse();
@ -541,7 +565,7 @@ void MortevielleEngine::mainGame() {
loadCFIEC();
for (g_crep = 1; g_crep <= _c_zzz; ++g_crep)
zzuul(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
decodeNumber(&g_adcfiec[161 * 16], ((822 * 128) - (161 * 16)) / 64);
loadBRUIT5();
_menu.initMenu();
@ -1684,7 +1708,7 @@ void MortevielleEngine::startDialog(int16 rep) {
assert(rep >= 0);
_mouse.hideMouse();
Common::String dialogStr = deline(rep + kDialogStringIndex);
Common::String dialogStr = getString(rep + kDialogStringIndex);
displayStr(dialogStr, 230, 4, 65, 24, 5);
f3f8::draw();
@ -1853,7 +1877,7 @@ void MortevielleEngine::gameLoaded() {
g_iouv = 0;
g_dobj = 0;
affrep();
_hintPctMessage = deline(580);
_hintPctMessage = getString(580);
_okdes = false;
_endGame = true;
@ -2101,4 +2125,196 @@ void MortevielleEngine::showMoveMenuAlert() {
Alert::show(getEngineString(S_USE_DEP_MENU), 1);
}
/**
* Decodes a number of 64 byte blocks
* @param pStart Start of data
* @param count Number of 64 byte blocks
* @remarks Originally called 'zzuul'
*/
void MortevielleEngine::decodeNumber(byte *pStart, int count) {
while (count-- > 0) {
for (int idx = 0; idx < 64; ++pStart, ++idx) {
uint16 v = ((*pStart - 0x80) << 1) + 0x80;
if (v & 0x8000)
*pStart = 0;
else if (v & 0xff00)
*pStart = 0xff;
else
*pStart = (byte)v;
}
}
}
void MortevielleEngine::cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
uint16 oct, ocd;
/* 5-8 */
oct = g_t_mot[idx];
oct = ((uint16)(oct << (16 - pt))) >> (16 - pt);
if (pt < 6) {
++idx;
oct = oct << (5 - pt);
pt += 11;
oct = oct | ((uint)g_t_mot[idx] >> pt);
} else {
pt -= 5;
oct = (uint)oct >> pt;
}
switch (oct) {
case 11:
c = '$';
the_end = true;
break;
case 30:
case 31:
ocd = g_t_mot[idx];
ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt);
if (pt < 6) {
++idx;
ocd = ocd << (5 - pt);
pt += 11;
ocd = ocd | ((uint)g_t_mot[idx] >> pt);
} else {
pt -= 5;
ocd = (uint)ocd >> pt;
}
if (oct == 30)
c = chr(tab30[ocd]);
else
c = chr(tab31[ocd]);
if (c == '\0') {
the_end = true;
c = '#';
}
break;
default:
c = chr(tabdr[oct]);
break;
}
}
/**
* Decode and extract the line with the given Id
* @remarks Originally called 'deline'
*/
Common::String MortevielleEngine::getString(int num) {
Common::String wrkStr = "";
if (num < 0) {
warning("deline: num < 0! Skipping");
} else if (!g_vm->_txxFileFl) {
wrkStr = g_vm->getGameString(num);
} else {
int i = g_t_rec[num]._hintId;
byte k = g_t_rec[num]._point;
int length = 0;
bool endFl = false;
char let;
do {
cinq_huit(let, i, k, endFl);
if (length < 254)
wrkStr += let;
++length;
} while (!endFl);
}
if (wrkStr.lastChar() == '$')
// Remove trailing '$'
wrkStr.deleteLastChar();
return wrkStr;
}
void MortevielleEngine::copcha() {
int i = kAcha;
do {
g_tabdon[i] = g_tabdon[i + 390];
++i;
} while (i != kAcha + 390);
}
/**
* Engine function - When restarting the game, reset the main variables used by the engine
* @remarks Originally called 'inzon'
*/
void MortevielleEngine::resetVariables() {
copcha();
g_s._alreadyEnteredManor = false;
g_s._selectedObjectId = 0;
g_s._cellarObjectId = 0;
g_s._atticBallHoleObjectId = 0;
g_s._atticRodHoleObjectId = 0;
g_s._wellObjectId = 0;
g_s._secretPassageObjectId = 0;
g_s._purpleRoomObjectId = 136;
g_s._cryptObjectId = 141;
g_s._faithScore = g_vm->getRandomNumber(4, 10);
g_s._currPlace = MANOR_FRONT;
for (int i = 2; i <= 6; ++i)
g_s._sjer[i] = chr(0);
g_s._sjer[1] = chr(113);
g_s._fullHour = chr(20);
for (int i = 1; i <= 10; ++i)
g_s._pourc[i] = ' ';
for (int i = 1; i <= 6; ++i)
g_s._teauto[i] = '*';
for (int i = 7; i <= 9; ++i)
g_s._teauto[i] = ' ';
for (int i = 10; i <= 28; ++i)
g_s._teauto[i] = '*';
for (int i = 29; i <= 42; ++i)
g_s._teauto[i] = ' ';
g_s._teauto[33] = '*';
for (int i = 1; i <= 8; ++i)
g_nbrep[i] = 0;
init_nbrepm();
}
/**
* Engine function - Set the palette
* @remarks Originally called 'writepal'
*/
void MortevielleEngine::setPal(int n) {
switch (g_vm->_currGraphicalDevice) {
case MODE_TANDY:
case MODE_EGA:
case MODE_AMSTRAD1512:
for (int i = 1; i <= 16; ++i) {
g_mem[(0x7000 * 16) + (2 * i)] = _stdPal[n][i].x;
g_mem[(0x7000 * 16) + (2 * i) + 1] = _stdPal[n][i].y;
}
break;
case MODE_CGA: {
nhom pal[16];
for (int i = 0; i < 16; ++i) {
pal[i] = g_vm->_cgaPal[n]._a[i];
}
if (n < 89)
palette(g_vm->_cgaPal[n]._p);
for (int i = 0; i <= 15; ++i)
outbloc(i, _patternArr[pal[i]._id], pal);
}
break;
default:
break;
}
}
} // End of namespace Mortevielle

View File

@ -80,10 +80,10 @@ enum DataType {
#define MORT_DAT "mort.dat"
#define GAME_FRAME_DELAY (1000 / 50)
const int kAcha = 492;
const int asoul = 154;
const int aouvr = 282;
const int achai = 387;
const int acha = 492;
const int arcf = 1272;
const int arep = 1314;
const int amzon = 1650;
@ -112,6 +112,8 @@ private:
void mainGame();
void playGame();
void handleAction();
void cinq_huit(char &c, int &idx, byte &pt, bool &the_end);
void copcha();
public:
Common::String _hintPctMessage;
Common::Point _prevPos;
@ -156,10 +158,10 @@ public:
int _minute;
float _addfix;
Common::Point _stdPal[91][17];
t_pcga _cgaPal[91];
int _c_zzz;
int ptr_word;
byte _v_lieu[7][25];
ScreenSurface _screenSurface;
@ -302,6 +304,11 @@ public:
void clearScreenType10();
int getRandomNumber(int minval, int maxval);
void showMoveMenuAlert();
void decodeNumber(byte *pStart, int count);
Common::String getString(int num);
void resetVariables();
void setPal(int n);
};

View File

@ -227,7 +227,7 @@ void MouseHandler::showMouse() {
* Set mouse position
* @remarks Originally called 'pos_mouse'
*/
void MouseHandler::setMousePos(Common::Point newPos) {
void MouseHandler::setMousePosition(Common::Point newPos) {
if (newPos.x > 314 * g_res)
newPos.x = 314 * g_res;
else if (newPos.x < 0)
@ -247,7 +247,7 @@ void MouseHandler::setMousePos(Common::Point newPos) {
* Get mouse poisition
* @remarks Originally called 'read_pos_mouse'
*/
void MouseHandler::getMousePos_(int &x, int &y, int &c) {
void MouseHandler::getMousePosition(int &x, int &y, int &c) {
x = g_vm->getMousePos().x;
y = g_vm->getMousePos().y;
c = g_vm->getMouseClick() ? 1 : 0;
@ -276,7 +276,7 @@ void MouseHandler::moveMouse(bool &funct, char &key) {
CHECK_QUIT;
in1 = g_vm->getChar();
getMousePos_(cx, cy, cd);
getMousePosition(cx, cy, cd);
switch (toupper(in1)) {
case '4':
cx -= 8;
@ -407,19 +407,19 @@ void MouseHandler::moveMouse(bool &funct, char &key) {
break;
}
setMousePos(Common::Point(cx, cy));
setMousePosition(Common::Point(cx, cy));
p_key = g_vm->keyPressed();
}
}
/**
* Engine function : Is mouse in a given rect?
* Mouse function : Is mouse in a given rect?
* @remarks Originally called 'dans_rect'
*/
bool MouseHandler::isMouseIn(rectangle r) {
bool MouseHandler::isMouseIn(Rect r) {
int x, y, c;
getMousePos_(x, y, c);
getMousePosition(x, y, c);
if ((x > r._x1) && (x < r._x2) && (y > r._y1) && (y < r._y2))
return true;

View File

@ -43,10 +43,10 @@ public:
void initMouse();
void hideMouse();
void showMouse();
void setMousePos(Common::Point newPos);
void getMousePos_(int &x, int &y, int &c);
void setMousePosition(Common::Point newPos);
void getMousePosition(int &x, int &y, int &c);
void moveMouse(bool &funct, char &key);
bool isMouseIn(rectangle r);
bool isMouseIn(Rect r);
};
} // End of namespace Mortevielle

View File

@ -36,126 +36,8 @@
namespace Mortevielle {
Common::String delig;
const byte tabdr[32] = {
32, 101, 115, 97, 114, 105, 110,
117, 116, 111, 108, 13, 100, 99,
112, 109, 46, 118, 130, 39, 102,
98, 44, 113, 104, 103, 33, 76,
85, 106, 30, 31
};
const byte tab30[32] = {
69, 67, 74, 138, 133, 120, 77, 122,
121, 68, 65, 63, 73, 80, 83, 82,
156, 45, 58, 79, 49, 86, 78, 84,
71, 81, 64, 66, 135, 34, 136, 91
};
const byte tab31[32]= {
93, 47, 48, 53, 50, 70, 124, 75,
72, 147, 140, 150, 151, 57, 56, 51,
107, 139, 55, 89, 131, 37, 54, 88,
119, 0, 0, 0, 0, 0, 0, 0
};
Common::String deline(int num);
typedef unsigned char uchar;
static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
/*
const uchar rap[32] = {
(uchar)',', (uchar)':', (uchar)'@', (uchar)'!', (uchar)'?', (uchar)'-', (uchar)'\207',
(uchar)'\240', (uchar)'\205', (uchar)'\203', (uchar)'\202', (uchar)'\212', (uchar)'\210', (uchar)'/',
(uchar)'\213', (uchar)'\214', (uchar)'\242', (uchar)'\047', (uchar)'\223', (uchar)'"', (uchar)'\227',
(uchar)'\226', (uchar)'0', (uchar)'1', (uchar)'2', (uchar)'3', (uchar)'4', (uchar)'5',
(uchar)'6', (uchar)'7', (uchar)'8', (uchar)'9'
};
*/
uint16 oct, ocd;
/* 5-8 */
oct = g_t_mot[idx];
oct = ((uint16)(oct << (16 - pt))) >> (16 - pt);
if (pt < 6) {
++idx;
oct = oct << (5 - pt);
pt += 11;
oct = oct | ((uint)g_t_mot[idx] >> pt);
} else {
pt -= 5;
oct = (uint)oct >> pt;
}
switch (oct) {
case 11:
c = '$';
the_end = true;
break;
case 30:
case 31:
ocd = g_t_mot[idx];
ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt);
if (pt < 6) {
++idx;
ocd = ocd << (5 - pt);
pt += 11;
ocd = ocd | ((uint)g_t_mot[idx] >> pt);
} else {
pt -= 5;
ocd = (uint)ocd >> pt;
}
if (oct == 30)
c = chr(tab30[ocd]);
else
c = chr(tab31[ocd]);
if (c == '\0') {
the_end = true;
c = '#';
}
break;
default:
c = chr(tabdr[oct]);
break;
}
} /* 5-8 */
/**
* Decode and extract the line with the given Id
*/
Common::String deline(int num) {
Common::String wrkStr = "";
if (num < 0) {
warning("deline: num < 0! Skipping");
} else if (!g_vm->_txxFileFl) {
wrkStr = g_vm->getGameString(num);
} else {
int i = g_t_rec[num]._hintId;
byte k = g_t_rec[num]._point;
int length = 0;
bool endFl = false;
char let;
do {
cinq_huit(let, i, k, endFl);
if (length < 254)
wrkStr += let;
++length;
} while (!endFl);
}
if (wrkStr.lastChar() == '$')
// Remove trailing '$'
wrkStr.deleteLastChar();
return wrkStr;
}
static int l_motsuiv(int p, const char *ch, int &tab) {
int c = p;
@ -429,7 +311,7 @@ void taffich() {
}
}
g_numpal = npal;
writepal(npal);
g_vm->setPal(npal);
if ((b < 15) || (b == 16) || (b == 17) || (b == 24) || (b == 26) || (b == 50)) {
lgt = 0;

View File

@ -35,7 +35,6 @@ namespace Mortevielle {
const int kAdrAni = 0x7314;
extern Common::String deline(int num);
extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ);
extern void chardes(Common::String filename, int32 passe, int long_);
extern void charani(Common::String filename, int32 skipSize, int length);

View File

@ -54,8 +54,8 @@ void charpal() {
error("Missing file - plxx.mor");
for (int i = 0; i <= 90; ++i) {
for (int j = 1; j <= 16; ++j) {
g_tabpal[i][j].x = f.readByte();
g_tabpal[i][j].y = f.readByte();
g_vm->_stdPal[i][j].x = f.readByte();
g_vm->_stdPal[i][j].y = f.readByte();
}
}
f.close();
@ -64,9 +64,9 @@ void charpal() {
error("Missing file - cxx.mor");
for (int j = 0; j <= 90; ++j) {
g_palcga[j]._p = f.readByte();
g_vm->_cgaPal[j]._p = f.readByte();
for (int i = 0; i <= 15; ++i) {
nhom &with = g_palcga[j]._a[i];
nhom &with = g_vm->_cgaPal[j]._a[i];
b = f.readByte();
with._id = (uint)b >> 4;
@ -75,13 +75,13 @@ void charpal() {
}
}
g_palcga[10]._a[9] = g_palcga[10]._a[5];
g_vm->_cgaPal[10]._a[9] = g_vm->_cgaPal[10]._a[5];
for (int j = 0; j <= 14; ++j) {
g_tpt[j]._tax = f.readByte();
g_tpt[j]._tay = f.readByte();
_patternArr[j]._tax = f.readByte();
_patternArr[j]._tay = f.readByte();
for (int i = 1; i <= 20; ++i)
for (int k = 1; k <= 20; ++k)
g_tpt[j]._des[i][k] = f.readByte();
_patternArr[j]._des[i][k] = f.readByte();
}
f.close();
}

View File

@ -109,7 +109,7 @@ void SavegameManager::loadSavegame(int n) {
g_s = g_s1;
for (int i = 0; i <= 389; ++i)
g_tabdon[i + acha] = g_bufcha[i];
g_tabdon[i + kAcha] = g_bufcha[i];
// Close the stream
delete stream;
@ -142,7 +142,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) {
g_vm->hourToChar();
for (i = 0; i <= 389; ++i)
g_bufcha[i] = g_tabdon[i + acha];
g_bufcha[i] = g_tabdon[i + kAcha];
g_s1 = g_s;
if (g_s1._currPlace == 26)
g_s1._currPlace = 15;

View File

@ -564,7 +564,7 @@ void SpeechManager::startSpeech(int rep, int ht, int typ) {
g_t_cph[i] = savph[i];
g_mlec = _typlec;
}
writepal(g_numpal);
g_vm->setPal(g_numpal);
}
} // End of namespace Mortevielle

View File

@ -117,9 +117,8 @@ int g_tay_tchar;
Hint g_t_rec[maxtd + 1];
int g_l[108];
int g_tbi[256];
Common::Point g_tabpal[91][17];
t_pcga g_palcga[91];
pattern g_tpt[15];
Pattern _patternArr[15];
byte g_adcfiec[(4088 * 16) + (311 * 0x80)];

View File

@ -140,17 +140,16 @@ struct SpeechQueue {
int _rep;
};
struct rectangle {
struct Rect {
int _x1, _x2, _y1, _y2;
bool _enabled;
};
struct pattern {
struct Pattern {
byte _tay, _tax;
byte _des[kMaxPatt + 1][kMaxPatt + 1];
};
struct nhom {
byte _id; /* number between 0 and 32 */
byte _hom[4];
@ -227,9 +226,7 @@ extern int g_tay_tchar;
extern Hint g_t_rec[maxtd + 1];
extern int g_l[108];
extern int g_tbi[256];
extern Common::Point g_tabpal[91][17];
extern t_pcga g_palcga[91];
extern pattern g_tpt[15];
extern Pattern _patternArr[15];
extern byte g_adcfiec[822 * 128];