aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-07-12 08:04:06 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit278e0b6647bd9cc46818771da86a2fadb30cd123 (patch)
tree3d008178cdfb15f6ee891169e2fb6c0a00da4b83
parent9aa6c28fabd95d3aeaf5840386fb5d3327247d62 (diff)
downloadscummvm-rg350-278e0b6647bd9cc46818771da86a2fadb30cd123.tar.gz
scummvm-rg350-278e0b6647bd9cc46818771da86a2fadb30cd123.tar.bz2
scummvm-rg350-278e0b6647bd9cc46818771da86a2fadb30cd123.zip
DM: Add f252_timelineProcessEvents60to61_moveGroup
-rw-r--r--engines/dm/group.cpp8
-rw-r--r--engines/dm/group.h6
-rw-r--r--engines/dm/timeline.cpp46
-rw-r--r--engines/dm/timeline.h1
4 files changed, 55 insertions, 6 deletions
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index 73c21198ac..49ac924333 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1809,4 +1809,12 @@ Thing GroupMan::f185_groupGetGenerated(int16 creatureType, int16 healthMultiplie
warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
return L0349_T_GroupThing;
}
+
+bool GroupMan::f223_isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY) {
+ int16 L0544_i_SquareType;
+
+ return (((L0544_i_SquareType = Square(_vm->_dungeonMan->f151_getSquare(mapX, mapY)).getType()) == k1_CorridorElemType)
+ || (L0544_i_SquareType == k5_ElementTypeTeleporter) || (L0544_i_SquareType == k2_ElementTypePit) || (L0544_i_SquareType == k4_DoorElemType));
+}
+
}
diff --git a/engines/dm/group.h b/engines/dm/group.h
index 6153d514d2..242e52768d 100644
--- a/engines/dm/group.h
+++ b/engines/dm/group.h
@@ -235,11 +235,7 @@ public:
void f194_removeAllActiveGroups(); // @ F0194_GROUP_RemoveAllActiveGroups
void f195_addAllActiveGroups(); // @ F0195_GROUP_AddAllActiveGroups
Thing f185_groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, direction dir, int16 mapX, int16 mapY); // @ F0185_GROUP_GetGenerated
-
-
-
-
-
+ bool f223_isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY); // @ F0223_GROUP_IsSquareACorridorTeleporterPitOrDoor
};
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 17376485c5..2bb96e0c42 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -264,7 +264,7 @@ void Timeline::f261_processTimeline() {
break;
case k60_TMEventTypeMoveGroupSilent:
case k61_TMEventTypeMoveGroupAudible:
- //F0252_TIMELINE_ProcessEvents60to61_MoveGroup(L0681_ps_Event);
+ f252_timelineProcessEvents60to61_moveGroup(L0681_ps_Event);
break;
case k65_TMEventTypeEnableGroupGenerator:
//F0246_TIMELINE_ProcessEvent65_EnableGroupGenerator(L0681_ps_Event);
@@ -815,4 +815,48 @@ void Timeline::f245_timlineProcessEvent5_squareCorridor(TimelineEvent* event) {
L0613_T_Thing = _vm->_dungeonMan->f159_getNextThing(L0613_T_Thing);
}
}
+
+void Timeline::f252_timelineProcessEvents60to61_moveGroup(TimelineEvent* event) {
+ uint16 L0656_ui_MapX;
+ uint16 L0657_ui_MapY;
+ Group* L0658_ps_Group;
+ bool L0659_B_RandomDirectionMoveRetried;
+
+
+ L0659_B_RandomDirectionMoveRetried = false;
+ L0656_ui_MapX = event->_B._location._mapX;
+ L0657_ui_MapY = event->_B._location._mapY;
+ L0657_ui_MapY = event->_B._location._mapY;
+T0252001:
+ if (((_vm->_dungeonMan->_g272_currMapIndex != _vm->_dungeonMan->_g309_partyMapIndex) || (L0656_ui_MapX != _vm->_dungeonMan->_g306_partyMapX) || (L0657_ui_MapY != _vm->_dungeonMan->_g307_partyMapY)) && (_vm->_groupMan->f175_groupGetThing(L0656_ui_MapX, L0657_ui_MapY) == Thing::_endOfList)) { /* BUG0_24 Lord Chaos may teleport into one of the Black Flames and become invisible until the Black Flame is killed. In this case, _vm->_groupMan->f175_groupGetThing returns the Black Flame thing and the Lord Chaos thing is not moved into the dungeon until the Black Flame is killed */
+ if (event->_type == k61_TMEventTypeMoveGroupAudible) {
+ warning(false, "F0064_SOUND_RequestPlay_CPSD");
+ }
+ _vm->_movsens->f267_getMoveResult(Thing(event->_C._slot), kM1_MapXNotOnASquare, 0, L0656_ui_MapX, L0657_ui_MapY);
+ } else {
+ if (!L0659_B_RandomDirectionMoveRetried) {
+ L0659_B_RandomDirectionMoveRetried = true;
+ L0658_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(Thing(event->_C._slot));
+ if ((L0658_ps_Group->_type == k23_CreatureTypeLordChaos) && !_vm->getRandomNumber(4)) {
+ switch (_vm->getRandomNumber(4)) {
+ case 0:
+ L0656_ui_MapX--;
+ break;
+ case 1:
+ L0656_ui_MapX++;
+ break;
+ case 2:
+ L0657_ui_MapY--;
+ break;
+ case 3:
+ L0657_ui_MapY++;
+ }
+ if (_vm->_groupMan->f223_isSquareACorridorTeleporterPitOrDoor(L0656_ui_MapX, L0657_ui_MapY))
+ goto T0252001;
+ }
+ }
+ event->_mapTime += 5;
+ _vm->_timeline->f238_addEventGetEventIndex(event);
+ }
+}
}
diff --git a/engines/dm/timeline.h b/engines/dm/timeline.h
index 3e5cbcdf65..c56db55dfd 100644
--- a/engines/dm/timeline.h
+++ b/engines/dm/timeline.h
@@ -173,6 +173,7 @@ public:
void f248_timelineProcessEvent6_squareWall(TimelineEvent *event); // @ F0248_TIMELINE_ProcessEvent6_Square_Wall
void f247_triggerProjectileLauncher(Sensor *sensor, TimelineEvent *event); // @ F0247_TIMELINE_TriggerProjectileLauncher
void f245_timlineProcessEvent5_squareCorridor(TimelineEvent *event); // @ F0245_TIMELINE_ProcessEvent5_Square_Corridor
+ void f252_timelineProcessEvents60to61_moveGroup(TimelineEvent *event); // @ F0252_TIMELINE_ProcessEvents60to61_MoveGroup
};