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:
23
src/mkmaze.c
23
src/mkmaze.c
@@ -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;
|
||||
|
||||
@@ -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*/
|
||||
|
||||
Reference in New Issue
Block a user