Fixes some odd indentations
This commit is contained in:
parent
4ceb82f171
commit
8221304df8
65
src/player.c
65
src/player.c
|
@ -181,7 +181,7 @@ on_monster_collision(Player *player,
|
||||||
action_spent(player);
|
action_spent(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
player_pickup_artifacts(Player *player, RoomSpace *space)
|
player_pickup_artifacts(Player *player, RoomSpace *space)
|
||||||
{
|
{
|
||||||
LinkedList *artifacts = space->artifacts;
|
LinkedList *artifacts = space->artifacts;
|
||||||
|
@ -191,7 +191,7 @@ player_pickup_artifacts(Player *player, RoomSpace *space)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
player_interact_objects(Player *player, RoomSpace *space)
|
player_interact_objects(Player *player, RoomSpace *space)
|
||||||
{
|
{
|
||||||
LinkedList *objects = space->objects;
|
LinkedList *objects = space->objects;
|
||||||
|
@ -201,7 +201,7 @@ player_interact_objects(Player *player, RoomSpace *space)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
player_collect_items(Player *player, RoomSpace *space)
|
player_collect_items(Player *player, RoomSpace *space)
|
||||||
{
|
{
|
||||||
LinkedList *items = space->items;
|
LinkedList *items = space->items;
|
||||||
|
@ -212,7 +212,7 @@ player_collect_items(Player *player, RoomSpace *space)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
player_interact_traps_and_pits(Player *player, RoomSpace *space)
|
player_interact_traps_and_pits(Player *player, RoomSpace *space)
|
||||||
{
|
{
|
||||||
if (space->lethal) {
|
if (space->lethal) {
|
||||||
|
@ -224,7 +224,7 @@ player_interact_traps_and_pits(Player *player, RoomSpace *space)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
player_has_collided(Player *p, RoomSpace *space)
|
player_has_collided(Player *p, RoomSpace *space)
|
||||||
{
|
{
|
||||||
if (space->occupied)
|
if (space->occupied)
|
||||||
|
@ -233,7 +233,7 @@ player_has_collided(Player *p, RoomSpace *space)
|
||||||
return !p->phase_count && space->monster && space->monster->sprite->state != SPRITE_STATE_FALLING;
|
return !p->phase_count && space->monster && space->monster->sprite->state != SPRITE_STATE_FALLING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
has_collided(Player *player, RoomMatrix *matrix, Vector2d direction)
|
has_collided(Player *player, RoomMatrix *matrix, Vector2d direction)
|
||||||
{
|
{
|
||||||
Position roomCoord = position_to_room_coords(&player->sprite->pos);
|
Position roomCoord = position_to_room_coords(&player->sprite->pos);
|
||||||
|
@ -276,7 +276,7 @@ has_collided(Player *player, RoomMatrix *matrix, Vector2d direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_clip_for_direction(Player *player, Vector2d *direction)
|
set_clip_for_direction(Player *player, Vector2d *direction)
|
||||||
{
|
{
|
||||||
if (vector2d_equals(*direction, VECTOR2D_LEFT))
|
if (vector2d_equals(*direction, VECTOR2D_LEFT))
|
||||||
|
@ -289,7 +289,7 @@ set_clip_for_direction(Player *player, Vector2d *direction)
|
||||||
player->sprite->clip.y = 0;
|
player->sprite->clip.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_turn(Player *player, Vector2d *direction)
|
player_turn(Player *player, Vector2d *direction)
|
||||||
{
|
{
|
||||||
set_clip_for_direction(player, direction);
|
set_clip_for_direction(player, direction);
|
||||||
|
@ -316,7 +316,7 @@ player_turn(Player *player, Vector2d *direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
move(Player *player, RoomMatrix *matrix, Vector2d direction)
|
move(Player *player, RoomMatrix *matrix, Vector2d direction)
|
||||||
{
|
{
|
||||||
player_turn(player, &direction);
|
player_turn(player, &direction);
|
||||||
|
@ -343,7 +343,7 @@ move(Player *player, RoomMatrix *matrix, Vector2d direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_sip_health(Player *player)
|
player_sip_health(Player *player)
|
||||||
{
|
{
|
||||||
bool hasSips = player->class == MAGE ?
|
bool hasSips = player->class == MAGE ?
|
||||||
|
@ -362,7 +362,7 @@ player_sip_health(Player *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Vector2d
|
static Vector2d
|
||||||
read_direction_from(Input *input)
|
read_direction_from(Input *input)
|
||||||
{
|
{
|
||||||
if (input_key_is_pressed(input, KEY_LEFT))
|
if (input_key_is_pressed(input, KEY_LEFT))
|
||||||
|
@ -377,7 +377,7 @@ read_direction_from(Input *input)
|
||||||
return VECTOR2D_NODIR;
|
return VECTOR2D_NODIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_next_move(UpdateData *data)
|
handle_next_move(UpdateData *data)
|
||||||
{
|
{
|
||||||
static unsigned int step = 1;
|
static unsigned int step = 1;
|
||||||
|
@ -417,7 +417,7 @@ handle_next_move(UpdateData *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
use_skill(Skill *skill, SkillData *skillData)
|
use_skill(Skill *skill, SkillData *skillData)
|
||||||
{
|
{
|
||||||
skill->active = false;
|
skill->active = false;
|
||||||
|
@ -427,7 +427,7 @@ use_skill(Skill *skill, SkillData *skillData)
|
||||||
skill->resetCountdown = skill->resetTime;
|
skill->resetCountdown = skill->resetTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_skill_activation(UpdateData *data)
|
check_skill_activation(UpdateData *data)
|
||||||
{
|
{
|
||||||
// TODO(Linus): This could be "smarter"
|
// TODO(Linus): This could be "smarter"
|
||||||
|
@ -468,7 +468,7 @@ check_skill_activation(UpdateData *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
check_skill_trigger(UpdateData *data)
|
check_skill_trigger(UpdateData *data)
|
||||||
{
|
{
|
||||||
Player *player = data->player;
|
Player *player = data->player;
|
||||||
|
@ -496,7 +496,7 @@ check_skill_trigger(UpdateData *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_sword_animation(Player *p, SDL_Renderer *renderer)
|
build_sword_animation(Player *p, SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
animation_load_texture(p->swordAnimation, "Extras/SwordSwing.png", renderer);
|
animation_load_texture(p->swordAnimation, "Extras/SwordSwing.png", renderer);
|
||||||
|
@ -514,7 +514,7 @@ build_sword_animation(Player *p, SDL_Renderer *renderer)
|
||||||
p->swordAnimation->sprite->rotationPoint = (SDL_Point) { 16, 16 };
|
p->swordAnimation->sprite->rotationPoint = (SDL_Point) { 16, 16 };
|
||||||
}
|
}
|
||||||
|
|
||||||
Player*
|
Player*
|
||||||
player_create(class_t class, Camera *cam)
|
player_create(class_t class, Camera *cam)
|
||||||
{
|
{
|
||||||
Player *player = malloc(sizeof(Player));
|
Player *player = malloc(sizeof(Player));
|
||||||
|
@ -596,7 +596,7 @@ player_create(class_t class, Camera *cam)
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_reset_on_levelchange(Player *player)
|
player_reset_on_levelchange(Player *player)
|
||||||
{
|
{
|
||||||
player->sprite->pos = (Position) {
|
player->sprite->pos = (Position) {
|
||||||
|
@ -604,7 +604,8 @@ player_reset_on_levelchange(Player *player)
|
||||||
player->equipment.keys = 0;
|
player->equipment.keys = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExperienceData player_get_xp_data(Player *p)
|
ExperienceData
|
||||||
|
player_get_xp_data(Player *p)
|
||||||
{
|
{
|
||||||
ExperienceData data;
|
ExperienceData data;
|
||||||
data.previousLevel = next_level_threshold(p->stats.lvl - 1);
|
data.previousLevel = next_level_threshold(p->stats.lvl - 1);
|
||||||
|
@ -614,7 +615,7 @@ ExperienceData player_get_xp_data(Player *p)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_monster_kill_check(Player *player, Monster *monster)
|
player_monster_kill_check(Player *player, Monster *monster)
|
||||||
{
|
{
|
||||||
if (!monster)
|
if (!monster)
|
||||||
|
@ -654,7 +655,7 @@ player_monster_kill_check(Player *player, Monster *monster)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_hit(Player *p, unsigned int dmg)
|
player_hit(Player *p, unsigned int dmg)
|
||||||
{
|
{
|
||||||
if (dmg > 0) {
|
if (dmg > 0) {
|
||||||
|
@ -678,7 +679,7 @@ player_hit(Player *p, unsigned int dmg)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_render(Player *player, Camera *cam)
|
player_render(Player *player, Camera *cam)
|
||||||
{
|
{
|
||||||
sprite_set_alpha(player->sprite, player->phase_count ? 150 : 255);
|
sprite_set_alpha(player->sprite, player->phase_count ? 150 : 255);
|
||||||
|
@ -691,25 +692,25 @@ player_render(Player *player, Camera *cam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_render_toplayer(Player *player, Camera *camera)
|
player_render_toplayer(Player *player, Camera *camera)
|
||||||
{
|
{
|
||||||
animation_render(player->swordAnimation, camera);
|
animation_render(player->swordAnimation, camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_reset_steps(Player *p)
|
player_reset_steps(Player *p)
|
||||||
{
|
{
|
||||||
p->stat_data.steps = 0;
|
p->stat_data.steps = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reset_dagger_skill(Player *p)
|
reset_dagger_skill(Player *p)
|
||||||
{
|
{
|
||||||
p->skills[3]->resetCountdown = 0;
|
p->skills[3]->resetCountdown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_update(UpdateData *data)
|
player_update(UpdateData *data)
|
||||||
{
|
{
|
||||||
Player *player = data->player;
|
Player *player = data->player;
|
||||||
|
@ -749,7 +750,7 @@ player_update(UpdateData *data)
|
||||||
animation_update(player->swordAnimation);
|
animation_update(player->swordAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
player_reset(Player *player)
|
player_reset(Player *player)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < LAST_ARTIFACT_EFFECT; ++i)
|
for (size_t i = 0; i < LAST_ARTIFACT_EFFECT; ++i)
|
||||||
|
@ -760,7 +761,7 @@ player_reset(Player *player)
|
||||||
projectile_destroy(linkedlist_pop(&player->projectiles));
|
projectile_destroy(linkedlist_pop(&player->projectiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_destroy(Player *player)
|
player_destroy(Player *player)
|
||||||
{
|
{
|
||||||
player_reset(player);
|
player_reset(player);
|
||||||
|
@ -780,19 +781,19 @@ player_destroy(Player *player)
|
||||||
free(player);
|
free(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
player_turn_over(Player *player)
|
player_turn_over(Player *player)
|
||||||
{
|
{
|
||||||
return player->stat_data.steps >= player->stats.speed;
|
return player->stat_data.steps >= player->stats.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32
|
Uint32
|
||||||
player_has_artifact(Player *p, MagicalEffect effect)
|
player_has_artifact(Player *p, MagicalEffect effect)
|
||||||
{
|
{
|
||||||
return p->equipment.artifacts[effect].level;
|
return p->equipment.artifacts[effect].level;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_add_artifact(Player *p, Artifact *a)
|
player_add_artifact(Player *p, Artifact *a)
|
||||||
{
|
{
|
||||||
if (a->price > p->gold) {
|
if (a->price > p->gold) {
|
||||||
|
@ -822,7 +823,7 @@ player_add_artifact(Player *p, Artifact *a)
|
||||||
p->equipment.hasArtifacts = true;
|
p->equipment.hasArtifacts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_set_falling(Player *player)
|
player_set_falling(Player *player)
|
||||||
{
|
{
|
||||||
mixer_play_effect(FALL0 + get_random(1));
|
mixer_play_effect(FALL0 + get_random(1));
|
||||||
|
|
Loading…
Reference in New Issue