bullet_has_hit

This commit is contained in:
jacob 2025-01-11 10:22:27 -06:00
parent 0c1d6a58de
commit 5d6835ece3
2 changed files with 28 additions and 25 deletions

View File

@ -229,6 +229,7 @@ struct entity {
struct v2 bullet_src_pos;
struct v2 bullet_src_dir;
f32 bullet_impulse;
b32 bullet_has_hit; /* Has the bullet hit a target this tick */
/* ====================================================================== */
/* Testing */

View File

@ -960,10 +960,11 @@ INTERNAL void game_update(struct game_cmd_array game_cmds)
if (entity_has_prop(e0, ENTITY_PROP_BULLET) || entity_has_prop(e1, ENTITY_PROP_BULLET)) {
struct entity *bullet = entity_has_prop(e0, ENTITY_PROP_BULLET) ? e0 : e1;
struct entity *target = e0 == bullet ? e1 : e0;
if (!bullet->bullet_has_hit) {
bullet->bullet_has_hit = true;
(UNUSED)bullet;
(UNUSED)target;
#if 0
#if 0
{
/* Set bullet position to hit position */
struct xform xf = entity_get_xform(bullet);
@ -972,9 +973,9 @@ INTERNAL void game_update(struct game_cmd_array game_cmds)
/* Release after publish so user sees bullet in final postiion */
entity_enable_prop(bullet, ENTITY_PROP_RELEASE_AFTER_PUBLISH);
}
#else
#else
entity_enable_prop(bullet, ENTITY_PROP_RELEASE_BEFORE_PUBLISH);
#endif
#endif
/* Create test blood */
/* TODO: Remove this */
@ -991,6 +992,7 @@ INTERNAL void game_update(struct game_cmd_array game_cmds)
}
}
}
}
/* ========================== *
* Initialize bullet kinematics from sources