<Someone> wrote:
> The new ^V wizmode menu is nice, but it is rather misleading; most of > the levels it lists are "you can't get there from here". Would it be > possible either to make it only list levels that can be reached > directly, or alternatively to allow you to reach the ones you > ordinarily couldn't (maybe by forcefully changing u.uz.dnum to yoink > you into the right branch, and even summarily issuing you with an > Amulet if you ask to teleport to the endgame).[...]; being able to bamf > quickly to Minetown from DL 1, for example, would be damn useful in > testing stuff. Allow fairly free roaming of the dungeon via the wizard mode teleport menu.
This commit is contained in:
@@ -507,7 +507,7 @@ E boolean FDECL(Invocation_lev, (d_level *));
|
|||||||
E xchar NDECL(level_difficulty);
|
E xchar NDECL(level_difficulty);
|
||||||
E schar FDECL(lev_by_name, (const char *));
|
E schar FDECL(lev_by_name, (const char *));
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
E schar FDECL(print_dungeon, (BOOLEAN_P));
|
E schar FDECL(print_dungeon, (BOOLEAN_P,schar *,xchar *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ### eat.c ### */
|
/* ### eat.c ### */
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ wiz_genesis()
|
|||||||
STATIC_PTR int
|
STATIC_PTR int
|
||||||
wiz_where()
|
wiz_where()
|
||||||
{
|
{
|
||||||
if (wizard) (void) print_dungeon(FALSE);
|
if (wizard) (void) print_dungeon(FALSE, (schar *)0, (xchar *)0);
|
||||||
else pline("Unavailable command '^O'.");
|
else pline("Unavailable command '^O'.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ int n_dgns; /* number of dungeons (used here, */
|
|||||||
/* and mklev.c) */
|
/* and mklev.c) */
|
||||||
static branch *branches = (branch *) 0; /* dungeon branch list */
|
static branch *branches = (branch *) 0; /* dungeon branch list */
|
||||||
|
|
||||||
|
struct lchoice {
|
||||||
|
int idx;
|
||||||
|
schar lev[MAXLINFO];
|
||||||
|
schar playerlev[MAXLINFO];
|
||||||
|
xchar dgn[MAXLINFO];
|
||||||
|
char menuletter;
|
||||||
|
};
|
||||||
|
|
||||||
static void FDECL(Fread, (genericptr_t, int, int, dlb *));
|
static void FDECL(Fread, (genericptr_t, int, int, dlb *));
|
||||||
STATIC_DCL xchar FDECL(dname_to_dnum, (const char *));
|
STATIC_DCL xchar FDECL(dname_to_dnum, (const char *));
|
||||||
STATIC_DCL int FDECL(find_branch, (const char *, struct proto_dungeon *));
|
STATIC_DCL int FDECL(find_branch, (const char *, struct proto_dungeon *));
|
||||||
@@ -42,7 +50,7 @@ STATIC_DCL xchar FDECL(pick_level, (boolean *, int));
|
|||||||
STATIC_DCL boolean FDECL(place_level, (int, struct proto_dungeon *));
|
STATIC_DCL boolean FDECL(place_level, (int, struct proto_dungeon *));
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
STATIC_DCL const char *FDECL(br_string, (int));
|
STATIC_DCL const char *FDECL(br_string, (int));
|
||||||
STATIC_DCL void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P, char *));
|
STATIC_DCL void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P, struct lchoice *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -1515,13 +1523,13 @@ br_string(type)
|
|||||||
|
|
||||||
/* Print all child branches between the lower and upper bounds. */
|
/* Print all child branches between the lower and upper bounds. */
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
print_branch(win, dnum, lower_bound, upper_bound, bymenu, menuletter)
|
print_branch(win, dnum, lower_bound, upper_bound, bymenu, lchoices)
|
||||||
winid win;
|
winid win;
|
||||||
int dnum;
|
int dnum;
|
||||||
int lower_bound;
|
int lower_bound;
|
||||||
int upper_bound;
|
int upper_bound;
|
||||||
boolean bymenu;
|
boolean bymenu;
|
||||||
char *menuletter;
|
struct lchoice *lchoices;
|
||||||
{
|
{
|
||||||
branch *br;
|
branch *br;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
@@ -1536,14 +1544,16 @@ print_branch(win, dnum, lower_bound, upper_bound, bymenu, menuletter)
|
|||||||
dungeons[br->end2.dnum].dname,
|
dungeons[br->end2.dnum].dname,
|
||||||
depth(&br->end1));
|
depth(&br->end1));
|
||||||
if (bymenu) {
|
if (bymenu) {
|
||||||
schar lev = depth(&br->end1);
|
lchoices->lev[lchoices->idx] = br->end1.dlevel;
|
||||||
|
lchoices->dgn[lchoices->idx] = br->end1.dnum;
|
||||||
|
lchoices->playerlev[lchoices->idx] = depth(&br->end1);
|
||||||
any.a_void = 0;
|
any.a_void = 0;
|
||||||
if (lev >= 0) any.a_schar = lev + 1;
|
any.a_int = lchoices->idx + 1;
|
||||||
else any.a_schar = lev;
|
add_menu(win, NO_GLYPH, &any, lchoices->menuletter,
|
||||||
add_menu(win, NO_GLYPH, &any, *menuletter,
|
|
||||||
0, ATR_NONE, buf, MENU_UNSELECTED);
|
0, ATR_NONE, buf, MENU_UNSELECTED);
|
||||||
if (*menuletter == 'z') *menuletter = 'A';
|
if (lchoices->menuletter == 'z') lchoices->menuletter = 'A';
|
||||||
else *menuletter += 1;
|
else lchoices->menuletter++;
|
||||||
|
lchoices->idx++;
|
||||||
} else
|
} else
|
||||||
putstr(win, 0, buf);
|
putstr(win, 0, buf);
|
||||||
}
|
}
|
||||||
@@ -1551,9 +1561,11 @@ print_branch(win, dnum, lower_bound, upper_bound, bymenu, menuletter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Print available dungeon information. */
|
/* Print available dungeon information. */
|
||||||
schar
|
boolean
|
||||||
print_dungeon(bymenu)
|
print_dungeon(bymenu, rlev, rdgn)
|
||||||
boolean bymenu;
|
boolean bymenu;
|
||||||
|
schar *rlev;
|
||||||
|
xchar *rdgn;
|
||||||
{
|
{
|
||||||
int i, last_level, nlev;
|
int i, last_level, nlev;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
@@ -1561,13 +1573,14 @@ boolean bymenu;
|
|||||||
s_level *slev;
|
s_level *slev;
|
||||||
dungeon *dptr;
|
dungeon *dptr;
|
||||||
branch *br;
|
branch *br;
|
||||||
|
|
||||||
anything any;
|
anything any;
|
||||||
char mlet;
|
struct lchoice lchoices;
|
||||||
|
|
||||||
winid win = create_nhwindow(NHW_MENU);
|
winid win = create_nhwindow(NHW_MENU);
|
||||||
if (bymenu) {
|
if (bymenu) {
|
||||||
start_menu(win);
|
start_menu(win);
|
||||||
mlet = 'a';
|
lchoices.idx = 0;
|
||||||
|
lchoices.menuletter = 'a';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, dptr = dungeons; i < n_dgns; i++, dptr++) {
|
for (i = 0, dptr = dungeons; i < n_dgns; i++, dptr++) {
|
||||||
@@ -1600,37 +1613,42 @@ boolean bymenu;
|
|||||||
if (slev->dlevel.dnum != i) continue;
|
if (slev->dlevel.dnum != i) continue;
|
||||||
|
|
||||||
/* print any branches before this level */
|
/* print any branches before this level */
|
||||||
print_branch(win, i, last_level, slev->dlevel.dlevel, bymenu, &mlet);
|
print_branch(win, i, last_level, slev->dlevel.dlevel, bymenu, &lchoices);
|
||||||
|
|
||||||
Sprintf(buf, " %s: %d", slev->proto, depth(&slev->dlevel));
|
Sprintf(buf, " %s: %d", slev->proto, depth(&slev->dlevel));
|
||||||
if (Is_stronghold(&slev->dlevel))
|
if (Is_stronghold(&slev->dlevel))
|
||||||
Sprintf(eos(buf), " (tune %s)", tune);
|
Sprintf(eos(buf), " (tune %s)", tune);
|
||||||
if (bymenu) {
|
if (bymenu) {
|
||||||
schar lev = depth(&slev->dlevel);
|
/* If other floating branches are added, this will need to change */
|
||||||
|
if (i != knox_level.dnum) {
|
||||||
|
lchoices.lev[lchoices.idx] = slev->dlevel.dlevel;
|
||||||
|
lchoices.dgn[lchoices.idx] = i;
|
||||||
|
} else {
|
||||||
|
lchoices.lev[lchoices.idx] = depth(&slev->dlevel);
|
||||||
|
lchoices.dgn[lchoices.idx] = 0;
|
||||||
|
}
|
||||||
|
lchoices.playerlev[lchoices.idx] = depth(&slev->dlevel);
|
||||||
any.a_void = 0;
|
any.a_void = 0;
|
||||||
if (lev >= 0) any.a_schar = lev + 1;
|
any.a_int = lchoices.idx + 1;
|
||||||
else any.a_schar = lev;
|
add_menu(win, NO_GLYPH, &any, lchoices.menuletter,
|
||||||
add_menu(win, NO_GLYPH, &any, mlet, 0, ATR_NONE, buf, MENU_UNSELECTED);
|
0, ATR_NONE, buf, MENU_UNSELECTED);
|
||||||
if (mlet == 'z') mlet = 'A';
|
if (lchoices.menuletter == 'z') lchoices.menuletter = 'A';
|
||||||
else mlet++;
|
else lchoices.menuletter++;
|
||||||
|
lchoices.idx++;
|
||||||
} else
|
} else
|
||||||
putstr(win, 0, buf);
|
putstr(win, 0, buf);
|
||||||
|
|
||||||
last_level = slev->dlevel.dlevel;
|
last_level = slev->dlevel.dlevel;
|
||||||
}
|
}
|
||||||
/* print branches after the last special level */
|
/* print branches after the last special level */
|
||||||
print_branch(win, i, last_level, MAXLEVEL, bymenu, &mlet);
|
print_branch(win, i, last_level, MAXLEVEL, bymenu, &lchoices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print out floating branches (if any). */
|
/* Print out floating branches (if any). */
|
||||||
for (first = TRUE, br = branches; br; br = br->next) {
|
for (first = TRUE, br = branches; br; br = br->next) {
|
||||||
if (br->end1.dnum == n_dgns) {
|
if (br->end1.dnum == n_dgns) {
|
||||||
if (first) {
|
if (first) {
|
||||||
if (bymenu) {
|
if (!bymenu) {
|
||||||
any.a_void = 0;
|
|
||||||
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
|
|
||||||
"Floating branches", MENU_UNSELECTED);
|
|
||||||
} else {
|
|
||||||
putstr(win, 0, "");
|
putstr(win, 0, "");
|
||||||
putstr(win, 0, "Floating branches");
|
putstr(win, 0, "Floating branches");
|
||||||
}
|
}
|
||||||
@@ -1638,32 +1656,28 @@ boolean bymenu;
|
|||||||
}
|
}
|
||||||
Sprintf(buf, " %s to %s",
|
Sprintf(buf, " %s to %s",
|
||||||
br_string(br->type), dungeons[br->end2.dnum].dname);
|
br_string(br->type), dungeons[br->end2.dnum].dname);
|
||||||
if (bymenu) {
|
if (!bymenu)
|
||||||
schar lev = lev_by_name(dungeons[br->end2.dnum].dname);
|
|
||||||
any.a_void = 0;
|
|
||||||
if (lev >= 0) any.a_schar = lev + 1;
|
|
||||||
else any.a_schar = lev;
|
|
||||||
add_menu(win, NO_GLYPH, &any, mlet, 0, ATR_NONE, buf, MENU_UNSELECTED);
|
|
||||||
if (mlet == 'z') mlet = 'A';
|
|
||||||
else mlet++;
|
|
||||||
} else
|
|
||||||
putstr(win, 0, buf);
|
putstr(win, 0, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bymenu) {
|
if (bymenu) {
|
||||||
int n;
|
int n;
|
||||||
menu_item *selected;
|
menu_item *selected;
|
||||||
schar lev = 0;
|
int idx;
|
||||||
|
|
||||||
end_menu(win, "Level teleport to where:");
|
end_menu(win, "Level teleport to where:");
|
||||||
n = select_menu(win, PICK_ONE, &selected);
|
n = select_menu(win, PICK_ONE, &selected);
|
||||||
destroy_nhwindow(win);
|
destroy_nhwindow(win);
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
lev = selected[0].item.a_schar;
|
idx = selected[0].item.a_int - 1;
|
||||||
if (lev > 0) lev--;
|
|
||||||
free((genericptr_t)selected);
|
free((genericptr_t)selected);
|
||||||
|
if (rlev && rdgn) {
|
||||||
|
*rlev = lchoices.lev[idx];
|
||||||
|
*rdgn = lchoices.dgn[idx];
|
||||||
|
return lchoices.playerlev[idx];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return lev;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I hate searching for the invocation pos while debugging. -dean */
|
/* I hate searching for the invocation pos while debugging. -dean */
|
||||||
|
|||||||
@@ -567,6 +567,7 @@ level_tele()
|
|||||||
d_level newlevel;
|
d_level newlevel;
|
||||||
const char *escape_by_flying = 0; /* when surviving dest of -N */
|
const char *escape_by_flying = 0; /* when surviving dest of -N */
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
|
boolean force_dest = FALSE;
|
||||||
|
|
||||||
if ((u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz))
|
if ((u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz))
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
@@ -608,7 +609,29 @@ level_tele()
|
|||||||
}
|
}
|
||||||
#ifdef WIZARD
|
#ifdef WIZARD
|
||||||
if (wizard && !strcmp(buf,"?")) {
|
if (wizard && !strcmp(buf,"?")) {
|
||||||
newlev = print_dungeon(TRUE);
|
schar destlev = 0;
|
||||||
|
xchar destdnum = 0;
|
||||||
|
if ((newlev = (int)print_dungeon(TRUE, &destlev, &destdnum))) {
|
||||||
|
char buf[BUFSZ];
|
||||||
|
newlevel.dnum = destdnum;
|
||||||
|
newlevel.dlevel = destlev;
|
||||||
|
if (In_endgame(&newlevel) && !In_endgame(&u.uz)) {
|
||||||
|
Sprintf(buf,
|
||||||
|
"Destination is earth level");
|
||||||
|
if (!u.uhave.amulet) {
|
||||||
|
struct obj *obj;
|
||||||
|
obj = mksobj(AMULET_OF_YENDOR,
|
||||||
|
TRUE, FALSE);
|
||||||
|
if (obj) {
|
||||||
|
obj = addinv(obj);
|
||||||
|
Strcat(buf, " with the amulet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assign_level(&newlevel, &earth_level);
|
||||||
|
pline("%s.", buf);
|
||||||
|
}
|
||||||
|
force_dest = TRUE;
|
||||||
|
} else return;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if ((newlev = lev_by_name(buf)) == 0) newlev = atoi(buf);
|
if ((newlev = lev_by_name(buf)) == 0) newlev = atoi(buf);
|
||||||
@@ -686,7 +709,7 @@ level_tele()
|
|||||||
|
|
||||||
killer.name[0] = 0; /* still alive, so far... */
|
killer.name[0] = 0; /* still alive, so far... */
|
||||||
|
|
||||||
if (newlev < 0) {
|
if (newlev < 0 && !force_dest) {
|
||||||
if (*u.ushops0) {
|
if (*u.ushops0) {
|
||||||
/* take unpaid inventory items off of shop bills */
|
/* take unpaid inventory items off of shop bills */
|
||||||
in_mklev = TRUE; /* suppress map update */
|
in_mklev = TRUE; /* suppress map update */
|
||||||
@@ -748,6 +771,9 @@ level_tele()
|
|||||||
} else if (u.uz.dnum == medusa_level.dnum &&
|
} else if (u.uz.dnum == medusa_level.dnum &&
|
||||||
newlev >= dungeons[u.uz.dnum].depth_start +
|
newlev >= dungeons[u.uz.dnum].depth_start +
|
||||||
dunlevs_in_dungeon(&u.uz)) {
|
dunlevs_in_dungeon(&u.uz)) {
|
||||||
|
#ifdef WIZARD
|
||||||
|
if (!(wizard && force_dest))
|
||||||
|
#endif
|
||||||
find_hell(&newlevel);
|
find_hell(&newlevel);
|
||||||
} else {
|
} else {
|
||||||
/* if invocation did not yet occur, teleporting into
|
/* if invocation did not yet occur, teleporting into
|
||||||
@@ -770,6 +796,9 @@ level_tele()
|
|||||||
* we must translate newlev to a number relative to the
|
* we must translate newlev to a number relative to the
|
||||||
* current dungeon.
|
* current dungeon.
|
||||||
*/
|
*/
|
||||||
|
#ifdef WIZARD
|
||||||
|
if (!(wizard && force_dest))
|
||||||
|
#endif
|
||||||
get_level(&newlevel, newlev);
|
get_level(&newlevel, newlev);
|
||||||
}
|
}
|
||||||
schedule_goto(&newlevel, FALSE, FALSE, 0, (char *)0, (char *)0);
|
schedule_goto(&newlevel, FALSE, FALSE, 0, (char *)0, (char *)0);
|
||||||
|
|||||||
Reference in New Issue
Block a user