minor cleanup

This commit is contained in:
jacob 2024-08-09 23:13:24 -05:00
parent 1125015ff7
commit d17727c133
3 changed files with 22 additions and 17 deletions

View File

@ -12,9 +12,6 @@ enum entity_prop {
ENTITY_PROP_CAMERA, ENTITY_PROP_CAMERA,
ENTITY_PROP_CAMERA_ACTIVE, ENTITY_PROP_CAMERA_ACTIVE,
ENTITY_PROP_EQUIPPER,
ENTITY_PROP_EQUIPABLE,
ENTITY_PROP_WEAPON, ENTITY_PROP_WEAPON,
ENTITY_PROP_TRIGGERING_EQUIPPED, ENTITY_PROP_TRIGGERING_EQUIPPED,
ENTITY_PROP_TRIGGERED_THIS_TICK, ENTITY_PROP_TRIGGERED_THIS_TICK,
@ -81,15 +78,18 @@ struct entity {
} control; } control;
/* ====================================================================== */ /* ====================================================================== */
/* Physics */ /* Player control */
struct v2 acceleration;
struct v2 velocity;
/* ENTITY_PROP_PLAYER_CONTROLLED */ /* ENTITY_PROP_PLAYER_CONTROLLED */
f32 player_max_speed; f32 player_max_speed;
f32 player_acceleration; f32 player_acceleration;
/* ====================================================================== */
/* Physics */
struct v2 acceleration;
struct v2 velocity;
/* ====================================================================== */ /* ====================================================================== */
/* Sprite */ /* Sprite */
@ -111,6 +111,12 @@ struct entity {
struct entity_handle equipped; struct entity_handle equipped;
/* ====================================================================== */
/* Weapon */
/* ENTITY_PROP_WEAPON */
f32 fire_rate;
/* ====================================================================== */ /* ====================================================================== */
/* Testing */ /* Testing */

View File

@ -124,7 +124,6 @@ INTERNAL void spawn_test_entities(void)
e->control.focus = V2(0, -1); e->control.focus = V2(0, -1);
entity_enable_prop(e, ENTITY_PROP_ANIMATING); entity_enable_prop(e, ENTITY_PROP_ANIMATING);
entity_enable_prop(e, ENTITY_PROP_EQUIPPER);
player_ent = e; player_ent = e;
@ -133,9 +132,9 @@ INTERNAL void spawn_test_entities(void)
/* Child 1 */ /* Child 1 */
{ {
struct v2 pos = V2(1, -1); struct v2 pos = V2(0.25, -0.25);
struct v2 size = V2(1, 1); struct v2 size = V2(1, 1);
f32 r = 0; f32 r = PI / 4;
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
@ -145,7 +144,6 @@ INTERNAL void spawn_test_entities(void)
e->sprite = sprite_tag_from_path(STR("res/graphics/gun.ase")); e->sprite = sprite_tag_from_path(STR("res/graphics/gun.ase"));
entity_enable_prop(e, ENTITY_PROP_ANIMATING); entity_enable_prop(e, ENTITY_PROP_ANIMATING);
entity_enable_prop(e, ENTITY_PROP_EQUIPABLE);
entity_enable_prop(e, ENTITY_PROP_WEAPON); entity_enable_prop(e, ENTITY_PROP_WEAPON);
player_ent->equipped = e->handle; player_ent->equipped = e->handle;

View File

@ -996,13 +996,14 @@ INTERNAL void user_update(void)
.move_dir = input_move_dir, .move_dir = input_move_dir,
.aim_pos = input_aim_pos .aim_pos = input_aim_pos
}); });
}
/* Queue player fire cmd */ /* Queue player fire cmd */
queue_game_cmd(&cmd_list, (struct game_cmd) { queue_game_cmd(&cmd_list, (struct game_cmd)
.kind = GAME_CMD_KIND_PLAYER_FIRE, {
.state = (G.bind_states[USER_BIND_KIND_FIRE].num_presses > 0 || G.bind_states[USER_BIND_KIND_FIRE].is_held) ? GAME_CMD_STATE_START : GAME_CMD_STATE_STOP .kind = GAME_CMD_KIND_PLAYER_FIRE,
}); .state = (G.bind_states[USER_BIND_KIND_FIRE].num_presses > 0 || G.bind_states[USER_BIND_KIND_FIRE].is_held) ? GAME_CMD_STATE_START : GAME_CMD_STATE_STOP
});
}
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */