fp: Wire up attack chaining

This commit is contained in:
2023-09-18 23:00:30 +10:00
parent 3e31d0ef69
commit 12e6e5d6f1
4 changed files with 124 additions and 110 deletions
+28
View File
@@ -421,3 +421,31 @@ static Dqn_Rect FP_Game_CalcEntityWorldBoundingBox(FP_Game *game, FP_GameEntityH
Dqn_Rect result = FP_Game_CalcEntityArrayWorldBoundingBox(game, &handle, 1);
return result;
}
// Transition the action into the desire state and set the flag to indicate it
// has just transitioned
static void FP_Game_EntityActionSetState(FP_GameEntityAction *action, FP_GameEntityState state)
{
if (!action)
return;
action->state = state;
action->flags |= FP_GameEntityActionFlag_StateTransition;
}
// Reset the timers and animation for the current action and set the duration
// for the new action.
static void FP_Game_EntityActionReset(FP_GameEntityAction *action, Dqn_f32 new_action_duration, TELY_AssetSpriteAnimation *anim)
{
if (!action)
return;
action->anim = anim;
action->timer_s = 0.f;
action->end_at_s = new_action_duration;
action->flags = 0;
}
static bool FP_Game_EntityActionHasFailed(FP_GameEntityAction const *action)
{
bool result = action ? action->flags & FP_GameEntityActionFlag_Failed : true;
return result;
}