X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fdo.c;h=8008272749c0cc5b3a873300082036f69384327c;hb=4755b4af1da1775cf009f0a8751d6ccd8807cf82;hp=085eb72de834acad30fe4cf7aa6b26323ca8e80b;hpb=c1324a2b46739bf54f89c951057b50f98bcb283c;p=jnethack%2Fsource.git diff --git a/src/do.c b/src/do.c index 085eb72..8008272 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1548978604 2019/01/31 23:50:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.189 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1576638499 2019/12/18 03:08:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.198 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -7,7 +7,7 @@ /* JNetHack Copyright */ /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */ -/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019 */ +/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2022 */ /* JNetHack may be freely redistributed. See license for details. */ #include "hack.h" @@ -183,8 +183,10 @@ const char *verb; struct trap *t; struct monst *mtmp; struct obj *otmp; +#if 0 /*JP*//*unused*/ boolean tseen; int ttyp = NO_TRAP; +#endif if (obj->where != OBJ_FREE) panic("flooreffects: obj not free"); @@ -196,8 +198,10 @@ const char *verb; return TRUE; } else if (obj->otyp == BOULDER && (t = t_at(x, y)) != 0 && (is_pit(t->ttyp) || is_hole(t->ttyp))) { +#if 0 /*JP*/ ttyp = t->ttyp; tseen = t->tseen ? TRUE : FALSE; +#endif if (((mtmp = m_at(x, y)) && mtmp->mtrapped) || (u.utrap && u.ux == x && u.uy == y)) { if (*verb && (cansee(x, y) || distu(x, y) == 0)) @@ -217,7 +221,7 @@ const char *verb; since trapped target is a sitting duck */ int damage, dieroll = 1; - /* 3.6.2: this was calling hmon() unconditionally + /* As of 3.6.2: this was calling hmon() unconditionally so always credited/blamed the hero but the boulder might have been thrown by a giant or launched by a rolling boulder trap triggered by a monster or @@ -327,7 +331,7 @@ const char *verb; } return water_damage(obj, NULL, FALSE) == ER_DESTROYED; } else if (u.ux == x && u.uy == y && (t = t_at(x, y)) != 0 - && uteetering_at_seen_pit(t)) { + && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) { if (Blind && !Deaf) /*JP You_hear("%s tumble downwards.", the(xname(obj))); @@ -335,10 +339,11 @@ const char *verb; You_hear("%s‚ª‰º‚Ì•û‚Ö“]‚ª‚Á‚Ä‚¢‚­‰¹‚ð•·‚¢‚½D", xname(obj)); else #if 0 /*JP*/ - pline("%s %s into %s pit.", The(xname(obj)), - otense(obj, "tumble"), the_your[t->madeby_u]); + pline("%s %s into %s %s.", The(xname(obj)), + otense(obj, "tumble"), the_your[t->madeby_u], + is_pit(t->ttyp) ? "pit" : "hole"); #else - pline("%s‚Í%s—Ž‚Æ‚µŒŠ‚É“]‚ª‚肨‚¿‚½D", xname(obj), + pline("%s‚Í%sŒŠ‚É“]‚ª‚肨‚¿‚½D", xname(obj), set_you[t->madeby_u]); #endif } else if (obj->globby) { @@ -378,17 +383,17 @@ register struct obj *obj; #else pline("%s‚ªÕ’d‚ɐG‚ê‚é‚Æ%sŒõ‚Á‚½D", doname(obj), - jconj_adj(hcolor(obj->blessed ? NH_AMBER : NH_BLACK))); + hcolor_adv(obj->blessed ? NH_AMBER : NH_BLACK)); #endif if (!Hallucination) - obj->bknown = 1; + obj->bknown = 1; /* ok to bypass set_bknown() */ } else { /*JP pline("%s %s on the altar.", Doname2(obj), otense(obj, "land")); */ pline("%s‚ðÕ’d‚̏ã‚É’u‚¢‚½D", Doname2(obj)); if (obj->oclass != COIN_CLASS) - obj->bknown = 1; + obj->bknown = 1; /* ok to bypass set_bknown() */ } } @@ -407,6 +412,7 @@ polymorph_sink() { uchar sym = S_sink; boolean sinklooted; + int algn; if (levl[u.ux][u.uy].typ != SINK) return; @@ -433,7 +439,11 @@ polymorph_sink() case 2: sym = S_altar; levl[u.ux][u.uy].typ = ALTAR; - levl[u.ux][u.uy].altarmask = Align2amask(rn2((int) A_LAWFUL + 2) - 1); + /* 3.6.3: this used to pass 'rn2(A_LAWFUL + 2) - 1' to + Align2amask() but that evaluates its argument more than once */ + algn = rn2(3) - 1; /* -1 (A_Cha) or 0 (A_Neu) or +1 (A_Law) */ + levl[u.ux][u.uy].altarmask = ((Inhell && rn2(3)) ? AM_NONE + : Align2amask(algn)); break; case 3: sym = S_room; @@ -718,14 +728,14 @@ register struct obj *obj; hcolor((obj->spe < 0) ? NH_BLACK : NH_SILVER)); #else pline("—¬‚µ‘ä‚͈êu%s‹P‚¢‚½D", - jconj_adj(hcolor((obj->spe < 0) ? NH_BLACK : NH_SILVER))); + hcolor_adv((obj->spe < 0) ? NH_BLACK : NH_SILVER)); #endif break; case RIN_WARNING: /*JP pline_The("sink glows %s for a moment.", hcolor(NH_WHITE)); */ - pline("—¬‚µ‘ä‚͈êu%s‹P‚¢‚½D", jconj_adj(hcolor(NH_WHITE))); + pline("—¬‚µ‘ä‚͈êu%s‹P‚¢‚½D", hcolor_adv(NH_WHITE)); break; case RIN_TELEPORT_CONTROL: /*JP: "beam aboard" ‚̓Xƒ^[ƒgƒŒƒbƒN‚́u“]‘—v*/ @@ -803,7 +813,7 @@ const char *word; #endif } obj->corpsenm = 0; /* reset */ - obj->bknown = 1; + set_bknown(obj, 1); return FALSE; } if (obj->otyp == LEASH && obj->leashmon != 0) { @@ -1274,9 +1284,33 @@ dodown() #endif return 0; /* didn't move */ } + + if (Upolyd && ceiling_hider(&mons[u.umonnum]) && u.uundetected) { + u.uundetected = 0; + if (Flying) { /* lurker above */ +/*JP + You("fly out of hiding."); +*/ + You("‰B‚ê‚é‚Ì‚ð‚â‚ß‚Ä”ò‚яo‚µ‚½D"); + } else { /* piercer */ +/*JP + You("drop to the %s.", surface(u.ux, u.uy)); +*/ + You("%s‚É—Ž‚¿‚½D", surface(u.ux, u.uy)); + if (is_pool_or_lava(u.ux, u.uy)) { + pooleffects(FALSE); + } else { + (void) pickup(1); + if ((trap = t_at(u.ux, u.uy)) != 0) + dotrap(trap, TOOKPLUNGE); + } + } + return 1; /* came out of hiding; might need '>' again to go down */ + } + if (!stairs_down && !ladder_down) { trap = t_at(u.ux, u.uy); - if (trap && uteetering_at_seen_pit(trap)) { + if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { dotrap(trap, TOOKPLUNGE); return 1; } else if (!trap || !is_hole(trap->ttyp) @@ -1337,7 +1371,9 @@ dodown() } if (trap) { +#if 0 /*JP*/ const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through"; +#endif #if 0 /*JP*/ const char *actn = Flying ? "fly" : locomotion(youmonst.data, "jump"); #else @@ -1729,6 +1765,16 @@ boolean at_stairs, falling, portal; } savelev(fd, ledger_no(&u.uz), cant_go_back ? FREE_SAVE : (WRITE_SAVE | FREE_SAVE)); + /* air bubbles and clouds are saved in game-state rather than with the + level they're used on; in normal play, you can't leave and return + to any endgame level--bubbles aren't needed once you move to the + next level so used to be discarded when the next special level was + loaded; but in wizard mode you can leave and return, and since they + aren't saved with the level and restored upon return (new ones are + created instead), we need to discard them to avoid a memory leak; + so bubbles are now discarded as we leave the level they're used on */ + if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) + save_waterlevel(-1, FREE_SAVE); bclose(fd); if (cant_go_back) { /* discard unreachable levels; keep #0 */ @@ -1788,10 +1834,16 @@ boolean at_stairs, falling, portal; reseed_random(rn2_on_display_rng); minit(); /* ZEROCOMP */ getlev(fd, hackpid, new_ledger, FALSE); + /* when in wizard mode, it is possible to leave from and return to + any level in the endgame; above, we discarded bubble/cloud info + when leaving Plane of Water or Air so recreate some now */ + if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) + restore_waterlevel(-1); (void) nhclose(fd); oinit(); /* reassign level dependent obj probabilities */ } reglyph_darkroom(); + u.uinwater = 0; /* do this prior to level-change pline messages */ vision_reset(); /* clear old level's line-of-sight */ vision_full_recalc = 0; /* don't let that reenable vision yet */