From 3d27ec4ecb1504cba2cefe01399818c3bdb63554 Mon Sep 17 00:00:00 2001 From: sketch Date: Wed, 8 Sep 2004 12:48:32 +0000 Subject: Rename round() to roundup() to avoid conflict with round(3) introduced in NetBSD 2.0. --- games/xroads/distinfo | 5 +- games/xroads/patches/patch-ac | 141 ++++++++++++++++++++++++++++++++++++++++++ games/xroads/patches/patch-ad | 13 ++++ games/xroads/patches/patch-ae | 118 +++++++++++++++++++++++++++++++++++ 4 files changed, 276 insertions(+), 1 deletion(-) create mode 100644 games/xroads/patches/patch-ac create mode 100644 games/xroads/patches/patch-ad create mode 100644 games/xroads/patches/patch-ae (limited to 'games') diff --git a/games/xroads/distinfo b/games/xroads/distinfo index eedecd848cd..b5b7e2ef302 100644 --- a/games/xroads/distinfo +++ b/games/xroads/distinfo @@ -1,6 +1,9 @@ -$NetBSD: distinfo,v 1.2 2001/04/21 02:08:42 wiz Exp $ +$NetBSD: distinfo,v 1.3 2004/09/08 12:48:32 sketch Exp $ SHA1 (xroads-v0.5.tar.gz) = 559f916eda55ba4700c2cea6fcb42d1b1a47fa06 Size (xroads-v0.5.tar.gz) = 48641 bytes SHA1 (patch-aa) = 4978b1b718b920871d06acff54895da60642c949 SHA1 (patch-ab) = f22b139e84c4e2d4d9d190d818d0ce6aba816a23 +SHA1 (patch-ac) = f2dea6edd1be400992e77cdbfea14c2485a29a07 +SHA1 (patch-ad) = 1ca73bd1201283f2a292040e9d3af9f10399b005 +SHA1 (patch-ae) = 8481238dc62755222ebf7c35199760848c64daf5 diff --git a/games/xroads/patches/patch-ac b/games/xroads/patches/patch-ac new file mode 100644 index 00000000000..32a4a263663 --- /dev/null +++ b/games/xroads/patches/patch-ac @@ -0,0 +1,141 @@ +$NetBSD: patch-ac,v 1.1 2004/09/08 12:48:32 sketch Exp $ + +--- 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 @@ + } + + /*************************************************************************************************/ +-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) == ++ trunc(amonst->x) && roundup(amonst->y) == trunc(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) == ++ trunc(amonst->x) && roundup(amonst->y) == trunc(amonst->y)) && + clearshot(amonst, &monst[targ])) { + watchentity(amonst, &monst[targ]); + vacattack(amonst, &monst[targ]); +@@ -423,9 +423,9 @@ + else amonst->frame++; + + if(data[amonst->type].etype!=EFFECT) { +- maze[round(oldy)][round(oldx)]=-2; /* Blank out old space */ ++ maze[roundup(oldy)][roundup(oldx)]=-2; /* Blank out old space */ + maze[trunc(oldy)][trunc(oldx)]=-2; +- maze[round(amonst->y)][round(amonst->x)]=number; ++ maze[roundup(amonst->y)][roundup(amonst->x)]=number; + maze[trunc(amonst->y)][trunc(amonst->x)]=number; + } + /* If there was something underneath the effect, redraw it */ +@@ -434,8 +434,8 @@ + 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)!=trunc(newx) && roundup(newy)!=trunc(newy)) { + #ifdef DEBUG + printf("Damn, in two half-steps at a time...\n"); + #endif +@@ -574,17 +574,17 @@ + + /* If we're in a half-step, eqx and eqy are the space we're moving + into */ +- if(round(newx)!=trunc(newx)) { ++ if(roundup(newx)!=trunc(newx)) { + eqy = trunc(newy); + if(newx > player->x) +- eqx = round(newx); ++ eqx = roundup(newx); + else if(newx < player->x) + eqx = trunc(newx); + } +- else if(round(newy)!=trunc(newy)) { ++ else if(roundup(newy)!=trunc(newy)) { + eqx = trunc(newx); + if(newy > player->y) +- eqy = round(newy); ++ eqy = roundup(newy); + else if(newy < player->y) + eqy = trunc(newy); + } +@@ -595,9 +595,9 @@ + /* + switch(player->dir) { + case LEFT: eqx = trunc(newx); break; +- case RIGHT: eqx = round(newx); break; ++ case RIGHT: eqx = roundup(newx); break; + case UP: eqy = trunc(newy); break; +- case DOWN: eqy = round(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), trunc(newx)); ++ printf("newy: %0.2f: round %d, trunc %d\n", newy, roundup(newy), trunc(newy)); + printf("Checkdest: %d\n", checkdest(eqx, eqy)); + printf("-----\n"); + } +@@ -647,7 +647,7 @@ + #ifdef DEBUG + printf("something in the way. (%d or %d)\n", + maze[trunc(newy)][trunc(newx)], +- maze[round(newy)][round(newy)]); ++ maze[roundup(newy)][roundup(newy)]); + #endif + newx=player->x; + newy=player->y; +@@ -658,14 +658,14 @@ + #endif + + /* Destination has been set, now all we have to do is move there */ +- maze[round(player->y)][round(player->x)]=-2; ++ maze[roundup(player->y)][roundup(player->x)]=-2; + maze[trunc(player->y)][trunc(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[roundup(player->y)][roundup(player->x)]=player->ind; + maze[trunc(player->y)][trunc(player->x)]=player->ind; + draw_tilex2(mainwindow, data[datapos].tile[player->frame], + player->x*GRIDSIZE, player->y*GRIDSIZE, +@@ -1279,7 +1279,7 @@ + player[i]->health = 0; + if(player[i]->attr & ACTIVE) { + player[i]->attr ^= ACTIVE; +- maze[round(player[i]->y)][round(player[i]->x)] = -2; ++ maze[roundup(player[i]->y)][roundup(player[i]->x)] = -2; + maze[trunc(player[i]->y)][trunc(player[i]->x)] = -2; + draw_tilex2(mainwindow, blank, player[i]->x*GRIDSIZE, + player[i]->y*GRIDSIZE, BLACK, RIGHT); diff --git a/games/xroads/patches/patch-ad b/games/xroads/patches/patch-ad new file mode 100644 index 00000000000..9327797f990 --- /dev/null +++ b/games/xroads/patches/patch-ad @@ -0,0 +1,13 @@ +$NetBSD: patch-ad,v 1.1 2004/09/08 12:48:32 sketch Exp $ + +--- xroads.h.orig 1999-06-30 19:25:02.000000000 +0100 ++++ xroads.h 2004-09-08 13:39:46.000000000 +0100 +@@ -33,7 +33,7 @@ + void killme( char * ); + void xconnect( int, char *[] ); + int trunc( float ); +-int round( float ); ++int roundup( float ); + #ifdef SIGHANDLE + void sigcatch( int ); + #endif diff --git a/games/xroads/patches/patch-ae b/games/xroads/patches/patch-ae new file mode 100644 index 00000000000..dc7185798a8 --- /dev/null +++ b/games/xroads/patches/patch-ae @@ -0,0 +1,118 @@ +$NetBSD: patch-ae,v 1.1 2004/09/08 12:48:32 sketch Exp $ + +--- ai.c.orig 1999-06-30 19:25:02.000000000 +0100 ++++ ai.c 2004-09-08 13:41:53.000000000 +0100 +@@ -59,12 +59,12 @@ + int tries=0; + + /* If in a halfstep, finish it */ +- if(trunc(amonst->x)!=round(amonst->x)) switch(amonst->dir) { ++ if(trunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) { + case LEFT: amonst->x-=0.5; return; + case RIGHT: amonst->x+=0.5; return; + default: amonst->dir = directions[(int)rnd(2) + 2]; + } +- if(trunc(amonst->y)!=round(amonst->y)) switch(amonst->dir) { ++ if(trunc(amonst->y)!=roundup(amonst->y)) switch(amonst->dir) { + case UP: amonst->y-=0.5; return; + case DOWN: amonst->y+=0.5; return; + default: amonst->dir = directions[(int)rnd(2)]; +@@ -84,9 +84,9 @@ + /* Find coordinates for new position */ + switch(dir) { + case UP: y-=0.5; eqy=trunc(y); eqx=trunc(x); break; +- case DOWN: y+=0.5; eqy=round(y); eqx=trunc(x); break; ++ case DOWN: y+=0.5; eqy=roundup(y); eqx=trunc(x); break; + case LEFT: x-=0.5; eqy=trunc(y); eqx=trunc(x); break; +- case RIGHT: x+=0.5; eqy=trunc(y); eqx=round(x); break; ++ case RIGHT: x+=0.5; eqy=trunc(y); eqx=roundup(x); break; + default: printf("Error: Not a direction\n"); return; + } + +@@ -94,7 +94,7 @@ + if(!checkdest(eqx, eqy)) goto tryagain; + + /* Check for double half-step */ +- if(trunc(x)!=round(x) && trunc(y)!=round(y)) goto tryagain; ++ if(trunc(x)!=roundup(x) && trunc(y)!=roundup(y)) goto tryagain; + + /* Passes all checks */ + amonst->x = x; +@@ -111,12 +111,12 @@ + float dx, dy, dz; + + /* If in a halfstep, finish it */ +- if(trunc(amonst->x)!=round(amonst->x)) switch(amonst->dir) { ++ if(trunc(amonst->x)!=roundup(amonst->x)) switch(amonst->dir) { + case LEFT: amonst->x-=0.5; return; + case RIGHT: amonst->x+=0.5; return; + default: amonst->dir = directions[(int)rnd(2) + 2]; + } +- if(trunc(amonst->y)!=round(amonst->y)) switch(amonst->dir) { ++ if(trunc(amonst->y)!=roundup(amonst->y)) switch(amonst->dir) { + case UP: amonst->y-=0.5; return; + case DOWN: amonst->y+=0.5; return; + default: amonst->dir = directions[(int)rnd(2)]; +@@ -136,8 +136,8 @@ + tryagain: /* Come back here to try again */ + tries++; + if(tries>100) { +- if(trunc(amonst->x)==round(amonst->x) && +- trunc(amonst->y)==round(amonst->y)) ++ if(trunc(amonst->x)==roundup(amonst->x) && ++ trunc(amonst->y)==roundup(amonst->y)) + watchentity(amonst, target); + return; + } +@@ -175,7 +175,7 @@ + if(!checkdest(eqx, eqy)) goto tryagain; + + /* Be careful of half-steps */ +- if(trunc(x)!=round(x) && trunc(y)!=round(y)) goto tryagain; ++ if(trunc(x)!=roundup(x) && trunc(y)!=roundup(y)) goto tryagain; + + /* Done working out new position, assign to character */ + amonst->x = x; +@@ -279,7 +279,7 @@ + printf("I was asked to kill a monster that shouldn't be killed!\n"); + if(amonst->health <= 0) { + if(data[amonst->type].etype != EFFECT) { +- maze[round(amonst->y)][round(amonst->x)] = -2; /* Blank */ ++ maze[roundup(amonst->y)][roundup(amonst->x)] = -2; /* Blank */ + maze[trunc(amonst->y)][trunc(amonst->x)] = -2; /* Blank */ + } + draw_tilex2(mainwindow, data[amonst->type].tile[amonst->frame], +@@ -293,8 +293,8 @@ + 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); +@@ -354,9 +354,9 @@ + else amonst->atspeed=4; + switch(amonst->dir) { + case LEFT: fx-=1; x=trunc(fx); y=trunc(fy); break; +- case RIGHT: fx+=1; x=round(fx); y=trunc(fy); break; ++ case RIGHT: fx+=1; x=roundup(fx); y=trunc(fy); break; + case UP: fy-=1; y=trunc(fy); x=trunc(fx); break; +- case DOWN: fy+=1; y=round(fy); x=trunc(fx); break; ++ case DOWN: fy+=1; y=roundup(fy); x=trunc(fx); break; + } + icorrectpos(&x, &y); + if(!checkdest(x, y)) { +@@ -420,8 +420,8 @@ + if(!(amonst->x == target->x || amonst->y == target->y)) return 0; + + /* Halfsteps are banned */ +- if(round(amonst->x) != trunc(amonst->x)) return 0; +- if(round(amonst->y) != trunc(amonst->y)) return 0; ++ if(roundup(amonst->x) != trunc(amonst->x)) return 0; ++ if(roundup(amonst->y) != trunc(amonst->y)) return 0; + + /* Force x1, y1 to be smaller pair */ + if(x1 > x2) { -- cgit v1.2.3