head 1.2; access; symbols pkgsrc-2026Q1:1.2.0.162 pkgsrc-2026Q1-base:1.2 pkgsrc-2025Q4:1.2.0.160 pkgsrc-2025Q4-base:1.2 pkgsrc-2025Q3:1.2.0.158 pkgsrc-2025Q3-base:1.2 pkgsrc-2025Q2:1.2.0.156 pkgsrc-2025Q2-base:1.2 pkgsrc-2025Q1:1.2.0.154 pkgsrc-2025Q1-base:1.2 pkgsrc-2024Q4:1.2.0.152 pkgsrc-2024Q4-base:1.2 pkgsrc-2024Q3:1.2.0.150 pkgsrc-2024Q3-base:1.2 pkgsrc-2024Q2:1.2.0.148 pkgsrc-2024Q2-base:1.2 pkgsrc-2024Q1:1.2.0.146 pkgsrc-2024Q1-base:1.2 pkgsrc-2023Q4:1.2.0.144 pkgsrc-2023Q4-base:1.2 pkgsrc-2023Q3:1.2.0.142 pkgsrc-2023Q3-base:1.2 pkgsrc-2023Q2:1.2.0.140 pkgsrc-2023Q2-base:1.2 pkgsrc-2023Q1:1.2.0.138 pkgsrc-2023Q1-base:1.2 pkgsrc-2022Q4:1.2.0.136 pkgsrc-2022Q4-base:1.2 pkgsrc-2022Q3:1.2.0.134 pkgsrc-2022Q3-base:1.2 pkgsrc-2022Q2:1.2.0.132 pkgsrc-2022Q2-base:1.2 pkgsrc-2022Q1:1.2.0.130 pkgsrc-2022Q1-base:1.2 pkgsrc-2021Q4:1.2.0.128 pkgsrc-2021Q4-base:1.2 pkgsrc-2021Q3:1.2.0.126 pkgsrc-2021Q3-base:1.2 pkgsrc-2021Q2:1.2.0.124 pkgsrc-2021Q2-base:1.2 pkgsrc-2021Q1:1.2.0.122 pkgsrc-2021Q1-base:1.2 pkgsrc-2020Q4:1.2.0.120 pkgsrc-2020Q4-base:1.2 pkgsrc-2020Q3:1.2.0.118 pkgsrc-2020Q3-base:1.2 pkgsrc-2020Q2:1.2.0.114 pkgsrc-2020Q2-base:1.2 pkgsrc-2020Q1:1.2.0.94 pkgsrc-2020Q1-base:1.2 pkgsrc-2019Q4:1.2.0.116 pkgsrc-2019Q4-base:1.2 pkgsrc-2019Q3:1.2.0.112 pkgsrc-2019Q3-base:1.2 pkgsrc-2019Q2:1.2.0.110 pkgsrc-2019Q2-base:1.2 pkgsrc-2019Q1:1.2.0.108 pkgsrc-2019Q1-base:1.2 pkgsrc-2018Q4:1.2.0.106 pkgsrc-2018Q4-base:1.2 pkgsrc-2018Q3:1.2.0.104 pkgsrc-2018Q3-base:1.2 pkgsrc-2018Q2:1.2.0.102 pkgsrc-2018Q2-base:1.2 pkgsrc-2018Q1:1.2.0.100 pkgsrc-2018Q1-base:1.2 pkgsrc-2017Q4:1.2.0.98 pkgsrc-2017Q4-base:1.2 pkgsrc-2017Q3:1.2.0.96 pkgsrc-2017Q3-base:1.2 pkgsrc-2017Q2:1.2.0.92 pkgsrc-2017Q2-base:1.2 pkgsrc-2017Q1:1.2.0.90 pkgsrc-2017Q1-base:1.2 pkgsrc-2016Q4:1.2.0.88 pkgsrc-2016Q4-base:1.2 pkgsrc-2016Q3:1.2.0.86 pkgsrc-2016Q3-base:1.2 pkgsrc-2016Q2:1.2.0.84 pkgsrc-2016Q2-base:1.2 pkgsrc-2016Q1:1.2.0.82 pkgsrc-2016Q1-base:1.2 pkgsrc-2015Q4:1.2.0.80 pkgsrc-2015Q4-base:1.2 pkgsrc-2015Q3:1.2.0.78 pkgsrc-2015Q3-base:1.2 pkgsrc-2015Q2:1.2.0.76 pkgsrc-2015Q2-base:1.2 pkgsrc-2015Q1:1.2.0.74 pkgsrc-2015Q1-base:1.2 pkgsrc-2014Q4:1.2.0.72 pkgsrc-2014Q4-base:1.2 pkgsrc-2014Q3:1.2.0.70 pkgsrc-2014Q3-base:1.2 pkgsrc-2014Q2:1.2.0.68 pkgsrc-2014Q2-base:1.2 pkgsrc-2014Q1:1.2.0.66 pkgsrc-2014Q1-base:1.2 pkgsrc-2013Q4:1.2.0.64 pkgsrc-2013Q4-base:1.2 pkgsrc-2013Q3:1.2.0.62 pkgsrc-2013Q3-base:1.2 pkgsrc-2013Q2:1.2.0.60 pkgsrc-2013Q2-base:1.2 pkgsrc-2013Q1:1.2.0.58 pkgsrc-2013Q1-base:1.2 pkgsrc-2012Q4:1.2.0.56 pkgsrc-2012Q4-base:1.2 pkgsrc-2012Q3:1.2.0.54 pkgsrc-2012Q3-base:1.2 pkgsrc-2012Q2:1.2.0.52 pkgsrc-2012Q2-base:1.2 pkgsrc-2012Q1:1.2.0.50 pkgsrc-2012Q1-base:1.2 pkgsrc-2011Q4:1.2.0.48 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q3:1.2.0.46 pkgsrc-2011Q3-base:1.2 pkgsrc-2011Q2:1.2.0.44 pkgsrc-2011Q2-base:1.2 pkgsrc-2011Q1:1.2.0.42 pkgsrc-2011Q1-base:1.2 pkgsrc-2010Q4:1.2.0.40 pkgsrc-2010Q4-base:1.2 pkgsrc-2010Q3:1.2.0.38 pkgsrc-2010Q3-base:1.2 pkgsrc-2010Q2:1.2.0.36 pkgsrc-2010Q2-base:1.2 pkgsrc-2010Q1:1.2.0.34 pkgsrc-2010Q1-base:1.2 pkgsrc-2009Q4:1.2.0.32 pkgsrc-2009Q4-base:1.2 pkgsrc-2009Q3:1.2.0.30 pkgsrc-2009Q3-base:1.2 pkgsrc-2009Q2:1.2.0.28 pkgsrc-2009Q2-base:1.2 pkgsrc-2009Q1:1.2.0.26 pkgsrc-2009Q1-base:1.2 pkgsrc-2008Q4:1.2.0.24 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.22 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.20 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.18 pkgsrc-2008Q2-base:1.2 cwrapper:1.2.0.16 pkgsrc-2008Q1:1.2.0.14 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.12 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.10 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.8 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.6 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.4 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.2 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.1.0.16 pkgsrc-2006Q2-base:1.1 pkgsrc-2006Q1:1.1.0.14 pkgsrc-2006Q1-base:1.1 pkgsrc-2005Q4:1.1.0.12 pkgsrc-2005Q4-base:1.1 pkgsrc-2005Q3:1.1.0.10 pkgsrc-2005Q3-base:1.1 pkgsrc-2005Q2:1.1.0.8 pkgsrc-2005Q2-base:1.1 pkgsrc-2005Q1:1.1.0.6 pkgsrc-2005Q1-base:1.1 pkgsrc-2004Q4:1.1.0.4 pkgsrc-2004Q4-base:1.1 pkgsrc-2004Q3:1.1.0.2 pkgsrc-2004Q3-base:1.1; locks; strict; comment @# @; 1.2 date 2006.08.02.19.24.55; author kristerw; state Exp; branches; next 1.1; 1.1 date 2004.09.08.12.48.32; author sketch; state Exp; branches; next ; desc @@ 1.2 log @Rename the function "trunc" to prevent conflict with the C99 "trunc" function. @ text @$NetBSD$ --- xroads.c.orig 1999-06-30 20:25:02.000000000 +0200 +++ xroads.c 2006-08-02 21:14:27.000000000 +0200 @@@@ -282,13 +282,13 @@@@ } /*************************************************************************************************/ -int trunc( float num ) { /* Truncate a float to an int */ +int mytrunc( float num ) { /* Truncate a float to an int */ if (num>0) return (int)num; else return (int)(num-0.5); } /*************************************************************************************************/ -int round( float num ) { /* Round a float to an int */ +int roundup( float num ) { /* Round a float to an int */ return (int)(num+0.5); } @@@@ -394,11 +394,11 @@@@ /* VacAttack */ /* if(data[amonst->type].attack1==VACCUUM && (amonst->x==monst[targ].x - || amonst->y==monst[targ].y) && (round(amonst->x) == - trunc(amonst->x) && round(amonst->y) == trunc(amonst->y))) { + || amonst->y==monst[targ].y) && (roundup(amonst->x) == + mytrunc(amonst->x) && roundup(amonst->y) == mytrunc(amonst->y))) { */ - if(data[amonst->type].attack1==VACCUUM && (round(amonst->x) == - trunc(amonst->x) && round(amonst->y) == trunc(amonst->y)) && + if(data[amonst->type].attack1==VACCUUM && (roundup(amonst->x) == + mytrunc(amonst->x) && roundup(amonst->y) == mytrunc(amonst->y)) && clearshot(amonst, &monst[targ])) { watchentity(amonst, &monst[targ]); vacattack(amonst, &monst[targ]); @@@@ -423,19 +423,19 @@@@ else amonst->frame++; if(data[amonst->type].etype!=EFFECT) { - maze[round(oldy)][round(oldx)]=-2; /* Blank out old space */ - maze[trunc(oldy)][trunc(oldx)]=-2; - maze[round(amonst->y)][round(amonst->x)]=number; - maze[trunc(amonst->y)][trunc(amonst->x)]=number; + maze[roundup(oldy)][roundup(oldx)]=-2; /* Blank out old space */ + maze[mytrunc(oldy)][mytrunc(oldx)]=-2; + maze[roundup(amonst->y)][roundup(amonst->x)]=number; + maze[mytrunc(amonst->y)][mytrunc(amonst->x)]=number; } /* If there was something underneath the effect, redraw it */ - if(maze[trunc(amonst->y)][trunc(amonst->x)]!=-2) { - bmonst=&monst[maze[trunc(amonst->y)][trunc(amonst->x)]]; + if(maze[mytrunc(amonst->y)][mytrunc(amonst->x)]!=-2) { + bmonst=&monst[maze[mytrunc(amonst->y)][mytrunc(amonst->x)]]; draw_tilex2(mainwindow, data[bmonst->type].tile[bmonst->frame], (bmonst->x)*GRIDSIZE, (bmonst->y)*GRIDSIZE, bmonst->color, bmonst->dir); } - if(maze[round(amonst->y)][round(amonst->x)]!=-2) { - bmonst=&monst[maze[round(amonst->y)][round(amonst->x)]]; + if(maze[roundup(amonst->y)][roundup(amonst->x)]!=-2) { + bmonst=&monst[maze[roundup(amonst->y)][roundup(amonst->x)]]; draw_tilex2(mainwindow, data[bmonst->type].tile[bmonst->frame], (bmonst->x)*GRIDSIZE, (bmonst->y)*GRIDSIZE, bmonst->color, bmonst->dir); } @@@@ -558,7 +558,7 @@@@ else if(player->attr & PULL_R) { newx+=1; player->attr &= ~PULL_R; } /* Only one half-step at a time */ - if(round(newx)!=trunc(newx) && round(newy)!=trunc(newy)) { + if(roundup(newx)!=mytrunc(newx) && roundup(newy)!=mytrunc(newy)) { #ifdef DEBUG printf("Damn, in two half-steps at a time...\n"); #endif @@@@ -574,30 +574,30 @@@@ /* If we're in a half-step, eqx and eqy are the space we're moving into */ - if(round(newx)!=trunc(newx)) { - eqy = trunc(newy); + if(roundup(newx)!=mytrunc(newx)) { + eqy = mytrunc(newy); if(newx > player->x) - eqx = round(newx); + eqx = roundup(newx); else if(newx < player->x) - eqx = trunc(newx); + eqx = mytrunc(newx); } - else if(round(newy)!=trunc(newy)) { - eqx = trunc(newx); + else if(roundup(newy)!=mytrunc(newy)) { + eqx = mytrunc(newx); if(newy > player->y) - eqy = round(newy); + eqy = roundup(newy); else if(newy < player->y) - eqy = trunc(newy); + eqy = mytrunc(newy); } else { - eqx = trunc(newx); - eqy = trunc(newy); + eqx = mytrunc(newx); + eqy = mytrunc(newy); } /* switch(player->dir) { - case LEFT: eqx = trunc(newx); break; - case RIGHT: eqx = round(newx); break; - case UP: eqy = trunc(newy); break; - case DOWN: eqy = round(newy); break; + case LEFT: eqx = mytrunc(newx); break; + case RIGHT: eqx = roundup(newx); break; + case UP: eqy = mytrunc(newy); break; + case DOWN: eqy = roundup(newy); break; default: } */ @@@@ -610,8 +610,8 @@@@ printf("Destination (%0.2f, %0.2f)...\n", newx, newy); printf("Equiv (%d, %d)\n", eqx, eqy); printf("@@ %d, %d : %d\n", eqx, eqy, maze[eqy][eqx]); - printf("newx: %0.2f: round %d, trunc %d\n", newx, round(newx), trunc(newx)); - printf("newy: %0.2f: round %d, trunc %d\n", newy, round(newy), trunc(newy)); + printf("newx: %0.2f: round %d, trunc %d\n", newx, roundup(newx), mytrunc(newx)); + printf("newy: %0.2f: round %d, trunc %d\n", newy, roundup(newy), mytrunc(newy)); printf("Checkdest: %d\n", checkdest(eqx, eqy)); printf("-----\n"); } @@@@ -646,8 +646,8 @@@@ else if(!okay) { #ifdef DEBUG printf("something in the way. (%d or %d)\n", - maze[trunc(newy)][trunc(newx)], - maze[round(newy)][round(newy)]); + maze[mytrunc(newy)][mytrunc(newx)], + maze[roundup(newy)][roundup(newy)]); #endif newx=player->x; newy=player->y; @@@@ -658,15 +658,15 @@@@ #endif /* Destination has been set, now all we have to do is move there */ - maze[round(player->y)][round(player->x)]=-2; - maze[trunc(player->y)][trunc(player->x)]=-2; + maze[roundup(player->y)][roundup(player->x)]=-2; + maze[mytrunc(player->y)][mytrunc(player->x)]=-2; draw_tilex2(mainwindow, blank, player->x*GRIDSIZE, player->y*GRIDSIZE, BLACK, RIGHT); /* Draw player */ player->x=newx; player->y=newy; - maze[round(player->y)][round(player->x)]=player->ind; - maze[trunc(player->y)][trunc(player->x)]=player->ind; + maze[roundup(player->y)][roundup(player->x)]=player->ind; + maze[mytrunc(player->y)][mytrunc(player->x)]=player->ind; draw_tilex2(mainwindow, data[datapos].tile[player->frame], player->x*GRIDSIZE, player->y*GRIDSIZE, player->color, player->dir); @@@@ -1279,8 +1279,8 @@@@ player[i]->health = 0; if(player[i]->attr & ACTIVE) { player[i]->attr ^= ACTIVE; - maze[round(player[i]->y)][round(player[i]->x)] = -2; - maze[trunc(player[i]->y)][trunc(player[i]->x)] = -2; + maze[roundup(player[i]->y)][roundup(player[i]->x)] = -2; + maze[mytrunc(player[i]->y)][mytrunc(player[i]->x)] = -2; draw_tilex2(mainwindow, blank, player[i]->x*GRIDSIZE, player[i]->y*GRIDSIZE, BLACK, RIGHT); #ifdef XPLOSIONS @ 1.1 log @Rename round() to roundup() to avoid conflict with round(3) introduced in NetBSD 2.0. @ text @d3 10 a12 3 --- xroads.c.orig 2004-09-08 13:39:59.000000000 +0100 +++ xroads.c 2004-09-08 13:41:00.000000000 +0100 @@@@ -288,7 +288,7 @@@@ d28 1 a28 1 + trunc(amonst->x) && roundup(amonst->y) == trunc(amonst->y))) { d33 1 a33 1 + trunc(amonst->x) && roundup(amonst->y) == trunc(amonst->y)) && d37 1 a37 1 @@@@ -423,9 +423,9 @@@@ d42 3 d46 1 a46 2 maze[trunc(oldy)][trunc(oldx)]=-2; - maze[round(amonst->y)][round(amonst->x)]=number; d48 1 a48 1 maze[trunc(amonst->y)][trunc(amonst->x)]=number; d51 4 a54 1 @@@@ -434,8 +434,8 @@@@ d70 1 a70 1 + if(roundup(newx)!=trunc(newx) && roundup(newy)!=trunc(newy)) { d74 1 a74 1 @@@@ -574,17 +574,17 @@@@ d79 3 a81 2 + if(roundup(newx)!=trunc(newx)) { eqy = trunc(newy); d86 2 a87 1 eqx = trunc(newx); d90 3 a92 2 + else if(roundup(newy)!=trunc(newy)) { eqx = trunc(newx); d97 8 a104 1 eqy = trunc(newy); a105 1 @@@@ -595,9 +595,9 @@@@ d108 1 a108 1 case LEFT: eqx = trunc(newx); break; d110 3 d114 1 a114 2 case UP: eqy = trunc(newy); break; - case DOWN: eqy = round(newy); break; d125 2 a126 2 + printf("newx: %0.2f: round %d, trunc %d\n", newx, roundup(newx), trunc(newx)); + printf("newy: %0.2f: round %d, trunc %d\n", newy, roundup(newy), trunc(newy)); d130 2 a131 1 @@@@ -647,7 +647,7 @@@@ d134 1 a134 1 maze[trunc(newy)][trunc(newx)], d136 1 d141 1 a141 1 @@@@ -658,14 +658,14 @@@@ d146 1 d148 1 a148 1 maze[trunc(player->y)][trunc(player->x)]=-2; d155 1 d157 1 a157 1 maze[trunc(player->y)][trunc(player->x)]=player->ind; d160 2 a161 1 @@@@ -1279,7 +1279,7 @@@@ d166 1 d168 1 a168 1 maze[trunc(player[i]->y)][trunc(player[i]->x)] = -2; d171 1 @