diff options
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/timeline.cpp | 28 | ||||
-rw-r--r-- | engines/dm/timeline.h | 5 |
2 files changed, 32 insertions, 1 deletions
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index 85aadcbb67..f8725a2ded 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -328,7 +328,7 @@ void Timeline::f261_processTimeline() { case k11_TMEventTypeEnableChampionAction: f253_timelineProcessEvent11Part1_enableChampionAction(L0682_s_Event._priority); if (L0682_s_Event._B._slotOrdinal) { - //F0259_TIMELINE_ProcessEvent11Part2_MoveWeaponFromQuiverToSlot(L0682_s_Event._priority, _vm->M1_ordinalToIndex(L0682_s_Event._B._slotOrdinal)); + f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot(L0682_s_Event._priority, _vm->M1_ordinalToIndex(L0682_s_Event._B._slotOrdinal)); } goto T0261048; case k12_TMEventTypeHideDamageReceived: @@ -952,4 +952,30 @@ T0253002: } L0662_ps_Champion->_actionIndex = k255_ChampionActionNone; } + +void Timeline::f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot(uint16 champIndex, uint16 slotIndex) { + uint16 L0677_ui_SlotIndex; + Champion* L0678_ps_Champion; + + L0678_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; + if (L0678_ps_Champion->_slots[slotIndex] != Thing::_none) { + return; + } + if (f258_timelineHasWeaponMovedSlot(champIndex, L0678_ps_Champion, k12_ChampionSlotQuiverLine_1_1, slotIndex)) { + return; + } + for (L0677_ui_SlotIndex = k7_ChampionSlotQuiverLine_2_1; L0677_ui_SlotIndex <= k9_ChampionSlotQuiverLine_2_2; L0677_ui_SlotIndex++) { + if (f258_timelineHasWeaponMovedSlot(champIndex, L0678_ps_Champion, L0677_ui_SlotIndex, slotIndex)) + break; + } +} + +bool Timeline::f258_timelineHasWeaponMovedSlot(int16 champIndex, Champion* champ, uint16 sourceSlotIndex, int16 destSlotIndex) { + if (Thing(champ->_slots[sourceSlotIndex]).getType() == k5_WeaponThingType) { + _vm->_championMan->f301_addObjectInSlot((ChampionIndex)champIndex, _vm->_championMan->f300_getObjectRemovedFromSlot(champIndex, sourceSlotIndex), + (ChampionSlot)destSlotIndex); + return true; + } + return false; +} } diff --git a/engines/dm/timeline.h b/engines/dm/timeline.h index f6f61ee808..021889dbfb 100644 --- a/engines/dm/timeline.h +++ b/engines/dm/timeline.h @@ -31,6 +31,7 @@ #include "dm.h" namespace DM { + class Champion; class Sensor; /* Event types */ @@ -178,6 +179,10 @@ public: void f252_timelineProcessEvents60to61_moveGroup(TimelineEvent *event); // @ F0252_TIMELINE_ProcessEvents60to61_MoveGroup void f246_timelineProcesEvent65_enableGroupGenerator(TimelineEvent *event); // @ F0246_TIMELINE_ProcessEvent65_EnableGroupGenerator void f253_timelineProcessEvent11Part1_enableChampionAction(uint16 champIndex); // @ F0253_TIMELINE_ProcessEvent11Part1_EnableChampionAction + void f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot(uint16 champIndex, + uint16 slotIndex);// @ F0259_TIMELINE_ProcessEvent11Part2_MoveWeaponFromQuiverToSlot + bool f258_timelineHasWeaponMovedSlot(int16 champIndex, Champion *champ, + uint16 sourceSlotIndex, int16 destSlotIndex); // @ F0258_TIMELINE_HasWeaponMovedToSlot }; |