Compare commits

...

4 Commits

@ -26,7 +26,7 @@
#define DEBUG_TOOLS
#define CHIPMUNK_INTEGRITY_CHECK
// #define FAT_THRUSTERS
#define NO_GRAVITY
// #define NO_GRAVITY
// #define NO_SUNS
#else

@ -1593,6 +1593,7 @@ static cpVect get_global_hand_pos(cpVect world_mouse_pos, bool *hand_at_arms_len
global_hand_pos = cpvadd(global_hand_pos, entity_pos(myentity()));
return global_hand_pos;
}
static void frame(void)
{
PROFILE_SCOPE("frame")
@ -1977,6 +1978,25 @@ static void frame(void)
{
uint64_t tick_to_predict = tick(&gs);
apply_this_tick_of_input_to_player(tick_to_predict);
// process particles
// without processing them at fixed timestep, there is jitter
{
double dt = TIMESTEP;
PARTICLES_ITER(p)
{
if (p->alive)
{
p->alive_for += dt;
p->pos = cpvadd(p->pos, cpvmult(p->vel, dt));
if (p->alive_for > 1.0)
{
p->alive = false;
}
}
}
}
process(&gs, TIMESTEP);
time_to_process -= TIMESTEP;
}
@ -2192,17 +2212,11 @@ static void frame(void)
{
if (p->alive)
{
p->alive_for += dt;
p->pos = cpvadd(p->pos, cpvmult(p->vel, dt));
if (p->alive_for > 1.0)
{
p->alive = false;
}
set_color_values(1.0, 1.0, 1.0, 1.0 - clamp01(p->alive_for));
pipeline_scope(goodpixel_pipeline)
{
sgp_set_image(0, image_pip);
draw_texture_centered(p->pos, 0.15 * p->scaling);
draw_texture_centered(p->pos, 0.2 * p->scaling);
sgp_reset_image(0);
}
}
@ -2234,10 +2248,16 @@ static void frame(void)
if (b->box_type == BoxThruster)
{
cpVect particle_vel = box_vel(b);
particle_vel = cpvadd(particle_vel, cpvmult(box_facing_vector(b), 0.5 + hash11(exec_time)*0.2)); // move outwards from thruster
particle_vel = cpvspin(particle_vel, hash11(exec_time)*0.1);
new_particle(cpvadd(entity_pos(b), cpvmult(box_facing_vector(b), BOX_SIZE * 0.5)), particle_vel);
// spawn particles
if(b->thrust > 0.0)
{
cpVect particle_vel = box_vel(b);
double hash_offset = (double)get_id(&gs,b).index; // to make each thruster have a unique pattern of exhaust
cpVect additional_vel = cpvmult(box_facing_vector(b), 0.5 + hash11(exec_time + hash_offset) * 0.2); // move outwards from thruster
additional_vel = cpvspin(additional_vel, hash11(exec_time + hash_offset) * 0.1); // some spin
particle_vel = cpvadd(particle_vel, additional_vel);
new_particle(cpvadd(entity_pos(b), cpvmult(box_facing_vector(b), BOX_SIZE * 0.5)), particle_vel);
}
transform_scope()
{
set_color_values(1.0, 1.0, 1.0, 1.0);

@ -80,7 +80,7 @@
#define INSTANT_DEATH_DISTANCE_FROM_CENTER 10000.0f
#define SOLAR_ENERGY_PER_SECOND 0.09f
#define DAMAGE_TO_PLAYER_PER_BLOCK 0.1f
#define BATTERY_CAPACITY 1.5f
#define BATTERY_CAPACITY 4.5f
#define PLAYER_ENERGY_RECHARGE_PER_SECOND 0.2
#define EXPLOSION_TIME 0.5f
#define EXPLOSION_DAMAGE_PER_SEC 10.0f

Loading…
Cancel
Save