questpgr support for special level arrival messages (trunk only)

Suggested by <email deleted>.  The level compiler allows
MESSAGE directives to provide text given upon initial entry to particular
levels.  Modify the code that delivers them to support quest pager text
substitution.  It could also be tweaked to support deliver-by-popup-window
in addition to deliver-by-pline, but I didn't go that far.

     He also suggested revising the message for the Plane of Air, but it
seems ok to me.  Instead, I've changed the message for the Astral Plane to
announce that it holds "the High Temple of <your deity>" rather than the
quite lame "the High Temples of the aligned gods".
This commit is contained in:
nethack.rankin
2007-03-03 04:51:47 +00:00
parent 23eb08a462
commit e3229e6d3b
4 changed files with 38 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
# SCCS Id: @(#)endgame.des 3.5 2002/01/19
# SCCS Id: @(#)endgame.des 3.5 2007/03/02
# Copyright (c) 1989 by Jean-Christophe Collet
# Copyright (c) 1992,1993 by Izchak Miller, David Cohrs,
# and Timo Hakulinen
@@ -476,7 +476,7 @@ MONSTER:'E',"water elemental",random,hostile
MAZE:"astral",' '
FLAGS: noteleport,hardfloor,nommap,shortsighted
MESSAGE: "You arrive on the Astral Plane!"
MESSAGE: "Here the High Temples of the aligned gods are located."
MESSAGE: "Here the High Temple of %d is located."
MESSAGE: "You sense alarm, hostility, and excitement in the air!"
GEOMETRY:center,center
MAP

View File

@@ -125,6 +125,7 @@ recognize most instances where hallucinatory monster name should be treated
as a personal name (to avoid "the Barney") instead of a description
avoid giving misleading or redundant feedback when reading scrolls
custom arrival message for special levels could be delivered too soon
custom arrival message for special levels now supports quest text substitution
prevent scroll of charging that has already disappeared from showing in the
picklist of things to charge
doors break instead of absorbing the blast of a broken wand of striking

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mkmaze.c 3.5 2006/05/09 */
/* SCCS Id: @(#)mkmaze.c 3.5 2007/03/02 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -7,7 +7,6 @@
#include "lev.h" /* save & restore info */
/* from sp_lev.c, for fixup_special() */
extern char *lev_message;
extern lev_region *lregions;
extern int num_lregions;
@@ -480,26 +479,6 @@ fixup_special()
num_lregions = 0;
}
/* special levels can include a custom arrival message; display it */
void
deliver_splev_message()
{
char *str, *nl;
/* this used to be inline within fixup_special(),
but then the message ended up being given too soon */
if (lev_message) {
for (str = lev_message; (nl = index(str, '\n')) != 0; str = nl + 1) {
*nl = '\0';
pline("%s", str);
}
if (*str)
pline("%s", str);
free((genericptr_t)lev_message);
lev_message = 0;
}
}
void
makemaz(s)
register const char *s;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)questpgr.c 3.5 2004/11/22 */
/* SCCS Id: @(#)questpgr.c 3.5 2007/03/02 */
/* Copyright 1991, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */
@@ -13,6 +13,9 @@
/* #define DEBUG */ /* uncomment for debugging */
/* from sp_lev.c, for deliver_splev_message() */
extern char *lev_message;
static void FDECL(Fread, (genericptr_t,int,int,dlb *));
STATIC_DCL struct qtmsg * FDECL(construct_qtlist, (long));
STATIC_DCL const char * NDECL(intermed);
@@ -365,7 +368,7 @@ struct qtmsg *qt_msg;
for (size = 0; size < qt_msg->size; size += (long)strlen(in_line)) {
(void) dlb_fgets(in_line, 80, msg_file);
convert_line();
pline(out_line);
pline("%s", out_line);
}
}
@@ -462,4 +465,33 @@ qt_montype()
return (mkclass(urole.enemy2sym, 0));
}
/* special levels can include a custom arrival message; display it */
void
deliver_splev_message()
{
char *str, *nl;
/* there's no provision for delivering via window instead of pline */
if (lev_message) {
/* lev_message can span multiple lines using embedded newline chars;
any segments too long to fit within in_line[] will be truncated */
for (str = lev_message; *str; str = nl + 1) {
(void)strncpy(in_line, str, sizeof in_line - 1);
in_line[sizeof in_line - 1] = '\0';
if ((nl = index(in_line, '\n')) != 0) *nl = '\0';
/* convert_line() expects encrypted input;
it reads from in_line[] and writes to out_line[] */
(void)xcrypt(in_line, in_line);
convert_line();
pline("%s", out_line);
if ((nl = index(str, '\n')) == 0) break; /* done if no newline */
}
free((genericptr_t)lev_message);
lev_message = 0;
}
}
/*questpgr.c*/