|
|
@ -323,7 +323,6 @@ void create_player(Player *player)
|
|
|
|
unlock_box(player, BoxMedbay);
|
|
|
|
unlock_box(player, BoxMedbay);
|
|
|
|
unlock_box(player, BoxSolarPanel);
|
|
|
|
unlock_box(player, BoxSolarPanel);
|
|
|
|
unlock_box(player, BoxScanner);
|
|
|
|
unlock_box(player, BoxScanner);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void create_player_entity(GameState *gs, Entity *e)
|
|
|
|
void create_player_entity(GameState *gs, Entity *e)
|
|
|
@ -1601,7 +1600,6 @@ void create_initial_world(GameState *gs)
|
|
|
|
create_station(gs, (V2){-50.0f, 0.0f}, BoxExplosive);
|
|
|
|
create_station(gs, (V2){-50.0f, 0.0f}, BoxExplosive);
|
|
|
|
create_station(gs, (V2){0.0f, 100.0f}, BoxGyroscope);
|
|
|
|
create_station(gs, (V2){0.0f, 100.0f}, BoxGyroscope);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void exit_seat(GameState *gs, Entity *seat_in, Entity *p)
|
|
|
|
void exit_seat(GameState *gs, Entity *seat_in, Entity *p)
|
|
|
@ -1888,11 +1886,12 @@ void process(GameState *gs, float dt)
|
|
|
|
if (!e->exists)
|
|
|
|
if (!e->exists)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (e->body != NULL)
|
|
|
|
// sun processing
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cpVect p = cpvsub(cpBodyGetPosition(e->body), v2_to_cp(SUN_POS));
|
|
|
|
|
|
|
|
cpFloat sqdist = cpvlengthsq(p);
|
|
|
|
cpVect pos_rel_sun = v2_to_cp(V2sub(entity_pos(e), SUN_POS));
|
|
|
|
if (sqdist > (INSTANT_DEATH_DISTANCE_FROM_SUN * INSTANT_DEATH_DISTANCE_FROM_SUN))
|
|
|
|
cpFloat sqdist = cpvlengthsq(pos_rel_sun);
|
|
|
|
|
|
|
|
if (e->body != NULL && sqdist > (INSTANT_DEATH_DISTANCE_FROM_SUN * INSTANT_DEATH_DISTANCE_FROM_SUN))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool platonic_found = false;
|
|
|
|
bool platonic_found = false;
|
|
|
|
if (e->is_grid)
|
|
|
|
if (e->is_grid)
|
|
|
@ -1909,7 +1908,7 @@ void process(GameState *gs, float dt)
|
|
|
|
if (platonic_found)
|
|
|
|
if (platonic_found)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cpBody *body = e->body;
|
|
|
|
cpBody *body = e->body;
|
|
|
|
cpBodySetVelocity(body, cpvmult(cpBodyGetVelocity(body), -1.0));
|
|
|
|
cpBodySetVelocity(body, cpvmult(cpBodyGetVelocity(body), -0.5));
|
|
|
|
cpVect rel_to_sun = cpvsub(cpBodyGetPosition(body), v2_to_cp(SUN_POS));
|
|
|
|
cpVect rel_to_sun = cpvsub(cpBodyGetPosition(body), v2_to_cp(SUN_POS));
|
|
|
|
cpBodySetPosition(body, cpvadd(v2_to_cp(SUN_POS), cpvmult(cpvnormalize(rel_to_sun), INSTANT_DEATH_DISTANCE_FROM_SUN)));
|
|
|
|
cpBodySetPosition(body, cpvadd(v2_to_cp(SUN_POS), cpvmult(cpvnormalize(rel_to_sun), INSTANT_DEATH_DISTANCE_FROM_SUN)));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1919,15 +1918,21 @@ void process(GameState *gs, float dt)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!e->is_grid) // grids aren't damaged (this edge case sucks!)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sqdist = cpvlengthsq(cpvsub(v2_to_cp(entity_pos(e)), v2_to_cp(SUN_POS)));
|
|
|
|
if (sqdist < (SUN_RADIUS * SUN_RADIUS))
|
|
|
|
if (sqdist < (SUN_RADIUS * SUN_RADIUS))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
e->damage += 10.0f * dt;
|
|
|
|
e->damage += 10.0f * dt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cpVect g = cpvmult(p, -sun_gravity_at_point(entity_pos(e)) / (sqdist * cpfsqrt(sqdist)));
|
|
|
|
if (e->body != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cpVect g = cpvmult(pos_rel_sun, -sun_gravity_at_point(entity_pos(e)) / (sqdist * cpfsqrt(sqdist)));
|
|
|
|
cpBodyUpdateVelocity(e->body, g, 1.0f, dt);
|
|
|
|
cpBodyUpdateVelocity(e->body, g, 1.0f, dt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e->is_explosion)
|
|
|
|
if (e->is_explosion)
|
|
|
|
{
|
|
|
|
{
|
|
|
|