[Scummvm-git-logs] scummvm master -> 1f1d860797029dbe58ea4cc282ff3489768965d5
bluegr
bluegr at gmail.com
Sat Nov 11 16:18:08 CET 2017
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1c2a9d2e12 DRASCULA: characterMoved and characterVisible are boolean variables
51cd9b4888 DRASCULA: Remove superfluous variable
d81869af58 DRASCULA: Simplify the drawing code in BJ's room
fd8a86038a DRASCULA: walkToObject is a boolean variable
4dbed7742a DRASCULA: Reduce the scope of framesWithoutAction
2bf05c2a74 DRASCULA: Clean up room variables, and simplify some related checks
1e1b6f7ca4 DRASCULA: Rename gotoObject() to walkToPoint() and simplify it
1f1d860797 DRASCULA: Merge the floor coordinates into _walkRect
Commit: 1c2a9d2e122304b1f6b8ca78b96e34b2a2ed53c8
https://github.com/scummvm/scummvm/commit/1c2a9d2e122304b1f6b8ca78b96e34b2a2ed53c8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:36+02:00
Commit Message:
DRASCULA: characterMoved and characterVisible are boolean variables
Changed paths:
engines/drascula/actors.cpp
engines/drascula/animation.cpp
engines/drascula/drascula.cpp
engines/drascula/drascula.h
engines/drascula/objects.cpp
engines/drascula/rooms.cpp
engines/drascula/saveload.cpp
diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp
index 3b1ac7c..8ab3839 100644
--- a/engines/drascula/actors.cpp
+++ b/engines/drascula/actors.cpp
@@ -105,7 +105,7 @@ void DrasculaEngine::hiccup(int counter) {
}
void DrasculaEngine::startWalking() {
- characterMoved = 1;
+ _characterMoved = true;
stepX = STEP_X;
stepY = STEP_Y;
@@ -124,7 +124,7 @@ void DrasculaEngine::startWalking() {
else if (roomY > curY + curHeight)
walkDown();
else
- characterMoved = 0;
+ _characterMoved = false;
} else {
if ((roomX < curX + curWidth / 2 ) && (roomY <= (curY + curHeight)))
quadrant_1();
@@ -135,7 +135,7 @@ void DrasculaEngine::startWalking() {
else if ((roomX > curX + curWidth / 2) && (roomY > (curY + curHeight)))
quadrant_4();
else
- characterMoved = 0;
+ _characterMoved = false;
}
_startTime = getTime();
}
@@ -144,16 +144,16 @@ void DrasculaEngine::moveCharacters() {
int curPos[6];
int r;
- if (characterMoved == 1 && stepX == STEP_X) {
+ if (_characterMoved && stepX == STEP_X) {
for (r = 0; r < stepX; r++) {
if (currentChapter != 2) {
if (trackProtagonist == 0 && roomX - r == curX + curWidth / 2) {
- characterMoved = 0;
+ _characterMoved = false;
stepX = STEP_X;
stepY = STEP_Y;
}
if (trackProtagonist == 1 && roomX + r == curX + curWidth / 2) {
- characterMoved = 0;
+ _characterMoved = false;
stepX = STEP_X;
stepY = STEP_Y;
curX = roomX - curWidth / 2;
@@ -161,12 +161,12 @@ void DrasculaEngine::moveCharacters() {
}
} else if (currentChapter == 2) {
if (trackProtagonist == 0 && roomX - r == curX) {
- characterMoved = 0;
+ _characterMoved = false;
stepX = STEP_X;
stepY = STEP_Y;
}
if (trackProtagonist == 1 && roomX + r == curX + curWidth) {
- characterMoved = 0;
+ _characterMoved = false;
stepX = STEP_X;
stepY = STEP_Y;
curX = roomX - curWidth + 4;
@@ -175,15 +175,15 @@ void DrasculaEngine::moveCharacters() {
}
}
}
- if (characterMoved == 1 && stepY == STEP_Y) {
+ if (_characterMoved && stepY == STEP_Y) {
for (r = 0; r < stepY; r++) {
if (trackProtagonist == 2 && roomY - r == curY + curHeight) {
- characterMoved = 0;
+ _characterMoved = false;
stepX = STEP_X;
stepY = STEP_Y;
}
if (trackProtagonist == 3 && roomY + r == curY + curHeight) {
- characterMoved = 0;
+ _characterMoved = false;
stepX = STEP_X;
stepY = STEP_Y;
}
@@ -191,13 +191,13 @@ void DrasculaEngine::moveCharacters() {
}
if (currentChapter != 2 && currentChapter != 3) {
- if (characterVisible == 0) {
+ if (!_characterVisible) {
increaseFrameNum();
return;
}
}
- if (characterMoved == 0) {
+ if (!_characterMoved) {
curPos[0] = 0;
curPos[1] = DIF_MASK_HARE;
curPos[2] = curX;
@@ -240,7 +240,7 @@ void DrasculaEngine::moveCharacters() {
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], frontSurface, screenSurface);
}
- } else if (characterMoved == 1) {
+ } else if (_characterMoved) {
curPos[0] = _frameX[_characterFrame];
curPos[1] = frame_y + DIF_MASK_HARE;
curPos[2] = curX;
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index 792b272..b8bbd56 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -363,7 +363,7 @@ void DrasculaEngine::animation_2_1() {
int l;
gotoObject(231, 91);
- characterVisible = 0;
+ _characterVisible = false;
term_int = 0;
@@ -436,7 +436,7 @@ void DrasculaEngine::animation_2_1() {
curX = 91;
curY = 95;
trackProtagonist = 1;
- characterVisible = 1;
+ _characterVisible = true;
loadPic("97g.alg", extraSurface);
if (animate("lev.bin", 15))
@@ -1143,7 +1143,7 @@ void DrasculaEngine::animation_6_3() {
int yoda_x[] = { 3 ,82, 161, 240, 3, 82 };
int yoda_y[] = { 3, 3, 3, 3, 94, 94 };
- characterMoved = 0;
+ _characterMoved = false;
flags[3] = 1;
updateRoom();
updateScreen();
@@ -1239,7 +1239,7 @@ void DrasculaEngine::animation_1_5() {
talk_bj(21);
while (!shouldQuit()) {
- if (characterMoved == 0)
+ if (!_characterMoved)
break;
updateRoom();
updateScreen();
@@ -1437,10 +1437,10 @@ void DrasculaEngine::animation_12_5() {
doBreak = 1;
previousMusic = roomMusic;
- characterVisible = 1;
+ _characterVisible = true;
clearRoom();
trackProtagonist = 1;
- characterMoved = 0;
+ _characterMoved = false;
curX = -1;
objExit = 104;
selectVerb(kVerbNone);
@@ -1547,7 +1547,7 @@ void DrasculaEngine::animation_1_6() {
updateEvents();
clearRoom();
black();
- characterVisible = 0;
+ _characterVisible = false;
flags[0] = 0;
updateRoom();
updateScreen();
@@ -1622,7 +1622,7 @@ void DrasculaEngine::animation_6_6() {
curX = -1;
selectVerb(kVerbNone);
enterRoom(58);
- characterVisible = 1;
+ _characterVisible = true;
trackProtagonist = 1;
animate("hbp.bin", 14);
@@ -2144,7 +2144,7 @@ void DrasculaEngine::animation_5_4(){
loadPic("anh_dr.alg", backSurface);
gotoObject(99, 160);
gotoObject(38, 177);
- characterVisible = 0;
+ _characterVisible = false;
updateRoom();
updateScreen();
delay(800);
@@ -2162,7 +2162,7 @@ void DrasculaEngine::animation_5_4(){
talk_igor(30, kIgorFront);
loadPic(96, frontSurface);
loadPic(99, backSurface);
- characterVisible = 1;
+ _characterVisible = true;
fadeToBlack(0);
exitRoom(0);
}
@@ -2217,7 +2217,7 @@ void DrasculaEngine::activatePendulum() {
debug(4, "activatePendulum()");
flags[1] = 2;
- characterVisible = 0;
+ _characterVisible = false;
_roomNumber = 102;
loadPic(102, bgSurface, HALF_PAL);
loadPic("an_p1.alg", drawSurface3);
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index d0d2790..0f031b1 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -136,11 +136,11 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
frame_y = 0;
curX = 0;
curY = 0;
- characterMoved = 0;
+ _characterMoved = false;
curDirection = 0;
trackProtagonist = 0;
_characterFrame = 0;
- characterVisible = 0;
+ _characterVisible = false;
roomX = 0;
roomY = 0;
checkFlags = 0;
@@ -292,10 +292,10 @@ Common::Error DrasculaEngine::run() {
_hasName = false;
frame_y = 0;
curX = -1;
- characterMoved = 0;
+ _characterMoved = false;
trackProtagonist = 3;
_characterFrame = 0;
- characterVisible = 1;
+ _characterVisible = true;
checkFlags = 1;
doBreak = 0;
walkToObject = 0;
@@ -537,11 +537,11 @@ bool DrasculaEngine::runCurrentChapter() {
showCursor();
while (!shouldQuit()) {
- if (characterMoved == 0) {
+ if (!_characterMoved) {
stepX = STEP_X;
stepY = STEP_Y;
}
- if (characterMoved == 0 && walkToObject == 1) {
+ if (!_characterMoved && walkToObject == 1) {
trackProtagonist = trackFinal;
walkToObject = 0;
}
@@ -629,7 +629,7 @@ bool DrasculaEngine::runCurrentChapter() {
!(currentChapter == 5 && pickedObject == 16)) {
#endif
_rightMouseButton = 0;
- characterMoved = 0;
+ _characterMoved = false;
if (trackProtagonist == 2)
trackProtagonist = 1;
if (currentChapter == 4) {
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 2f8fc86..a74328c 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -435,8 +435,8 @@ public:
int flags[NUM_FLAGS];
int frame_y;
- int curX, curY, characterMoved, curDirection, trackProtagonist, _characterFrame;
- int characterVisible;
+ int curX, curY, curDirection, trackProtagonist, _characterFrame;
+ bool _characterMoved, _characterVisible;
int roomX, roomY, checkFlags;
int doBreak;
int stepX, stepY;
diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp
index 02846ab..4087eee 100644
--- a/engines/drascula/objects.cpp
+++ b/engines/drascula/objects.cpp
@@ -62,7 +62,7 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) {
hideCursor();
if (currentChapter == 5 || currentChapter == 6) {
- if (characterVisible == 0) {
+ if (!_characterVisible) {
curX = roomX;
curY = roomY;
updateRoom();
@@ -78,7 +78,7 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) {
updateRoom();
updateScreen();
updateEvents();
- if (characterMoved == 0)
+ if (!_characterMoved)
break;
pause(3);
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index 57d4517..df41fea 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -980,12 +980,12 @@ bool DrasculaEngine::room_59(int fl) {
playSound(12);
pause(19);
stopSound();
- characterVisible = 0;
+ _characterVisible = false;
updateRoom();
copyRect(101, 34, curX - 4, curY - 1, 37, 70, drawSurface3, screenSurface);
copyBackground(0, 0, 0, 0, 320, 200, screenSurface, bgSurface);
updateScreen();
- characterVisible = 1;
+ _characterVisible = true;
clearRoom();
loadPic("tlef0.alg", bgSurface, COMPLETE_PAL);
loadPic("tlef1.alg", drawSurface3);
@@ -1399,7 +1399,7 @@ void DrasculaEngine::update_58_pre() {
}
void DrasculaEngine::update_58() {
- if (characterVisible == 1)
+ if (_characterVisible)
copyRect(67, 139, 140, 147, 12, 16, drawSurface3, screenSurface);
}
@@ -1524,7 +1524,7 @@ void DrasculaEngine::update_102() {
bool DrasculaEngine::checkAction(int fl) {
hideCursor();
- characterMoved = 0;
+ _characterMoved = false;
updateRoom();
updateScreen();
@@ -1774,7 +1774,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
curX = _destX[objIsExit];
curY = _destY[objIsExit] - curHeight;
}
- characterMoved = 0;
+ _characterMoved = false;
}
loadPic(roomDisk, drawSurface3);
@@ -1833,7 +1833,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
curHeight = (CHARACTER_HEIGHT * factor_red[curY]) / 100;
curWidth = (CHARACTER_WIDTH * factor_red[curY]) / 100;
}
- characterMoved = 0;
+ _characterMoved = false;
}
if (currentChapter == 2) {
@@ -1845,7 +1845,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
}
if (currentChapter == 5)
- characterVisible = 1;
+ _characterVisible = true;
updateVisible();
@@ -1885,7 +1885,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
if (currentChapter == 5) {
if (_roomNumber == 45)
- characterVisible = 0;
+ _characterVisible = false;
if (_roomNumber == 49 && flags[7] == 0) {
playTalkSequence(4); // sequence 4, chapter 5
}
@@ -1925,7 +1925,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
updateRoom();
updateScreen();
}
- characterMoved = 0;
+ _characterMoved = false;
trackProtagonist = trackCharacter_alkeva[doorNumber];
objExit = roomExits[doorNumber];
doBreak = 1;
@@ -1961,7 +1961,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
}
if (currentChapter == 5)
- characterVisible = 1;
+ _characterVisible = true;
clearRoom();
if (!sscanf(_targetSurface[doorNumber], "%d", &roomNum)) {
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp
index f0484e2..01c7ab7 100644
--- a/engines/drascula/saveload.cpp
+++ b/engines/drascula/saveload.cpp
@@ -281,7 +281,7 @@ bool DrasculaEngine::loadGame(int slot) {
// things. Reset those before loading the savegame otherwise we may have some
// issues such as the protagonist being invisible after reloading a savegame.
if (_roomNumber == 102 && flags[1] == 2) {
- characterVisible = 1;
+ _characterVisible = true;
loadPic(96, frontSurface);
loadPic(97, frontSurface);
loadPic(97, extraSurface);
Commit: 51cd9b488856dea791079ca6681c16c64d9d14d8
https://github.com/scummvm/scummvm/commit/51cd9b488856dea791079ca6681c16c64d9d14d8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:36+02:00
Commit Message:
DRASCULA: Remove superfluous variable
Changed paths:
engines/drascula/objects.cpp
engines/drascula/saveload.cpp
diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp
index 4087eee..33d3674 100644
--- a/engines/drascula/objects.cpp
+++ b/engines/drascula/objects.cpp
@@ -97,7 +97,9 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) {
}
void DrasculaEngine::checkObjects() {
- int l, veo = 0;
+ int l;
+
+ _hasName = false;
for (l = 0; l < numRoomObjs; l++) {
if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l]
@@ -105,21 +107,16 @@ void DrasculaEngine::checkObjects() {
&& visible[l] == 1 && isDoor[l] == 0) {
strcpy(textName, objName[l]);
_hasName = true;
- veo = 1;
}
}
if (_mouseX > curX + 2 && _mouseY > curY + 2
&& _mouseX < curX + curWidth - 2 && _mouseY < curY + curHeight - 2) {
- if (currentChapter == 2 || veo == 0) {
+ if (currentChapter == 2 || !_hasName) {
strcpy(textName, "hacker");
_hasName = true;
- veo = 1;
}
}
-
- if (veo == 0)
- _hasName = false;
}
/**
@@ -265,9 +262,8 @@ void DrasculaEngine::updateVisible() {
}
if (_roomNumber == 22 && flags[27] == 1)
visible[3] = 0;
- if (_roomNumber == 26 && flags[21] == 0) {
+ if (_roomNumber == 26 && flags[21] == 0)
Common::strlcpy(objName[2], _textmisc[0], 20);
- }
if (_roomNumber == 26 && flags[18] == 1)
visible[2] = 0;
if (_roomNumber == 26 && flags[12] == 1)
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp
index 01c7ab7..d54c337 100644
--- a/engines/drascula/saveload.cpp
+++ b/engines/drascula/saveload.cpp
@@ -317,9 +317,8 @@ bool DrasculaEngine::loadGame(int slot) {
takeObject = in->readSint32LE();
pickedObject = in->readSint32LE();
_loadedDifferentChapter = false;
- if (!sscanf(currentData, "%d.ald", &roomNum)) {
+ if (!sscanf(currentData, "%d.ald", &roomNum))
error("Bad save format");
- }
// When loading room 102 while being attached below the pendulum Some variables
// are not correctly set and can cause random crashes when calling enterRoom below.
Commit: d81869af58b3b8216447a2e77fd6302c21e6550e
https://github.com/scummvm/scummvm/commit/d81869af58b3b8216447a2e77fd6302c21e6550e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:36+02:00
Commit Message:
DRASCULA: Simplify the drawing code in BJ's room
Changed paths:
engines/drascula/actors.cpp
engines/drascula/animation.cpp
engines/drascula/drascula.cpp
engines/drascula/drascula.h
engines/drascula/rooms.cpp
engines/drascula/talk.cpp
diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp
index 8ab3839..a6f04d1 100644
--- a/engines/drascula/actors.cpp
+++ b/engines/drascula/actors.cpp
@@ -55,17 +55,6 @@ void DrasculaEngine::placeDrascula() {
copyRect(drX, 122, drasculaX, drasculaY, 45, 77, backSurface, screenSurface);
}
-void DrasculaEngine::placeBJ() {
- int bX = 0;
-
- if (trackBJ == 3)
- bX = 10;
- else if (trackBJ == 0)
- bX = 37;
-
- copyRect(bX, 99, bjX, bjY, 26, 76, drawSurface3, screenSurface);
-}
-
void DrasculaEngine::hiccup(int counter) {
int y = 0, trackCharacter = 0;
if (currentChapter == 3)
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index b8bbd56..2e70b0f 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -430,9 +430,6 @@ void DrasculaEngine::animation_2_1() {
break;
for (l = 0; l < 200; l++)
factor_red[l] = 99;
- bjX = 170;
- bjY = 90;
- trackBJ = 0;
curX = 91;
curY = 95;
trackProtagonist = 1;
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 0f031b1..b6d5084 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -70,9 +70,6 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
_talkSequences = 0;
_currentSaveSlot = 0;
- bjX = 0;
- bjY = 0;
- trackBJ = 0;
framesWithoutAction = 0;
term_int = 0;
currentChapter = 0;
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index a74328c..9129e52 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -456,7 +456,6 @@ public:
int blinking;
int igorX, igorY, trackIgor;
int drasculaX, drasculaY, trackDrascula;
- int bjX, bjY, trackBJ;
int framesWithoutAction;
int term_int;
int currentChapter;
@@ -526,7 +525,6 @@ public:
bool animate(const char *animation, int FPS);
void pause(int);
void placeIgor();
- void placeBJ();
void placeDrascula();
void talkInit(const char *filename);
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index df41fea..8418135 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -1153,9 +1153,6 @@ void DrasculaEngine::updateRefresh_pre() {
break;
}
}
-
- if (currentChapter == 1 && _roomNumber == 16)
- placeBJ();
}
void DrasculaEngine::update_1_pre() {
@@ -1309,15 +1306,15 @@ void DrasculaEngine::update_14_pre() {
}
void DrasculaEngine::update_16_pre() {
- if (currentChapter != 2) {
- debug(4, "update_16_pre: Special case, current chapter is not 2, not performing update");
- return;
+ if (currentChapter == 1) {
+ // Place BJ
+ copyRect(37, 99, 170, 90, 26, 76, drawSurface3, screenSurface);
+ } else if (currentChapter == 2) {
+ if (flags[17] == 0)
+ copyBackground(1, 103, 24, 72, 33, 95, drawSurface3, screenSurface);
+ if (flags[19] == 1)
+ copyBackground(37, 151, 224, 115, 56, 47, drawSurface3, screenSurface);
}
-
- if (flags[17] == 0)
- copyBackground(1, 103, 24, 72, 33, 95, drawSurface3, screenSurface);
- if (flags[19] == 1)
- copyBackground(37, 151, 224, 115, 56, 47, drawSurface3, screenSurface);
}
void DrasculaEngine::update_18_pre() {
@@ -1678,9 +1675,8 @@ void DrasculaEngine::enterRoom(int roomIndex) {
strcpy(currentData, fileName);
Common::SeekableReadStream *stream = _archives.open(fileName);
- if (!stream) {
+ if (!stream)
error("missing data file %s", fileName);
- }
TextResourceParser p(stream, DisposeAfterUse::YES);
diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp
index 7ac2cc6..aa79dab 100644
--- a/engines/drascula/talk.cpp
+++ b/engines/drascula/talk.cpp
@@ -338,14 +338,14 @@ void DrasculaEngine::talk_bj(int index) {
updateRefresh_pre();
- copyBackground(bjX + 2, bjY - 1, bjX + 2, bjY - 1, 27, 40, bgSurface, screenSurface);
+ copyBackground(170 + 2, 90 - 1, 170 + 2, 90 - 1, 27, 40, bgSurface, screenSurface);
- copyRect(x_talk[face], 99, bjX + 2, bjY - 1, 27, 40, drawSurface3, screenSurface);
+ copyRect(x_talk[face], 99, 170 + 2, 90 - 1, 27, 40, drawSurface3, screenSurface);
moveCharacters();
updateRefresh();
if (!_subtitlesDisabled)
- centerText(said, bjX + 7, bjY);
+ centerText(said, 170 + 7, 90);
updateScreen();
Commit: fd8a86038aab1876a2c71e773a92195db5e2db53
https://github.com/scummvm/scummvm/commit/fd8a86038aab1876a2c71e773a92195db5e2db53
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:37+02:00
Commit Message:
DRASCULA: walkToObject is a boolean variable
Changed paths:
engines/drascula/animation.cpp
engines/drascula/drascula.cpp
engines/drascula/drascula.h
engines/drascula/objects.cpp
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index 2e70b0f..b48060a 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -1230,7 +1230,7 @@ void DrasculaEngine::animation_1_5() {
talk(438);
roomX = 120;
roomY = 157;
- walkToObject = 1;
+ _walkToObject = true;
trackFinal = 1;
startWalking();
talk_bj(21);
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index b6d5084..e442681 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -102,7 +102,7 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
lowerLimit = 0;
upperLimit = 0;
trackFinal = 0;
- walkToObject = 0;
+ _walkToObject = false;
objExit = 0;
_startTime = 0;
hasAnswer = 0;
@@ -295,7 +295,7 @@ Common::Error DrasculaEngine::run() {
_characterVisible = true;
checkFlags = 1;
doBreak = 0;
- walkToObject = 0;
+ _walkToObject = false;
stepX = STEP_X;
stepY = STEP_Y;
@@ -538,9 +538,9 @@ bool DrasculaEngine::runCurrentChapter() {
stepX = STEP_X;
stepY = STEP_Y;
}
- if (!_characterMoved && walkToObject == 1) {
+ if (!_characterMoved && _walkToObject) {
trackProtagonist = trackFinal;
- walkToObject = 0;
+ _walkToObject = false;
}
if (currentChapter == 2) {
@@ -554,10 +554,10 @@ bool DrasculaEngine::runCurrentChapter() {
gotoObject(178, 121);
gotoObject(169, 135);
} else if (_roomNumber == 14 && (curX == 214) && (curY + curHeight == 121)) {
- walkToObject = 1;
+ _walkToObject = true;
gotoObject(190, 130);
} else if (_roomNumber == 14 && (curX == 246) && (curY + curHeight == 112)) {
- walkToObject = 1;
+ _walkToObject = true;
gotoObject(190, 130);
}
}
@@ -765,7 +765,7 @@ bool DrasculaEngine::verify1() {
roomY = roomObjY[l];
trackFinal = trackObj[l];
doBreak = 1;
- walkToObject = 1;
+ _walkToObject = true;
startWalking();
}
}
@@ -796,7 +796,7 @@ bool DrasculaEngine::verify2() {
if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l]
&& _mouseX < _objectX2[l] && _mouseY < _objectY2[l] && visible[l] == 1) {
trackFinal = trackObj[l];
- walkToObject = 1;
+ _walkToObject = true;
gotoObject(roomObjX[l], roomObjY[l]);
if (checkAction(objectNum[l]))
return true;
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 9129e52..be27ae6 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -443,7 +443,8 @@ public:
int curHeight, curWidth, feetHeight;
int floorX1, floorY1, floorX2, floorY2;
int lowerLimit, upperLimit;
- int trackFinal, walkToObject;
+ int trackFinal;
+ bool _walkToObject;
int objExit;
int _startTime;
int hasAnswer;
diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp
index 33d3674..300d477 100644
--- a/engines/drascula/objects.cpp
+++ b/engines/drascula/objects.cpp
@@ -84,8 +84,8 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) {
pause(3);
}
- if (walkToObject == 1) {
- walkToObject = 0;
+ if (_walkToObject) {
+ _walkToObject = false;
trackProtagonist = trackFinal;
}
updateRoom();
Commit: 4dbed7742afea3afc414d9550378f5c98709ad29
https://github.com/scummvm/scummvm/commit/4dbed7742afea3afc414d9550378f5c98709ad29
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:37+02:00
Commit Message:
DRASCULA: Reduce the scope of framesWithoutAction
Changed paths:
engines/drascula/drascula.cpp
engines/drascula/drascula.h
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index e442681..1f3f0c6 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -70,7 +70,6 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
_talkSequences = 0;
_currentSaveSlot = 0;
- framesWithoutAction = 0;
term_int = 0;
currentChapter = 0;
_loadedDifferentChapter = false;
@@ -310,7 +309,6 @@ Common::Error DrasculaEngine::run() {
vonBraunX = 120;
trackVonBraun = 1;
vonBraunHasMoved = 0;
- framesWithoutAction = 0;
term_int = 0;
musicStopped = 0;
globalSpeed = 0;
@@ -399,6 +397,7 @@ void DrasculaEngine::endChapter() {
bool DrasculaEngine::runCurrentChapter() {
int n;
+ int framesWithoutAction = 0;
_rightMouseButton = 0;
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index be27ae6..d493a9d 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -457,7 +457,6 @@ public:
int blinking;
int igorX, igorY, trackIgor;
int drasculaX, drasculaY, trackDrascula;
- int framesWithoutAction;
int term_int;
int currentChapter;
bool _loadedDifferentChapter;
Commit: 2bf05c2a746065f373ac136c994714dae376cdbc
https://github.com/scummvm/scummvm/commit/2bf05c2a746065f373ac136c994714dae376cdbc
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:38+02:00
Commit Message:
DRASCULA: Clean up room variables, and simplify some related checks
Changed paths:
engines/drascula/drascula.cpp
engines/drascula/drascula.h
engines/drascula/interface.cpp
engines/drascula/objects.cpp
engines/drascula/rooms.cpp
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 1f3f0c6..bf333d6 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -744,8 +744,7 @@ bool DrasculaEngine::verify1() {
removeObject();
else {
for (l = 0; l < numRoomObjs; l++) {
- if (_mouseX >= _objectX1[l] && _mouseY >= _objectY1[l]
- && _mouseX <= _objectX2[l] && _mouseY <= _objectY2[l] && doBreak == 0) {
+ if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && doBreak == 0) {
if (exitRoom(l))
return true;
if (doBreak == 1)
@@ -758,10 +757,9 @@ bool DrasculaEngine::verify1() {
doBreak = 1;
for (l = 0; l < numRoomObjs; l++) {
- if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l]
- && _mouseX < _objectX2[l] && _mouseY < _objectY2[l] && doBreak == 0) {
- roomX = roomObjX[l];
- roomY = roomObjY[l];
+ if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && doBreak == 0) {
+ roomX = _roomObject[l].x;
+ roomY = _roomObject[l].y;
trackFinal = trackObj[l];
doBreak = 1;
_walkToObject = true;
@@ -792,11 +790,10 @@ bool DrasculaEngine::verify2() {
return true;
} else {
for (l = 0; l < numRoomObjs; l++) {
- if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l]
- && _mouseX < _objectX2[l] && _mouseY < _objectY2[l] && visible[l] == 1) {
+ if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && visible[l] == 1) {
trackFinal = trackObj[l];
_walkToObject = true;
- gotoObject(roomObjX[l], roomObjY[l]);
+ gotoObject(_roomObject[l].x, _roomObject[l].y);
if (checkAction(objectNum[l]))
return true;
if (currentChapter == 4)
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index d493a9d..848b807 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -420,11 +420,13 @@ public:
char iconName[44][13];
int objectNum[40], visible[40], isDoor[40];
- int roomObjX[40], roomObjY[40], trackObj[40];
+ int trackObj[40];
+ Common::Point _roomObject[40];
int inventoryObjects[43];
- char _targetSurface[40][20];
- int _destX[40], _destY[40], trackCharacter_alkeva[40], roomExits[40];
- int _objectX1[40], _objectY1[40], _objectX2[40], _objectY2[40];
+ int _doorDestRoom[40];
+ Common::Point _doorDestPoint[40];
+ int trackCharacter_alkeva[40], _roomExitId[40];
+ Common::Rect _objectRect[40];
int takeObject, pickedObject;
bool _subtitlesDisabled;
bool _menuBar, _menuScreen, _hasName;
diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp
index 07f192c..a0656e1 100644
--- a/engines/drascula/interface.cpp
+++ b/engines/drascula/interface.cpp
@@ -165,9 +165,7 @@ void DrasculaEngine::showMap() {
_hasName = false;
for (int l = 0; l < numRoomObjs; l++) {
- if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l]
- && _mouseX < _objectX2[l] && _mouseY < _objectY2[l]
- && visible[l] == 1) {
+ if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && visible[l] == 1) {
strcpy(textName, objName[l]);
_hasName = true;
}
diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp
index 300d477..1a87a55 100644
--- a/engines/drascula/objects.cpp
+++ b/engines/drascula/objects.cpp
@@ -102,9 +102,7 @@ void DrasculaEngine::checkObjects() {
_hasName = false;
for (l = 0; l < numRoomObjs; l++) {
- if (_mouseX > _objectX1[l] && _mouseY > _objectY1[l]
- && _mouseX < _objectX2[l] && _mouseY < _objectY2[l]
- && visible[l] == 1 && isDoor[l] == 0) {
+ if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && visible[l] == 1 && isDoor[l] == 0) {
strcpy(textName, objName[l]);
_hasName = true;
}
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index 8418135..b4de3c51 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -1705,24 +1705,29 @@ void DrasculaEngine::enterRoom(int roomIndex) {
p.parseInt(numRoomObjs);
+ int x1, y1, x2, y2;
+
for (l = 0; l < numRoomObjs; l++) {
p.parseInt(objectNum[l]);
p.parseString(objName[l]);
- p.parseInt(_objectX1[l]);
- p.parseInt(_objectY1[l]);
- p.parseInt(_objectX2[l]);
- p.parseInt(_objectY2[l]);
- p.parseInt(roomObjX[l]);
- p.parseInt(roomObjY[l]);
+ p.parseInt(x1);
+ p.parseInt(y1);
+ p.parseInt(x2);
+ p.parseInt(y2);
+ _objectRect[l] = Common::Rect(x1, y1, x2, y2);
+ p.parseInt(x1);
+ p.parseInt(y1);
+ _roomObject[l] = Common::Point(x1, y1);
p.parseInt(trackObj[l]);
p.parseInt(visible[l]);
p.parseInt(isDoor[l]);
if (isDoor[l] != 0) {
- p.parseString(_targetSurface[l]);
- p.parseInt(_destX[l]);
- p.parseInt(_destY[l]);
+ p.parseInt(_doorDestRoom[l]);
+ p.parseInt(x1);
+ p.parseInt(y1);
+ _doorDestPoint[l] = Common::Point(x1, y1);
p.parseInt(trackCharacter_alkeva[l]);
- p.parseInt(roomExits[l]);
+ p.parseInt(_roomExitId[l]);
updateDoor(l);
}
}
@@ -1767,8 +1772,8 @@ void DrasculaEngine::enterRoom(int roomIndex) {
if (currentChapter == 2) {
if (curX == -1) {
- curX = _destX[objIsExit];
- curY = _destY[objIsExit] - curHeight;
+ curX = _doorDestPoint[objIsExit].x;
+ curY = _doorDestPoint[objIsExit].y - curHeight;
}
_characterMoved = false;
}
@@ -1820,8 +1825,8 @@ void DrasculaEngine::enterRoom(int roomIndex) {
if (currentChapter != 2) {
if (curX == -1) {
- curX = _destX[objIsExit];
- curY = _destY[objIsExit];
+ curX = _doorDestPoint[objIsExit].x;
+ curY = _doorDestPoint[objIsExit].y;
curHeight = (CHARACTER_HEIGHT * factor_red[curY]) / 100;
curWidth = (CHARACTER_WIDTH * factor_red[curY]) / 100;
curY = curY - curHeight;
@@ -1915,7 +1920,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
((currentChapter != 3 && currentChapter != 5) || visible[doorNumber] == 1)) {
hideCursor();
- gotoObject(roomObjX[doorNumber], roomObjY[doorNumber]);
+ gotoObject(_roomObject[doorNumber].x, _roomObject[doorNumber].y);
if (currentChapter != 2) {
trackProtagonist = trackObj[doorNumber];
updateRoom();
@@ -1923,7 +1928,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
}
_characterMoved = false;
trackProtagonist = trackCharacter_alkeva[doorNumber];
- objExit = roomExits[doorNumber];
+ objExit = _roomExitId[doorNumber];
doBreak = 1;
previousMusic = roomMusic;
@@ -1960,9 +1965,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
_characterVisible = true;
clearRoom();
- if (!sscanf(_targetSurface[doorNumber], "%d", &roomNum)) {
- error("Malformed roomNum in targetSurface (%s)", _targetSurface[doorNumber]);
- }
+ roomNum = _doorDestRoom[doorNumber];
curX = -1;
enterRoom(roomNum);
Commit: 1e1b6f7ca45eaa7911359337fd0e12fb19249e03
https://github.com/scummvm/scummvm/commit/1e1b6f7ca45eaa7911359337fd0e12fb19249e03
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:38+02:00
Commit Message:
DRASCULA: Rename gotoObject() to walkToPoint() and simplify it
Changed paths:
engines/drascula/animation.cpp
engines/drascula/drascula.cpp
engines/drascula/drascula.h
engines/drascula/objects.cpp
engines/drascula/rooms.cpp
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index b48060a..cb83292 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -362,7 +362,7 @@ void DrasculaEngine::animation_2_1() {
int l;
- gotoObject(231, 91);
+ walkToPoint(Common::Point(231, 91));
_characterVisible = false;
term_int = 0;
@@ -439,7 +439,7 @@ void DrasculaEngine::animation_2_1() {
if (animate("lev.bin", 15))
break;
- gotoObject(100 + curWidth / 2, 99 + curHeight);
+ walkToPoint(Common::Point(100 + curWidth / 2, 99 + curHeight));
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE) || shouldQuit())
break;
trackProtagonist = 1;
@@ -484,7 +484,7 @@ void DrasculaEngine::animation_2_1() {
pause(118);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE) || shouldQuit())
break;
- gotoObject(132, 97 + curHeight);
+ walkToPoint(Common::Point(132, 97 + curHeight));
pause(60);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE) || shouldQuit())
break;
@@ -492,7 +492,7 @@ void DrasculaEngine::animation_2_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE) || shouldQuit())
break;
talk_bj(12);
- gotoObject(157, 98 + curHeight);
+ walkToPoint(Common::Point(157, 98 + curHeight));
if (animate("bes.bin", 16))
break;
playMusic(11);
@@ -880,8 +880,8 @@ void DrasculaEngine::animation_23_2() {
trackVonBraun = 1;
talk_vonBraun(16, kVonBraunNormal);
trackVonBraun = 2;
- gotoObject(157, 147);
- gotoObject(131, 149);
+ walkToPoint(Common::Point(157, 147));
+ walkToPoint(Common::Point(131, 149));
trackProtagonist = 0;
animation_14_2();
if (flags[25] == 0)
@@ -1024,7 +1024,7 @@ void DrasculaEngine::animation_31_2() {
talk_vonBraun(44, kVonBraunNormal);
placeVonBraun(-50);
pause(15);
- gotoObject(159, 140);
+ walkToPoint(Common::Point(159, 140));
loadPic(99, backSurface);
playTalkSequence(31); // sequence 31, chapter 2
@@ -1041,8 +1041,8 @@ void DrasculaEngine::animation_31_2() {
void DrasculaEngine::animation_35_2() {
debug(4, "animation_35_2()");
- gotoObject(96, 165);
- gotoObject(79, 165);
+ walkToPoint(Common::Point(96, 165));
+ walkToPoint(Common::Point(79, 165));
updateRoom();
updateScreen();
@@ -1130,7 +1130,7 @@ void DrasculaEngine::animation_2_3() {
loadPic(97, extraSurface);
loadPic(99, backSurface);
- gotoObject(332, 127);
+ walkToPoint(Common::Point(332, 127));
}
void DrasculaEngine::animation_6_3() {
@@ -1221,7 +1221,7 @@ void DrasculaEngine::animation_1_5() {
talk_bj(19);
talk(229);
pause(5);
- gotoObject(114, 170);
+ walkToPoint(Common::Point(114, 170));
trackProtagonist = 3;
talk(431);
talk_bj(20);
@@ -1265,7 +1265,7 @@ void DrasculaEngine::animation_5_5(){
selectVerb(kVerbNone);
removeObject(8);
- gotoObject(curX - 19, curY + curHeight);
+ walkToPoint(Common::Point(curX - 19, curY + curHeight));
trackProtagonist = 1;
updateRoom();
updateScreen();
@@ -1429,8 +1429,8 @@ void DrasculaEngine::animation_12_5() {
loadPic(99, backSurface);
- gotoObject(40, 169);
- gotoObject(-14, 175);
+ walkToPoint(Common::Point(40, 169));
+ walkToPoint(Common::Point(-14, 175));
doBreak = 1;
previousMusic = roomMusic;
@@ -1487,7 +1487,7 @@ void DrasculaEngine::animation_14_5() {
pause(17);
trackProtagonist = 3;
talk(246);
- gotoObject(89, 160);
+ walkToPoint(Common::Point(89, 160));
flags[10] = 1;
playSound(7);
updateRoom();
@@ -1659,7 +1659,7 @@ void DrasculaEngine::animation_9_6() {
updateScreen();
fadeFromBlack(0);
pause(96);
- gotoObject(116, 178);
+ walkToPoint(Common::Point(116, 178));
trackProtagonist = 2;
updateRoom();
updateScreen();
@@ -1844,7 +1844,7 @@ void DrasculaEngine::animation_24_2() {
debug(4, "animation_24_2()");
if (curX < 178)
- gotoObject(208, 136);
+ walkToPoint(Common::Point(208, 136));
trackProtagonist = 3;
updateRoom();
pause(3);
@@ -2139,8 +2139,8 @@ void DrasculaEngine::animation_5_4(){
trackProtagonist = 3;
loadPic("anh_dr.alg", backSurface);
- gotoObject(99, 160);
- gotoObject(38, 177);
+ walkToPoint(Common::Point(99, 160));
+ walkToPoint(Common::Point(38, 177));
_characterVisible = false;
updateRoom();
updateScreen();
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index bf333d6..bb126e5 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -444,7 +444,7 @@ bool DrasculaEngine::runCurrentChapter() {
enterRoom(62);
curX = -20;
curY = 56;
- gotoObject(65, 145);
+ walkToPoint(Common::Point(65, 145));
}
// REMINDER: This is a good place to debug animations
@@ -550,14 +550,14 @@ bool DrasculaEngine::runCurrentChapter() {
// made the character start walking off screen, as his actual position was
// different than the displayed one
if (_roomNumber == 3 && (curX == 279) && (curY + curHeight == 101)) {
- gotoObject(178, 121);
- gotoObject(169, 135);
+ walkToPoint(Common::Point(178, 121));
+ walkToPoint(Common::Point(169, 135));
} else if (_roomNumber == 14 && (curX == 214) && (curY + curHeight == 121)) {
_walkToObject = true;
- gotoObject(190, 130);
+ walkToPoint(Common::Point(190, 130));
} else if (_roomNumber == 14 && (curX == 246) && (curY + curHeight == 112)) {
_walkToObject = true;
- gotoObject(190, 130);
+ walkToPoint(Common::Point(190, 130));
}
}
@@ -793,7 +793,7 @@ bool DrasculaEngine::verify2() {
if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && visible[l] == 1) {
trackFinal = trackObj[l];
_walkToObject = true;
- gotoObject(_roomObject[l].x, _roomObject[l].y);
+ walkToPoint(_roomObject[l]);
if (checkAction(objectNum[l]))
return true;
if (currentChapter == 4)
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 848b807..090ab65 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -487,7 +487,7 @@ public:
void enterRoom(int);
void clearRoom();
- void gotoObject(int, int);
+ void walkToPoint(Common::Point pos);
void moveCursor();
void checkObjects();
void selectVerbFromBar();
diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp
index 1a87a55..2a24e02 100644
--- a/engines/drascula/objects.cpp
+++ b/engines/drascula/objects.cpp
@@ -57,7 +57,7 @@ void DrasculaEngine::chooseObject(int object) {
pickedObject = object;
}
-void DrasculaEngine::gotoObject(int pointX, int pointY) {
+void DrasculaEngine::walkToPoint(Common::Point pos) {
bool cursorVisible = isCursorVisible();
hideCursor();
@@ -70,8 +70,8 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) {
return;
}
}
- roomX = pointX;
- roomY = pointY;
+ roomX = pos.x;
+ roomY = pos.y;
startWalking();
while (!shouldQuit()) {
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index b4de3c51..c6632f5 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -690,7 +690,7 @@ bool DrasculaEngine::room_26(int fl) {
else if (pickedObject == 16 && fl == 50 && flags[18] == 1 && flags[12] == 1)
animation_5_4();
else if (pickedObject == kVerbPick && fl == 143 && flags[18] == 1) {
- gotoObject(260, 180);
+ walkToPoint(Common::Point(260, 180));
pickObject(10);
visible[1] = 0;
flags[12] = 1;
@@ -699,14 +699,14 @@ bool DrasculaEngine::room_26(int fl) {
talk_igor(27, kIgorDoor);
flags[30] = 1;
talk_igor(28, kIgorDoor);
- gotoObject(153, 180);
+ walkToPoint(Common::Point(153, 180));
} else if (pickedObject == kVerbPick && fl == 143 && flags[18] == 0) {
- gotoObject(260, 180);
+ walkToPoint(Common::Point(260, 180));
copyBackground(80, 78, 199, 94, 38, 27, drawSurface3, screenSurface);
updateScreen(199, 94, 199, 94, 38, 27, screenSurface);
pause(3);
talk_igor(25, kIgorWig);
- gotoObject(153, 180);
+ walkToPoint(Common::Point(153, 180));
} else if (pickedObject == kVerbTalk && fl == 51)
animation_1_4();
else
@@ -927,7 +927,7 @@ bool DrasculaEngine::room_55(int fl) {
playSound(11);
animate("det.bin", 17);
finishSound();
- gotoObject(curX - 3, curY + curHeight + 6);
+ walkToPoint(Common::Point(curX - 3, curY + curHeight + 6));
} else
hasAnswer = 0;
@@ -972,7 +972,7 @@ bool DrasculaEngine::room_59(int fl) {
delay(40);
finishSound();
delay(10);
- gotoObject(174, 168);
+ walkToPoint(Common::Point(174, 168));
trackProtagonist = 2;
updateRoom();
updateScreen();
@@ -1920,7 +1920,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
((currentChapter != 3 && currentChapter != 5) || visible[doorNumber] == 1)) {
hideCursor();
- gotoObject(_roomObject[doorNumber].x, _roomObject[doorNumber].y);
+ walkToPoint(_roomObject[doorNumber]);
if (currentChapter != 2) {
trackProtagonist = trackObj[doorNumber];
updateRoom();
@@ -1940,8 +1940,8 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
if (objectNum[doorNumber] == 136)
animation_2_2();
if (objectNum[doorNumber] == 124) {
- gotoObject(163, 106);
- gotoObject(287, 101);
+ walkToPoint(Common::Point(163, 106));
+ walkToPoint(Common::Point(287, 101));
trackProtagonist = 0;
}
if (objectNum[doorNumber] == 173) {
@@ -1958,7 +1958,7 @@ bool DrasculaEngine::exitRoom(int doorNumber) {
addObject(kItemEarplugs);
}
} else if (currentChapter == 4 && objectNum[doorNumber] == 108) {
- gotoObject(171, 78);
+ walkToPoint(Common::Point(171, 78));
}
if (currentChapter == 5)
Commit: 1f1d860797029dbe58ea4cc282ff3489768965d5
https://github.com/scummvm/scummvm/commit/1f1d860797029dbe58ea4cc282ff3489768965d5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-11-11T17:14:38+02:00
Commit Message:
DRASCULA: Merge the floor coordinates into _walkRect
Changed paths:
engines/drascula/drascula.cpp
engines/drascula/drascula.h
engines/drascula/rooms.cpp
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index bb126e5..3f840b0 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -94,10 +94,6 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
_talkSequencesSize = 0;
_numLangs = 0;
feetHeight = 0;
- floorX1 = 0;
- floorY1 = 0;
- floorX2 = 0;
- floorY2 = 0;
lowerLimit = 0;
upperLimit = 0;
trackFinal = 0;
@@ -768,8 +764,8 @@ bool DrasculaEngine::verify1() {
}
if (doBreak == 0) {
- roomX = CLIP(_mouseX, floorX1, floorX2);
- roomY = CLIP(_mouseY, floorY1 + feetHeight, floorY2);
+ roomX = CLIP<int16>(_mouseX, _walkRect.left, _walkRect.right);
+ roomY = CLIP<int16>(_mouseY, _walkRect.top + feetHeight, _walkRect.bottom);
startWalking();
}
doBreak = 0;
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 090ab65..fa96fb5 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -443,7 +443,7 @@ public:
int doBreak;
int stepX, stepY;
int curHeight, curWidth, feetHeight;
- int floorX1, floorY1, floorX2, floorY2;
+ Common::Rect _walkRect;
int lowerLimit, upperLimit;
int trackFinal;
bool _walkToObject;
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index c6632f5..b8dc51e 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -1732,10 +1732,11 @@ void DrasculaEngine::enterRoom(int roomIndex) {
}
}
- p.parseInt(floorX1);
- p.parseInt(floorY1);
- p.parseInt(floorX2);
- p.parseInt(floorY2);
+ p.parseInt(x1);
+ p.parseInt(y1);
+ p.parseInt(x2);
+ p.parseInt(y2);
+ _walkRect = Common::Rect(x1, y1, x2, y2);
if (currentChapter != 2) {
p.parseInt(upperLimit);
@@ -1797,27 +1798,27 @@ void DrasculaEngine::enterRoom(int roomIndex) {
color_abc(kColorLightGreen);
if (currentChapter != 2) {
- for (l = 0; l <= floorY1; l++)
+ for (l = 0; l <= _walkRect.top; l++)
factor_red[l] = upperLimit;
- for (l = floorY1; l <= 201; l++)
+ for (l = _walkRect.top; l <= 201; l++)
factor_red[l] = lowerLimit;
- chiquez = (float)(lowerLimit - upperLimit) / (float)(floorY2 - floorY1);
- for (l = floorY1; l <= floorY2; l++) {
+ chiquez = (float)(lowerLimit - upperLimit) / (float)(_walkRect.bottom - _walkRect.top);
+ for (l = _walkRect.top; l <= _walkRect.bottom; l++) {
factor_red[l] = (int)(upperLimit + pequegnez);
pequegnez = pequegnez + chiquez;
}
}
if (_roomNumber == 24) {
- for (l = floorY1 - 1; l > 74; l--) {
+ for (l = _walkRect.top - 1; l > 74; l--) {
factor_red[l] = (int)(upperLimit - pequegnez);
pequegnez = pequegnez + chiquez;
}
}
if (currentChapter == 5 && _roomNumber == 54) {
- for (l = floorY1 - 1; l > 84; l--) {
+ for (l = _walkRect.top - 1; l > 84; l--) {
factor_red[l] = (int)(upperLimit - pequegnez);
pequegnez = pequegnez + chiquez;
}
More information about the Scummvm-git-logs
mailing list