fp: Redo the attack boxes
This commit is contained in:
@@ -414,6 +414,37 @@ static Dqn_Rect FP_Game_CalcEntityAttackWorldHitBox(FP_Game const *game, FP_Game
|
||||
return result;
|
||||
}
|
||||
|
||||
static Dqn_FArray<Dqn_Rect, FP_GameDirection_Count> FP_Game_CalcEntityMeleeAttackBoxes(FP_Game const *game, FP_GameEntityHandle handle)
|
||||
{
|
||||
Dqn_FArray<Dqn_Rect, FP_GameDirection_Count> result = {};
|
||||
Dqn_Rect hit_box = FP_Game_CalcEntityWorldHitBox(game, handle);
|
||||
DQN_FOR_UINDEX (dir_index, FP_GameDirection_Count) {
|
||||
Dqn_Rect *rect = Dqn_FArray_Make(&result, Dqn_ZeroMem_Yes);
|
||||
rect->size = hit_box.size;
|
||||
switch (dir_index) {
|
||||
case FP_GameDirection_Left: {
|
||||
rect->pos = Dqn_Rect_InterpolatedPoint(hit_box, Dqn_V2_InitNx2(-1.f, 0.f));
|
||||
} break;
|
||||
|
||||
case FP_GameDirection_Right: {
|
||||
rect->pos = Dqn_Rect_InterpolatedPoint(hit_box, Dqn_V2_InitNx2(+1.f, 0.f));
|
||||
} break;
|
||||
|
||||
case FP_GameDirection_Up: {
|
||||
rect->pos = Dqn_Rect_InterpolatedPoint(hit_box, Dqn_V2_InitNx2(0.f, -1.f));
|
||||
} break;
|
||||
|
||||
case FP_GameDirection_Down: {
|
||||
rect->pos = Dqn_Rect_InterpolatedPoint(hit_box, Dqn_V2_InitNx2(0.f, +1.f));
|
||||
} break;
|
||||
|
||||
case FP_GameDirection_Count: break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static Dqn_Rect FP_Game_CalcEntityArrayWorldBoundingBox(FP_Game const *game, FP_GameEntityHandle const *handles, Dqn_usize count)
|
||||
{
|
||||
Dqn_Rect result = {};
|
||||
|
||||
Reference in New Issue
Block a user