From 24e9b472c3fdc752830966b3c90e219874e6654a Mon Sep 17 00:00:00 2001 From: declan Date: Mon, 6 Oct 2025 00:48:41 +0100 Subject: [PATCH] use slab aabb for gunshots --- code/game/impl/bandit.c | 8 +++----- code/game/impl/world.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/code/game/impl/bandit.c b/code/game/impl/bandit.c index f8e3f35..bd5d1d5 100644 --- a/code/game/impl/bandit.c +++ b/code/game/impl/bandit.c @@ -2,11 +2,9 @@ #include "game/bandit.h" void UpdateBandit(F32 delta, Bandit *bandit, World *world) { - if( - world->player.controls.shot - && AABB_Point(bandit->collision, world->player.shotPos) - && bandit->currentArea == world->player.currentArea - ) { + if ( + world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, bandit->collision) && bandit->currentArea == world->player.currentArea) + { printf("You shot the bandit %*.s\n", Sv(bandit->name)); bandit->health--; } diff --git a/code/game/impl/world.c b/code/game/impl/world.c index 320170c..74f9741 100644 --- a/code/game/impl/world.c +++ b/code/game/impl/world.c @@ -18,11 +18,9 @@ void UpdateNPCs(F32 delta, World *world) { NPC *npc = &world->npcs[i]; UpdateNPC(delta, npc, world); - if( - world->player.controls.shot - && AABB_Point(npc->collision, world->player.shotPos) - && npc->currentArea == world->player.currentArea - ) { + if ( + world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, npc->collision) && npc->currentArea == world->player.currentArea) + { printf("You shot %*.s\n", Sv(world->npcs[i].name)); } }