DM: Add f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot

This commit is contained in:
Bendegúz Nagy 2016-07-12 08:27:57 +02:00
parent 4818eaaf55
commit c62029211d
2 changed files with 32 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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
};