summaryrefslogtreecommitdiff
path: root/games/xroads
diff options
context:
space:
mode:
authorkristerw <kristerw@pkgsrc.org>2006-08-02 19:24:55 +0000
committerkristerw <kristerw@pkgsrc.org>2006-08-02 19:24:55 +0000
commita6a547d3a3b0a48aed1ddd61faa38d03dc9e4b66 (patch)
treecc7af9649319eaee597a40cbba1654242aab0c4a /games/xroads
parent5fdbb5088ab0edd6b3f747fe85f22354dcbc90e3 (diff)
downloadpkgsrc-a6a547d3a3b0a48aed1ddd61faa38d03dc9e4b66.tar.gz
Rename the function "trunc" to prevent conflict with the C99 "trunc" function.
Diffstat (limited to 'games/xroads')
-rw-r--r--games/xroads/distinfo8
-rw-r--r--games/xroads/patches/patch-ac94
-rw-r--r--games/xroads/patches/patch-ad12
-rw-r--r--games/xroads/patches/patch-ae79
4 files changed, 120 insertions, 73 deletions
diff --git a/games/xroads/distinfo b/games/xroads/distinfo
index b0e75085a03..635fa5e7256 100644
--- a/games/xroads/distinfo
+++ b/games/xroads/distinfo
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.5 2005/06/14 18:50:50 jmmv Exp $
+$NetBSD: distinfo,v 1.6 2006/08/02 19:24:55 kristerw Exp $
SHA1 (xroads-v0.5.tar.gz) = 559f916eda55ba4700c2cea6fcb42d1b1a47fa06
RMD160 (xroads-v0.5.tar.gz) = c0399b391d2113d93c08c25ad6370273791261b7
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) = f1b8e462f0b3b4c822ac339f3f4ae990b4d996f9
+SHA1 (patch-ac) = 19c91236e36cced0c26f527fdc99a565dfdb245f
+SHA1 (patch-ad) = eb76c3ee57d8b18f70e7f8bcd41d96d5e1dd4dad
+SHA1 (patch-ae) = 7770ab7e6fec64d836f3ed886e1709dab508d9c5
diff --git a/games/xroads/patches/patch-ac b/games/xroads/patches/patch-ac
index 32a4a263663..ea140b46f5e 100644
--- a/games/xroads/patches/patch-ac
+++ b/games/xroads/patches/patch-ac
@@ -1,8 +1,15 @@
-$NetBSD: patch-ac,v 1.1 2004/09/08 12:48:32 sketch Exp $
+$NetBSD: patch-ac,v 1.2 2006/08/02 19:24:55 kristerw 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 @@
+--- 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);
}
/*************************************************************************************************/
@@ -18,28 +25,33 @@ $NetBSD: patch-ac,v 1.1 2004/09/08 12:48:32 sketch Exp $
- || 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))) {
++ 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) ==
-+ trunc(amonst->x) && roundup(amonst->y) == trunc(amonst->y)) &&
++ mytrunc(amonst->x) && roundup(amonst->y) == mytrunc(amonst->y)) &&
clearshot(amonst, &monst[targ])) {
watchentity(amonst, &monst[targ]);
vacattack(amonst, &monst[targ]);
-@@ -423,9 +423,9 @@
+@@ -423,19 +423,19 @@
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[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[trunc(amonst->y)][trunc(amonst->x)]=number;
++ maze[mytrunc(amonst->y)][mytrunc(amonst->x)]=number;
}
/* If there was something underneath the effect, redraw it */
-@@ -434,8 +434,8 @@
+- 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);
}
@@ -55,40 +67,51 @@ $NetBSD: patch-ac,v 1.1 2004/09/08 12:48:32 sketch Exp $
/* 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)) {
++ if(roundup(newx)!=mytrunc(newx) && roundup(newy)!=mytrunc(newy)) {
#ifdef DEBUG
printf("Damn, in two half-steps at a time...\n");
#endif
-@@ -574,17 +574,17 @@
+@@ -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)) {
-+ if(roundup(newx)!=trunc(newx)) {
- eqy = trunc(newy);
+- 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 = trunc(newx);
++ eqx = mytrunc(newx);
}
- else if(round(newy)!=trunc(newy)) {
-+ else if(roundup(newy)!=trunc(newy)) {
- eqx = trunc(newx);
+- 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 = trunc(newy);
++ eqy = mytrunc(newy);
+ }
+ else {
+- eqx = trunc(newx);
+- eqy = trunc(newy);
++ eqx = mytrunc(newx);
++ eqy = mytrunc(newy);
}
-@@ -595,9 +595,9 @@
/*
switch(player->dir) {
- case LEFT: eqx = trunc(newx); break;
+- 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 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:
}
@@ -99,43 +122,50 @@ $NetBSD: patch-ac,v 1.1 2004/09/08 12:48:32 sketch Exp $
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("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");
}
-@@ -647,7 +647,7 @@
+@@ -646,8 +646,8 @@
+ else if(!okay) {
#ifdef DEBUG
printf("something in the way. (%d or %d)\n",
- maze[trunc(newy)][trunc(newx)],
+- 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,14 +658,14 @@
+@@ -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[trunc(player->y)][trunc(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[trunc(player->y)][trunc(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,
-@@ -1279,7 +1279,7 @@
+ 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[trunc(player[i]->y)][trunc(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
diff --git a/games/xroads/patches/patch-ad b/games/xroads/patches/patch-ad
index 9327797f990..c1b68baf239 100644
--- a/games/xroads/patches/patch-ad
+++ b/games/xroads/patches/patch-ad
@@ -1,12 +1,14 @@
-$NetBSD: patch-ad,v 1.1 2004/09/08 12:48:32 sketch Exp $
+$NetBSD: patch-ad,v 1.2 2006/08/02 19:24:55 kristerw 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 @@
+--- xroads.h.orig 1999-06-30 20:25:02.000000000 +0200
++++ xroads.h 2006-08-02 21:12:52.000000000 +0200
+@@ -32,8 +32,8 @@
+ int xytotype( int, int );
void killme( char * );
void xconnect( int, char *[] );
- int trunc( float );
+-int trunc( float );
-int round( float );
++int mytrunc( float );
+int roundup( float );
#ifdef SIGHANDLE
void sigcatch( int );
diff --git a/games/xroads/patches/patch-ae b/games/xroads/patches/patch-ae
index c355c8a94d9..21b44f00851 100644
--- a/games/xroads/patches/patch-ae
+++ b/games/xroads/patches/patch-ae
@@ -1,79 +1,82 @@
-$NetBSD: patch-ae,v 1.2 2005/06/14 18:50:50 jmmv Exp $
+$NetBSD: patch-ae,v 1.3 2006/08/02 19:24:55 kristerw Exp $
--- ai.c.orig 1999-06-30 20:25:02.000000000 +0200
-+++ ai.c
-@@ -59,12 +59,12 @@ void destrand( entity *amonst ) {
++++ ai.c 2006-08-02 21:15:07.000000000 +0200
+@@ -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) {
++ if(mytrunc(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) {
++ if(mytrunc(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 @@ void destrand( entity *amonst ) {
+@@ -83,10 +83,10 @@
+
/* Find coordinates for new position */
switch(dir) {
- case UP: y-=0.5; eqy=trunc(y); eqx=trunc(x); break;
+- 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 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;
++ case UP: y-=0.5; eqy=mytrunc(y); eqx=mytrunc(x); break;
++ case DOWN: y+=0.5; eqy=roundup(y); eqx=mytrunc(x); break;
++ case LEFT: x-=0.5; eqy=mytrunc(y); eqx=mytrunc(x); break;
++ case RIGHT: x+=0.5; eqy=mytrunc(y); eqx=roundup(x); break;
default: printf("Error: Not a direction\n"); return;
}
-@@ -94,7 +94,7 @@ void destrand( entity *amonst ) {
+@@ -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;
++ if(mytrunc(x)!=roundup(x) && mytrunc(y)!=roundup(y)) goto tryagain;
/* Passes all checks */
amonst->x = x;
-@@ -111,12 +111,12 @@ void desthome( entity *amonst ) {
+@@ -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) {
++ if(mytrunc(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) {
++ if(mytrunc(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 @@ void desthome( entity *amonst ) {
+@@ -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))
++ if(mytrunc(amonst->x)==roundup(amonst->x) &&
++ mytrunc(amonst->y)==roundup(amonst->y))
watchentity(amonst, target);
return;
}
-@@ -175,7 +175,7 @@ void desthome( entity *amonst ) {
+@@ -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;
++ if(mytrunc(x)!=roundup(x) && mytrunc(y)!=roundup(y)) goto tryagain;
/* Done working out new position, assign to character */
amonst->x = x;
-@@ -193,7 +193,6 @@ void deststraight( entity *actmonst ) {
+@@ -193,7 +193,6 @@
case DOWN: y+=1; break;
case LEFT: x-=1; break;
case RIGHT: x+=1; break;
@@ -81,16 +84,25 @@ $NetBSD: patch-ae,v 1.2 2005/06/14 18:50:50 jmmv Exp $
}
icorrectpos(&x, &y);
if(!checkdest(x, y) && data[xytotype(x, y)].etype==CHARACTER) {
-@@ -279,7 +278,7 @@ void killmonster( entity *amonst ) {
+@@ -279,22 +278,22 @@
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[trunc(amonst->y)][trunc(amonst->x)] = -2; /* Blank */
+ maze[roundup(amonst->y)][roundup(amonst->x)] = -2; /* Blank */
- maze[trunc(amonst->y)][trunc(amonst->x)] = -2; /* Blank */
++ maze[mytrunc(amonst->y)][mytrunc(amonst->x)] = -2; /* Blank */
}
draw_tilex2(mainwindow, data[amonst->type].tile[amonst->frame],
-@@ -293,8 +292,8 @@ void killmonster( entity *amonst ) {
+ amonst->x*GRIDSIZE, amonst->y*GRIDSIZE, BLACK,
+ amonst->dir);
+ }
+ /* 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);
}
@@ -101,26 +113,29 @@ $NetBSD: patch-ae,v 1.2 2005/06/14 18:50:50 jmmv Exp $
draw_tilex2(mainwindow, data[bmonst->type].tile[bmonst->frame],
bmonst->x*GRIDSIZE, bmonst->y*GRIDSIZE,
bmonst->color, bmonst->dir);
-@@ -354,9 +353,9 @@ void spawnbullet( entity *amonst ) {
+@@ -353,10 +352,10 @@
+ amonst->atspeed = 10;
else amonst->atspeed=4;
switch(amonst->dir) {
- case LEFT: fx-=1; x=trunc(fx); y=trunc(fy); break;
+- 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 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;
++ case LEFT: fx-=1; x=mytrunc(fx); y=mytrunc(fy); break;
++ case RIGHT: fx+=1; x=roundup(fx); y=mytrunc(fy); break;
++ case UP: fy-=1; y=mytrunc(fy); x=mytrunc(fx); break;
++ case DOWN: fy+=1; y=roundup(fy); x=mytrunc(fx); break;
}
icorrectpos(&x, &y);
if(!checkdest(x, y)) {
-@@ -420,8 +419,8 @@ int clearshot( entity *amonst, entity *t
+@@ -420,8 +419,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;
++ if(roundup(amonst->x) != mytrunc(amonst->x)) return 0;
++ if(roundup(amonst->y) != mytrunc(amonst->y)) return 0;
/* Force x1, y1 to be smaller pair */
if(x1 > x2) {