Running clang-format

This commit is contained in:
mibi88 2024-07-31 17:12:12 +02:00
parent 3dd4b6466a
commit bbf366ed6e
3 changed files with 18 additions and 14 deletions

View file

@ -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) { Map *map_get_for_tile(Game *game, int x, int y) {
int i = 0; int i = 0;
Map *map = worldRPG[i]; Map *map = worldRPG[i];
do{ do {
int rx = x - map->x; int rx = x - map->x;
int ry = y - map->y; 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; return map;
} }
i++; i++;
map = worldRPG[i]; map = worldRPG[i];
}while(map != NULL); } while(map != NULL);
return game->map_level; return game->map_level;
} }

View file

@ -267,8 +267,8 @@ void npc_draw(Game *game) {
} }
#endif // DEBUGMODE #endif // DEBUGMODE
int16_t delX = ((Data->curx * PXSIZE)>>PRECISION) - (int16_t)pl->wx; int16_t delX = ((Data->curx * PXSIZE) >> PRECISION) - (int16_t)pl->wx;
int16_t delY = ((Data->cury * PXSIZE)>>PRECISION) - (int16_t)pl->wy; int16_t delY = ((Data->cury * PXSIZE) >> PRECISION) - (int16_t)pl->wy;
bopti_image_t *face = npc_sprites[Data->face]; bopti_image_t *face = npc_sprites[Data->face];
dimage(pl->px - P_WIDTH / 2 + delX, pl->py - P_HEIGHT / 2 + delY, face); dimage(pl->px - P_WIDTH / 2 + delX, pl->py - P_HEIGHT / 2 + delY, face);
} }

View file

@ -94,19 +94,23 @@ void player_move(Game *game, Direction direction) {
player->wy = game->map_level->y * T_HEIGHT * PXSIZE + player->y; player->wy = game->map_level->y * T_HEIGHT * PXSIZE + player->y;
/* Check if we should change map */ /* 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]); Map *target = map_get_for_tile(game,
if(target != game->map_level){ game->map_level->x + player->x / T_WIDTH +
if(target->x > game->map_level->x){ 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; player->x = 0;
} }
if(target->x < game->map_level->x){ if(target->x < game->map_level->x) {
player->x = target->w*T_WIDTH; player->x = target->w * T_WIDTH;
} }
if(target->y > game->map_level->y){ if(target->y > game->map_level->y) {
player->y = 0; player->y = 0;
} }
if(target->y < game->map_level->y){ if(target->y < game->map_level->y) {
player->y = target->h*T_HEIGHT; player->y = target->h * T_HEIGHT;
} }
game->map_level = target; game->map_level = target;
} }
@ -149,7 +153,7 @@ void player_action(Game *game) {
bopti_image_t *face = &npc_male; bopti_image_t *face = &npc_male;
/* It's a NPC */ /* It's a NPC */
face = (bopti_image_t*)faces[currentNPC->face]; face = (bopti_image_t *)faces[currentNPC->face];
uint32_t dialogStart = currentNPC->dialogID; uint32_t dialogStart = currentNPC->dialogID;
/* we set this NPC to paused to avoid changing its position while /* we set this NPC to paused to avoid changing its position while