Move quest texts to lua

This commit is contained in:
Pasi Kallinen
2019-11-24 17:41:39 +02:00
parent ac315adaf1
commit 8b87013fba
12 changed files with 3204 additions and 3792 deletions
+3047
View File
File diff suppressed because it is too large Load Diff
-3521
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2094,8 +2094,8 @@ E short FDECL(quest_info, (int));
E const char *NDECL(ldrname); E const char *NDECL(ldrname);
E boolean FDECL(is_quest_artifact, (struct obj *)); E boolean FDECL(is_quest_artifact, (struct obj *));
E struct obj *FDECL(find_quest_artifact, (unsigned)); E struct obj *FDECL(find_quest_artifact, (unsigned));
E void FDECL(com_pager, (int)); E void FDECL(com_pager, (const char *));
E void FDECL(qt_pager, (int)); E void FDECL(qt_pager, (const char *));
E struct permonst *NDECL(qt_montype); E struct permonst *NDECL(qt_montype);
E void NDECL(deliver_splev_message); E void NDECL(deliver_splev_message);
+1 -2
View File
@@ -622,7 +622,6 @@ newgame()
if (iflags.news) if (iflags.news)
display_file(NEWS, FALSE); display_file(NEWS, FALSE);
#endif #endif
load_qtlist(); /* load up the quest text info */
/* quest_init(); -- Now part of role_init() */ /* quest_init(); -- Now part of role_init() */
mklev(); mklev();
@@ -639,7 +638,7 @@ newgame()
if (flags.legacy) { if (flags.legacy) {
flush_screen(1); flush_screen(1);
com_pager(1); com_pager("legacy");
} }
urealtime.realtime = 0L; urealtime.realtime = 0L;
+2 -2
View File
@@ -1663,9 +1663,9 @@ boolean at_stairs, falling, portal;
|| g.quest_status.leader_is_dead)) { || g.quest_status.leader_is_dead)) {
if (!u.uevent.qcalled) { if (!u.uevent.qcalled) {
u.uevent.qcalled = 1; u.uevent.qcalled = 1;
com_pager(2); /* main "leader needs help" message */ com_pager("quest_portal"); /* main "leader needs help" message */
} else { /* reminder message */ } else { /* reminder message */
com_pager(Role_if(PM_ROGUE) ? 4 : 3); com_pager(Role_if(PM_ROGUE) ? "quest_portal_demand" : "quest_portal_again");
} }
} }
} }
+31 -31
View File
@@ -27,13 +27,13 @@ static void
on_start() on_start()
{ {
if (!Qstat(first_start)) { if (!Qstat(first_start)) {
qt_pager(QT_FIRSTTIME); qt_pager("firsttime");
Qstat(first_start) = TRUE; Qstat(first_start) = TRUE;
} else if ((u.uz0.dnum != u.uz.dnum) || (u.uz0.dlevel < u.uz.dlevel)) { } else if ((u.uz0.dnum != u.uz.dnum) || (u.uz0.dlevel < u.uz.dlevel)) {
if (Qstat(not_ready) <= 2) if (Qstat(not_ready) <= 2)
qt_pager(QT_NEXTTIME); qt_pager("nexttime");
else else
qt_pager(QT_OTHERTIME); qt_pager("othertime");
} }
} }
@@ -48,14 +48,14 @@ on_locate()
return; return;
} else if (!Qstat(first_locate)) { } else if (!Qstat(first_locate)) {
if (from_above) if (from_above)
qt_pager(QT_FIRSTLOCATE); qt_pager("locate_first");
/* if we've arrived from below this will be a lie, but there won't /* if we've arrived from below this will be a lie, but there won't
be any point in delivering the message upon a return visit from be any point in delivering the message upon a return visit from
above later since the level has now been seen */ above later since the level has now been seen */
Qstat(first_locate) = TRUE; Qstat(first_locate) = TRUE;
} else { } else {
if (from_above) if (from_above)
qt_pager(QT_NEXTLOCATE); qt_pager("locate_next");
} }
} }
@@ -65,7 +65,7 @@ on_goal()
if (Qstat(killed_nemesis)) { if (Qstat(killed_nemesis)) {
return; return;
} else if (!Qstat(made_goal)) { } else if (!Qstat(made_goal)) {
qt_pager(QT_FIRSTGOAL); qt_pager("goal_first");
Qstat(made_goal) = 1; Qstat(made_goal) = 1;
} else { } else {
/* /*
@@ -81,7 +81,7 @@ on_goal()
| (1 << OBJ_BURIED)); | (1 << OBJ_BURIED));
struct obj *qarti = find_quest_artifact(whichobjchains); struct obj *qarti = find_quest_artifact(whichobjchains);
qt_pager(qarti ? QT_NEXTGOAL : QT_ALTGOAL); qt_pager(qarti ? "goal_next" : "goal_alt");
if (Qstat(made_goal) < 7) if (Qstat(made_goal) < 7)
Qstat(made_goal)++; Qstat(made_goal)++;
} }
@@ -109,7 +109,7 @@ nemdead()
{ {
if (!Qstat(killed_nemesis)) { if (!Qstat(killed_nemesis)) {
Qstat(killed_nemesis) = TRUE; Qstat(killed_nemesis) = TRUE;
qt_pager(QT_KILLEDNEM); qt_pager("killed_nemesis");
} }
} }
@@ -123,7 +123,7 @@ struct obj *obj;
obj->dknown = 1; obj->dknown = 1;
/* only give this message once */ /* only give this message once */
Qstat(touched_artifact) = TRUE; Qstat(touched_artifact) = TRUE;
qt_pager(QT_GOTIT); qt_pager("gotit");
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
} }
} }
@@ -221,16 +221,16 @@ struct obj *obj; /* quest artifact; possibly null if carrying Amulet */
struct obj *otmp; struct obj *otmp;
if (u.uhave.amulet) { /* unlikely but not impossible */ if (u.uhave.amulet) { /* unlikely but not impossible */
qt_pager(QT_HASAMULET); qt_pager("hasamulet");
/* leader IDs the real amulet but ignores any fakes */ /* leader IDs the real amulet but ignores any fakes */
if ((otmp = carrying(AMULET_OF_YENDOR)) != 0) if ((otmp = carrying(AMULET_OF_YENDOR)) != 0)
fully_identify_obj(otmp); fully_identify_obj(otmp);
} else { } else {
qt_pager(!Qstat(got_thanks) ? QT_OFFEREDIT : QT_OFFEREDIT2); qt_pager(!Qstat(got_thanks) ? "offeredit" : "offeredit2");
/* should have obtained bell during quest; /* should have obtained bell during quest;
if not, suggest returning for it now */ if not, suggest returning for it now */
if ((otmp = carrying(BELL_OF_OPENING)) == 0) if ((otmp = carrying(BELL_OF_OPENING)) == 0)
com_pager(5); com_pager("quest_complete_no_bell");
} }
Qstat(got_thanks) = TRUE; Qstat(got_thanks) = TRUE;
@@ -260,7 +260,7 @@ chat_with_leader()
/* Rule 2: You've gone back before going for the amulet. */ /* Rule 2: You've gone back before going for the amulet. */
else else
qt_pager(QT_POSTHANKS); qt_pager("posthanks");
/* Rule 3: You've got the artifact and are back to return it. */ /* Rule 3: You've got the artifact and are back to return it. */
} else if (u.uhave.questart) { } else if (u.uhave.questart) {
@@ -274,16 +274,16 @@ chat_with_leader()
/* Rule 4: You haven't got the artifact yet. */ /* Rule 4: You haven't got the artifact yet. */
} else if (Qstat(got_quest)) { } else if (Qstat(got_quest)) {
qt_pager(rn1(10, QT_ENCOURAGE)); qt_pager("encourage");
/* Rule 5: You aren't yet acceptable - or are you? */ /* Rule 5: You aren't yet acceptable - or are you? */
} else { } else {
if (!Qstat(met_leader)) { if (!Qstat(met_leader)) {
qt_pager(QT_FIRSTLEADER); qt_pager("leader_first");
Qstat(met_leader) = TRUE; Qstat(met_leader) = TRUE;
Qstat(not_ready) = 0; Qstat(not_ready) = 0;
} else } else
qt_pager(QT_NEXTLEADER); qt_pager("leader_next");
/* the quest leader might have passed through the portal into /* the quest leader might have passed through the portal into
the regular dungeon; none of the remaining make sense there */ the regular dungeon; none of the remaining make sense there */
@@ -291,16 +291,16 @@ chat_with_leader()
return; return;
if (not_capable()) { if (not_capable()) {
qt_pager(QT_BADLEVEL); qt_pager("badlevel");
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
expulsion(FALSE); expulsion(FALSE);
} else if (is_pure(TRUE) < 0) { } else if (is_pure(TRUE) < 0) {
com_pager(QT_BANISHED); com_pager("banished");
expulsion(TRUE); expulsion(TRUE);
} else if (is_pure(TRUE) == 0) { } else if (is_pure(TRUE) == 0) {
qt_pager(QT_BADALIGN); qt_pager("badalign");
if (Qstat(not_ready) == MAX_QUEST_TRIES) { if (Qstat(not_ready) == MAX_QUEST_TRIES) {
qt_pager(QT_LASTLEADER); qt_pager("leader_last");
expulsion(TRUE); expulsion(TRUE);
} else { } else {
Qstat(not_ready)++; Qstat(not_ready)++;
@@ -308,7 +308,7 @@ chat_with_leader()
expulsion(FALSE); expulsion(FALSE);
} }
} else { /* You are worthy! */ } else { /* You are worthy! */
qt_pager(QT_ASSIGNQUEST); qt_pager("assignquest");
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
Qstat(got_quest) = TRUE; Qstat(got_quest) = TRUE;
} }
@@ -330,7 +330,7 @@ struct monst *mtmp;
return; return;
if (Qstat(pissed_off)) { if (Qstat(pissed_off)) {
qt_pager(QT_LASTLEADER); qt_pager("leader_last");
expulsion(TRUE); expulsion(TRUE);
} else } else
chat_with_leader(); chat_with_leader();
@@ -340,7 +340,7 @@ static void
chat_with_nemesis() chat_with_nemesis()
{ {
/* The nemesis will do most of the talking, but... */ /* The nemesis will do most of the talking, but... */
qt_pager(rn1(10, QT_DISCOURAGE)); qt_pager("discourage");
if (!Qstat(met_nemesis)) if (!Qstat(met_nemesis))
Qstat(met_nemesis++); Qstat(met_nemesis++);
} }
@@ -350,21 +350,21 @@ nemesis_speaks()
{ {
if (!Qstat(in_battle)) { if (!Qstat(in_battle)) {
if (u.uhave.questart) if (u.uhave.questart)
qt_pager(QT_NEMWANTSIT); qt_pager("nemesis_wantsit");
else if (Qstat(made_goal) == 1 || !Qstat(met_nemesis)) else if (Qstat(made_goal) == 1 || !Qstat(met_nemesis))
qt_pager(QT_FIRSTNEMESIS); qt_pager("nemesis_first");
else if (Qstat(made_goal) < 4) else if (Qstat(made_goal) < 4)
qt_pager(QT_NEXTNEMESIS); qt_pager("nemesis_next");
else if (Qstat(made_goal) < 7) else if (Qstat(made_goal) < 7)
qt_pager(QT_OTHERNEMESIS); qt_pager("nemesis_other");
else if (!rn2(5)) else if (!rn2(5))
qt_pager(rn1(10, QT_DISCOURAGE)); qt_pager("discourage");
if (Qstat(made_goal) < 7) if (Qstat(made_goal) < 7)
Qstat(made_goal)++; Qstat(made_goal)++;
Qstat(met_nemesis) = TRUE; Qstat(met_nemesis) = TRUE;
} else /* he will spit out random maledictions */ } else /* he will spit out random maledictions */
if (!rn2(5)) if (!rn2(5))
qt_pager(rn1(10, QT_DISCOURAGE)); qt_pager("discourage");
} }
static void static void
@@ -372,9 +372,9 @@ chat_with_guardian()
{ {
/* These guys/gals really don't have much to say... */ /* These guys/gals really don't have much to say... */
if (u.uhave.questart && Qstat(killed_nemesis)) if (u.uhave.questart && Qstat(killed_nemesis))
qt_pager(rn1(5, QT_GUARDTALK2)); qt_pager("guardtalk_after");
else else
qt_pager(rn1(5, QT_GUARDTALK)); qt_pager("guardtalk_before");
} }
static void static void
+114 -219
View File
@@ -9,15 +9,12 @@
#include "qtext.h" #include "qtext.h"
#define QTEXT_FILE "quest.dat" #define QTEXT_FILE "quest.lua"
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
#include "wintty.h" #include "wintty.h"
#endif #endif
static void NDECL(dump_qtlist);
static void FDECL(Fread, (genericptr_t, int, int, dlb *));
static struct qtmsg *FDECL(construct_qtlist, (long));
static const char *NDECL(intermed); static const char *NDECL(intermed);
static struct obj *FDECL(find_qarti, (struct obj *)); static struct obj *FDECL(find_qarti, (struct obj *));
static const char *NDECL(neminame); static const char *NDECL(neminame);
@@ -27,123 +24,10 @@ static void FDECL(qtext_pronoun, (CHAR_P, CHAR_P));
static struct qtmsg *FDECL(msg_in, (struct qtmsg *, int)); static struct qtmsg *FDECL(msg_in, (struct qtmsg *, int));
static void FDECL(convert_arg, (CHAR_P)); static void FDECL(convert_arg, (CHAR_P));
static void FDECL(convert_line, (char *,char *)); static void FDECL(convert_line, (char *,char *));
static void FDECL(deliver_by_pline, (struct qtmsg *)); static void FDECL(deliver_by_pline, (const char *));
static void FDECL(deliver_by_window, (struct qtmsg *, int)); static void FDECL(deliver_by_window, (const char *, int));
static boolean FDECL(skip_pager, (BOOLEAN_P)); static boolean FDECL(skip_pager, (BOOLEAN_P));
/* dump the character msg list to check appearance;
build with DEBUG enabled and use DEBUGFILES=questpgr.c
in sysconf file or environment */
static void
dump_qtlist()
{
#ifdef DEBUG
struct qtmsg *msg;
if (!explicitdebug(__FILE__))
return;
for (msg = g.qt_list.chrole; msg->msgnum > 0; msg++) {
(void) dlb_fseek(g.msg_file, msg->offset, SEEK_SET);
deliver_by_window(msg, NHW_MAP);
}
#endif /* DEBUG */
return;
}
static void
Fread(ptr, size, nitems, stream)
genericptr_t ptr;
int size, nitems;
dlb *stream;
{
int cnt;
if ((cnt = dlb_fread(ptr, size, nitems, stream)) != nitems) {
panic("PREMATURE EOF ON QUEST TEXT FILE! Expected %d bytes, got %d",
(size * nitems), (size * cnt));
}
}
static struct qtmsg *
construct_qtlist(hdr_offset)
long hdr_offset;
{
struct qtmsg *msg_list;
int n_msgs;
(void) dlb_fseek(g.msg_file, hdr_offset, SEEK_SET);
Fread(&n_msgs, sizeof(int), 1, g.msg_file);
msg_list = (struct qtmsg *) alloc((unsigned) (n_msgs + 1)
* sizeof (struct qtmsg));
/*
* Load up the list.
*/
Fread((genericptr_t) msg_list, n_msgs * sizeof (struct qtmsg), 1,
g.msg_file);
msg_list[n_msgs].msgnum = -1;
return msg_list;
}
void
load_qtlist()
{
int n_classes, i;
char qt_classes[N_HDR][LEN_HDR];
long qt_offsets[N_HDR];
g.msg_file = dlb_fopen(QTEXT_FILE, RDBMODE);
if (!g.msg_file)
panic("CANNOT OPEN QUEST TEXT FILE %s.", QTEXT_FILE);
/*
* Read in the number of classes, then the ID's & offsets for
* each header.
*/
Fread(&n_classes, sizeof (int), 1, g.msg_file);
Fread(&qt_classes[0][0], sizeof (char) * LEN_HDR, n_classes, g.msg_file);
Fread(qt_offsets, sizeof (long), n_classes, g.msg_file);
/*
* Now construct the message lists for quick reference later
* on when we are actually paging the messages out.
*/
g.qt_list.common = g.qt_list.chrole = (struct qtmsg *) 0;
for (i = 0; i < n_classes; i++) {
if (!strncmp(COMMON_ID, qt_classes[i], LEN_HDR))
g.qt_list.common = construct_qtlist(qt_offsets[i]);
else if (!strncmp(g.urole.filecode, qt_classes[i], LEN_HDR))
g.qt_list.chrole = construct_qtlist(qt_offsets[i]);
#if 0 /* UNUSED but available */
else if (!strncmp(g.urace.filecode, qt_classes[i], LEN_HDR))
g.qt_list.chrace = construct_qtlist(qt_offsets[i]);
#endif
}
if (!g.qt_list.common || !g.qt_list.chrole)
impossible("load_qtlist: cannot load quest text.");
dump_qtlist();
return; /* no ***DON'T*** close the msg_file */
}
/* called at program exit */
void
unload_qtlist()
{
if (g.msg_file)
(void) dlb_fclose(g.msg_file), g.msg_file = 0;
if (g.qt_list.common)
free((genericptr_t) g.qt_list.common), g.qt_list.common = 0;
if (g.qt_list.chrole)
free((genericptr_t) g.qt_list.chrole), g.qt_list.chrole = 0;
return;
}
short short
quest_info(typ) quest_info(typ)
int typ; int typ;
@@ -418,7 +302,7 @@ char *in_line, *out_line;
char xbuf[BUFSZ]; char xbuf[BUFSZ];
cc = out_line; cc = out_line;
for (c = xcrypt(in_line, xbuf); *c; c++) { for (c = in_line; *c; c++) {
*cc = 0; *cc = 0;
switch (*c) { switch (*c) {
case '\r': case '\r':
@@ -505,68 +389,42 @@ char *in_line, *out_line;
} }
static void static void
deliver_by_pline(qt_msg) deliver_by_pline(str)
struct qtmsg *qt_msg; const char *str;
{ {
long size;
char in_line[BUFSZ], out_line[BUFSZ]; char in_line[BUFSZ], out_line[BUFSZ];
*in_line = '\0'; Strcpy(in_line, str);
for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) { convert_line(in_line, out_line);
(void) dlb_fgets(in_line, sizeof in_line, g.msg_file); pline("%s", out_line);
convert_line(in_line, out_line);
pline("%s", out_line);
}
} }
static void static void
deliver_by_window(qt_msg, how) deliver_by_window(msg, how)
struct qtmsg *qt_msg; const char *msg;
int how; int how;
{ {
long size; const char *msgp = msg;
const char *msgend = eos((char *)msg);
char in_line[BUFSZ], out_line[BUFSZ]; char in_line[BUFSZ], out_line[BUFSZ];
boolean qtdump = (how == NHW_MAP); winid datawin = create_nhwindow(how);
winid datawin = create_nhwindow(qtdump ? NHW_TEXT : how);
#ifdef DEBUG while (msgp && msgp != msgend) {
if (qtdump) { int i = 0;
char buf[BUFSZ]; while (*msgp != '\0' && *msgp != '\n' && (i < BUFSZ-2)) {
in_line[i] = *msgp;
/* when dumping quest messages at startup, all of them are passed to i++;
* deliver_by_window(), even if normally given to deliver_by_pline() msgp++;
*/ }
Sprintf(buf, "msgnum: %d, delivery: %c", if (*msgp == '\n')
qt_msg->msgnum, qt_msg->delivery); msgp++;
putstr(datawin, 0, buf); in_line[i] = '\0';
putstr(datawin, 0, "");
}
#endif
for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) {
(void) dlb_fgets(in_line, sizeof in_line, g.msg_file);
convert_line(in_line, out_line); convert_line(in_line, out_line);
putstr(datawin, 0, out_line); putstr(datawin, 0, out_line);
} }
display_nhwindow(datawin, TRUE); display_nhwindow(datawin, TRUE);
destroy_nhwindow(datawin); destroy_nhwindow(datawin);
/* block messages delivered by window aren't kept in message history
but have a one-line summary which is put there for ^P recall */
*out_line = '\0';
if (qt_msg->summary_size) {
(void) dlb_fgets(in_line, sizeof in_line, g.msg_file);
convert_line(in_line, out_line);
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
} else if (qt_msg->delivery == 'c') { /* skip for 'qtdump' of 'p' */
/* delivery 'c' and !summary_size, summary expected but not present;
this doesn't prefix the number with role code vs 'general'
but should be good enough for summary verification purposes */
Sprintf(out_line, "[missing block message summary for #%05d]",
qt_msg->msgnum);
#endif
}
if (*out_line)
putmsghistory(out_line, FALSE);
} }
static boolean static boolean
@@ -576,71 +434,110 @@ boolean common;
/* WIZKIT: suppress plot feedback if starting with quest artifact */ /* WIZKIT: suppress plot feedback if starting with quest artifact */
if (g.program_state.wizkit_wishing) if (g.program_state.wizkit_wishing)
return TRUE; return TRUE;
if (!(common ? g.qt_list.common : g.qt_list.chrole)) {
panic("%s: no %s quest text data available",
common ? "com_pager" : "qt_pager",
common ? "common" : "role-specific");
/*NOTREACHED*/
return TRUE;
}
return FALSE; return FALSE;
} }
void boolean
com_pager(msgnum) com_pager_core(section, msgid)
int msgnum; const char *section;
const char *msgid;
{ {
struct qtmsg *qt_msg; const char *const howtoput[] = { "pline", "window", "menu", NULL };
const int howtoput2i[] = { 1, 2, 3, 0 };
int output;
lua_State *L;
char *synopsis;
char *text;
if (skip_pager(TRUE)) if (skip_pager(TRUE))
return; return FALSE;
if (!(qt_msg = msg_in(g.qt_list.common, msgnum))) { L = nhl_init();
impossible("com_pager: message %d not found.", msgnum);
return; if (!nhl_loadlua(L, QTEXT_FILE)) {
impossible("com_pager: %s not found.", QTEXT_FILE);
lua_close(L);
return FALSE;
} }
(void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET); lua_settop(L, 0);
if (qt_msg->delivery == 'p') lua_getglobal(L, "questtext");
deliver_by_pline(qt_msg); if (!lua_istable(L, -1)) {
else if (msgnum == 1) impossible("com_pager: questtext in %s is not a lua table", QTEXT_FILE);
deliver_by_window(qt_msg, NHW_MENU); lua_close(L);
return FALSE;
}
lua_getfield(L, -1, section);
if (!lua_istable(L, -1)) {
impossible("com_pager: questtext[%s] in %s is not a lua table", section, QTEXT_FILE);
lua_close(L);
return FALSE;
}
lua_getfield(L, -1, msgid);
if (!lua_istable(L, -1)) {
impossible("com_pager: questtext[%s][%s] in %s is not a lua table", section, msgid, QTEXT_FILE);
lua_close(L);
return FALSE;
}
synopsis = get_table_str_opt(L, "synopsis", NULL);
text = get_table_str_opt(L, "text", NULL);
output = howtoput2i[get_table_option(L, "output", "pline", howtoput)];
if (!synopsis && !text) {
int nelems;
lua_len(L, -1);
nelems = LUA_INTCAST(lua_tointeger(L, -1));
lua_pop(L, 1);
if (nelems < 2) {
impossible("com_pager: questtext[%s][%s] in %s in not an array of strings", section, msgid, QTEXT_FILE);
lua_close(L);
return FALSE;
}
nelems = rn2(nelems) + 1;
lua_pushinteger(L, nelems);
lua_gettable(L, -2);
text = dupstr(luaL_checkstring(L, -1));
}
if ((index(text, '\n') || (strlen(text) >= (BUFSZ - 1))) && output == 1)
output = 2;
if (output == 1)
deliver_by_pline(text);
else if (output == 3)
deliver_by_window(text, NHW_MENU);
else else
deliver_by_window(qt_msg, NHW_TEXT); deliver_by_window(text, NHW_TEXT);
return;
if (synopsis) {
char in_line[BUFSZ], out_line[BUFSZ];
Strcpy(in_line, synopsis);
convert_line(in_line, out_line);
putmsghistory(out_line, FALSE);
}
free(synopsis);
free(text);
lua_close(L);
return TRUE;
} }
void void
qt_pager(msgnum) com_pager(msgid)
int msgnum; const char *msgid;
{ {
struct qtmsg *qt_msg; com_pager_core("common", msgid);
}
if (skip_pager(FALSE)) void
return; qt_pager(msgid)
const char *msgid;
qt_msg = msg_in(g.qt_list.chrole, msgnum); {
if (!qt_msg) { if (!com_pager_core(g.urole.filecode, msgid))
/* some roles have an alternate message for return to the goal com_pager_core("common", msgid);
level when the quest artifact is absent (handled by caller)
but some don't; for the latter, use the normal goal message;
note: for first visit, artifact is assumed to always be
present which might not be true for wizard mode but we don't
worry about quest message references in that situation */
if (msgnum == QT_ALTGOAL)
qt_msg = msg_in(g.qt_list.chrole, QT_NEXTGOAL);
}
if (!qt_msg) {
impossible("qt_pager: message %d not found.", msgnum);
return;
}
(void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET);
if (qt_msg->delivery == 'p' && strcmp(windowprocs.name, "X11"))
deliver_by_pline(qt_msg);
else
deliver_by_window(qt_msg, NHW_TEXT);
return;
} }
struct permonst * struct permonst *
@@ -674,8 +571,6 @@ deliver_splev_message()
/* copying will stop at newline if one is present */ /* copying will stop at newline if one is present */
copynchars(in_line, str, (int) (sizeof in_line) - 1); copynchars(in_line, str, (int) (sizeof in_line) - 1);
/* convert_line() expects encrypted input */
(void) xcrypt(in_line, in_line);
convert_line(in_line, out_line); convert_line(in_line, out_line);
pline("%s", out_line); pline("%s", out_line);
-1
View File
@@ -1104,7 +1104,6 @@ NHFILE *nhfp;
*/ */
inven_inuse(FALSE); inven_inuse(FALSE);
load_qtlist(); /* re-load the quest text info */
/* Set up the vision internals, after levl[] data is loaded /* Set up the vision internals, after levl[] data is loaded
but before docrt(). */ but before docrt(). */
reglyph_darkroom(); reglyph_darkroom();
-1
View File
@@ -1285,7 +1285,6 @@ freedynamicdata()
#endif #endif
zero_nhfile(&tnhfp); /* also sets fd to -1 */ zero_nhfile(&tnhfp); /* also sets fd to -1 */
tnhfp.mode = FREEING; tnhfp.mode = FREEING;
unload_qtlist();
free_menu_coloring(); free_menu_coloring();
free_invbuf(); /* let_to_name (invent.c) */ free_invbuf(); /* let_to_name (invent.c) */
free_youbuf(); /* You_buf,&c (pline.c) */ free_youbuf(); /* You_buf,&c (pline.c) */
+4 -3
View File
@@ -762,13 +762,14 @@ register struct monst *mtmp;
random_insult[rn2(SIZE(random_insult))]); random_insult[rn2(SIZE(random_insult))]);
} else if (is_lminion(mtmp) } else if (is_lminion(mtmp)
&& !(mtmp->isminion && EMIN(mtmp)->renegade)) { && !(mtmp->isminion && EMIN(mtmp)->renegade)) {
com_pager(rn2(QTN_ANGELIC - 1 + (Hallucination ? 1 : 0)) com_pager("angel_cuss"); /* TODO: the Hallucination msg */
+ QT_ANGELIC); /*com_pager(rn2(QTN_ANGELIC - 1 + (Hallucination ? 1 : 0))
+ QT_ANGELIC);*/
} else { } else {
if (!rn2(is_minion(mtmp->data) ? 100 : 5)) if (!rn2(is_minion(mtmp->data) ? 100 : 5))
pline("%s casts aspersions on your ancestry.", Monnam(mtmp)); pline("%s casts aspersions on your ancestry.", Monnam(mtmp));
else else
com_pager(rn2(QTN_DEMONIC) + QT_DEMONIC); com_pager("demon_cuss");
} }
} }
+1 -4
View File
@@ -9,7 +9,7 @@ NHSROOT=..
# SHELL=E:/GEMINI2/MUPFEL.TTP # SHELL=E:/GEMINI2/MUPFEL.TTP
# UUDECODE=uudecode # UUDECODE=uudecode
VARDAT = bogusmon data engrave epitaph rumors quest.dat oracles options VARDAT = bogusmon data engrave epitaph rumors quest.lua oracles options
all: $(VARDAT) spec_levs quest_levs all: $(VARDAT) spec_levs quest_levs
@@ -100,9 +100,6 @@ data: data.base ../util/makedefs
rumors: rumors.tru rumors.fal ../util/makedefs rumors: rumors.tru rumors.fal ../util/makedefs
../util/makedefs -r ../util/makedefs -r
quest.dat: quest.txt ../util/makedefs
../util/makedefs -q
oracles: oracles.txt ../util/makedefs oracles: oracles.txt ../util/makedefs
../util/makedefs -h ../util/makedefs -h
+2 -6
View File
@@ -57,7 +57,7 @@ DIRPERM = 0755
# for Gnome # for Gnome
# VARDATND = x11tiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm # VARDATND = x11tiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm
VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors VARDATD = bogusmon data engrave epitaph oracles options quest.lua rumors
VARDAT = $(VARDATD) $(VARDATND) VARDAT = $(VARDATD) $(VARDATND)
# Some versions of make use the SHELL environment variable as the shell # Some versions of make use the SHELL environment variable as the shell
@@ -133,8 +133,7 @@ oracles: $(GAME)
options: $(GAME) options: $(GAME)
( cd dat ; $(MAKE) options ) ( cd dat ; $(MAKE) options )
quest.dat: $(GAME) quest.lua: $(GAME)
( cd dat ; $(MAKE) quest.dat )
spec_levs: spec_levs:
( cd dat ; $(MAKE) spec_levs ) ( cd dat ; $(MAKE) spec_levs )
@@ -247,9 +246,6 @@ fetch-Lua:
update: $(GAME) recover $(VARDAT) spec_levs update: $(GAME) recover $(VARDAT) spec_levs
# (don't yank the old version out from under people who're playing it) # (don't yank the old version out from under people who're playing it)
-mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
# quest.dat is also kept open and has the same problems over NFS
# (quest.dat may be inside nhdat if dlb is in use)
-mv $(INSTDIR)/quest.dat $(INSTDIR)/quest.dat.old
-mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old -mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old
# set up new versions of the game files # set up new versions of the game files
( $(MAKE) dofiles ) ( $(MAKE) dofiles )