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) {
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;
}

View file

@ -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);
}

View file

@ -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