Merge branch 'master' into nhmall-booktribute

This commit is contained in:
nhmall
2015-04-10 12:15:14 -04:00
42 changed files with 2016 additions and 855 deletions
+34 -3
View File
@@ -24,6 +24,7 @@ CONTENTS
4. git configuration
5. variable expansion
6. reserved names
7. nhadd/nhcommit
------------------------------------------------------------------------------
1. email
Email to devteam@nethack.org will usually get a response, but it may take a
@@ -52,7 +53,9 @@ XXX windows
XXX linux
B. Specify the prefix for variable substitution:
(This assumes you are not a member of DevTeam or any variant's development
team. If you are, this may be wrong. Look for more specific documentation.)
team. If you are, this may be wrong. Look for more specific documentation.
For example, this file uses "MINE" for the substitution prefix - this will
almost always be wrong if you are working with someone else.)
Decide where you want to put this info; it should NOT be inside the
tree you cloned from git. I use ~/nethack/GITADDDIR; for that base,
create the needed directories and edit the file:
@@ -82,8 +85,7 @@ D. aliases
nhadd
nhcommit
These two commands take the same options as the normal git add and commit
commands but perform RCS/CVS-style variable substitution. Note that the
substitutions do not show up in the working directory.
commands but perform RCS/CVS-style variable substitution.
Note that nothing terrible will happen if you do not use the nh* versions
of the commands.
@@ -94,6 +96,12 @@ D. aliases
MINE-Revision CVS style revision number
MINE-Branch the current git branch
For direct access to the substitution mechanism, use:
nhsub
See the section "nhadd/nhcommit" for details on those aliases.
Run "perldoc DEVEL/hooksdir/nhsub" for details on nhsub.
That's it. If you need to do something more when setting up your repository,
keep reading. Otherwise, you are done with this section.
@@ -165,3 +173,26 @@ D. Using your own hooks
Anything that matches m/^nh/i or m/^nethack/i is reserved in all
namespaces (environment, file names, git config, etc).
------------------------------------------------------------------------------
7. nhadd/nhcommit
nhadd is essentially "git nhsub $*; git add $*"
nhcommit is essentially "git nhsub $*; git commit $*"
As "git add" and "git commit" have complex arguments, nhsub attempts to
do the right thing - or at least something reasonable - for most arguments.
If nhadd/nhcommit don't do what you need, run "git nhsub" on its own then
add/commit.
So when do I need to use what?
The object is to get nhsub run right before git takes a snapshot of each
file. So for example:
- use "git nhcommit <filespec>" instead of "git commit <filespec>"
- use "git nhadd <filespec>" instead of "git add <filespec>"
- use either "git commit" or "git nhcommit" (because the snapshot was
already taken)
- if you use "git nhsub <filespec>" then you can "git add <filespec>" or
"git commit <filespec>"
For more complex situations, "git nhsub" takes -v and -n flags - see
"perldoc DEVEL/hooksdir/nhsub".
------------------------------------------------------------------------------
+108 -10
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# nhsub
# $NHDT-Date: 1427913635 2015/04/01 18:40:35 $
# $NHDT-Date: 1427408239 2015/03/26 22:17:19 $
# Note: was originally called nhdate; the rename is not reflected in the code.
@@ -27,7 +27,11 @@ my %codes = (
'd M'=>0, 'd D'=>0,
'c M'=>0, 'c D'=>0,
# M [ MD] updated in index
'dM '=>0, 'dMM'=>1, 'dMD'=>0,
'aM '=>0, 'aMM'=>1, 'aMD'=>0,
'cM '=>0, 'cMM'=>1, 'cMD'=>0,
'fM '=>0, 'fMM'=>1, 'fMD'=>0,
# M [ MD] updated in index
'dA '=>1, 'dAM'=>1, 'dAD'=>1,
'aA '=>1, 'aAM'=>1, 'aAD'=>1,
@@ -41,9 +45,17 @@ my %codes = (
'fD '=>1, 'fDM'=>1,
# D [ M] deleted from index
# R [ MD] renamed in index
'dR '=>0, 'dRM'=>1, 'dRD'=>0,
'aR '=>0, 'aRM'=>1, 'aRD'=>0,
'cR '=>0, 'cRM'=>1, 'cRD'=>0,
'fR '=>0, 'fRM'=>1, 'fRD'=>0,
# R [ MD] renamed in index
# C [ MD] copied in index
'dC '=>0, 'dCM'=>1, 'dCD'=>0,
'aC '=>0, 'aCM'=>1, 'aCD'=>0,
'cC '=>0, 'cCM'=>1, 'cCD'=>0,
'fC '=>0, 'fCM'=>1, 'fCD'=>0,
# C [ MD] copied in index
'aM '=>1, 'aA '=>1, 'aR '=>1, 'aC '=>1,
'fM '=>1, 'fA '=>1, 'fR '=>1, 'fC '=>1,
@@ -87,13 +99,48 @@ if ($^O eq "MSWin32")
$PDS = '\\';
}
# pick up the prefix for substitutions in this repo
my $PREFIX = &git_config('nethack','substprefix');
print "PREFIX: '$PREFIX'\n" if($opt{v});
# various command line options to consider and what the code actually does:
#DONE nhcommit with no files should exit(0)
#DONE nhadd with no files should exit(0)
#DONE commit -a?
# add root dir
#DONE commit -a + files -> exit(0)
#nothing: commit --interactive/--patch
#nothing: add -i/--interactive --patch/-p?
#nothing: add -u/--update?????? -A/--all/--no-ignore-removal???
#nothing (not quite right): add --no-all --ignore-removal???
#DONE add --refresh
#nothing: add -N/--intent-to-add
#DONE add -n - exit(0)
#DONE add --dry-run - exit 0
#DONE commit --dry-run - exit 0
#DONE?: add foo/\*/x (letting git expand the filenames)
my @rawlist0 = &cmdparse(@ARGV);
# Use git ls-files to expand command line filepaths with wildcards.
# Let's try this for all commands.
my @rawlist;
foreach my $e (@rawlist0){
if($e =~ m/[?*[\\]/){
my @rv = &lsfiles(undef, $e);
push(@rawlist, @rv) if(@rv);
if($opt{f}){
my @rv = &lsfiles('-i', $e);
push(@rawlist, @rv) if(@rv);
}
} else {
push(@rawlist, $e);
}
}
my @rawlist = &cmdparse(@ARGV);
push(@rawlist,'.') if($#rawlist == -1);
# pick up the prefix for substitutions in this repo
#TEST my $PREFIX = &git_config('nethack','substprefix');
my $PREFIX = "NHDT";
print "PREFIX: '$PREFIX'\n" if($opt{v});
while(@rawlist){
my $raw = shift @rawlist;
if(-f $raw){
@@ -201,7 +248,21 @@ my $count = s/\$$PREFIX-(([A-Za-z][A-Za-z0-9_]*)(: ([^\x24]+))?)\$/&handlevar($2
my $ofile = $file . ".nht";
open(TOUT, ">", $ofile) or die "Can't open $ofile";
die "write failed: $!" unless defined syswrite(TOUT, $_);
#XXX MUST add a loop here
# die "write failed: $!" unless defined syswrite(TOUT, $_);
my $offset = 0;
my $sent;
#print STDERR "L=",length,"\n";
while($offset < length){
$sent = syswrite(TOUT, $_, (length($_) - $offset), $offset);
die "write failed: $!" unless defined($sent);
#print STDERR "rv=$sent\n";
last if($sent == (length($_) - $offset));
$offset += $sent;
#print STDERR "loop: O=$offset\n";
}
close TOUT or die "Can't close $ofile";
rename $ofile, $file or die "Can't rename $ofile to $file";
}
@@ -230,8 +291,14 @@ sub cmdparse {
last;
}
if(m/^--/){
if($opt{cmd} eq 'add' && $_ eq '--dry-run'){
exit 0;
}
if($opt{cmd} eq 'commit' && $_ eq '--dry-run'){
$opt{'n'} = 1;
exit 0;
}
if($opt{cmd} eq 'add' && $_ eq '--refresh'){
exit 0;
}
shift @in;
next;
@@ -244,6 +311,10 @@ sub cmdparse {
} elsif($opt{cmd} eq 'date'){
$opt{$single}++;
}
if($opt{cmd} eq 'add' && $single eq 'n'){
exit 0;
}
}
}
shift @in;
@@ -253,6 +324,20 @@ sub cmdparse {
$mode = 'f' if($opt{cmd} eq 'date' && ($opt{f}||$opt{F}));
$mode = 'f' if($opt{cmd} eq 'add' && $opt{f});
if($opt{cmd} eq 'add' && $#in == -1){
exit 0;
}
if($opt{cmd} eq 'commit' && $#in == -1){
exit 0;
}
if($opt{cmd} eq 'add' && $opt{a} && $#in != -1){
exit 0;
}
if($opt{cmd} eq 'add' && $opt{a}){
my $x = `git rev-parse --show-toplevel`;
$x =~ s/[\n\r]+$//;
push(@in, $x);
}
return @in; # this is our file list
}
@@ -286,6 +371,19 @@ sub handlevar {
}
}
sub lsfiles {
my ($flags, $ps) = @_;
open RV, "-|", "git ls-files $flags '$ps'" or die "Can't ls-files";
my @rv = <RV>;
map { s/[\r\n]+$// } @rv;
if(!close RV){
return undef if($! == 0);
die "close ls-files failed: $!";
}
return undef if($#rv == -1);
return @rv;
}
package PREFIX;
use POSIX qw(strftime);
+11 -11
View File
@@ -112,18 +112,18 @@ FLAGS: hardfloor
INIT_MAP: mines, '.' , 'P' , false , true , lit , false
GEOMETRY:center,center
MAP
...PPP.........PPPP..............PPPP...
.PPPP...........PP................PPPP..
PP.................................PPP..
....................................PPP.
.....................................PP.
.......................................P
xxxxxxxxx......xxxx...........xxxxxxxxxx
xxxxxxx.........xxx.............xxxxxxxx
xxxx..............................xxxxxx
xx.................................xxxxx
....................................xxxx
.......................................x
........................................
PP...................................PPP
.PPP...............................PPP..
..PP.............................PPPP...
..PPP...........................PPPPPP..
....PPPP.........PPP.........PPPP..PP...
xx...................................xxx
xxxx..............................xxxxxx
xxxxxx..........................xxxxxxxx
xxxxxxxx.........xx..........xxxxxxxxxxx
xxxxxxxxx.......xxxxxx.....xxxxxxxxxxxxx
ENDMAP
# Dungeon Description
# The Isle of Glass is a Tor rising out of the swamps surrounding it.
+11 -11
View File
@@ -203,17 +203,17 @@ MAZE: "Mon-goal", ' '
INIT_MAP: mines, 'L' , '.' , false , false , unlit , false
GEOMETRY:center,center
MAP
.L......L.LLL.......LL....
.LLL.......L......LL......
LL.LL.............L.LL....
..........................
......................LL..
......................LLL.
LL........................
.LL.......................
.LL................LL.L...
..LL.....L.LL.......LLL...
.........LLL.........L....
xxxxxx..xxxxxx...xxxxxxxxx
xxxx......xx......xxxxxxxx
xx.xx.............xxxxxxxx
x....................xxxxx
......................xxxx
......................xxxx
xx........................
xxx......................x
xxx................xxxxxxx
xxxx.....x.xx.......xxxxxx
xxxxx...xxxxxx....xxxxxxxx
ENDMAP
# Dungeon Description
$place = { (14,04),(13,07) }
+11 -11
View File
@@ -186,17 +186,17 @@ MAZE: "Pri-goal", ' '
INIT_MAP: mines, 'L' , '.' , false , false , unlit , false
GEOMETRY:center,center
MAP
.L......L.LLL.......LL....
.LLL.......L......LL......
LL.LL.............L.LL....
..........................
......................LL..
......................LLL.
LL........................
.LL.......................
.LL................LL.L...
..LL.....L.LL.......LLL...
.........LLL.........L....
xxxxxx..xxxxxx...xxxxxxxxx
xxxx......xx......xxxxxxxx
xx.xx.............xxxxxxxx
x....................xxxxx
......................xxxx
......................xxxx
xx........................
xxx......................x
xxx................xxxxxxx
xxxx.....x.xx.......xxxxxx
xxxxx...xxxxxx....xxxxxxxx
ENDMAP
# Dungeon Description
$place = { (14,04),(13,07) }
+24 -24
View File
@@ -94,19 +94,19 @@ FLAGS: hardfloor,icedpools
INIT_MAP: mines, '.', 'I', true, true, lit, false
GEOMETRY:center,center
MAP
PPPP.... ....PPPPP.
PLP... .PPLLLPP
PPPPxxxx xxxxPPPPPx
PLPxxx xPPLLLPP
PPP ....................... PPPLLP
.. ............................ PPPP
. ............................... ....
................................. ..
.................................... .
xx ............................ PPPP
x ............................... xxxx
................................. xx
.................................... x
...................................
. .................................. .
.. .............................. PP
.PPP .......................... PLP
.PLLP ..PLLP
.PPPP.. ....PPPP
x .................................. x
xx .............................. PP
xPPP .......................... PLP
xPLLP xxPLLP
xPPPPxx xxxxPPPP
ENDMAP
# Dungeon Description
REGION:(00,00,39,12),lit,"ordinary"
@@ -180,23 +180,23 @@ FLAGS: icedpools
INIT_MAP: mines, '.', 'L', true, true, lit, false
GEOMETRY:center,center
MAP
.L............................LLLLL
LLL.........LLLLL.LLLLL.........LLL
.LLL......LLLLLLLLLLLLLLL.......LL.
.LLL.....LLL|---------|LLL.....L...
..LL....LL|--.........--|LL.....LLL
.......LL|-...LLLLLLL...-|LL.....L.
.......LL|...LL.....LL...|LL.......
xxxxxx.....................xxxxxxxx
xxxxx.......LLLLL.LLLLL......xxxxxx
xxxx......LLLLLLLLLLLLLLL......xxxx
xxxx.....LLL|---------|LLL.....xxxx
xxxx....LL|--.........--|LL.....xxx
x......LL|-...LLLLLLL...-|LL.....xx
.......LL|...LL.....LL...|LL......x
......LL|-..LL.......LL..-|LL......
......LL|.................|LL......
......LL|-..LL.......LL..-|LL......
.......LL|...LL.....LL...|LL.......
.......LL|-...LLLLLLL...-|LL.......
..L.....LL|--.........--|LL.....LL.
..LL.....LLL|---------|LLL....LLLL.
..LLL.....LLLLLLLLLLLLLLL...LLLLL..
.LLLL.......LLLLL.LLLLL.....LLLL...
..LL...............................
xx.....LL|-...LLLLLLL...-|LL......x
xxx.....LL|--.........--|LL.....xxx
xxxx.....LLL|---------|LLL...xxxxxx
xxxxx.....LLLLLLLLLLLLLLL...xxxxxxx
xxxxxx......LLLLL.LLLLL.....xxxxxxx
xxxxxxxxx..................xxxxxxxx
ENDMAP
# Dungeon Description
REGION:(00,00,34,16),lit,"ordinary"
+239
View File
@@ -436,3 +436,242 @@ MONSTER:random,random
MONSTER:random,random
MONSTER:random,random
MONSTER:random,random
# The Four Circles
LEVEL:"bigrm-6"
FLAGS:mazelevel
INIT_MAP:solidfill,' '
GEOMETRY:center,center
MAP
--------- --------- --------- ---------
---.......--- ---.......--- ---.......--- ---.......---
--...........-- --...........-- --...........-- --...........--
--.............-- --.............-- --.............-- --.............--
-...............- -...............- -...............- -...............-
|-...............---...............---...............---...............--
|.................-.................-.................-.................|
|........T.................T.................T.................T........|
|.......................................................................|
|......T.{.....................................................{.T......|
|.......................................................................|
|........T.................T.................T.................T........|
|.................-.................-.................-.................|
--...............---...............---...............---...............--
-...............- -...............- -...............- -...............-
--.............-- --.............-- --.............-- --.............--
--...........-- --...........-- --...........-- --...........--
---.......--- ---.......--- ---.......--- ---.......---
--------- --------- --------- ---------
ENDMAP
REGION:(01,01,72,17),lit,"ordinary"
STAIR:random,up
STAIR:random,down
NON_DIGGABLE:(00,00,72,18)
LOOP [15] {
OBJECT:random,random
}
LOOP [6] {
TRAP:random,random
}
LOOP [28] {
MONSTER:random,random
}
# Let's tilt it a bit
LEVEL:"bigrm-7"
FLAGS:mazelevel
INIT_MAP:solidfill,' '
GEOMETRY:center,center
MAP
-----
---------...---
---------.........L...---
---------.......................---
---------.................................---
---------...........................................---
---------.....................................................---
|--------...............................................................--|
|.........................................................................|
|.L.....................................................................L.|
|.........................................................................|
|--...............................................................--------|
---.....................................................---------
---...........................................---------
---.................................---------
---.......................---------
---...L.........---------
---...---------
-----
ENDMAP
$terrain = terrain:{ 'L', 'T', '{', '.' }
SHUFFLE:$terrain
REPLACE_TERRAIN:(00,00,74,18),'L',$terrain[0],100%
REGION:(01,01,73,17),lit,"ordinary"
STAIR:random,up
STAIR:random,down
NON_DIGGABLE:(00,00,74,18)
LOOP [15] {
OBJECT:random,random
}
LOOP [6] {
TRAP:random,random
}
LOOP [28] {
MONSTER:random,random
}
# Slanted
LEVEL:"bigrm-8"
FLAGS:mazelevel
INIT_MAP:solidfill,' '
GEOMETRY:center,center
MAP
----------------------------------------------
|............................................---
--.............................................---
---......................................FF.....---
---...................................FF........---
---................................FF...........---
---.............................FF..............---
---..........................FF.................---
---.......................FF....................---
---....................FF.......................---
---.................FF..........................---
---..............FF.............................---
---...........FF................................----
---........FF...................................---
---.....FF......................................---
---.............................................--
---............................................|
----------------------------------------------
ENDMAP
REGION:(01,01,73,16),lit,"ordinary"
STAIR:random,up
STAIR:random,down
NON_DIGGABLE:(00,00,74,17)
LOOP [15] {
OBJECT:random,random
}
LOOP [6] {
TRAP:random,random
}
LOOP [28] {
MONSTER:random,random
}
# The Eye
LEVEL:"bigrm-9"
FLAGS:mazelevel
GEOMETRY:center,center
MAP
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}................................}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}............................................}}}}}}}}}}}}}}}
}}}}}}}}}}......................................................}}}}}}}}}}
}}}}}}}............................................................}}}}}}}
}}}}}.......................LLLLLLLLLLLLLLLLLL.......................}}}}}
}}}....................LLLLLLLLLLLLLLLLLLLLLLLLLLL.....................}}}
}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................}
}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................}
}....................LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL....................}
}}}....................LLLLLLLLLLLLLLLLLLLLLLLLLLL.....................}}}
}}}}}.......................LLLLLLLLLLLLLLLLLL.......................}}}}}
}}}}}}}............................................................}}}}}}}
}}}}}}}}}}......................................................}}}}}}}}}}
}}}}}}}}}}}}}}}............................................}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}................................}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}................}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
ENDMAP
# Unlit, except 3 mapgrids around the "pupil"
REGION:(00,00,73,18),unlit,"ordinary"
REGION:(26,04,47,14),lit,"ordinary"
REGION:(21,05,51,13),lit,"ordinary"
REGION:(19,06,54,12),lit,"ordinary"
STAIR:random,up
STAIR:random,down
LOOP [15] {
OBJECT:random,random
}
LOOP [6] {
TRAP:random,random
}
LOOP [28] {
MONSTER:random,random
}
# Fog Maze
LEVEL:"bigrm-10"
FLAGS:mazelevel
GEOMETRY:center,center
MAP
.......................................................................
.......................................................................
.......................................................................
.......................................................................
...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C...
...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...
...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C...
...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...
...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C...
...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...
...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C...
...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...
...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C...
...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...
...C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C...
.......................................................................
.......................................................................
.......................................................................
.......................................................................
ENDMAP
REGION:(00,00,70,18),lit,"ordinary"
# when falling down on this level, never end up in the fog maze
TELEPORT_REGION:(00,00,70,18),(02,03,68,15),down
LOOP [15] {
OBJECT:random,random
}
LOOP [6] {
TRAP:random,random
}
LOOP [28] {
MONSTER:random,random
}
MAZEWALK:(4, 2), south
# Stairs up, not in the fog maze
STAIR:(00,00,70,18),(02,03,68,15),up
STAIR:random,down
+2 -2
View File
@@ -24,10 +24,10 @@ LEVELDESC: roguelike
LEVEL: "oracle" "O" @ (5, 5)
LEVALIGN: neutral
CHAINBRANCH: "Sokoban" "oracle" + (1, 0) up
RNDLEVEL: "bigrm" "B" @ (10, 3) 40 5
RNDLEVEL: "bigrm" "B" @ (10, 3) 40 10
CHAINBRANCH: "The Quest" "oracle" + (6, 2) portal
BRANCH: "Fort Ludios" @ (18, 4) portal
RNDLEVEL: "medusa" "none" @ (-5, 4) 2
RNDLEVEL: "medusa" "none" @ (-5, 4) 4
LEVALIGN: chaotic
LEVEL: "castle" "none" @ (-1, 0)
CHAINBRANCH: "Gehennom" "castle" + (0, 0) no_down
+28 -24
View File
@@ -163,43 +163,43 @@ INIT_MAP:mines,'.','}',true,true,unlit,false
# guarantee at least one open spot to ensure successful stair placement
GEOMETRY:left,bottom
MAP
}}}}}}}}
}}...}}}
}}}...}}
}}}}.}}}
}}}}}}}}
xxxxxxxx
xx...xxx
xxx...xx
xxxx.xxx
xxxxxxxx
ENDMAP
OBJECT:('`',"boulder"),random
GEOMETRY:right,top
MAP
}}}}}}}}
}}}}.}}}
}}}...}}
}}...}}}
}}}}}}}}
xxxxxxxx
xxxx.xxx
xxx...xx
xx...xxx
xxxxxxxx
ENDMAP
OBJECT:('`',"boulder"),random
# lair
GEOMETRY:center,center
MAP
..}}}}}.}}}}}.}}}}}.}}}}}.}}}}}.}}}}}.}}}}}.}}}}}..
.}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}.
xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx
x}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x
}}}...}}..}}.}.}}.}}.}}}...}}}.}}}..}}}..}}}}...}}}
.}}}.}}.}}}.}}.}}.}}...}}.}}.....}}.....}....}.}}}.
..}}}..}}}.}}.}}.}}..}}.....}}.}}}.}}.}}}}}}}}}}}..
.}}}..}}}}}.}}.}}.}}...}}}}}.....}}.}}}}}}.....}}}.
x}}}.}}.}}}.}}.}}.}}...}}.}}.....}}.....}....}.}}}x
xx}}}..}}}.}}.}}.}}..}}.....}}.}}}.}}.}}}}}}}}}}}xx
x}}}..}}}}}.}}.}}.}}...}}}}}.....}}.}}}}}}.....}}}x
}}}..}}...}}..}}.}}}.}}}...}}}.}}}.}.}}}}..P.P..}}}
}}.}}}}...}}}}}.}...}}}..P..}}}.}.}}}.}}}}.....}}}}
}.}}}}.}}.}..}.}}}}}}}..P.P..}}}.}}}.}}..}}...}}}}.
.}}}}.}}}}....}}}}}.}}}..P..}}}.}}}}.}}..}}...}}}.}
}.}}}}.}}.}..}.}}}}}}}..P.P..}}}.}}}.}}..}}...}}}}x
x}}}}.}}}}....}}}}}.}}}..P..}}}.}}}}.}}..}}...}}}.}
}}}}..}}.}}..}}}}...}}}}...}}}.}}}}}.}}}}.}}}}}}.}}
}}}...}}...}}}..}}}}}}}}}}}}.....}}}}.}}...}..}.}}}
.}}}..}}.}}}}....}}..}}}..}}.....}}}}.}}}.}....}}}.
..}}}.}}}}..}}..}}..}}..}}..}}.}}}..}.}..}}}..}}}..
.}}}.}}}}....}}}}..}}....}}}}}}}...}}}....}}}}.}}}.
x}}}..}}.}}}}....}}..}}}..}}.....}}}}.}}}.}....}}}x
xx}}}.}}}}..}}..}}..}}..}}..}}.}}}..}.}..}}}..}}}xx
x}}}.}}}}....}}}}..}}....}}}}}}}...}}}....}}}}.}}}x
}}}...}}}....}}}..}}}....}}}..}}...}}}....}}}...}}}
.}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}.
..}}}}}.}}}}}.}}}}}.}}}}}.}}}}}.}}}}}.}}}}}.}}}}}..
x}}}.}}}}}..}}}..}}}}}..}}}..}}}}}..}}}..}}}}}.}}}x
xx}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}x}}}}}xx
ENDMAP
# Random registers
$monster = monster: { 'j','b','P','F' }
@@ -502,8 +502,8 @@ TRAP:"magic", random
#
# The Baalzebub level
#
MAZE:"baalz",random
FLAGS: noteleport
MAZE:"baalz",' '
FLAGS: noteleport,corrmaze
GEOMETRY:right,center
MAP
-------------------------------------------------
@@ -561,6 +561,10 @@ MONSTER:'V',random
#
MAZE:"sanctum", ' '
FLAGS: noteleport,hardfloor,nommap
# This is outside the main map, below, so we must do it before adding
# that map and anchoring coordinates to it. This extends the invisible
# barrier up to the top row, which falls outside the drawn map.
NON_PASSWALL:(39,00,41,00)
GEOMETRY:center,center
MAP
----------------------------------------------------------------------------
+199
View File
@@ -217,3 +217,202 @@ MONSTER:random,random
MONSTER:random,random
MONSTER:random,random
MONSTER:random,random
LEVEL:"medusa-3"
FLAGS: noteleport,mazelevel
INIT_MAP:solidfill,' '
GEOMETRY:center,center
#
# Here you disturb ravens nesting in the trees.
#
MAP
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}T..T.}}}}}}}}}}}}}}}}}}}}..}}}}}}}}.}}}...}}}}}}}.}}}}}......}}}}}}}
}}}}}}.......T.}}}}}}}}}}}..}}}}..T.}}}}}}...T...T..}}...T..}}..-----..}}}}}
}}}...-----....}}}}}}}}}}.T..}}}}}...}}}}}.....T..}}}}}......T..|...|.T..}}}
}}}.T.|...|...T.}}}}}}}.T......}}}}..T..}}.}}}.}}...}}}}}.T.....+...|...}}}}
}}}}..|...|.}}.}}}}}.....}}}T.}}}}.....}}}}}}.T}}}}}}}}}}}}}..T.|...|.}}}}}}
}}}}}.|...|.}}}}}}..T..}}}}}}}}}}}}}T.}}}}}}}}..}}}}}}}}}}}.....-----.}}}}}}
}}}}}.--+--..}}}}}}...}}}}}}}}}}}}}}}}}}}T.}}}}}}}}}}}}}}}}.T.}........}}}}}
}}}}}.......}}}}}}..}}}}}}}}}.}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}.}}.T.}}}}}}
}}.T...T...}}}}T}}}}}}}}}}}....}}}}}}}}}}T}}}}}.T}}...}}}}}}}}}}}}}}...}}}}}
}}}...T}}}}}}}..}}}}}}}}}}}.T...}}}}}}}}.T.}.T.....T....}}}}}}}}}}}}}.}}}}}}
}}}}}}}}}}}}}}}....}}}}}}}...}}.}}}}}}}}}}............T..}}}}}.T.}}}}}}}}}}}
}}}}}}}}}}}}}}}}..T..}}}}}}}}}}}}}}..}}}}}..------+--...T.}}}....}}}}}}}}}}}
}}}}.}..}}}}}}}.T.....}}}}}}}}}}}..T.}}}}.T.|...|...|....}}}}}.}}}}}...}}}}}
}}}.T.}...}..}}}}T.T.}}}}}}.}}}}}}}....}}...|...+...|.}}}}}}}}}}}}}..T...}}}
}}}}..}}}.....}}...}}}}}}}...}}}}}}}}}}}}}T.|...|...|}}}}}}}}}}}....T..}}}}}
}}}}}..}}}.T..}}}.}}}}}}}}.T..}}}}}}}}}}}}}}---S-----}}}}}}}}}}}}}....}}}}}}
}}}}}}}}}}}..}}}}}}}}}}}}}}}.}}}}}}}}}}}}}}}}}T..T}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
ENDMAP
$place = { (08,06),(66,05),(46,15) }
SHUFFLE: $place
REGION:(00,00,74,19),lit,"ordinary"
REGION:(49,14,51,16),random,"ordinary",unfilled
REGION:(07,05,09,07),unlit,"ordinary"
REGION:(65,04,67,06),unlit,"ordinary"
REGION:(45,14,47,16),unlit,"ordinary"
# Non diggable walls
# 4th room has diggable walls as Medusa is never placed there
NON_DIGGABLE:(06,04,10,08)
NON_DIGGABLE:(64,03,68,07)
NON_DIGGABLE:(44,13,48,17)
# All places are accessible also with jumping, so don't bother
# restricting the placement when teleporting from levels below this.
TELEPORT_REGION:(33,02,38,07),(0,0,0,0),down
STAIR:(32,01,39,07),(0,0,0,0),up
STAIR:$place[0],down
DOOR:locked,(08,08)
DOOR:locked,(64,05)
DOOR:random,(50,13)
DOOR:locked,(48,15)
#
FOUNTAIN:$place[1]
#
CONTAINER:('`',"statue"),$place[2],uncursed,montype:"knight",3,name:"Perseus" {
[75%]: OBJECT: ('[',"shield of reflection"),cursed,+0
[25%]: OBJECT: ('[',"levitation boots"),+0
[50%]: OBJECT: (')',"scimitar"),blessed,+2
[50%]: OBJECT: ('(',"sack")
}
#
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
LOOP [8] {
OBJECT:random,random
}
OBJECT:('?',"blank paper"),(48,18)
OBJECT:('?',"blank paper"),(48,18)
#
TRAP:"rust",random
TRAP:"rust",random
TRAP:"board",random
TRAP:"board",random
TRAP:random,random
#
MONSTER:('@',"Medusa"),$place[0]
MONSTER:(';',"giant eel"),random
MONSTER:(';',"giant eel"),random
MONSTER:(';',"jellyfish"),random
MONSTER:(';',"jellyfish"),random
MONSTER:('n',"wood nymph"),random
MONSTER:('n',"wood nymph"),random
MONSTER:('n',"water nymph"),random
MONSTER:('n',"water nymph"),random
LOOP [30] {
MONSTER:('B',"raven"),random,hostile
}
LEVEL:"medusa-4"
FLAGS: noteleport,mazelevel
INIT_MAP:solidfill,' '
GEOMETRY:center,center
#
# Here the Medusa rules some slithery monsters from her 'palace', with
# a yellow dragon nesting in the backyard.
#
MAP
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}........}}}}}}}}}}}}}}}}}}}}}}}..}}}.....}}}}}}}}}}}----|}}}}}
}}}}}}..----------F-.....}}}}}}}}}}}}}}}}..---...}}}}....T.}}}}}}}....|}}}}}
}}}.....|...F......S}}}}....}}}}}}}...}}.....|}}.}}}}}}}......}}}}|......}}}
}}}.....+...|..{...|}}}}}}}}}}}}.....}}}}|...|}}}}}}}}}}}.}}}}}}}}----.}}}}}
}}......|...|......|}}}}}}}}}......}}}}}}|.......}}}}}}}}}}}}}..}}}}}...}}}}
}}|-+--F|-+--....|F|-|}}}}}....}}}....}}}-----}}.....}}}}}}}......}}}}.}}}}}
}}|...}}|...|....|}}}|}}}}}}}..}}}}}}}}}}}}}}}}}}}}....}}}}}}}}....T.}}}}}}}
}}|...}}F...+....F}}}}}}}..}}}}}}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}....}}..}}
}}|...}}|...|....|}}}|}....}}}}}}....}}}...}}}}}...}}}}}}}}}}}}}}}}}.....}}}
}}--+--F|-+--....-F|-|....}}}}}}}}}}.T...}}}}....---}}}}}}}}}}}}}}}}}}}}}}}}
}}......|...|......|}}}}}.}}}}}}}}}....}}}}}}}.....|}}}}}}}}}.}}}}}}}}}}}}}}
}}}}....+...|..{...|.}}}}}}}}}}}}}}}}}}}}}}}}}}.|..|}}}}}}}......}}}}...}}}}
}}}}}}..|...F......|...}}}}}}}}}}..---}}}}}}}}}}--.-}}}}}....}}}}}}....}}}}}
}}}}}}}}-----S----F|....}}}}}}}}}|...|}}}}}}}}}}}}...}}}}}}...}}}}}}..}}}}}}
}}}}}}}}}..............T...}}}}}.|.......}}}}}}}}}}}}}}..}...}.}}}}....}}}}}
}}}}}}}}}}....}}}}...}...}}}}}.......|.}}}}}}}}}}}}}}.......}}}}}}}}}...}}}}
}}}}}}}}}}..}}}}}}}}}}.}}}}}}}}}}-..--.}}}}}}}}..}}}}}}..T...}}}..}}}}}}}}}}
}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}}...}}}}}}}....}}}}}}}.}}}..}}}...}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}}}}....}}}}}}}}}}}}}}}}}}}...}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
ENDMAP
#
$place = { (04,08),(10,04),(10,08),(10,12) }
SHUFFLE: $place
#
REGION:(00,00,74,19),lit,"ordinary"
REGION:(13,03,18,13),lit,"ordinary",unfilled
#
TELEPORT_REGION:(64,01,74,17),(0,0,0,0),down
TELEPORT_REGION:(02,02,18,13),(0,0,0,0),up
#
STAIR:(67,01,74,20),(0,0,0,0),up
STAIR:$place[0],down
#
DOOR:locked,(04,06)
DOOR:locked,(04,10)
DOOR:locked,(08,04)
DOOR:locked,(08,12)
DOOR:locked,(10,06)
DOOR:locked,(10,10)
DOOR:locked,(12,08)
#
BRANCH:levregion(27,00,79,20),(0,0,0,0)
#
NON_DIGGABLE:(01,01,22,14)
#
OBJECT:('(',"crystal ball"),(07,08)
#
CONTAINER:('`',"statue"),$place[1],uncursed,montype:"knight",3,name:"Perseus" {
[75%]: OBJECT: ('[',"shield of reflection"),cursed,+0
[25%]: OBJECT: ('[',"levitation boots"),+0
[50%]: OBJECT: (')',"scimitar"),blessed,+2
[50%]: OBJECT: ('(',"sack")
}
#
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
CONTAINER:('`',"statue"),random { }
LOOP [8] {
OBJECT:random,random
}
#
LOOP [7] {
TRAP:random,random
}
#
MONSTER:('@',"Medusa"),$place[0]
MONSTER:(';',"kraken"),(07,07)
#
# the nesting dragon
MONSTER:('D',"yellow dragon"), (05,04), asleep
[50%]: MONSTER: ('D',"baby yellow dragon"), (04,04), asleep
[25%]: MONSTER: ('D',"baby yellow dragon"), (04,05), asleep
OBJECT:('%',"egg"), (05,04), montype:"yellow dragon"
[50%]: OBJECT: ('%',"egg"), (05,04), montype:"yellow dragon"
[25%]: OBJECT: ('%',"egg"), (05,04), montype:"yellow dragon"
#
MONSTER:(';',"giant eel"),random
MONSTER:(';',"giant eel"),random
MONSTER:(';',"jellyfish"),random
MONSTER:(';',"jellyfish"),random
LOOP [14] {
MONSTER:'S',random
}
LOOP [4] {
MONSTER:('N',"black naga hatchling"), random
MONSTER:('N',"black naga"), random
}
+15
View File
@@ -1952,6 +1952,8 @@ new players if it detects some anticipated mistakes (default on).
.lp "confirm "
Have user confirm attacks on pets, shopkeepers, and other
peaceable creatures (default on).
.lp dark_room
Show out-of-sight areas of lit rooms (default off).
.lp disclose
Controls what information the program reveals when the game ends.
Value is a space separated list of prompting/category pairs
@@ -2324,6 +2326,19 @@ the appearance of the display, not the way the game treats you.
Show your approximate accumulated score on bottom line (default off).
.lp "silent "
Suppress terminal beeps (default on).
.lp sortloot
Controls the sorting behavior of the pickup lists for inventory
and #loot commands and some others.
The possible values are:
.PS full
.PL full
always sort the lists;
.PL loot
only sort the lists that don't use inventory letters, like with
the #loot and pickup commands;
.PL none
show lists the traditional way without sorting.
.PE
.lp sortpack
Sort the pack contents by type when displaying inventory (default on).
.lp sparkle
+17
View File
@@ -2363,6 +2363,9 @@ players if it detects some anticipated mistakes (default on).
Have user confirm attacks on pets, shopkeepers, and other
peaceable creatures (default on).
%.lp
%.lp
\item[\ib{dark\_room}]
Show out-of-sight areas of lit rooms (default off).
\item[\ib{disclose}]
Controls what information the program reveals when the game ends.
Value is a space separated list of prompting/category pairs
@@ -2789,6 +2792,20 @@ Show your approximate accumulated score on bottom line (default off).
\item[\ib{silent}]
Suppress terminal beeps (default on).
%.lp
\item[\ib{sortloot}]
Controls the sorting behavior of pickup lists for inventory
and \#loot commands and some others.
The possible values are:
%.sd
%.si
{\tt full} --- always sort the lists;\\
{\tt loot} --- only sort the lists that don't use inventory
letters, like with the \#loot and pickup commands;\\
{\tt none} --- show lists the traditional way without sorting.
%.ei
%.ed
%.lp
\item[\ib{sortpack}]
Sort the pack contents by type when displaying inventory (default on).
%.lp
+2
View File
@@ -1152,6 +1152,8 @@ adopt/adapt/improve the Paranoid_Quit patch; default is paranoid_confirm:pray
adopt/adapt/improve Dungeon Overview
Aardvark Joe's Extended Logfile
Michael Deutschmann's use_darkgray
Clive Crous' dark_room
Jukka Lahtinen's sortloot
Code Cleanup and Reorganization
-1
View File
@@ -416,7 +416,6 @@ typedef unsigned char uchar;
/* display features */
/* dungeon features */
/* dungeon levels */
#define WALLIFIED_MAZE /* Fancy mazes - Jean-Christophe Collet */
/* monsters & objects */
/* I/O */
#if !defined(MAC)
+3
View File
@@ -860,6 +860,8 @@ E int NDECL(midnight);
/* ### invent.c ### */
E struct obj **FDECL(objarr_init, (int));
E void FDECL(objarr_set, (struct obj *, int, struct obj **, BOOLEAN_P));
E void FDECL(assigninvlet, (struct obj *));
E struct obj *FDECL(merge_choice, (struct obj *,struct obj *));
E int FDECL(merged, (struct obj **,struct obj **));
@@ -1526,6 +1528,7 @@ E char *FDECL(doname, (struct obj *));
E boolean FDECL(not_fully_identified, (struct obj *));
E char *FDECL(corpse_xname, (struct obj *,const char *,unsigned));
E char *FDECL(cxname, (struct obj *));
E char *FDECL(cxname_singular, (struct obj *));
E char *FDECL(killer_xname, (struct obj *));
E char *FDECL(short_oname, (struct obj *,char *(*)(OBJ_P),char *(*)(OBJ_P),
unsigned));
+2
View File
@@ -23,6 +23,7 @@ struct flag {
boolean biff; /* enable checking for mail */
boolean bones; /* allow saving/loading bones */
boolean confirm; /* confirm before hitting tame monsters */
boolean dark_room; /* show shadows in lit rooms */
boolean debug; /* in debugging mode */
#define wizard flags.debug
boolean end_own; /* list all own scores */
@@ -47,6 +48,7 @@ struct flag {
boolean showexp; /* show experience points */
boolean showscore; /* show score */
boolean silent; /* whether the bell rings or not */
boolean sortloot; /* sort items alphabetically when looting */
boolean sortpack; /* sorted inventory */
boolean sparkle; /* show "resisting" special FX (Scott Bigham) */
boolean standout; /* use standout for --More-- */
+82 -76
View File
@@ -128,98 +128,102 @@
#define S_bars 17 /* KMH -- iron bars */
#define S_tree 18 /* KMH */
#define S_room 19
#define S_corr 20
#define S_litcorr 21
#define S_upstair 22
#define S_dnstair 23
#define S_upladder 24
#define S_dnladder 25
#define S_altar 26
#define S_grave 27
#define S_throne 28
#define S_sink 29
#define S_fountain 30
#define S_pool 31
#define S_ice 32
#define S_lava 33
#define S_vodbridge 34
#define S_hodbridge 35
#define S_vcdbridge 36 /* closed drawbridge, vertical wall */
#define S_hcdbridge 37 /* closed drawbridge, horizontal wall */
#define S_air 38
#define S_cloud 39
#define S_water 40
#define S_darkroom 20
#define S_corr 21
#define S_litcorr 22
#define S_upstair 23
#define S_dnstair 24
#define S_upladder 25
#define S_dnladder 26
#define S_altar 27
#define S_grave 28
#define S_throne 29
#define S_sink 30
#define S_fountain 31
#define S_pool 32
#define S_ice 33
#define S_lava 34
#define S_vodbridge 35
#define S_hodbridge 36
#define S_vcdbridge 37 /* closed drawbridge, vertical wall */
#define S_hcdbridge 38 /* closed drawbridge, horizontal wall */
#define S_air 39
#define S_cloud 40
#define S_water 41
/* end dungeon characters, begin traps */
#define S_arrow_trap 41
#define S_dart_trap 42
#define S_falling_rock_trap 43
#define S_squeaky_board 44
#define S_bear_trap 45
#define S_land_mine 46
#define S_rolling_boulder_trap 47
#define S_sleeping_gas_trap 48
#define S_rust_trap 49
#define S_fire_trap 50
#define S_pit 51
#define S_spiked_pit 52
#define S_hole 53
#define S_trap_door 54
#define S_teleportation_trap 55
#define S_level_teleporter 56
#define S_magic_portal 57
#define S_web 58
#define S_statue_trap 59
#define S_magic_trap 60
#define S_anti_magic_trap 61
#define S_polymorph_trap 62
#define S_arrow_trap 42
#define S_dart_trap 43
#define S_falling_rock_trap 44
#define S_squeaky_board 45
#define S_bear_trap 46
#define S_land_mine 47
#define S_rolling_boulder_trap 48
#define S_sleeping_gas_trap 49
#define S_rust_trap 50
#define S_fire_trap 51
#define S_pit 52
#define S_spiked_pit 53
#define S_hole 54
#define S_trap_door 55
#define S_teleportation_trap 56
#define S_level_teleporter 57
#define S_magic_portal 58
#define S_web 59
#define S_statue_trap 60
#define S_magic_trap 61
#define S_anti_magic_trap 62
#define S_polymorph_trap 63
/* end traps, begin special effects */
#define S_vbeam 63 /* The 4 zap beam symbols. Do NOT separate. */
#define S_hbeam 64 /* To change order or add, see function */
#define S_lslant 65 /* zapdir_to_glyph() in display.c. */
#define S_rslant 66
#define S_digbeam 67 /* dig beam symbol */
#define S_flashbeam 68 /* camera flash symbol */
#define S_boomleft 69 /* thrown boomerang, open left, e.g ')' */
#define S_boomright 70 /* thrown boomerand, open right, e.g. '(' */
#define S_ss1 71 /* 4 magic shield glyphs */
#define S_ss2 72
#define S_ss3 73
#define S_ss4 74
#define S_poisoncloud 75
#define S_vbeam 64 /* The 4 zap beam symbols. Do NOT separate. */
#define S_hbeam 65 /* To change order or add, see function */
#define S_lslant 66 /* zapdir_to_glyph() in display.c. */
#define S_rslant 67
#define S_digbeam 68 /* dig beam symbol */
#define S_flashbeam 69 /* camera flash symbol */
#define S_boomleft 70 /* thrown boomerang, open left, e.g ')' */
#define S_boomright 71 /* thrown boomerand, open right, e.g. '(' */
#define S_ss1 72 /* 4 magic shield glyphs */
#define S_ss2 73
#define S_ss3 74
#define S_ss4 75
#define S_poisoncloud 76
#define S_goodpos 77 /* valid position for targeting */
/* The 8 swallow symbols. Do NOT separate. To change order or add, see */
/* the function swallow_to_glyph() in display.c. */
#define S_sw_tl 76 /* swallow top left [1] */
#define S_sw_tc 77 /* swallow top center [2] Order: */
#define S_sw_tr 78 /* swallow top right [3] */
#define S_sw_ml 79 /* swallow middle left [4] 1 2 3 */
#define S_sw_mr 80 /* swallow middle right [6] 4 5 6 */
#define S_sw_bl 81 /* swallow bottom left [7] 7 8 9 */
#define S_sw_bc 82 /* swallow bottom center [8] */
#define S_sw_br 83 /* swallow bottom right [9] */
#define S_sw_tl 78 /* swallow top left [1] */
#define S_sw_tc 79 /* swallow top center [2] Order: */
#define S_sw_tr 80 /* swallow top right [3] */
#define S_sw_ml 81 /* swallow middle left [4] 1 2 3 */
#define S_sw_mr 82 /* swallow middle right [6] 4 5 6 */
#define S_sw_bl 83 /* swallow bottom left [7] 7 8 9 */
#define S_sw_bc 84 /* swallow bottom center [8] */
#define S_sw_br 85 /* swallow bottom right [9] */
#define S_explode1 84 /* explosion top left */
#define S_explode2 85 /* explosion top center */
#define S_explode3 86 /* explosion top right Ex. */
#define S_explode4 87 /* explosion middle left */
#define S_explode5 88 /* explosion middle center /-\ */
#define S_explode6 89 /* explosion middle right |@| */
#define S_explode7 90 /* explosion bottom left \-/ */
#define S_explode8 91 /* explosion bottom center */
#define S_explode9 92 /* explosion bottom right */
#define S_explode1 86 /* explosion top left */
#define S_explode2 87 /* explosion top center */
#define S_explode3 88 /* explosion top right Ex. */
#define S_explode4 89 /* explosion middle left */
#define S_explode5 90 /* explosion middle center /-\ */
#define S_explode6 91 /* explosion middle right |@| */
#define S_explode7 92 /* explosion bottom left \-/ */
#define S_explode8 93 /* explosion bottom center */
#define S_explode9 94 /* explosion bottom right */
/* end effects */
#define MAXPCHARS 93 /* maximum number of mapped characters */
#define MAXDCHARS 41 /* maximum of mapped dungeon characters */
#define MAXPCHARS 95 /* maximum number of mapped characters */
#define MAXDCHARS 42 /* maximum of mapped dungeon characters */
#define MAXTCHARS 22 /* maximum of mapped trap characters */
#define MAXECHARS 30 /* maximum of mapped effects characters */
#define MAXECHARS 31 /* maximum of mapped effects characters */
#define MAXEXPCHARS 9 /* number of explosion characters */
#define DARKROOMSYM (Is_rogue_level(&u.uz) ? S_stone : S_darkroom)
struct symdef {
uchar sym;
const char *explanation;
@@ -550,6 +554,8 @@ struct levelflags {
Bitfield(wizard_bones,1); /* set if level came from a bones file
which was created in wizard mode (or
normal mode descendant of such) */
Bitfield(corrmaze, 1); /* Whether corridors are used for the maze
rather than ROOM */
};
typedef struct
+80 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 sp_lev.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 sp_lev.h $NHDT-Date: 1428655166 2015/04/10 08:39:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* NetHack 3.5 sp_lev.h $Date: 2009/05/06 10:45:06 $ $Revision: 1.5 $ */
/* SCCS Id: @(#)sp_lev.h 3.5 2007/08/01 */
/* Copyright (c) 1989 by Jean-Christophe Collet */
@@ -30,6 +30,7 @@
#define GRAVEYARD 0x00000100L
#define ICEDPOOLS 0x00000200L /* for ice locations: ICED_POOL vs ICED_MOAT */
#define SOLIDIFY 0x00000400L /* outer areas are nondiggable & nonpasswall */
#define CORRMAZE 0x00000800L /* for maze levels only */
/* different level layout initializers */
#define LVLINIT_NONE 0
@@ -470,4 +471,82 @@ struct lc_breakdef {
int break_depth;
};
/*
* Quick! Avert your eyes while you still have a chance!
*/
#ifdef SPEC_LEV
/* compiling lev_comp rather than nethack */
# ifdef USE_OLDARGS
# undef VA_ARGS
# undef VA_DECL
# undef VA_DECL2
# undef VA_SHIFT
# define VA_ARGS arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,\
arg10,arg11,arg12,arg13,arg14
# define VA_DECL(typ1,var1) (var1,VA_ARGS) \
typ1 var1; \
char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9,\
*arg10,*arg11,*arg12,*arg13,*arg14; {
# define VA_DECL2(typ1,var1,typ2,var2) (var1,var2,VA_ARGS) \
typ1 var1; typ2 var2; \
char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9,\
*arg10,*arg11,*arg12,*arg13,*arg14; {
/* unlike in the core, lev_comp's VA_SHIFT is completely safe,
because callers always pass all these arguments */
# define VA_SHIFT() (arg1=arg2, arg2=arg3, arg3=arg4, arg4=arg5,\
arg5=arg6, arg6=arg7, arg7=arg8, arg8=arg9,\
arg9=arg10, arg10=arg11, arg11=arg12,\
arg12=arg13, arg13=arg14, arg14=0)
/* standard NULL may be either (void *)0 or plain 0, both of
which would need to be explicitly cast to (char *) here */
typedef char *Va;
# define VA_PASS1(a1) (Va)a1, (Va)0,(Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS2(a1,a2) (Va)a1, (Va)a2, (Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS3(a1,a2,a3) (Va)a1, (Va)a2, (Va)a3, (Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS4(a1,a2,a3,a4) (Va)a1, (Va)a2, (Va)a3, (Va)a4, (Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS5(a1,a2,a3,a4,a5) \
(Va)a1, (Va)a2, (Va)a3, (Va)a4, (Va)a5,\
(Va)0,(Va)0,(Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS7(a1,a2,a3,a4,a5,a6,a7) \
(Va)a1, (Va)a2, (Va)a3, (Va)a4, (Va)a5,\
(Va)a6, (Va)a7, (Va)0,(Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS8(a1,a2,a3,a4,a5,a6,a7,a8) \
(Va)a1, (Va)a2, (Va)a3, (Va)a4, (Va)a5,\
(Va)a6, (Va)a7, (Va)a8, (Va)0,(Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS9(a1,a2,a3,a4,a5,a6,a7,a8,a9) \
(Va)a1, (Va)a2, (Va)a3, (Va)a4, (Va)a5,\
(Va)a6, (Va)a7, (Va)a8, (Va)a9, (Va)0,\
(Va)0,(Va)0,(Va)0,(Va)0
# define VA_PASS14(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
(Va)a1, (Va)a2, (Va)a3, (Va)a4, (Va)a5,\
(Va)a6, (Va)a7, (Va)a8, (Va)a9, (Va)a10,\
(Va)a11, (Va)a12, (Va)a13, (Va)a14
# else /*!USE_OLDARGS*/
/* USE_STDARG and USE_VARARGS don't need to pass dummy arguments
or cast real ones */
# define VA_PASS1(a1) a1
# define VA_PASS2(a1,a2) a1,a2
# define VA_PASS3(a1,a2,a3) a1,a2,a3
# define VA_PASS4(a1,a2,a3,a4) a1,a2,a3,a4
# define VA_PASS5(a1,a2,a3,a4,a5) a1,a2,a3,a4,a5
# define VA_PASS7(a1,a2,a3,a4,a5,a6,a7) a1,a2,a3,a4,a5,a6,a7
# define VA_PASS8(a1,a2,a3,a4,a5,a6,a7,a8) a1,a2,a3,a4,a5,a6,a7,a8
# define VA_PASS9(a1,a2,a3,a4,a5,a6,a7,a8,a9) a1,a2,a3,a4,a5,a6,a7,a8,a9
# define VA_PASS14(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) \
a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14
# endif /*?USE_OLDARGS*/
/* You were warned to avert your eyes.... */
#endif /*SPEC_LEV*/
#endif /* SP_LEV_H */
+9 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 tradstdc.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 tradstdc.h $NHDT-Date: 1428655166 2015/04/10 08:39:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ */
/* NetHack 3.5 tradstdc.h $Date: 2012/01/11 18:23:26 $ $Revision: 1.15 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -95,10 +95,17 @@
# define VA_DECL(typ1,var1) (var1,VA_ARGS) typ1 var1; \
char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9; {
# define VA_DECL2(typ1,var1,typ2,var2) (var1,var2,VA_ARGS) \
typ1 var1; typ2 var2;\
typ1 var1; typ2 var2; \
char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9; {
# define VA_START(x)
# define VA_INIT(var1,typ1)
/* this is inherently risky, and should only be attempted as a
very last resort; manipulating arguments which haven't actually
been passed may or may not cause severe trouble depending on
the function-calling/argument-passing mechanism being used */
# define VA_SHIFT() (arg1=arg2, arg2=arg3, arg3=arg4, arg4=arg5,\
arg5=arg6, arg6=arg7, arg7=arg8, arg8=arg9)
# define VA_NEXT(var1,typ1) ((var1 = (typ1)arg1), VA_SHIFT(), var1)
# define VA_END()
# endif
#endif
+2 -2
View File
@@ -1396,7 +1396,7 @@ display_jump_positions(state)
int state;
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
} else if (state == 1) {
int x,y, dx, dy;
for (dx = -4; dx <= 4; dx++)
@@ -2605,7 +2605,7 @@ display_polearm_positions(state)
int state;
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
} else if (state == 1) {
int x,y, dx,dy;
for (dx = -4; dx <= 4; dx++)
+2 -2
View File
@@ -764,11 +764,11 @@ newsym(x,y)
* These checks and changes must be here and not in back_to_glyph().
* They are dependent on the position being out of sight.
*/
else if (!lev->waslit) {
else if (!lev->waslit || (flags.dark_room && iflags.use_color)) {
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
show_glyph(x, y, lev->glyph = cmap_to_glyph(DARKROOMSYM));
else
goto show_mem;
} else {
+1
View File
@@ -238,6 +238,7 @@ const char *goal;
if (glyph_is_cmap(k) &&
(IS_DOOR(levl[tx][ty].typ) ||
glyph_to_cmap(k) == S_room ||
glyph_to_cmap(k) == S_darkroom ||
glyph_to_cmap(k) == S_corr ||
glyph_to_cmap(k) == S_litcorr)) {
/* what the hero remembers to be at tx,ty */
+18 -15
View File
@@ -156,7 +156,8 @@ const struct symdef defsyms[MAXPCHARS] = {
{'#', "iron bars", C(HI_METAL)}, /* bars */
{'#', "tree", C(CLR_GREEN)}, /* tree */
{'.', "floor of a room",C(CLR_GRAY)}, /* room */
/*20*/ {'#', "corridor", C(CLR_GRAY)}, /* dark corr */
/*20*/ {'.', "dark part of a room",C(CLR_BLACK)}, /* dark room */
{'#', "corridor", C(CLR_GRAY)}, /* dark corr */
{'#', "lit corridor", C(CLR_GRAY)}, /* lit corr (see mapglyph.c) */
{'<', "staircase up", C(CLR_GRAY)}, /* upstair */
{'>', "staircase down", C(CLR_GRAY)}, /* dnstair */
@@ -165,8 +166,8 @@ const struct symdef defsyms[MAXPCHARS] = {
{'_', "altar", C(CLR_GRAY)}, /* altar */
{'|', "grave", C(CLR_GRAY)}, /* grave */
{'\\', "opulent throne",C(HI_GOLD)}, /* throne */
{'#', "sink", C(CLR_GRAY)}, /* sink */
/*30*/ {'{', "fountain", C(CLR_BLUE)}, /* fountain */
/*30*/ {'#', "sink", C(CLR_GRAY)}, /* sink */
{'{', "fountain", C(CLR_BLUE)}, /* fountain */
{'}', "water", C(CLR_BLUE)}, /* pool */
{'.', "ice", C(CLR_CYAN)}, /* ice */
{'}', "molten lava", C(CLR_RED)}, /* lava */
@@ -175,8 +176,8 @@ const struct symdef defsyms[MAXPCHARS] = {
{'#', "raised drawbridge",C(CLR_BROWN)}, /* vcdbridge */
{'#', "raised drawbridge",C(CLR_BROWN)}, /* hcdbridge */
{' ', "air", C(CLR_CYAN)}, /* open air */
{'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */
/*40*/ {'}', "water", C(CLR_BLUE)}, /* under water */
/*40*/ {'#', "cloud", C(CLR_GRAY)}, /* [part of] a cloud */
{'}', "water", C(CLR_BLUE)}, /* under water */
{'^', "arrow trap", C(HI_METAL)}, /* trap */
{'^', "dart trap", C(HI_METAL)}, /* trap */
{'^', "falling rock trap",C(CLR_GRAY)}, /* trap */
@@ -185,8 +186,8 @@ const struct symdef defsyms[MAXPCHARS] = {
{'^', "land mine", C(CLR_RED)}, /* trap */
{'^', "rolling boulder trap", C(CLR_GRAY)}, /* trap */
{'^', "sleeping gas trap",C(HI_ZAP)}, /* trap */
{'^', "rust trap", C(CLR_BLUE)}, /* trap */
/*50*/ {'^', "fire trap", C(CLR_ORANGE)}, /* trap */
/*50*/ {'^', "rust trap", C(CLR_BLUE)}, /* trap */
{'^', "fire trap", C(CLR_ORANGE)}, /* trap */
{'^', "pit", C(CLR_BLACK)}, /* trap */
{'^', "spiked pit", C(CLR_BLACK)}, /* trap */
{'^', "hole", C(CLR_BROWN)}, /* trap */
@@ -195,8 +196,8 @@ const struct symdef defsyms[MAXPCHARS] = {
{'^', "level teleporter", C(CLR_MAGENTA)}, /* trap */
{'^', "magic portal", C(CLR_BRIGHT_MAGENTA)}, /* trap */
{'"', "web", C(CLR_GRAY)}, /* web */
{'^', "statue trap", C(CLR_GRAY)}, /* trap */
/*60*/ {'^', "magic trap", C(HI_ZAP)}, /* trap */
/*60*/ {'^', "statue trap", C(CLR_GRAY)}, /* trap */
{'^', "magic trap", C(HI_ZAP)}, /* trap */
{'^', "anti-magic field", C(HI_ZAP)}, /* trap */
{'^', "polymorph trap", C(CLR_BRIGHT_GREEN)}, /* trap */
{'|', "wall", C(CLR_GRAY)}, /* vbeam */
@@ -205,29 +206,30 @@ const struct symdef defsyms[MAXPCHARS] = {
{'/', "wall", C(CLR_GRAY)}, /* rslant */
{'*', "", C(CLR_WHITE)}, /* dig beam */
{'!', "", C(CLR_WHITE)}, /* camera flash beam */
{')', "", C(HI_WOOD)}, /* boomerang open left */
/*70*/ {'(', "", C(HI_WOOD)}, /* boomerang open right */
/*70*/ {')', "", C(HI_WOOD)}, /* boomerang open left */
{'(', "", C(HI_WOOD)}, /* boomerang open right */
{'0', "", C(HI_ZAP)}, /* 4 magic shield symbols */
{'#', "", C(HI_ZAP)},
{'@', "", C(HI_ZAP)},
{'*', "", C(HI_ZAP)},
{'#', "poison cloud", C(CLR_BRIGHT_GREEN)}, /* [part of] a poison cloud */
{'?', "valid position", C(CLR_BRIGHT_GREEN)}, /* valid position for targeting */
{'/', "", C(CLR_GREEN)}, /* swallow top left */
{'-', "", C(CLR_GREEN)}, /* swallow top center */
{'\\', "", C(CLR_GREEN)}, /* swallow top right */
/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow top right */
{'|', "", C(CLR_GREEN)}, /* swallow middle left */
{'|', "", C(CLR_GREEN)}, /* swallow middle right */
/*80*/ {'\\', "", C(CLR_GREEN)}, /* swallow bottom left */
{'\\', "", C(CLR_GREEN)}, /* swallow bottom left */
{'-', "", C(CLR_GREEN)}, /* swallow bottom center*/
{'/', "", C(CLR_GREEN)}, /* swallow bottom right */
{'/', "", C(CLR_ORANGE)}, /* explosion top left */
{'-', "", C(CLR_ORANGE)}, /* explosion top center */
{'\\', "", C(CLR_ORANGE)}, /* explosion top right */
{'|', "", C(CLR_ORANGE)}, /* explosion middle left */
{' ', "", C(CLR_ORANGE)}, /* explosion middle center*/
/*90*/ {' ', "", C(CLR_ORANGE)}, /* explosion middle center*/
{'|', "", C(CLR_ORANGE)}, /* explosion middle right */
{'\\', "", C(CLR_ORANGE)}, /* explosion bottom left */
/*90*/ {'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/
{'-', "", C(CLR_ORANGE)}, /* explosion bottom center*/
{'/', "", C(CLR_ORANGE)}, /* explosion bottom right */
};
@@ -647,6 +649,7 @@ struct symparse loadsyms[] = {
{SYM_PCHAR, S_flashbeam, "S_flashbeam"},
{SYM_PCHAR, S_boomleft, "S_boomleft"},
{SYM_PCHAR, S_boomright, "S_boomright"},
{SYM_PCHAR, S_goodpos, "S_goodpos"},
{SYM_PCHAR, S_ss1, "S_ss1"},
{SYM_PCHAR, S_ss2, "S_ss2"},
{SYM_PCHAR, S_ss3, "S_ss3"},
+25 -1
View File
@@ -1237,6 +1237,9 @@ struct obj *list;
boolean identified, all_containers, reportempty;
{
register struct obj *box, *obj;
struct obj **oarray;
int i,j,n;
char *invlet;
char buf[BUFSZ];
boolean cat, deadcat;
@@ -1256,10 +1259,30 @@ boolean identified, all_containers, reportempty;
continue; /* wrong type of container */
} else if (box->cobj) {
winid tmpwin = create_nhwindow(NHW_MENU);
/* count the number of items */
for (n = 0, obj = box->cobj; obj; obj = obj->nobj) n++;
/* Make a temporary array to store the objects sorted */
oarray = objarr_init(n);
/* Add objects to the array */
i = 0;
invlet = flags.inv_order;
nextclass:
for (obj = box->cobj; obj; obj = obj->nobj) {
if (!flags.sortpack || obj->oclass == *invlet) {
objarr_set(obj, i++, oarray, (flags.sortloot == 'f' || flags.sortloot == 'l') );
}
} /* for loop */
if (flags.sortpack) {
if (*++invlet) goto nextclass;
}
Sprintf(buf, "Contents of %s:", the(xname(box)));
putstr(tmpwin, 0, buf);
putstr(tmpwin, 0, "");
for (obj = box->cobj; obj; obj = obj->nobj) {
for (i = 0; i < n; i++) {
obj = oarray[i];
if (identified) {
makeknown(obj->otyp);
obj->known = obj->bknown =
@@ -1269,6 +1292,7 @@ boolean identified, all_containers, reportempty;
}
putstr(tmpwin, 0, doname(obj));
}
free(oarray);
if (cat) putstr(tmpwin, 0, "Schroedinger's cat");
else if (deadcat) putstr(tmpwin, 0, "Schroedinger's dead cat");
display_nhwindow(tmpwin, TRUE);
+1 -1
View File
@@ -1420,7 +1420,7 @@ docompress_file(filename, uncomp)
const char *filename;
boolean uncomp;
{
gzFile *compressedfile;
gzFile compressedfile;
FILE *uncompressedfile;
char cfn[256];
char buf[1024];
+112 -14
View File
@@ -8,6 +8,7 @@
#define NOINVSYM '#'
#define CONTAINED_SYM '>' /* designator for inside a container */
STATIC_DCL int FDECL(sortloot_cmp, (struct obj *, struct obj *));
STATIC_DCL void NDECL(reorder_invent);
STATIC_DCL boolean FDECL(mergable,(struct obj *,struct obj *));
STATIC_DCL void FDECL(noarmor, (BOOLEAN_P));
@@ -42,6 +43,88 @@ static int lastinvnr = 51; /* 0 ... 51 (never saved&restored) */
*/
static char venom_inv[] = { VENOM_CLASS, 0 }; /* (constant) */
int
sortloot_cmp(obj1, obj2)
struct obj *obj1;
struct obj *obj2;
{
int val1 = 0;
int val2 = 0;
/* Sort object names in lexicographical order, ignoring quantity. */
int name_cmp = strcmpi(cxname_singular(obj1), cxname_singular(obj2));
if (name_cmp != 0) {
return name_cmp;
}
/* Sort by BUC. Map blessed to 4, uncursed to 2, cursed to 1, and unknown to 0. */
val1 = obj1->bknown ? (obj1->blessed << 2) + ((!obj1->blessed && !obj1->cursed) << 1) + obj1->cursed : 0;
val2 = obj2->bknown ? (obj2->blessed << 2) + ((!obj2->blessed && !obj2->cursed) << 1) + obj2->cursed : 0;
if (val1 != val2) {
return val2 - val1; /* Because bigger is better. */
}
/* Sort by greasing. This will put the objects in degreasing order. */
val1 = obj1->greased;
val2 = obj2->greased;
if (val1 != val2) {
return val2 - val1; /* Because bigger is better. */
}
/* Sort by erosion. The effective amount is what matters. */
val1 = greatest_erosion(obj1);
val2 = greatest_erosion(obj2);
if (val1 != val2) {
return val1 - val2; /* Because bigger is WORSE. */
}
/* Sort by erodeproofing. Map known-invulnerable to 1, and both
* known-vulnerable and unknown-vulnerability to 0, because that's how they're displayed. */
val1 = obj1->rknown && obj1->oerodeproof;
val2 = obj2->rknown && obj2->oerodeproof;
if (val1 != val2) {
return val2 - val1; /* Because bigger is better. */
}
/* Sort by enchantment. Map unknown to -1000, which is comfortably below the range of ->spe. */
val1 = obj1->known ? obj1->spe : -1000;
val2 = obj2->known ? obj2->spe : -1000;
if (val1 != val2) {
return val2 - val1; /* Because bigger is better. */
}
return 0; /* They're identical, as far as we're concerned. */
}
struct obj **
objarr_init(n)
int n;
{
return (struct obj **)alloc(n * sizeof(struct obj *));
}
void
objarr_set(otmp, idx, oarray, dosort)
struct obj *otmp;
int idx;
struct obj **oarray;
boolean dosort;
{
if (dosort) {
int j;
for (j = idx; j; j--) {
if (sortloot_cmp(otmp, oarray[j-1]) > 0) break;
oarray[j] = oarray[j-1];
}
oarray[j] = otmp;
} else {
oarray[idx] = otmp;
}
}
void
assigninvlet(otmp)
register struct obj *otmp;
@@ -1722,6 +1805,8 @@ long* out_cnt;
static winid local_win = WIN_ERR; /* window for partial menus */
anything any;
menu_item *selected;
struct obj **oarray;
int i, j;
/* overriden by global flag */
if (flags.perm_invent) {
@@ -1768,6 +1853,19 @@ long* out_cnt;
return ret;
}
/* count the number of items */
for (n = 0, otmp = invent; otmp; otmp = otmp->nobj)
if (!lets || !*lets || index(lets, otmp->invlet)) n++;
oarray = objarr_init(n);
/* Add objects to the array */
i = 0;
for (otmp = invent; otmp; otmp = otmp->nobj)
if (!lets || !*lets || index(lets, otmp->invlet)) {
objarr_set(otmp, i++, oarray, (flags.sortloot == 'f'));
}
start_menu(win);
if (wizard && iflags.override_ID) {
char prompt[BUFSZ];
@@ -1782,22 +1880,21 @@ long* out_cnt;
nextclass:
classcount = 0;
any = zeroany; /* set all bits to zero */
for(otmp = invent; otmp; otmp = otmp->nobj) {
ilet = otmp->invlet;
if(!lets || !*lets || index(lets, ilet)) {
any = zeroany; /* zero */
if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) {
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
for(i = 0; i < n; i++) {
otmp = oarray[i];
ilet = otmp->invlet;
any = zeroany; /* zero */
if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) {
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*invlet, FALSE, (want_reply && iflags.menu_head_objsym)), MENU_UNSELECTED);
classcount++;
}
any.a_char = ilet;
add_menu(win, obj_to_glyph(otmp),
&any, ilet, 0, ATR_NONE, doname(otmp),
MENU_UNSELECTED);
}
classcount++;
}
any.a_char = ilet;
add_menu(win, obj_to_glyph(otmp),
&any, ilet, 0, ATR_NONE, doname(otmp),
MENU_UNSELECTED);
}
}
if (flags.sortpack) {
if (*++invlet) goto nextclass;
@@ -1806,6 +1903,7 @@ nextclass:
goto nextclass;
}
}
free(oarray);
end_menu(win, (char *) 0);
n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected);
+1 -1
View File
@@ -116,7 +116,7 @@ unsigned *ospecial;
color = CLR_MAGENTA;
else if (offset == S_corr || offset == S_litcorr)
color = CLR_GRAY;
else if (offset >= S_room && offset <= S_water)
else if (offset >= S_room && offset <= S_water && offset != S_darkroom)
color = CLR_GREEN;
else
color = NO_COLOR;
+1
View File
@@ -582,6 +582,7 @@ clear_level_structures()
level.flags.is_cavernous_lev = 0;
level.flags.arboreal = 0;
level.flags.wizard_bones = 0;
level.flags.corrmaze = 0;
nroom = 0;
rooms[0].hx = -1;
+30 -38
View File
@@ -541,25 +541,25 @@ register const char *s;
}
level.flags.is_maze_lev = TRUE;
level.flags.corrmaze = !rn2(3);
#ifndef WALLIFIED_MAZE
for(x = 2; x < x_maze_max; x++)
for(y = 2; y < y_maze_max; y++)
levl[x][y].typ = STONE;
#else
for(x = 2; x <= x_maze_max; x++)
for(y = 2; y <= y_maze_max; y++)
levl[x][y].typ = ((x % 2) && (y % 2)) ? STONE : HWALL;
#endif
if (level.flags.corrmaze)
for(x = 2; x < x_maze_max; x++)
for(y = 2; y < y_maze_max; y++)
levl[x][y].typ = STONE;
else
for(x = 2; x <= x_maze_max; x++)
for(y = 2; y <= y_maze_max; y++)
levl[x][y].typ = ((x % 2) && (y % 2)) ? STONE : HWALL;
maze0xy(&mm);
walkfrom((int) mm.x, (int) mm.y, 0);
/* put a boulder at the maze center */
(void) mksobj_at(BOULDER, (int) mm.x, (int) mm.y, TRUE, FALSE);
#ifdef WALLIFIED_MAZE
wallification(2, 2, x_maze_max, y_maze_max);
#endif
if (!level.flags.corrmaze)
wallification(2, 2, x_maze_max, y_maze_max);
mazexy(&mm);
mkstairs(mm.x, mm.y, 1, (struct mkroom *)0); /* up */
if (!Invocation_lev(&u.uz)) {
@@ -650,11 +650,12 @@ schar typ;
int q, a, dir, pos;
int dirs[4];
#ifndef WALLIFIED_MAZE
if (!typ) typ = CORR;
#else
if (!typ) typ = ROOM;
#endif
if (!typ) {
if (level.flags.corrmaze)
typ = CORR;
else
typ = ROOM;
}
pos = 1;
mazex[pos] = (char) x;
@@ -695,11 +696,12 @@ schar typ;
register int q,a,dir;
int dirs[4];
#ifndef WALLIFIED_MAZE
if (!typ) typ = CORR;
#else
if (!typ) typ = ROOM;
#endif
if (!typ) {
if (level.flags.corrmaze)
typ = CORR;
else
typ = ROOM;
}
if(!IS_DOOR(levl[x][y].typ)) {
/* might still be on edge of MAP, so don't overwrite */
@@ -737,7 +739,7 @@ register int dir;
void
mazexy(cc) /* find random point in generated corridors,
so we don't create items in moats, bunkers, or walls */
so we don't create items in moats, bunkers, or walls */
coord *cc;
{
int cpt=0;
@@ -746,13 +748,8 @@ mazexy(cc) /* find random point in generated corridors,
cc->x = 3 + 2*rn2((x_maze_max>>1) - 1);
cc->y = 3 + 2*rn2((y_maze_max>>1) - 1);
cpt++;
} while (cpt < 100 && levl[cc->x][cc->y].typ !=
#ifdef WALLIFIED_MAZE
ROOM
#else
CORR
#endif
);
} while (cpt < 100 &&
levl[cc->x][cc->y].typ != (level.flags.corrmaze ? CORR : ROOM));
if (cpt >= 100) {
register int x, y;
/* last try */
@@ -760,13 +757,8 @@ mazexy(cc) /* find random point in generated corridors,
for (y = 0; y < (y_maze_max>>1) - 1; y++) {
cc->x = 3 + 2 * x;
cc->y = 3 + 2 * y;
if (levl[cc->x][cc->y].typ ==
#ifdef WALLIFIED_MAZE
ROOM
#else
CORR
#endif
) return;
if (levl[cc->x][cc->y].typ == (level.flags.corrmaze ? CORR : ROOM))
return;
}
panic("mazexy: can't find a place!");
}
@@ -783,7 +775,7 @@ bound_digging()
* so the boundary would be breached
*
* we can't bound unconditionally on one beyond the last line, because
* that provides a window of abuse for WALLIFIED_MAZE special levels
* that provides a window of abuse for wallified special levels
*/
{
register int x,y;
+21 -1
View File
@@ -19,6 +19,8 @@ STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *));
STATIC_DCL boolean FDECL(singplur_lookup, (char *,char *,BOOLEAN_P,
const char *const *));
STATIC_DCL char *FDECL(singplur_compound, (char *));
STATIC_DCL char *FDECL(xname_flags, (struct obj *, unsigned));
struct Jitem {
int item;
@@ -237,7 +239,15 @@ boolean juice; /* whether or not to append " juice" to the name */
char *
xname(obj)
struct obj *obj;
{
return xname_flags(obj, CXN_NORMAL);
}
char *
xname_flags(obj, cxn_flags)
register struct obj *obj;
unsigned cxn_flags; /* bitmask of CXN_xxx values */
{
register char *buf;
register int typ = obj->otyp;
@@ -246,7 +256,7 @@ register struct obj *obj;
const char *actualn = OBJ_NAME(*ocl);
const char *dn = OBJ_DESCR(*ocl);
const char *un = ocl->oc_uname;
boolean pluralize = (obj->quan != 1L);
boolean pluralize = (obj->quan != 1L) && !(cxn_flags & CXN_SINGULAR);
boolean known, dknown, bknown;
buf = nextobuf() + PREFIX; /* leave room for "17 -3 " */
@@ -1078,6 +1088,16 @@ struct obj *obj;
return xname(obj);
}
/* like cxname, but ignores quantity */
char *
cxname_singular(obj)
struct obj *obj;
{
if (obj->otyp == CORPSE)
return corpse_xname(obj, (const char *)0, CXN_SINGULAR);
return xname_flags(obj, CXN_SINGULAR);
}
/* treat an object as fully ID'd when it might be used as reason for death */
char *
killer_xname(obj)
+88 -3
View File
@@ -105,6 +105,7 @@ static struct Bool_Opt
{"color", &iflags.wc_color, FALSE, SET_IN_GAME}, /*WC*/
# endif
{"confirm",&flags.confirm, TRUE, SET_IN_GAME},
{"dark_room", &flags.dark_room, TRUE, SET_IN_GAME},
{"eight_bit_tty", &iflags.wc_eight_bit_input, FALSE, SET_IN_GAME}, /*WC*/
#ifdef TTY_GRAPHICS
{"extmenu", &iflags.extmenu, FALSE, SET_IN_GAME},
@@ -346,6 +347,7 @@ static struct Comp_Opt
{ "scroll_amount", "amount to scroll map when scroll_margin is reached",
20, DISP_IN_GAME }, /*WC*/
{ "scroll_margin", "scroll map when this far from the edge", 20, DISP_IN_GAME }, /*WC*/
{ "sortloot", "sort object selection lists by description", 4, SET_IN_GAME },
#ifdef MSDOS
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE },
#endif
@@ -496,6 +498,35 @@ STATIC_OVL boolean FDECL(wc2_supported, (const char *));
STATIC_DCL void FDECL(remove_autopickup_exception, (struct autopickup_exception *));
STATIC_OVL int FDECL(count_ape_maps, (int *, int *));
void
reglyph_darkroom()
{
xchar x,y;
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
struct rm *lev = &levl[x][y];
if (!flags.dark_room) {
if (lev->glyph == cmap_to_glyph(S_darkroom))
lev->glyph = lev->waslit ? cmap_to_glyph(S_room) : cmap_to_glyph(S_stone);
} else {
if (lev->glyph == cmap_to_glyph(S_room) &&
lev->seenv &&
lev->waslit && !cansee(x,y))
lev->glyph = cmap_to_glyph(S_darkroom);
else if (lev->glyph == cmap_to_glyph(S_stone) &&
lev->typ == ROOM &&
lev->seenv &&
!cansee(x,y))
lev->glyph = cmap_to_glyph(S_darkroom);
}
}
if (flags.dark_room && iflags.use_color)
showsyms[S_darkroom]=showsyms[S_room];
else
showsyms[S_darkroom]=showsyms[S_stone];
}
/* check whether a user-supplied option string is a proper leading
substring of a particular option name; option string might have
a colon or equals sign and arbitrary value appended to it */
@@ -629,6 +660,7 @@ initoptions_init()
(genericptr_t)def_inv_order, sizeof flags.inv_order);
flags.pickup_types[0] = '\0';
flags.pickup_burden = MOD_ENCUMBER;
flags.sortloot = 'l'; /* sort only loot by default */
for (i = 0; i < NUM_DISCLOSURE_OPTIONS; i++)
flags.end_disclose[i] = DISCLOSE_PROMPT_DEFAULT_NO;
@@ -704,6 +736,8 @@ initoptions_finish()
/* result in the player's preferred fruit [better than "\033"]. */
obj_descr[SLIME_MOLD].oc_name = "fruit";
reglyph_darkroom();
return;
}
@@ -2328,6 +2362,22 @@ goodfruit:
return;
}
fullname = "sortloot";
if (match_optname(opts, fullname, 4, TRUE)) {
op = string_for_env_opt(fullname, opts, FALSE);
if (op) {
switch (tolower(*op)) {
case 'n':
case 'l':
case 'f': flags.sortloot = tolower(*op);
break;
default: badoption(opts);
return;
}
}
return;
}
fullname = "suppress_alert";
if (match_optname(opts, fullname, 4, TRUE)) {
if (duplicate) complain_about_duplicate(opts,1);
@@ -2810,7 +2860,8 @@ goodfruit:
else if ((boolopt[i].addr) == &flags.invlet_constant) {
if (flags.invlet_constant) reassign();
}
else if ((boolopt[i].addr) == &flags.lit_corridor) {
else if (((boolopt[i].addr) == &flags.lit_corridor) ||
((boolopt[i].addr) == &flags.dark_room)) {
/*
* All corridor squares seen via night vision or
* candles & lamps change. Update them by calling
@@ -2820,6 +2871,7 @@ goodfruit:
*/
vision_recalc(2); /* shut down vision */
vision_full_recalc = 1; /* delayed recalc */
if (iflags.use_color) need_redraw = TRUE; /* darkroom refresh */
}
else if ((boolopt[i].addr) == &iflags.use_inverse ||
(boolopt[i].addr) == &flags.showrace ||
@@ -2862,6 +2914,10 @@ static NEARDATA const char *runmodes[] = {
"teleport", "run", "walk", "crawl"
};
static NEARDATA const char *sortltype[] = {
"none", "loot", "full"
};
/*
* Convert the given string of object classes to a string of default object
* symbols.
@@ -3149,8 +3205,10 @@ doset()
}
destroy_nhwindow(tmpwin);
if (need_redraw)
if (need_redraw) {
reglyph_darkroom();
(void) doredraw();
}
return 0;
}
@@ -3168,7 +3226,8 @@ boolean setinitial,setfromfile;
char buf[BUFSZ];
/* Special handling of menustyle, pickup_burden, pickup_types,
* disclose, runmode, msg_window, menu_headings, and number_pad options.
* disclose, runmode, msg_window, menu_headings, sortloot,
* and number_pad options.
* Also takes care of interactive autopickup_exception_handling changes.
*/
if (!strcmp("menustyle", optname)) {
@@ -3349,6 +3408,23 @@ boolean setinitial,setfromfile;
}
destroy_nhwindow(tmpwin);
#endif
} else if (!strcmp("sortloot", optname)) {
const char *sortl_name;
menu_item *sortl_pick = (menu_item *)0;
tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin);
for (i = 0; i < SIZE(sortltype); i++) {
sortl_name = sortltype[i];
any.a_char = *sortl_name;
add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0,
ATR_NONE, sortl_name, MENU_UNSELECTED);
}
end_menu(tmpwin, "Select loot sorting type:");
if (select_menu(tmpwin, PICK_ONE, &sortl_pick) > 0) {
flags.sortloot = sortl_pick->item.a_char;
free((genericptr_t)sortl_pick);
}
destroy_nhwindow(tmpwin);
} else if (!strcmp("align_message", optname) ||
!strcmp("align_status", optname)) {
menu_item *window_pick = (menu_item *)0;
@@ -3938,6 +4014,15 @@ char *buf;
if (iflags.wc_scroll_margin) Sprintf(buf, "%d",iflags.wc_scroll_margin);
else Strcpy(buf, defopt);
}
else if (!strcmp(optname, "sortloot")) {
char *sortname = (char *)NULL;
for (i=0; i < SIZE(sortltype) && sortname==(char *)NULL; i++) {
if (flags.sortloot == sortltype[i][0])
sortname = (char *)sortltype[i];
}
if (sortname != (char *)NULL)
Sprintf(buf, "%s", sortname);
}
else if (!strcmp(optname, "player_selection"))
Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog");
#ifdef MSDOS
+3 -3
View File
@@ -250,7 +250,7 @@ lookat(x, y, buf, monbuf)
int tnum = what_trap(glyph_to_trap(glyph));
Strcpy(buf, defsyms[trap_to_defsym(tnum)].explanation);
} else if(!glyph_is_cmap(glyph)) {
Strcpy(buf,"dark part of a room");
Strcpy(buf,"unexplored area");
} else switch(glyph_to_cmap(glyph)) {
case S_altar:
Sprintf(buf, "%s %saltar",
@@ -557,8 +557,8 @@ const char **firstmatch;
x_str = defsyms[i].explanation;
if (sym == ((looked) ?
showsyms[i] : defsyms[i].sym) && *x_str) {
/* avoid "an air", "a water", or "a floor of a room" */
int article = (i == S_room) ? 2 : /* 2=>"the" */
/* avoid "an air", "a water", "a floor of a room", "a dark part of a room" */
int article = ((i == S_room)||(i == S_darkroom)) ? 2 : /* 2=>"the" */
!(strcmp(x_str, "air") == 0 || /* 1=>"an" */
strcmp(x_str, "water") == 0); /* 0=>(none)*/
+15 -2
View File
@@ -708,9 +708,10 @@ menu_item **pick_list; /* return list of items picked */
int how; /* type of query */
boolean FDECL((*allow), (OBJ_P));/* allow function */
{
int n;
int i, j, n;
winid win;
struct obj *curr, *last, fake_hero_object;
struct obj **oarray;
char *pack;
anything any;
boolean printed_type_name,
@@ -743,6 +744,16 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
return 1;
}
oarray = objarr_init(n);
/* Add objects to the array */
i = 0;
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
if ((*allow)(curr)) {
objarr_set(curr, i++, oarray, (flags.sortloot == 'f' ||
(flags.sortloot == 'l' && !(qflags & USE_INVLET))));
}
}
win = create_nhwindow(NHW_MENU);
start_menu(win);
any = zeroany;
@@ -756,7 +767,8 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
pack = flags.inv_order;
do {
printed_type_name = FALSE;
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
for (i = 0; i < n; i++) {
curr = oarray[i];
if ((qflags & FEEL_COCKATRICE) && curr->otyp == CORPSE &&
will_feel_cockatrice(curr, FALSE)) {
destroy_nhwindow(win); /* stop the menu and revert */
@@ -784,6 +796,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
}
pack++;
} while (sorted && *pack);
free(oarray);
if (engulfer) {
char buf[BUFSZ];
+1 -1
View File
@@ -888,7 +888,7 @@ display_stinking_cloud_positions(state)
int state;
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
} else if (state == 1) {
int x,y, dx, dy;
int dist = 6;
+15 -12
View File
@@ -520,12 +520,11 @@ schar filling;
for (x = x1; x <= x2; x++)
for (y = y1; y <= y2; y++) {
#ifndef WALLIFIED_MAZE
levl[x][y].typ = STONE;
#else
levl[x][y].typ =
(y < 2 || ((x % 2) && (y % 2))) ? STONE : filling;
#endif
if (level.flags.corrmaze)
levl[x][y].typ = STONE;
else
levl[x][y].typ =
(y < 2 || ((x % 2) && (y % 2))) ? STONE : filling;
}
}
@@ -2948,6 +2947,7 @@ spo_level_flags(coder)
if (lflags & GRAVEYARD) level.flags.graveyard = 1;
if (lflags & ICEDPOOLS) icedpools = TRUE;
if (lflags & SOLIDIFY) coder->solidify = TRUE;
if (lflags & CORRMAZE) level.flags.corrmaze = TRUE;
opvar_free(flagdata);
}
@@ -4114,11 +4114,7 @@ spo_mazewalk(coder)
if (!isok(x,y)) return;
if (OV_i(ftyp) < 1) {
#ifndef WALLIFIED_MAZE
OV_i(ftyp) = CORR;
#else
OV_i(ftyp) = ROOM;
#endif
OV_i(ftyp) = level.flags.corrmaze ? CORR : ROOM;
}
/* don't use move() - it doesn't use W_NORTH, etc. */
@@ -5167,7 +5163,14 @@ next_opcode:
link_doors_rooms();
fill_rooms();
remove_boundary_syms();
wallification(1, 0, COLNO-1, ROWNO-1);
/* FIXME: Ideally, we want this call to only cover areas of the map
* which were not inserted directly by the special level file (see
* the insect legs on Baalzebub's level, for instance). Since that
* is currently not possible, we overload the corrmaze flag for this
* purpose.
*/
if (!level.flags.corrmaze)
wallification(1, 0, COLNO-1, ROWNO-1);
count_features();
+1 -1
View File
@@ -79,7 +79,7 @@ VARDAT = $(VARDATD) $(VARDATND)
DATHELP = help hh cmdhelp history opthelp wizhelp
SPEC_LEVS = asmodeus.lev baalz.lev bigrm-?.lev castle.lev fakewiz?.lev \
SPEC_LEVS = asmodeus.lev baalz.lev bigrm-*.lev castle.lev fakewiz?.lev \
juiblex.lev knox.lev medusa-?.lev minend-?.lev minefill.lev \
minetn-?.lev oracle.lev orcus.lev sanctum.lev soko?-?.lev \
tower?.lev valley.lev wizard?.lev \
+2 -1
View File
@@ -112,7 +112,7 @@ FILE *orig_yyin = NULL;
map_cnt = 0;
return MAP_ID;
}
<MAPC>[-|}{+xABCISHKMPLWTtFYU\\#. 0123456789]*\r?\n {
<MAPC>[-|}{+xABCISHKPLWTF\\#. 0123456789]*\r?\n {
int len = yyleng;
savetoken(yytext);
/* convert \r\n to \n */
@@ -296,6 +296,7 @@ shroud { savetoken(yytext); yylval.i=SHROUD; return FLAG_TYPE; }
graveyard { savetoken(yytext); yylval.i=GRAVEYARD; return FLAG_TYPE; }
icedpools { savetoken(yytext); yylval.i=ICEDPOOLS; return FLAG_TYPE; }
solidify { savetoken(yytext); yylval.i=SOLIDIFY; return FLAG_TYPE; }
corrmaze { savetoken(yytext); yylval.i=CORRMAZE; return FLAG_TYPE; }
[0-9]+d[0-9]+ { char *p = strchr(yytext, 'd');
savetoken(yytext);
if (p) {
+376 -267
View File
File diff suppressed because it is too large Load Diff
+158 -83
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 lev_main.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 lev_main.c $NHDT-Date: 1428655166 2015/04/10 08:39:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
/* NetHack 3.5 lev_main.c $Date: 2012/01/12 04:48:12 $ $Revision: 1.20 $ */
/* SCCS Id: @(#)lev_main.c 3.5 2007/01/17 */
/* Copyright (c) 1989 by Jean-Christophe Collet */
@@ -8,11 +8,9 @@
* This file contains the main function for the parser
* and some useful functions needed by yacc
*/
#define SPEC_LEV /* for MPW */
/* although, why don't we move those special defines here.. and in dgn_main? */
#include <stdarg.h>
#define SPEC_LEV /* for USE_OLDARGS (sp_lev.h) and for MPW (macconf.h) */
#define NEED_VARARGS
#include "hack.h"
#include "date.h"
#include "sp_lev.h"
@@ -77,14 +75,14 @@ extern unsigned _stklen = STKSIZ;
#endif
#define MAX_ERRORS 25
extern int NDECL (yyparse);
extern void FDECL (init_yyin, (FILE *));
extern void FDECL (init_yyout, (FILE *));
extern int NDECL(yyparse);
extern void FDECL(init_yyin, (FILE *));
extern void FDECL(init_yyout, (FILE *));
int FDECL (main, (int, char **));
void FDECL (yyerror, (const char *));
void FDECL (yywarning, (const char *));
int NDECL (yywrap);
int FDECL(main, (int, char **));
void FDECL(yyerror, (const char *));
void FDECL(yywarning, (const char *));
int NDECL(yywrap);
int FDECL(get_floor_type, (CHAR_P));
int FDECL(get_room_type, (char *));
int FDECL(get_trap_type, (char *));
@@ -113,11 +111,12 @@ extern void NDECL(decl_init);
void FDECL(add_opcode, (sp_lev *, int, genericptr_t));
static boolean FDECL(write_common_data, (int,sp_lev *));
static boolean FDECL(write_common_data, (int));
static boolean FDECL(write_maze, (int,sp_lev *));
static void NDECL(init_obj_classes);
static int FDECL(case_insensitive_comp, (const char *, const char *));
void VDECL(lc_pline, (const char *, ...));
void VDECL(lc_error, (const char *, ...));
void VDECL(lc_warning, (const char *, ...));
char * FDECL(decode_parm_chr, (CHAR_P));
@@ -128,8 +127,8 @@ struct opvar * FDECL(set_opvar_region, (struct opvar *, long));
struct opvar * FDECL(set_opvar_mapchar, (struct opvar *, long));
struct opvar * FDECL(set_opvar_monst, (struct opvar *, long));
struct opvar * FDECL(set_opvar_obj, (struct opvar *, long));
struct opvar * FDECL(set_opvar_str, (struct opvar *, char *));
struct opvar * FDECL(set_opvar_var, (struct opvar *, char *));
struct opvar * FDECL(set_opvar_str, (struct opvar *, const char *));
struct opvar * FDECL(set_opvar_var, (struct opvar *, const char *));
void VDECL(add_opvars, (sp_lev *, const char *, ...));
void NDECL(break_stmt_start);
void FDECL(break_stmt_end, (sp_lev *));
@@ -295,8 +294,7 @@ char **argv;
}
fin = freopen(fname, "r", stdin);
if (!fin) {
(void) fprintf(stderr,"Can't open \"%s\" for input.\n",
fname);
lc_pline("Can't open \"%s\" for input.\n", fname);
perror(fname);
errors_encountered = TRUE;
} else {
@@ -329,9 +327,10 @@ yyerror(s)
const char *s;
{
char *e = ((char *)s + strlen(s) - 1);
(void) fprintf(stderr, "%s: line %d, pos %d: %s",
fname, nh_line_number,
token_start_pos-strlen(curr_token), s);
token_start_pos - (int)strlen(curr_token), s);
if (*e != '.' && *e != '!')
(void) fprintf(stderr, " at \"%s\"", curr_token);
(void) fprintf(stderr, "\n");
@@ -362,30 +361,84 @@ yywrap()
return 1;
}
/*
* lc_pline(): lev_comp version of pline(), stripped down version of
* core's pline(), with convoluted handling for variadic arguments to
* support <stdarg.h>, <varargs.h>, and neither of the above.
*
* Using state for message/warning/error mode simplifies calling interface.
*/
#define LC_PLINE_MESSAGE 0
#define LC_PLINE_WARNING 1
#define LC_PLINE_ERROR 2
static int lc_pline_mode = LC_PLINE_MESSAGE;
#if defined(USE_STDARG) || defined(USE_VARARGS)
static void FDECL(lc_vpline, (const char *, va_list));
void
lc_error(const char *fmt, ...)
{
char buf[512];
va_list argp;
va_start(argp, fmt);
(void) vsnprintf(buf, 511, fmt, argp);
va_end(argp);
yyerror(buf);
lc_pline VA_DECL(const char *, line)
VA_START(line);
VA_INIT(line, char *);
lc_vpline(line, VA_ARGS);
VA_END();
}
# ifdef USE_STDARG
static void
lc_vpline(const char *line, va_list the_args) {
# else
static void
lc_vpline(line, the_args) const char *line; va_list the_args; {
# endif
#else /* USE_STDARG | USE_VARARG */
#define lc_vpline lc_pline
void
lc_warning(const char *fmt, ...)
{
char buf[512];
va_list argp;
lc_pline VA_DECL(const char *, line)
#endif /* USE_STDARG | USE_VARARG */
va_start(argp, fmt);
(void) vsnprintf(buf, 511, fmt, argp);
va_end(argp);
char pbuf[3*BUFSZ];
static char nomsg[] = "(no message)";
/* Do NOT use VA_START and VA_END in here... see above */
yywarning(buf);
if (!line || !*line) line = nomsg; /* shouldn't happen */
if (index(line, '%')) {
Vsprintf(pbuf, line, VA_ARGS);
pbuf[BUFSZ-1] = '\0'; /* truncate if long */
line = pbuf;
}
switch (lc_pline_mode) {
case LC_PLINE_ERROR: yyerror(line); break;
case LC_PLINE_WARNING: yywarning(line); break;
default: (void)fprintf(stderr, "%s\n", line); break;
}
lc_pline_mode = LC_PLINE_MESSAGE; /* reset to default */
return;
}
/*VARARGS1*/
void
lc_error VA_DECL(const char *, line)
VA_START(line);
VA_INIT(line, const char *);
lc_pline_mode = LC_PLINE_ERROR;
lc_vpline(line, VA_ARGS);
VA_END();
return;
}
/*VARARGS1*/
void
lc_warning VA_DECL(const char *, line)
VA_START(line);
VA_INIT(line, const char *);
lc_pline_mode = LC_PLINE_WARNING;
lc_vpline(line, VA_ARGS);
VA_END();
return;
}
@@ -394,16 +447,17 @@ decode_parm_chr(chr)
char chr;
{
static char buf[32];
switch (chr) {
default: sprintf(buf, "unknown"); break;
case 'i': sprintf(buf, "int"); break;
case 'r': sprintf(buf, "region"); break;
case 's': sprintf(buf, "str"); break;
case 'O': sprintf(buf, "obj"); break;
case 'c': sprintf(buf, "coord"); break;
case ' ': sprintf(buf, "nothing"); break;
case 'm': sprintf(buf, "mapchar"); break;
case 'M': sprintf(buf, "monster"); break;
default: Strcpy(buf, "unknown"); break;
case 'i': Strcpy(buf, "int"); break;
case 'r': Strcpy(buf, "region"); break;
case 's': Strcpy(buf, "str"); break;
case 'O': Strcpy(buf, "obj"); break;
case 'c': Strcpy(buf, "coord"); break;
case ' ': Strcpy(buf, "nothing"); break;
case 'm': Strcpy(buf, "mapchar"); break;
case 'M': Strcpy(buf, "monster"); break;
}
return buf;
}
@@ -500,7 +554,7 @@ long val;
struct opvar *
set_opvar_str(ov, val)
struct opvar *ov;
char *val;
const char *val;
{
if (ov) {
ov->spovartyp = SPOVAR_STRING;
@@ -512,7 +566,7 @@ char *val;
struct opvar *
set_opvar_var(ov, val)
struct opvar *ov;
char *val;
const char *val;
{
if (ov) {
ov->spovartyp = SPOVAR_VARIABLE;
@@ -524,13 +578,36 @@ char *val;
#define New(type) \
(type *) memset((genericptr_t)alloc(sizeof(type)), 0, sizeof(type))
void
add_opvars(sp_lev *sp, const char *fmt, ...)
{
const char *p;
va_list argp;
#if defined(USE_STDARG) || defined(USE_VARARGS)
static void FDECL(vadd_opvars, (sp_lev *, const char *, va_list));
va_start(argp, fmt);
void
add_opvars VA_DECL2(sp_lev *, sp, const char *, fmt)
VA_START(fmt);
VA_INIT(fmt, char *);
vadd_opvars(sp, fmt, VA_ARGS);
VA_END();
}
# ifdef USE_STDARG
static void
vadd_opvars(sp_lev *sp, const char *fmt, va_list the_args) {
# else
static void
vadd_opvars(sp, fmt, the_args) sp_lev *sp; const char *fmt; va_list the_args; {
# endif
#else /* USE_STDARG | USE_VARARG */
#define vadd_opvars add_opvars
void
add_opvars VA_DECL2(sp_lev *, sp, const char *, fmt)
#endif /* USE_STDARG | USE_VARARG */
const char *p, *lp;
long la;
/* Do NOT use VA_START and VA_END in here... see above */
for(p = fmt; *p != '\0'; p++) {
switch(*p) {
@@ -538,74 +615,73 @@ add_opvars(sp_lev *sp, const char *fmt, ...)
case 'i': /* integer */
{
struct opvar *ov = New(struct opvar);
set_opvar_int(ov, va_arg(argp, long));
set_opvar_int(ov, VA_NEXT(la, long));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 'c': /* coordinate */
{
struct opvar *ov = New(struct opvar);
set_opvar_coord(ov, va_arg(argp, long));
set_opvar_coord(ov, VA_NEXT(la, long));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 'r': /* region */
{
struct opvar *ov = New(struct opvar);
set_opvar_region(ov, va_arg(argp, long));
set_opvar_region(ov, VA_NEXT(la, long));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 'm': /* mapchar */
{
struct opvar *ov = New(struct opvar);
set_opvar_mapchar(ov, va_arg(argp, long));
set_opvar_mapchar(ov, VA_NEXT(la, long));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 'M': /* monster */
{
struct opvar *ov = New(struct opvar);
set_opvar_monst(ov, va_arg(argp, long));
set_opvar_monst(ov, VA_NEXT(la, long));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 'O': /* object */
{
struct opvar *ov = New(struct opvar);
set_opvar_obj(ov, va_arg(argp, long));
set_opvar_obj(ov, VA_NEXT(la, long));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 's': /* string */
{
struct opvar *ov = New(struct opvar);
set_opvar_str(ov, va_arg(argp, char *));
set_opvar_str(ov, VA_NEXT(lp, const char *));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 'v': /* variable */
{
struct opvar *ov = New(struct opvar);
set_opvar_var(ov, va_arg(argp, char *));
set_opvar_var(ov, VA_NEXT(lp, const char *));
add_opcode(sp, SPO_PUSH, ov);
break;
}
case 'o': /* opcode */
{
long i = va_arg(argp, int);
long i = VA_NEXT(la, int);
if (i < 0 || i >= MAX_SP_OPCODES)
fprintf(stderr, "add_opvars: unknown opcode '%li'.\n", i);
lc_pline("add_opvars: unknown opcode '%ld'.", i);
add_opcode(sp, i, NULL);
break;
}
default:
fprintf(stderr, "add_opvars: illegal format character '%c'.\n", *p);
lc_pline("add_opvars: illegal format character '%c'.", *p);
break;
}
}
va_end(argp);
return;
}
void
@@ -785,12 +861,12 @@ spovar2str(spovar)
{
static int togl = 0;
static char buf[2][128];
char *n = NULL;
const char *n = NULL;
int is_array = (spovar & SPOVAR_ARRAY);
spovar &= ~SPOVAR_ARRAY;
switch (spovar) {
default: lc_error("spovar2str(%li)", spovar); break;
default: lc_error("spovar2str(%ld)", spovar); break;
case SPOVAR_INT: n = "integer"; break;
case SPOVAR_STRING: n = "string"; break;
case SPOVAR_VARIABLE: n = "variable"; break;
@@ -860,7 +936,7 @@ reverse_jmp_opcode(opcode)
case SPO_JG: return SPO_JLE;
case SPO_JLE: return SPO_JG;
case SPO_JGE: return SPO_JL;
default: lc_error("Cannot reverse comparison jmp opcode %i.", opcode); return SPO_NULL;
default: lc_error("Cannot reverse comparison jmp opcode %d.", opcode); return SPO_NULL;
}
}
@@ -897,7 +973,7 @@ opvar_clone(ov)
break;
default:
{
lc_error("Unknown opvar_clone value type (%i)!", ov->spovartyp);
lc_error("Unknown opvar_clone value type (%d)!", ov->spovartyp);
}
}
return tmpov;
@@ -1110,15 +1186,15 @@ char c;
case 'H' : return(SCORR);
case '{' : return(FOUNTAIN);
case '\\' : return(THRONE);
case 'K' :
return(SINK);
case 'K' : return(SINK);
case '}' : return(MOAT);
case 'P' : return(POOL);
case 'L' : return(LAVAPOOL);
case 'I' : return(ICE);
case 'W' : return(WATER);
case 'T' : return (TREE);
case 'F' : return (IRONBARS); /* Fe = iron */
case 'T' : return (TREE);
case 'F' : return (IRONBARS); /* Fe = iron */
case 'x' : return(MAX_TYPE); /* "see-through" */
}
return(INVALID_TYPE);
}
@@ -1133,7 +1209,7 @@ genericptr_t dat;
_opcode *tmp;
if ((opc < 0) || (opc >= MAX_SP_OPCODES))
lc_error("Unknown opcode '%i'", opc);
lc_error("Unknown opcode '%d'", opc);
tmp = (_opcode *)alloc(sizeof(_opcode)*(nop+1));
if (sp->opcodes && nop) {
@@ -1226,7 +1302,7 @@ sp_lev *sp;
mbuf[((max_hig-1) * max_len) + (max_len-1) + 1] = '\0';
add_opvars(sp, "siio", mbuf, max_hig, max_len, SPO_MAP);
add_opvars(sp, "siio", VA_PASS4(mbuf, max_hig, max_len, SPO_MAP));
for (dy = 0; dy < max_hig; dy++)
Free(tmpmap[dy]);
@@ -1240,9 +1316,8 @@ sp_lev *sp;
* Output some info common to all special levels.
*/
static boolean
write_common_data(fd, lvl)
write_common_data(fd)
int fd;
sp_lev *lvl;
{
static struct version_info version_data = {
VERSION_NUMBER, VERSION_FEATURES,
@@ -1264,7 +1339,7 @@ sp_lev *maze;
{
int i;
if (!write_common_data(fd, maze))
if (!write_common_data(fd))
return FALSE;
Write(fd, &(maze->n_opcodes), sizeof(maze->n_opcodes));
@@ -1275,7 +1350,7 @@ sp_lev *maze;
Write(fd, &(tmpo.opcode), sizeof(tmpo.opcode));
if (tmpo.opcode < SPO_NULL || tmpo.opcode >= MAX_SP_OPCODES)
panic("write_maze: unknown opcode (%i).", tmpo.opcode);
panic("write_maze: unknown opcode (%d).", tmpo.opcode);
if (tmpo.opcode == SPO_PUSH) {
genericptr_t opdat = tmpo.opdat;
@@ -1304,14 +1379,14 @@ sp_lev *maze;
Free(ov->vardata.str);
}
break;
default: panic("write_maze: unknown data type (%i).", ov->spovartyp);
default: panic("write_maze: unknown data type (%d).", ov->spovartyp);
}
} else panic("write_maze: PUSH with no data.");
} else {
/* sanity check */
genericptr_t opdat = tmpo.opdat;
if (opdat)
panic("write_maze: opcode (%i) has data.", tmpo.opcode);
panic("write_maze: opcode (%d) has data.", tmpo.opcode);
}
Free(tmpo.opdat);
@@ -1357,7 +1432,7 @@ sp_lev *lvl;
if (!lvl) panic("write_level_file");
if (be_verbose)
fprintf(stdout, "File: '%s', opcodes: %li\n", lbuf, lvl->n_opcodes);
fprintf(stdout, "File: '%s', opcodes: %ld\n", lbuf, lvl->n_opcodes);
if (!write_maze(fout, lvl))
return FALSE;
-3
View File
@@ -1367,9 +1367,6 @@ static const char *build_opts[] = {
#ifdef VISION_TABLES
"vision tables",
#endif
#ifdef WALLIFIED_MAZE
"walled mazes",
#endif
#ifdef ZEROCOMP
"zero-compressed save files",
#endif
+264 -226
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 wintty.c $NHDT-Date: 1427667623 2015/03/29 22:20:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */
/* NetHack 3.5 wintty.c $NHDT-Date: 1428394244 2015/04/07 08:10:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.84 $ */
/* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -1770,7 +1770,7 @@ struct WinDesc *cw;
if (i == cw->maxrow) {
#ifdef H2344_BROKEN
if(cw->type == NHW_TEXT){
tty_curs(BASE_WINDOW, 0, (int)ttyDisplay->cury+1);
tty_curs(BASE_WINDOW, 1, (int)ttyDisplay->cury+1);
cl_eos();
}
#endif