minor cleanup
This commit is contained in:
parent
1125015ff7
commit
d17727c133
20
src/entity.h
20
src/entity.h
@ -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 */
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
13
src/user.c
13
src/user.c
@ -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
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user