mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 05:36:12 +00:00
DRASCULA: Clean up room variables, and simplify some related checks
This commit is contained in:
parent
4dbed7742a
commit
2bf05c2a74
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user