Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
computermouth committed Oct 17, 2023
1 parent 4dd2781 commit 024e03b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions entity_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ entity_t * entity_enemy_spawn_projectile(entity_t * e, void (*func)(entity_t *,
}

entity_t * entity_enemy_spawn_projectile_ng(entity_t * e, entity_id_t eid, float speed, float yaw_offset, float pitch_offset) {

entity_params_t ep = map_entt_params_from_eid(eid);
ep.entity_generic_params.position = e->p;

entity_t * projectile = game_spawn_ng(&ep);
projectile->_check_against = ENTITY_GROUP_PLAYER;
projectile->_yaw = e->_yaw + PI/2.0f;
Expand Down
2 changes: 1 addition & 1 deletion entity_projectile_grenade.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void entity_projectile_grenade_init(entity_t * e, uint8_t p1, uint8_t p2) {

void entity_projectile_grenade_update(entity_t * e) {
entity_update_physics(e);

// roll em
e->_yaw += (fabs(e->v.x) + fabs(e->v.y) + fabs(e->v.z)) * .02 * game_tick;
e->_pitch += (fabs(e->v.x) + fabs(e->v.y) + fabs(e->v.z)) * .02 * game_tick;
Expand Down
36 changes: 18 additions & 18 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,30 +147,30 @@ extern constfunc map_constfunc_from_eid(entity_id_t eid);

entity_t * game_spawn_ng (entity_params_t * ep) {

void (*constructor)(entity_t *, vec3_t, uint8_t, uint8_t) = map_constfunc_from_eid(ep->id);
// todo, spawn the things with parameters
if(ep->id >= __ENTITY_ID_END) {
fprintf(stderr, "E: unimp -- %d\n", ep->id);
return NULL;
}
entity_t * e = NULL;
if(ep->id == ENTITY_ID_LIGHT) {
e = game_spawn(
void (*constructor)(entity_t *, vec3_t, uint8_t, uint8_t) = map_constfunc_from_eid(ep->id);
// todo, spawn the things with parameters
if(ep->id >= __ENTITY_ID_END) {
fprintf(stderr, "E: unimp -- %d\n", ep->id);
return NULL;
}

entity_t * e = NULL;

if(ep->id == ENTITY_ID_LIGHT) {
e = game_spawn(
constructor,
ep->entity_light_params.position, 0, 0, ep);
} else if(ep->id == ENTITY_ID_PLAYER) {
e = game_spawn(
} else if(ep->id == ENTITY_ID_PLAYER) {
e = game_spawn(
constructor,
ep->entity_player_params.position, 0, 0, ep);
} else {
e = game_spawn(
} else {
e = game_spawn(
constructor,
ep->entity_generic_params.position, 0, 0, ep);
// todo
// free kv
}
// todo
// free kv
}

return e;
}
Expand Down
16 changes: 8 additions & 8 deletions map.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void map_init() {
}

typedef void (*constfunc)(entity_t *, vec3_t, uint8_t, uint8_t);
constfunc map_constfunc_from_eid(entity_id_t eid){
constfunc map_constfunc_from_eid(entity_id_t eid) {
return map_entity_table[eid].constructor_func;
}

Expand All @@ -149,24 +149,24 @@ void (*spawn_class[])(entity_t *, vec3_t, uint8_t, uint8_t) = {
};

ref_entt_t * map_ref_entt_from_eid(entity_id_t eid) {
if(eid < 0 || eid > __ENTITY_ID_END){
if(eid < 0 || eid > __ENTITY_ID_END) {
fprintf(stderr, "eid not found: %d\n", eid);
return NULL;
}
return vector_at(map->ref_entities, eid);
}

entity_params_t map_entt_params_from_eid(entity_id_t eid){
entity_params_t map_entt_params_from_eid(entity_id_t eid) {
entity_params_t ep = { 0 };
if(eid < 0 || eid > __ENTITY_ID_END){
if(eid < 0 || eid > __ENTITY_ID_END) {
fprintf(stderr, "eid not found: %d\n", eid);
return ep;
}

ref_entt_t * re = map_ref_entt_from_eid(eid);
ep.id = eid;
ep.entity_generic_params.ref_entt = re;

return ep;
}

Expand Down Expand Up @@ -619,11 +619,11 @@ void map_load (map_t * m) {
pos = &ep->entity_player_params.position;
if (ep->id == ENTITY_ID_LIGHT)
pos = &ep->entity_light_params.position;

pos->x *= 32;
pos->y *= 16;
pos->z *= 32;

game_spawn_ng(ep);
}

Expand Down
6 changes: 3 additions & 3 deletions weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void weapon_shoot(weapon_t * w, vec3_t pos, float yaw, float pitch) {
}

void weapon_spawn_projectile(weapon_t * w, vec3_t pos, float yaw, float pitch) {

entity_params_t ep = map_entt_params_from_eid(w->_projectile_type_ng);
ep.entity_generic_params.position = vec3_add(
pos,
Expand All @@ -52,9 +52,9 @@ void weapon_spawn_projectile(weapon_t * w, vec3_t pos, float yaw, float pitch) {
)
)
);

entity_t * projectile = game_spawn_ng(&ep);

projectile->v = vec3_rotate_yaw_pitch(
vec3(0, 0, w->_projectile_speed),
yaw, pitch
Expand Down

0 comments on commit 024e03b

Please sign in to comment.