aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-10-13 12:41:27 +0200
committerStrangerke2012-10-13 12:41:27 +0200
commitd7a9cfb80fd574643130f8ea43ff2f206627614c (patch)
tree4c0a3bac23cc2ba52204e6d39f1d17c33163a086
parentc33462da12e9704ad196edf29ee48d0c90d0f0d7 (diff)
downloadscummvm-rg350-d7a9cfb80fd574643130f8ea43ff2f206627614c.tar.gz
scummvm-rg350-d7a9cfb80fd574643130f8ea43ff2f206627614c.tar.bz2
scummvm-rg350-d7a9cfb80fd574643130f8ea43ff2f206627614c.zip
MORTEVIELLE: rework _openObjects use, rename resetOpenObjects
-rw-r--r--engines/mortevielle/actions.cpp20
-rw-r--r--engines/mortevielle/mortevielle.cpp24
-rw-r--r--engines/mortevielle/mortevielle.h4
3 files changed, 25 insertions, 23 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 1bf64cca0f..2f4af8538d 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -502,8 +502,8 @@ void MortevielleEngine::fctSearch() {
int cx = 0;
do {
++cx;
- } while ((cx <= 6) && (_num != ord(_openObjects[cx])));
- if (_num != ord(_openObjects[cx]))
+ } while ((cx <= 6) && (_num != _openObjects[cx]));
+ if (_num != _openObjects[cx])
_crep = 187;
else {
if (_currBitIndex > 0)
@@ -607,8 +607,8 @@ void MortevielleEngine::fctOpen() {
int tmpPlace = 0;
do {
++tmpPlace;
- } while (!((tmpPlace > 6) || (ord(_openObjects[tmpPlace]) == 0) || (ord(_openObjects[tmpPlace]) == _num)));
- if (ord(_openObjects[tmpPlace]) != _num) {
+ } while (!((tmpPlace > 6) || (_openObjects[tmpPlace] == 0) || (_openObjects[tmpPlace] == _num)));
+ if (_openObjects[tmpPlace] != _num) {
if (!( ((_num == 3) && ((_coreVar._currPlace == OWN_ROOM)
|| (_coreVar._currPlace == ROOM9)
|| (_coreVar._currPlace == BLUE_ROOM)
@@ -631,7 +631,7 @@ void MortevielleEngine::fctOpen() {
if (getRandomNumber(1, 4) == 3)
_speechManager.startSpeech(7, 9, 1);
}
- _openObjects[tmpPlace] = chr(_num);
+ _openObjects[tmpPlace] = _num;
aniof(1, _num);
}
tmpPlace = _coreVar._currPlace;
@@ -885,11 +885,11 @@ void MortevielleEngine::fctClose() {
int cx = 0;
do {
++cx;
- } while ((cx <= 6) && (_num != ord(_openObjects[cx])));
- if (_num == ord(_openObjects[cx])) {
+ } while ((cx <= 6) && (_num != _openObjects[cx]));
+ if (_num == _openObjects[cx]) {
aniof(2, _num);
_crep = 998;
- _openObjects[cx] = chr(0);
+ _openObjects[cx] = 0;
--_openObjCount;
if (_openObjCount < 0)
_openObjCount = 0;
@@ -984,8 +984,8 @@ void MortevielleEngine::fctSelfPut() {
int cx = 0;
do {
++cx;
- } while ((cx <= 6) && (_num != ord(_openObjects[cx])));
- if (_num != ord(_openObjects[cx]))
+ } while ((cx <= 6) && (_num != _openObjects[cx]));
+ if (_num != _openObjects[cx])
_crep = 187;
else {
_mchai = chai;
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index 68889b4796..088c8809cd 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -1677,9 +1677,8 @@ void MortevielleEngine::startMusicOrSpeech(int so) {
* @remarks Originally called 'tperd'
*/
void MortevielleEngine::loseGame() {
- initouv();
+ resetOpenObjects();
_roomDoorId = OWN_ROOM;
- _openObjCount = 0;
_mchai = 0;
_menu.unsetSearchMenu();
if (!_blo)
@@ -1894,8 +1893,7 @@ void MortevielleEngine::gameLoaded() {
_heroSearching = true;
_mchai = 0;
_manorDistance = 0;
- initouv();
- _openObjCount = 0;
+ resetOpenObjects();
_takeObjCount = 0;
affrep();
_hintPctMessage = getString(580);
@@ -3048,9 +3046,14 @@ void MortevielleEngine::mapMessageId(int &mesgId) {
mesgId -= 3976;
}
-void MortevielleEngine::initouv() {
+/**
+ * Initialize open objects array
+ * @remarks Originally called 'initouv'
+ */
+void MortevielleEngine::resetOpenObjects() {
for (int cx = 1; cx <= 7; ++cx)
- _openObjects[cx] = chr(0);
+ _openObjects[cx] = 0;
+ _openObjCount = 0;
}
void MortevielleEngine::ecr2(Common::String text) {
@@ -3323,8 +3326,8 @@ void MortevielleEngine::drawPicture() {
prepareScreenType1();
if ((_caff < 30) || (_caff > 32)) {
for (int cx = 1; cx <= 6; ++cx) {
- if (ord(_openObjects[cx]) != 0)
- aniof(1, ord(_openObjects[cx]));
+ if (_openObjects[cx] != 0)
+ aniof(1, _openObjects[cx]);
}
if (_caff == 13) {
@@ -3414,10 +3417,9 @@ void MortevielleEngine::exitRoom() {
_coreVar._faithScore += (_coreVar._faithScore / 10);
}
- for (int cx = 1; cx <= 7; ++cx)
- _openObjects[cx] = chr(0);
+ resetOpenObjects();
+
_roomDoorId = OWN_ROOM;
- _openObjCount = 0;
_mchai = 0;
resetRoomVariables(_coreVar._currPlace);
}
diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h
index a57a304ad1..7e0f717142 100644
--- a/engines/mortevielle/mortevielle.h
+++ b/engines/mortevielle/mortevielle.h
@@ -278,7 +278,7 @@ private:
Common::String _hintPctMessage;
byte *_cfiecBuffer;
int _cfiecBufferSize;
- byte _openObjects[8];
+ int _openObjects[8];
int _nbrep[9];
int _nbrepm[9];
uint16 _inpBuffer[kMaxTi + 1];
@@ -425,7 +425,7 @@ private:
void adzon();
void displayTextInDescriptionBar(int x, int y, int nb, int mesgId);
void mapMessageId(int &mesgId);
- void initouv();
+ void resetOpenObjects();
void phaz(int &rand, int &p, int cf);
void writetp(Common::String s, int t);
void premtet();