Merge branch 'master' into derek-farming
Reverse merge before final reintegration. * master: (40 commits) Fix magic mapped dark room symbols Disclose extinct species alongside genocided ones ... Conflicts: doc/fixes35.0 src/do.c src/files.c src/invent.c src/objnam.c sys/share/pcmain.c
This commit is contained in:
@@ -294,6 +294,8 @@ boolean resuming;
|
||||
/* underwater and waterlevel vision are done here */
|
||||
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
|
||||
movebubbles();
|
||||
else if (Is_firelevel(&u.uz))
|
||||
fumaroles();
|
||||
else if (Underwater)
|
||||
under_water(0);
|
||||
/* vision while buried done here */
|
||||
|
||||
+7
-4
@@ -37,6 +37,8 @@ STATIC_DCL boolean FDECL(figurine_location_checks,
|
||||
(struct obj *, coord *, BOOLEAN_P));
|
||||
STATIC_DCL void FDECL(add_class, (char *, CHAR_P));
|
||||
STATIC_DCL void FDECL(setapplyclasses, (char *));
|
||||
STATIC_DCL boolean FDECL(is_valid_jump_pos, (int, int, int, BOOLEAN_P));
|
||||
STATIC_DCL boolean FDECL(find_poleable_mon, (coord *, int, int));
|
||||
|
||||
#ifdef AMIGA
|
||||
void FDECL( amii_speaker, ( struct obj *, char *, int ) );
|
||||
@@ -1394,14 +1396,15 @@ 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++)
|
||||
for (dy = -4; dy <= 4; dy++) {
|
||||
x = dx + (int)u.ux;
|
||||
y = dy + (int)u.uy;
|
||||
if (isok(x,y) && is_valid_jump_pos(x,y, jumping_is_magic, FALSE))
|
||||
if (isok(x,y) && ACCESSIBLE(levl[x][y].typ) &&
|
||||
is_valid_jump_pos(x,y, jumping_is_magic, FALSE))
|
||||
tmp_at(x,y);
|
||||
}
|
||||
} else {
|
||||
@@ -2602,14 +2605,14 @@ 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++)
|
||||
for (dy = -4; dy <= 4; dy++) {
|
||||
x = dx + (int)u.ux;
|
||||
y = dy + (int)u.uy;
|
||||
if (isok(x, y) &&
|
||||
if (isok(x, y) && ACCESSIBLE(levl[x][y].typ) &&
|
||||
distu(x, y) >= polearm_range_min &&
|
||||
distu(x, y) <= polearm_range_max) {
|
||||
tmp_at(x, y);
|
||||
|
||||
+5
-4
@@ -331,7 +331,7 @@ struct obj *corpse;
|
||||
clear_bypasses();
|
||||
fd = open_bonesfile(&u.uz, &bonesid);
|
||||
if (fd >= 0) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
if (wizard) {
|
||||
if (yn("Bones file already exists. Replace it?") == 'y') {
|
||||
if (delete_bonesfile(&u.uz)) goto make_bones;
|
||||
@@ -504,7 +504,7 @@ struct obj *corpse;
|
||||
if (bytes_counted > freediskspace(bones)) { /* not enough room */
|
||||
if (wizard)
|
||||
pline("Insufficient space to create bones file.");
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
cancel_bonesfile();
|
||||
return;
|
||||
}
|
||||
@@ -551,7 +551,7 @@ getbones()
|
||||
ok = TRUE;
|
||||
if(wizard) {
|
||||
if(yn("Get bones?") == 'n') {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
compress_bonesfile();
|
||||
return(0);
|
||||
}
|
||||
@@ -595,8 +595,9 @@ getbones()
|
||||
resetobjs(level.buriedobjlist,TRUE);
|
||||
}
|
||||
}
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
sanitize_engravings();
|
||||
u.uroleplay.numbones++;
|
||||
|
||||
if(wizard) {
|
||||
if(yn("Unlink bones?") == 'n') {
|
||||
|
||||
+5
-3
@@ -103,9 +103,9 @@ NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
|
||||
|
||||
NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
|
||||
NEARDATA s_level *sp_levchn;
|
||||
NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 };
|
||||
NEARDATA stairway upladder = { 0, 0 }, dnladder = { 0, 0 };
|
||||
NEARDATA stairway sstairs = { 0, 0 };
|
||||
NEARDATA stairway upstair = { 0, 0, { 0,0 }, 0 }, dnstair = { 0, 0, { 0,0 }, 0 };
|
||||
NEARDATA stairway upladder = { 0, 0, { 0,0 }, 0 }, dnladder = { 0, 0, { 0,0 }, 0 };
|
||||
NEARDATA stairway sstairs = { 0, 0, { 0,0 }, 0 };
|
||||
NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
NEARDATA coord inv_pos = { 0, 0 };
|
||||
@@ -219,6 +219,8 @@ NEARDATA struct c_color_names c_color_names = {
|
||||
"white"
|
||||
};
|
||||
|
||||
struct menucoloring *menu_colorings = NULL;
|
||||
|
||||
const char *c_obj_colors[] = {
|
||||
"black", /* CLR_BLACK */
|
||||
"red", /* CLR_RED */
|
||||
|
||||
+13
-6
@@ -160,7 +160,7 @@ magic_map_background(x, y, show)
|
||||
if (!cansee(x,y) && !lev->waslit) {
|
||||
/* Floor spaces are dark if unlit. Corridors are dark if unlit. */
|
||||
if (lev->typ == ROOM && glyph == cmap_to_glyph(S_room))
|
||||
glyph = cmap_to_glyph(S_stone);
|
||||
glyph = cmap_to_glyph((flags.dark_room && iflags.use_color) ? (DARKROOMSYM) : S_stone);
|
||||
else if (lev->typ == CORR && glyph == cmap_to_glyph(S_litcorr))
|
||||
glyph = cmap_to_glyph(S_corr);
|
||||
}
|
||||
@@ -674,7 +674,12 @@ newsym(x,y)
|
||||
*/
|
||||
lev->waslit = (lev->lit!=0); /* remember lit condition */
|
||||
|
||||
if (reg != NULL && ACCESSIBLE(lev->typ)) {
|
||||
/* normal region shown only on accessible positions, but poison clouds
|
||||
* also shown above lava, pools and moats.
|
||||
*/
|
||||
if (reg != NULL && (ACCESSIBLE(lev->typ) ||
|
||||
(reg->glyph == cmap_to_glyph(S_poisoncloud) &&
|
||||
(lev->typ == LAVAPOOL || lev->typ == POOL || lev->typ == MOAT)))) {
|
||||
show_region(reg,x,y);
|
||||
return;
|
||||
}
|
||||
@@ -759,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 {
|
||||
@@ -824,8 +829,10 @@ shieldeff(x,y)
|
||||
* DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account.
|
||||
*/
|
||||
|
||||
#define TMP_AT_MAX_GLYPHS (COLNO*2)
|
||||
|
||||
static struct tmp_glyph {
|
||||
coord saved[COLNO]; /* previously updated positions */
|
||||
coord saved[TMP_AT_MAX_GLYPHS]; /* previously updated positions */
|
||||
int sidx; /* index of next unused slot in saved[] */
|
||||
int style; /* either DISP_BEAM or DISP_FLASH or DISP_ALWAYS */
|
||||
int glyph; /* glyph to use when printing */
|
||||
@@ -895,7 +902,7 @@ tmp_at(x, y)
|
||||
default: /* do it */
|
||||
if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) {
|
||||
if (tglyph->style != DISP_ALL && !cansee(x,y)) break;
|
||||
if (tglyph->sidx >= COLNO) break; /* too many locations */
|
||||
if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */
|
||||
/* save pos for later erasing */
|
||||
tglyph->saved[tglyph->sidx].x = x;
|
||||
tglyph->saved[tglyph->sidx].y = y;
|
||||
|
||||
@@ -953,7 +953,7 @@ currentlevel_rewrite()
|
||||
|
||||
#ifdef MFLOPPY
|
||||
if (!savelev(fd, ledger_no(&u.uz), COUNT_SAVE)) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
delete_levelfile(ledger_no(&u.uz));
|
||||
pline("NetHack is out of disk space for making levels!");
|
||||
You("can save, quit, or continue playing.");
|
||||
@@ -1168,7 +1168,7 @@ boolean at_stairs, falling, portal;
|
||||
}
|
||||
minit(); /* ZEROCOMP */
|
||||
getlev(fd, hackpid, new_ledger, FALSE);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
oinit(); /* reassign level dependent obj probabilities */
|
||||
}
|
||||
/* do this prior to level-change pline messages */
|
||||
@@ -1296,6 +1296,8 @@ boolean at_stairs, falling, portal;
|
||||
/* initial movement of bubbles just before vision_recalc */
|
||||
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
|
||||
movebubbles();
|
||||
else if (Is_firelevel(&u.uz))
|
||||
fumaroles();
|
||||
|
||||
if (level_info[new_ledger].flags & FORGOTTEN) {
|
||||
forget_map(ALL_MAP); /* forget the map */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
+20
-15
@@ -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,28 +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 */
|
||||
};
|
||||
|
||||
@@ -614,6 +617,7 @@ struct symparse loadsyms[] = {
|
||||
{SYM_PCHAR, S_hcdbridge, "S_hcdbridge"},
|
||||
{SYM_PCHAR, S_air, "S_air"},
|
||||
{SYM_PCHAR, S_cloud, "S_cloud"},
|
||||
{SYM_PCHAR, S_poisoncloud, "S_poisoncloud"},
|
||||
{SYM_PCHAR, S_water, "S_water"},
|
||||
{SYM_PCHAR, S_arrow_trap, "S_arrow_trap"},
|
||||
{SYM_PCHAR, S_dart_trap, "S_dart_trap"},
|
||||
@@ -645,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"},
|
||||
|
||||
@@ -1237,6 +1237,9 @@ struct obj *list;
|
||||
boolean identified, all_containers, reportempty;
|
||||
{
|
||||
register struct obj *box, *obj;
|
||||
struct obj **oarray;
|
||||
int i,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);
|
||||
@@ -1413,43 +1437,72 @@ num_genocides()
|
||||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
num_extinct()
|
||||
{
|
||||
int i, n = 0;
|
||||
|
||||
for (i = LOW_PM; i < NUMMONS; ++i)
|
||||
if (!(mvitals[i].mvflags & G_GENOD) &&
|
||||
(mvitals[i].mvflags & G_GONE) &&
|
||||
!(mons[i].geno & G_UNIQ)) ++n;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
STATIC_OVL void
|
||||
list_genocided(defquery, ask)
|
||||
char defquery;
|
||||
boolean ask;
|
||||
{
|
||||
register int i;
|
||||
int ngenocided;
|
||||
int ngenocided, nextinct;
|
||||
char c;
|
||||
winid klwin;
|
||||
char buf[BUFSZ];
|
||||
|
||||
ngenocided = num_genocides();
|
||||
nextinct = num_extinct();
|
||||
|
||||
/* genocided species list */
|
||||
if (ngenocided != 0) {
|
||||
c = ask ? yn_function("Do you want a list of species genocided?",
|
||||
ynqchars, defquery) : defquery;
|
||||
/* genocided or extinct species list */
|
||||
if (ngenocided != 0 || nextinct != 0) {
|
||||
Sprintf(buf, "Do you want a list of %sspecies%s%s?",
|
||||
(nextinct && !ngenocided) ? "extinct " : "",
|
||||
(ngenocided) ? " genocided" : "",
|
||||
(nextinct && ngenocided) ? " and extinct" : "");
|
||||
c = ask ? yn_function(buf, ynqchars, defquery) : defquery;
|
||||
if (c == 'q') done_stopprint++;
|
||||
if (c == 'y') {
|
||||
klwin = create_nhwindow(NHW_MENU);
|
||||
putstr(klwin, 0, "Genocided species:");
|
||||
Sprintf(buf, "%s%s species:",
|
||||
(ngenocided) ? "Genocided" : "Extinct",
|
||||
(nextinct && ngenocided) ? " or extinct" : "");
|
||||
putstr(klwin, 0, buf);
|
||||
putstr(klwin, 0, "");
|
||||
|
||||
for (i = LOW_PM; i < NUMMONS; i++)
|
||||
if (mvitals[i].mvflags & G_GENOD) {
|
||||
if (mvitals[i].mvflags & G_GONE && !(mons[i].geno & G_UNIQ)) {
|
||||
if ((mons[i].geno & G_UNIQ) && i != PM_HIGH_PRIEST)
|
||||
Sprintf(buf, "%s%s",
|
||||
!type_is_pname(&mons[i]) ? "" : "the ",
|
||||
mons[i].mname);
|
||||
else
|
||||
Strcpy(buf, makeplural(mons[i].mname));
|
||||
if (!(mvitals[i].mvflags & G_GENOD))
|
||||
Strcat(buf, " (extinct)");
|
||||
putstr(klwin, 0, buf);
|
||||
}
|
||||
|
||||
putstr(klwin, 0, "");
|
||||
Sprintf(buf, "%d species genocided.", ngenocided);
|
||||
putstr(klwin, 0, buf);
|
||||
if (ngenocided > 0) {
|
||||
Sprintf(buf, "%d species genocided.", ngenocided);
|
||||
putstr(klwin, 0, buf);
|
||||
}
|
||||
if (nextinct > 0) {
|
||||
Sprintf(buf, "%d species extinct.", nextinct);
|
||||
putstr(klwin, 0, buf);
|
||||
}
|
||||
|
||||
display_nhwindow(klwin, TRUE);
|
||||
destroy_nhwindow(klwin);
|
||||
|
||||
+45
-36
@@ -641,12 +641,12 @@ really_close()
|
||||
lftrack.fd = -1;
|
||||
lftrack.oflag = 0;
|
||||
if (fd != -1)
|
||||
(void)_close(fd);
|
||||
(void)close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
close(fd)
|
||||
nhclose(fd)
|
||||
int fd;
|
||||
{
|
||||
if (lftrack.fd == fd) {
|
||||
@@ -655,10 +655,17 @@ int fd;
|
||||
lftrack.nethack_thinks_it_is_open = FALSE;
|
||||
return 0;
|
||||
}
|
||||
return _close(fd);
|
||||
return close(fd);
|
||||
}
|
||||
#else
|
||||
int
|
||||
nhclose(fd)
|
||||
int fd;
|
||||
{
|
||||
return close(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* ---------- END LEVEL FILE HANDLING ----------- */
|
||||
|
||||
|
||||
@@ -996,7 +1003,7 @@ restore_saved_game()
|
||||
if ((fd = open_savefile()) < 0) return fd;
|
||||
|
||||
if (validate(fd, fq_save) != 0) {
|
||||
(void) close(fd), fd = -1;
|
||||
(void) nhclose(fd), fd = -1;
|
||||
(void) delete_savefile();
|
||||
}
|
||||
return fd;
|
||||
@@ -1021,7 +1028,7 @@ const char* filename;
|
||||
get_plname_from_file(fd, tplname);
|
||||
result = dupstr(tplname);
|
||||
}
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
}
|
||||
nh_compress(SAVEF);
|
||||
|
||||
@@ -1413,7 +1420,7 @@ docompress_file(filename, uncomp)
|
||||
const char *filename;
|
||||
boolean uncomp;
|
||||
{
|
||||
gzFile *compressedfile;
|
||||
gzFile compressedfile;
|
||||
FILE *uncompressedfile;
|
||||
char cfn[256];
|
||||
char buf[1024];
|
||||
@@ -1777,7 +1784,7 @@ const char *filename;
|
||||
if (unlink(lockname) < 0)
|
||||
HUP raw_printf("Can't unlink %s.", lockname);
|
||||
# ifdef NO_FILE_LINKS
|
||||
(void) close(lockfd);
|
||||
(void) nhclose(lockfd);
|
||||
# endif
|
||||
|
||||
#endif /* UNIX || VMS */
|
||||
@@ -2288,6 +2295,8 @@ int src;
|
||||
} else if (match_varname(buf, "BOULDER", 3)) {
|
||||
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE,
|
||||
1, "BOULDER");
|
||||
} else if (match_varname(buf, "MENUCOLOR", 9)) {
|
||||
(void) add_menu_coloring(bufp);
|
||||
} else if (match_varname(buf, "WARNINGS", 5)) {
|
||||
(void) get_uchars(fp, buf, bufp, translate, FALSE,
|
||||
WARNCOUNT, "WARNINGS");
|
||||
@@ -2932,9 +2941,9 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
|
||||
wait_synch();
|
||||
}
|
||||
# endif
|
||||
(void) close(fd); /* RECORD is accessible */
|
||||
(void) nhclose(fd); /* RECORD is accessible */
|
||||
} else if ((fd = open(fq_record, O_CREAT|O_RDWR, FCMASK)) >= 0) {
|
||||
(void) close(fd); /* RECORD newly created */
|
||||
(void) nhclose(fd); /* RECORD newly created */
|
||||
# if defined(VMS) && !defined(SECURE)
|
||||
/* Re-protect RECORD with world:read+write+execute+delete access. */
|
||||
(void) chmod(fq_record, FCMASK | 007);
|
||||
@@ -2974,9 +2983,9 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
|
||||
raw_printf("Warning: cannot write record %s", tmp);
|
||||
wait_synch();
|
||||
} else
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
} else /* open succeeded */
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
#else /* MICRO || WIN32*/
|
||||
|
||||
# ifdef MAC
|
||||
@@ -3060,14 +3069,14 @@ recover_savefile()
|
||||
if (read(gfd, (genericptr_t) &hpid, sizeof hpid) != sizeof hpid) {
|
||||
raw_printf(
|
||||
"\nCheckpoint data incompletely written or subsequently clobbered. Recovery impossible.");
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
if (read(gfd, (genericptr_t) &savelev, sizeof(savelev))
|
||||
!= sizeof(savelev)) {
|
||||
raw_printf("\nCheckpointing was not in effect for %s -- recovery impossible.\n",
|
||||
lock);
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
if ((read(gfd, (genericptr_t) savename, sizeof savename)
|
||||
@@ -3081,7 +3090,7 @@ recover_savefile()
|
||||
(read(gfd, (genericptr_t) &tmpplbuf, pltmpsiz)
|
||||
!= pltmpsiz)) {
|
||||
raw_printf("\nError reading %s -- can't recover.\n", lock);
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -3097,15 +3106,15 @@ recover_savefile()
|
||||
sfd = create_savefile();
|
||||
if (sfd < 0) {
|
||||
raw_printf("\nCannot recover savefile %s.\n", SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lfd = open_levelfile(savelev, errbuf);
|
||||
if (lfd < 0) {
|
||||
raw_printf("\n%s\n", errbuf);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3113,8 +3122,8 @@ recover_savefile()
|
||||
if (write(sfd, (genericptr_t) &version_data, sizeof version_data)
|
||||
!= sizeof version_data) {
|
||||
raw_printf("\nError writing %s; recovery failed.", SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3124,8 +3133,8 @@ recover_savefile()
|
||||
raw_printf(
|
||||
"\nError writing %s; recovery failed (savefile_info).\n",
|
||||
SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3135,8 +3144,8 @@ recover_savefile()
|
||||
raw_printf(
|
||||
"Error writing %s; recovery failed (player name size).\n",
|
||||
SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3146,28 +3155,28 @@ recover_savefile()
|
||||
raw_printf(
|
||||
"Error writing %s; recovery failed (player name).\n",
|
||||
SAVEF);
|
||||
(void)close(gfd);
|
||||
(void)close(sfd);
|
||||
(void)nhclose(gfd);
|
||||
(void)nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!copy_bytes(lfd, sfd)) {
|
||||
(void) close(lfd);
|
||||
(void) close(sfd);
|
||||
(void) nhclose(lfd);
|
||||
(void) nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
(void)close(lfd);
|
||||
(void)nhclose(lfd);
|
||||
processed[savelev] = 1;
|
||||
|
||||
if (!copy_bytes(gfd, sfd)) {
|
||||
(void) close(lfd);
|
||||
(void) close(sfd);
|
||||
(void) nhclose(lfd);
|
||||
(void) nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
(void)close(gfd);
|
||||
(void)nhclose(gfd);
|
||||
processed[0] = 1;
|
||||
|
||||
for (lev = 1; lev < 256; lev++) {
|
||||
@@ -3181,17 +3190,17 @@ recover_savefile()
|
||||
levc = (xchar) lev;
|
||||
write(sfd, (genericptr_t) &levc, sizeof(levc));
|
||||
if (!copy_bytes(lfd, sfd)) {
|
||||
(void) close(lfd);
|
||||
(void) close(sfd);
|
||||
(void) nhclose(lfd);
|
||||
(void) nhclose(sfd);
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
(void)close(lfd);
|
||||
(void)nhclose(lfd);
|
||||
processed[lev] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)close(sfd);
|
||||
(void)nhclose(sfd);
|
||||
|
||||
#ifdef HOLD_LOCKFILE_OPEN
|
||||
really_close();
|
||||
|
||||
+9
-5
@@ -603,24 +603,28 @@ STATIC_DCL struct tm *NDECL(getlt);
|
||||
void
|
||||
setrandom()
|
||||
{
|
||||
time_t now = getnow(); /* time((TIME_type) 0) */
|
||||
unsigned long seed = (unsigned long)getnow(); /* time((TIME_type) 0) */
|
||||
#ifdef UNIX
|
||||
/* Quick dirty band-aid to prevent PRNG prediction */
|
||||
seed *= getpid();
|
||||
#endif
|
||||
|
||||
/* the types are different enough here that sweeping the different
|
||||
* routine names into one via #defines is even more confusing
|
||||
*/
|
||||
#ifdef RANDOM /* srandom() from sys/share/random.c */
|
||||
srandom((unsigned int) now);
|
||||
srandom((unsigned int) seed);
|
||||
#else
|
||||
# if defined(__APPLE__) || defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */
|
||||
# if defined(BSD) && !defined(POSIX_TYPES) && defined(SUNOS4)
|
||||
(void)
|
||||
# endif
|
||||
srandom((int) now);
|
||||
srandom((int) seed);
|
||||
# else
|
||||
# ifdef UNIX /* system srand48() */
|
||||
srand48((long) now);
|
||||
srand48((long) seed);
|
||||
# else /* poor quality system routine */
|
||||
srand((int) now);
|
||||
srand((int) seed);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+114
-17
@@ -7,6 +7,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));
|
||||
@@ -41,6 +42,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;
|
||||
@@ -1726,11 +1809,12 @@ long* out_cnt;
|
||||
struct obj *otmp;
|
||||
char ilet, ret;
|
||||
char *invlet = flags.inv_order;
|
||||
int n, classcount;
|
||||
int i, n, classcount;
|
||||
winid win; /* windows being used */
|
||||
static winid local_win = WIN_ERR; /* window for partial menus */
|
||||
anything any;
|
||||
menu_item *selected;
|
||||
struct obj **oarray;
|
||||
|
||||
/* overriden by global flag */
|
||||
if (flags.perm_invent) {
|
||||
@@ -1777,6 +1861,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];
|
||||
@@ -1791,23 +1888,22 @@ 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;
|
||||
if (--invlet != venom_inv) {
|
||||
@@ -1815,6 +1911,7 @@ nextclass:
|
||||
goto nextclass;
|
||||
}
|
||||
}
|
||||
free(oarray);
|
||||
end_menu(win, (char *) 0);
|
||||
|
||||
n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected);
|
||||
|
||||
+9
-7
@@ -122,13 +122,15 @@ register int x, y, n;
|
||||
*/
|
||||
if (enexto(&mm, mm.x, mm.y, mtmp->data)) {
|
||||
mon = makemon(mtmp->data, mm.x, mm.y, NO_MM_FLAGS);
|
||||
mon->mpeaceful = FALSE;
|
||||
mon->mavenge = 0;
|
||||
set_malign(mon);
|
||||
/* Undo the second peace_minded() check in makemon(); if the
|
||||
* monster turned out to be peaceful the first time we
|
||||
* didn't create it at all; we don't want a second check.
|
||||
*/
|
||||
if (mon) {
|
||||
mon->mpeaceful = FALSE;
|
||||
mon->mavenge = 0;
|
||||
set_malign(mon);
|
||||
/* Undo the second peace_minded() check in makemon(); if the
|
||||
* monster turned out to be peaceful the first time we
|
||||
* didn't create it at all; we don't want a second check.
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -2558,6 +2558,7 @@ cloneu()
|
||||
if (u.mh <= 1) return(struct monst *)0;
|
||||
if (mvitals[mndx].mvflags & G_EXTINCT) return(struct monst *)0;
|
||||
mon = makemon(youmonst.data, u.ux, u.uy, NO_MINVENT|MM_EDOG);
|
||||
if (!mon) return NULL;
|
||||
mon->mcloned = 1;
|
||||
mon = christen_monst(mon, plname);
|
||||
initedog(mon);
|
||||
|
||||
+2
-1
@@ -537,7 +537,7 @@ STATIC_OVL void
|
||||
clear_level_structures()
|
||||
{
|
||||
static struct rm zerorm = { cmap_to_glyph(S_stone),
|
||||
0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
register int x,y;
|
||||
register struct rm *lev;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+51
-40
@@ -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;
|
||||
@@ -879,6 +871,25 @@ register xchar x, y, todnum, todlevel;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
fumaroles()
|
||||
{
|
||||
xchar n;
|
||||
boolean snd = FALSE, loud = FALSE;
|
||||
for (n = rn2(3)+2; n; n--) {
|
||||
xchar x = rn1(COLNO-4,3);
|
||||
xchar y = rn1(ROWNO-4,3);
|
||||
if (levl[x][y].typ == LAVAPOOL) {
|
||||
NhRegion *r = create_gas_cloud(x,y, 4+rn2(5), rn1(10,5));
|
||||
clear_heros_fault(r);
|
||||
snd = TRUE;
|
||||
if (distu(x,y) < 15) loud = TRUE;
|
||||
}
|
||||
}
|
||||
if (snd && !Deaf)
|
||||
Norep("You hear a %swhoosh!", loud ? "loud " : "");
|
||||
}
|
||||
|
||||
/*
|
||||
* Special waterlevel stuff in endgame (TH).
|
||||
*
|
||||
@@ -916,9 +927,9 @@ movebubbles()
|
||||
register int x, y, i, j;
|
||||
struct trap *btrap;
|
||||
static const struct rm water_pos =
|
||||
{ cmap_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0 };
|
||||
{ cmap_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
static const struct rm air_pos =
|
||||
{ cmap_to_glyph(S_cloud), AIR, 0, 0, 0, 1, 0, 0, 0 };
|
||||
{ cmap_to_glyph(S_cloud), AIR, 0, 0, 0, 1, 0, 0, 0, 0 };
|
||||
|
||||
/* set up the portal the first time bubbles are moved */
|
||||
if (!wportal) set_wportal();
|
||||
|
||||
+3
-3
@@ -1367,14 +1367,14 @@ NEARDATA struct permonst mons[] = {
|
||||
A(ATTK(AT_ENGL, AD_PHYS, 1, 10),
|
||||
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
|
||||
SIZ(0, 0, MS_SILENT, MZ_HUGE), MR_POISON|MR_STONE, 0,
|
||||
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_UNSOLID|M1_FLY,
|
||||
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_BREATHLESS|M1_UNSOLID|M1_FLY,
|
||||
M2_STRONG|M2_NEUTER, 0, CLR_CYAN),
|
||||
MON("fire elemental", S_ELEMENTAL,
|
||||
LVL(8, 12, 2, 30, 0), (G_NOCORPSE|1),
|
||||
A(ATTK(AT_CLAW, AD_FIRE, 3, 6), ATTK(AT_NONE, AD_FIRE, 0, 4),
|
||||
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
|
||||
SIZ(0, 0, MS_SILENT, MZ_HUGE), MR_FIRE|MR_POISON|MR_STONE, 0,
|
||||
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_UNSOLID|M1_FLY|M1_NOTAKE,
|
||||
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_BREATHLESS|M1_UNSOLID|M1_FLY|M1_NOTAKE,
|
||||
M2_STRONG|M2_NEUTER, M3_INFRAVISIBLE, CLR_YELLOW),
|
||||
MON("earth elemental", S_ELEMENTAL,
|
||||
LVL(8, 6, 2, 30, 0), (G_NOCORPSE|1),
|
||||
@@ -1390,7 +1390,7 @@ NEARDATA struct permonst mons[] = {
|
||||
A(ATTK(AT_CLAW, AD_PHYS, 5, 6),
|
||||
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
|
||||
SIZ(2500, 0, MS_SILENT, MZ_HUGE), MR_POISON|MR_STONE, 0,
|
||||
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_UNSOLID|
|
||||
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_BREATHLESS|M1_UNSOLID|
|
||||
M1_AMPHIBIOUS|M1_SWIM,
|
||||
M2_STRONG|M2_NEUTER, 0, CLR_BLUE),
|
||||
/*
|
||||
|
||||
+1
-1
@@ -753,7 +753,7 @@ char *buf;
|
||||
break;
|
||||
}
|
||||
(void) write(fd, buf, strlen(buf));
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
}
|
||||
}
|
||||
#endif /* UNIX386MUSIC */
|
||||
|
||||
+21
-1
@@ -18,6 +18,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;
|
||||
@@ -236,7 +238,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;
|
||||
@@ -245,7 +255,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 " */
|
||||
@@ -1079,6 +1089,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)
|
||||
|
||||
+267
-3
@@ -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},
|
||||
@@ -141,6 +142,7 @@ static struct Bool_Opt
|
||||
{"mail", (boolean *)0, TRUE, SET_IN_FILE},
|
||||
#endif
|
||||
{"mention_walls", &iflags.mention_walls, FALSE, SET_IN_GAME},
|
||||
{"menucolors", &iflags.use_menu_color, FALSE, SET_IN_GAME},
|
||||
/* for menu debugging only*/
|
||||
{"menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME},
|
||||
{"menu_objsyms", &iflags.menu_head_objsym, FALSE, SET_IN_GAME},
|
||||
@@ -345,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
|
||||
@@ -495,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 */
|
||||
@@ -628,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;
|
||||
@@ -703,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;
|
||||
}
|
||||
|
||||
@@ -1090,6 +1125,174 @@ STATIC_VAR const struct paranoia_opts {
|
||||
{ ~0, "all", 3, 0, 0, 0 }, /* ditto */
|
||||
};
|
||||
|
||||
|
||||
extern struct menucoloring *menu_colorings;
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
const int color;
|
||||
} colornames[] = {
|
||||
{"black", CLR_BLACK},
|
||||
{"red", CLR_RED},
|
||||
{"green", CLR_GREEN},
|
||||
{"brown", CLR_BROWN},
|
||||
{"blue", CLR_BLUE},
|
||||
{"magenta", CLR_MAGENTA},
|
||||
{"cyan", CLR_CYAN},
|
||||
{"gray", CLR_GRAY},
|
||||
{"grey", CLR_GRAY},
|
||||
{"orange", CLR_ORANGE},
|
||||
{"lightgreen", CLR_BRIGHT_GREEN},
|
||||
{"yellow", CLR_YELLOW},
|
||||
{"lightblue", CLR_BRIGHT_BLUE},
|
||||
{"lightmagenta", CLR_BRIGHT_MAGENTA},
|
||||
{"lightcyan", CLR_BRIGHT_CYAN},
|
||||
{"white", CLR_WHITE}
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
const int attr;
|
||||
} attrnames[] = {
|
||||
{"none", ATR_NONE},
|
||||
{"bold", ATR_BOLD},
|
||||
{"dim", ATR_DIM},
|
||||
{"underline", ATR_ULINE},
|
||||
{"blink", ATR_BLINK},
|
||||
{"inverse", ATR_INVERSE}
|
||||
};
|
||||
|
||||
/* parse '"regex_string"=color&attr' and add it to menucoloring */
|
||||
boolean
|
||||
add_menu_coloring(str)
|
||||
char *str;
|
||||
{
|
||||
int i, c = NO_COLOR, a = ATR_NONE;
|
||||
struct menucoloring *tmp;
|
||||
char *tmps, *cs = strchr(str, '=');
|
||||
#ifdef MENU_COLOR_REGEX_POSIX
|
||||
int errnum;
|
||||
char errbuf[80];
|
||||
#endif
|
||||
const char *err = (char *)0;
|
||||
|
||||
if (!cs || !str) return FALSE;
|
||||
|
||||
tmps = cs;
|
||||
tmps++;
|
||||
while (*tmps && isspace(*tmps)) tmps++;
|
||||
|
||||
for (i = 0; i < SIZE(colornames); i++)
|
||||
if (strstri(tmps, colornames[i].name) == tmps) {
|
||||
c = colornames[i].color;
|
||||
break;
|
||||
}
|
||||
if ((i == SIZE(colornames)) && (*tmps >= '0' && *tmps <='9'))
|
||||
c = atoi(tmps);
|
||||
|
||||
if (c > 15) return FALSE;
|
||||
|
||||
tmps = strchr(str, '&');
|
||||
if (tmps) {
|
||||
tmps++;
|
||||
while (*tmps && isspace(*tmps)) tmps++;
|
||||
for (i = 0; i < SIZE(attrnames); i++)
|
||||
if (strstri(tmps, attrnames[i].name) == tmps) {
|
||||
a = attrnames[i].attr;
|
||||
break;
|
||||
}
|
||||
if ((i == SIZE(attrnames)) && (*tmps >= '0' && *tmps <='9'))
|
||||
a = atoi(tmps);
|
||||
}
|
||||
|
||||
*cs = '\0';
|
||||
tmps = str;
|
||||
if ((*tmps == '"') || (*tmps == '\'')) {
|
||||
cs--;
|
||||
while (isspace(*cs)) cs--;
|
||||
if (*cs == *tmps) {
|
||||
*cs = '\0';
|
||||
tmps++;
|
||||
}
|
||||
}
|
||||
|
||||
tmp = (struct menucoloring *)alloc(sizeof(struct menucoloring));
|
||||
#ifdef MENU_COLOR_REGEX
|
||||
#ifdef MENU_COLOR_REGEX_POSIX
|
||||
errnum = regcomp(&tmp->match, tmps, REG_EXTENDED | REG_NOSUB);
|
||||
if (errnum != 0)
|
||||
{
|
||||
regerror(errnum, &tmp->match, errbuf, sizeof(errbuf));
|
||||
err = errbuf;
|
||||
}
|
||||
#else
|
||||
tmp->match.translate = 0;
|
||||
tmp->match.fastmap = 0;
|
||||
tmp->match.buffer = 0;
|
||||
tmp->match.allocated = 0;
|
||||
tmp->match.regs_allocated = REGS_FIXED;
|
||||
err = re_compile_pattern(tmps, strlen(tmps), &tmp->match);
|
||||
#endif
|
||||
#else
|
||||
tmp->match = (char *)alloc(strlen(tmps)+1);
|
||||
(void) memcpy((genericptr_t)tmp->match, (genericptr_t)tmps, strlen(tmps)+1);
|
||||
#endif
|
||||
if (err) {
|
||||
raw_printf("\nMenucolor regex error: %s\n", err);
|
||||
wait_synch();
|
||||
free(tmp);
|
||||
return FALSE;
|
||||
} else {
|
||||
tmp->next = menu_colorings;
|
||||
tmp->color = c;
|
||||
tmp->attr = a;
|
||||
menu_colorings = tmp;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
boolean
|
||||
get_menu_coloring(str, color, attr)
|
||||
char *str;
|
||||
int *color, *attr;
|
||||
{
|
||||
struct menucoloring *tmpmc;
|
||||
if (iflags.use_menu_color)
|
||||
for (tmpmc = menu_colorings; tmpmc; tmpmc = tmpmc->next)
|
||||
#ifdef MENU_COLOR_REGEX
|
||||
# ifdef MENU_COLOR_REGEX_POSIX
|
||||
if (regexec(&tmpmc->match, str, 0, NULL, 0) == 0) {
|
||||
# else
|
||||
if (re_search(&tmpmc->match, str, strlen(str), 0, 9999, 0) >= 0) {
|
||||
# endif
|
||||
#else
|
||||
if (pmatch(tmpmc->match, str)) {
|
||||
#endif
|
||||
*color = tmpmc->color;
|
||||
*attr = tmpmc->attr;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
free_menu_coloring()
|
||||
{
|
||||
struct menucoloring *tmp = menu_colorings;
|
||||
|
||||
while (tmp) {
|
||||
struct menucoloring *tmp2 = tmp->next;
|
||||
#ifdef MENU_COLOR_REGEX
|
||||
(void) regfree(&tmp->match);
|
||||
#else
|
||||
free(tmp->match);
|
||||
#endif
|
||||
free(tmp);
|
||||
tmp = tmp2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
parseoptions(opts, tinitial, tfrom_file)
|
||||
register char *opts;
|
||||
@@ -1431,6 +1634,16 @@ boolean tinitial, tfrom_file;
|
||||
return;
|
||||
}
|
||||
|
||||
/* menucolor:"regex_string"=color */
|
||||
fullname = "menucolor";
|
||||
if (match_optname(opts, fullname, 9, TRUE)) {
|
||||
if (negated) bad_negation(fullname, FALSE);
|
||||
else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
|
||||
if (!add_menu_coloring(op))
|
||||
badoption(opts);
|
||||
return;
|
||||
}
|
||||
|
||||
fullname = "msghistory";
|
||||
if (match_optname(opts, fullname, 3, TRUE)) {
|
||||
if (duplicate) complain_about_duplicate(opts,1);
|
||||
@@ -2149,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);
|
||||
@@ -2631,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
|
||||
@@ -2641,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 ||
|
||||
@@ -2683,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.
|
||||
@@ -2970,8 +3205,10 @@ doset()
|
||||
}
|
||||
|
||||
destroy_nhwindow(tmpwin);
|
||||
if (need_redraw)
|
||||
if (need_redraw) {
|
||||
reglyph_darkroom();
|
||||
(void) doredraw();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2989,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)) {
|
||||
@@ -3170,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;
|
||||
@@ -3759,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
|
||||
|
||||
+3
-3
@@ -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)*/
|
||||
|
||||
|
||||
+16
-3
@@ -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, 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];
|
||||
@@ -810,7 +823,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
|
||||
if (n > 0) {
|
||||
menu_item *mi;
|
||||
int i, k;
|
||||
int k;
|
||||
|
||||
/* fix up counts: -1 means no count used => pick all;
|
||||
if fake_hero_object was picked, discard that choice */
|
||||
|
||||
+37
-4
@@ -27,7 +27,8 @@ STATIC_DCL void FDECL(randomize,(int *, int));
|
||||
STATIC_DCL void FDECL(forget_single_object, (int));
|
||||
STATIC_DCL void FDECL(forget, (int));
|
||||
STATIC_DCL int FDECL(maybe_tame, (struct monst *,struct obj *));
|
||||
|
||||
STATIC_DCL boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P));
|
||||
STATIC_DCL void FDECL(display_stinking_cloud_positions, (int));
|
||||
STATIC_PTR void FDECL(set_lit, (int,int,genericptr_t));
|
||||
|
||||
STATIC_OVL boolean
|
||||
@@ -868,6 +869,39 @@ struct obj *sobj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean
|
||||
is_valid_stinking_cloud_pos(x,y, showmsg)
|
||||
int x,y;
|
||||
boolean showmsg;
|
||||
{
|
||||
if (!cansee(x, y) || !ACCESSIBLE(levl[x][y].typ) || distu(x, y) >= 32) {
|
||||
if (showmsg) You("smell rotten eggs.");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
display_stinking_cloud_positions(state)
|
||||
int state;
|
||||
{
|
||||
if (state == 0) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
|
||||
} else if (state == 1) {
|
||||
int x,y, dx, dy;
|
||||
int dist = 6;
|
||||
for (dx = -dist; dx <= dist; dx++)
|
||||
for (dy = -dist; dy <= dist; dy++) {
|
||||
x = u.ux + dx;
|
||||
y = u.uy + dy;
|
||||
if (isok(x,y) && is_valid_stinking_cloud_pos(x,y, FALSE))
|
||||
tmp_at(x,y);
|
||||
}
|
||||
} else {
|
||||
tmp_at(DISP_END, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* scroll effects; return 1 if we use up the scroll and possibly make it
|
||||
become discovered, 0 if caller should take care of those side-effects */
|
||||
int
|
||||
@@ -1613,14 +1647,13 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
already_known ? "stinking " : "");
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
getpos_sethilite(display_stinking_cloud_positions);
|
||||
if (getpos(&cc, TRUE, "the desired position") < 0) {
|
||||
pline1(Never_mind);
|
||||
break;
|
||||
}
|
||||
if (!cansee(cc.x, cc.y) || distu(cc.x, cc.y) >= 32) {
|
||||
You("smell rotten eggs.");
|
||||
if (!is_valid_stinking_cloud_pos(cc.x, cc.y, TRUE))
|
||||
break;
|
||||
}
|
||||
(void) create_gas_cloud(cc.x, cc.y, 3+bcsign(sobj),
|
||||
8+4*bcsign(sobj));
|
||||
break;
|
||||
|
||||
+1
-1
@@ -996,7 +996,7 @@ int damage;
|
||||
cloud->arg = zeroany;
|
||||
cloud->arg.a_int = damage;
|
||||
cloud->visible = TRUE;
|
||||
cloud->glyph = cmap_to_glyph(S_cloud);
|
||||
cloud->glyph = cmap_to_glyph(damage ? S_poisoncloud : S_cloud);
|
||||
add_region(cloud);
|
||||
return cloud;
|
||||
}
|
||||
|
||||
+4
-4
@@ -718,7 +718,7 @@ xchar ltmp;
|
||||
|
||||
/* Remove levels and bones that may have been created.
|
||||
*/
|
||||
(void) close(nfd);
|
||||
(void) nhclose(nfd);
|
||||
# ifdef AMIGA
|
||||
clearlocks();
|
||||
# else
|
||||
@@ -767,7 +767,7 @@ register int fd;
|
||||
if (!restgamestate(fd, &stuckid, &steedid)) {
|
||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||
savelev(-1, 0, FREE_SAVE); /* discard current level */
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
restoring = FALSE;
|
||||
return(0);
|
||||
@@ -841,7 +841,7 @@ register int fd;
|
||||
get_plname_from_file(fd, plname);
|
||||
|
||||
getlev(fd, 0, (xchar)0, FALSE);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
|
||||
/* Now set the restore settings to match the
|
||||
* settings used by the save file output routines
|
||||
@@ -1558,7 +1558,7 @@ register unsigned int len;
|
||||
} else {
|
||||
pline("Read %d instead of %u bytes.", rlen, len);
|
||||
if(restoring) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
error("Error restoring old game.");
|
||||
}
|
||||
|
||||
+10
-9
@@ -162,7 +162,7 @@ dosave0()
|
||||
nh_uncompress(fq_save);
|
||||
fd = open_savefile();
|
||||
if (fd > 0) {
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
There("seems to be an old save file.");
|
||||
if (yn("Overwrite the old file?") == 'n') {
|
||||
@@ -218,7 +218,7 @@ dosave0()
|
||||
pline("Require %ld bytes but only have %ld.", needed, fds);
|
||||
}
|
||||
flushout();
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
return 0;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ dosave0()
|
||||
ofd = open_levelfile(ltmp, whynot);
|
||||
if (ofd < 0) {
|
||||
HUP pline1(whynot);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
HUP Strcpy(killer.name, whynot);
|
||||
HUP done(TRICKED);
|
||||
@@ -273,7 +273,7 @@ dosave0()
|
||||
}
|
||||
minit(); /* ZEROCOMP */
|
||||
getlev(ofd, hackpid, ltmp, FALSE);
|
||||
(void) close(ofd);
|
||||
(void) nhclose(ofd);
|
||||
bwrite(fd, (genericptr_t) <mp, sizeof ltmp); /* level number*/
|
||||
savelev(fd, ltmp, WRITE_SAVE | FREE_SAVE); /* actual level*/
|
||||
delete_levelfile(ltmp);
|
||||
@@ -404,7 +404,7 @@ savestateinlock()
|
||||
Strcpy(killer.name, whynot);
|
||||
done(TRICKED);
|
||||
}
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
|
||||
fd = create_levelfile(0, whynot);
|
||||
if (fd < 0) {
|
||||
@@ -742,7 +742,7 @@ def_bclose(fd)
|
||||
bw_FILE = 0;
|
||||
} else
|
||||
#endif
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ zerocomp_bclose(fd)
|
||||
int fd;
|
||||
{
|
||||
zerocomp_bufoff(fd);
|
||||
(void) close(fd);
|
||||
(void) nhclose(fd);
|
||||
return;
|
||||
}
|
||||
#endif /* ZEROCOMP */
|
||||
@@ -1296,6 +1296,7 @@ void
|
||||
freedynamicdata()
|
||||
{
|
||||
unload_qtlist();
|
||||
free_menu_coloring();
|
||||
free_invbuf(); /* let_to_name (invent.c) */
|
||||
free_youbuf(); /* You_buf,&c (pline.c) */
|
||||
tmp_at(DISP_FREEMEM, 0); /* temporary display effects */
|
||||
@@ -1442,8 +1443,8 @@ char *from, *to;
|
||||
if (nto != nfrom)
|
||||
panic("Copyfile failed!");
|
||||
} while (nfrom == BUFSIZ);
|
||||
(void) close(fdfrom);
|
||||
(void) close(fdto);
|
||||
(void) nhclose(fdfrom);
|
||||
(void) nhclose(fdto);
|
||||
# endif /* TOS */
|
||||
}
|
||||
|
||||
|
||||
+221
-115
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1426465441 2015/03/16 00:24:01 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.25 $ */
|
||||
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1427934549 2015/04/02 00:29:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
|
||||
/* NetHack 3.5 sp_lev.c $Date: 2011/01/05 01:28:36 $ $Revision: 1.23 $ */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "sp_lev.h"
|
||||
|
||||
typedef void (*select_iter_func)(int, int, genericptr_t);
|
||||
|
||||
extern void FDECL(mkmap, (lev_init *));
|
||||
|
||||
STATIC_DCL void FDECL(get_room_loc, (schar *, schar *, struct mkroom *));
|
||||
@@ -35,6 +37,94 @@ STATIC_DCL boolean FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P,
|
||||
XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P));
|
||||
|
||||
long FDECL(opvar_array_length, (struct sp_coder *));
|
||||
STATIC_DCL void NDECL(solidify_map);
|
||||
STATIC_DCL void FDECL(splev_stack_init, (struct splevstack *));
|
||||
STATIC_DCL void FDECL(splev_stack_done, (struct splevstack *));
|
||||
STATIC_DCL void FDECL(splev_stack_push, (struct splevstack *, struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(splev_stack_pop, (struct splevstack *));
|
||||
STATIC_DCL struct splevstack * FDECL(splev_stack_reverse, (struct splevstack *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_str, (char *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_int, (long));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_coord, (int, int));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_new_region, (int,int, int,int));
|
||||
STATIC_DCL void FDECL(opvar_free_x, (struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_clone, (struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(opvar_var_conversion, (struct sp_coder *, struct opvar *));
|
||||
STATIC_DCL struct splev_var * FDECL(opvar_var_defined, (struct sp_coder *, char *));
|
||||
STATIC_DCL struct opvar * FDECL(splev_stack_getdat, (struct sp_coder *, XCHAR_P));
|
||||
STATIC_DCL struct opvar * FDECL(splev_stack_getdat_any, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(variable_list_del, (struct splev_var *));
|
||||
STATIC_DCL void FDECL(lvlfill_maze_grid, (int,int, int,int, SCHAR_P));
|
||||
STATIC_DCL void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P));
|
||||
STATIC_DCL void NDECL(remove_boundary_syms);
|
||||
STATIC_DCL void FDECL(maybe_add_door, (int,int, struct mkroom *));
|
||||
STATIC_DCL void NDECL(link_doors_rooms);
|
||||
STATIC_DCL void NDECL(fill_rooms);
|
||||
STATIC_DCL unpacked_coord FDECL(get_unpacked_coord, (long, int));
|
||||
STATIC_DCL void FDECL(replace_terrain, (replaceterrain *, struct mkroom *));
|
||||
STATIC_DCL void FDECL(wallify_map, (int,int, int,int));
|
||||
STATIC_DCL void FDECL(splev_initlev, (lev_init *));
|
||||
STATIC_DCL struct sp_frame * FDECL(frame_new, (long));
|
||||
STATIC_DCL void FDECL(frame_del, (struct sp_frame *));
|
||||
STATIC_DCL void FDECL(spo_frame_push, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_frame_pop, (struct sp_coder *));
|
||||
STATIC_DCL long FDECL(sp_code_jmpaddr, (long, long));
|
||||
STATIC_DCL void FDECL(spo_call, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_return, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_end_moninvent, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_pop_container, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_message, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_monster, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_object, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_level_flags, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_initlevel, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_engraving, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_mineralize, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_room, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_endroom, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_stair, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_ladder, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_grave, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_altar, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_trap, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_gold, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_corridor, (struct sp_coder *));
|
||||
STATIC_DCL struct opvar * FDECL(selection_opvar, (char *));
|
||||
STATIC_DCL xchar FDECL(selection_getpoint, (int,int, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_setpoint, (int,int, struct opvar *, XCHAR_P));
|
||||
STATIC_DCL struct opvar * FDECL(selection_not, (struct opvar *));
|
||||
STATIC_DCL struct opvar * FDECL(selection_logical_oper, (struct opvar *, struct opvar *, CHAR_P));
|
||||
STATIC_DCL struct opvar * FDECL(selection_filter_mapchar, (struct opvar *, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_filter_percent, (struct opvar *, int));
|
||||
STATIC_DCL int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *));
|
||||
STATIC_DCL void FDECL(selection_do_grow, (struct opvar *, int));
|
||||
STATIC_DCL void FDECL(selection_floodfill, (struct opvar *, int,int));
|
||||
STATIC_DCL void FDECL(selection_do_ellipse, (struct opvar *, int,int, int,int, int));
|
||||
STATIC_DCL long FDECL(line_dist_coord, (long,long, long,long, long,long));
|
||||
STATIC_DCL void FDECL(selection_do_gradient, (struct opvar *, long,long, long,long, long,long,long,long));
|
||||
STATIC_DCL void FDECL(selection_do_line, (SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_do_randline, (SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, struct opvar *));
|
||||
STATIC_DCL void FDECL(selection_iterate, (struct opvar *, select_iter_func, genericptr_t));
|
||||
STATIC_DCL void FDECL(sel_set_ter, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(sel_set_feature, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(sel_set_door, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(spo_door, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_feature, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_terrain, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_replace_terrain, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_levregion, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_region, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_drawbridge, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_mazewalk, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_wall_property, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_room_door, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(sel_set_wallify, (int,int, genericptr_t));
|
||||
STATIC_DCL void FDECL(spo_wallify, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_map, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_jmp, (struct sp_coder *, sp_lev *));
|
||||
STATIC_DCL void FDECL(spo_conditional_jump, (struct sp_coder *, sp_lev *));
|
||||
STATIC_DCL void FDECL(spo_var_init, (struct sp_coder *));
|
||||
STATIC_DCL void FDECL(spo_shuffle_array, (struct sp_coder *));
|
||||
|
||||
#define LEFT 1
|
||||
#define H_LEFT 2
|
||||
@@ -430,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,10 +612,9 @@ remove_boundary_syms()
|
||||
|
||||
|
||||
void
|
||||
maybe_add_door(x,y, droom, i,s)
|
||||
maybe_add_door(x,y, droom)
|
||||
int x,y;
|
||||
struct mkroom *droom;
|
||||
int i,s;
|
||||
{
|
||||
if (droom->hx >= 0 && doorindex < DOORMAX && inside_room(droom, x,y))
|
||||
add_door(x, y, droom);
|
||||
@@ -541,9 +629,9 @@ link_doors_rooms()
|
||||
for (x = 0; x < COLNO; x++)
|
||||
if (IS_DOOR(levl[x][y].typ) || levl[x][y].typ == SDOOR) {
|
||||
for (tmpi = 0; tmpi < nroom; tmpi++) {
|
||||
maybe_add_door(x,y, &rooms[tmpi], tmpi,-1);
|
||||
maybe_add_door(x,y, &rooms[tmpi]);
|
||||
for (m = 0; m < rooms[tmpi].nsubrooms; m++) {
|
||||
maybe_add_door(x,y, rooms[tmpi].sbrooms[m], tmpi,m);
|
||||
maybe_add_door(x,y, rooms[tmpi].sbrooms[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1581,24 +1669,28 @@ struct mkroom *croom;
|
||||
if (!container_idx) {
|
||||
if (!invent_carrying_monster) {
|
||||
/*impossible("create_object: no container");*/
|
||||
/* don't complain, the monster may be gone legally (eg. unique demon already generated)
|
||||
TODO: In the case of unique demon lords, they should get their inventories even when
|
||||
they get generated outside the des-file. Maybe another data file that determines what
|
||||
inventories monsters get by default?
|
||||
/* don't complain, the monster may be gone legally
|
||||
(eg. unique demon already generated)
|
||||
TODO: In the case of unique demon lords, they should
|
||||
get their inventories even when they get generated
|
||||
outside the des-file. Maybe another data file that
|
||||
determines what inventories monsters get by default?
|
||||
*/
|
||||
} else {
|
||||
int c;
|
||||
int ci;
|
||||
struct obj *objcheck = otmp;
|
||||
int inuse = -1;
|
||||
for (c = 0; c < container_idx; c++)
|
||||
if (container_obj[c] == objcheck)
|
||||
inuse = c;
|
||||
|
||||
for (ci = 0; ci < container_idx; ci++)
|
||||
if (container_obj[ci] == objcheck)
|
||||
inuse = ci;
|
||||
remove_object(otmp);
|
||||
if (mpickobj(invent_carrying_monster, otmp)) {
|
||||
if (inuse > -1) {
|
||||
impossible("container given to monster was merged or deallocated.");
|
||||
for (c = inuse; c < container_idx-1; c++)
|
||||
container_obj[c] = container_obj[c+1];
|
||||
impossible(
|
||||
"container given to monster was merged or deallocated.");
|
||||
for (ci = inuse; ci < container_idx - 1; ci++)
|
||||
container_obj[ci] = container_obj[ci + 1];
|
||||
container_obj[container_idx] = NULL;
|
||||
container_idx--;
|
||||
}
|
||||
@@ -2490,6 +2582,7 @@ spo_return(coder)
|
||||
opvar_free(params);
|
||||
}
|
||||
|
||||
/*ARGUSED*/
|
||||
void
|
||||
spo_end_moninvent(coder)
|
||||
struct sp_coder *coder;
|
||||
@@ -2499,6 +2592,7 @@ spo_end_moninvent(coder)
|
||||
invent_carrying_monster = NULL;
|
||||
}
|
||||
|
||||
/*ARGUSED*/
|
||||
void
|
||||
spo_pop_container(coder)
|
||||
struct sp_coder *coder;
|
||||
@@ -2543,7 +2637,7 @@ spo_monster(coder)
|
||||
int nparams = 0;
|
||||
|
||||
struct opvar *varparam;
|
||||
struct opvar *id, *coord, *has_inv;
|
||||
struct opvar *id, *mcoord, *has_inv;
|
||||
monster tmpmons;
|
||||
|
||||
tmpmons.peaceful = -1;
|
||||
@@ -2660,13 +2754,13 @@ spo_monster(coder)
|
||||
}
|
||||
}
|
||||
|
||||
if (!OV_pop_c(coord)) panic("no monster coord?");
|
||||
if (!OV_pop_c(mcoord)) panic("no monster coord?");
|
||||
|
||||
if (!OV_pop_typ(id, SPOVAR_MONST)) panic("no mon type");
|
||||
|
||||
tmpmons.id = SP_MONST_PM(OV_i(id));
|
||||
tmpmons.class = SP_MONST_CLASS(OV_i(id));
|
||||
tmpmons.coord = OV_i(coord);
|
||||
tmpmons.coord = OV_i(mcoord);
|
||||
tmpmons.has_invent = OV_i(has_inv);
|
||||
|
||||
create_monster(&tmpmons, coder->croom);
|
||||
@@ -2675,7 +2769,7 @@ spo_monster(coder)
|
||||
Free(tmpmons.appear_as.str);
|
||||
|
||||
opvar_free(id);
|
||||
opvar_free(coord);
|
||||
opvar_free(mcoord);
|
||||
opvar_free(has_inv);
|
||||
opvar_free(varparam);
|
||||
}
|
||||
@@ -2837,22 +2931,23 @@ spo_level_flags(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *flagdata;
|
||||
long flags;
|
||||
long lflags;
|
||||
|
||||
if (!OV_pop_i(flagdata)) return;
|
||||
flags = OV_i(flagdata);
|
||||
lflags = OV_i(flagdata);
|
||||
|
||||
if (flags & NOTELEPORT) level.flags.noteleport = 1;
|
||||
if (flags & HARDFLOOR) level.flags.hardfloor = 1;
|
||||
if (flags & NOMMAP) level.flags.nommap = 1;
|
||||
if (flags & SHORTSIGHTED) level.flags.shortsighted = 1;
|
||||
if (flags & ARBOREAL) level.flags.arboreal = 1;
|
||||
if (flags & MAZELEVEL) level.flags.is_maze_lev = 1;
|
||||
if (flags & PREMAPPED) coder->premapped = TRUE;
|
||||
if (flags & SHROUD) level.flags.hero_memory = 0;
|
||||
if (flags & GRAVEYARD) level.flags.graveyard = 1;
|
||||
if (flags & ICEDPOOLS) icedpools = TRUE;
|
||||
if (flags & SOLIDIFY) coder->solidify = TRUE;
|
||||
if (lflags & NOTELEPORT) level.flags.noteleport = 1;
|
||||
if (lflags & HARDFLOOR) level.flags.hardfloor = 1;
|
||||
if (lflags & NOMMAP) level.flags.nommap = 1;
|
||||
if (lflags & SHORTSIGHTED) level.flags.shortsighted = 1;
|
||||
if (lflags & ARBOREAL) level.flags.arboreal = 1;
|
||||
if (lflags & MAZELEVEL) level.flags.is_maze_lev = 1;
|
||||
if (lflags & PREMAPPED) coder->premapped = TRUE;
|
||||
if (lflags & SHROUD) level.flags.hero_memory = 0;
|
||||
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);
|
||||
}
|
||||
@@ -2902,19 +2997,19 @@ void
|
||||
spo_engraving(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *etyp, *txt, *coord;
|
||||
struct opvar *etyp, *txt, *ecoord;
|
||||
xchar x,y;
|
||||
|
||||
if (!OV_pop_i(etyp) ||
|
||||
!OV_pop_s(txt) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(ecoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(ecoord));
|
||||
make_engr_at(x, y, OV_s(txt), 0L, OV_i(etyp));
|
||||
|
||||
opvar_free(etyp);
|
||||
opvar_free(txt);
|
||||
opvar_free(coord);
|
||||
opvar_free(ecoord);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2940,10 +3035,10 @@ void
|
||||
spo_room(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
if (coder->n_subroom > MAX_NESTED_ROOMS)
|
||||
if (coder->n_subroom > MAX_NESTED_ROOMS) {
|
||||
panic("Too deeply nested rooms?!");
|
||||
else {
|
||||
struct opvar *flags, *h, *w, *yalign, *xalign,
|
||||
} else {
|
||||
struct opvar *rflags, *h, *w, *yalign, *xalign,
|
||||
*y, *x, *rlit, *chance, *rtype;
|
||||
|
||||
room tmproom;
|
||||
@@ -2955,7 +3050,7 @@ spo_room(coder)
|
||||
!OV_pop_i(x) ||
|
||||
!OV_pop_i(yalign) ||
|
||||
!OV_pop_i(xalign) ||
|
||||
!OV_pop_i(flags) ||
|
||||
!OV_pop_i(rflags) ||
|
||||
!OV_pop_i(rlit) ||
|
||||
!OV_pop_i(chance) ||
|
||||
!OV_pop_i(rtype)) return;
|
||||
@@ -2970,9 +3065,9 @@ spo_room(coder)
|
||||
tmproom.rtype = OV_i(rtype);
|
||||
tmproom.chance = OV_i(chance);
|
||||
tmproom.rlit = OV_i(rlit);
|
||||
tmproom.filled = (OV_i(flags) & (1 << 0));
|
||||
/*tmproom.irregular = (OV_i(flags) & (1 << 1));*/
|
||||
tmproom.joined = !(OV_i(flags) & (1 << 2));
|
||||
tmproom.filled = (OV_i(rflags) & (1 << 0));
|
||||
/*tmproom.irregular = (OV_i(rflags) & (1 << 1));*/
|
||||
tmproom.joined = !(OV_i(rflags) & (1 << 2));
|
||||
|
||||
opvar_free(x);
|
||||
opvar_free(y);
|
||||
@@ -2983,7 +3078,7 @@ spo_room(coder)
|
||||
opvar_free(rtype);
|
||||
opvar_free(chance);
|
||||
opvar_free(rlit);
|
||||
opvar_free(flags);
|
||||
opvar_free(rflags);
|
||||
|
||||
if (!coder->failed_room[coder->n_subroom-1]) {
|
||||
tmpcr = build_room(&tmproom, coder->croom);
|
||||
@@ -3028,18 +3123,18 @@ spo_stair(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *up, *coord;
|
||||
struct opvar *up, *scoord;
|
||||
struct trap *badtrap;
|
||||
|
||||
if (!OV_pop_i(up) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(scoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(scoord));
|
||||
if ((badtrap = t_at(x,y)) != 0) deltrap(badtrap);
|
||||
mkstairs(x, y, (char)OV_i(up), coder->croom);
|
||||
SpLev_Map[x][y] = 1;
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(scoord);
|
||||
opvar_free(up);
|
||||
}
|
||||
|
||||
@@ -3048,12 +3143,12 @@ spo_ladder(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *up, *coord;
|
||||
struct opvar *up, *lcoord;
|
||||
|
||||
if (!OV_pop_i(up) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(lcoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(lcoord));
|
||||
|
||||
levl[x][y].typ = LADDER;
|
||||
SpLev_Map[x][y] = 1;
|
||||
@@ -3064,7 +3159,7 @@ spo_ladder(coder)
|
||||
xdnladder = x; ydnladder = y;
|
||||
levl[x][y].ladder = LA_DOWN;
|
||||
}
|
||||
opvar_free(coord);
|
||||
opvar_free(lcoord);
|
||||
opvar_free(up);
|
||||
}
|
||||
|
||||
@@ -3072,13 +3167,13 @@ void
|
||||
spo_grave(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *coord, *typ, *txt;
|
||||
struct opvar *gcoord, *typ, *txt;
|
||||
schar x,y;
|
||||
if (!OV_pop_i(typ) ||
|
||||
!OV_pop_s(txt) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(gcoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord));
|
||||
|
||||
if (isok(x, y) && !t_at(x, y)) {
|
||||
levl[x][y].typ = GRAVE;
|
||||
@@ -3089,7 +3184,7 @@ spo_grave(coder)
|
||||
}
|
||||
}
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(gcoord);
|
||||
opvar_free(typ);
|
||||
opvar_free(txt);
|
||||
}
|
||||
@@ -3098,20 +3193,20 @@ void
|
||||
spo_altar(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *al, *shrine, *coord;
|
||||
struct opvar *al, *shrine, *acoord;
|
||||
altar tmpaltar;
|
||||
|
||||
if (!OV_pop_i(al) ||
|
||||
!OV_pop_i(shrine) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(acoord)) return;
|
||||
|
||||
tmpaltar.coord = OV_i(coord);
|
||||
tmpaltar.coord = OV_i(acoord);
|
||||
tmpaltar.align = OV_i(al);
|
||||
tmpaltar.shrine = OV_i(shrine);
|
||||
|
||||
create_altar(&tmpaltar, coder->croom);
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(acoord);
|
||||
opvar_free(shrine);
|
||||
opvar_free(al);
|
||||
}
|
||||
@@ -3121,17 +3216,17 @@ spo_trap(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *type;
|
||||
struct opvar *coord;
|
||||
struct opvar *tcoord;
|
||||
trap tmptrap;
|
||||
|
||||
if (!OV_pop_i(type) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(tcoord)) return;
|
||||
|
||||
tmptrap.coord = OV_i(coord);
|
||||
tmptrap.coord = OV_i(tcoord);
|
||||
tmptrap.type = OV_i(type);
|
||||
|
||||
create_trap(&tmptrap, coder->croom);
|
||||
opvar_free(coord);
|
||||
opvar_free(tcoord);
|
||||
opvar_free(type);
|
||||
}
|
||||
|
||||
@@ -3139,15 +3234,16 @@ void
|
||||
spo_gold(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *coord, *amt;
|
||||
struct opvar *gcoord, *amt;
|
||||
schar x,y;
|
||||
long amount;
|
||||
if (!OV_pop_c(coord) || !OV_pop_i(amt)) return;
|
||||
|
||||
if (!OV_pop_c(gcoord) || !OV_pop_i(amt)) return;
|
||||
amount = OV_i(amt);
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord));
|
||||
if (amount == -1) amount = rnd(200);
|
||||
mkgold(amount, x,y);
|
||||
opvar_free(coord);
|
||||
opvar_free(gcoord);
|
||||
opvar_free(amt);
|
||||
}
|
||||
|
||||
@@ -3202,7 +3298,7 @@ selection_opvar(nbuf)
|
||||
return ov;
|
||||
}
|
||||
|
||||
char
|
||||
xchar
|
||||
selection_getpoint(x,y,ov)
|
||||
int x,y;
|
||||
struct opvar *ov;
|
||||
@@ -3217,12 +3313,12 @@ void
|
||||
selection_setpoint(x,y,ov, c)
|
||||
int x,y;
|
||||
struct opvar *ov;
|
||||
char c;
|
||||
xchar c;
|
||||
{
|
||||
if (!ov || ov->spovartyp != SPOVAR_SEL) return;
|
||||
if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) return;
|
||||
|
||||
ov->vardata.str[COLNO*y + x] = (c + 1);
|
||||
ov->vardata.str[COLNO*y + x] = (char)(c + 1);
|
||||
}
|
||||
|
||||
struct opvar *
|
||||
@@ -3476,16 +3572,16 @@ line_dist_coord(x1,y1, x2,y2, x3,y3)
|
||||
long py = y2-y1;
|
||||
long s = px*px + py*py;
|
||||
long x, y, dx, dy, dist = 0;
|
||||
float u = 0;
|
||||
float lu = 0;
|
||||
|
||||
if (x1 == x2 && y1 == y2) return isqrt(dist2(x1,y1, x3,y3));
|
||||
|
||||
u = ((x3 - x1) * px + (y3 - y1) * py) / (float)s;
|
||||
if (u > 1) u = 1;
|
||||
else if (u < 0) u = 0;
|
||||
lu = ((x3 - x1) * px + (y3 - y1) * py) / (float)s;
|
||||
if (lu > 1) lu = 1;
|
||||
else if (lu < 0) lu = 0;
|
||||
|
||||
x = x1 + u * px;
|
||||
y = y1 + u * py;
|
||||
x = x1 + lu * px;
|
||||
y = y1 + lu * py;
|
||||
dx = x - x3;
|
||||
dy = y - y3;
|
||||
dist = isqrt(dx*dx + dy*dy);
|
||||
@@ -3642,7 +3738,7 @@ selection_do_randline(x1,y1,x2,y2,rough, rec, ov)
|
||||
void
|
||||
selection_iterate(ov, func, arg)
|
||||
struct opvar *ov;
|
||||
void FDECL((*func), (int,int,genericptr_t));
|
||||
select_iter_func func;
|
||||
genericptr_t arg;
|
||||
{
|
||||
int x,y;
|
||||
@@ -3878,19 +3974,19 @@ void
|
||||
spo_region(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
struct opvar *rtype, *rlit, *flags, *area;
|
||||
struct opvar *rtype, *rlit, *rflags, *area;
|
||||
xchar dx1,dy1,dx2,dy2;
|
||||
register struct mkroom *troom;
|
||||
boolean prefilled, room_not_needed, irregular, joined;
|
||||
|
||||
if (!OV_pop_i(flags) ||
|
||||
if (!OV_pop_i(rflags) ||
|
||||
!OV_pop_i(rtype) ||
|
||||
!OV_pop_i(rlit) ||
|
||||
!OV_pop_r(area)) return;
|
||||
|
||||
prefilled = !(OV_i(flags) & (1 << 0));
|
||||
irregular = (OV_i(flags) & (1 << 1));
|
||||
joined = !(OV_i(flags) & (1 << 2));
|
||||
prefilled = !(OV_i(rflags) & (1 << 0));
|
||||
irregular = (OV_i(rflags) & (1 << 1));
|
||||
joined = !(OV_i(rflags) & (1 << 2));
|
||||
|
||||
if(OV_i(rtype) > MAXRTYPE) {
|
||||
OV_i(rtype) -= MAXRTYPE+1;
|
||||
@@ -3927,7 +4023,7 @@ spo_region(coder)
|
||||
light_region(&tmpregion);
|
||||
|
||||
opvar_free(area);
|
||||
opvar_free(flags);
|
||||
opvar_free(rflags);
|
||||
opvar_free(rlit);
|
||||
opvar_free(rtype);
|
||||
|
||||
@@ -3973,7 +4069,7 @@ spo_region(coder)
|
||||
}
|
||||
|
||||
opvar_free(area);
|
||||
opvar_free(flags);
|
||||
opvar_free(rflags);
|
||||
opvar_free(rlit);
|
||||
opvar_free(rtype);
|
||||
}
|
||||
@@ -3983,18 +4079,18 @@ spo_drawbridge(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *dir, *db_open, *coord;
|
||||
struct opvar *dir, *db_open, *dcoord;
|
||||
|
||||
if (!OV_pop_i(dir) ||
|
||||
!OV_pop_i(db_open) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(dcoord)) return;
|
||||
|
||||
get_location_coord(&x, &y, DRY|WET|HOT, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, DRY|WET|HOT, coder->croom, OV_i(dcoord));
|
||||
if (!create_drawbridge(x, y, OV_i(dir), OV_i(db_open)))
|
||||
impossible("Cannot create drawbridge.");
|
||||
SpLev_Map[x][y] = 1;
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(dcoord);
|
||||
opvar_free(db_open);
|
||||
opvar_free(dir);
|
||||
}
|
||||
@@ -4004,25 +4100,21 @@ spo_mazewalk(coder)
|
||||
struct sp_coder *coder;
|
||||
{
|
||||
xchar x,y;
|
||||
struct opvar *ftyp, *fstocked,*fdir, *coord;
|
||||
struct opvar *ftyp, *fstocked,*fdir, *mcoord;
|
||||
int dir;
|
||||
|
||||
if (!OV_pop_i(ftyp) ||
|
||||
!OV_pop_i(fstocked) ||
|
||||
!OV_pop_i(fdir) ||
|
||||
!OV_pop_c(coord)) return;
|
||||
!OV_pop_c(mcoord)) return;
|
||||
|
||||
dir = OV_i(fdir);
|
||||
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(mcoord));
|
||||
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. */
|
||||
@@ -4066,7 +4158,7 @@ spo_mazewalk(coder)
|
||||
walkfrom(x, y, OV_i(ftyp));
|
||||
if (OV_i(fstocked)) fill_empty_maze();
|
||||
|
||||
opvar_free(coord);
|
||||
opvar_free(mcoord);
|
||||
opvar_free(fdir);
|
||||
opvar_free(fstocked);
|
||||
opvar_free(ftyp);
|
||||
@@ -4121,6 +4213,7 @@ spo_room_door(coder)
|
||||
opvar_free(pos);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
sel_set_wallify(x,y,arg)
|
||||
int x, y;
|
||||
@@ -4833,7 +4926,7 @@ sp_lev *lvl;
|
||||
{
|
||||
struct opvar *sel1, *sel2, *pt;
|
||||
if (!OV_pop_typ(sel1, SPOVAR_SEL)) panic("no sel1 for add");
|
||||
if (!OV_pop_typ(sel2, SPOVAR_SEL)) panic("no sel1 for add");
|
||||
if (!OV_pop_typ(sel2, SPOVAR_SEL)) panic("no sel2 for add");
|
||||
pt = selection_logical_oper(sel1, sel2, '|');
|
||||
opvar_free(sel1);
|
||||
opvar_free(sel2);
|
||||
@@ -4941,7 +5034,8 @@ sp_lev *lvl;
|
||||
{
|
||||
struct opvar *tmp = NULL, *tmp2 = NULL, *pt = selection_opvar(NULL);
|
||||
schar x1,y1,x2,y2;
|
||||
if (!OV_pop_c(tmp) || !OV_pop_c(tmp2)) panic("no ter sel linecoord");
|
||||
if (!OV_pop_c(tmp)) panic("no ter sel linecoord1");
|
||||
if (!OV_pop_c(tmp2)) panic("no ter sel linecoord2");
|
||||
get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2));
|
||||
x1 = (x1 < 0) ? 0 : x1;
|
||||
@@ -4958,7 +5052,9 @@ sp_lev *lvl;
|
||||
{
|
||||
struct opvar *tmp = NULL, *tmp2 = NULL, *tmp3, *pt = selection_opvar(NULL);
|
||||
schar x1,y1,x2,y2;
|
||||
if (!OV_pop_i(tmp3) || !OV_pop_c(tmp) || !OV_pop_c(tmp2)) panic("no ter sel randline");
|
||||
if (!OV_pop_i(tmp3)) panic("no ter sel randline1");
|
||||
if (!OV_pop_c(tmp)) panic("no ter sel randline2");
|
||||
if (!OV_pop_c(tmp2)) panic("no ter sel randline3");
|
||||
get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2));
|
||||
x1 = (x1 < 0) ? 0 : x1;
|
||||
@@ -5029,25 +5125,28 @@ sp_lev *lvl;
|
||||
break;
|
||||
case SPO_SEL_GRADIENT:
|
||||
{
|
||||
struct opvar *gtyp, *glim, *mind, *maxd, *coord, *coord2;
|
||||
struct opvar *gtyp, *glim, *mind, *maxd, *gcoord, *coord2;
|
||||
struct opvar *sel;
|
||||
schar x,y, x2,y2;
|
||||
if (!OV_pop_i(gtyp)) panic("no gtyp for grad");
|
||||
if (!OV_pop_i(glim)) panic("no glim for grad");
|
||||
if (!OV_pop_c(coord2)) panic("no coord2 for grad");
|
||||
if (!OV_pop_c(coord)) panic("no coord for grad");
|
||||
if (!OV_pop_c(gcoord)) panic("no coord for grad");
|
||||
if (!OV_pop_i(maxd)) panic("no maxd for grad");
|
||||
if (!OV_pop_i(mind)) panic("no mind for grad");
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(coord));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(coord2));
|
||||
get_location_coord(&x, &y, ANY_LOC, coder->croom,
|
||||
OV_i(gcoord));
|
||||
get_location_coord(&x2, &y2, ANY_LOC, coder->croom,
|
||||
OV_i(coord2));
|
||||
|
||||
sel = selection_opvar(NULL);
|
||||
selection_do_gradient(sel, x,y, x2,y2, OV_i(gtyp), OV_i(mind), OV_i(maxd), OV_i(glim));
|
||||
selection_do_gradient(sel, x,y, x2,y2, OV_i(gtyp),
|
||||
OV_i(mind), OV_i(maxd), OV_i(glim));
|
||||
splev_stack_push(coder->stack, sel);
|
||||
|
||||
opvar_free(gtyp);
|
||||
opvar_free(glim);
|
||||
opvar_free(coord);
|
||||
opvar_free(gcoord);
|
||||
opvar_free(coord2);
|
||||
opvar_free(maxd);
|
||||
opvar_free(mind);
|
||||
@@ -5064,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();
|
||||
|
||||
|
||||
+3
-2
@@ -353,8 +353,9 @@ encodexlogflags()
|
||||
{
|
||||
long e = 0L;
|
||||
|
||||
if (wizard) e |= 1L << 0;
|
||||
if (discover) e |= 1L << 1;
|
||||
if (wizard) e |= 1L << 0;
|
||||
if (discover) e |= 1L << 1;
|
||||
if (!u.uroleplay.numbones) e |= 1L << 2;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 trap.c $NHDT-Date: 1427331767 2015/03/26 01:02:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.199 $ */
|
||||
/* NetHack 3.5 trap.c $NHDT-Date: 1427934551 2015/04/02 00:29:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.223 $ */
|
||||
/* NetHack 3.5 trap.c $Date: 2013/03/14 01:58:21 $ $Revision: 1.179 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -3169,7 +3169,6 @@ struct obj *obj;
|
||||
const char *ostr;
|
||||
boolean force;
|
||||
{
|
||||
boolean exploded = FALSE;
|
||||
if (!obj) return ER_NOTHING;
|
||||
|
||||
if (snuff_lit(obj))
|
||||
|
||||
Reference in New Issue
Block a user