aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-07-11 15:38:25 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit953f7909fcc1c3b5f699bd9add53ec0a2640e00f (patch)
tree9cde6dbb389a1715e485a37a30453aaef0f11a00
parent12f06fd1d9460524ba8e9307a89edc1454516c27 (diff)
downloadscummvm-rg350-953f7909fcc1c3b5f699bd9add53ec0a2640e00f.tar.gz
scummvm-rg350-953f7909fcc1c3b5f699bd9add53ec0a2640e00f.tar.bz2
scummvm-rg350-953f7909fcc1c3b5f699bd9add53ec0a2640e00f.zip
DM: Add f241_timelineProcessEvent1_doorAnimation
-rw-r--r--engines/dm/dungeonman.h3
-rw-r--r--engines/dm/group.cpp2
-rw-r--r--engines/dm/timeline.cpp75
-rw-r--r--engines/dm/timeline.h1
4 files changed, 76 insertions, 5 deletions
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index a5c6ae2415..2763906d5d 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -204,8 +204,7 @@ public:
uint16 M59_getWariness() { return (_properties >> 12) & 0xF; }
uint16 M60_getFireResistance() { return (_resistances >> 4) & 0xF; }
uint16 M61_poisonResistance() { return (_resistances >> 8) & 0xF; }
- uint16 M51_height() { return (_attributes >> 7) & 0x3; }
-
+ static uint16 M51_height(uint16 attrib) { return (attrib >> 7) & 0x3; }
uint16 M54_getSightRange() { return (_ranges) & 0xF; }
uint16 M55_getSmellRange() { return (_ranges >> 8) & 0xF; }
uint16 M56_getAttackRange() { return (_ranges >> 12) & 0xF; }
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index ffd466f6b6..a39065bbba 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1109,7 +1109,7 @@ bool GroupMan::f202_isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, i
}
if (L0431_i_SquareType == k4_DoorElemType) {
L0432_ps_Teleporter = (Teleporter *)_vm->_dungeonMan->f157_getSquareFirstThingData(L0428_i_MapX, L0429_i_MapY);
- if (((Square(L0430_ui_Square).getDoorState()) > (((Door *)L0432_ps_Teleporter)->opensVertically() ? creatureInfo->M51_height() : 1)) && ((Square(L0430_ui_Square).getDoorState()) != k5_doorState_DESTROYED) && !getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) {
+ if (((Square(L0430_ui_Square).getDoorState()) > (((Door *)L0432_ps_Teleporter)->opensVertically() ? CreatureInfo::M51_height(creatureInfo->_attributes) : 1)) && ((Square(L0430_ui_Square).getDoorState()) != k5_doorState_DESTROYED) && !getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) {
_g389_groupMovementBlockedByDoor = true;
return false;
}
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index c98338cb94..2bb578e126 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -234,7 +234,7 @@ void Timeline::f261_processTimeline() {
_vm->_projexpl->f219_processEvents48To49_projectile(L0681_ps_Event);
break;
case k1_TMEventTypeDoorAnimation:
- //F0241_TIMELINE_ProcessEvent1_DoorAnimation(L0681_ps_Event);
+ f241_timelineProcessEvent1_doorAnimation(L0681_ps_Event);
break;
case k25_TMEventTypeExplosion:
//F0220_EXPLOSION_ProcessEvent25_Explosion(L0681_ps_Event);
@@ -330,7 +330,8 @@ T0261053:
}
bool Timeline::f240_isFirstEventExpiered() {
- return (_vm->_timeline->_g372_eventCount && (M30_time(_vm->_timeline->_g370_events[_vm->_timeline->_g371_timeline[0]]._mapTime) <= _vm->_g313_gameTime));
+ warning(false, "possibly dangerous cast to int32");
+ return (_vm->_timeline->_g372_eventCount && ((int32)M30_time(_vm->_timeline->_g370_events[_vm->_timeline->_g371_timeline[0]]._mapTime) <= _vm->_g313_gameTime));
}
void Timeline::f239_timelineExtractFirstEvent(TimelineEvent* event) {
@@ -340,4 +341,74 @@ void Timeline::f239_timelineExtractFirstEvent(TimelineEvent* event) {
f237_deleteEvent(L0592_ui_EventIndex);
}
+void Timeline::f241_timelineProcessEvent1_doorAnimation(TimelineEvent* event) {
+ uint16 L0593_ui_MapX;
+ uint16 L0594_ui_MapY;
+ int16 L0595_i_Effect;
+ int16 L0596_i_DoorState;
+ Square* L0597_puc_Square;
+ Door* L0598_ps_Door;
+ Thing L0599_T_GroupThing;
+ uint16 L0600_ui_CreatureAttributes;
+ uint16 L0602_ui_Multiple;
+#define AL0602_ui_VerticalDoor L0602_ui_Multiple
+#define AL0602_ui_Height L0602_ui_Multiple
+
+ L0597_puc_Square = (Square*)&_vm->_dungeonMan->_g271_currMapData[L0593_ui_MapX = event->_B._location._mapX][L0594_ui_MapY = event->_B._location._mapY];
+ if ((L0596_i_DoorState = Square(*L0597_puc_Square).getDoorState()) == k5_doorState_DESTROYED) {
+ return;
+ }
+ event->_mapTime++;
+ L0595_i_Effect = event->_C.A._effect;
+ if (L0595_i_Effect == k1_SensorEffClear) {
+ L0598_ps_Door = (Door*)_vm->_dungeonMan->f157_getSquareFirstThingData(L0593_ui_MapX, L0594_ui_MapY);
+ AL0602_ui_VerticalDoor = L0598_ps_Door->opensVertically();
+ if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0593_ui_MapX == _vm->_dungeonMan->_g306_partyMapX) && (L0594_ui_MapY == _vm->_dungeonMan->_g307_partyMapY) && (L0596_i_DoorState != k0_doorState_OPEN)) {
+ if (_vm->_championMan->_g305_partyChampionCount > 0) {
+ L0597_puc_Square->setDoorState(k0_doorState_OPEN);
+
+ // Strangerke
+ // Original bug fixed - A closing horizontal door wounds champions to the head instead of to the hands. Missing parenthesis in the condition cause all doors to wound the head in addition to the torso
+ // See BUG0_78
+ if (_vm->_championMan->f324_damageAll_getDamagedChampionCount(5, k0x0008_ChampionWoundTorso | (AL0602_ui_VerticalDoor ? k0x0004_ChampionWoundHead : k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand), k2_attackType_SELF)) {
+ warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
+ }
+ }
+ event->_mapTime++;
+ _vm->_timeline->f238_addEventGetEventIndex(event);
+ return;
+ }
+ if (((L0599_T_GroupThing = _vm->_groupMan->f175_groupGetThing(L0593_ui_MapX, L0594_ui_MapY)) != Thing::_endOfList) && !getFlag(L0600_ui_CreatureAttributes = _vm->_dungeonMan->f144_getCreatureAttributes(L0599_T_GroupThing), k0x0040_MaskCreatureInfo_nonMaterial)) {
+ if (L0596_i_DoorState >= (AL0602_ui_Height ? CreatureInfo::M51_height(L0600_ui_CreatureAttributes) : 1)) { /* Creature height or 1 */
+ if (_vm->_groupMan->f191_getDamageAllCreaturesOutcome((Group*)_vm->_dungeonMan->f156_getThingData(L0599_T_GroupThing), L0593_ui_MapX, L0594_ui_MapY, 5, true) != k2_outcomeKilledAllCreaturesInGroup) {
+ _vm->_groupMan->f209_processEvents29to41(L0593_ui_MapX, L0594_ui_MapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0);
+ }
+ L0596_i_DoorState = (L0596_i_DoorState == k0_doorState_OPEN) ? k0_doorState_OPEN : (L0596_i_DoorState - 1);
+ L0597_puc_Square->setDoorState(L0596_i_DoorState);
+ warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
+ event->_mapTime++;
+ _vm->_timeline->f238_addEventGetEventIndex(event);
+ return;
+ }
+ }
+ }
+ if (((L0595_i_Effect == k0_SensorEffSet) && (L0596_i_DoorState == k0_doorState_OPEN)) || ((L0595_i_Effect == k1_SensorEffClear) && (L0596_i_DoorState == k4_doorState_CLOSED))) {
+ goto T0241020_Return;
+ }
+ L0596_i_DoorState += (L0595_i_Effect == k0_SensorEffSet) ? -1 : 1;
+ L0597_puc_Square->setDoorState(L0596_i_DoorState);
+ warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
+ if (L0595_i_Effect == k0_SensorEffSet) {
+ if (L0596_i_DoorState == k0_doorState_OPEN) {
+ return;
+ }
+ } else {
+ if (L0596_i_DoorState == k4_doorState_CLOSED) {
+ return;
+ }
+ }
+ _vm->_timeline->f238_addEventGetEventIndex(event);
+T0241020_Return:
+ ;
+}
}
diff --git a/engines/dm/timeline.h b/engines/dm/timeline.h
index b5728a0d95..7e94ed7543 100644
--- a/engines/dm/timeline.h
+++ b/engines/dm/timeline.h
@@ -162,6 +162,7 @@ public:
void f261_processTimeline(); // @ F0261_TIMELINE_Process_CPSEF
bool f240_isFirstEventExpiered(); // @ F0240_TIMELINE_IsFirstEventExpired_CPSE
void f239_timelineExtractFirstEvent(TimelineEvent *event); // @ F0239_TIMELINE_ExtractFirstEvent
+ void f241_timelineProcessEvent1_doorAnimation(TimelineEvent *event); // @ F0241_TIMELINE_ProcessEvent1_DoorAnimation
};