MORTEVIELLE: Get rid of mor.cpp

This commit is contained in:
Strangerke
2012-04-06 08:23:48 +02:00
parent a87b992e8d
commit 7b94de6408
12 changed files with 706 additions and 798 deletions
+57 -60
View File
@@ -28,7 +28,6 @@
#include "common/scummsys.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
@@ -59,17 +58,17 @@ void MortevielleEngine::fctMove() {
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(1);
setCoordinates(1);
if (_num == 0)
return;
if (_num == 1) {
_coreVar._currPlace = OWN_ROOM;
_menu.setDestinationMenuText(OWN_ROOM);
_menu.setDestinationText(OWN_ROOM);
} else if (_num == 7) {
_coreVar._currPlace = ATTIC;
_menu.setDestinationMenuText(ATTIC);
_menu.setDestinationText(ATTIC);
}
if (_num != 6)
@@ -86,7 +85,7 @@ void MortevielleEngine::fctMove() {
showMoveMenuAlert();
return;
}
tsort();
exitRoom();
int menuChoice = 1;
while (_menu._moveMenu[menuChoice] != _msg[4])
@@ -97,14 +96,14 @@ void MortevielleEngine::fctMove() {
gotoManorFront();
else if (menuChoice == 2)
checkManorDistance();
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
return;
} else if (_coreVar._currPlace == INSIDE_WELL) {
if (menuChoice == 1)
floodedInWell();
else if (menuChoice == 2)
gotoManorBack();
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
return;
} else if ((_coreVar._currPlace == BUREAU) && (menuChoice == 1))
menuChoice = 6;
@@ -174,7 +173,7 @@ void MortevielleEngine::fctMove() {
if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14))
affrep();
resetRoomVariables(_coreVar._currPlace);
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
}
/**
@@ -226,15 +225,15 @@ void MortevielleEngine::fctTake() {
if ((_anyone) || (_keyPressedEsc))
return;
if (_caff == 3) {
tcoord(2);
setCoordinates(2);
if (_num == 1) {
_crep = 152;
return;
}
}
tcoord(5);
setCoordinates(5);
if ((_num == 0) || ((_num == 1) && (_coreVar._currPlace == CRYPT))) {
tcoord(8);
setCoordinates(8);
if (_num != 0) {
if (_currBitIndex > 0)
_coreVar._faithScore += 3;
@@ -302,14 +301,12 @@ void MortevielleEngine::fctTake() {
* @remarks Originally called 'tsprendre'
*/
void MortevielleEngine::fctInventoryTake() {
int cx, cy, cz;
cx = 0;
int cx = 0;
do {
++cx;
} while (_menu._inventoryMenu[cx] != _msg[4]);
cz = 0;
cy = 0;
int cz = 0;
int cy = 0;
do {
++cy;
if (ord(_coreVar._sjer[cy]) != 0)
@@ -317,7 +314,7 @@ void MortevielleEngine::fctInventoryTake() {
} while (cz != cx);
cz = ord(_coreVar._sjer[cy]);
_coreVar._sjer[cy] = chr(0);
modinv();
_menu.setInventoryText();
avpoing(cz);
_crep = 998;
clearScreenType2();
@@ -333,9 +330,9 @@ void MortevielleEngine::fctLift() {
tfleche();
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(3);
setCoordinates(3);
if (_num == 0) {
tcoord(8);
setCoordinates(8);
if (_num != 0) {
if (_currBitIndex > 0)
++_coreVar._faithScore;
@@ -363,13 +360,13 @@ void MortevielleEngine::fctLift() {
*/
void MortevielleEngine::fctRead() {
if (_caff > 99)
st4(_caff);
getReadDescription(_caff);
else {
if (!_syn)
ecr3(getEngineString(S_READ));
tfleche();
if (!(_anyone) && !(_keyPressedEsc)) {
tcoord(4);
setCoordinates(4);
if (_num != 0)
_crep = 107;
}
@@ -384,7 +381,7 @@ void MortevielleEngine::fctSelfRead() {
if (_coreVar._selectedObjectId == 0)
_crep = 186;
else
st4(_coreVar._selectedObjectId);
getReadDescription(_coreVar._selectedObjectId);
}
/**
@@ -403,9 +400,9 @@ void MortevielleEngine::fctLook() {
tfleche();
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(5);
setCoordinates(5);
if (_num == 0) {
tcoord(8);
setCoordinates(8);
_crep = 131;
if (_num != 0) {
if (_coreVar._currPlace == ATTIC) {
@@ -484,7 +481,7 @@ void MortevielleEngine::fctSearch() {
const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107};
if (_caff > 99) {
st7(_caff);
getSearchDescription(_caff);
return;
}
@@ -501,9 +498,9 @@ void MortevielleEngine::fctSearch() {
return;
}
tcoord(6);
setCoordinates(6);
if (_num == 0) {
tcoord(7);
setCoordinates(7);
if (_num != 0) {
int cx = 0;
do {
@@ -526,7 +523,7 @@ void MortevielleEngine::fctSearch() {
_crep = 997;
}
} else {
tcoord(8);
setCoordinates(8);
_crep = 997;
if (_num != 0) {
if (_currBitIndex > 0)
@@ -575,7 +572,7 @@ void MortevielleEngine::fctSearch() {
*/
void MortevielleEngine::fctSelfSearch() {
if (_coreVar._selectedObjectId != 0)
st7(_coreVar._selectedObjectId);
getSearchDescription(_coreVar._selectedObjectId);
else
_crep = 186;
}
@@ -606,7 +603,7 @@ void MortevielleEngine::fctOpen() {
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(7);
setCoordinates(7);
if (_num != 0) {
if (_currBitIndex > 0)
_coreVar._faithScore += 2;
@@ -662,7 +659,7 @@ void MortevielleEngine::fctPlace() {
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(8);
setCoordinates(8);
if (_num != 0) {
_crep = 999;
if (_caff == 13) {
@@ -719,11 +716,11 @@ void MortevielleEngine::fctPlace() {
_menu.displayMenu();
if (enterPassageFl) {
_coreVar._currPlace = SECRET_PASSAGE;
_menu.setDestinationMenuText(SECRET_PASSAGE);
_menu.setDestinationText(SECRET_PASSAGE);
} else {
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
setPal(14);
dessin(0);
dessin();
aniof(1, 2);
aniof(1, 1);
alertTxt = getString(577);
@@ -790,7 +787,7 @@ void MortevielleEngine::fctTurn() {
tfleche();
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(9);
setCoordinates(9);
if (_num != 0) {
_crep = 997;
if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) {
@@ -825,7 +822,7 @@ void MortevielleEngine::fctSelfHide() {
ecr3(getEngineString(S_HIDE_SELF));
tfleche();
if (!(_anyone) && !(_keyPressedEsc)) {
tcoord(10);
setCoordinates(10);
if (_num == 0)
_hiddenHero = false;
else {
@@ -847,7 +844,7 @@ void MortevielleEngine::fctAttach() {
ecr3(getEngineString(S_TIE));
tfleche();
if (!(_anyone) && !(_keyPressedEsc)) {
tcoord(8);
setCoordinates(8);
_crep = 997;
if ((_num != 0) && (_coreVar._currPlace == WELL)) {
_crep = 999;
@@ -876,7 +873,7 @@ void MortevielleEngine::fctClose() {
_crep = 998;
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(7);
setCoordinates(7);
if (_num != 0) {
int cx = 0;
do {
@@ -969,7 +966,7 @@ void MortevielleEngine::fctSelfPut() {
tfleche();
if ((_anyone) || (_keyPressedEsc))
return;
tcoord(7);
setCoordinates(7);
_crep = 124;
if (_num != 0) {
int chai;
@@ -989,7 +986,7 @@ void MortevielleEngine::fctSelfPut() {
}
}
} else {
tcoord(8);
setCoordinates(8);
if (_num != 0) {
_crep = 998;
if (_caff == PURPLE_ROOM) {
@@ -1026,7 +1023,7 @@ void MortevielleEngine::fctSelfPut() {
} else {
_crep = 124;
if (_caff == WELL) {
tcoord(5);
setCoordinates(5);
if (_num != 0)
_crep = 185;
}
@@ -1089,11 +1086,11 @@ void MortevielleEngine::fctEat() {
if ((_coreVar._currPlace > LANDING) && (_coreVar._currPlace < ROOM26)) {
_crep = 148;
} else {
tsort();
exitRoom();
_coreVar._currPlace = DINING_ROOM;
_caff = 10;
resetRoomVariables(_coreVar._currPlace);
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
int j, h, m;
updateHour(j, h, m);
@@ -1129,7 +1126,7 @@ void MortevielleEngine::fctEat() {
void MortevielleEngine::fctEnter() {
if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) {
gotoDiningRoom();
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
} else if (_coreVar._currPlace == LANDING)
showMoveMenuAlert();
else if (_ment == 0)
@@ -1140,7 +1137,7 @@ void MortevielleEngine::fctEnter() {
} else {
int z = 0;
if (!_blo)
z = t11(_ment);
z = getPresence(_ment);
if (z != 0) {
if ((_ment == 3) || (_ment == 7))
_crep = 179;
@@ -1173,7 +1170,7 @@ void MortevielleEngine::fctEnter() {
_coreVar._currPlace = _ment;
affrep();
resetRoomVariables(_coreVar._currPlace);
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
_ment = 0;
_savedBitIndex = 0;
_currBitIndex = 0;
@@ -1193,12 +1190,12 @@ void MortevielleEngine::fctSleep() {
return;
}
if (_coreVar._currPlace != OWN_ROOM) {
tsort();
exitRoom();
_coreVar._currPlace = OWN_ROOM;
affrep();
afdes();
resetRoomVariables(_coreVar._currPlace);
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
}
clearScreenType3();
clearScreenType2();
@@ -1253,7 +1250,7 @@ void MortevielleEngine::fctForce() {
* @remarks Originally called 'tsortir'
*/
void MortevielleEngine::fctLeave() {
tsort();
exitRoom();
_crep = 0;
if ((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK) || (_coreVar._currPlace == WELL))
_crep = 997;
@@ -1270,7 +1267,7 @@ void MortevielleEngine::fctLeave() {
nextPlace = SECRET_PASSAGE;
_crep = 176;
} else if (_coreVar._currPlace == SECRET_PASSAGE)
nextPlace = t23coul();
nextPlace = checkLeaveSecretPassage();
else if (_coreVar._currPlace == INSIDE_WELL)
nextPlace = WELL;
@@ -1281,7 +1278,7 @@ void MortevielleEngine::fctLeave() {
if (_crep == 0)
_crep = nextPlace;
resetRoomVariables(nextPlace);
_menu.setDestinationMenuText(nextPlace);
_menu.setDestinationText(nextPlace);
}
}
@@ -1298,7 +1295,7 @@ void MortevielleEngine::fctWait() {
++_jh;
prepareRoom();
if (!_blo)
t11(_coreVar._currPlace);
getPresence(_coreVar._currPlace);
if ((_currBitIndex != 0) && (_savedBitIndex == 0)) {
_crep = 998;
if ((_coreVar._currPlace == ATTIC) || (_coreVar._currPlace == CELLAR))
@@ -1357,7 +1354,7 @@ void MortevielleEngine::fctDiscuss() {
repon(2, _caff);
suj = _caff + 60;
}
tkey1(false);
testKey(false);
mennor();
_mouse.hideMouse();
hirs();
@@ -1527,7 +1524,7 @@ void MortevielleEngine::fctDiscuss() {
drawClock();
affrep();
/* chech;*/
_menu.setDestinationMenuText(_coreVar._currPlace);
_menu.setDestinationText(_coreVar._currPlace);
clearScreenType3();
}
@@ -1575,7 +1572,7 @@ void MortevielleEngine::endGame() {
clearScreenType2();
clearScreenType3();
repon(9, 1509);
tkey1(false);
testKey(false);
_mouse.hideMouse();
_caff = 70;
taffich();
@@ -1586,18 +1583,18 @@ void MortevielleEngine::endGame() {
clearScreenType1();
repon(9, 1509);
repon(2, 142);
tkey1(false);
testKey(false);
_caff = 32;
afdes();
repon(6, 34);
repon(2, 35);
startMusicOrSpeech(0);
tkey1(false);
testKey(false);
// A wait message was displayed.
// tkey1 was called before and after.
// testKey (aka tkey1) was called before and after.
// Most likely the double call is useless, thus removed
//
// tkey1(false);
// testKey(false);
resetVariables();
}
@@ -1608,7 +1605,7 @@ void MortevielleEngine::endGame() {
void MortevielleEngine::askRestart() {
clearScreenType2();
startMusicOrSpeech(0);
tkey1(false);
testKey(false);
displayEmptyHand();
resetVariables();
initGame();
+2 -3
View File
@@ -29,7 +29,6 @@
#include "mortevielle/dialogs.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mor.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/speech.h"
@@ -61,7 +60,7 @@ int Alert::show(const Common::String &msg, int n) {
g_vm->setMouseClick(false);
decodeAlertDetails(msg, caseNumb, lignNumb, nbcol, chaine, cas);
sauvecr(50, (NUM_LINES + 1) << 4);
g_vm->sauvecr(50, (NUM_LINES + 1) << 4);
i = 0;
if (chaine == "") {
@@ -170,7 +169,7 @@ int Alert::show(const Common::String &msg, int n) {
tmp4 += " ";
g_vm->_screenSurface.drawString(tmp4, 1);
}
charecr(50, (NUM_LINES + 1) << 4);
g_vm->charecr(50, (NUM_LINES + 1) << 4);
g_vm->_mouse.showMouse();
/* Restore the background area */
+31 -6
View File
@@ -29,7 +29,6 @@
#include "common/str.h"
#include "common/textconsole.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
@@ -88,7 +87,7 @@ void Menu::setText(int menuId, Common::String name) {
* Init destination menu
* @remarks Originally called 'tmlieu'
*/
void Menu::setDestinationMenuText(int roomId) {
void Menu::setDestinationText(int roomId) {
Common::String nomp;
if (roomId == 26)
@@ -323,7 +322,7 @@ void Menu::menuDown(int ii) {
xco = _menuConstants[ii - 1][0];
lignNumb = _menuConstants[ii - 1][3];
g_vm->_mouse.hideMouse();
sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1);
g_vm->sauvecr(10, (_menuConstants[ii - 1][1] + 1) << 1);
xco = xco << 3;
if (g_vm->_res == 1)
cx = 10;
@@ -396,7 +395,7 @@ void Menu::menuDown(int ii) {
*/
void Menu::menuUp(int xx) {
if (_multiTitle) {
charecr(10, (_menuConstants[xx - 1][1] + 1) << 1);
g_vm->charecr(10, (_menuConstants[xx - 1][1] + 1) << 1);
/* Restore the background area */
assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch);
@@ -538,7 +537,7 @@ void Menu::initMenu() {
_moveMenu[i] = 0x200 + i;
_inventoryMenu[i] = 0x100 + i;
if (i > 6)
g_vm->_menu.disableMenuItem(_inventoryMenu[i]);
disableMenuItem(_inventoryMenu[i]);
}
_msg3 = OPCODE_NONE;
_msg4 = OPCODE_NONE;
@@ -567,7 +566,7 @@ void Menu::setSearchMenu() {
* @remarks Originally called 'mfouen'
*/
void Menu::unsetSearchMenu() {
setDestinationMenuText(g_vm->_coreVar._currPlace);
setDestinationText(g_vm->_coreVar._currPlace);
for (int i = 1; i <= 11; ++i)
enableMenuItem(_actionMenu[i]);
@@ -575,4 +574,30 @@ void Menu::unsetSearchMenu() {
setText(OPCODE_LIFT, g_vm->getEngineString(S_RAISE));
}
/**
* Set Inventory menu texts
* @remarks Originally called 'modinv'
*/
void Menu::setInventoryText() {
int r;
Common::String nomp;
int cy = 0;
for (int i = 1; i <= 6; ++i) {
if (g_vm->_coreVar._sjer[i] != chr(0)) {
++cy;
r = (ord(g_vm->_coreVar._sjer[i]) + 400);
nomp = g_vm->getString(r - 501 + kInventoryStringIndex);
setText(_inventoryMenu[cy], nomp);
enableMenuItem(_inventoryMenu[i]);
}
}
if (cy < 6) {
for (int i = cy + 1; i <= 6; ++i) {
setText(_inventoryMenu[i], " ");
disableMenuItem(_inventoryMenu[i]);
}
}
}
} // End of namespace Mortevielle
+2 -1
View File
@@ -62,7 +62,8 @@ public:
int _moveMenu[8];
void setText(int menuId, Common::String name);
void setDestinationMenuText(int roomId);
void setDestinationText(int roomId);
void setInventoryText();
void disableMenuItem(int menuId);
void enableMenuItem(int menuId);
void displayMenu();
-1
View File
@@ -7,7 +7,6 @@ MODULE_OBJS := \
graphics.o \
keyboard.o \
menu.o \
mor.o \
mortevielle.o \
mouse.o \
outtext.o \
-618
View File
@@ -1,618 +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/endian.h"
#include "common/file.h"
#include "common/str.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/graphics.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/speech.h"
#include "mortevielle/var_mor.h"
#include "mortevielle/keyboard.h"
namespace Mortevielle {
/* NIVEAU 10 */
void phaz(int &rand, int &p, int cf) {
p += cf;
rand = g_vm->getRandomNumber(1, 100);
}
int t11(int roomId) {
int retVal = 0;
int rand;
int p = g_vm->getPresenceStats(rand, g_vm->_coreVar._faithScore, roomId);
g_vm->_place = roomId;
if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) {
if (p != -500) {
if (rand > p) {
g_vm->displayAloneText();
retVal = 0;
} else {
g_vm->setPresenceFlags(g_vm->_place);
retVal = g_vm->getPresenceBitIndex(g_vm->_place);
}
} else
retVal = g_vm->getPresenceBitIndex(g_vm->_place);
}
if (roomId > ROOM9) {
if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26))
g_vm->displayAloneText();
else {
int h = 0;
if (roomId == DINING_ROOM)
p = g_vm->getPresenceStatsDiningRoom(h);
else if (roomId == BUREAU)
p = g_vm->getPresenceStatsBureau(h);
else if (roomId == KITCHEN)
p = g_vm->getPresenceStatsKitchen();
else if ((roomId == ATTIC) || (roomId == CELLAR))
p = g_vm->getPresenceStatsAttic();
else if ((roomId == LANDING) || (roomId == ROOM26))
p = g_vm->getPresenceStatsLanding();
else if (roomId == CHAPEL)
p = g_vm->getPresenceStatsChapel(h);
p += g_vm->_coreVar._faithScore;
rand = g_vm->getRandomNumber(1, 100);
if (rand > p) {
g_vm->displayAloneText();
retVal = 0;
} else {
if (roomId == DINING_ROOM)
p = g_vm->setPresenceDiningRoom(h);
else if (roomId == BUREAU)
p = g_vm->setPresenceBureau(h);
else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR))
p = g_vm->setPresenceKitchen();
else if ((roomId == LANDING) || (roomId == ROOM26))
p = g_vm->setPresenceLanding();
else if (roomId == CHAPEL)
p = g_vm->setPresenceChapel(h);
retVal = p;
}
}
}
return retVal;
}
void writetp(Common::String s, int t) {
if (g_vm->_res == 2)
g_vm->_screenSurface.drawString(s, t);
else
g_vm->_screenSurface.drawString(g_vm->copy(s, 1, 25), t);
}
void aniof(int ouf, int num) {
if ((g_vm->_caff == 7) && ((num == 4) || (num == 5)))
return;
if ((g_vm->_caff == 10) && (num == 7))
num = 6;
else if (g_vm->_caff == 12) {
if (num == 3)
num = 4;
else if (num == 4)
num = 3;
}
int ad = kAdrAni;
int offset = g_vm->animof(ouf, num);
GfxSurface surface;
surface.decode(&g_vm->_mem[ad * 16 + offset]);
g_vm->_screenSurface.drawPicture(surface, 0, 12);
g_vm->prepareScreenType1();
}
/* NIVEAU 9 */
void dessin(int ad) {
if (ad != 0)
g_vm->draw(kAdrDes, ((ad % 160) * 2), (ad / 160));
else {
g_vm->clearScreenType1();
if (g_vm->_caff > 99) {
g_vm->draw(kAdrDes, 60, 33);
g_vm->_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box
} else if (g_vm->_caff > 69) {
g_vm->draw(kAdrDes, 112, 48); // Heads
g_vm->_screenSurface.drawBox(222, 47, 155, 91, 15);
} else {
g_vm->draw(kAdrDes, 0, 12);
g_vm->prepareScreenType1();
if ((g_vm->_caff < 30) || (g_vm->_caff > 32)) {
for (int cx = 1; cx <= 6; ++cx) {
if (ord(g_vm->_touv[cx]) != 0)
aniof(1, ord(g_vm->_touv[cx]));
}
if (g_vm->_caff == 13) {
if (g_vm->_coreVar._atticBallHoleObjectId == 141)
aniof(1, 7);
if (g_vm->_coreVar._atticRodHoleObjectId == 159)
aniof(1, 6);
} else if ((g_vm->_caff == 14) && (g_vm->_coreVar._cellarObjectId == 151))
aniof(1, 2);
else if ((g_vm->_caff == 17) && (g_vm->_coreVar._secretPassageObjectId == 143))
aniof(1, 1);
else if ((g_vm->_caff == 24) && (g_vm->_coreVar._wellObjectId != 0))
aniof(1, 1);
}
if (g_vm->_caff < ROOM26)
g_vm->startMusicOrSpeech(1);
}
}
}
void fenat(char ans) {
int coul;
g_vm->_mouse.hideMouse();
if (g_vm->_currGraphicalDevice == MODE_CGA)
coul = 2;
else if (g_vm->_currGraphicalDevice == MODE_HERCULES)
coul = 1;
else
coul = 12;
g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul);
g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15);
g_vm->_mouse.showMouse();
}
/* NIVEAU 8 */
void afdes() {
taffich();
dessin(0);
g_vm->_okdes = false;
}
void tkey1(bool d) {
bool quest = false;
int x, y, c;
g_vm->_mouse.hideMouse();
fenat('K');
// Wait for release from any key or mouse button
while (g_vm->keyPressed())
g_vm->_key = testou();
do {
g_vm->_mouse.getMousePosition(x, y, c);
g_vm->keyPressed();
} while (c != 0);
// Event loop
do {
if (d)
g_vm->prepareRoom();
quest = g_vm->keyPressed();
g_vm->_mouse.getMousePosition(x, y, c);
CHECK_QUIT;
} while (!(quest || (c != 0) || (d && g_vm->_anyone)));
if (quest)
testou();
g_vm->setMouseClick(false);
g_vm->_mouse.showMouse();
}
/* NIVEAU 7 */
void tlu(int af, int ob) {
g_vm->_caff = 32;
afdes();
g_vm->repon(6, ob + 4000);
g_vm->repon(2, 999);
tkey1(true);
g_vm->_caff = af;
g_vm->_msg[3] = OPCODE_NONE;
g_vm->_crep = 998;
}
void affrep() {
g_vm->_caff = g_vm->_coreVar._currPlace;
g_vm->_crep = g_vm->_coreVar._currPlace;
}
void tsort() {
if ((g_vm->_iouv > 0) && (g_vm->_coreVar._currPlace != 0)) {
if (g_vm->_coreVar._faithScore < 50)
g_vm->_coreVar._faithScore += 2;
else
g_vm->_coreVar._faithScore += (g_vm->_coreVar._faithScore / 10);
}
for (int cx = 1; cx <= 7; ++cx)
g_vm->_touv[cx] = chr(0);
g_vm->_ment = 0;
g_vm->_iouv = 0;
g_vm->_mchai = 0;
g_vm->resetRoomVariables(g_vm->_coreVar._currPlace);
}
void st4(int ob) {
g_vm->_crep = 997;
switch (ob) {
case 114 :
g_vm->_crep = 109;
break;
case 110 :
g_vm->_crep = 107;
break;
case 158 :
g_vm->_crep = 113;
break;
case 152:
case 153:
case 154:
case 155:
case 156:
case 150:
case 100:
case 157:
case 160:
case 161 :
tlu(g_vm->_caff, ob);
break;
default:
break;
}
}
void modinv() {
int r;
Common::String nomp;
int cy = 0;
for (int i = 1; i <= 6; ++i) {
if (g_vm->_coreVar._sjer[i] != chr(0)) {
++cy;
r = (ord(g_vm->_coreVar._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]);
}
}
if (cy < 6) {
for (int i = cy + 1; i <= 6; ++i) {
g_vm->_menu.setText(g_vm->_menu._inventoryMenu[i], " ");
g_vm->_menu.disableMenuItem(g_vm->_menu._inventoryMenu[i]);
}
}
}
void mennor() {
g_vm->_menu.menuUp(g_vm->_msg[3]);
}
void premtet() {
g_vm->draw(kAdrDes, 10, 80);
g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15);
}
/* NIVEAU 5 */
void ajchai() {
int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1;
int cx = 0;
do {
++cx;
} while ((cx <= 9) && (g_vm->_tabdon[cy + cx] != 0));
if (g_vm->_tabdon[cy + cx] == 0)
g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId;
else
g_vm->_crep = 192;
}
void ajjer(int ob) {
int cx = 0;
do {
++cx;
} while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0));
if (ord(g_vm->_coreVar._sjer[cx]) == 0) {
g_vm->_coreVar._sjer[(cx)] = chr(ob);
modinv();
} else
g_vm->_crep = 139;
}
void quelquun() {
if (g_vm->_menu._menuDisplayed)
g_vm->_menu.eraseMenu();
g_vm->endSearch();
g_vm->_crep = 997;
L1:
if (!g_vm->_hiddenHero) {
if (g_vm->_crep == 997)
g_vm->_crep = 138;
g_vm->repon(2, g_vm->_crep);
if (g_vm->_crep == 138)
g_vm->_speechManager.startSpeech(5, 2, 1);
else
g_vm->_speechManager.startSpeech(4, 4, 1);
if (g_vm->_iouv == 0)
g_vm->_coreVar._faithScore += 2;
else if (g_vm->_coreVar._faithScore < 50)
g_vm->_coreVar._faithScore += 4;
else
g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10);
tsort();
g_vm->_menu.setDestinationMenuText(LANDING);
int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex);
g_vm->_caff = 69 + cx;
g_vm->_crep = g_vm->_caff;
g_vm->_msg[3] = MENU_DISCUSS;
g_vm->_msg[4] = g_vm->_menu._discussMenu[cx];
g_vm->_syn = true;
g_vm->_col = true;
} else {
if (g_vm->getRandomNumber(1, 3) == 2) {
g_vm->_hiddenHero = false;
g_vm->_crep = 137;
goto L1;
} else {
g_vm->repon(2, 136);
int rand = (g_vm->getRandomNumber(0, 4)) - 2;
g_vm->_speechManager.startSpeech(3, rand, 1);
g_vm->clearScreenType2();
g_vm->displayAloneText();
g_vm->resetRoomVariables(MANOR_FRONT);
affrep();
}
}
if (g_vm->_menu._menuDisplayed)
g_vm->_menu.drawMenu();
}
void tsuiv() {
int tbcl;
int cl;
int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1;
int cx = 0;
do {
++cx;
++g_vm->_cs;
cl = cy + g_vm->_cs;
tbcl = g_vm->_tabdon[cl];
} while ((tbcl == 0) && (g_vm->_cs <= 9));
if ((tbcl != 0) && (g_vm->_cs < 11)) {
++g_vm->_is;
g_vm->_caff = tbcl;
g_vm->_crep = g_vm->_caff + 400;
if (g_vm->_currBitIndex != 0)
g_vm->_coreVar._faithScore += 2;
} else {
affrep();
g_vm->endSearch();
if (cx > 9)
g_vm->_crep = 131;
}
}
void tfleche() {
bool qust;
char touch;
if (g_vm->_num == 9999)
return;
fenat(chr(152));
bool inRect = false;
do {
touch = '\0';
do {
g_vm->_mouse.moveMouse(qust, touch);
CHECK_QUIT;
if (g_vm->getMouseClick())
inRect = (g_vm->_mouse._pos.x < 256 * g_vm->_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12);
g_vm->prepareRoom();
} while (!(qust || inRect || g_vm->_anyone));
if (qust && (touch == '\103'))
Alert::show(g_vm->_hintPctMessage, 1);
} while (!((touch == '\73') || ((touch == '\104') && (g_vm->_x != 0) && (g_vm->_y != 0)) || (g_vm->_anyone) || (inRect)));
if (touch == '\73')
g_vm->_keyPressedEsc = true;
if (inRect) {
g_vm->_x = g_vm->_mouse._pos.x;
g_vm->_y = g_vm->_mouse._pos.y;
}
}
void tcoord(int sx) {
int sy, ix, iy;
int ib;
g_vm->_num = 0;
g_vm->_crep = 999;
int a = 0;
int atdon = amzon + 3;
int cy = 0;
while (cy < g_vm->_caff) {
a += g_vm->_tabdon[atdon];
atdon += 4;
++cy;
}
if (g_vm->_tabdon[atdon] == 0) {
g_vm->_crep = 997;
return;
}
a += kFleche;
int cb = 0;
for (cy = 0; cy <= (sx - 2); ++cy) {
ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)];
cb += (ib * 4) + 2;
}
ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)];
if (ib == 0) {
g_vm->_crep = 997;
return;
}
cy = 1;
do {
cb += 2;
sx = g_vm->_tabdon[a + cb] * g_vm->_res;
sy = g_vm->_tabdon[(a + cb + 1)];
cb += 2;
ix = g_vm->_tabdon[a + cb] * g_vm->_res;
iy = g_vm->_tabdon[(a + cb + 1)];
++cy;
} while (!(((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) || (cy > ib)));
if ((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) {
g_vm->_num = cy - 1;
return;
}
g_vm->_crep = 997;
}
void st7(int ob) {
switch (ob) {
case 116:
case 144:
g_vm->_crep = 104;
break;
case 126:
case 111:
g_vm->_crep = 108;
break;
case 132:
g_vm->_crep = 111;
break;
case 142:
g_vm->_crep = 112;
break;
default:
g_vm->_crep = 183;
st4(ob);
}
}
void treg(int ob) {
int mdes = g_vm->_caff;
g_vm->_caff = ob;
if (((g_vm->_caff > 29) && (g_vm->_caff < 33)) || (g_vm->_caff == 144) || (g_vm->_caff == 147) || (g_vm->_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) {
afdes();
if ((g_vm->_caff > 29) && (g_vm->_caff < 33))
g_vm->repon(2, g_vm->_caff);
else
g_vm->repon(2, g_vm->_caff + 400);
tkey1(true);
g_vm->_caff = mdes;
g_vm->_msg[3] = 0;
g_vm->_crep = 998;
} else {
g_vm->_obpart = true;
g_vm->_crep = g_vm->_caff + 400;
g_vm->_menu.setSearchMenu();
}
}
void avpoing(int &ob) {
g_vm->_crep = 999;
if (g_vm->_coreVar._selectedObjectId != 0)
ajjer(g_vm->_coreVar._selectedObjectId);
if (g_vm->_crep != 139) {
g_vm->displayItemInHand(ob + 400);
g_vm->_coreVar._selectedObjectId = ob;
ob = 0;
}
}
void rechai(int &ch) {
int tmpPlace = g_vm->_coreVar._currPlace;
if (g_vm->_coreVar._currPlace == CRYPT)
tmpPlace = CELLAR;
ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_vm->_num - 1];
}
int t23coul() {
if (!g_vm->checkInventory(143)) {
g_vm->_crep = 1512;
g_vm->loseGame();
}
return CELLAR;
}
void st13(int ob) {
if ((ob == 114) || (ob == 116) || (ob == 126) || (ob == 132) ||
(ob == 111) || (ob == 106) || (ob == 102) || (ob == 100) ||
(ob == 110) || (ob == 153) || (ob == 154) || (ob == 155) ||
(ob == 156) || (ob == 157) || (ob == 144) || (ob == 158) ||
(ob == 150) || (ob == 152))
g_vm->_crep = 999;
else
g_vm->_crep = 105;
}
void sauvecr(int y, int dy) {
// g_vm->_mouse.hideMouse();
// g_vm->_mouse.showMouse();
}
void charecr(int y, int dy) {
// g_vm->_mouse.hideMouse();
// g_vm->_mouse.showMouse();
}
} // End of namespace Mortevielle
-82
View File
@@ -1,82 +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_MOR_H
#define MORTEVIELLE_MOR_H
#include "common/str.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {
const int kTime1 = 410;
const int kTime2 = 250;
static const int _actionMenu[12] = { OPCODE_NONE,
OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP,
OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT,
OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE
};
/* NIVEAU 10 */
extern void phaz(int &rand, int &p, int cf);
extern int t11(int roomId);
extern void writetp(Common::String s, int t);
extern void aniof(int ouf, int num);
/* NIVEAU 9 */
extern void dessin(int ad);
extern void fenat(char ans);
/* NIVEAU 8 */
extern void afdes();
extern void tkey1(bool d);
/* NIVEAU 7 */
extern void tlu(int af, int ob);
extern void affrep();
/* NIVEAU 6 */
extern void tsort();
extern void st4(int ob);
extern void modinv();
extern void mennor();
extern void premtet();
/* NIVEAU 5 */
extern void ajchai();
extern void ajjer(int ob);
extern void quelquun();
extern void tsuiv();
extern void tfleche();
extern void tcoord(int sx);
extern void st7(int ob);
extern void treg(int ob);
extern void avpoing(int &ob);
extern void rechai(int &ch);
extern int t23coul();
extern void st13(int ob);
extern void sauvecr(int y, int dy);
extern void charecr(int y, int dy);
} // End of namespace Mortevielle
#endif
+575 -21
View File
@@ -32,7 +32,6 @@
#include "mortevielle/dialogs.h"
#include "mortevielle/keyboard.h"
#include "mortevielle/menu.h"
#include "mortevielle/mor.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/saveload.h"
@@ -697,7 +696,7 @@ void MortevielleEngine::handleAction() {
taffich();
if (_okdes) {
_okdes = false;
dessin(0);
dessin();
}
if ((!_syn) || (_col))
repon(2, _crep);
@@ -1658,7 +1657,7 @@ void MortevielleEngine::loseGame() {
_mchai = 0;
_menu.unsetSearchMenu();
if (!_blo)
t11(MANOR_FRONT);
getPresence(MANOR_FRONT);
_loseGame = true;
clearScreenType1();
@@ -1753,7 +1752,7 @@ void MortevielleEngine::gotoDiningRoom() {
afdes();
_screenSurface.drawBox(223, 47, 155, 91, 15);
repon(2, 33);
tkey1(false);
testKey(false);
mennor();
_mouse.hideMouse();
hirs();
@@ -1766,7 +1765,7 @@ void MortevielleEngine::gotoDiningRoom() {
affrep();
resetPresenceInRooms(DINING_ROOM);
if (!_blo)
minute = t11(OWN_ROOM);
getPresence(OWN_ROOM);
_currBitIndex = 0;
_savedBitIndex = 0;
_coreVar._alreadyEnteredManor = true;
@@ -1889,8 +1888,8 @@ void MortevielleEngine::gameLoaded() {
repon(2, _crep);
clearScreenType3();
_endGame = false;
_menu.setDestinationMenuText(_coreVar._currPlace);
modinv();
_menu.setDestinationText(_coreVar._currPlace);
_menu.setInventoryText();
if (_coreVar._selectedObjectId != 0)
displayItemInHand(_coreVar._selectedObjectId + 400);
_mouse.showMouse();
@@ -1975,7 +1974,7 @@ void MortevielleEngine::handleOpcode() {
fctSelfHide();
} else {
if (_anyone) {
quelquun();
interactNPC();
_anyone = false;
mennor();
return;
@@ -3118,39 +3117,594 @@ int MortevielleEngine::getPresenceStats(int &rand, int cf, int roomId) {
*/
void MortevielleEngine::setPresenceFlags(int roomId) {
if ((roomId == GREEN_ROOM) || (roomId == DARKBLUE_ROOM)) {
int rand = g_vm->getRandomNumber(1, 2);
int rand = getRandomNumber(1, 2);
if (roomId == GREEN_ROOM) {
if (rand == 1)
g_vm->_roomPresenceLuc = true;
_roomPresenceLuc = true;
else
g_vm->_roomPresenceIda = true;
_roomPresenceIda = true;
} else { // roomId == DARKBLUE_ROOM
if (rand == 1)
g_vm->_roomPresenceGuy = true;
_roomPresenceGuy = true;
else
g_vm->_roomPresenceEva = true;
_roomPresenceEva = true;
}
} else if (roomId == PURPLE_ROOM)
g_vm->_purpleRoomPresenceLeo = true;
_purpleRoomPresenceLeo = true;
else if (roomId == TOILETS)
g_vm->_toiletsPresenceBobMax = true;
_toiletsPresenceBobMax = true;
else if (roomId == BLUE_ROOM)
g_vm->_roomPresenceMax = true;
_roomPresenceMax = true;
else if (roomId == RED_ROOM)
g_vm->_roomPresenceBob = true;
_roomPresenceBob = true;
else if (roomId == BATHROOM)
g_vm->_bathRoomPresenceBobMax = true;
_bathRoomPresenceBobMax = true;
else if (roomId == GREEN_ROOM2)
g_vm->_roomPresencePat = true;
_roomPresencePat = true;
else if (roomId == ROOM9)
g_vm->_room9PresenceLeo = true;
_room9PresenceLeo = true;
}
void MortevielleEngine::init_nbrepm() {
static const byte ipm[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 };
for (int idx = 0; idx < 9; ++idx)
g_vm->_nbrepm[idx] = ipm[idx];
_nbrepm[idx] = ipm[idx];
}
void MortevielleEngine::phaz(int &rand, int &p, int cf) {
p += cf;
rand = getRandomNumber(1, 100);
}
/**
* Get Presence
* @remarks Originally called 't11'
*/
int MortevielleEngine::getPresence(int roomId) {
int retVal = 0;
int rand;
int p = getPresenceStats(rand, _coreVar._faithScore, roomId);
_place = roomId;
if ((roomId > OWN_ROOM) && (roomId < DINING_ROOM)) {
if (p != -500) {
if (rand > p) {
displayAloneText();
retVal = 0;
} else {
setPresenceFlags(_place);
retVal = getPresenceBitIndex(_place);
}
} else
retVal = getPresenceBitIndex(_place);
}
if (roomId > ROOM9) {
if ((roomId > LANDING) && (roomId != CHAPEL) && (roomId != ROOM26))
displayAloneText();
else {
int h = 0;
if (roomId == DINING_ROOM)
p = getPresenceStatsDiningRoom(h);
else if (roomId == BUREAU)
p = getPresenceStatsBureau(h);
else if (roomId == KITCHEN)
p = getPresenceStatsKitchen();
else if ((roomId == ATTIC) || (roomId == CELLAR))
p = getPresenceStatsAttic();
else if ((roomId == LANDING) || (roomId == ROOM26))
p = getPresenceStatsLanding();
else if (roomId == CHAPEL)
p = getPresenceStatsChapel(h);
p += _coreVar._faithScore;
rand = getRandomNumber(1, 100);
if (rand > p) {
displayAloneText();
retVal = 0;
} else {
if (roomId == DINING_ROOM)
p = setPresenceDiningRoom(h);
else if (roomId == BUREAU)
p = setPresenceBureau(h);
else if ((roomId == KITCHEN) || (roomId == ATTIC) || (roomId == CELLAR))
p = setPresenceKitchen();
else if ((roomId == LANDING) || (roomId == ROOM26))
p = setPresenceLanding();
else if (roomId == CHAPEL)
p = setPresenceChapel(h);
retVal = p;
}
}
}
return retVal;
}
void MortevielleEngine::writetp(Common::String s, int t) {
if (_res == 2)
_screenSurface.drawString(s, t);
else
_screenSurface.drawString(copy(s, 1, 25), t);
}
void MortevielleEngine::aniof(int ouf, int num) {
if ((_caff == 7) && ((num == 4) || (num == 5)))
return;
if ((_caff == 10) && (num == 7))
num = 6;
else if (_caff == 12) {
if (num == 3)
num = 4;
else if (num == 4)
num = 3;
}
int ad = kAdrAni;
int offset = animof(ouf, num);
GfxSurface surface;
surface.decode(&_mem[ad * 16 + offset]);
_screenSurface.drawPicture(surface, 0, 12);
prepareScreenType1();
}
void MortevielleEngine::dessin() {
clearScreenType1();
if (_caff > 99) {
draw(kAdrDes, 60, 33);
_screenSurface.drawBox(118, 32, 291, 121, 15); // Medium box
} else if (_caff > 69) {
draw(kAdrDes, 112, 48); // Heads
_screenSurface.drawBox(222, 47, 155, 91, 15);
} else {
draw(kAdrDes, 0, 12);
prepareScreenType1();
if ((_caff < 30) || (_caff > 32)) {
for (int cx = 1; cx <= 6; ++cx) {
if (ord(_touv[cx]) != 0)
aniof(1, ord(_touv[cx]));
}
if (_caff == 13) {
if (_coreVar._atticBallHoleObjectId == 141)
aniof(1, 7);
if (_coreVar._atticRodHoleObjectId == 159)
aniof(1, 6);
} else if ((_caff == 14) && (_coreVar._cellarObjectId == 151))
aniof(1, 2);
else if ((_caff == 17) && (_coreVar._secretPassageObjectId == 143))
aniof(1, 1);
else if ((_caff == 24) && (_coreVar._wellObjectId != 0))
aniof(1, 1);
}
if (_caff < ROOM26)
startMusicOrSpeech(1);
}
}
void MortevielleEngine::afdes() {
taffich();
dessin();
_okdes = false;
}
/**
* Engine function - Place
* @remarks Originally called 'tkey1'
*/
void MortevielleEngine::testKey(bool d) {
bool quest = false;
int x, y, c;
_mouse.hideMouse();
fenat('K');
// Wait for release from any key or mouse button
while (keyPressed())
_key = testou();
do {
_mouse.getMousePosition(x, y, c);
keyPressed();
} while (c != 0);
// Event loop
do {
if (d)
prepareRoom();
quest = keyPressed();
_mouse.getMousePosition(x, y, c);
CHECK_QUIT;
} while (!(quest || (c != 0) || (d && _anyone)));
if (quest)
testou();
setMouseClick(false);
_mouse.showMouse();
}
void MortevielleEngine::tlu(int af, int ob) {
_caff = 32;
afdes();
repon(6, ob + 4000);
repon(2, 999);
testKey(true);
_caff = af;
_msg[3] = OPCODE_NONE;
_crep = 998;
}
void MortevielleEngine::affrep() {
_caff = _coreVar._currPlace;
_crep = _coreVar._currPlace;
}
/**
* Exit room
* @remarks Originally called 'tsort'
*/
void MortevielleEngine::exitRoom() {
if ((_iouv > 0) && (_coreVar._currPlace != OWN_ROOM)) {
if (_coreVar._faithScore < 50)
_coreVar._faithScore += 2;
else
_coreVar._faithScore += (_coreVar._faithScore / 10);
}
for (int cx = 1; cx <= 7; ++cx)
_touv[cx] = chr(0);
_ment = 0;
_iouv = 0;
_mchai = 0;
resetRoomVariables(_coreVar._currPlace);
}
/**
* get 'read' description
* @remarks Originally called 'st4'
*/
void MortevielleEngine::getReadDescription(int objId) {
_crep = 997;
switch (objId) {
case 114 :
_crep = 109;
break;
case 110 :
_crep = 107;
break;
case 158 :
_crep = 113;
break;
case 152:
case 153:
case 154:
case 155:
case 156:
case 150:
case 100:
case 157:
case 160:
case 161 :
tlu(_caff, objId);
break;
default:
break;
}
}
/**
* get 'search' description
* @remarks Originally called 'st7'
*/
void MortevielleEngine::getSearchDescription(int objId) {
switch (objId) {
case 116:
case 144:
_crep = 104;
break;
case 126:
case 111:
_crep = 108;
break;
case 132:
_crep = 111;
break;
case 142:
_crep = 112;
break;
default:
_crep = 183;
getReadDescription(objId);
}
}
void MortevielleEngine::mennor() {
g_vm->_menu.menuUp(g_vm->_msg[3]);
}
void MortevielleEngine::premtet() {
g_vm->draw(kAdrDes, 10, 80);
g_vm->_screenSurface.drawBox(18, 79, 155, 91, 15);
}
void MortevielleEngine::ajchai() {
int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1;
int cx = 0;
do {
++cx;
} while ((cx <= 9) && (g_vm->_tabdon[cy + cx] != 0));
if (g_vm->_tabdon[cy + cx] == 0)
g_vm->_tabdon[cy + cx] = g_vm->_coreVar._selectedObjectId;
else
g_vm->_crep = 192;
}
void MortevielleEngine::ajjer(int ob) {
int cx = 0;
do {
++cx;
} while ((cx <= 5) && (ord(g_vm->_coreVar._sjer[cx]) != 0));
if (ord(g_vm->_coreVar._sjer[cx]) == 0) {
g_vm->_coreVar._sjer[(cx)] = chr(ob);
g_vm->_menu.setInventoryText();
} else
g_vm->_crep = 139;
}
/**
* Interact with NPC
* @remarks Originally called 'quelquun'
*/
void MortevielleEngine::interactNPC() {
if (g_vm->_menu._menuDisplayed)
g_vm->_menu.eraseMenu();
g_vm->endSearch();
g_vm->_crep = 997;
L1:
if (!g_vm->_hiddenHero) {
if (g_vm->_crep == 997)
g_vm->_crep = 138;
g_vm->repon(2, g_vm->_crep);
if (g_vm->_crep == 138)
g_vm->_speechManager.startSpeech(5, 2, 1);
else
g_vm->_speechManager.startSpeech(4, 4, 1);
if (g_vm->_iouv == 0)
g_vm->_coreVar._faithScore += 2;
else if (g_vm->_coreVar._faithScore < 50)
g_vm->_coreVar._faithScore += 4;
else
g_vm->_coreVar._faithScore += 3 * (g_vm->_coreVar._faithScore / 10);
g_vm->exitRoom();
g_vm->_menu.setDestinationText(LANDING);
int cx = g_vm->convertBitIndexToCharacterIndex(g_vm->_currBitIndex);
g_vm->_caff = 69 + cx;
g_vm->_crep = g_vm->_caff;
g_vm->_msg[3] = MENU_DISCUSS;
g_vm->_msg[4] = g_vm->_menu._discussMenu[cx];
g_vm->_syn = true;
g_vm->_col = true;
} else {
if (g_vm->getRandomNumber(1, 3) == 2) {
g_vm->_hiddenHero = false;
g_vm->_crep = 137;
goto L1;
} else {
g_vm->repon(2, 136);
int rand = (g_vm->getRandomNumber(0, 4)) - 2;
g_vm->_speechManager.startSpeech(3, rand, 1);
g_vm->clearScreenType2();
g_vm->displayAloneText();
g_vm->resetRoomVariables(MANOR_FRONT);
g_vm->affrep();
}
}
if (g_vm->_menu._menuDisplayed)
g_vm->_menu.drawMenu();
}
void MortevielleEngine::tsuiv() {
int tbcl;
int cy = kAcha + ((g_vm->_mchai - 1) * 10) - 1;
int cx = 0;
do {
++cx;
++g_vm->_cs;
int cl = cy + g_vm->_cs;
tbcl = g_vm->_tabdon[cl];
} while ((tbcl == 0) && (g_vm->_cs <= 9));
if ((tbcl != 0) && (g_vm->_cs < 11)) {
++g_vm->_is;
g_vm->_caff = tbcl;
g_vm->_crep = g_vm->_caff + 400;
if (g_vm->_currBitIndex != 0)
g_vm->_coreVar._faithScore += 2;
} else {
g_vm->affrep();
g_vm->endSearch();
if (cx > 9)
g_vm->_crep = 131;
}
}
void MortevielleEngine::tfleche() {
bool qust;
char touch;
if (g_vm->_num == 9999)
return;
fenat(chr(152));
bool inRect = false;
do {
touch = '\0';
do {
g_vm->_mouse.moveMouse(qust, touch);
CHECK_QUIT;
if (g_vm->getMouseClick())
inRect = (g_vm->_mouse._pos.x < 256 * g_vm->_res) && (g_vm->_mouse._pos.y < 176) && (g_vm->_mouse._pos.y > 12);
g_vm->prepareRoom();
} while (!(qust || inRect || g_vm->_anyone));
if (qust && (touch == '\103'))
Alert::show(g_vm->_hintPctMessage, 1);
} while (!((touch == '\73') || ((touch == '\104') && (g_vm->_x != 0) && (g_vm->_y != 0)) || (g_vm->_anyone) || (inRect)));
if (touch == '\73')
g_vm->_keyPressedEsc = true;
if (inRect) {
g_vm->_x = g_vm->_mouse._pos.x;
g_vm->_y = g_vm->_mouse._pos.y;
}
}
/**
* Set coordinates
* @remarks Originally called 'tcoord'
*/
void MortevielleEngine::setCoordinates(int sx) {
int sy, ix, iy;
int ib;
g_vm->_num = 0;
g_vm->_crep = 999;
int a = 0;
int atdon = amzon + 3;
int cy = 0;
while (cy < g_vm->_caff) {
a += g_vm->_tabdon[atdon];
atdon += 4;
++cy;
}
if (g_vm->_tabdon[atdon] == 0) {
g_vm->_crep = 997;
return;
}
a += kFleche;
int cb = 0;
for (cy = 0; cy <= (sx - 2); ++cy) {
ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)];
cb += (ib * 4) + 2;
}
ib = (g_vm->_tabdon[a + cb] << 8) + g_vm->_tabdon[(a + cb + 1)];
if (ib == 0) {
g_vm->_crep = 997;
return;
}
cy = 1;
do {
cb += 2;
sx = g_vm->_tabdon[a + cb] * g_vm->_res;
sy = g_vm->_tabdon[(a + cb + 1)];
cb += 2;
ix = g_vm->_tabdon[a + cb] * g_vm->_res;
iy = g_vm->_tabdon[(a + cb + 1)];
++cy;
} while (!(((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) || (cy > ib)));
if ((g_vm->_x >= sx) && (g_vm->_x <= ix) && (g_vm->_y >= sy) && (g_vm->_y <= iy)) {
g_vm->_num = cy - 1;
return;
}
g_vm->_crep = 997;
}
void MortevielleEngine::treg(int objId) {
int mdes = g_vm->_caff;
g_vm->_caff = objId;
if (((g_vm->_caff > 29) && (g_vm->_caff < 33)) || (g_vm->_caff == 144) || (g_vm->_caff == 147) || (g_vm->_caff == 149) || (g_vm->_msg[4] == OPCODE_SLOOK)) {
g_vm->afdes();
if ((g_vm->_caff > 29) && (g_vm->_caff < 33))
g_vm->repon(2, g_vm->_caff);
else
g_vm->repon(2, g_vm->_caff + 400);
g_vm->testKey(true);
g_vm->_caff = mdes;
g_vm->_msg[3] = 0;
g_vm->_crep = 998;
} else {
g_vm->_obpart = true;
g_vm->_crep = g_vm->_caff + 400;
g_vm->_menu.setSearchMenu();
}
}
void MortevielleEngine::avpoing(int &objId) {
g_vm->_crep = 999;
if (g_vm->_coreVar._selectedObjectId != 0)
g_vm->ajjer(g_vm->_coreVar._selectedObjectId);
if (g_vm->_crep != 139) {
g_vm->displayItemInHand(objId + 400);
g_vm->_coreVar._selectedObjectId = objId;
objId = 0;
}
}
void MortevielleEngine::rechai(int &ch) {
int tmpPlace = g_vm->_coreVar._currPlace;
if (g_vm->_coreVar._currPlace == CRYPT)
tmpPlace = CELLAR;
ch = g_vm->_tabdon[achai + (tmpPlace * 7) + g_vm->_num - 1];
}
/**
* Check before leaving the secret passage
* @remarks Originally called 't23coul'
*/
int MortevielleEngine::checkLeaveSecretPassage() {
if (!g_vm->checkInventory(143)) {
g_vm->_crep = 1512;
g_vm->loseGame();
}
return CELLAR;
}
void MortevielleEngine::fenat(char ans) {
int coul;
g_vm->_mouse.hideMouse();
if (g_vm->_currGraphicalDevice == MODE_CGA)
coul = 2;
else if (g_vm->_currGraphicalDevice == MODE_HERCULES)
coul = 1;
else
coul = 12;
g_vm->_screenSurface.writeCharacter(Common::Point(306, 193), ord(ans), coul);
g_vm->_screenSurface.drawBox(300, 191, 16, 8, 15);
g_vm->_mouse.showMouse();
}
void MortevielleEngine::sauvecr(int y, int dy) {
// _mouse.hideMouse();
// _mouse.showMouse();
}
void MortevielleEngine::charecr(int y, int dy) {
// _mouse.hideMouse();
// _mouse.showMouse();
}
} // End of namespace Mortevielle
+38 -2
View File
@@ -73,6 +73,12 @@ enum DataType {
kGameStrings = 1
};
static const int _actionMenu[12] = { OPCODE_NONE,
OPCODE_SHIDE, OPCODE_ATTACH, OPCODE_FORCE, OPCODE_SLEEP,
OPCODE_ENTER, OPCODE_CLOSE, OPCODE_KNOCK, OPCODE_EAT,
OPCODE_PLACE, OPCODE_OPEN, OPCODE_LEAVE
};
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 400
#define SCREEN_ORIG_HEIGHT 200
@@ -80,6 +86,9 @@ enum DataType {
#define MORT_DAT "mort.dat"
#define GAME_FRAME_DELAY (1000 / 50)
const int kTime1 = 410;
const int kTime2 = 250;
const int kAcha = 492;
const int kAdrDes = 0x7000;
const int kFleche = 1758;
@@ -167,11 +176,18 @@ private:
int readclock();
void palette(int v1);
int checkLeoMaxRandomPresence();
void interactNPC();
void adzon();
void text1(int x, int y, int nb, int m);
void modif(int &nu);
void initouv();
void phaz(int &rand, int &p, int cf);
void writetp(Common::String s, int t);
void premtet();
void ajchai();
void tfleche();
void setCoordinates(int sx);
public:
Common::String _hintPctMessage;
@@ -417,9 +433,14 @@ public:
void displayItemInHand(int objId);
void displayEmptyHand();
void resetRoomVariables(int roomId);
int getPresenceStats(int &rand, int cf, int roomId);
int getPresenceStats(int &rand, int cf, int roomId);
void setPresenceFlags(int roomId);
int getPresence(int roomId);
void testKey(bool d);
void exitRoom();
void getReadDescription(int objId);
void getSearchDescription(int objId);
int checkLeaveSecretPassage();
void pictout(int seg, int dep, int x, int y);
int animof(int ouf, int num);
@@ -427,6 +448,21 @@ public:
void ecr2(Common::String text);
void ecr3(Common::String text);
void init_nbrepm();
void aniof(int ouf, int num);
void dessin();
void afdes();
void tlu(int af, int ob);
void affrep();
void mennor();
void ajjer(int ob);
void tsuiv();
void treg(int objId);
void avpoing(int &objId);
void rechai(int &ch);
void fenat(char ans);
void sauvecr(int y, int dy);
void charecr(int y, int dy);
};
+1 -2
View File
@@ -27,7 +27,6 @@
#include "common/file.h"
#include "common/str.h"
#include "mortevielle/mor.h"
#include "mortevielle/mouse.h"
#include "mortevielle/outtext.h"
#include "mortevielle/graphics.h"
@@ -338,7 +337,7 @@ void taffich() {
if ((a == 13) || (a == 14))
g_vm->displayAloneText();
else if (!g_vm->_blo)
cx = t11(g_vm->_coreVar._currPlace);
g_vm->getPresence(g_vm->_coreVar._currPlace);
g_vm->_savedBitIndex = 0;
}
}
-1
View File
@@ -28,7 +28,6 @@
#include "common/file.h"
#include "common/system.h"
#include "mortevielle/dialogs.h"
#include "mortevielle/mor.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/saveload.h"
-1
View File
@@ -30,7 +30,6 @@
#include "mortevielle/speech.h"
#include "mortevielle/sound.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mor.h"
#include "mortevielle/var_mor.h"
namespace Mortevielle {