From bbf366ed6e05c671d518c56a861c96206badcf88 Mon Sep 17 00:00:00 2001 From: mibi88 <76903855+mibi88@users.noreply.github.com> Date: Wed, 31 Jul 2024 17:12:12 +0200 Subject: [PATCH] Running clang-format --- src/map.c | 6 +++--- src/npc.c | 4 ++-- src/player.c | 22 +++++++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/map.c b/src/map.c index 6a53804..89cb3ca 100644 --- a/src/map.c +++ b/src/map.c @@ -228,14 +228,14 @@ short int map_get_walkable(Game *game, int x, int y) { Map *map_get_for_tile(Game *game, int x, int y) { int i = 0; Map *map = worldRPG[i]; - do{ + do { int rx = x - map->x; int ry = y - map->y; - if(rx >= 0 && rx < map->w && ry >= 0 && ry < map->h){ + if(rx >= 0 && rx < map->w && ry >= 0 && ry < map->h) { return map; } i++; map = worldRPG[i]; - }while(map != NULL); + } while(map != NULL); return game->map_level; } diff --git a/src/npc.c b/src/npc.c index 8223156..8286b76 100644 --- a/src/npc.c +++ b/src/npc.c @@ -267,8 +267,8 @@ void npc_draw(Game *game) { } #endif // DEBUGMODE - int16_t delX = ((Data->curx * PXSIZE)>>PRECISION) - (int16_t)pl->wx; - int16_t delY = ((Data->cury * PXSIZE)>>PRECISION) - (int16_t)pl->wy; + int16_t delX = ((Data->curx * PXSIZE) >> PRECISION) - (int16_t)pl->wx; + int16_t delY = ((Data->cury * PXSIZE) >> PRECISION) - (int16_t)pl->wy; bopti_image_t *face = npc_sprites[Data->face]; dimage(pl->px - P_WIDTH / 2 + delX, pl->py - P_HEIGHT / 2 + delY, face); } diff --git a/src/player.c b/src/player.c index 59bf857..72eb595 100644 --- a/src/player.c +++ b/src/player.c @@ -94,19 +94,23 @@ void player_move(Game *game, Direction direction) { player->wy = game->map_level->y * T_HEIGHT * PXSIZE + player->y; /* Check if we should change map */ - Map *target = map_get_for_tile(game, game->map_level->x+player->x/T_WIDTH+one_px_mov[direction * 2], game->map_level->y+player->y/T_HEIGHT+one_px_mov[direction * 2 + 1]); - if(target != game->map_level){ - if(target->x > game->map_level->x){ + Map *target = map_get_for_tile(game, + game->map_level->x + player->x / T_WIDTH + + one_px_mov[direction * 2], + game->map_level->y + player->y / T_HEIGHT + + one_px_mov[direction * 2 + 1]); + if(target != game->map_level) { + if(target->x > game->map_level->x) { player->x = 0; } - if(target->x < game->map_level->x){ - player->x = target->w*T_WIDTH; + if(target->x < game->map_level->x) { + player->x = target->w * T_WIDTH; } - if(target->y > game->map_level->y){ + if(target->y > game->map_level->y) { player->y = 0; } - if(target->y < game->map_level->y){ - player->y = target->h*T_HEIGHT; + if(target->y < game->map_level->y) { + player->y = target->h * T_HEIGHT; } game->map_level = target; } @@ -149,7 +153,7 @@ void player_action(Game *game) { bopti_image_t *face = &npc_male; /* It's a NPC */ - face = (bopti_image_t*)faces[currentNPC->face]; + face = (bopti_image_t *)faces[currentNPC->face]; uint32_t dialogStart = currentNPC->dialogID; /* we set this NPC to paused to avoid changing its position while