Running clang-format

This commit is contained in:
mibi88 2024-07-31 14:39:09 +02:00
parent 6cfe0ab687
commit 490fceca25
2 changed files with 14 additions and 10 deletions

View file

@ -30,10 +30,10 @@ void interaction_available(Game *game) {
/* simple distance check along X and Y axis */ /* simple distance check along X and Y axis */
/* Be careful to use world coordinates, not local (i.e.map) ones */ /* Be careful to use world coordinates, not local (i.e.map) ones */
if((abs((int)game->player.wx - if((abs((int)game->player.wx -
(int)(game->map_level->npcs[i].curx>>PRECISION) * PXSIZE) < (int)(game->map_level->npcs[i].curx >> PRECISION) * PXSIZE) <
MAX_INTERACTION_DISTANCE * PXSIZE) && MAX_INTERACTION_DISTANCE * PXSIZE) &&
(abs((int)game->player.wy - (abs((int)game->player.wy -
(int)(game->map_level->npcs[i].cury>>PRECISION) * PXSIZE) < (int)(game->map_level->npcs[i].cury >> PRECISION) * PXSIZE) <
MAX_INTERACTION_DISTANCE * PXSIZE)) { MAX_INTERACTION_DISTANCE * PXSIZE)) {
/* the player can do something */ /* the player can do something */
game->player.canDoSomething = true; game->player.canDoSomething = true;

View file

@ -108,8 +108,8 @@ int npc_pathfind(int32_t dest_x, int32_t dest_y, Map *full_map, NPC *npc) {
int32_t w = full_map->w; int32_t w = full_map->w;
int32_t h = full_map->h; int32_t h = full_map->h;
int32_t x = (npc->curx>>PRECISION) / T_WIDTH; int32_t x = (npc->curx >> PRECISION) / T_WIDTH;
int32_t y = (npc->cury>>PRECISION) / T_HEIGHT; int32_t y = (npc->cury >> PRECISION) / T_HEIGHT;
dest_x /= T_WIDTH; dest_x /= T_WIDTH;
dest_y /= T_HEIGHT; dest_y /= T_HEIGHT;
int32_t spos = y * w + x; int32_t spos = y * w + x;
@ -213,8 +213,10 @@ void update_npc(NPC *npc) {
if(!npc->hasPath || npc->paused == true) if(!npc->hasPath || npc->paused == true)
return; return;
float vecX = (float)(npc->xpath[npc->currentPoint] + npc->x) - (npc->curx>>PRECISION); float vecX = (float)(npc->xpath[npc->currentPoint] + npc->x) -
float vecY = (float)(npc->ypath[npc->currentPoint] + npc->y) - (npc->cury>>PRECISION); (npc->curx >> PRECISION);
float vecY = (float)(npc->ypath[npc->currentPoint] + npc->y) -
(npc->cury >> PRECISION);
float vecN = length(vecX, vecY); float vecN = length(vecX, vecY);
if(vecN > 0.5f) { if(vecN > 0.5f) {
@ -225,8 +227,8 @@ void update_npc(NPC *npc) {
npc->currentPoint = npc->currentPoint % npc->path_length; npc->currentPoint = npc->currentPoint % npc->path_length;
} }
npc->curx += vecX*(float)(1<<PRECISION); npc->curx += vecX * (float)(1 << PRECISION);
npc->cury += vecY*(float)(1<<PRECISION); npc->cury += vecY * (float)(1 << PRECISION);
} }
void npc_draw(Game *game) { void npc_draw(Game *game) {
@ -265,8 +267,10 @@ void npc_draw(Game *game) {
} }
#endif // DEBUGMODE #endif // DEBUGMODE
int16_t delX = ((int16_t)((Data->curx>>PRECISION) * PXSIZE)) - (int16_t)pl->wx; int16_t delX =
int16_t delY = ((int16_t)((Data->cury>>PRECISION) * PXSIZE)) - (int16_t)pl->wy; ((int16_t)((Data->curx >> PRECISION) * PXSIZE)) - (int16_t)pl->wx;
int16_t delY =
((int16_t)((Data->cury >> PRECISION) * PXSIZE)) - (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);
} }