prefix some macro names

This commit is contained in:
nhmall
2022-11-03 16:50:25 -04:00
parent d80e8d9569
commit cf897d9293
3 changed files with 59 additions and 59 deletions
+28 -28
View File
@@ -8,10 +8,10 @@
#include "hack.h" #include "hack.h"
#define UP 1 #define XL_UP 1
#define DOWN 2 #define XL_DOWN 2
#define LEFT 4 #define XL_LEFT 4
#define RIGHT 8 #define XL_RIGHT 8
static void roguejoin(coordxy, coordxy, coordxy, coordxy, int); static void roguejoin(coordxy, coordxy, coordxy, coordxy, int);
static void roguecorr(coordxy, coordxy, int); static void roguecorr(coordxy, coordxy, int);
@@ -48,8 +48,8 @@ roguecorr(coordxy x, coordxy y, int dir)
{ {
register coordxy fromx, fromy, tox, toy; register coordxy fromx, fromy, tox, toy;
if (dir == DOWN) { if (dir == XL_DOWN) {
g.r[x][y].doortable &= ~DOWN; g.r[x][y].doortable &= ~XL_DOWN;
if (!g.r[x][y].real) { if (!g.r[x][y].real) {
fromx = g.r[x][y].rlx; fromx = g.r[x][y].rlx;
fromy = g.r[x][y].rly; fromy = g.r[x][y].rly;
@@ -71,7 +71,7 @@ roguecorr(coordxy x, coordxy y, int dir)
return; return;
} }
y++; y++;
g.r[x][y].doortable &= ~UP; g.r[x][y].doortable &= ~XL_UP;
if (!g.r[x][y].real) { if (!g.r[x][y].real) {
tox = g.r[x][y].rlx; tox = g.r[x][y].rlx;
toy = g.r[x][y].rly; toy = g.r[x][y].rly;
@@ -90,8 +90,8 @@ roguecorr(coordxy x, coordxy y, int dir)
} }
roguejoin(fromx, fromy, tox, toy, FALSE); roguejoin(fromx, fromy, tox, toy, FALSE);
return; return;
} else if (dir == RIGHT) { } else if (dir == XL_RIGHT) {
g.r[x][y].doortable &= ~RIGHT; g.r[x][y].doortable &= ~XL_RIGHT;
if (!g.r[x][y].real) { if (!g.r[x][y].real) {
fromx = g.r[x][y].rlx; fromx = g.r[x][y].rlx;
fromy = g.r[x][y].rly; fromy = g.r[x][y].rly;
@@ -113,7 +113,7 @@ roguecorr(coordxy x, coordxy y, int dir)
return; return;
} }
x++; x++;
g.r[x][y].doortable &= ~LEFT; g.r[x][y].doortable &= ~XL_LEFT;
if (!g.r[x][y].real) { if (!g.r[x][y].real) {
tox = g.r[x][y].rlx; tox = g.r[x][y].rlx;
toy = g.r[x][y].rly; toy = g.r[x][y].rly;
@@ -147,16 +147,16 @@ miniwalk(coordxy x, coordxy y)
while (1) { while (1) {
q = 0; q = 0;
#define doorhere (g.r[x][y].doortable) #define doorhere (g.r[x][y].doortable)
if (x > 0 && (!(doorhere & LEFT)) if (x > 0 && (!(doorhere & XL_LEFT))
&& (!g.r[x - 1][y].doortable || !rn2(10))) && (!g.r[x - 1][y].doortable || !rn2(10)))
dirs[q++] = 0; dirs[q++] = 0;
if (x < 2 && (!(doorhere & RIGHT)) if (x < 2 && (!(doorhere & XL_RIGHT))
&& (!g.r[x + 1][y].doortable || !rn2(10))) && (!g.r[x + 1][y].doortable || !rn2(10)))
dirs[q++] = 1; dirs[q++] = 1;
if (y > 0 && (!(doorhere & UP)) if (y > 0 && (!(doorhere & XL_UP))
&& (!g.r[x][y - 1].doortable || !rn2(10))) && (!g.r[x][y - 1].doortable || !rn2(10)))
dirs[q++] = 2; dirs[q++] = 2;
if (y < 2 && (!(doorhere & DOWN)) if (y < 2 && (!(doorhere & XL_DOWN))
&& (!g.r[x][y + 1].doortable || !rn2(10))) && (!g.r[x][y + 1].doortable || !rn2(10)))
dirs[q++] = 3; dirs[q++] = 3;
/* Rogue levels aren't just 3 by 3 mazes; they have some extra /* Rogue levels aren't just 3 by 3 mazes; they have some extra
@@ -167,24 +167,24 @@ miniwalk(coordxy x, coordxy y)
dir = dirs[rn2(q)]; dir = dirs[rn2(q)];
switch (dir) { /* Move in direction */ switch (dir) { /* Move in direction */
case 0: case 0:
doorhere |= LEFT; doorhere |= XL_LEFT;
x--; x--;
doorhere |= RIGHT; doorhere |= XL_RIGHT;
break; break;
case 1: case 1:
doorhere |= RIGHT; doorhere |= XL_RIGHT;
x++; x++;
doorhere |= LEFT; doorhere |= XL_LEFT;
break; break;
case 2: case 2:
doorhere |= UP; doorhere |= XL_UP;
y--; y--;
doorhere |= DOWN; doorhere |= XL_DOWN;
break; break;
case 3: case 3:
doorhere |= DOWN; doorhere |= XL_DOWN;
y++; y++;
doorhere |= UP; doorhere |= XL_UP;
break; break;
} }
miniwalk(x, y); miniwalk(x, y);
@@ -265,13 +265,13 @@ makeroguerooms(void)
/* Now, add connecting corridors. */ /* Now, add connecting corridors. */
for (y = 0; y < 3; y++) for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++) { for (x = 0; x < 3; x++) {
if (here.doortable & DOWN) if (here.doortable & XL_DOWN)
roguecorr(x, y, DOWN); roguecorr(x, y, XL_DOWN);
if (here.doortable & RIGHT) if (here.doortable & XL_RIGHT)
roguecorr(x, y, RIGHT); roguecorr(x, y, XL_RIGHT);
if (here.doortable & LEFT) if (here.doortable & XL_LEFT)
impossible("left end of %d, %d never connected?", x, y); impossible("left end of %d, %d never connected?", x, y);
if (here.doortable & UP) if (here.doortable & XL_UP)
impossible("up end of %d, %d never connected?", x, y); impossible("up end of %d, %d never connected?", x, y);
} }
#undef here #undef here
+11 -11
View File
@@ -3518,9 +3518,9 @@ wizterrainwish(struct _readobjnam_data *d)
return (struct obj *) 0; return (struct obj *) 0;
} }
#define UNDEFINED 0 #define TIN_UNDEFINED 0
#define EMPTY 1 #define TIN_EMPTY 1
#define SPINACH 2 #define TIN_SPINACH 2
static void static void
readobjnam_init(char *bp, struct _readobjnam_data *d) readobjnam_init(char *bp, struct _readobjnam_data *d)
@@ -3539,7 +3539,7 @@ readobjnam_init(char *bp, struct _readobjnam_data *d)
d->tvariety = RANDOM_TIN; d->tvariety = RANDOM_TIN;
d->mgend = -1; /* not specified, aka random */ d->mgend = -1; /* not specified, aka random */
d->mntmp = NON_PM; d->mntmp = NON_PM;
d->contents = UNDEFINED; d->contents = TIN_UNDEFINED;
d->oclass = 0; d->oclass = 0;
d->actualn = d->dn = d->un = 0; d->actualn = d->dn = d->un = 0;
d->wetness = 0; d->wetness = 0;
@@ -3687,7 +3687,7 @@ readobjnam_preparse(struct _readobjnam_data *d)
} else if (!strncmpi(d->bp, "diluted ", l = 8)) { } else if (!strncmpi(d->bp, "diluted ", l = 8)) {
d->isdiluted = 1; d->isdiluted = 1;
} else if (!strncmpi(d->bp, "empty ", l = 6)) { } else if (!strncmpi(d->bp, "empty ", l = 6)) {
d->contents = EMPTY; d->contents = TIN_EMPTY;
} else if (!strncmpi(d->bp, "small ", l = 6)) { /* glob sizes */ } else if (!strncmpi(d->bp, "small ", l = 6)) { /* glob sizes */
/* "small" might be part of monster name (mimic, if wishing /* "small" might be part of monster name (mimic, if wishing
for its corpse) rather than prefix for glob size; when for its corpse) rather than prefix for glob size; when
@@ -3865,7 +3865,7 @@ readobjnam_postparse1(struct _readobjnam_data *d)
} }
if ((d->p = strstri(d->bp, " of spinach")) != 0) { if ((d->p = strstri(d->bp, " of spinach")) != 0) {
*d->p = 0; *d->p = 0;
d->contents = SPINACH; d->contents = TIN_SPINACH;
} }
/* real vs fake is only useful for wizard mode but we'll accept its /* real vs fake is only useful for wizard mode but we'll accept its
parsing in normal play (result is never real Amulet for that case) */ parsing in normal play (result is never real Amulet for that case) */
@@ -3968,7 +3968,7 @@ readobjnam_postparse1(struct _readobjnam_data *d)
&& !strstri(d->bp, "finger ")) { && !strstri(d->bp, "finger ")) {
if ((d->p = strstri(d->bp, "tin of ")) != 0) { if ((d->p = strstri(d->bp, "tin of ")) != 0) {
if (!strcmpi(d->p + 7, "spinach")) { if (!strcmpi(d->p + 7, "spinach")) {
d->contents = SPINACH; d->contents = TIN_SPINACH;
d->mntmp = NON_PM; d->mntmp = NON_PM;
} else { } else {
d->tmp = tin_variety_txt(d->p + 7, &d->tinv); d->tmp = tin_variety_txt(d->p + 7, &d->tinv);
@@ -4354,7 +4354,7 @@ readobjnam_postparse3(struct _readobjnam_data *d)
return 6; /*goto retry;*/ return 6; /*goto retry;*/
} }
if (!strcmpi(d->bp, "spinach")) { if (!strcmpi(d->bp, "spinach")) {
d->contents = SPINACH; d->contents = TIN_SPINACH;
d->typ = TIN; d->typ = TIN;
return 2; /*goto typfnd;*/ return 2; /*goto typfnd;*/
} }
@@ -4682,9 +4682,9 @@ readobjnam(char *bp, struct obj *no_wish)
switch (d.typ) { switch (d.typ) {
case TIN: case TIN:
d.otmp->spe = 0; /* default: not spinach */ d.otmp->spe = 0; /* default: not spinach */
if (d.contents == EMPTY) { if (d.contents == TIN_EMPTY) {
d.otmp->corpsenm = NON_PM; d.otmp->corpsenm = NON_PM;
} else if (d.contents == SPINACH) { } else if (d.contents == TIN_SPINACH) {
d.otmp->corpsenm = NON_PM; d.otmp->corpsenm = NON_PM;
d.otmp->spe = 1; /* spinach after all */ d.otmp->spe = 1; /* spinach after all */
} }
@@ -4862,7 +4862,7 @@ readobjnam(char *bp, struct obj *no_wish)
d.otmp->otrapped = (d.trapped == 1); d.otmp->otrapped = (d.trapped == 1);
} }
/* empty for containers rather than for tins */ /* empty for containers rather than for tins */
if (d.contents == EMPTY) { if (d.contents == TIN_EMPTY) {
if (d.otmp->otyp == BAG_OF_TRICKS || d.otmp->otyp == HORN_OF_PLENTY) { if (d.otmp->otyp == BAG_OF_TRICKS || d.otmp->otyp == HORN_OF_PLENTY) {
if (d.otmp->spe > 0) if (d.otmp->spe > 0)
d.otmp->spe = 0; d.otmp->spe = 0;
+20 -20
View File
@@ -163,11 +163,11 @@ int lspo_trap(lua_State *);
int lspo_wall_property(lua_State *); int lspo_wall_property(lua_State *);
int lspo_wallify(lua_State *); int lspo_wallify(lua_State *);
#define LEFT 1 #define SPLEV_LEFT 1
#define H_LEFT 2 #define SPLEV_H_LEFT 2
#define CENTER 3 #define SPLEV_CENTER 3
#define H_RIGHT 4 #define SPLEV_H_RIGHT 4
#define RIGHT 5 #define SPLEV_RIGHT 5
#define TOP 1 #define TOP 1
#define BOTTOM 5 #define BOTTOM 5
@@ -1561,12 +1561,12 @@ create_room(
xabs = (((xtmp - 1) * COLNO) / 5) + 1; xabs = (((xtmp - 1) * COLNO) / 5) + 1;
yabs = (((ytmp - 1) * ROWNO) / 5) + 1; yabs = (((ytmp - 1) * ROWNO) / 5) + 1;
switch (xaltmp) { switch (xaltmp) {
case LEFT: case SPLEV_LEFT:
break; break;
case RIGHT: case SPLEV_RIGHT:
xabs += (COLNO / 5) - wtmp; xabs += (COLNO / 5) - wtmp;
break; break;
case CENTER: case SPLEV_CENTER:
xabs += ((COLNO / 5) - wtmp) / 2; xabs += ((COLNO / 5) - wtmp) / 2;
break; break;
} }
@@ -1576,7 +1576,7 @@ create_room(
case BOTTOM: case BOTTOM:
yabs += (ROWNO / 5) - htmp; yabs += (ROWNO / 5) - htmp;
break; break;
case CENTER: case SPLEV_CENTER:
yabs += ((ROWNO / 5) - htmp) / 2; yabs += ((ROWNO / 5) - htmp) / 2;
break; break;
} }
@@ -3892,12 +3892,12 @@ lspo_room(lua_State *L)
"none", "random", NULL "none", "random", NULL
}; };
static const int l_or_r2i[] = { static const int l_or_r2i[] = {
LEFT, H_LEFT, CENTER, H_RIGHT, RIGHT, -1, -1, -1 SPLEV_LEFT, SPLEV_H_LEFT, SPLEV_CENTER, SPLEV_H_RIGHT, SPLEV_RIGHT, -1, -1, -1
}; };
static const char *const top_or_bot[] = { static const char *const top_or_bot[] = {
"top", "center", "bottom", "none", "random", NULL "top", "center", "bottom", "none", "random", NULL
}; };
static const int t_or_b2i[] = { TOP, CENTER, BOTTOM, -1, -1, -1 }; static const int t_or_b2i[] = { TOP, SPLEV_CENTER, BOTTOM, -1, -1, -1 };
room tmproom; room tmproom;
struct mkroom *tmpcr; struct mkroom *tmpcr;
lua_Integer rx, ry; lua_Integer rx, ry;
@@ -6445,12 +6445,12 @@ TODO: g.coder->croom needs to be updated
"left", "half-left", "center", "half-right", "right", "none", NULL "left", "half-left", "center", "half-right", "right", "none", NULL
}; };
static const int l_or_r2i[] = { static const int l_or_r2i[] = {
LEFT, H_LEFT, CENTER, H_RIGHT, RIGHT, -1, -1 SPLEV_LEFT, SPLEV_H_LEFT, SPLEV_CENTER, SPLEV_H_RIGHT, SPLEV_RIGHT, -1, -1
}; };
static const char *const top_or_bot[] = { static const char *const top_or_bot[] = {
"top", "center", "bottom", "none", NULL "top", "center", "bottom", "none", NULL
}; };
static const int t_or_b2i[] = { TOP, CENTER, BOTTOM, -1, -1 }; static const int t_or_b2i[] = { TOP, SPLEV_CENTER, BOTTOM, -1, -1 };
int lr, tb; int lr, tb;
lua_Integer x = -1, y = -1; lua_Integer x = -1, y = -1;
struct mapfragment *mf; struct mapfragment *mf;
@@ -6467,7 +6467,7 @@ TODO: g.coder->croom needs to be updated
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
tmpstr = dupstr(luaL_checkstring(L, 1)); tmpstr = dupstr(luaL_checkstring(L, 1));
lr = tb = CENTER; lr = tb = SPLEV_CENTER;
mf = mapfrag_fromstr(tmpstr); mf = mapfrag_fromstr(tmpstr);
free(tmpstr); free(tmpstr);
} else { } else {
@@ -6545,19 +6545,19 @@ TODO: g.coder->croom needs to be updated
} else { } else {
/* place map starting at halign,valign */ /* place map starting at halign,valign */
switch (lr) { switch (lr) {
case LEFT: case SPLEV_LEFT:
g.xstart = splev_init_present ? 1 : 3; g.xstart = splev_init_present ? 1 : 3;
break; break;
case H_LEFT: case SPLEV_H_LEFT:
g.xstart = 2 + ((g.x_maze_max - 2 - g.xsize) / 4); g.xstart = 2 + ((g.x_maze_max - 2 - g.xsize) / 4);
break; break;
case CENTER: case SPLEV_CENTER:
g.xstart = 2 + ((g.x_maze_max - 2 - g.xsize) / 2); g.xstart = 2 + ((g.x_maze_max - 2 - g.xsize) / 2);
break; break;
case H_RIGHT: case SPLEV_H_RIGHT:
g.xstart = 2 + ((g.x_maze_max - 2 - g.xsize) * 3 / 4); g.xstart = 2 + ((g.x_maze_max - 2 - g.xsize) * 3 / 4);
break; break;
case RIGHT: case SPLEV_RIGHT:
g.xstart = g.x_maze_max - g.xsize - 1; g.xstart = g.x_maze_max - g.xsize - 1;
break; break;
} }
@@ -6565,7 +6565,7 @@ TODO: g.coder->croom needs to be updated
case TOP: case TOP:
g.ystart = 3; g.ystart = 3;
break; break;
case CENTER: case SPLEV_CENTER:
g.ystart = 2 + ((g.y_maze_max - 2 - g.ysize) / 2); g.ystart = 2 + ((g.y_maze_max - 2 - g.ysize) / 2);
break; break;
case BOTTOM: case BOTTOM: