fp: Add a simplified swarming algorithm
This commit is contained in:
+12
-2
@@ -258,6 +258,16 @@ static bool FP_Game_IsNilEntity(FP_GameEntity *entity)
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool FP_Game_IsNilEntityHandle(FP_Game *game, FP_GameEntityHandle handle)
|
||||
{
|
||||
bool result = true;
|
||||
if (handle.id != 0) {
|
||||
FP_GameEntity *entity = FP_Game_GetEntity(game, handle);
|
||||
result = FP_Game_IsNilEntity(entity);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void FP_Game_DetachEntityIntoFreeList(FP_Game *game, FP_GameEntityHandle handle)
|
||||
{
|
||||
FP_GameEntity *entity = FP_Game_GetEntity(game, handle);
|
||||
@@ -353,7 +363,7 @@ static Dqn_V2 FP_Game_CalcEntityWorldPos(FP_Game const *game, FP_GameEntityHandl
|
||||
|
||||
static Dqn_Rect FP_Game_CalcEntityLocalHitBox(FP_Game const *game, FP_GameEntityHandle handle)
|
||||
{
|
||||
FP_GameEntity *entity = FP_Game_GetEntity(DQN_CAST(FP_Game *)game, handle);
|
||||
FP_GameEntity *entity = FP_Game_GetEntity(DQN_CAST(FP_Game *)game, handle);
|
||||
Dqn_V2 half_hit_box_size = entity->local_hit_box_size * .5f;
|
||||
Dqn_Rect result = Dqn_Rect_InitV2x2(entity->local_hit_box_offset - half_hit_box_size, entity->local_hit_box_size);
|
||||
return result;
|
||||
@@ -651,7 +661,7 @@ static Dqn_V2 FP_Game_CalcWaypointWorldPos(FP_Game *game, FP_GameWaypoint const
|
||||
Dqn_Rect entity_rect = FP_Game_CalcEntityWorldHitBox(game, waypoint_entity->handle);
|
||||
switch (waypoint->type_direction) {
|
||||
case FP_GameDirection_Up: {
|
||||
result = Dqn_V2_InitNx2(entity_rect.pos.x + entity_rect.size.w * .5f, entity_rect.pos.y + entity_rect.size.h * .1f);
|
||||
result = Dqn_V2_InitNx2(entity_rect.pos.x + entity_rect.size.w * .5f, entity_rect.pos.y - entity_rect.size.h * .1f);
|
||||
} break;
|
||||
|
||||
case FP_GameDirection_Down: {
|
||||
|
||||
Reference in New Issue
Block a user