feat: made hitboxes area dependent
This commit is contained in:
@@ -189,14 +189,14 @@ void LoadWorld(M_Arena *arena, World *world) {
|
||||
//
|
||||
{
|
||||
U32 n_hitbox = *(U32 *) base; base += 4;
|
||||
AABB *boxes = (AABB *) base;
|
||||
World_Hitbox *boxes = (World_Hitbox *) base;
|
||||
|
||||
world->hitboxCount = n_hitbox;
|
||||
world->hitboxes = M_ArenaPush(arena, AABB, .count = WORLD_HITBOX_MAX);
|
||||
world->hitboxes = M_ArenaPush(arena, World_Hitbox, .count = WORLD_HITBOX_MAX);
|
||||
|
||||
M_CopySize(world->hitboxes, boxes, n_hitbox * sizeof(AABB));
|
||||
M_CopySize(world->hitboxes, boxes, n_hitbox * sizeof(World_Hitbox));
|
||||
|
||||
base += (WORLD_HITBOX_MAX * sizeof(AABB));
|
||||
base += (WORLD_HITBOX_MAX * sizeof(World_Hitbox));
|
||||
}
|
||||
|
||||
// Map
|
||||
@@ -242,7 +242,7 @@ void GenerateNavMesh(M_Arena *arena, World *world) {
|
||||
U32 y = (i / 96);
|
||||
bool skip = false;
|
||||
for(U32 hi = 0; hi < world->hitboxCount; hi++) {
|
||||
if(AABB_Point(world->hitboxes[hi], V2F((F32) x, (F32) y))) {
|
||||
if(AABB_Point(world->hitboxes[hi].box, V2F((F32) x, (F32) y))) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ void GenerateNavMesh(M_Arena *arena, World *world) {
|
||||
}
|
||||
// It's quad for loop time :D
|
||||
for(U32 hi = 0; hi < world->hitboxCount; hi++) {
|
||||
if(AABB_Point(world->hitboxes[hi], V2F((F32) (x + nx), (F32) (y + ny)))) {
|
||||
if(AABB_Point(world->hitboxes[hi].box, V2F((F32) (x + nx), (F32) (y + ny)))) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user