Skip to content

Commit

Permalink
DM: Add f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendegúz Nagy committed Aug 26, 2016
1 parent 4818eaa commit c620292
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
28 changes: 27 additions & 1 deletion engines/dm/timeline.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -952,4 +952,30 @@ void Timeline::f253_timelineProcessEvent11Part1_enableChampionAction(uint16 cham
}
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;
}
}
5 changes: 5 additions & 0 deletions engines/dm/timeline.h
Expand Up @@ -31,6 +31,7 @@
#include "dm.h"

namespace DM {
class Champion;
class Sensor;

/* Event types */
Expand Down Expand Up @@ -178,6 +179,10 @@ class Timeline {
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
};


Expand Down

0 comments on commit c620292

Please sign in to comment.