|
|
@ -94,7 +94,8 @@ void unlock_box(Player *player, enum BoxType box)
|
|
|
|
bool box_unlocked(Player *player, enum BoxType box)
|
|
|
|
bool box_unlocked(Player *player, enum BoxType box)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert(box < MAX_BOX_TYPES);
|
|
|
|
assert(box < MAX_BOX_TYPES);
|
|
|
|
if(box == BoxInvalid) return false;
|
|
|
|
if (box == BoxInvalid)
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return learned_boxes_has_box(player->box_unlocks, box);
|
|
|
|
return learned_boxes_has_box(player->box_unlocks, box);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -618,7 +619,8 @@ float entity_angular_velocity(Entity *grid)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Entity *box_grid(Entity *box)
|
|
|
|
Entity *box_grid(Entity *box)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(box == NULL) return NULL;
|
|
|
|
if (box == NULL)
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
assert(box->is_box);
|
|
|
|
assert(box->is_box);
|
|
|
|
return (Entity *)cpBodyGetUserData(cpShapeGetBody(box->shape));
|
|
|
|
return (Entity *)cpBodyGetUserData(cpShapeGetBody(box->shape));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1774,7 +1776,7 @@ void process(GameState *gs, float dt)
|
|
|
|
if (maybe_box_to_destroy != NULL)
|
|
|
|
if (maybe_box_to_destroy != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Entity *cur_box = cp_shape_entity(maybe_box_to_destroy);
|
|
|
|
Entity *cur_box = cp_shape_entity(maybe_box_to_destroy);
|
|
|
|
if (!cur_box->indestructible)
|
|
|
|
if (!cur_box->indestructible && !cur_box->is_platonic)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Entity *cur_grid = cp_body_entity(cpShapeGetBody(maybe_box_to_destroy));
|
|
|
|
Entity *cur_grid = cp_body_entity(cpShapeGetBody(maybe_box_to_destroy));
|
|
|
|
p->damage -= DAMAGE_TO_PLAYER_PER_BLOCK * ((BATTERY_CAPACITY - cur_box->energy_used) / BATTERY_CAPACITY);
|
|
|
|
p->damage -= DAMAGE_TO_PLAYER_PER_BLOCK * ((BATTERY_CAPACITY - cur_box->energy_used) / BATTERY_CAPACITY);
|
|
|
@ -1806,7 +1808,8 @@ void process(GameState *gs, float dt)
|
|
|
|
grid_correct_for_holes(gs, target_grid); // no holey ship for you!
|
|
|
|
grid_correct_for_holes(gs, target_grid); // no holey ship for you!
|
|
|
|
new_box->box_type = player->input.build_type;
|
|
|
|
new_box->box_type = player->input.build_type;
|
|
|
|
new_box->compass_rotation = player->input.build_rotation;
|
|
|
|
new_box->compass_rotation = player->input.build_rotation;
|
|
|
|
if(new_box->box_type == BoxScanner) new_box->blueprints_learned = player->box_unlocks;
|
|
|
|
if (new_box->box_type == BoxScanner)
|
|
|
|
|
|
|
|
new_box->blueprints_learned = player->box_unlocks;
|
|
|
|
if (new_box->box_type == BoxBattery)
|
|
|
|
if (new_box->box_type == BoxBattery)
|
|
|
|
new_box->energy_used = BATTERY_CAPACITY;
|
|
|
|
new_box->energy_used = BATTERY_CAPACITY;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1834,8 +1837,30 @@ void process(GameState *gs, float dt)
|
|
|
|
cpVect p = cpvsub(cpBodyGetPosition(e->body), v2_to_cp(SUN_POS));
|
|
|
|
cpVect p = cpvsub(cpBodyGetPosition(e->body), v2_to_cp(SUN_POS));
|
|
|
|
cpFloat sqdist = cpvlengthsq(p);
|
|
|
|
cpFloat sqdist = cpvlengthsq(p);
|
|
|
|
if (sqdist > (INSTANT_DEATH_DISTANCE_FROM_SUN * INSTANT_DEATH_DISTANCE_FROM_SUN))
|
|
|
|
if (sqdist > (INSTANT_DEATH_DISTANCE_FROM_SUN * INSTANT_DEATH_DISTANCE_FROM_SUN))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool platonic_found = false;
|
|
|
|
|
|
|
|
if(e->is_grid)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BOXES_ITER(gs, cur_box, e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(cur_box->is_platonic)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
platonic_found = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (platonic_found)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cpBody *body = e->body;
|
|
|
|
|
|
|
|
cpBodySetVelocity(body, cpvmult(cpBodyGetVelocity(body), -1.0));
|
|
|
|
|
|
|
|
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)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entity_destroy(gs, e);
|
|
|
|
entity_destroy(gs, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sqdist < (SUN_RADIUS * SUN_RADIUS))
|
|
|
|
if (sqdist < (SUN_RADIUS * SUN_RADIUS))
|
|
|
|