MORTEVIELLE: Some more renaming

This commit is contained in:
Strangerke
2012-04-06 08:23:28 +02:00
parent 6e7118a8ef
commit fc14ffbcb5
14 changed files with 121 additions and 122 deletions
+5 -5
View File
@@ -45,7 +45,7 @@ void MortevielleEngine::fctMove() {
if ((g_s._currPlace == ROOM26) && (g_msg[4] == _menu._moveMenu[6])) {
g_s._currPlace = LANDING;
g_caff = g_s._currPlace;
afdes(0);
afdes();
repon(2, g_s._currPlace);
}
if ((g_s._currPlace == LANDING) && (g_msg[4] == _menu._moveMenu[6])) {
@@ -1156,7 +1156,7 @@ void MortevielleEngine::fctEnter() {
if (g_ment == 9) {
_col = true;
g_caff = 70;
afdes(0);
afdes();
repon(2, g_caff);
} else
_col = false;
@@ -1194,7 +1194,7 @@ void MortevielleEngine::fctSleep() {
tsort();
g_s._currPlace = OWN_ROOM;
affrep();
afdes(0);
afdes();
debloc(g_s._currPlace);
_menu.setDestinationMenuText(g_s._currPlace);
}
@@ -1351,7 +1351,7 @@ void MortevielleEngine::fctDiscuss() {
++cx;
} while (_menu._discussMenu[cx] != g_msg[4]);
g_caff = 69 + cx;
afdes(0);
afdes();
repon(2, g_caff);
suj = g_caff + 60;
}
@@ -1586,7 +1586,7 @@ void MortevielleEngine::endGame() {
repon(2, 142);
tkey1(false);
g_caff = 32;
afdes(0);
afdes();
repon(6, 34);
repon(2, 35);
startMusicOrSpeech(0);
+2 -2
View File
@@ -56,8 +56,8 @@ int Alert::show(const Common::String &msg, int n) {
memset(&limit[0][0], 0, sizeof(int) * 3 * 3);
int do_alert_result;
hideMouse();
while (keypressed())
dumi = get_ch(); // input >> kbd >> dumi;
while (g_vm->keyPressed())
dumi = g_vm->getChar();
g_vm->setMouseClick(false);
decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas);
+5 -5
View File
@@ -33,13 +33,13 @@
namespace Mortevielle {
char readkey1() {
char c = get_ch();
char c = g_vm->getChar();
return c;
}
int testou() {
char ch = get_ch();
char ch = g_vm->getChar();
switch (ch) {
case '\23' :
@@ -54,8 +54,8 @@ int testou() {
}
break;
case '\33' :
if (keypressed())
ch = get_ch();
if (g_vm->keyPressed())
ch = g_vm->getChar();
break;
default:
break;
@@ -65,7 +65,7 @@ int testou() {
}
void teskbd() {
if (keypressed())
if (g_vm->keyPressed())
testou();
}
+68 -57
View File
@@ -420,17 +420,17 @@ void paint_rect(int x, int y, int dx, int dy) {
* Engine function - Update hour
* @remarks Originally called 'calch'
*/
void updateHour(int &day, int &hour, int &minute) {
void MortevielleEngine::updateHour(int &day, int &hour, int &minute) {
int newHour = readclock();
int th = g_jh + ((newHour - g_mh) / g_t);
minute = ((th % 2) + g_vm->_currHalfHour) * 30;
hour = ((uint)th >> 1) + g_vm->_currHour;
minute = ((th % 2) + _currHalfHour) * 30;
hour = ((uint)th >> 1) + _currHour;
if (minute == 60) {
minute = 0;
++hour;
}
day = (hour / 24) + g_vm->_currDay;
hour = hour - ((day - g_vm->_currDay) * 24);
day = (hour / 24) + _currDay;
hour = hour - ((day - _currDay) * 24);
}
/**
@@ -465,7 +465,9 @@ void repon(int f, int m) {
displayStr(tmpStr, 8, 176, 85, 3, 5);
} else {
modif(m);
if ((f == 2) || (f == 8)) {
switch (f) {
case 2:
case 8:
clearScreenType2();
g_vm->prepareScreenType2();
text1(8, 182, 103, m);
@@ -478,7 +480,10 @@ void repon(int f, int m) {
g_s._teauto[38] = '*';
}
}
} else if ((f == 1) || (f == 6) || (f == 9)) {
break;
case 1:
case 6:
case 9: {
int i;
if ((f == 1) || (f == 6))
i = 4;
@@ -490,9 +495,12 @@ void repon(int f, int m) {
if (m == 180)
g_s._pourc[6] = '*';
if (m == 179)
else if (m == 179)
g_s._pourc[10] = '*';
}
break;
default:
break;
}
}
}
@@ -1132,7 +1140,7 @@ int MortevielleEngine::setPresenceChapel(int hour) {
* Engine function - Get the answer after you known a door
* @remarks Originally called 'frap'
*/
void getKnockAnswer() {
void MortevielleEngine::getKnockAnswer() {
int day, hour, minute;
updateHour(day, hour, minute);
@@ -1711,7 +1719,7 @@ void tinke() {
Common::String stpo;
g_vm->_anyone = false;
updateHour(day, hour, minute);
g_vm->updateHour(day, hour, minute);
if (day != g_vm->_day) {
g_vm->_day = day;
int i = 0;
@@ -1737,18 +1745,18 @@ void tinke() {
else
stpo = chr(cf + 48);
g_hintPctMessage = Common::String(d3);
g_hintPctMessage += d5;
g_hintPctMessage += d4;
g_hintPctMessage += d3;
g_hintPctMessage += d1;
g_hintPctMessage += stpo;
g_hintPctMessage += '0';
g_hintPctMessage += d2;
g_hintPctMessage += d4;
g_hintPctMessage += d3;
g_hintPctMessage += d6;
g_hintPctMessage += d4;
g_vm->_hintPctMessage = Common::String(d3);
g_vm->_hintPctMessage += d5;
g_vm->_hintPctMessage += d4;
g_vm->_hintPctMessage += d3;
g_vm->_hintPctMessage += d1;
g_vm->_hintPctMessage += stpo;
g_vm->_hintPctMessage += '0';
g_vm->_hintPctMessage += d2;
g_vm->_hintPctMessage += d4;
g_vm->_hintPctMessage += d3;
g_vm->_hintPctMessage += d6;
g_vm->_hintPctMessage += d4;
}
if (minute > g_vm->_minute) {
g_vm->_minute = 30;
@@ -1869,9 +1877,9 @@ void fenat(char ans) {
/* NIVEAU 8 */
void afdes(int ad) {
void afdes() {
taffich();
dessin(ad);
dessin(0);
g_vm->_okdes = false;
}
@@ -1883,18 +1891,18 @@ void tkey1(bool d) {
fenat('K');
// Wait for release from any key or mouse button
while (keypressed())
while (g_vm->keyPressed())
g_key = testou();
do {
getMousePos_(x, y, c);
keypressed();
g_vm->keyPressed();
} while (c != 0);
// Event loop
do {
if (d)
tinke();
quest = keypressed();
quest = g_vm->keyPressed();
getMousePos_(x, y, c);
CHECK_QUIT;
} while (!(quest || (c != 0) || (d && g_vm->_anyone)));
@@ -1907,7 +1915,7 @@ void tkey1(bool d) {
/* NIVEAU 7 */
void tlu(int af, int ob) {
g_caff = 32;
afdes(0);
afdes();
repon(6, ob + 4000);
repon(2, 999);
tkey1(true);
@@ -2125,7 +2133,7 @@ void MortevielleEngine::gotoDiningRoom() {
_currBitIndex = 255; // Everybody is present
showPeoplePresent(_currBitIndex);
g_caff = 77;
afdes(0);
afdes();
_screenSurface.drawBox(223, 47, 155, 91, 15);
repon(2, 33);
tkey1(false);
@@ -2298,7 +2306,7 @@ void tfleche() {
} while (!(qust || inRect || g_vm->_anyone));
if (qust && (touch == '\103'))
Alert::show(g_hintPctMessage, 1);
Alert::show(g_vm->_hintPctMessage, 1);
} while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (g_y != 0)) || (g_vm->_anyone) || (inRect)));
if (touch == '\73')
@@ -2390,7 +2398,7 @@ void treg(int ob) {
g_caff = ob;
if (((g_caff > 29) && (g_caff < 33)) || (g_caff == 144) || (g_caff == 147) || (g_caff == 149) || (g_msg[4] == OPCODE_SLOOK)) {
afdes(0);
afdes();
if ((g_caff > 29) && (g_caff < 33))
repon(2, g_caff);
else
@@ -2459,25 +2467,25 @@ void aldepl() {
* Engine function - Change Graphical Device
* @remarks Originally called 'change_gd'
*/
void changeGraphicalDevice(int newDevice) {
void MortevielleEngine::changeGraphicalDevice(int newDevice) {
hideMouse();
g_vm->_currGraphicalDevice = newDevice;
_currGraphicalDevice = newDevice;
hirs();
initMouse();
showMouse();
drawRightFrame();
tinke();
drawClock();
if (g_vm->_currBitIndex != 0)
g_vm->showPeoplePresent(g_vm->_currBitIndex);
if (_currBitIndex != 0)
showPeoplePresent(_currBitIndex);
else
g_vm->displayAloneText();
displayAloneText();
clearScreenType2();
clearScreenType3();
g_maff = 68;
afdes(0);
afdes();
repon(2, g_crep);
g_vm->_menu.displayMenu();
_menu.displayMenu();
}
/**
@@ -2512,7 +2520,7 @@ void MortevielleEngine::gameLoaded() {
g_iouv = 0;
g_dobj = 0;
affrep();
g_hintPctMessage = deline(580);
_hintPctMessage = deline(580);
_okdes = false;
_endGame = true;
@@ -2522,7 +2530,7 @@ void MortevielleEngine::gameLoaded() {
displayAloneText();
tinke();
drawClock();
afdes(0);
afdes();
repon(2, g_crep);
clearScreenType3();
_endGame = false;
@@ -2533,20 +2541,6 @@ void MortevielleEngine::gameLoaded() {
showMouse();
}
/* NIVEAU 3 */
/* procedure PROGRAMME */
void tmaj3() {
int day, hour, minute;
updateHour(day, hour, minute);
if (minute == 30)
minute = 1;
hour += day * 24;
minute += hour * 2;
g_s._fullHour = chr(minute);
}
/**
* Engine function - Handle OpCodes
* @remarks Originally called 'tsitu'
@@ -2655,9 +2649,26 @@ void MortevielleEngine::handleOpcode() {
mennor();
}
/* NIVEAU 1 */
/**
* Engine function - Transform time into a char
* @remarks Originally called 'tmaj3'
*/
void MortevielleEngine::hourToChar() {
int day, hour, minute;
void theure() {
g_vm->updateHour(day, hour, minute);
if (minute == 30)
minute = 1;
hour += day * 24;
minute += hour * 2;
g_s._fullHour = chr(minute);
}
/**
* Engine function - extract time from a char
* @remarks Originally called 'theure'
*/
void MortevielleEngine::charToHour() {
int fullHour = ord(g_s._fullHour);
int tmpHour = fullHour % 48;
g_vm->_currDay = fullHour / 48;
+1 -11
View File
@@ -68,7 +68,6 @@ extern void ecr2(Common::String str_);
extern void ecr3(Common::String text);
extern void stop();
extern void paint_rect(int x, int y, int dx, int dy);
extern void updateHour(int &day, int &hour, int &minute);
extern int convertCharacterIndexToBitIndex(int characterIndex);
/* NIVEAU 12 */
extern void modobj(int m);
@@ -79,7 +78,6 @@ extern void drawClock();
* NIVEAU 11 *
*************/
extern void debloc(int roomId);
extern void getKnockAnswer();
extern int convertBitIndexToCharacterIndex(int bitIndex);
extern void ecfren(int &p, int &rand, int cf, int roomId);
extern void becfren(int roomId);
@@ -97,7 +95,7 @@ extern void dessin(int ad);
extern void tinke();
extern void fenat(char ans);
/* NIVEAU 8 */
extern void afdes(int ad);
extern void afdes();
extern void tkey1(bool d);
/* NIVEAU 7 */
extern void tlu(int af, int ob);
@@ -128,13 +126,5 @@ extern void maivid();
extern void st13(int ob);
extern void aldepl();
extern void changeGraphicalDevice(int newDevice);
/* NIVEAU 3 */
/* procedure PROGRAMME */
extern void tmaj3();
/* NIVEAU 1 */
extern void theure();
} // End of namespace Mortevielle
#endif
+15 -6
View File
@@ -164,7 +164,7 @@ Common::ErrorCode MortevielleEngine::initialise() {
return result;
// Load some error messages (was previously in chartex())
g_hintPctMessage = deline(580); // You should have noticed %d hints
_hintPctMessage = deline(580); // You should have noticed %d hints
// Set default EGA palette
_paletteManager.setDefaultPalette();
@@ -287,6 +287,11 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataTyp
assert(dataSize == 0);
}
/**
* Check is a key was pressed
* It also delays the engine and check if the screen has to be updated
* @remarks Originally called 'keypressed'
*/
bool MortevielleEngine::keyPressed() {
// Check for any pending key presses
handleEvents();
@@ -305,10 +310,14 @@ bool MortevielleEngine::keyPressed() {
return !_keypresses.empty();
}
/**
* Wait for a keypress
* @remarks Originally called 'get_ch'
*/
int MortevielleEngine::getChar() {
// If there isn't any pending keypress, wait until there is
while (!shouldQuit() && _keypresses.empty()) {
keypressed();
keyPressed();
}
// Return the top keypress
@@ -496,7 +505,7 @@ Common::Error MortevielleEngine::run() {
// Either load the initial game state savegame, or the specified savegame number
adzon();
_savegameManager.takesav(loadSlot);
_savegameManager.loadSavegame(loadSlot);
// Run the main game loop
mainGame();
@@ -537,7 +546,7 @@ void MortevielleEngine::mainGame() {
loadBRUIT5();
_menu.initMenu();
theure();
charToHour();
initGame();
hirs();
drawRightFrame();
@@ -613,7 +622,7 @@ void MortevielleEngine::handleAction() {
if (_menu._menuSelected && (g_msg[3] == MENU_LOAD))
_savegameManager.loadGame((g_msg[4] & 7) - 1);
if (inkey == '\103') { /* F9 */
temps = Alert::show(g_hintPctMessage, 1);
temps = Alert::show(_hintPctMessage, 1);
return;
} else if (inkey == '\77') {
if ((g_mnumo != OPCODE_NONE) && ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))) {
@@ -629,7 +638,7 @@ void MortevielleEngine::handleAction() {
}
if (inkey == '\73') {
_quitGame = true;
tmaj3();
hourToChar();
} else {
if ((funct) && (inkey != '\77'))
return;
+8
View File
@@ -112,6 +112,8 @@ private:
void playGame();
void handleAction();
public:
Common::String _hintPctMessage;
bool _roomPresenceLuc;
bool _roomPresenceIda;
bool _purpleRoomPresenceLeo;
@@ -281,6 +283,12 @@ public:
void prepareScreenType1();
void prepareScreenType2();
void prepareScreenType3();
void updateHour(int &day, int &hour, int &minute);
void getKnockAnswer();
void charToHour();
void hourToChar();
void changeGraphicalDevice(int newDevice);
};
+5 -5
View File
@@ -296,7 +296,7 @@ void moveMouse(bool &funct, char &key) {
// Set defaults and check pending events
funct = false;
key = '\377';
p_key = keypressed();
p_key = g_vm->keyPressed();
// If mouse button clicked, return it
if (g_vm->getMouseClick())
@@ -306,7 +306,7 @@ void moveMouse(bool &funct, char &key) {
while (p_key) {
CHECK_QUIT;
in1 = get_ch();
in1 = g_vm->getChar();
getMousePos_(cx, cy, cd);
switch (toupper(in1)) {
case '4':
@@ -347,10 +347,10 @@ void moveMouse(bool &funct, char &key) {
return;
break;
case '\33':
p_key = keypressed();
p_key = g_vm->keyPressed();
if (p_key) {
in2 = get_ch();
in2 = g_vm->getChar();
if ((in2 >= ';') && (in2 <= 'D')) {
funct = true;
@@ -439,7 +439,7 @@ void moveMouse(bool &funct, char &key) {
}
setMousePos(cx, cy);
p_key = keypressed();
p_key = g_vm->keyPressed();
}
}
+1 -2
View File
@@ -211,7 +211,7 @@ void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ)
xc = x;
yc += 6;
if (yc > yf) {
while (!keypressed())
while (!g_vm->keyPressed())
;
i = y;
do {
@@ -303,7 +303,6 @@ void taffich() {
int32 lgt;
int alllum[16];
int a = g_caff;
if ((a >= 153) && (a <= 161))
a = tran2[a - 153];
+4 -4
View File
@@ -158,13 +158,13 @@ void music() {
bool fin = false;
int k = 0;
do {
fin = keypressed();
fin = g_vm->keyPressed();
g_vm->_soundManager.musyc(g_tbi, 9958, kTempoMusic);
++k;
fin = fin | keypressed() | (k >= 5);
fin = fin | g_vm->keyPressed() | (k >= 5);
} while (!fin);
while (keypressed())
get_ch(); // input >> kbd >> ch;
while (g_vm->keyPressed())
g_vm->getChar();
}
+6 -8
View File
@@ -72,11 +72,9 @@ void SavegameManager::sync_save(Common::Serializer &sz) {
/**
* Inner code for loading a saved game
* @remarks Originally called 'takesav'
*/
void SavegameManager::takesav(int n) {
int i;
Common::String st;
void SavegameManager::loadSavegame(int n) {
// -- Load the file
Common::String filename = generateSaveName(n);
@@ -110,7 +108,7 @@ void SavegameManager::takesav(int n) {
sync_save(sz);
g_s = g_s1;
for (i = 0; i <= 389; ++i)
for (int i = 0; i <= 389; ++i)
g_tabdon[i + acha] = g_bufcha[i];
// Close the stream
@@ -123,10 +121,10 @@ void SavegameManager::takesav(int n) {
Common::Error SavegameManager::loadGame(int n) {
hideMouse();
maivid();
takesav(n);
loadSavegame(n);
/* Initialization */
theure();
g_vm->charToHour();
g_vm->initGame();
g_vm->gameLoaded();
showMouse();
@@ -141,7 +139,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) {
int i;
hideMouse();
tmaj3();
g_vm->hourToChar();
for (i = 0; i <= 389; ++i)
g_bufcha[i] = g_tabdon[i + acha];
+1 -1
View File
@@ -51,7 +51,7 @@ class SavegameManager {
private:
void sync_save(Common::Serializer &sz);
public:
void takesav(int n);
void loadSavegame(int n);
Common::Error loadGame(int n);
Common::Error saveGame(int n, const Common::String &saveName);
-9
View File
@@ -115,8 +115,6 @@ int g_x,
int g_t_cph[6401];
byte g_tabdon[4001];
Common::String g_hintPctMessage; // Provides the % of hints
byte g_is;
int g_nbrep[9];
@@ -190,13 +188,6 @@ int getRandomNumber(int minval, int maxval) {
return g_vm->_randomSource.getRandomNumber(maxval - minval) + minval;
}
bool keypressed() {
return g_vm->keyPressed();
}
char get_ch() {
return g_vm->getChar();
}
/**
* Restore a screen sectio
*/
-7
View File
@@ -221,7 +221,6 @@ extern int g_x,
extern int g_t_cph[6401]; // Speech
extern byte g_tabdon[4001];
extern Common::String g_hintPctMessage; // gives the pct of hints found
extern byte g_is;
extern int g_nbrep[9];
@@ -264,17 +263,11 @@ extern byte g_mem[65536 * 16];
#define hires {}
// Stubs for input functions
extern bool keypressed();
extern char get_ch();
extern void palette(int v1);
extern void intr(int intNum, registres &regs);
extern int getRandomNumber(int minval, int maxval);
// (* external 'c:\mc\charecr.com'; *)
extern void s_char(int Gd, int y, int dy);
// (* external 'c:\mc\sauvecr.com'; *)
extern void s_sauv(int Gd, int y, int dy);
} // End of namespace Mortevielle