diff --git a/Flight.vcxproj b/Flight.vcxproj index 539277f..2a145c4 100644 --- a/Flight.vcxproj +++ b/Flight.vcxproj @@ -58,7 +58,6 @@ true v143 Unicode - false Application diff --git a/flight.rdbg b/flight.rdbg index add557f..b9fccbd 100644 Binary files a/flight.rdbg and b/flight.rdbg differ diff --git a/gamestate.c b/gamestate.c index b575c9b..c5f7e90 100644 --- a/gamestate.c +++ b/gamestate.c @@ -2492,21 +2492,28 @@ void process(struct GameState *gs, double dt, bool is_subframe) { cpVect pos_rel_sun = (cpvsub(entity_pos(e), (entity_pos(i.sun)))); cpFloat sqdist = cpvlengthsq(pos_rel_sun); + if (!e->is_grid) // grids aren't damaged (this edge case sucks!) { - sqdist = cpvlengthsq(cpvsub((entity_pos(e)), (entity_pos(i.sun)))); - if (sqdist < (i.sun->sun_radius * i.sun->sun_radius)) + PROFILE_SCOPE("Grid processing") { - e->damage += 10.0 * dt; + sqdist = cpvlengthsq(cpvsub((entity_pos(e)), (entity_pos(i.sun)))); + if (sqdist < (i.sun->sun_radius * i.sun->sun_radius)) + { + e->damage += 10.0 * dt; + } } } if (e->body != NULL) { - cpVect accel = sun_gravity_accel_for_entity(e, i.sun); - cpVect new_vel = entity_vel(gs, e); - new_vel = cpvadd(new_vel, cpvmult(accel, dt)); - cpBodySetVelocity(e->body, (new_vel)); + PROFILE_SCOPE("Body processing") + { + cpVect accel = sun_gravity_accel_for_entity(e, i.sun); + cpVect new_vel = entity_vel(gs, e); + new_vel = cpvadd(new_vel, cpvmult(accel, dt)); + cpBodySetVelocity(e->body, (new_vel)); + } } } } diff --git a/main.c b/main.c index 99080bd..372bc1d 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,5 @@ //------------------------------------------------------------------------------ + // Take flight //------------------------------------------------------------------------------ @@ -1559,8 +1560,6 @@ static void frame(void) } } - // dbg_rect(before_reprediction); - // gameplay ui(false, dt, width, height); // if ui button is pressed before game logic, set the pressed to // false so it doesn't propagate from the UI modal/button diff --git a/server.c b/server.c index da8b945..6e5f40d 100644 --- a/server.c +++ b/server.c @@ -25,6 +25,7 @@ // started in a thread from host void server(void *info_raw) { + init_profiling_mythread(1); ServerThreadInfo *info = (ServerThreadInfo *)info_raw; const char *world_save_name = info->world_save; #ifdef PROFILING @@ -38,7 +39,6 @@ void server(void *info_raw) gs.server_side_computing = true; Log("Allocated %zu bytes for entities\n", entities_size); - init_profiling_mythread(1); create_initial_world(&gs); diff --git a/types.h b/types.h index f565583..41793e4 100644 --- a/types.h +++ b/types.h @@ -52,7 +52,7 @@ #define SOLAR_ENERGY_PER_SECOND 0.09f #define DAMAGE_TO_PLAYER_PER_BLOCK 0.1f #define BATTERY_CAPACITY 1.5f -#define PLAYER_ENERGY_RECHARGE_PER_SECOND 0.2f +#define PLAYER_ENERGY_RECHARGE_PER_SECOND 0.2 #define EXPLOSION_TIME 0.5f #define EXPLOSION_DAMAGE_PER_SEC 10.0f #define EXPLOSION_DAMAGE_THRESHOLD 0.2f // how much damage until it explodes