MORTEVIELLE: Rename some variables and functions related to 'Search' action

This commit is contained in:
Strangerke 2012-03-04 10:17:27 +01:00
parent 47a00c8257
commit e92369be21
12 changed files with 106 additions and 104 deletions

View File

@ -207,7 +207,7 @@ void fctTake() {
g_s._ivier = 0;
if (g_s._mlieu == 24)
g_s._ipuit = 0;
mfouen();
unsetSearchMenu();
g_obpart = false;
affrep();
} else {
@ -377,10 +377,10 @@ void fctRead() {
* @remarks Originally called 'tslire'
*/
void fctSelfRead() {
if (g_s._derobj == 0)
if (g_s._selectedObjectId == 0)
g_crep = 186;
else
st4(g_s._derobj);
st4(g_s._selectedObjectId);
}
/**
@ -466,8 +466,8 @@ void fctLook() {
* @remarks Originally called 'tsregarder'
*/
void fctSelftLook() {
if (g_s._derobj != 0)
treg(g_s._derobj);
if (g_s._selectedObjectId != 0)
treg(g_s._selectedObjectId);
else
g_crep = 186;
}
@ -515,8 +515,8 @@ void fctSearch() {
if (g_mchai != 0) {
g_cs = 0;
g_is = 0;
g_fouil = true;
mfoudi();
g_heroSearching = true;
setSearchMenu();
tsuiv();
} else
g_crep = 997;
@ -570,8 +570,8 @@ void fctSearch() {
* @remarks Originally called 'tsfouiller'
*/
void fctSelfSearch() {
if (g_s._derobj != 0)
st7(g_s._derobj);
if (g_s._selectedObjectId != 0)
st7(g_s._selectedObjectId);
else
g_crep = 186;
}
@ -643,7 +643,7 @@ void fctOpen() {
* @remarks Originally called 'tmettre'
*/
void fctPlace() {
if (g_s._derobj == 0) {
if (g_s._selectedObjectId == 0) {
g_crep = 186;
return;
}
@ -666,15 +666,15 @@ void fctPlace() {
if (g_s._iboul != 0) {
g_crep = 188;
} else {
g_s._iboul = g_s._derobj;
if (g_s._derobj == 141)
g_s._iboul = g_s._selectedObjectId;
if (g_s._selectedObjectId == 141)
aniof(1, 7);
}
} else if (g_s._ibag != 0) {
g_crep = 188;
} else {
g_s._ibag = g_s._derobj;
if (g_s._derobj == 159)
g_s._ibag = g_s._selectedObjectId;
if (g_s._selectedObjectId == 159)
aniof(1, 6);
}
}
@ -683,8 +683,8 @@ void fctPlace() {
if (g_s._icave != 0) {
g_crep = 188;
} else {
g_s._icave = g_s._derobj;
if (g_s._derobj == 151) {
g_s._icave = g_s._selectedObjectId;
if (g_s._selectedObjectId == 151) {
// Open hidden passage
aniof(1, 2);
aniof(1, 1);
@ -739,7 +739,7 @@ void fctPlace() {
if (g_caff == 16) {
if (g_s._icryp == 0)
g_s._icryp = g_s._derobj;
g_s._icryp = g_s._selectedObjectId;
else
g_crep = 188;
}
@ -747,7 +747,7 @@ void fctPlace() {
if (g_caff == 17) {
if (g_s._ivier != 0) {
g_crep = 188;
} else if (g_s._derobj == 143) {
} else if (g_s._selectedObjectId == 143) {
g_s._ivier = 143;
aniof(1, 1);
} else {
@ -759,8 +759,8 @@ void fctPlace() {
if (g_caff == 24) {
if (g_s._ipuit != 0) {
g_crep = 188;
} else if ((g_s._derobj == 140) || (g_s._derobj == 120)) {
g_s._ipuit = g_s._derobj;
} else if ((g_s._selectedObjectId == 140) || (g_s._selectedObjectId == 120)) {
g_s._ipuit = g_s._selectedObjectId;
aniof(1, 1);
} else {
g_crep = 185;
@ -836,7 +836,7 @@ void fctSelfHide() {
* @remarks Originally called 'tattacher'
*/
void fctAttach() {
if (g_s._derobj == 0)
if (g_s._selectedObjectId == 0)
g_crep = 186;
else {
if (!g_syn)
@ -847,8 +847,8 @@ void fctAttach() {
g_crep = 997;
if ((g_num != 0) && (g_s._mlieu == 24)) {
g_crep = 999;
if ((g_s._derobj == 120) || (g_s._derobj == 140)) {
g_s._ipuit = g_s._derobj;
if ((g_s._selectedObjectId == 120) || (g_s._selectedObjectId == 140)) {
g_s._ipuit = g_s._selectedObjectId;
aniof(1, 1);
} else
g_crep = 185;
@ -953,7 +953,7 @@ void fctKnock() {
void fctSelfPut() {
if (!g_syn)
ecr3(g_vm->getEngineString(S_POSE));
if (g_s._derobj == 0)
if (g_s._selectedObjectId == 0)
g_crep = 186;
else {
if (g_caff > 99) {
@ -993,7 +993,7 @@ void fctSelfPut() {
if (g_s._iloic != 0)
g_crep = 188;
else
g_s._iloic = g_s._derobj;
g_s._iloic = g_s._selectedObjectId;
}
if (g_caff == 13) {
@ -1001,11 +1001,11 @@ void fctSelfPut() {
if (g_s._iboul != 0)
g_crep = 188;
else
g_s._iboul = g_s._derobj;
g_s._iboul = g_s._selectedObjectId;
} else if (g_s._ibag != 0) {
g_crep = 188;
} else {
g_s._ibag = g_s._derobj;
g_s._ibag = g_s._selectedObjectId;
}
}
@ -1013,7 +1013,7 @@ void fctSelfPut() {
if (g_s._icryp != 0)
g_crep = 188;
else
g_s._icryp = g_s._derobj;
g_s._icryp = g_s._selectedObjectId;
}
if (g_caff == 24)
@ -1133,7 +1133,7 @@ void fctEnter() {
aldepl();
else if (g_ment == 0)
g_crep = 997;
else if ((g_ment == 9) && (g_s._derobj != 136)) {
else if ((g_ment == 9) && (g_s._selectedObjectId != 136)) {
g_crep = 189;
g_s._teauto[8] = '*';
} else {
@ -1344,7 +1344,7 @@ void fctDiscuss() {
Common::String lib[47];
bool f;
finfouil();
endSearch();
if (g_col)
suj = 128;
else {

View File

@ -311,7 +311,7 @@ bool KnowledgeCheck::show() {
dialogHeight = 23;
g_vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight));
Common::String tmpStr = deline(textIndexArr[indx]);
afftex(tmpStr, 20, 15, 100, 2, 0);
displayStr(tmpStr, 20, 15, 100, 2, 0);
if (indx != 9) {
firstOption = textIndexArr[indx] + 1;
@ -328,7 +328,7 @@ bool KnowledgeCheck::show() {
tmpStr = deline(j);
if ((int) tmpStr.size() > maxLength)
maxLength = tmpStr.size();
afftex(tmpStr, 100, optionPosY, 100, 1, 0);
displayStr(tmpStr, 100, optionPosY, 100, 1, 0);
choiceArray[prevChoice] = tmpStr;
optionPosY += 8;
}
@ -366,16 +366,16 @@ bool KnowledgeCheck::show() {
if (coor[currChoice]._enabled) {
if ((prevChoice != 0) && (prevChoice != currChoice)) {
tmpStr = choiceArray[prevChoice] + '$';
afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
}
if (prevChoice != currChoice) {
tmpStr = choiceArray[currChoice] + '$';
afftex(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1);
displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1);
prevChoice = currChoice;
}
} else if (prevChoice != 0) {
tmpStr = choiceArray[prevChoice] + '$';
afftex(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0);
prevChoice = 0;
}
} while (!((prevChoice != 0) && g_vm->getMouseClick()));

View File

@ -140,7 +140,7 @@ void text1(int x, int y, int nb, int m) {
Common::String tmpStr = deline(m);
if ((y == 182) && ((int) tmpStr.size() * co > nb * 6))
y = 176;
afftex(tmpStr, x, y, nb, 20, g_color_txt);
displayStr(tmpStr, x, y, nb, 20, g_color_txt);
}
void initouv() {
@ -325,7 +325,7 @@ void repon(int f, int m) {
g_f2_all = false;
clsf2();
afftex(tmpStr, 8, 176, 85, 3, 5);
displayStr(tmpStr, 8, 176, 85, 3, 5);
} else {
modif(m);
if (f == 8)
@ -354,7 +354,7 @@ void repon(int f, int m) {
i = 5;
tmpStr = deline(m);
afftex(tmpStr, 80, 40, 60, 25, i);
displayStr(tmpStr, 80, 40, 60, 25, i);
if (m == 180)
g_s._pourc[6] = '*';
@ -366,21 +366,21 @@ void repon(int f, int m) {
ecrf7();
tmpStr = deline(m);
int xco, dx, caspe;
int xSmallStr, xLargeStr, dx;
if (g_res == 1) {
xco = 252 - tmpStr.size() * 5;
caspe = 100;
xSmallStr = 252 - tmpStr.size() * 5;
xLargeStr = 100;
dx = 80;
} else {
xco = 252 - tmpStr.size() * 3;
caspe = 144;
xSmallStr = 252 - tmpStr.size() * 3;
xLargeStr = 144;
dx = 50;
}
if (tmpStr.size() < 40)
afftex(tmpStr, xco, 86, dx, 3, 5);
displayStr(tmpStr, xSmallStr, 86, dx, 3, 5);
else
afftex(tmpStr, caspe, 86, dx, 3, 5);
displayStr(tmpStr, xLargeStr, 86, dx, 3, 5);
}
}
}
@ -1016,7 +1016,7 @@ void inzon() {
copcha();
g_s._ipre = false;
g_s._derobj = 0;
g_s._selectedObjectId = 0;
g_s._icave = 0;
g_s._iboul = 0;
g_s._ibag = 0;

View File

@ -274,7 +274,11 @@ void affrep() {
g_crep = g_s._mlieu;
}
void mfouen() {
/**
* Engine function - Switch action menu from "Search" mode back to normal mode
* @remarks Originally called 'mfouen'
*/
void unsetSearchMenu() {
tmlieu(g_s._mlieu);
for (int cx = 1; cx <= 11; ++cx)
g_vm->_menu.enableMenuItem(_actionMenu[cx]);
@ -290,7 +294,7 @@ void tperd() {
g_ment = 0;
g_iouv = 0;
g_mchai = 0;
mfouen();
unsetSearchMenu();
if (!g_blo) {
int cx;
t11(21, cx);
@ -361,7 +365,7 @@ void cherjer(int ob, bool &d) {
for (cx = 1; cx <= 6; ++cx)
d = (d || (ord(g_s._sjer[cx]) == ob));
if (g_s._derobj == ob)
if (g_s._selectedObjectId == ob)
d = true;
}
@ -397,7 +401,7 @@ void sparl(float adr, float rep) {
repint = abs((int)rep);
hideMouse();
Common::String tmpStr = deline(repint + kDialogStringIndex);
afftex(tmpStr, 230, 4, 65, 24, 5);
displayStr(tmpStr, 230, 4, 65, 24, 5);
f3f8::draw();
key = 0;
@ -410,15 +414,23 @@ void sparl(float adr, float rep) {
showMouse();
}
void finfouil() {
g_fouil = false;
/**
* Engine function - End of Search: reset globals
* @remarks Originally called 'finfouill'
*/
void endSearch() {
g_heroSearching = false;
g_obpart = false;
g_cs = 0;
g_is = 0;
mfouen();
unsetSearchMenu();
}
void mfoudi() {
/**
* Engine function - Switch action menu to "Search" mode
* @remarks Originally called 'mfoudi'
*/
void setSearchMenu() {
for (int cx = 1; cx <= 7; ++cx)
g_vm->_menu.disableMenuItem(g_vm->_menu._moveMenu[cx]);
@ -447,7 +459,7 @@ void ajchai() {
} while ((cx <= 9) && (g_tabdon[cy + cx] != 0));
if (g_tabdon[cy + cx] == 0)
g_tabdon[cy + cx] = g_s._derobj;
g_tabdon[cy + cx] = g_s._selectedObjectId;
else
g_crep = 192;
}
@ -549,7 +561,7 @@ void quelquun() {
if (g_imen)
g_vm->_menu.eraseMenu();
finfouil();
endSearch();
g_crep = 997;
L1:
if (!g_cache) {
@ -618,7 +630,7 @@ void tsuiv() {
g_s._conf += 2;
} else {
affrep();
finfouil();
endSearch();
if (cx > 9)
g_crep = 131;
}
@ -750,18 +762,18 @@ void treg(int ob) {
} else {
g_obpart = true;
g_crep = g_caff + 400;
mfoudi();
setSearchMenu();
}
}
void avpoing(int &ob) {
g_crep = 999;
if (g_s._derobj != 0)
ajjer(g_s._derobj);
if (g_s._selectedObjectId != 0)
ajjer(g_s._selectedObjectId);
if (g_crep != 139) {
modobj(ob + 400);
g_s._derobj = ob;
g_s._selectedObjectId = ob;
ob = 0;
}
}
@ -786,7 +798,7 @@ void t23coul(int &l) {
}
void maivid() {
g_s._derobj = 0;
g_s._selectedObjectId = 0;
modobj(500);
}

View File

@ -47,7 +47,7 @@ extern void tmlieu(int roomId);
/* NIVEAU 7 */
extern void tlu(int af, int ob);
extern void affrep();
extern void mfouen();
extern void unsetSearchMenu();
/* NIVEAU 6 */
extern void tperd();
extern void tsort();
@ -56,8 +56,8 @@ extern void cherjer(int ob, bool &d);
extern void st1sama();
extern void modinv();
extern void sparl(float adr, float rep);
extern void finfouil();
extern void mfoudi();
extern void endSearch();
extern void setSearchMenu();
extern void mennor();
extern void premtet();
/* NIVEAU 5 */

View File

@ -613,14 +613,14 @@ void MortevielleEngine::handleAction() {
if ((g_msg[3] == MENU_ACTION) || (g_msg[3] == MENU_SELF))
g_mnumo = g_msg[4];
if (!g_anyone) {
if ((g_fouil) || (g_obpart)) {
if ((g_heroSearching) || (g_obpart)) {
if (y_s < 12)
return;
if ((g_msg[4] == OPCODE_SOUND) || (g_msg[4] == OPCODE_LIFT)) {
oo = true;
if ((g_msg[4] == OPCODE_LIFT) || (g_obpart)) {
finfouil();
endSearch();
g_caff = g_s._mlieu;
g_crep = 998;
} else

View File

@ -163,16 +163,18 @@ static int l_motsuiv(int p, const char *ch, int &tab) {
return tab * (p - c);
}
void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) {
bool the_end;
/**
* Engine function - Display Text
* @remarks Originally called 'afftex'
*/
void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ) {
int tab;
Common::String s;
int i, j;
// Safeguard: add $ just in case
ch += '$';
inputStr += '$';
/* debug(' .. Afftex');*/
g_vm->_screenSurface.putxy(x, y);
if (g_res == 1)
tab = 10;
@ -184,12 +186,11 @@ void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) {
int yc = y;
int xf = x + dx;
int yf = y + dy;
// int p = 1;
int p = 0;
the_end = (ch[p] == '$');
bool stringParsed = (inputStr[p] == '$');
s = "";
while (!the_end) {
switch (ch[p]) {
while (!stringParsed) {
switch (inputStr[p]) {
case '@':
g_vm->_screenSurface.writeg(s, typ);
s = "";
@ -202,15 +203,14 @@ void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) {
s += ' ';
xc += tab;
++p;
if (l_motsuiv(p, ch.c_str(), tab) + xc > xf) {
if (l_motsuiv(p, inputStr.c_str(), tab) + xc > xf) {
g_vm->_screenSurface.writeg(s, typ);
s = "";
xc = x;
yc += 6;
if (yc > yf) {
do {
while (!keypressed())
;
} while (!keypressed());
i = y;
do {
j = x;
@ -227,15 +227,15 @@ void afftex(Common::String ch, int x, int y, int dx, int dy, int typ) {
}
break;
case '$':
the_end = true;
stringParsed = true;
g_vm->_screenSurface.writeg(s, typ);
break;
default:
s += ch[p];
s += inputStr[p];
++p;
xc += tab;
break;
} /* case */
}
}
}

View File

@ -33,7 +33,7 @@
namespace Mortevielle {
extern Common::String deline(int num);
extern void afftex(Common::String ch, int x, int y, int dx, int dy, int typ);
extern void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ);
} // End of namespace Mortevielle
#endif

View File

@ -70,7 +70,6 @@ void changeGraphicalDevice(int newDevice) {
*/
void MortevielleEngine::gameLoaded() {
int k;
bool test[3];
char g[8];
hideMouse();
@ -79,11 +78,8 @@ void MortevielleEngine::gameLoaded() {
_loseGame = true;
g_anyone = false;
g_okdes = true;
test[0] = false;
test[1] = false;
g[0] = '\040';
g_col = false;
test[2] = false;
g[7] = g[0];
g[2] = 'A';
g_cache = false;
@ -103,7 +99,7 @@ void MortevielleEngine::gameLoaded() {
k = 0;
g_ment = 0;
g_syn = true;
g_fouil = true;
g_heroSearching = true;
g_mchai = 0;
g_inei = 0;
initouv();
@ -113,18 +109,12 @@ void MortevielleEngine::gameLoaded() {
g_dobj = 0;
affrep();
g_hintPctMessage = deline(580);
while ((test[k] == false) && (k < 2)) {
++k;
// Original read in the boot sector here of each drive and did some calculations -
// presumably for copy protection. This has been replaced with hardcoded success
test[k] = true;
g_okdes = false;
_endGame = true;
_loseGame = false;
g_heroSearching = false;
g_okdes = false;
_endGame = true;
_loseGame = false;
g_fouil = false;
}
person();
tinke();
drawClock();
@ -134,8 +124,8 @@ void MortevielleEngine::gameLoaded() {
_endGame = false;
tmlieu(g_s._mlieu);
modinv();
if (g_s._derobj != 0)
modobj(g_s._derobj + 400);
if (g_s._selectedObjectId != 0)
modobj(g_s._selectedObjectId + 400);
showMouse();
}
@ -240,7 +230,7 @@ void tsitu() {
((h > 0) && (h < 6) && (g_s._mlieu != 0)))
++g_s._conf;
if (((g_s._mlieu < 16) || (g_s._mlieu > 19)) && (g_s._mlieu != 23)
&& (g_s._mlieu != 0) && (g_s._derobj != 152) && (!g_vm->_loseGame)) {
&& (g_s._mlieu != 0) && (g_s._selectedObjectId != 152) && (!g_vm->_loseGame)) {
if ((g_s._conf > 99) && (h > 8) && (h < 16)) {
g_crep = 1501;
tperd();

View File

@ -59,7 +59,7 @@ void SavegameManager::sync_save(Common::Serializer &sz) {
sz.syncAsSint16LE(g_s1._icave);
sz.syncAsSint16LE(g_s1._ivier);
sz.syncAsSint16LE(g_s1._ipuit);
sz.syncAsSint16LE(g_s1._derobj);
sz.syncAsSint16LE(g_s1._selectedObjectId);
sz.syncAsSint16LE(g_s1._iloic);
sz.syncAsSint16LE(g_s1._icryp);
sz.syncAsByte(g_s1._ipre);

View File

@ -101,7 +101,7 @@ bool g_blo,
g_iesc,
g_col,
g_syn,
g_fouil,
g_heroSearching,
g_zuul,
g_obpart,
g_okdes,

View File

@ -158,7 +158,7 @@ struct sav_chaine {
byte _teauto[43];
byte _sjer[31];
int _mlieu, _iboul, _ibag, _icave, _ivier, _ipuit;
int _derobj, _iloic, _icryp;
int _selectedObjectId, _iloic, _icryp;
bool _ipre;
byte _heure;
};
@ -238,7 +238,7 @@ extern bool g_blo,
g_iesc,
g_col,
g_syn,
g_fouil,
g_heroSearching,
g_zuul,
g_obpart,
g_okdes,