From: Sean Hunt Date: Sun, 24 May 2015 15:32:45 +0000 (+0900) Subject: Convert the vibrating square to a trap X-Git-Tag: NetHack-3.6.0_RC01~367 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26ee7dc3704ff292ea59458a739c602fe10d8d17;p=nethack Convert the vibrating square to a trap Patch due to ais523 in NetHack 4. This is not ready to be merged yet; the vibrating square needs a tile image for tiles builds. --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index a72aa514a..7032dbc9d 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -917,6 +917,7 @@ uncursed enchant weapon now correctly fixes erosion scroll of earth messages cleaned up long worms can no longer be leashed the chest in the Castle containing the wishing wand can never be trapped +the vibrating square is now a trap Platform- and/or Interface-Specific Fixes diff --git a/include/rm.h b/include/rm.h index 0af8aa011..58631bfbe 100644 --- a/include/rm.h +++ b/include/rm.h @@ -216,7 +216,7 @@ /* end effects */ -#define MAXPCHARS 95 /* maximum number of mapped characters */ +#define MAXPCHARS 96 /* maximum number of mapped characters */ #define MAXDCHARS 42 /* maximum of mapped dungeon characters */ #define MAXTCHARS 22 /* maximum of mapped trap characters */ #define MAXECHARS 31 /* maximum of mapped effects characters */ diff --git a/include/trap.h b/include/trap.h index 8aa989028..8234fc2c2 100644 --- a/include/trap.h +++ b/include/trap.h @@ -78,6 +78,7 @@ extern struct trap *ftrap; #define MAGIC_TRAP 20 #define ANTI_MAGIC 21 #define POLY_TRAP 22 -#define TRAPNUM 23 +#define VIBRATING_SQUARE 23 +#define TRAPNUM 24 #endif /* TRAP_H */ diff --git a/src/dig.c b/src/dig.c index a659ff130..9c194269f 100644 --- a/src/dig.c +++ b/src/dig.c @@ -220,6 +220,7 @@ int x, y; && (levl[x][y].wall_info & W_NONDIGGABLE) != 0) || (ttmp && (ttmp->ttyp == MAGIC_PORTAL + || ttmp->ttyp == VIBRATING_SQUARE || (!Can_dig_down(&u.uz) && !levl[x][y].candig)))) { if (verbose) pline_The("%s here is too hard to %s.", surface(x, y), verb); @@ -778,7 +779,8 @@ coord *cc; lev = &levl[dig_x][dig_y]; nohole = (!Can_dig_down(&u.uz) && !lev->candig); - if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL || nohole)) + if ((ttmp && (ttmp->ttyp == MAGIC_PORTAL + || ttmp->ttyp == VIBRATING_SQUARE || nohole)) || (IS_ROCK(lev->typ) && lev->typ != SDOOR && (lev->wall_info & W_NONDIGGABLE) != 0)) { pline_The("%s %shere is too hard to dig in.", surface(dig_x, dig_y), diff --git a/src/dothrow.c b/src/dothrow.c index 0b6296058..af25f096d 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -619,6 +619,9 @@ int x, y; if (ttmp->ttyp == MAGIC_PORTAL) { dotrap(ttmp, 0); return FALSE; + } else if (ttmp->ttyp == VIBRATING_SQUARE) { + pline("The ground vibrates as you pass it."); + dotrap(ttmp, 0); /* doesn't print messages */ } else if (ttmp->ttyp == FIRE_TRAP) { dotrap(ttmp, 0); } else if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT diff --git a/src/drawing.c b/src/drawing.c index 60ee41685..f46435c21 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -204,14 +204,15 @@ const struct symdef defsyms[MAXPCHARS] = { { '^', "magic trap", C(HI_ZAP) }, /* trap */ { '^', "anti-magic field", C(HI_ZAP) }, /* trap */ { '^', "polymorph trap", C(CLR_BRIGHT_GREEN) }, /* trap */ + { '^', "vibrating square", C(CLR_YELLOW) }, /* trap */ { '|', "wall", C(CLR_GRAY) }, /* vbeam */ { '-', "wall", C(CLR_GRAY) }, /* hbeam */ { '\\', "wall", C(CLR_GRAY) }, /* lslant */ { '/', "wall", C(CLR_GRAY) }, /* rslant */ { '*', "", C(CLR_WHITE) }, /* dig beam */ { '!', "", C(CLR_WHITE) }, /* camera flash beam */ - /*70*/ { ')', "", C(HI_WOOD) }, /* boomerang open left */ - { '(', "", C(HI_WOOD) }, /* boomerang open right */ + { ')', "", C(HI_WOOD) }, /* boomerang open left */ + /*70*/ { '(', "", C(HI_WOOD) }, /* boomerang open right */ { '0', "", C(HI_ZAP) }, /* 4 magic shield symbols */ { '#', "", C(HI_ZAP) }, { '@', "", C(HI_ZAP) }, @@ -222,8 +223,8 @@ const struct symdef defsyms[MAXPCHARS] = { C(CLR_BRIGHT_GREEN) }, /* valid position for targeting */ { '/', "", C(CLR_GREEN) }, /* swallow top left */ { '-', "", C(CLR_GREEN) }, /* swallow top center */ - /*80*/ { '\\', "", C(CLR_GREEN) }, /* swallow top right */ - { '|', "", C(CLR_GREEN) }, /* swallow middle left */ + { '\\', "", C(CLR_GREEN) }, /* swallow top right */ + /*80*/ { '|', "", C(CLR_GREEN) }, /* swallow middle left */ { '|', "", C(CLR_GREEN) }, /* swallow middle right */ { '\\', "", C(CLR_GREEN) }, /* swallow bottom left */ { '-', "", C(CLR_GREEN) }, /* swallow bottom center*/ @@ -232,8 +233,8 @@ const struct symdef defsyms[MAXPCHARS] = { { '-', "", C(CLR_ORANGE) }, /* explosion top center */ { '\\', "", C(CLR_ORANGE) }, /* explosion top right */ { '|', "", C(CLR_ORANGE) }, /* explosion middle left */ - /*90*/ { ' ', "", C(CLR_ORANGE) }, /* explosion middle center*/ - { '|', "", C(CLR_ORANGE) }, /* explosion middle right */ + { ' ', "", C(CLR_ORANGE) }, /* explosion middle center*/ + /*90*/ { '|', "", C(CLR_ORANGE) }, /* explosion middle right */ { '\\', "", C(CLR_ORANGE) }, /* explosion bottom left */ { '-', "", C(CLR_ORANGE) }, /* explosion bottom center*/ { '/', "", C(CLR_ORANGE) }, /* explosion bottom right */ diff --git a/src/mklev.c b/src/mklev.c index 02d90200e..5d33569b0 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -476,7 +476,7 @@ static NEARDATA const char *trap_engravings[TRAPNUM] = { (char *) 0, (char *) 0, (char *) 0, (char *) 0, /* 14..16: trap door, teleport, level-teleport */ "Vlad was here", "ad aerarium", "ad aerarium", (char *) 0, (char *) 0, - (char *) 0, (char *) 0, (char *) 0, (char *) 0, + (char *) 0, (char *) 0, (char *) 0, (char *) 0, (char *) 0, }; STATIC_OVL void @@ -1295,6 +1295,7 @@ coord *tm; /* reject "too hard" traps */ switch (kind) { case MAGIC_PORTAL: + case VIBRATING_SQUARE: kind = NO_TRAP; break; case ROLLING_BOULDER_TRAP: diff --git a/src/mkmaze.c b/src/mkmaze.c index 842e0f72a..1b649ca87 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -298,7 +298,7 @@ d_level *lev; It might still fail if there's a dungeon feature here. */ struct trap *t = t_at(x, y); - if (t && t->ttyp != MAGIC_PORTAL) + if (t && t->ttyp != MAGIC_PORTAL && t->ttyp != VIBRATING_SQUARE) deltrap(t); if (bad_location(x, y, nlx, nly, nhx, nhy)) return FALSE; @@ -619,6 +619,7 @@ register const char *s; || !SPACE_POS(levl[x][y].typ) || occupied(x, y)); inv_pos.x = x; inv_pos.y = y; + maketrap(inv_pos.x, inv_pos.y, VIBRATING_SQUARE); #undef INVPOS_X_MARGIN #undef INVPOS_Y_MARGIN #undef INVPOS_DISTANCE diff --git a/src/polyself.c b/src/polyself.c index 0083a9c07..58e516882 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1173,6 +1173,7 @@ dospinweb() case TELEP_TRAP: case LEVEL_TELEP: case MAGIC_PORTAL: + case VIBRATING_SQUARE: Your("webbing vanishes!"); return (0); case WEB: diff --git a/src/sp_lev.c b/src/sp_lev.c index 6a3c64313..2c92f0dd6 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -735,6 +735,7 @@ rndtrap() rtrap = rnd(TRAPNUM - 1); switch (rtrap) { case HOLE: /* no random holes on special levels */ + case VIBRATING_SQUARE: case MAGIC_PORTAL: rtrap = NO_TRAP; break; diff --git a/src/trap.c b/src/trap.c index 0870bb76c..5123dff32 100644 --- a/src/trap.c +++ b/src/trap.c @@ -314,7 +314,7 @@ register int x, y, typ; register boolean oldplace; if ((ttmp = t_at(x, y)) != 0) { - if (ttmp->ttyp == MAGIC_PORTAL) + if (ttmp->ttyp == MAGIC_PORTAL || ttmp->ttyp == VIBRATING_SQUARE) return (struct trap *) 0; oldplace = TRUE; if (u.utrap && (x == u.ux) && (y == u.uy) @@ -826,8 +826,8 @@ unsigned trflags; defsyms[trap_to_defsym(ttype)].explanation); return; } - if (!Fumbling && ttype != MAGIC_PORTAL && ttype != ANTI_MAGIC - && !forcebungle && !plunged && !adj_pit + if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE + && ttype != ANTI_MAGIC && !forcebungle && !plunged && !adj_pit && (!rn2(5) || ((ttype == PIT || ttype == SPIKED_PIT) && is_clinger(youmonst.data)))) { You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u) @@ -1426,6 +1426,11 @@ unsigned trflags; feeltrap(trap); domagicportal(trap); break; + case VIBRATING_SQUARE: + seetrap(trap); + /* messages handled elsewhere; the trap symbol is merely to mark the + * square for future reference */ + break; default: feeltrap(trap); @@ -2590,6 +2595,18 @@ register struct monst *mtmp; } break; + case VIBRATING_SQUARE: + if (see_it && !Blind) { + if (in_sight) + pline("You see a strange vibration beneath %s %s.", + s_suffix(mon_nam(mtmp)), + makeplural(mbodypart(mtmp, FOOT))); + else + pline("You see the ground vibrate in the distance."); + seetrap(trap); + } + break; + default: impossible("Some monster encountered a strange trap of type %d.", tt); diff --git a/util/lev_main.c b/util/lev_main.c index c2ce813c6..fa64ae905 100644 --- a/util/lev_main.c +++ b/util/lev_main.c @@ -173,6 +173,7 @@ static struct { { "magic", MAGIC_TRAP }, { "anti magic", ANTI_MAGIC }, { "polymorph", POLY_TRAP }, + { "vibrating square", VIBRATING_SQUARE }, { 0, 0 } }; static struct {