]> granicus.if.org Git - nethack/commitdiff
enlightenment revamp, part I (trunk only)
authornethack.rankin <nethack.rankin>
Mon, 21 Jan 2008 16:40:56 +0000 (16:40 +0000)
committernethack.rankin <nethack.rankin>
Mon, 21 Jan 2008 16:40:56 +0000 (16:40 +0000)
     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
include/hack.h
src/artifact.c
src/cmd.c
src/end.c
src/fountain.c
src/potion.c
src/zap.c

index 8e201d5acfb149cf969efd49d097194a0c57bcbf..eceb0ff3cd65369ce6059874ab159c82211aa39f 100644 (file)
@@ -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));
index 9e5e9e41d8e6f3fd25ab2048d713e1f543dde6f6..2d684ee4e38f0f62e81bab2ee3ce10b4f8de3839 100644 (file)
@@ -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
index 9097daa7494aa3d1f076424127df769ae99c2561..f9bede58f09120281c51bad355596dab9837f88d 100644 (file)
@@ -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);
index 4ae0a5a04573d0f2a1b3d030eeaa829e43fa4ee5..b63a529b8e4b67be0132f981b58a27adfcbfe6cc 100644 (file)
--- 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
index 92a335b85b6b34acdd7896433268d3b047f7d87b..774822ce4d569c8d799ae902e70b5fa5f52c6604 100644 (file)
--- 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++;
        }
 
index 708a1c698361d6f765a38884d8dcb5fa4fc5aec7..51857f25307698124a2ea6c844f724a231166163 100644 (file)
@@ -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;
index 9c701ddc1d54967f48a9164a882cb2c646117c89..b0819b8e36b182bce93f65c571c3d8dcb660115d 100644 (file)
@@ -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);
                }
index c8955864e2fced94539626cc36a70dc837e99c62..1ed66fc4736d5720b12bbc6ee3ac55f075e230cf 100644 (file)
--- 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;