diff --git a/.vscode/settings.json b/.vscode/settings.json index 989c230..c0ab517 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -54,6 +54,11 @@ "stdint.h": "c", "ipsettings.h": "c", "cpvect.h": "c", - "miniaudio.h": "c" + "miniaudio.h": "c", + "bit": "c", + "condition_variable": "c", + "ctime": "c", + "limits": "c", + "xlocinfo": "c" } } \ No newline at end of file diff --git a/gamestate.c b/gamestate.c index 67feedd..41ff287 100644 --- a/gamestate.c +++ b/gamestate.c @@ -75,7 +75,7 @@ bool cloaking_active(GameState *gs, Entity *e) { // cloaking doesn't work for first 1/2 second of game because when initializing // everything needs to be uncloaked - return time(gs) >= 0.5 && (time(gs) - e->time_was_last_cloaked) <= TIMESTEP * 2.0; + return elapsed_time(gs) >= 0.5 && (elapsed_time(gs) - e->time_was_last_cloaked) <= TIMESTEP * 2.0; } bool is_cloaked(GameState *gs, Entity *e, Entity *this_players_perspective) @@ -1684,7 +1684,7 @@ static void cloaking_shield_callback_func(cpShape *shape, cpContactPointSet *poi GameState *gs = entitys_gamestate(from_cloaking_box); Entity *to_cloak = cp_shape_entity(shape); - to_cloak->time_was_last_cloaked = time(gs); + to_cloak->time_was_last_cloaked = elapsed_time(gs); to_cloak->last_cloaked_by_squad = from_cloaking_box->owning_squad; } @@ -1824,7 +1824,7 @@ uint64_t tick(GameState *gs) return gs->tick; } -double time(GameState *gs) +double elapsed_time(GameState *gs) { return ((double)gs->tick * TIMESTEP) + gs->subframe_time; } @@ -2247,7 +2247,7 @@ void process(struct GameState *gs, double dt) { p->goldness += 0.1; p->damage = 0.0; - gs->goldpos = (cpVect){.x = hash11((float)time(gs)) * 20.0, .y = hash11((float)time(gs) - 13.6) * 20.0}; + gs->goldpos = (cpVect){.x = hash11((float)elapsed_time(gs)) * 20.0, .y = hash11((float)elapsed_time(gs) - 13.6) * 20.0}; } #if 1 cpVect world_hand_pos = get_world_hand_pos(gs, &player->input, p); diff --git a/types.h b/types.h index c39c922..0d3cbd8 100644 --- a/types.h +++ b/types.h @@ -426,7 +426,7 @@ void process_fixed_timestep(GameState *gs); void process(struct GameState *gs, double dt); // does in place Entity *closest_box_to_point_in_radius(struct GameState *gs, cpVect point, double radius, bool (*filter_func)(Entity *)); uint64_t tick(struct GameState *gs); -double time(GameState *gs); +double elapsed_time(GameState *gs); double sun_dist_no_gravity(Entity *sun); // all of these return if successful or not