From afb58a61abd0e8114a090ab0ad664d59c10dd4b1 Mon Sep 17 00:00:00 2001 From: iamcheeseman <[hidden email]> Date: Tue, 13 Jan 2026 00:01:44 -0500 Subject: formatter --- src/phys/world.odin | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/phys/world.odin') diff --git a/src/phys/world.odin b/src/phys/world.odin index 51a85a5..c263459 100644 --- a/src/phys/world.odin +++ b/src/phys/world.odin @@ -26,19 +26,19 @@ destroy_world :: proc() { delete(world.bodies) } -@(private="file") +@(private = "file") hash_bin :: proc(x: i32, y: i32) -> u32 { return transmute(u32)((x * 73856093) ~ (y * 19349663)) } -@(private="file") +@(private = "file") world_to_bin :: proc(point: Vec2) -> (i32, i32) { - return \ - i32(math.floor(point.x / BIN_SIZE)), - i32(math.floor(point.y / BIN_SIZE)) + return i32( + math.floor(point.x / BIN_SIZE), + ), i32(math.floor(point.y / BIN_SIZE)) } -@(private="file") +@(private = "file") get_surrounding_bins :: proc( pos: Vec2, allocator := context.temp_allocator, @@ -49,8 +49,8 @@ get_surrounding_bins :: proc( idx := 0 - for offset_x in -1..=1 { - for offset_y in -1..=1 { + for offset_x in -1 ..= 1 { + for offset_y in -1 ..= 1 { bin_idx := hash_bin(center_x + i32(offset_x), center_y + i32(offset_y)) bin := &world.bins[bin_idx % BIN_COUNT] neighbors[idx] = bin @@ -61,13 +61,13 @@ get_surrounding_bins :: proc( return neighbors } -@(private="file") +@(private = "file") find_bin :: proc(b: Body) -> ^[dynamic]Body_Handle { bin_x, bin_y := world_to_bin(b.pos + b.rect.start) return &world.bins[hash_bin(bin_x, bin_y) % BIN_COUNT] } -@(private="file") +@(private = "file") add_to_bins :: proc(b: ^Body) { bin := find_bin(b^) idx := i32(len(bin)) @@ -75,7 +75,7 @@ add_to_bins :: proc(b: ^Body) { b.bin_idx = idx } -@(private="file") +@(private = "file") remove_from_bins :: proc(b: Body) { bin := find_bin(b) @@ -214,4 +214,3 @@ set_body_position :: proc(h: Body_Handle, new_pos: Vec2) { b.pos = new_pos } } - -- cgit v1.3-2-g0d8e