]> granicus.if.org Git - nethack/commitdiff
#U986: <email deleted> wrote
authornethack.allison <nethack.allison>
Fri, 4 Jun 2004 03:56:27 +0000 (03:56 +0000)
committernethack.allison <nethack.allison>
Fri, 4 Jun 2004 03:56:27 +0000 (03:56 +0000)
on Sunday, April 4, 2004 at 20:27:06:
> On occassion when restoring a game where the
> character is wielding Sting, floor glyphs
> will show up before the --more-- prompt.
> These floor glyphs usually correspond to the
> location of monsters (sometimes they are just
> cavern features such as walls).  Some of these
> floor glyphs are not in the character's line
> of sight upon restoring.

Also in this patch is a restore of Sting's ability
to glow blue.

doc/fixes35.0
include/decl.h
include/extern.h
src/allmain.c
src/artifact.c
src/decl.c
src/display.c
src/restore.c

index 96cd23f6d008bc8f19bdae08c0057df149a6b417..c6c450b1344eaf32b6a0d3c4e46025fbe1ce8462 100644 (file)
@@ -70,6 +70,8 @@ a slow-moving monster hidden under a rotting corpse was not immediately
 mimic that ends up on the rogue level should not mimic a closed door
 polymorphed or shapechanged monster sometimes got erroneous hit points
 mimic should not mimic a boulder while on a pit or hole location
+Sting could trigger premature display of orcs during savegame restore
+Sting now glows light blue again
 
 
 Platform- and/or Interface-Specific Fixes
index dac11660e1a3bdc89fef4cd13dedb759047a6668..c6e4dc0bb78511e368b4e46a61cf173aba7aef0d 100644 (file)
@@ -36,6 +36,7 @@ E NEARDATA int occtime;
 
 #define WARNCOUNT 6                    /* number of different warning levels */
 E uchar warnsyms[WARNCOUNT];
+E NEARDATA int warn_obj_cnt;           /* count of monsters meeting criteria */
 
 E int x_maze_max, y_maze_max;
 E int otg_temp;
@@ -214,6 +215,7 @@ E NEARDATA boolean stoned;
 E NEARDATA boolean unweapon;
 E NEARDATA boolean mrg_to_wielded;
 E NEARDATA struct obj *current_wand;
+E NEARDATA boolean defer_see_monsters;
 
 E NEARDATA boolean in_steed_dismounting;
 
index 72b2b564e1088ccaef783cff2551f8a815c17925..a684735dfc48bd1ca538516a209ba3b908320a2d 100644 (file)
@@ -82,6 +82,7 @@ E long FDECL(spec_m2, (struct obj *));
 E boolean FDECL(artifact_has_invprop, (struct obj *,UCHAR_P));
 E long FDECL(arti_cost, (struct obj *));
 E struct obj *FDECL(what_gives, (long *));
+E void FDECL(Sting_effects, (int));
 
 /* ### attrib.c ### */
 
index 80591b5573849a7c0b7eeb36b01f618ca67bad9c..02fdfa7f00dbc5dc01813bdbc609b8a26374e188 100644 (file)
@@ -53,6 +53,10 @@ moveloop()
 #endif
 
     (void) encumber_msg(); /* in case they auto-picked up something */
+    if (defer_see_monsters) {
+       defer_see_monsters = FALSE;
+       see_monsters();
+    }
 
     u.uz0.dlevel = u.uz.dlevel;
     youmonst.movement = NORMAL_SPEED;  /* give the hero some movement points */
index 02e008beddb539aaa9a3b845b384c7dc139a859e..afbe6c6e4312130adfc0d57e79eeb894840e3000 100644 (file)
@@ -1540,5 +1540,18 @@ long *abil;
        }
        return (struct obj *)0;
 }
+
+void
+Sting_effects(orc_count)
+int orc_count;
+{
+      if (uwep && uwep->oartifact == ART_STING) {
+          if (orc_count > 0 && warn_obj_cnt == 0)
+              pline("%s %s %s!", bare_artifactname(uwep),
+                      otense(uwep,"glow"), hcolor(NH_LIGHT_BLUE));
+          else if (orc_count == 0 && warn_obj_cnt > 0)
+              pline("%s stops glowing.", bare_artifactname(uwep));
+      }
+}
 /*artifact.c*/
 
index 8f25615c34d5fb2ecee219caefe9b7fce1716dfb..1ca1d5c7cb43f967a0e47855635927aa07ad8a0c 100644 (file)
@@ -43,6 +43,7 @@ struct dgn_topology dungeon_topology = {DUMMY};
 #include "quest.h"
 struct q_score quest_status = DUMMY;
 
+NEARDATA int warn_obj_cnt = 0;
 NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY;
 NEARDATA int doorindex = 0;
 NEARDATA char *save_cm = 0;
@@ -116,6 +117,7 @@ NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
 NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
 NEARDATA coord inv_pos = { 0, 0 };
 
+NEARDATA boolean defer_see_monsters = FALSE;
 NEARDATA boolean in_mklev = FALSE;
 NEARDATA boolean stoned = FALSE;       /* done to monsters hit by 'c' */
 NEARDATA boolean unweapon = FALSE;
index 3990cc6d9060bd45549e5206e2c60dbaf1660152..f5e0a1499290acced52babd091e469b1553beb66 100644 (file)
@@ -1067,12 +1067,28 @@ void
 see_monsters()
 {
     register struct monst *mon;
+    int new_warn_obj_cnt = 0;
+
+    if (defer_see_monsters) return;
 
     for (mon = fmon; mon; mon = mon->nmon) {
        if (DEADMONSTER(mon)) continue;
        newsym(mon->mx,mon->my);
        if (mon->wormno) see_wsegs(mon);
+       if (MATCH_WARN_OF_MON(mon)) {
+           if (context.warntype.obj &&
+               (context.warntype.obj & mon->data->mflags2)) new_warn_obj_cnt++;
+       }
+    }
+    /*
+     * Make Sting glow blue or stop glowing if required.
+     */
+    if (new_warn_obj_cnt != warn_obj_cnt &&
+       uwep && uwep->oartifact == ART_STING) {
+       Sting_effects(new_warn_obj_cnt);
+       warn_obj_cnt = new_warn_obj_cnt;
     }
+
 #ifdef STEED
     /* when mounted, hero's location gets caught by monster loop */
     if (!u.usteed)
index f3fcc9e810fd68a3d0a614f52a010c1828c461c7..0ff54c4352ccd894c0f49ce9cbe6bbfc95a9df1b 100644 (file)
@@ -423,6 +423,13 @@ unsigned int *stuckid, *steedid;   /* STEED */
        migrating_mons = restmonchn(fd, FALSE);
        mread(fd, (genericptr_t) mvitals, sizeof(mvitals));
 
+       /*
+        * There are some things after this that can have unintended display
+        * side-effects too early in the game.
+        * Disable see_monsters() here, re-enable it at the top of moveloop()
+        */
+       defer_see_monsters = TRUE;
+
        /* this comes after inventory has been loaded */
        for(otmp = invent; otmp; otmp = otmp->nobj)
                if(otmp->owornmask)