summaryrefslogtreecommitdiff
path: root/src/bullets.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-04-30 19:18:50 +0200
committerAldrik Ramaekers <aldrik@amftech.nl>2023-04-30 19:18:50 +0200
commit3767d1ce3e2b90d4eb667985c0997cb5293cc27e (patch)
treea3a9671aefd322794518c55105ea0085e1d73d09 /src/bullets.c
parent784b123af41337c57535b80c15fe13b62dfc1e66 (diff)
work
Diffstat (limited to 'src/bullets.c')
-rw-r--r--src/bullets.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/bullets.c b/src/bullets.c
index ff96db9..dcdc02a 100644
--- a/src/bullets.c
+++ b/src/bullets.c
@@ -40,7 +40,6 @@ void shoot(platform_window* window, u32 id, float dirx, float diry) {
for (int i = 0; i < max_bullets; i++) {
bullet b = bullets[i];
if (b.active) continue;
-
bullets[i] = (bullet){p->id, true, bulletx, bullety, hh + 0.5,.endx = bullet_end_point_x,.endy = bullet_end_point_y, .damage = g.damage};
break;
}
@@ -76,7 +75,7 @@ bool check_if_bullet_collided_with_object(bullet* b, platform_window* window) {
float dist_of_closest_intersect = __FLT_MAX__;
for (int i = 0; i < MAX_OBJECTS; i++) {
- object o = objects[i];
+ object o = loaded_map.objects[i];
if (!o.active) continue;
if (b->position.z <= o.h + o.size.z && b->position.z >= o.h) {
box obj_box = get_box_of_square((vec3f){o.position.x, o.position.y, o.h}, o.size);
@@ -259,8 +258,7 @@ void draw_bullets(platform_window* window) {
b.position.z = p->gun_height;
}
- if ((int)bullets[i].position.y < (int)bullets[i].endy) { BULLET_RENDER_DEPTH((int)bullets[i].position.y); }
- else { BULLET_RENDER_DEPTH((int)bullets[i].endy); }
+ BULLET_RENDER_DEPTH((int)bullets[i].position.y);
float bullet_render_x = b.position.x*info.tile_width + (b.position.y*info.px_incline);
float bullet_render_y = b.position.y*info.tile_height - (b.position.z*info.px_raised_per_h);