random initial drawbridge state (trunk only)
Suggested by <Someone>: in the special level compiler, support
"random" in addition to "open" and "closed" for a drawbridge's inital
state. Drawbridge shares code with door, so the necessary parsing was
already present. This just treats random as valid for drawbridge instead
of explicitly rejecting it, and makes the special level loader process it.
He also suggested that the two drawbridges on the bottom level of
the Valk's quest be changed from open to random, but this patch doesn't
go that far. I think it's a good idea, but since the player can't use a
musicial instrument on those bridges, this has more impact on game play
than it might at first seem. I don't really want to see Valkyries be
required to use magic for occasions where both bridges start out closed.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)sp_lev.c 3.5 2006/05/09 */
|
||||
/* SCCS Id: @(#)sp_lev.c 3.5 2007/04/20 */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2405,7 +2405,9 @@ dlb *fd;
|
||||
x = tmpdb.x; y = tmpdb.y;
|
||||
get_location(&x, &y, DRY|WET);
|
||||
|
||||
if (!create_drawbridge(x, y, tmpdb.dir, tmpdb.db_open))
|
||||
typ = tmpdb.db_open;
|
||||
if (typ == 127) typ = rn2(2); /* 0 => closed, 1 => open */
|
||||
if (!create_drawbridge(x, y, tmpdb.dir, typ))
|
||||
impossible("Cannot create drawbridge.");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
|
||||
#define yyerrok (yyerrflag=0)
|
||||
#define YYRECOVERING (yyerrflag!=0)
|
||||
#define YYPREFIX "yy"
|
||||
/* SCCS Id: @(#)lev_yacc.c 3.5 2000/01/17 */
|
||||
/* SCCS Id: @(#)lev_yacc.c 3.5 2007/04/20 */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1812,8 +1812,10 @@ case 151:
|
||||
tmpdb[ndb]->db_open = 1;
|
||||
else if ( yyvsp[0].i == D_CLOSED )
|
||||
tmpdb[ndb]->db_open = 0;
|
||||
else if (yyvsp[0].i == -1) /* RANDOM_TYPE */
|
||||
tmpdb[ndb]->db_open = 127; /* random */
|
||||
else
|
||||
yyerror("A drawbridge can only be open or closed!");
|
||||
yyerror("A drawbridge can only be open, closed, or random!");
|
||||
ndb++;
|
||||
if (ndb >= MAX_OF_TYPE) {
|
||||
yyerror("Too many drawbridges in mazepart!");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%{
|
||||
/* SCCS Id: @(#)lev_yacc.c 3.5 2000/01/17 */
|
||||
/* SCCS Id: @(#)lev_yacc.c 3.5 2007/04/20 */
|
||||
/* Copyright (c) 1989 by Jean-Christophe Collet */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1062,8 +1062,10 @@ drawbridge_detail: DRAWBRIDGE_ID ':' coordinate ',' DIRECTION ',' door_state
|
||||
tmpdb[ndb]->db_open = 1;
|
||||
else if ( $<i>7 == D_CLOSED )
|
||||
tmpdb[ndb]->db_open = 0;
|
||||
else if ($<i>7 == -1) /* RANDOM_TYPE */
|
||||
tmpdb[ndb]->db_open = 127; /* random */
|
||||
else
|
||||
yyerror("A drawbridge can only be open or closed!");
|
||||
yyerror("A drawbridge can only be open, closed, or random!");
|
||||
ndb++;
|
||||
if (ndb >= MAX_OF_TYPE) {
|
||||
yyerror("Too many drawbridges in mazepart!");
|
||||
|
||||
Reference in New Issue
Block a user