diff options
author | Bendegúz Nagy | 2016-07-12 08:27:57 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | c62029211dbd377b240bce8687175a5ed40cd8da (patch) | |
tree | 74752bc56990354f6f942bc182fcb3f06b366c93 /engines/dm | |
parent | 4818eaaf55bb40164fd3d0ca00dbbaa09a7e789d (diff) | |
download | scummvm-rg350-c62029211dbd377b240bce8687175a5ed40cd8da.tar.gz scummvm-rg350-c62029211dbd377b240bce8687175a5ed40cd8da.tar.bz2 scummvm-rg350-c62029211dbd377b240bce8687175a5ed40cd8da.zip |
DM: Add f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot
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 }; |