aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-07-11 16:00:53 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commitcc5f1ab478e21d99ac3edeba621fea73bf591ea5 (patch)
tree9a30c09b000d3fc8c8b541cc95a2f4e53f0bcf48
parent953f7909fcc1c3b5f699bd9add53ec0a2640e00f (diff)
downloadscummvm-rg350-cc5f1ab478e21d99ac3edeba621fea73bf591ea5.tar.gz
scummvm-rg350-cc5f1ab478e21d99ac3edeba621fea73bf591ea5.tar.bz2
scummvm-rg350-cc5f1ab478e21d99ac3edeba621fea73bf591ea5.zip
DM: Add f220_explosionProcessEvent25_explosion
-rw-r--r--engines/dm/TODOs/todo.txt3
-rw-r--r--engines/dm/dm.h2
-rw-r--r--engines/dm/projexpl.cpp92
-rw-r--r--engines/dm/projexpl.h2
-rw-r--r--engines/dm/timeline.cpp2
5 files changed, 98 insertions, 3 deletions
diff --git a/engines/dm/TODOs/todo.txt b/engines/dm/TODOs/todo.txt
index 1d08b44ca4..78a5e9cd80 100644
--- a/engines/dm/TODOs/todo.txt
+++ b/engines/dm/TODOs/todo.txt
@@ -6,6 +6,7 @@ Bugs:
Logic:
When object are put on the right side of the current square, they disappear
+ Drawing door ornaments segfaults when going back to the start
@@ -19,4 +20,6 @@ Todo:
Double check strcat, strstr usages, I might have messed them up in many places
I forgot to add a bunch of warning for show/hide mouse pointer and other mouse functions
+Finish stuff:
+ f261_processTimeline
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 1b4850a849..5b8061c809 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -81,8 +81,8 @@ enum ThingType {
class Thing {
- uint16 _data;
public:
+ uint16 _data;
static const Thing _none; // @ C0xFFFF_THING_NONE
static const Thing _endOfList; // @ C0xFFFE_THING_ENDOFLIST
static const Thing _firstExplosion; // @ C0xFF80_THING_FIRST_EXPLOSION
diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp
index 53b3f3afef..e8464aab8d 100644
--- a/engines/dm/projexpl.cpp
+++ b/engines/dm/projexpl.cpp
@@ -500,4 +500,96 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) {
L0519_ps_Event->_B._slot = L0515_T_ProjectileThingNewCell.toUint16();
L0520_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(L0519_ps_Event);
}
+
+void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) {
+ Explosion* L0532_ps_Explosion;
+ Group* L0533_ps_Group;
+ CreatureInfo* L0534_ps_CreatureInfo;
+ uint16 L0528_ui_MapX;
+ uint16 L0529_ui_MapY;
+ int16 L0530_i_Attack;
+ int16 L0531_i_Multiple;
+#define AL0531_i_SquareType L0531_i_Multiple
+#define AL0531_i_CreatureCount L0531_i_Multiple
+ Thing L0535_T_GroupThing;
+ Thing L0536_T_ExplosionThing;
+ uint16 L0537_ui_Multiple;
+#define AL0537_ui_CreatureType L0537_ui_Multiple
+#define AL0537_ui_NonMaterialAdditionalAttack L0537_ui_Multiple
+ bool L0538_B_ExplosionOnPartySquare;
+ TimelineEvent L0539_s_Event;
+
+ L0528_ui_MapX = event->_B._location._mapX;
+ L0529_ui_MapY = event->_B._location._mapY;
+ L0532_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[Thing((event->_C._slot)).getIndex()];
+ AL0531_i_SquareType = Square(_vm->_dungeonMan->_g271_currMapData[L0528_ui_MapX][L0529_ui_MapY]).getType();
+ L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_g306_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_g307_partyMapY);
+ if ((L0535_T_GroupThing = _vm->_groupMan->f175_groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) {
+ L0533_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0535_T_GroupThing);
+ L0534_ps_CreatureInfo = &g243_CreatureInfo[AL0537_ui_CreatureType = L0533_ps_Group->_type];
+ }
+ if ((L0536_T_ExplosionThing = Thing(Thing::_firstExplosion.toUint16() + L0532_ps_Explosion->getType())) == Thing::_explPoisonCloud) {
+ L0530_i_Attack = MAX(1, MIN(L0532_ps_Explosion->getAttack() >> 5, 4) + _vm->getRandomNumber(2)); /* Value between 1 and 5 */
+ } else {
+ L0530_i_Attack = (L0532_ps_Explosion->getAttack() >> 1) + 1;
+ L0530_i_Attack += _vm->getRandomNumber(L0530_i_Attack) + 1;
+ }
+
+
+ switch (L0536_T_ExplosionThing.toUint16()) {
+ case 0xFF82:
+ if (!(L0530_i_Attack >>= 1))
+ break;
+ case 0xFF80:
+ if (AL0531_i_SquareType == k4_DoorElemType) {
+ _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true, 0);
+ }
+ break;
+ case 0xFF83:
+ if ((L0535_T_GroupThing != Thing::_endOfList) && getFlag(L0534_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) {
+ if ((AL0537_ui_CreatureType == k19_CreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex)) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */
+ L0530_i_Attack -= (AL0537_ui_NonMaterialAdditionalAttack = L0530_i_Attack >> 3);
+ AL0537_ui_NonMaterialAdditionalAttack <<= 1;
+ AL0537_ui_NonMaterialAdditionalAttack++;
+ AL0531_i_CreatureCount = L0533_ps_Group->getCount();
+ do {
+ if (getFlag(_vm->_groupMan->_g375_activeGroups[L0533_ps_Group->getActiveGroupIndex()]._aspect[AL0531_i_CreatureCount], k0x0080_MaskActiveGroupIsAttacking)) { /* Materializer / Zytaz can only be damaged while they are attacking */
+ _vm->_groupMan->f190_groupGetDamageCreatureOutcome(L0533_ps_Group, AL0531_i_CreatureCount, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack + _vm->getRandomNumber(AL0537_ui_NonMaterialAdditionalAttack) + _vm->getRandomNumber(4), true);
+ }
+ } while (--AL0531_i_CreatureCount >= 0);
+ } else {
+ _vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true);
+ }
+ }
+ break;
+ case 0xFFE4:
+ L0532_ps_Explosion->setType(L0532_ps_Explosion->getType() + 1);
+ warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD");
+ goto T0220026;
+ case 0xFFA8:
+ if (L0532_ps_Explosion->getAttack() > 55) {
+ L0532_ps_Explosion->setAttack(L0532_ps_Explosion->getAttack() - 40);
+ goto T0220026;
+ }
+ break;
+ case 0xFF87:
+ if (L0538_B_ExplosionOnPartySquare) {
+ _vm->_championMan->f324_damageAll_getDamagedChampionCount(L0530_i_Attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL);
+ } else {
+ if ((L0535_T_GroupThing != Thing::_endOfList) && (L0530_i_Attack = _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(AL0537_ui_CreatureType, L0530_i_Attack)) && (_vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true) != k2_outcomeKilledAllCreaturesInGroup) && (L0530_i_Attack > 2)) {
+ _vm->_groupMan->f209_processEvents29to41(L0528_ui_MapX, L0529_ui_MapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0);
+ }
+ }
+ if (L0532_ps_Explosion->getAttack() >= 6) {
+ L0532_ps_Explosion->setAttack(L0532_ps_Explosion->getAttack() - 3);
+T0220026:
+ L0539_s_Event = *event;
+ L0539_s_Event._mapTime++;
+ _vm->_timeline->f238_addEventGetEventIndex(&L0539_s_Event);
+ return;
+ }
+ }
+ _vm->_dungeonMan->f164_unlinkThingFromList(Thing(event->_C._slot), Thing(0), L0528_ui_MapX, L0529_ui_MapY);
+ L0532_ps_Explosion->setNextThing(Thing::_none);
+}
}
diff --git a/engines/dm/projexpl.h b/engines/dm/projexpl.h
index 125bd8e30f..d0e030f719 100644
--- a/engines/dm/projexpl.h
+++ b/engines/dm/projexpl.h
@@ -99,7 +99,7 @@ public:
void f214_projectileDeleteEvent(Thing thing); // @ F0214_PROJECTILE_DeleteEvent
void f215_projectileDelete(Thing projectileThing, Thing *groupSlot, int16 mapX, int16 mapY); // @ F0215_PROJECTILE_Delete
void f219_processEvents48To49_projectile(TimelineEvent *event); // @ F0219_PROJECTILE_ProcessEvents48To49_Projectile
-
+ void f220_explosionProcessEvent25_explosion(TimelineEvent *event); // @ F0220_EXPLOSION_ProcessEvent25_Explosion
};
}
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 2bb578e126..55a80cf915 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -237,7 +237,7 @@ void Timeline::f261_processTimeline() {
f241_timelineProcessEvent1_doorAnimation(L0681_ps_Event);
break;
case k25_TMEventTypeExplosion:
- //F0220_EXPLOSION_ProcessEvent25_Explosion(L0681_ps_Event);
+ _vm->_projexpl->f220_explosionProcessEvent25_explosion(L0681_ps_Event);
break;
case k7_TMEventTypeFakeWall:
//F0242_TIMELINE_ProcessEvent7_Square_FakeWall(L0681_ps_Event);