diff --git a/res/graphics/tim.ase b/res/graphics/tim.ase index f975bd8d..fec5c35b 100644 --- a/res/graphics/tim.ase +++ b/res/graphics/tim.ase @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd0019692bfc14d9c0ad8b9140145ff81e49b26615a3636007d9b5fc01566aa8 -size 6087 +oid sha256:ec441d678c8163a5fed2ff71d5a88589183791064748fbda0974fa05712e06a2 +size 766 diff --git a/src/sim_step.c b/src/sim_step.c index af4324c3..6f0cf934 100644 --- a/src/sim_step.c +++ b/src/sim_step.c @@ -51,84 +51,6 @@ void sim_accel_reset(struct sim_snapshot *ss, struct sim_accel *accel) /* TODO: Remove this */ -INTERNAL void spawn_test_entities(struct sim_step_ctx *ctx, struct v2 offset) -{ - struct sim_snapshot *world = ctx->world; - struct sim_ent *root = sim_ent_from_id(world, SIM_ENT_ROOT_ID); - - root->mass_unscaled = F32_INFINITY; - root->inertia_unscaled = F32_INFINITY; - - /* Enemy */ - if (ctx->is_master) { - struct sim_ent *e = sim_ent_alloc_sync_src(root); - - struct v2 pos = V2(1, -2); - pos = v2_add(pos, offset); - f32 r = 0; - struct v2 size = V2(1, 1); - struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); - sim_ent_set_xform(e, xf); - - e->sprite = sprite_tag_from_path(LIT("res/graphics/tim.ase")); - e->sprite_collider_slice = LIT("shape"); - e->layer = SIM_LAYER_SHOULDERS; - - sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC); - e->mass_unscaled = 100; - e->inertia_unscaled = 10; - e->linear_ground_friction = 250; - e->angular_ground_friction = 200; - } - - /* Big box */ -#if 1 - { - struct sim_ent *e = sim_ent_alloc_local(root); - - struct v2 pos = V2(1, -0.5); - pos = v2_add(pos, offset); - f32 r = 0; - struct v2 size = V2(0.5, 0.25); - struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); - sim_ent_set_xform(e, xf); - - e->sprite = sprite_tag_from_path(LIT("res/graphics/box.ase")); - e->sprite_collider_slice = LIT("shape"); - e->layer = SIM_LAYER_SHOULDERS; - - sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC); - e->mass_unscaled = 100; - e->inertia_unscaled = 50; - e->linear_ground_friction = 100; - e->angular_ground_friction = 50; - } -#endif - - /* Tiny box */ -#if 0 - { - struct sim_ent *e = sim_ent_alloc_sync_src(root); - - struct v2 pos = V2(1, -0.5); - pos = v2_add(pos, offset); - f32 r = PI / 4; - struct v2 size = V2(0.5, 0.25); - struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); - sim_ent_set_xform(e, xf); - - e->sprite = sprite_tag_from_path(LIT("res/graphics/bullet.ase")); - e->sprite_collider_slice = LIT("shape"); - e->layer = SIM_LAYER_SHOULDERS; - - sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC); - e->mass_unscaled = 0.5; - e->inertia_unscaled = 1000; - e->linear_ground_friction = 0.001; - } -#endif -} - INTERNAL struct sim_ent *spawn_test_employee(struct sim_step_ctx *ctx) { struct sim_snapshot *world = ctx->world; @@ -165,7 +87,7 @@ INTERNAL struct sim_ent *spawn_test_employee(struct sim_step_ctx *ctx) e->local_collider.points[0] = V2(0, 0); e->local_collider.count = 1; - e->local_collider.radius = 0.30f; + e->local_collider.radius = 0.25f; struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); //xf.bx.y = -1.f; @@ -179,7 +101,7 @@ INTERNAL struct sim_ent *spawn_test_employee(struct sim_step_ctx *ctx) //e->control_force = 500; e->control_force = 1200; - e->control_force_max_speed = 8; + e->control_force_max_speed = 7; //e->control_torque = 5000; e->control_torque = F32_INFINITY; @@ -229,6 +151,93 @@ INTERNAL struct sim_ent *spawn_test_camera(struct sim_snapshot *world, struct si return camera_ent; } +INTERNAL void spawn_test_entities(struct sim_step_ctx *ctx, struct v2 offset) +{ + struct sim_snapshot *world = ctx->world; + struct sim_ent *root = sim_ent_from_id(world, SIM_ENT_ROOT_ID); + (UNUSED)offset; + + root->mass_unscaled = F32_INFINITY; + root->inertia_unscaled = F32_INFINITY; + +#if 0 + /* Enemy */ + if (ctx->is_master) { + struct sim_ent *e = sim_ent_alloc_sync_src(root); + + struct v2 pos = V2(1, -2); + pos = v2_add(pos, offset); + f32 r = 0; + struct v2 size = V2(1, 1); + struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); + sim_ent_set_xform(e, xf); + + e->sprite = sprite_tag_from_path(LIT("res/graphics/tim.ase")); + e->sprite_collider_slice = LIT("shape"); + e->layer = SIM_LAYER_SHOULDERS; + + sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC); + e->mass_unscaled = 100; + e->inertia_unscaled = 10; + e->linear_ground_friction = 250; + e->angular_ground_friction = 200; + } +#endif + + /* Enemy */ + if (ctx->is_master) { + struct sim_ent *e = spawn_test_employee(ctx); + (UNUSED)e; + } + + /* Big box */ +#if 0 + { + struct sim_ent *e = sim_ent_alloc_local(root); + + struct v2 pos = V2(1, -0.5); + pos = v2_add(pos, offset); + f32 r = 0; + struct v2 size = V2(0.5, 0.25); + struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); + sim_ent_set_xform(e, xf); + + e->sprite = sprite_tag_from_path(LIT("res/graphics/box.ase")); + e->sprite_collider_slice = LIT("shape"); + e->layer = SIM_LAYER_SHOULDERS; + + sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC); + e->mass_unscaled = 100; + e->inertia_unscaled = 50; + e->linear_ground_friction = 100; + e->angular_ground_friction = 50; + } +#endif + + /* Tiny box */ +#if 0 + { + struct sim_ent *e = sim_ent_alloc_sync_src(root); + + struct v2 pos = V2(1, -0.5); + pos = v2_add(pos, offset); + f32 r = PI / 4; + struct v2 size = V2(0.5, 0.25); + struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size); + sim_ent_set_xform(e, xf); + + e->sprite = sprite_tag_from_path(LIT("res/graphics/bullet.ase")); + e->sprite_collider_slice = LIT("shape"); + e->layer = SIM_LAYER_SHOULDERS; + + sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC); + e->mass_unscaled = 0.5; + e->inertia_unscaled = 1000; + e->linear_ground_friction = 0.001; + } +#endif +} + INTERNAL void test_clear_level(struct sim_step_ctx *ctx) { struct sim_snapshot *world = ctx->world;