Merge branch 'master' into nhmall-booktribute
This commit is contained in:
@@ -1396,7 +1396,7 @@ display_jump_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx, dy;
|
||||
for (dx = -4; dx <= 4; dx++)
|
||||
@@ -2605,7 +2605,7 @@ display_polearm_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx,dy;
|
||||
for (dx = -4; dx <= 4; dx++)
|
||||
|
||||
@@ -764,11 +764,11 @@ newsym(x,y)
|
||||
* These checks and changes must be here and not in back_to_glyph().
|
||||
* They are dependent on the position being out of sight.
|
||||
*/
|
||||
else if (!lev->waslit) {
|
||||
else if (!lev->waslit || (flags.dark_room && iflags.use_color)) {
|
||||
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
|
||||
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM)
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
|
||||
show_glyph(x, y, lev->glyph = cmap_to_glyph(DARKROOMSYM));
|
||||
else
|
||||
goto show_mem;
|
||||
} else {
|
||||
|
||||
@@ -238,6 +238,7 @@ const char *goal;
|
||||
if (glyph_is_cmap(k) &&
|
||||
(IS_DOOR(levl[tx][ty].typ) ||
|
||||
glyph_to_cmap(k) == S_room ||
|
||||
glyph_to_cmap(k) == S_darkroom ||
|
||||
glyph_to_cmap(k) == S_corr ||
|
||||
glyph_to_cmap(k) == S_litcorr)) {
|
||||
/* what the hero remembers to be at tx,ty */
|
||||
|
||||
@@ -156,7 +156,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'#', "iron bars", C(HI_METAL)}, /* bars */
|
||||
{'#', "tree", C(CLR_GREEN)}, /* tree */
|
||||
{'.', "floor of a room",C(CLR_GRAY)}, /* room */
|
||||
/*20*/ {'#', "corridor", C(CLR_GRAY)}, /* dark corr */
|
||||
/*20*/ {'.', "dark part of a room",C(CLR_BLACK)}, /* dark room */
|
||||
{'#', "corridor", C(CLR_GRAY)}, /* dark corr */
|
||||
{'#', "lit corridor", C(CLR_GRAY)}, /* lit corr (see mapglyph.c) */
|
||||
{'<', "staircase up", C(CLR_GRAY)}, /* upstair */
|
||||
{'>', "staircase down", C(CLR_GRAY)}, /* dnstair */
|
||||
@@ -165,8 +166,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'_', "altar", C(CLR_GRAY)}, /* altar */
|
||||
{'|', "grave", C(CLR_GRAY)}, /* grave */
|
||||
{'\\', "opulent throne",C(HI_GOLD)}, /* throne */
|
||||
{'#', "sink", C(CLR_GRAY)}, /* sink */
|
||||
/*30*/ {'{', "fountain", C(CLR_BLUE)}, /* fountain */
|
||||
/*30*/ {'#', "sink", C(CLR_GRAY)}, /* sink */
|
||||
{'{', "fountain", C(CLR_BLUE)}, /* fountain */
|
||||
{'}', "water", C(CLR_BLUE)}, /* pool */
|
||||
{'.', "ice", C(CLR_CYAN)}, /* ice */
|
||||
{'}', "molten lava", C(CLR_RED)}, /* lava */
|
||||
@@ -175,8 +176,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'#', "raised drawbridge",C(CLR_BROWN)}, /* vcdbridge */
|
||||
{'#', "raised drawbridge",C(CLR_BROWN)}, /* hcdbridge */
|
||||
{' ', "air", C(CLR_CYAN)}, /* open air */
|
||||
{'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */
|
||||
/*40*/ {'}', "water", C(CLR_BLUE)}, /* under water */
|
||||
/*40*/ {'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */
|
||||
{'}', "water", C(CLR_BLUE)}, /* under water */
|
||||
{'^', "arrow trap", C(HI_METAL)}, /* trap */
|
||||
{'^', "dart trap", C(HI_METAL)}, /* trap */
|
||||
{'^', "falling rock trap",C(CLR_GRAY)}, /* trap */
|
||||
@@ -185,8 +186,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'^', "land mine", C(CLR_RED)}, /* trap */
|
||||
{'^', "rolling boulder trap", C(CLR_GRAY)}, /* trap */
|
||||
{'^', "sleeping gas trap",C(HI_ZAP)}, /* trap */
|
||||
{'^', "rust trap", C(CLR_BLUE)}, /* trap */
|
||||
/*50*/ {'^', "fire trap", C(CLR_ORANGE)}, /* trap */
|
||||
/*50*/ {'^', "rust trap", C(CLR_BLUE)}, /* trap */
|
||||
{'^', "fire trap", C(CLR_ORANGE)}, /* trap */
|
||||
{'^', "pit", C(CLR_BLACK)}, /* trap */
|
||||
{'^', "spiked pit", C(CLR_BLACK)}, /* trap */
|
||||
{'^', "hole", C(CLR_BROWN)}, /* trap */
|
||||
@@ -195,8 +196,8 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'^', "level teleporter", C(CLR_MAGENTA)}, /* trap */
|
||||
{'^', "magic portal", C(CLR_BRIGHT_MAGENTA)}, /* trap */
|
||||
{'"', "web", C(CLR_GRAY)}, /* web */
|
||||
{'^', "statue trap", C(CLR_GRAY)}, /* trap */
|
||||
/*60*/ {'^', "magic trap", C(HI_ZAP)}, /* trap */
|
||||
/*60*/ {'^', "statue trap", C(CLR_GRAY)}, /* trap */
|
||||
{'^', "magic trap", C(HI_ZAP)}, /* trap */
|
||||
{'^', "anti-magic field", C(HI_ZAP)}, /* trap */
|
||||
{'^', "polymorph trap", C(CLR_BRIGHT_GREEN)}, /* trap */
|
||||
{'|', "wall", C(CLR_GRAY)}, /* vbeam */
|
||||
@@ -205,29 +206,30 @@ const struct symdef defsyms[MAXPCHARS] = {
|
||||
{'/', "wall", C(CLR_GRAY)}, /* rslant */
|
||||
{'*', "", C(CLR_WHITE)}, /* dig beam */
|
||||
{'!', "", C(CLR_WHITE)}, /* camera flash beam */
|
||||
{')', "", C(HI_WOOD)}, /* boomerang open left */
|
||||
/*70*/ {'(', "", C(HI_WOOD)}, /* boomerang open right */
|
||||
/*70*/ {')', "", C(HI_WOOD)}, /* boomerang open left */
|
||||
{'(', "", C(HI_WOOD)}, /* boomerang open right */
|
||||
{'0', "", C(HI_ZAP)}, /* 4 magic shield symbols */
|
||||
{'#', "", C(HI_ZAP)},
|
||||
{'@', "", C(HI_ZAP)},
|
||||
{'*', "", C(HI_ZAP)},
|
||||
{'#', "poison cloud", C(CLR_BRIGHT_GREEN)}, /* [part of] a poison cloud */
|
||||
{'?', "valid position", C(CLR_BRIGHT_GREEN)}, /* valid position for targeting */
|
||||
{'/', "", C(CLR_GREEN)}, /* swallow top left */
|
||||
{'-', "", C(CLR_GREEN)}, /* swallow top center */
|
||||
{'\\', "", C(CLR_GREEN)}, /* swallow top right */
|
||||
/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow top right */
|
||||
{'|', "", C(CLR_GREEN)}, /* swallow middle left */
|
||||
{'|', "", C(CLR_GREEN)}, /* swallow middle right */
|
||||
/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow bottom left */
|
||||
{'\\', "", C(CLR_GREEN)}, /* swallow bottom left */
|
||||
{'-', "", C(CLR_GREEN)}, /* swallow bottom center*/
|
||||
{'/', "", C(CLR_GREEN)}, /* swallow bottom right */
|
||||
{'/', "", C(CLR_ORANGE)}, /* explosion top left */
|
||||
{'-', "", C(CLR_ORANGE)}, /* explosion top center */
|
||||
{'\\', "", C(CLR_ORANGE)}, /* explosion top right */
|
||||
{'|', "", C(CLR_ORANGE)}, /* explosion middle left */
|
||||
{' ', "", C(CLR_ORANGE)}, /* explosion middle center*/
|
||||
/*90*/ {' ', "", C(CLR_ORANGE)}, /* explosion middle center*/
|
||||
{'|', "", C(CLR_ORANGE)}, /* explosion middle right */
|
||||
{'\\', "", C(CLR_ORANGE)}, /* explosion bottom left */
|
||||
/*90*/ {'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/
|
||||
{'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/
|
||||
{'/', "", C(CLR_ORANGE)}, /* explosion bottom right */
|
||||
};
|
||||
|
||||
@@ -647,6 +649,7 @@ struct symparse loadsyms[] = {
|
||||
{SYM_PCHAR, S_flashbeam, "S_flashbeam"},
|
||||
{SYM_PCHAR, S_boomleft, "S_boomleft"},
|
||||
{SYM_PCHAR, S_boomright, "S_boomright"},
|
||||
{SYM_PCHAR, S_goodpos, "S_goodpos"},
|
||||
{SYM_PCHAR, S_ss1, "S_ss1"},
|
||||
{SYM_PCHAR, S_ss2, "S_ss2"},
|
||||
{SYM_PCHAR, S_ss3, "S_ss3"},
|
||||
|
||||
26
src/end.c
26
src/end.c
@@ -1237,6 +1237,9 @@ struct obj *list;
|
||||
boolean identified, all_containers, reportempty;
|
||||
{
|
||||
register struct obj *box, *obj;
|
||||
struct obj **oarray;
|
||||
int i,j,n;
|
||||
char *invlet;
|
||||
char buf[BUFSZ];
|
||||
boolean cat, deadcat;
|
||||
|
||||
@@ -1256,10 +1259,30 @@ boolean identified, all_containers, reportempty;
|
||||
continue; /* wrong type of container */
|
||||
} else if (box->cobj) {
|
||||
winid tmpwin = create_nhwindow(NHW_MENU);
|
||||
|
||||
/* count the number of items */
|
||||
for (n = 0, obj = box->cobj; obj; obj = obj->nobj) n++;
|
||||
/* Make a temporary array to store the objects sorted */
|
||||
oarray = objarr_init(n);
|
||||
|
||||
/* Add objects to the array */
|
||||
i = 0;
|
||||
invlet = flags.inv_order;
|
||||
nextclass:
|
||||
for (obj = box->cobj; obj; obj = obj->nobj) {
|
||||
if (!flags.sortpack || obj->oclass == *invlet) {
|
||||
objarr_set(obj, i++, oarray, (flags.sortloot == 'f' || flags.sortloot == 'l') );
|
||||
}
|
||||
} /* for loop */
|
||||
if (flags.sortpack) {
|
||||
if (*++invlet) goto nextclass;
|
||||
}
|
||||
|
||||
Sprintf(buf, "Contents of %s:", the(xname(box)));
|
||||
putstr(tmpwin, 0, buf);
|
||||
putstr(tmpwin, 0, "");
|
||||
for (obj = box->cobj; obj; obj = obj->nobj) {
|
||||
for (i = 0; i < n; i++) {
|
||||
obj = oarray[i];
|
||||
if (identified) {
|
||||
makeknown(obj->otyp);
|
||||
obj->known = obj->bknown =
|
||||
@@ -1269,6 +1292,7 @@ boolean identified, all_containers, reportempty;
|
||||
}
|
||||
putstr(tmpwin, 0, doname(obj));
|
||||
}
|
||||
free(oarray);
|
||||
if (cat) putstr(tmpwin, 0, "Schroedinger's cat");
|
||||
else if (deadcat) putstr(tmpwin, 0, "Schroedinger's dead cat");
|
||||
display_nhwindow(tmpwin, TRUE);
|
||||
|
||||
@@ -1420,7 +1420,7 @@ docompress_file(filename, uncomp)
|
||||
const char *filename;
|
||||
boolean uncomp;
|
||||
{
|
||||
gzFile *compressedfile;
|
||||
gzFile compressedfile;
|
||||
FILE *uncompressedfile;
|
||||
char cfn[256];
|
||||
char buf[1024];
|
||||
|
||||
126
src/invent.c
126
src/invent.c
@@ -8,6 +8,7 @@
|
||||
#define NOINVSYM '#'
|
||||
#define CONTAINED_SYM '>' /* designator for inside a container */
|
||||
|
||||
STATIC_DCL int FDECL(sortloot_cmp, (struct obj *, struct obj *));
|
||||
STATIC_DCL void NDECL(reorder_invent);
|
||||
STATIC_DCL boolean FDECL(mergable,(struct obj *,struct obj *));
|
||||
STATIC_DCL void FDECL(noarmor, (BOOLEAN_P));
|
||||
@@ -42,6 +43,88 @@ static int lastinvnr = 51; /* 0 ... 51 (never saved&restored) */
|
||||
*/
|
||||
static char venom_inv[] = { VENOM_CLASS, 0 }; /* (constant) */
|
||||
|
||||
|
||||
int
|
||||
sortloot_cmp(obj1, obj2)
|
||||
struct obj *obj1;
|
||||
struct obj *obj2;
|
||||
{
|
||||
int val1 = 0;
|
||||
int val2 = 0;
|
||||
|
||||
/* Sort object names in lexicographical order, ignoring quantity. */
|
||||
int name_cmp = strcmpi(cxname_singular(obj1), cxname_singular(obj2));
|
||||
|
||||
if (name_cmp != 0) {
|
||||
return name_cmp;
|
||||
}
|
||||
|
||||
/* Sort by BUC. Map blessed to 4, uncursed to 2, cursed to 1, and unknown to 0. */
|
||||
val1 = obj1->bknown ? (obj1->blessed << 2) + ((!obj1->blessed && !obj1->cursed) << 1) + obj1->cursed : 0;
|
||||
val2 = obj2->bknown ? (obj2->blessed << 2) + ((!obj2->blessed && !obj2->cursed) << 1) + obj2->cursed : 0;
|
||||
if (val1 != val2) {
|
||||
return val2 - val1; /* Because bigger is better. */
|
||||
}
|
||||
|
||||
/* Sort by greasing. This will put the objects in degreasing order. */
|
||||
val1 = obj1->greased;
|
||||
val2 = obj2->greased;
|
||||
if (val1 != val2) {
|
||||
return val2 - val1; /* Because bigger is better. */
|
||||
}
|
||||
|
||||
/* Sort by erosion. The effective amount is what matters. */
|
||||
val1 = greatest_erosion(obj1);
|
||||
val2 = greatest_erosion(obj2);
|
||||
if (val1 != val2) {
|
||||
return val1 - val2; /* Because bigger is WORSE. */
|
||||
}
|
||||
|
||||
/* Sort by erodeproofing. Map known-invulnerable to 1, and both
|
||||
* known-vulnerable and unknown-vulnerability to 0, because that's how they're displayed. */
|
||||
val1 = obj1->rknown && obj1->oerodeproof;
|
||||
val2 = obj2->rknown && obj2->oerodeproof;
|
||||
if (val1 != val2) {
|
||||
return val2 - val1; /* Because bigger is better. */
|
||||
}
|
||||
|
||||
/* Sort by enchantment. Map unknown to -1000, which is comfortably below the range of ->spe. */
|
||||
val1 = obj1->known ? obj1->spe : -1000;
|
||||
val2 = obj2->known ? obj2->spe : -1000;
|
||||
if (val1 != val2) {
|
||||
return val2 - val1; /* Because bigger is better. */
|
||||
}
|
||||
|
||||
return 0; /* They're identical, as far as we're concerned. */
|
||||
}
|
||||
|
||||
struct obj **
|
||||
objarr_init(n)
|
||||
int n;
|
||||
{
|
||||
return (struct obj **)alloc(n * sizeof(struct obj *));
|
||||
}
|
||||
|
||||
void
|
||||
objarr_set(otmp, idx, oarray, dosort)
|
||||
struct obj *otmp;
|
||||
int idx;
|
||||
struct obj **oarray;
|
||||
boolean dosort;
|
||||
{
|
||||
if (dosort) {
|
||||
int j;
|
||||
for (j = idx; j; j--) {
|
||||
if (sortloot_cmp(otmp, oarray[j-1]) > 0) break;
|
||||
oarray[j] = oarray[j-1];
|
||||
}
|
||||
oarray[j] = otmp;
|
||||
} else {
|
||||
oarray[idx] = otmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
assigninvlet(otmp)
|
||||
register struct obj *otmp;
|
||||
@@ -1722,6 +1805,8 @@ long* out_cnt;
|
||||
static winid local_win = WIN_ERR; /* window for partial menus */
|
||||
anything any;
|
||||
menu_item *selected;
|
||||
struct obj **oarray;
|
||||
int i, j;
|
||||
|
||||
/* overriden by global flag */
|
||||
if (flags.perm_invent) {
|
||||
@@ -1768,6 +1853,19 @@ long* out_cnt;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* count the number of items */
|
||||
for (n = 0, otmp = invent; otmp; otmp = otmp->nobj)
|
||||
if (!lets || !*lets || index(lets, otmp->invlet)) n++;
|
||||
|
||||
oarray = objarr_init(n);
|
||||
|
||||
/* Add objects to the array */
|
||||
i = 0;
|
||||
for (otmp = invent; otmp; otmp = otmp->nobj)
|
||||
if (!lets || !*lets || index(lets, otmp->invlet)) {
|
||||
objarr_set(otmp, i++, oarray, (flags.sortloot == 'f'));
|
||||
}
|
||||
|
||||
start_menu(win);
|
||||
if (wizard && iflags.override_ID) {
|
||||
char prompt[BUFSZ];
|
||||
@@ -1782,22 +1880,21 @@ long* out_cnt;
|
||||
nextclass:
|
||||
classcount = 0;
|
||||
any = zeroany; /* set all bits to zero */
|
||||
for(otmp = invent; otmp; otmp = otmp->nobj) {
|
||||
ilet = otmp->invlet;
|
||||
if(!lets || !*lets || index(lets, ilet)) {
|
||||
any = zeroany; /* zero */
|
||||
if (!flags.sortpack || otmp->oclass == *invlet) {
|
||||
if (flags.sortpack && !classcount) {
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
|
||||
for(i = 0; i < n; i++) {
|
||||
otmp = oarray[i];
|
||||
ilet = otmp->invlet;
|
||||
any = zeroany; /* zero */
|
||||
if (!flags.sortpack || otmp->oclass == *invlet) {
|
||||
if (flags.sortpack && !classcount) {
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
|
||||
let_to_name(*invlet, FALSE, (want_reply && iflags.menu_head_objsym)), MENU_UNSELECTED);
|
||||
classcount++;
|
||||
}
|
||||
any.a_char = ilet;
|
||||
add_menu(win, obj_to_glyph(otmp),
|
||||
&any, ilet, 0, ATR_NONE, doname(otmp),
|
||||
MENU_UNSELECTED);
|
||||
}
|
||||
classcount++;
|
||||
}
|
||||
any.a_char = ilet;
|
||||
add_menu(win, obj_to_glyph(otmp),
|
||||
&any, ilet, 0, ATR_NONE, doname(otmp),
|
||||
MENU_UNSELECTED);
|
||||
}
|
||||
}
|
||||
if (flags.sortpack) {
|
||||
if (*++invlet) goto nextclass;
|
||||
@@ -1806,6 +1903,7 @@ nextclass:
|
||||
goto nextclass;
|
||||
}
|
||||
}
|
||||
free(oarray);
|
||||
end_menu(win, (char *) 0);
|
||||
|
||||
n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected);
|
||||
|
||||
@@ -116,7 +116,7 @@ unsigned *ospecial;
|
||||
color = CLR_MAGENTA;
|
||||
else if (offset == S_corr || offset == S_litcorr)
|
||||
color = CLR_GRAY;
|
||||
else if (offset >= S_room && offset <= S_water)
|
||||
else if (offset >= S_room && offset <= S_water && offset != S_darkroom)
|
||||
color = CLR_GREEN;
|
||||
else
|
||||
color = NO_COLOR;
|
||||
|
||||
@@ -582,6 +582,7 @@ clear_level_structures()
|
||||
level.flags.is_cavernous_lev = 0;
|
||||
level.flags.arboreal = 0;
|
||||
level.flags.wizard_bones = 0;
|
||||
level.flags.corrmaze = 0;
|
||||
|
||||
nroom = 0;
|
||||
rooms[0].hx = -1;
|
||||
|
||||
68
src/mkmaze.c
68
src/mkmaze.c
@@ -541,25 +541,25 @@ register const char *s;
|
||||
}
|
||||
|
||||
level.flags.is_maze_lev = TRUE;
|
||||
level.flags.corrmaze = !rn2(3);
|
||||
|
||||
#ifndef WALLIFIED_MAZE
|
||||
for(x = 2; x < x_maze_max; x++)
|
||||
for(y = 2; y < y_maze_max; y++)
|
||||
levl[x][y].typ = STONE;
|
||||
#else
|
||||
for(x = 2; x <= x_maze_max; x++)
|
||||
for(y = 2; y <= y_maze_max; y++)
|
||||
levl[x][y].typ = ((x % 2) && (y % 2)) ? STONE : HWALL;
|
||||
#endif
|
||||
if (level.flags.corrmaze)
|
||||
for(x = 2; x < x_maze_max; x++)
|
||||
for(y = 2; y < y_maze_max; y++)
|
||||
levl[x][y].typ = STONE;
|
||||
else
|
||||
for(x = 2; x <= x_maze_max; x++)
|
||||
for(y = 2; y <= y_maze_max; y++)
|
||||
levl[x][y].typ = ((x % 2) && (y % 2)) ? STONE : HWALL;
|
||||
|
||||
maze0xy(&mm);
|
||||
walkfrom((int) mm.x, (int) mm.y, 0);
|
||||
/* put a boulder at the maze center */
|
||||
(void) mksobj_at(BOULDER, (int) mm.x, (int) mm.y, TRUE, FALSE);
|
||||
|
||||
#ifdef WALLIFIED_MAZE
|
||||
wallification(2, 2, x_maze_max, y_maze_max);
|
||||
#endif
|
||||
if (!level.flags.corrmaze)
|
||||
wallification(2, 2, x_maze_max, y_maze_max);
|
||||
|
||||
mazexy(&mm);
|
||||
mkstairs(mm.x, mm.y, 1, (struct mkroom *)0); /* up */
|
||||
if (!Invocation_lev(&u.uz)) {
|
||||
@@ -650,11 +650,12 @@ schar typ;
|
||||
int q, a, dir, pos;
|
||||
int dirs[4];
|
||||
|
||||
#ifndef WALLIFIED_MAZE
|
||||
if (!typ) typ = CORR;
|
||||
#else
|
||||
if (!typ) typ = ROOM;
|
||||
#endif
|
||||
if (!typ) {
|
||||
if (level.flags.corrmaze)
|
||||
typ = CORR;
|
||||
else
|
||||
typ = ROOM;
|
||||
}
|
||||
|
||||
pos = 1;
|
||||
mazex[pos] = (char) x;
|
||||
@@ -695,11 +696,12 @@ schar typ;
|
||||
register int q,a,dir;
|
||||
int dirs[4];
|
||||
|
||||
#ifndef WALLIFIED_MAZE
|
||||
if (!typ) typ = CORR;
|
||||
#else
|
||||
if (!typ) typ = ROOM;
|
||||
#endif
|
||||
if (!typ) {
|
||||
if (level.flags.corrmaze)
|
||||
typ = CORR;
|
||||
else
|
||||
typ = ROOM;
|
||||
}
|
||||
|
||||
if(!IS_DOOR(levl[x][y].typ)) {
|
||||
/* might still be on edge of MAP, so don't overwrite */
|
||||
@@ -737,7 +739,7 @@ register int dir;
|
||||
|
||||
void
|
||||
mazexy(cc) /* find random point in generated corridors,
|
||||
so we don't create items in moats, bunkers, or walls */
|
||||
so we don't create items in moats, bunkers, or walls */
|
||||
coord *cc;
|
||||
{
|
||||
int cpt=0;
|
||||
@@ -746,13 +748,8 @@ mazexy(cc) /* find random point in generated corridors,
|
||||
cc->x = 3 + 2*rn2((x_maze_max>>1) - 1);
|
||||
cc->y = 3 + 2*rn2((y_maze_max>>1) - 1);
|
||||
cpt++;
|
||||
} while (cpt < 100 && levl[cc->x][cc->y].typ !=
|
||||
#ifdef WALLIFIED_MAZE
|
||||
ROOM
|
||||
#else
|
||||
CORR
|
||||
#endif
|
||||
);
|
||||
} while (cpt < 100 &&
|
||||
levl[cc->x][cc->y].typ != (level.flags.corrmaze ? CORR : ROOM));
|
||||
if (cpt >= 100) {
|
||||
register int x, y;
|
||||
/* last try */
|
||||
@@ -760,13 +757,8 @@ mazexy(cc) /* find random point in generated corridors,
|
||||
for (y = 0; y < (y_maze_max>>1) - 1; y++) {
|
||||
cc->x = 3 + 2 * x;
|
||||
cc->y = 3 + 2 * y;
|
||||
if (levl[cc->x][cc->y].typ ==
|
||||
#ifdef WALLIFIED_MAZE
|
||||
ROOM
|
||||
#else
|
||||
CORR
|
||||
#endif
|
||||
) return;
|
||||
if (levl[cc->x][cc->y].typ == (level.flags.corrmaze ? CORR : ROOM))
|
||||
return;
|
||||
}
|
||||
panic("mazexy: can't find a place!");
|
||||
}
|
||||
@@ -783,7 +775,7 @@ bound_digging()
|
||||
* so the boundary would be breached
|
||||
*
|
||||
* we can't bound unconditionally on one beyond the last line, because
|
||||
* that provides a window of abuse for WALLIFIED_MAZE special levels
|
||||
* that provides a window of abuse for wallified special levels
|
||||
*/
|
||||
{
|
||||
register int x,y;
|
||||
|
||||
22
src/objnam.c
22
src/objnam.c
@@ -19,6 +19,8 @@ STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *));
|
||||
STATIC_DCL boolean FDECL(singplur_lookup, (char *,char *,BOOLEAN_P,
|
||||
const char *const *));
|
||||
STATIC_DCL char *FDECL(singplur_compound, (char *));
|
||||
STATIC_DCL char *FDECL(xname_flags, (struct obj *, unsigned));
|
||||
|
||||
|
||||
struct Jitem {
|
||||
int item;
|
||||
@@ -237,7 +239,15 @@ boolean juice; /* whether or not to append " juice" to the name */
|
||||
|
||||
char *
|
||||
xname(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
return xname_flags(obj, CXN_NORMAL);
|
||||
}
|
||||
|
||||
char *
|
||||
xname_flags(obj, cxn_flags)
|
||||
register struct obj *obj;
|
||||
unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
{
|
||||
register char *buf;
|
||||
register int typ = obj->otyp;
|
||||
@@ -246,7 +256,7 @@ register struct obj *obj;
|
||||
const char *actualn = OBJ_NAME(*ocl);
|
||||
const char *dn = OBJ_DESCR(*ocl);
|
||||
const char *un = ocl->oc_uname;
|
||||
boolean pluralize = (obj->quan != 1L);
|
||||
boolean pluralize = (obj->quan != 1L) && !(cxn_flags & CXN_SINGULAR);
|
||||
boolean known, dknown, bknown;
|
||||
|
||||
buf = nextobuf() + PREFIX; /* leave room for "17 -3 " */
|
||||
@@ -1078,6 +1088,16 @@ struct obj *obj;
|
||||
return xname(obj);
|
||||
}
|
||||
|
||||
/* like cxname, but ignores quantity */
|
||||
char *
|
||||
cxname_singular(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
if (obj->otyp == CORPSE)
|
||||
return corpse_xname(obj, (const char *)0, CXN_SINGULAR);
|
||||
return xname_flags(obj, CXN_SINGULAR);
|
||||
}
|
||||
|
||||
/* treat an object as fully ID'd when it might be used as reason for death */
|
||||
char *
|
||||
killer_xname(obj)
|
||||
|
||||
@@ -105,6 +105,7 @@ static struct Bool_Opt
|
||||
{"color", &iflags.wc_color, FALSE, SET_IN_GAME}, /*WC*/
|
||||
# endif
|
||||
{"confirm",&flags.confirm, TRUE, SET_IN_GAME},
|
||||
{"dark_room", &flags.dark_room, TRUE, SET_IN_GAME},
|
||||
{"eight_bit_tty", &iflags.wc_eight_bit_input, FALSE, SET_IN_GAME}, /*WC*/
|
||||
#ifdef TTY_GRAPHICS
|
||||
{"extmenu", &iflags.extmenu, FALSE, SET_IN_GAME},
|
||||
@@ -346,6 +347,7 @@ static struct Comp_Opt
|
||||
{ "scroll_amount", "amount to scroll map when scroll_margin is reached",
|
||||
20, DISP_IN_GAME }, /*WC*/
|
||||
{ "scroll_margin", "scroll map when this far from the edge", 20, DISP_IN_GAME }, /*WC*/
|
||||
{ "sortloot", "sort object selection lists by description", 4, SET_IN_GAME },
|
||||
#ifdef MSDOS
|
||||
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE },
|
||||
#endif
|
||||
@@ -496,6 +498,35 @@ STATIC_OVL boolean FDECL(wc2_supported, (const char *));
|
||||
STATIC_DCL void FDECL(remove_autopickup_exception, (struct autopickup_exception *));
|
||||
STATIC_OVL int FDECL(count_ape_maps, (int *, int *));
|
||||
|
||||
|
||||
void
|
||||
reglyph_darkroom()
|
||||
{
|
||||
xchar x,y;
|
||||
for (x = 0; x < COLNO; x++)
|
||||
for (y = 0; y < ROWNO; y++) {
|
||||
struct rm *lev = &levl[x][y];
|
||||
if (!flags.dark_room) {
|
||||
if (lev->glyph == cmap_to_glyph(S_darkroom))
|
||||
lev->glyph = lev->waslit ? cmap_to_glyph(S_room) : cmap_to_glyph(S_stone);
|
||||
} else {
|
||||
if (lev->glyph == cmap_to_glyph(S_room) &&
|
||||
lev->seenv &&
|
||||
lev->waslit && !cansee(x,y))
|
||||
lev->glyph = cmap_to_glyph(S_darkroom);
|
||||
else if (lev->glyph == cmap_to_glyph(S_stone) &&
|
||||
lev->typ == ROOM &&
|
||||
lev->seenv &&
|
||||
!cansee(x,y))
|
||||
lev->glyph = cmap_to_glyph(S_darkroom);
|
||||
}
|
||||
}
|
||||
if (flags.dark_room && iflags.use_color)
|
||||
showsyms[S_darkroom]=showsyms[S_room];
|
||||
else
|
||||
showsyms[S_darkroom]=showsyms[S_stone];
|
||||
}
|
||||
|
||||
/* check whether a user-supplied option string is a proper leading
|
||||
substring of a particular option name; option string might have
|
||||
a colon or equals sign and arbitrary value appended to it */
|
||||
@@ -629,6 +660,7 @@ initoptions_init()
|
||||
(genericptr_t)def_inv_order, sizeof flags.inv_order);
|
||||
flags.pickup_types[0] = '\0';
|
||||
flags.pickup_burden = MOD_ENCUMBER;
|
||||
flags.sortloot = 'l'; /* sort only loot by default */
|
||||
|
||||
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++)
|
||||
flags.end_disclose[i] = DISCLOSE_PROMPT_DEFAULT_NO;
|
||||
@@ -704,6 +736,8 @@ initoptions_finish()
|
||||
/* result in the player's preferred fruit [better than "\033"]. */
|
||||
obj_descr[SLIME_MOLD].oc_name = "fruit";
|
||||
|
||||
reglyph_darkroom();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2328,6 +2362,22 @@ goodfruit:
|
||||
return;
|
||||
}
|
||||
|
||||
fullname = "sortloot";
|
||||
if (match_optname(opts, fullname, 4, TRUE)) {
|
||||
op = string_for_env_opt(fullname, opts, FALSE);
|
||||
if (op) {
|
||||
switch (tolower(*op)) {
|
||||
case 'n':
|
||||
case 'l':
|
||||
case 'f': flags.sortloot = tolower(*op);
|
||||
break;
|
||||
default: badoption(opts);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fullname = "suppress_alert";
|
||||
if (match_optname(opts, fullname, 4, TRUE)) {
|
||||
if (duplicate) complain_about_duplicate(opts,1);
|
||||
@@ -2810,7 +2860,8 @@ goodfruit:
|
||||
else if ((boolopt[i].addr) == &flags.invlet_constant) {
|
||||
if (flags.invlet_constant) reassign();
|
||||
}
|
||||
else if ((boolopt[i].addr) == &flags.lit_corridor) {
|
||||
else if (((boolopt[i].addr) == &flags.lit_corridor) ||
|
||||
((boolopt[i].addr) == &flags.dark_room)) {
|
||||
/*
|
||||
* All corridor squares seen via night vision or
|
||||
* candles & lamps change. Update them by calling
|
||||
@@ -2820,6 +2871,7 @@ goodfruit:
|
||||
*/
|
||||
vision_recalc(2); /* shut down vision */
|
||||
vision_full_recalc = 1; /* delayed recalc */
|
||||
if (iflags.use_color) need_redraw = TRUE; /* darkroom refresh */
|
||||
}
|
||||
else if ((boolopt[i].addr) == &iflags.use_inverse ||
|
||||
(boolopt[i].addr) == &flags.showrace ||
|
||||
@@ -2862,6 +2914,10 @@ static NEARDATA const char *runmodes[] = {
|
||||
"teleport", "run", "walk", "crawl"
|
||||
};
|
||||
|
||||
static NEARDATA const char *sortltype[] = {
|
||||
"none", "loot", "full"
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert the given string of object classes to a string of default object
|
||||
* symbols.
|
||||
@@ -3149,8 +3205,10 @@ doset()
|
||||
}
|
||||
|
||||
destroy_nhwindow(tmpwin);
|
||||
if (need_redraw)
|
||||
if (need_redraw) {
|
||||
reglyph_darkroom();
|
||||
(void) doredraw();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3168,7 +3226,8 @@ boolean setinitial,setfromfile;
|
||||
char buf[BUFSZ];
|
||||
|
||||
/* Special handling of menustyle, pickup_burden, pickup_types,
|
||||
* disclose, runmode, msg_window, menu_headings, and number_pad options.
|
||||
* disclose, runmode, msg_window, menu_headings, sortloot,
|
||||
* and number_pad options.
|
||||
* Also takes care of interactive autopickup_exception_handling changes.
|
||||
*/
|
||||
if (!strcmp("menustyle", optname)) {
|
||||
@@ -3349,6 +3408,23 @@ boolean setinitial,setfromfile;
|
||||
}
|
||||
destroy_nhwindow(tmpwin);
|
||||
#endif
|
||||
} else if (!strcmp("sortloot", optname)) {
|
||||
const char *sortl_name;
|
||||
menu_item *sortl_pick = (menu_item *)0;
|
||||
tmpwin = create_nhwindow(NHW_MENU);
|
||||
start_menu(tmpwin);
|
||||
for (i = 0; i < SIZE(sortltype); i++) {
|
||||
sortl_name = sortltype[i];
|
||||
any.a_char = *sortl_name;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0,
|
||||
ATR_NONE, sortl_name, MENU_UNSELECTED);
|
||||
}
|
||||
end_menu(tmpwin, "Select loot sorting type:");
|
||||
if (select_menu(tmpwin, PICK_ONE, &sortl_pick) > 0) {
|
||||
flags.sortloot = sortl_pick->item.a_char;
|
||||
free((genericptr_t)sortl_pick);
|
||||
}
|
||||
destroy_nhwindow(tmpwin);
|
||||
} else if (!strcmp("align_message", optname) ||
|
||||
!strcmp("align_status", optname)) {
|
||||
menu_item *window_pick = (menu_item *)0;
|
||||
@@ -3938,6 +4014,15 @@ char *buf;
|
||||
if (iflags.wc_scroll_margin) Sprintf(buf, "%d",iflags.wc_scroll_margin);
|
||||
else Strcpy(buf, defopt);
|
||||
}
|
||||
else if (!strcmp(optname, "sortloot")) {
|
||||
char *sortname = (char *)NULL;
|
||||
for (i=0; i < SIZE(sortltype) && sortname==(char *)NULL; i++) {
|
||||
if (flags.sortloot == sortltype[i][0])
|
||||
sortname = (char *)sortltype[i];
|
||||
}
|
||||
if (sortname != (char *)NULL)
|
||||
Sprintf(buf, "%s", sortname);
|
||||
}
|
||||
else if (!strcmp(optname, "player_selection"))
|
||||
Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog");
|
||||
#ifdef MSDOS
|
||||
|
||||
@@ -250,7 +250,7 @@ lookat(x, y, buf, monbuf)
|
||||
int tnum = what_trap(glyph_to_trap(glyph));
|
||||
Strcpy(buf, defsyms[trap_to_defsym(tnum)].explanation);
|
||||
} else if(!glyph_is_cmap(glyph)) {
|
||||
Strcpy(buf,"dark part of a room");
|
||||
Strcpy(buf,"unexplored area");
|
||||
} else switch(glyph_to_cmap(glyph)) {
|
||||
case S_altar:
|
||||
Sprintf(buf, "%s %saltar",
|
||||
@@ -557,8 +557,8 @@ const char **firstmatch;
|
||||
x_str = defsyms[i].explanation;
|
||||
if (sym == ((looked) ?
|
||||
showsyms[i] : defsyms[i].sym) && *x_str) {
|
||||
/* avoid "an air", "a water", or "a floor of a room" */
|
||||
int article = (i == S_room) ? 2 : /* 2=>"the" */
|
||||
/* avoid "an air", "a water", "a floor of a room", "a dark part of a room" */
|
||||
int article = ((i == S_room)||(i == S_darkroom)) ? 2 : /* 2=>"the" */
|
||||
!(strcmp(x_str, "air") == 0 || /* 1=>"an" */
|
||||
strcmp(x_str, "water") == 0); /* 0=>(none)*/
|
||||
|
||||
|
||||
17
src/pickup.c
17
src/pickup.c
@@ -708,9 +708,10 @@ menu_item **pick_list; /* return list of items picked */
|
||||
int how; /* type of query */
|
||||
boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
{
|
||||
int n;
|
||||
int i, j, n;
|
||||
winid win;
|
||||
struct obj *curr, *last, fake_hero_object;
|
||||
struct obj **oarray;
|
||||
char *pack;
|
||||
anything any;
|
||||
boolean printed_type_name,
|
||||
@@ -743,6 +744,16 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
return 1;
|
||||
}
|
||||
|
||||
oarray = objarr_init(n);
|
||||
/* Add objects to the array */
|
||||
i = 0;
|
||||
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
|
||||
if ((*allow)(curr)) {
|
||||
objarr_set(curr, i++, oarray, (flags.sortloot == 'f' ||
|
||||
(flags.sortloot == 'l' && !(qflags & USE_INVLET))));
|
||||
}
|
||||
}
|
||||
|
||||
win = create_nhwindow(NHW_MENU);
|
||||
start_menu(win);
|
||||
any = zeroany;
|
||||
@@ -756,7 +767,8 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
pack = flags.inv_order;
|
||||
do {
|
||||
printed_type_name = FALSE;
|
||||
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
|
||||
for (i = 0; i < n; i++) {
|
||||
curr = oarray[i];
|
||||
if ((qflags & FEEL_COCKATRICE) && curr->otyp == CORPSE &&
|
||||
will_feel_cockatrice(curr, FALSE)) {
|
||||
destroy_nhwindow(win); /* stop the menu and revert */
|
||||
@@ -784,6 +796,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
}
|
||||
pack++;
|
||||
} while (sorted && *pack);
|
||||
free(oarray);
|
||||
|
||||
if (engulfer) {
|
||||
char buf[BUFSZ];
|
||||
|
||||
@@ -888,7 +888,7 @@ display_stinking_cloud_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx, dy;
|
||||
int dist = 6;
|
||||
|
||||
27
src/sp_lev.c
27
src/sp_lev.c
@@ -520,12 +520,11 @@ schar filling;
|
||||
|
||||
for (x = x1; x <= x2; x++)
|
||||
for (y = y1; y <= y2; y++) {
|
||||
#ifndef WALLIFIED_MAZE
|
||||
levl[x][y].typ = STONE;
|
||||
#else
|
||||
levl[x][y].typ =
|
||||
(y < 2 || ((x % 2) && (y % 2))) ? STONE : filling;
|
||||
#endif
|
||||
if (level.flags.corrmaze)
|
||||
levl[x][y].typ = STONE;
|
||||
else
|
||||
levl[x][y].typ =
|
||||
(y < 2 || ((x % 2) && (y % 2))) ? STONE : filling;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2948,6 +2947,7 @@ spo_level_flags(coder)
|
||||
if (lflags & GRAVEYARD) level.flags.graveyard = 1;
|
||||
if (lflags & ICEDPOOLS) icedpools = TRUE;
|
||||
if (lflags & SOLIDIFY) coder->solidify = TRUE;
|
||||
if (lflags & CORRMAZE) level.flags.corrmaze = TRUE;
|
||||
|
||||
opvar_free(flagdata);
|
||||
}
|
||||
@@ -4114,11 +4114,7 @@ spo_mazewalk(coder)
|
||||
if (!isok(x,y)) return;
|
||||
|
||||
if (OV_i(ftyp) < 1) {
|
||||
#ifndef WALLIFIED_MAZE
|
||||
OV_i(ftyp) = CORR;
|
||||
#else
|
||||
OV_i(ftyp) = ROOM;
|
||||
#endif
|
||||
OV_i(ftyp) = level.flags.corrmaze ? CORR : ROOM;
|
||||
}
|
||||
|
||||
/* don't use move() - it doesn't use W_NORTH, etc. */
|
||||
@@ -5167,7 +5163,14 @@ next_opcode:
|
||||
link_doors_rooms();
|
||||
fill_rooms();
|
||||
remove_boundary_syms();
|
||||
wallification(1, 0, COLNO-1, ROWNO-1);
|
||||
/* FIXME: Ideally, we want this call to only cover areas of the map
|
||||
* which were not inserted directly by the special level file (see
|
||||
* the insect legs on Baalzebub's level, for instance). Since that
|
||||
* is currently not possible, we overload the corrmaze flag for this
|
||||
* purpose.
|
||||
*/
|
||||
if (!level.flags.corrmaze)
|
||||
wallification(1, 0, COLNO-1, ROWNO-1);
|
||||
|
||||
count_features();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user