fp: Address warnings on GCC

This commit is contained in:
doyle 2023-10-21 00:06:28 +11:00
parent 85fe5c8ff7
commit 7a2b7618e8
2 changed files with 10 additions and 16 deletions

View File

@ -1927,17 +1927,14 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
if (entity->handle != player)
continue;
Dqn_V2 new_entity_pos = entity_pos;
Dqn_Rect camera_view_rect = Dqn_Rect_InitV2x2((camera->size * -.5f) + (camera->world_pos / camera->scale), camera->size);
Dqn_Rect entity_hit_box = FP_Game_CalcEntityWorldHitBox(game, entity_handle);
Dqn_Rect playable_bounds = Dqn_Rect_ExpandV2(camera_view_rect, -entity_hit_box.size);
Dqn_Rect hit_box = FP_Game_CalcEntityWorldHitBox(game, entity_handle);
new_entity_pos.x = DQN_MAX(new_entity_pos.x, playable_bounds.pos.x);
new_entity_pos.y = DQN_MAX(new_entity_pos.y, playable_bounds.pos.y);
new_entity_pos.x = DQN_MIN(new_entity_pos.x, playable_bounds.pos.x + playable_bounds.size.x);
new_entity_pos.y = DQN_MIN(new_entity_pos.y, playable_bounds.pos.y + playable_bounds.size.y);
Dqn_Rect const camera_view_rect = Dqn_Rect_InitV2x2((camera->size * -.5f) + (camera->world_pos / camera->scale), camera->size);
Dqn_Rect const entity_hit_box = FP_Game_CalcEntityWorldHitBox(game, entity_handle);
Dqn_Rect const playable_bounds = Dqn_Rect_ExpandV2(camera_view_rect, -entity_hit_box.size);
Dqn_V2 new_entity_pos = entity_pos;
new_entity_pos.x = DQN_MAX(new_entity_pos.x, playable_bounds.pos.x);
new_entity_pos.y = DQN_MAX(new_entity_pos.y, playable_bounds.pos.y);
new_entity_pos.x = DQN_MIN(new_entity_pos.x, playable_bounds.pos.x + playable_bounds.size.x);
new_entity_pos.y = DQN_MIN(new_entity_pos.y, playable_bounds.pos.y + playable_bounds.size.y);
if (new_entity_pos != entity_pos) {
entity_is_oob_with_camera = true;

View File

@ -1093,11 +1093,8 @@ static void FP_Game_MoveEntity(FP_Game *game, FP_GameEntityHandle entity_handle,
if (DQN_ABS(entity->velocity.y) < 5.f)
entity->velocity.y = 0.f;
Dqn_V2 const delta_pos = (acceleration * 0.5f * t_squared) + (entity->velocity * t);
Dqn_Rect const entity_world_hit_box = FP_Game_CalcEntityWorldHitBox(game, entity->handle);
Dqn_V2 const entity_pos = FP_Game_CalcEntityWorldPos(game, entity->handle);
Dqn_V2 const entity_new_pos = entity_pos + delta_pos;
Dqn_V2 const delta_pos = (acceleration * 0.5f * t_squared) + (entity->velocity * t);
Dqn_V2 const entity_pos = FP_Game_CalcEntityWorldPos(game, entity->handle);
FP_GameCanMoveToPositionResult move_to_result = FP_Game_CanEntityMoveToPosition(game, entity->handle, delta_pos);
if (move_to_result.yes) {
entity->local_pos += delta_pos;