From 33c14ba5233766dd2f569cc03cc8869dc5e76018 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Mon, 21 Jan 2008 16:40:56 +0000 Subject: [PATCH] enlightenment revamp, part I (trunk only) Groundwork for re-doing ^X so that it'll be more integrated with enlightenment and display bottom line information without abbreviations or long-line truncation. `mode' doesn't do anything yet so may provoke lint complaints. --- include/extern.h | 4 ++-- include/hack.h | 9 ++++++++- src/artifact.c | 4 ++-- src/cmd.c | 13 ++++++++----- src/end.c | 5 +++-- src/fountain.c | 4 ++-- src/potion.c | 4 ++-- src/zap.c | 4 ++-- 8 files changed, 29 insertions(+), 18 deletions(-) diff --git a/include/extern.h b/include/extern.h index 8e201d5ac..eceb0ff3c 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)extern.h 3.5 2007/06/27 */ +/* SCCS Id: @(#)extern.h 3.5 2008/01/19 */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -194,7 +194,7 @@ E void FDECL(rhack, (char *)); E int NDECL(doextlist); E int NDECL(extcmd_via_menu); E int NDECL(enter_explore_mode); -E void FDECL(enlightenment, (int)); +E void FDECL(enlightenment, (int,int)); E void FDECL(show_conduct, (int)); E int FDECL(xytod, (SCHAR_P,SCHAR_P)); E void FDECL(dtoxy, (coord *,int)); diff --git a/include/hack.h b/include/hack.h index 9e5e9e41d..2d684ee4e 100644 --- a/include/hack.h +++ b/include/hack.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)hack.h 3.5 2007/03/24 */ +/* SCCS Id: @(#)hack.h 3.5 2008/01/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -291,6 +291,13 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ #define EXPL_FROSTY 6 #define EXPL_MAX 7 +/* enlightenment control flags */ +#define BASICENLIGHTENMENT 1 /* show mundane stuff */ +#define MAGICENLIGHTENMENT 2 /* show intrinsics and such */ +#define ENL_GAMEINPROGRESS 0 +#define ENL_GAMEOVERALIVE 1 /* ascension, escape, quit, trickery */ +#define ENL_GAMEOVERDEAD 2 + /* Macros for messages referring to hands, eyes, feet, etc... */ #define ARM 0 #define EYE 1 diff --git a/src/artifact.c b/src/artifact.c index 9097daa74..f9bede58f 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)artifact.c 3.5 2007/05/09 */ +/* SCCS Id: @(#)artifact.c 3.5 2008/01/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1401,7 +1401,7 @@ arti_invoke(obj) break; } case ENLIGHTENING: - enlightenment(0); + enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS); break; case CREATE_AMMO: { struct obj *otmp = mksobj(ARROW, TRUE, FALSE); diff --git a/src/cmd.c b/src/cmd.c index 4ae0a5a04..b63a529b8 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)cmd.c 3.5 2007/05/05 */ +/* SCCS Id: @(#)cmd.c 3.5 2008/01/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -960,7 +960,7 @@ wiz_rumor_check(VOID_ARGS) /* -enlightenment and conduct- */ -static winid en_win; +static winid en_win = WIN_ERR; static const char You_[] = "You ", are[] = "are ", were[] = "were ", @@ -1046,8 +1046,9 @@ int final; } void -enlightenment(final) -int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */ +enlightenment(mode, final) +int mode; /* BASICENLIGHTENMENT | MAGICENLIGHTENMENT (| both) */ +int final; /* ENL_GAMEINPROGRESS:0, ENL_GAVEOVERALIVE, ENL_GAMEOVERDEAD */ { int ltmp, armpro; char buf[BUFSZ]; @@ -1397,6 +1398,7 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */ display_nhwindow(en_win, TRUE); destroy_nhwindow(en_win); + en_win = WIN_ERR; return; } @@ -1511,7 +1513,7 @@ doattributes(VOID_ARGS) if (!minimal_enlightenment()) return 0; if (wizard || discover) - enlightenment(0); + enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS); return 0; } @@ -1614,6 +1616,7 @@ int final; /* Pop up the window and wait for a key */ display_nhwindow(en_win, TRUE); destroy_nhwindow(en_win); + en_win = WIN_ERR; } #ifndef M diff --git a/src/end.c b/src/end.c index 92a335b85..774822ce4 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)end.c 3.5 2007/05/12 */ +/* SCCS Id: @(#)end.c 3.5 2008/01/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -398,7 +398,8 @@ boolean taken; c = ask ? yn_function("Do you want to see your attributes?", ynqchars, defquery) : defquery; if (c == 'y') - enlightenment(how >= PANICKED ? 1 : 2); /* final */ + enlightenment((BASICENLIGHTENMENT|MAGICENLIGHTENMENT), + (how >= PANICKED) ? ENL_GAMEOVERALIVE : ENL_GAMEOVERDEAD); if (c == 'q') done_stopprint++; } diff --git a/src/fountain.c b/src/fountain.c index 708a1c698..51857f253 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)fountain.c 3.5 2006/05/08 */ +/* SCCS Id: @(#)fountain.c 3.5 2008/01/19 */ /* Copyright Scott R. Turner, srt@ucla, 10/27/86 */ /* NetHack may be freely redistributed. See license for details. */ @@ -239,7 +239,7 @@ drinkfountain() You_feel("self-knowledgeable..."); display_nhwindow(WIN_MESSAGE, FALSE); - enlightenment(0); + enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS); exercise(A_WIS, TRUE); pline_The("feeling subsides."); break; diff --git a/src/potion.c b/src/potion.c index 9c701ddc1..b0819b8e3 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)potion.c 3.5 2007/05/29 */ +/* SCCS Id: @(#)potion.c 3.5 2008/01/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -583,7 +583,7 @@ peffects(otmp) } You_feel("self-knowledgeable..."); display_nhwindow(WIN_MESSAGE, FALSE); - enlightenment(0); + enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS); pline_The("feeling subsides."); exercise(A_WIS, TRUE); } diff --git a/src/zap.c b/src/zap.c index c8955864e..1ed66fc47 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)zap.c 3.5 2007/05/30 */ +/* SCCS Id: @(#)zap.c 3.5 2008/01/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1971,7 +1971,7 @@ register struct obj *obj; known = TRUE; You_feel("self-knowledgeable..."); display_nhwindow(WIN_MESSAGE, FALSE); - enlightenment(FALSE); + enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS); pline_The("feeling subsides."); exercise(A_WIS, TRUE); break; -- 2.40.0