Merge branch 'master' into derek-farming

Reverse merge before final reintegration.

* master: (40 commits)
  Fix magic mapped dark room symbols
  Disclose extinct species alongside genocided ones
  ...

Conflicts:
	doc/fixes35.0
	src/do.c
	src/files.c
	src/invent.c
	src/objnam.c
	sys/share/pcmain.c
This commit is contained in:
Derek S. Ray
2015-04-10 16:56:30 -04:00
67 changed files with 4905 additions and 3014 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
}
+69
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
@@ -2051,6 +2053,9 @@ An obsolete synonym for ``gender:male''.
Cannot be set with the `O' command.
.lp mention_walls
Give feedback when walking against a wall (default off).
.lp menucolors
Enable coloring menu lines (default off).
See ``Configuring Menu Colors'' on how to configure the colors.
.lp menustyle
Controls the interface used when you need to choose various objects (in
response to the Drop command, for instance). The value specified should
@@ -2321,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
@@ -2604,6 +2622,56 @@ The second example results in the exclusion of any corpse from autopickup.
The last example results in the exclusion of items known to be cursed from
autopickup.
.hn 2
Configuring Menu Colors
.pg
Some platforms allow you to define colors used in menu lines when the
line matches a user-defined pattern. At this time the tty, win32tty and
win32gui support this.
.pg
In general, the config file entries to configure the menu color mappings
look like this:
.si
.lp MENUCOLOR="pattern"=color&attribute
.ei
.PS "menu color"
.PL pattern
the pattern to match;
.PL color
the color to use for lines matching the pattern;
.PL attribute
the attribute to use for lines matching the pattern. The attribute is
optional, and if left out, you must also leave out the preceding ampersand.
If no attribute is defined, no attribute is used.
.PE
.lp ""
For explanation on pattern format and the matching routines, see
the pattern in the ``Configuring User Sounds'' -section.
.lp ""
Allowed colors are black, red, green, brown, blue, magenta, cyan, gray,
orange, lightgreen, yellow, lightblue, lightmagenta, lightcyan, and white.
.lp ""
Allowed attributes are none, bold, dim, underline, blink, and inverse.
Note that the platform used may interpret the attributes any way it
wants.
.lp ""
Here's an example of menu colors using NetHack's internal
pattern matching facility:
.sd
.si
MENUCOLOR="* blessed *"=green
MENUCOLOR="* cursed *"=red
MENUCOLOR="* cursed *(being worn)"=red&underline
.ei
.ed
specifies that any menu line with " blessed " contained
in it will be shown in green color, lines with " cursed " will be
shown in red, and lines with " cursed " followed by "(being worn)"
on the same line will be shown in red color and underlined.
You can have multiple MENUCOLOR entries in your config file,
and the last MENUCOLOR-line in your config file that matches
a menu line will be used for the line.
.pg
.hn 2
Configuring User Sounds
.pg
Some platforms allow you to define sound files to be played when a message
@@ -2784,6 +2852,7 @@ O S_ogre (ogre)
o S_orc (orc)
p S_piercer (piercer)
^ S_pit (pit)
# S_poisoncloud (poison cloud)
^ S_polymorph_trap (polymorph trap)
} S_pool (water)
! S_potion (potion)
+87
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
@@ -2479,6 +2482,10 @@ An obsolete synonym for ``{\tt gender:male}''. Cannot be set with the
\item[\ib{mention\_walls}]
Give feedback when walking against a wall (default off).
%.lp
\item[\ib{menucolors}]
Enable coloring menu lines (default off).
See ``{\it Configuring Menu Colors\/}'' on how to configure the colors.
%.lp
\item[\ib{menustyle}]
Controls the interface used when you need to choose various objects (in
response to the Drop command, for instance). The value specified should
@@ -2785,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
@@ -3141,6 +3162,71 @@ The second example results in the exclusion of any corpse from autopickup.
The last example results in the exclusion of items known to be cursed from
autopickup.
%.lp
%.hn 2
\subsection*{Configuring Menu Colors}
%.pg
Some platforms allow you to define colors used in menu lines when the
line matches a user-defined pattern. At this time the tty, win32tty and
win32gui support this.
%.pg
In general, the config file entries to configure the menu color mappings
look like this:
\begin{verbatim}
MENUCOLOR="pattern"=color&attribute
\end{verbatim}
\blist{}
%.lp
\item[\ib{pattern}]
the pattern to match;
%.lp
\item[\ib{color}]
the color to use for lines matching the pattern;
%.lp
\item[\ib{attribute}]
the attribute to use for lines matching the pattern. The attribute is
optional, and if left out, you must also leave out the preceding ampersand.
If no attribute is defined, no attribute is used.
\elist
%.lp ""
For explanation on pattern format and the matching routines, see
the pattern in the {\it Configuring User Sounds} -section.
%.lp ""
Allowed colors are {\it black}, {\it red}, {\it green}, {\it brown},
{\it blue}, {\it magenta}, {\it cyan}, {\it gray}, {\it orange},
{\it lightgreen}, {\it yellow}, {\it lightblue}, {\it lightmagenta},
{\it lightcyan}, and {\it white}.
%.lp ""
Allowed attributes are {\it none}, {\it bold}, {\it dim}, {\it underline},
{\it blink}, and {\it inverse}.
Note that the platform used may interpret the attributes any way it
wants.
%.lp ""
Here's an example of menu colors using NetHack's internal
pattern matching facility:
\begin{verbatim}
MENUCOLOR="* blessed *"=green
MENUCOLOR="* cursed *"=red
MENUCOLOR="* cursed *(being worn)"=red&underline
\end{verbatim}
specifies that any menu line with " blessed " contained
in it will be shown in green color, lines with " cursed " will be
shown in red, and lines with " cursed " followed by "(being worn)"
on the same line will be shown in red color and underlined.
You can have multiple MENUCOLOR entries in your config file,
and the last MENUCOLOR-line in your config file that matches
a menu line will be used for the line.
%.pg
%.lp
%.hn 2
\subsection*{Configuring User Sounds}
@@ -3343,6 +3429,7 @@ Default & Symbol Name & Description\\
\verb@o@ & S\_orc & (orc)\\
\verb@p@ & S\_piercer & (piercer)\\
\verb@^@ & S\_pit & (pit)\\
\verb@#@ & S\_poisoncloud & (poison cloud)\\
\verb@^@ & S\_polymorph\_trap & (polymorph trap)\\
\verb@}@ & S\_pool & (water)\\
\verb@!@ & S\_potion & (potion)\\
+6 -2
View File
@@ -887,13 +887,13 @@ show object symbols in menu headings in menus where those object symbols
act as menu accelerators, toggleable via "menu_objsyms" option
show t-shirt text at end of game inventory disclose
hitting with a polearm remembers the position of the last monster you hit
allow showing legal polearm positions when asked for location to hit
add messages for trying to pick up some terrain features
boomerang makes noise when hitting a sink
non-pet rust monsters would eat rust-proofed non-digestibles but ignore
those non-digestibles otherwise
kicking a grave may topple the gravestone
allow showing legal jumping positions when asked for location to jump to
allow showing legal positions for stinking cloud, jumping and polearms
when asked for a location
cloned creatures (of any type) don't deathdrop items
pudding corpses behave somewhat differently than before
@@ -1114,6 +1114,7 @@ show more explicit reason why player was helpless at death
added new hallucinatory-only gods
options to create the character blind or nudist
moving clouds on the plane of air
disclose extinct species alongside genocided ones
Platform- and/or Interface-Specific New Features
@@ -1134,6 +1135,7 @@ smartphone: added "Type Cmd" command that allows to type arbitrary commands
smartphone: added Q(quiver) command to "Attack" layout
smartphone: fixed F command to prompt for direction
unix,vms: altmeta option to handle terminals which send "ESC c" for Alt+c
tty,win32gui,win32tty: add menucolors
NetHack Community Patches (or Variation) Included
@@ -1152,6 +1154,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
sortloot by Jeroen Demeyer and Jukka Lahtinen
Code Cleanup and Reorganization
+18
View File
@@ -7,6 +7,10 @@
#ifndef COLOR_H
#define COLOR_H
#ifdef MENU_COLOR_REGEX
#include <regex.h>
#endif
/*
* The color scheme used is tailored for an IBM PC. It consists of the
* standard 8 colors, folowed by their bright counterparts. There are
@@ -51,4 +55,18 @@
#define DRAGON_SILVER CLR_BRIGHT_CYAN
#define HI_ZAP CLR_BRIGHT_BLUE
struct menucoloring {
# ifdef MENU_COLOR_REGEX
# ifdef MENU_COLOR_REGEX_POSIX
regex_t match;
# else
struct re_pattern_buffer match;
# endif
# else
char *match;
# endif
int color, attr;
struct menucoloring *next;
};
#endif /* COLOR_H */
+8 -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)
@@ -437,6 +436,14 @@ typedef unsigned char uchar;
* bugs left here.
*/
/* Menucolors */
# define MENU_COLOR_REGEX /* use GNU regex */
/*# define MENU_COLOR_REGEX_POSIX*/ /* use POSIX regex */
/* if neither is defined, uses pmatch()
* pmatch() provides basic globbing: '*' and '?' wildcards.
*/
#define STATUS_VIA_WINDOWPORT /* re-work of the status line updating process */
#define STATUS_HILITES /* support hilites of status fields */
/* #define WINCHAIN*/ /* stacked window systems */
+8
View File
@@ -743,6 +743,7 @@ E boolean NDECL(recover_savefile);
#ifdef SYSCF_FILE
E void NDECL(assure_syscf_file);
#endif
E int FDECL(nhclose, (int));
#ifdef HOLD_LOCKFILE_OPEN
E void NDECL(really_close);
#endif
@@ -856,6 +857,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 **));
@@ -1158,6 +1161,7 @@ E boolean FDECL(bad_location, (XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P))
E void FDECL(place_lregion, (XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P,
XCHAR_P,XCHAR_P,XCHAR_P,XCHAR_P,
XCHAR_P,d_level *));
E void NDECL(fumaroles);
E void NDECL(movebubbles);
E void NDECL(water_friction);
E void FDECL(save_waterlevel, (int,int));
@@ -1525,6 +1529,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));
@@ -1587,6 +1592,9 @@ E void FDECL(parsesymbols, (char *));
E struct symparse *FDECL(match_sym, (char *));
E void NDECL(set_playmode);
E int FDECL(sym_val, (char *));
E boolean FDECL(add_menu_coloring, (char *));
E boolean FDECL(get_menu_coloring, (char *, int *, int *));
E void NDECL(free_menu_coloring);
/* ### pager.c ### */
+3
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-- */
@@ -201,6 +203,7 @@ struct instance_flags {
boolean rlecomp; /* run-length comp of levels when writing savefile */
uchar num_pad_mode;
boolean echo; /* 1 to echo characters */
boolean use_menu_color; /* use color in menus; only if wc_color */
#if 0
boolean DECgraphics; /* use DEC VT-xxx extended character set */
boolean IBMgraphics; /* use IBM extended character set */
+82 -75
View File
@@ -128,97 +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_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 75 /* swallow top left [1] */
#define S_sw_tc 76 /* swallow top center [2] Order: */
#define S_sw_tr 77 /* swallow top right [3] */
#define S_sw_ml 78 /* swallow middle left [4] 1 2 3 */
#define S_sw_mr 79 /* swallow middle right [6] 4 5 6 */
#define S_sw_bl 80 /* swallow bottom left [7] 7 8 9 */
#define S_sw_bc 81 /* swallow bottom center [8] */
#define S_sw_br 82 /* 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 83 /* explosion top left */
#define S_explode2 84 /* explosion top center */
#define S_explode3 85 /* explosion top right Ex. */
#define S_explode4 86 /* explosion middle left */
#define S_explode5 87 /* explosion middle center /-\ */
#define S_explode6 88 /* explosion middle right |@| */
#define S_explode7 89 /* explosion bottom left \-/ */
#define S_explode8 90 /* explosion bottom center */
#define S_explode9 91 /* 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 92 /* 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 29 /* 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;
@@ -549,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
+1
View File
@@ -95,6 +95,7 @@ struct u_conduct { /* number of times... */
struct u_roleplay {
boolean blind; /* permanently blind */
boolean nudist; /* has not worn any armor, ever */
long numbones; /* # of bones files loaded */
};
/*** Unified structure containing role information ***/
+2
View File
@@ -294,6 +294,8 @@ boolean resuming;
/* underwater and waterlevel vision are done here */
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
movebubbles();
else if (Is_firelevel(&u.uz))
fumaroles();
else if (Underwater)
under_water(0);
/* vision while buried done here */
+7 -4
View File
@@ -37,6 +37,8 @@ STATIC_DCL boolean FDECL(figurine_location_checks,
(struct obj *, coord *, BOOLEAN_P));
STATIC_DCL void FDECL(add_class, (char *, CHAR_P));
STATIC_DCL void FDECL(setapplyclasses, (char *));
STATIC_DCL boolean FDECL(is_valid_jump_pos, (int, int, int, BOOLEAN_P));
STATIC_DCL boolean FDECL(find_poleable_mon, (coord *, int, int));
#ifdef AMIGA
void FDECL( amii_speaker, ( struct obj *, char *, int ) );
@@ -1394,14 +1396,15 @@ 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++)
for (dy = -4; dy <= 4; dy++) {
x = dx + (int)u.ux;
y = dy + (int)u.uy;
if (isok(x,y) && is_valid_jump_pos(x,y, jumping_is_magic, FALSE))
if (isok(x,y) && ACCESSIBLE(levl[x][y].typ) &&
is_valid_jump_pos(x,y, jumping_is_magic, FALSE))
tmp_at(x,y);
}
} else {
@@ -2602,14 +2605,14 @@ 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++)
for (dy = -4; dy <= 4; dy++) {
x = dx + (int)u.ux;
y = dy + (int)u.uy;
if (isok(x, y) &&
if (isok(x, y) && ACCESSIBLE(levl[x][y].typ) &&
distu(x, y) >= polearm_range_min &&
distu(x, y) <= polearm_range_max) {
tmp_at(x, y);
+5 -4
View File
@@ -331,7 +331,7 @@ struct obj *corpse;
clear_bypasses();
fd = open_bonesfile(&u.uz, &bonesid);
if (fd >= 0) {
(void) close(fd);
(void) nhclose(fd);
if (wizard) {
if (yn("Bones file already exists. Replace it?") == 'y') {
if (delete_bonesfile(&u.uz)) goto make_bones;
@@ -504,7 +504,7 @@ struct obj *corpse;
if (bytes_counted > freediskspace(bones)) { /* not enough room */
if (wizard)
pline("Insufficient space to create bones file.");
(void) close(fd);
(void) nhclose(fd);
cancel_bonesfile();
return;
}
@@ -551,7 +551,7 @@ getbones()
ok = TRUE;
if(wizard) {
if(yn("Get bones?") == 'n') {
(void) close(fd);
(void) nhclose(fd);
compress_bonesfile();
return(0);
}
@@ -595,8 +595,9 @@ getbones()
resetobjs(level.buriedobjlist,TRUE);
}
}
(void) close(fd);
(void) nhclose(fd);
sanitize_engravings();
u.uroleplay.numbones++;
if(wizard) {
if(yn("Unlink bones?") == 'n') {
+5 -3
View File
@@ -103,9 +103,9 @@ NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
NEARDATA s_level *sp_levchn;
NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 };
NEARDATA stairway upladder = { 0, 0 }, dnladder = { 0, 0 };
NEARDATA stairway sstairs = { 0, 0 };
NEARDATA stairway upstair = { 0, 0, { 0,0 }, 0 }, dnstair = { 0, 0, { 0,0 }, 0 };
NEARDATA stairway upladder = { 0, 0, { 0,0 }, 0 }, dnladder = { 0, 0, { 0,0 }, 0 };
NEARDATA stairway sstairs = { 0, 0, { 0,0 }, 0 };
NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
NEARDATA coord inv_pos = { 0, 0 };
@@ -219,6 +219,8 @@ NEARDATA struct c_color_names c_color_names = {
"white"
};
struct menucoloring *menu_colorings = NULL;
const char *c_obj_colors[] = {
"black", /* CLR_BLACK */
"red", /* CLR_RED */
+13 -6
View File
@@ -160,7 +160,7 @@ magic_map_background(x, y, show)
if (!cansee(x,y) && !lev->waslit) {
/* Floor spaces are dark if unlit. Corridors are dark if unlit. */
if (lev->typ == ROOM && glyph == cmap_to_glyph(S_room))
glyph = cmap_to_glyph(S_stone);
glyph = cmap_to_glyph((flags.dark_room && iflags.use_color) ? (DARKROOMSYM) : S_stone);
else if (lev->typ == CORR && glyph == cmap_to_glyph(S_litcorr))
glyph = cmap_to_glyph(S_corr);
}
@@ -674,7 +674,12 @@ newsym(x,y)
*/
lev->waslit = (lev->lit!=0); /* remember lit condition */
if (reg != NULL && ACCESSIBLE(lev->typ)) {
/* normal region shown only on accessible positions, but poison clouds
* also shown above lava, pools and moats.
*/
if (reg != NULL && (ACCESSIBLE(lev->typ) ||
(reg->glyph == cmap_to_glyph(S_poisoncloud) &&
(lev->typ == LAVAPOOL || lev->typ == POOL || lev->typ == MOAT)))) {
show_region(reg,x,y);
return;
}
@@ -759,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 {
@@ -824,8 +829,10 @@ shieldeff(x,y)
* DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account.
*/
#define TMP_AT_MAX_GLYPHS (COLNO*2)
static struct tmp_glyph {
coord saved[COLNO]; /* previously updated positions */
coord saved[TMP_AT_MAX_GLYPHS]; /* previously updated positions */
int sidx; /* index of next unused slot in saved[] */
int style; /* either DISP_BEAM or DISP_FLASH or DISP_ALWAYS */
int glyph; /* glyph to use when printing */
@@ -895,7 +902,7 @@ tmp_at(x, y)
default: /* do it */
if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) {
if (tglyph->style != DISP_ALL && !cansee(x,y)) break;
if (tglyph->sidx >= COLNO) break; /* too many locations */
if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */
/* save pos for later erasing */
tglyph->saved[tglyph->sidx].x = x;
tglyph->saved[tglyph->sidx].y = y;
+4 -2
View File
@@ -953,7 +953,7 @@ currentlevel_rewrite()
#ifdef MFLOPPY
if (!savelev(fd, ledger_no(&u.uz), COUNT_SAVE)) {
(void) close(fd);
(void) nhclose(fd);
delete_levelfile(ledger_no(&u.uz));
pline("NetHack is out of disk space for making levels!");
You("can save, quit, or continue playing.");
@@ -1168,7 +1168,7 @@ boolean at_stairs, falling, portal;
}
minit(); /* ZEROCOMP */
getlev(fd, hackpid, new_ledger, FALSE);
(void) close(fd);
(void) nhclose(fd);
oinit(); /* reassign level dependent obj probabilities */
}
/* do this prior to level-change pline messages */
@@ -1296,6 +1296,8 @@ boolean at_stairs, falling, portal;
/* initial movement of bubbles just before vision_recalc */
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
movebubbles();
else if (Is_firelevel(&u.uz))
fumaroles();
if (level_info[new_ledger].flags & FORGOTTEN) {
forget_map(ALL_MAP); /* forget the map */
+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 */
+20 -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,28 +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 */
};
@@ -614,6 +617,7 @@ struct symparse loadsyms[] = {
{SYM_PCHAR, S_hcdbridge, "S_hcdbridge"},
{SYM_PCHAR, S_air, "S_air"},
{SYM_PCHAR, S_cloud, "S_cloud"},
{SYM_PCHAR, S_poisoncloud, "S_poisoncloud"},
{SYM_PCHAR, S_water, "S_water"},
{SYM_PCHAR, S_arrow_trap, "S_arrow_trap"},
{SYM_PCHAR, S_dart_trap, "S_dart_trap"},
@@ -645,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"},
+63 -10
View File
@@ -1237,6 +1237,9 @@ struct obj *list;
boolean identified, all_containers, reportempty;
{
register struct obj *box, *obj;
struct obj **oarray;
int i,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);
@@ -1413,43 +1437,72 @@ num_genocides()
return n;
}
int
num_extinct()
{
int i, n = 0;
for (i = LOW_PM; i < NUMMONS; ++i)
if (!(mvitals[i].mvflags & G_GENOD) &&
(mvitals[i].mvflags & G_GONE) &&
!(mons[i].geno & G_UNIQ)) ++n;
return n;
}
STATIC_OVL void
list_genocided(defquery, ask)
char defquery;
boolean ask;
{
register int i;
int ngenocided;
int ngenocided, nextinct;
char c;
winid klwin;
char buf[BUFSZ];
ngenocided = num_genocides();
nextinct = num_extinct();
/* genocided species list */
if (ngenocided != 0) {
c = ask ? yn_function("Do you want a list of species genocided?",
ynqchars, defquery) : defquery;
/* genocided or extinct species list */
if (ngenocided != 0 || nextinct != 0) {
Sprintf(buf, "Do you want a list of %sspecies%s%s?",
(nextinct && !ngenocided) ? "extinct " : "",
(ngenocided) ? " genocided" : "",
(nextinct && ngenocided) ? " and extinct" : "");
c = ask ? yn_function(buf, ynqchars, defquery) : defquery;
if (c == 'q') done_stopprint++;
if (c == 'y') {
klwin = create_nhwindow(NHW_MENU);
putstr(klwin, 0, "Genocided species:");
Sprintf(buf, "%s%s species:",
(ngenocided) ? "Genocided" : "Extinct",
(nextinct && ngenocided) ? " or extinct" : "");
putstr(klwin, 0, buf);
putstr(klwin, 0, "");
for (i = LOW_PM; i < NUMMONS; i++)
if (mvitals[i].mvflags & G_GENOD) {
if (mvitals[i].mvflags & G_GONE && !(mons[i].geno & G_UNIQ)) {
if ((mons[i].geno & G_UNIQ) && i != PM_HIGH_PRIEST)
Sprintf(buf, "%s%s",
!type_is_pname(&mons[i]) ? "" : "the ",
mons[i].mname);
else
Strcpy(buf, makeplural(mons[i].mname));
if (!(mvitals[i].mvflags & G_GENOD))
Strcat(buf, " (extinct)");
putstr(klwin, 0, buf);
}
putstr(klwin, 0, "");
Sprintf(buf, "%d species genocided.", ngenocided);
putstr(klwin, 0, buf);
if (ngenocided > 0) {
Sprintf(buf, "%d species genocided.", ngenocided);
putstr(klwin, 0, buf);
}
if (nextinct > 0) {
Sprintf(buf, "%d species extinct.", nextinct);
putstr(klwin, 0, buf);
}
display_nhwindow(klwin, TRUE);
destroy_nhwindow(klwin);
+45 -36
View File
@@ -641,12 +641,12 @@ really_close()
lftrack.fd = -1;
lftrack.oflag = 0;
if (fd != -1)
(void)_close(fd);
(void)close(fd);
return;
}
int
close(fd)
nhclose(fd)
int fd;
{
if (lftrack.fd == fd) {
@@ -655,10 +655,17 @@ int fd;
lftrack.nethack_thinks_it_is_open = FALSE;
return 0;
}
return _close(fd);
return close(fd);
}
#else
int
nhclose(fd)
int fd;
{
return close(fd);
}
#endif
/* ---------- END LEVEL FILE HANDLING ----------- */
@@ -996,7 +1003,7 @@ restore_saved_game()
if ((fd = open_savefile()) < 0) return fd;
if (validate(fd, fq_save) != 0) {
(void) close(fd), fd = -1;
(void) nhclose(fd), fd = -1;
(void) delete_savefile();
}
return fd;
@@ -1021,7 +1028,7 @@ const char* filename;
get_plname_from_file(fd, tplname);
result = dupstr(tplname);
}
(void) close(fd);
(void) nhclose(fd);
}
nh_compress(SAVEF);
@@ -1413,7 +1420,7 @@ docompress_file(filename, uncomp)
const char *filename;
boolean uncomp;
{
gzFile *compressedfile;
gzFile compressedfile;
FILE *uncompressedfile;
char cfn[256];
char buf[1024];
@@ -1777,7 +1784,7 @@ const char *filename;
if (unlink(lockname) < 0)
HUP raw_printf("Can't unlink %s.", lockname);
# ifdef NO_FILE_LINKS
(void) close(lockfd);
(void) nhclose(lockfd);
# endif
#endif /* UNIX || VMS */
@@ -2288,6 +2295,8 @@ int src;
} else if (match_varname(buf, "BOULDER", 3)) {
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE,
1, "BOULDER");
} else if (match_varname(buf, "MENUCOLOR", 9)) {
(void) add_menu_coloring(bufp);
} else if (match_varname(buf, "WARNINGS", 5)) {
(void) get_uchars(fp, buf, bufp, translate, FALSE,
WARNCOUNT, "WARNINGS");
@@ -2932,9 +2941,9 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
wait_synch();
}
# endif
(void) close(fd); /* RECORD is accessible */
(void) nhclose(fd); /* RECORD is accessible */
} else if ((fd = open(fq_record, O_CREAT|O_RDWR, FCMASK)) >= 0) {
(void) close(fd); /* RECORD newly created */
(void) nhclose(fd); /* RECORD newly created */
# if defined(VMS) && !defined(SECURE)
/* Re-protect RECORD with world:read+write+execute+delete access. */
(void) chmod(fq_record, FCMASK | 007);
@@ -2974,9 +2983,9 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
raw_printf("Warning: cannot write record %s", tmp);
wait_synch();
} else
(void) close(fd);
(void) nhclose(fd);
} else /* open succeeded */
(void) close(fd);
(void) nhclose(fd);
#else /* MICRO || WIN32*/
# ifdef MAC
@@ -3060,14 +3069,14 @@ recover_savefile()
if (read(gfd, (genericptr_t) &hpid, sizeof hpid) != sizeof hpid) {
raw_printf(
"\nCheckpoint data incompletely written or subsequently clobbered. Recovery impossible.");
(void)close(gfd);
(void)nhclose(gfd);
return FALSE;
}
if (read(gfd, (genericptr_t) &savelev, sizeof(savelev))
!= sizeof(savelev)) {
raw_printf("\nCheckpointing was not in effect for %s -- recovery impossible.\n",
lock);
(void)close(gfd);
(void)nhclose(gfd);
return FALSE;
}
if ((read(gfd, (genericptr_t) savename, sizeof savename)
@@ -3081,7 +3090,7 @@ recover_savefile()
(read(gfd, (genericptr_t) &tmpplbuf, pltmpsiz)
!= pltmpsiz)) {
raw_printf("\nError reading %s -- can't recover.\n", lock);
(void)close(gfd);
(void)nhclose(gfd);
return FALSE;
}
@@ -3097,15 +3106,15 @@ recover_savefile()
sfd = create_savefile();
if (sfd < 0) {
raw_printf("\nCannot recover savefile %s.\n", SAVEF);
(void)close(gfd);
(void)nhclose(gfd);
return FALSE;
}
lfd = open_levelfile(savelev, errbuf);
if (lfd < 0) {
raw_printf("\n%s\n", errbuf);
(void)close(gfd);
(void)close(sfd);
(void)nhclose(gfd);
(void)nhclose(sfd);
delete_savefile();
return FALSE;
}
@@ -3113,8 +3122,8 @@ recover_savefile()
if (write(sfd, (genericptr_t) &version_data, sizeof version_data)
!= sizeof version_data) {
raw_printf("\nError writing %s; recovery failed.", SAVEF);
(void)close(gfd);
(void)close(sfd);
(void)nhclose(gfd);
(void)nhclose(sfd);
delete_savefile();
return FALSE;
}
@@ -3124,8 +3133,8 @@ recover_savefile()
raw_printf(
"\nError writing %s; recovery failed (savefile_info).\n",
SAVEF);
(void)close(gfd);
(void)close(sfd);
(void)nhclose(gfd);
(void)nhclose(sfd);
delete_savefile();
return FALSE;
}
@@ -3135,8 +3144,8 @@ recover_savefile()
raw_printf(
"Error writing %s; recovery failed (player name size).\n",
SAVEF);
(void)close(gfd);
(void)close(sfd);
(void)nhclose(gfd);
(void)nhclose(sfd);
delete_savefile();
return FALSE;
}
@@ -3146,28 +3155,28 @@ recover_savefile()
raw_printf(
"Error writing %s; recovery failed (player name).\n",
SAVEF);
(void)close(gfd);
(void)close(sfd);
(void)nhclose(gfd);
(void)nhclose(sfd);
delete_savefile();
return FALSE;
}
if (!copy_bytes(lfd, sfd)) {
(void) close(lfd);
(void) close(sfd);
(void) nhclose(lfd);
(void) nhclose(sfd);
delete_savefile();
return FALSE;
}
(void)close(lfd);
(void)nhclose(lfd);
processed[savelev] = 1;
if (!copy_bytes(gfd, sfd)) {
(void) close(lfd);
(void) close(sfd);
(void) nhclose(lfd);
(void) nhclose(sfd);
delete_savefile();
return FALSE;
}
(void)close(gfd);
(void)nhclose(gfd);
processed[0] = 1;
for (lev = 1; lev < 256; lev++) {
@@ -3181,17 +3190,17 @@ recover_savefile()
levc = (xchar) lev;
write(sfd, (genericptr_t) &levc, sizeof(levc));
if (!copy_bytes(lfd, sfd)) {
(void) close(lfd);
(void) close(sfd);
(void) nhclose(lfd);
(void) nhclose(sfd);
delete_savefile();
return FALSE;
}
(void)close(lfd);
(void)nhclose(lfd);
processed[lev] = 1;
}
}
}
(void)close(sfd);
(void)nhclose(sfd);
#ifdef HOLD_LOCKFILE_OPEN
really_close();
+9 -5
View File
@@ -603,24 +603,28 @@ STATIC_DCL struct tm *NDECL(getlt);
void
setrandom()
{
time_t now = getnow(); /* time((TIME_type) 0) */
unsigned long seed = (unsigned long)getnow(); /* time((TIME_type) 0) */
#ifdef UNIX
/* Quick dirty band-aid to prevent PRNG prediction */
seed *= getpid();
#endif
/* the types are different enough here that sweeping the different
* routine names into one via #defines is even more confusing
*/
#ifdef RANDOM /* srandom() from sys/share/random.c */
srandom((unsigned int) now);
srandom((unsigned int) seed);
#else
# if defined(__APPLE__) || defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */
# if defined(BSD) && !defined(POSIX_TYPES) && defined(SUNOS4)
(void)
# endif
srandom((int) now);
srandom((int) seed);
# else
# ifdef UNIX /* system srand48() */
srand48((long) now);
srand48((long) seed);
# else /* poor quality system routine */
srand((int) now);
srand((int) seed);
# endif
# endif
#endif
+114 -17
View File
@@ -7,6 +7,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));
@@ -41,6 +42,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;
@@ -1726,11 +1809,12 @@ long* out_cnt;
struct obj *otmp;
char ilet, ret;
char *invlet = flags.inv_order;
int n, classcount;
int i, n, classcount;
winid win; /* windows being used */
static winid local_win = WIN_ERR; /* window for partial menus */
anything any;
menu_item *selected;
struct obj **oarray;
/* overriden by global flag */
if (flags.perm_invent) {
@@ -1777,6 +1861,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];
@@ -1791,23 +1888,22 @@ 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;
if (--invlet != venom_inv) {
@@ -1815,6 +1911,7 @@ nextclass:
goto nextclass;
}
}
free(oarray);
end_menu(win, (char *) 0);
n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected);
+9 -7
View File
@@ -122,13 +122,15 @@ register int x, y, n;
*/
if (enexto(&mm, mm.x, mm.y, mtmp->data)) {
mon = makemon(mtmp->data, mm.x, mm.y, NO_MM_FLAGS);
mon->mpeaceful = FALSE;
mon->mavenge = 0;
set_malign(mon);
/* Undo the second peace_minded() check in makemon(); if the
* monster turned out to be peaceful the first time we
* didn't create it at all; we don't want a second check.
*/
if (mon) {
mon->mpeaceful = FALSE;
mon->mavenge = 0;
set_malign(mon);
/* Undo the second peace_minded() check in makemon(); if the
* monster turned out to be peaceful the first time we
* didn't create it at all; we don't want a second check.
*/
}
}
}
}
+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
@@ -2558,6 +2558,7 @@ cloneu()
if (u.mh <= 1) return(struct monst *)0;
if (mvitals[mndx].mvflags & G_EXTINCT) return(struct monst *)0;
mon = makemon(youmonst.data, u.ux, u.uy, NO_MINVENT|MM_EDOG);
if (!mon) return NULL;
mon->mcloned = 1;
mon = christen_monst(mon, plname);
initedog(mon);
+2 -1
View File
@@ -537,7 +537,7 @@ STATIC_OVL void
clear_level_structures()
{
static struct rm zerorm = { cmap_to_glyph(S_stone),
0, 0, 0, 0, 0, 0, 0, 0 };
0, 0, 0, 0, 0, 0, 0, 0, 0 };
register int x,y;
register struct rm *lev;
@@ -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;
+51 -40
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;
@@ -879,6 +871,25 @@ register xchar x, y, todnum, todlevel;
return;
}
void
fumaroles()
{
xchar n;
boolean snd = FALSE, loud = FALSE;
for (n = rn2(3)+2; n; n--) {
xchar x = rn1(COLNO-4,3);
xchar y = rn1(ROWNO-4,3);
if (levl[x][y].typ == LAVAPOOL) {
NhRegion *r = create_gas_cloud(x,y, 4+rn2(5), rn1(10,5));
clear_heros_fault(r);
snd = TRUE;
if (distu(x,y) < 15) loud = TRUE;
}
}
if (snd && !Deaf)
Norep("You hear a %swhoosh!", loud ? "loud " : "");
}
/*
* Special waterlevel stuff in endgame (TH).
*
@@ -916,9 +927,9 @@ movebubbles()
register int x, y, i, j;
struct trap *btrap;
static const struct rm water_pos =
{ cmap_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0 };
{ cmap_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0, 0 };
static const struct rm air_pos =
{ cmap_to_glyph(S_cloud), AIR, 0, 0, 0, 1, 0, 0, 0 };
{ cmap_to_glyph(S_cloud), AIR, 0, 0, 0, 1, 0, 0, 0, 0 };
/* set up the portal the first time bubbles are moved */
if (!wportal) set_wportal();
+3 -3
View File
@@ -1367,14 +1367,14 @@ NEARDATA struct permonst mons[] = {
A(ATTK(AT_ENGL, AD_PHYS, 1, 10),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(0, 0, MS_SILENT, MZ_HUGE), MR_POISON|MR_STONE, 0,
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_UNSOLID|M1_FLY,
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_BREATHLESS|M1_UNSOLID|M1_FLY,
M2_STRONG|M2_NEUTER, 0, CLR_CYAN),
MON("fire elemental", S_ELEMENTAL,
LVL(8, 12, 2, 30, 0), (G_NOCORPSE|1),
A(ATTK(AT_CLAW, AD_FIRE, 3, 6), ATTK(AT_NONE, AD_FIRE, 0, 4),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(0, 0, MS_SILENT, MZ_HUGE), MR_FIRE|MR_POISON|MR_STONE, 0,
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_UNSOLID|M1_FLY|M1_NOTAKE,
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_BREATHLESS|M1_UNSOLID|M1_FLY|M1_NOTAKE,
M2_STRONG|M2_NEUTER, M3_INFRAVISIBLE, CLR_YELLOW),
MON("earth elemental", S_ELEMENTAL,
LVL(8, 6, 2, 30, 0), (G_NOCORPSE|1),
@@ -1390,7 +1390,7 @@ NEARDATA struct permonst mons[] = {
A(ATTK(AT_CLAW, AD_PHYS, 5, 6),
NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(2500, 0, MS_SILENT, MZ_HUGE), MR_POISON|MR_STONE, 0,
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_UNSOLID|
M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_BREATHLESS|M1_UNSOLID|
M1_AMPHIBIOUS|M1_SWIM,
M2_STRONG|M2_NEUTER, 0, CLR_BLUE),
/*
+1 -1
View File
@@ -753,7 +753,7 @@ char *buf;
break;
}
(void) write(fd, buf, strlen(buf));
(void) close(fd);
(void) nhclose(fd);
}
}
#endif /* UNIX386MUSIC */
+21 -1
View File
@@ -18,6 +18,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;
@@ -236,7 +238,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;
@@ -245,7 +255,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 " */
@@ -1079,6 +1089,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)
+267 -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},
@@ -141,6 +142,7 @@ static struct Bool_Opt
{"mail", (boolean *)0, TRUE, SET_IN_FILE},
#endif
{"mention_walls", &iflags.mention_walls, FALSE, SET_IN_GAME},
{"menucolors", &iflags.use_menu_color, FALSE, SET_IN_GAME},
/* for menu debugging only*/
{"menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME},
{"menu_objsyms", &iflags.menu_head_objsym, FALSE, SET_IN_GAME},
@@ -345,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
@@ -495,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 */
@@ -628,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;
@@ -703,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;
}
@@ -1090,6 +1125,174 @@ STATIC_VAR const struct paranoia_opts {
{ ~0, "all", 3, 0, 0, 0 }, /* ditto */
};
extern struct menucoloring *menu_colorings;
static const struct {
const char *name;
const int color;
} colornames[] = {
{"black", CLR_BLACK},
{"red", CLR_RED},
{"green", CLR_GREEN},
{"brown", CLR_BROWN},
{"blue", CLR_BLUE},
{"magenta", CLR_MAGENTA},
{"cyan", CLR_CYAN},
{"gray", CLR_GRAY},
{"grey", CLR_GRAY},
{"orange", CLR_ORANGE},
{"lightgreen", CLR_BRIGHT_GREEN},
{"yellow", CLR_YELLOW},
{"lightblue", CLR_BRIGHT_BLUE},
{"lightmagenta", CLR_BRIGHT_MAGENTA},
{"lightcyan", CLR_BRIGHT_CYAN},
{"white", CLR_WHITE}
};
static const struct {
const char *name;
const int attr;
} attrnames[] = {
{"none", ATR_NONE},
{"bold", ATR_BOLD},
{"dim", ATR_DIM},
{"underline", ATR_ULINE},
{"blink", ATR_BLINK},
{"inverse", ATR_INVERSE}
};
/* parse '"regex_string"=color&attr' and add it to menucoloring */
boolean
add_menu_coloring(str)
char *str;
{
int i, c = NO_COLOR, a = ATR_NONE;
struct menucoloring *tmp;
char *tmps, *cs = strchr(str, '=');
#ifdef MENU_COLOR_REGEX_POSIX
int errnum;
char errbuf[80];
#endif
const char *err = (char *)0;
if (!cs || !str) return FALSE;
tmps = cs;
tmps++;
while (*tmps && isspace(*tmps)) tmps++;
for (i = 0; i < SIZE(colornames); i++)
if (strstri(tmps, colornames[i].name) == tmps) {
c = colornames[i].color;
break;
}
if ((i == SIZE(colornames)) && (*tmps >= '0' && *tmps <='9'))
c = atoi(tmps);
if (c > 15) return FALSE;
tmps = strchr(str, '&');
if (tmps) {
tmps++;
while (*tmps && isspace(*tmps)) tmps++;
for (i = 0; i < SIZE(attrnames); i++)
if (strstri(tmps, attrnames[i].name) == tmps) {
a = attrnames[i].attr;
break;
}
if ((i == SIZE(attrnames)) && (*tmps >= '0' && *tmps <='9'))
a = atoi(tmps);
}
*cs = '\0';
tmps = str;
if ((*tmps == '"') || (*tmps == '\'')) {
cs--;
while (isspace(*cs)) cs--;
if (*cs == *tmps) {
*cs = '\0';
tmps++;
}
}
tmp = (struct menucoloring *)alloc(sizeof(struct menucoloring));
#ifdef MENU_COLOR_REGEX
#ifdef MENU_COLOR_REGEX_POSIX
errnum = regcomp(&tmp->match, tmps, REG_EXTENDED | REG_NOSUB);
if (errnum != 0)
{
regerror(errnum, &tmp->match, errbuf, sizeof(errbuf));
err = errbuf;
}
#else
tmp->match.translate = 0;
tmp->match.fastmap = 0;
tmp->match.buffer = 0;
tmp->match.allocated = 0;
tmp->match.regs_allocated = REGS_FIXED;
err = re_compile_pattern(tmps, strlen(tmps), &tmp->match);
#endif
#else
tmp->match = (char *)alloc(strlen(tmps)+1);
(void) memcpy((genericptr_t)tmp->match, (genericptr_t)tmps, strlen(tmps)+1);
#endif
if (err) {
raw_printf("\nMenucolor regex error: %s\n", err);
wait_synch();
free(tmp);
return FALSE;
} else {
tmp->next = menu_colorings;
tmp->color = c;
tmp->attr = a;
menu_colorings = tmp;
return TRUE;
}
}
boolean
get_menu_coloring(str, color, attr)
char *str;
int *color, *attr;
{
struct menucoloring *tmpmc;
if (iflags.use_menu_color)
for (tmpmc = menu_colorings; tmpmc; tmpmc = tmpmc->next)
#ifdef MENU_COLOR_REGEX
# ifdef MENU_COLOR_REGEX_POSIX
if (regexec(&tmpmc->match, str, 0, NULL, 0) == 0) {
# else
if (re_search(&tmpmc->match, str, strlen(str), 0, 9999, 0) >= 0) {
# endif
#else
if (pmatch(tmpmc->match, str)) {
#endif
*color = tmpmc->color;
*attr = tmpmc->attr;
return TRUE;
}
return FALSE;
}
void
free_menu_coloring()
{
struct menucoloring *tmp = menu_colorings;
while (tmp) {
struct menucoloring *tmp2 = tmp->next;
#ifdef MENU_COLOR_REGEX
(void) regfree(&tmp->match);
#else
free(tmp->match);
#endif
free(tmp);
tmp = tmp2;
}
}
void
parseoptions(opts, tinitial, tfrom_file)
register char *opts;
@@ -1431,6 +1634,16 @@ boolean tinitial, tfrom_file;
return;
}
/* menucolor:"regex_string"=color */
fullname = "menucolor";
if (match_optname(opts, fullname, 9, TRUE)) {
if (negated) bad_negation(fullname, FALSE);
else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0)
if (!add_menu_coloring(op))
badoption(opts);
return;
}
fullname = "msghistory";
if (match_optname(opts, fullname, 3, TRUE)) {
if (duplicate) complain_about_duplicate(opts,1);
@@ -2149,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);
@@ -2631,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
@@ -2641,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 ||
@@ -2683,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.
@@ -2970,8 +3205,10 @@ doset()
}
destroy_nhwindow(tmpwin);
if (need_redraw)
if (need_redraw) {
reglyph_darkroom();
(void) doredraw();
}
return 0;
}
@@ -2989,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)) {
@@ -3170,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;
@@ -3759,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)*/
+16 -3
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, 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];
@@ -810,7 +823,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
if (n > 0) {
menu_item *mi;
int i, k;
int k;
/* fix up counts: -1 means no count used => pick all;
if fake_hero_object was picked, discard that choice */
+37 -4
View File
@@ -27,7 +27,8 @@ STATIC_DCL void FDECL(randomize,(int *, int));
STATIC_DCL void FDECL(forget_single_object, (int));
STATIC_DCL void FDECL(forget, (int));
STATIC_DCL int FDECL(maybe_tame, (struct monst *,struct obj *));
STATIC_DCL boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P));
STATIC_DCL void FDECL(display_stinking_cloud_positions, (int));
STATIC_PTR void FDECL(set_lit, (int,int,genericptr_t));
STATIC_OVL boolean
@@ -868,6 +869,39 @@ struct obj *sobj;
return 0;
}
boolean
is_valid_stinking_cloud_pos(x,y, showmsg)
int x,y;
boolean showmsg;
{
if (!cansee(x, y) || !ACCESSIBLE(levl[x][y].typ) || distu(x, y) >= 32) {
if (showmsg) You("smell rotten eggs.");
return FALSE;
}
return TRUE;
}
void
display_stinking_cloud_positions(state)
int state;
{
if (state == 0) {
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
} else if (state == 1) {
int x,y, dx, dy;
int dist = 6;
for (dx = -dist; dx <= dist; dx++)
for (dy = -dist; dy <= dist; dy++) {
x = u.ux + dx;
y = u.uy + dy;
if (isok(x,y) && is_valid_stinking_cloud_pos(x,y, FALSE))
tmp_at(x,y);
}
} else {
tmp_at(DISP_END, 0);
}
}
/* scroll effects; return 1 if we use up the scroll and possibly make it
become discovered, 0 if caller should take care of those side-effects */
int
@@ -1613,14 +1647,13 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
already_known ? "stinking " : "");
cc.x = u.ux;
cc.y = u.uy;
getpos_sethilite(display_stinking_cloud_positions);
if (getpos(&cc, TRUE, "the desired position") < 0) {
pline1(Never_mind);
break;
}
if (!cansee(cc.x, cc.y) || distu(cc.x, cc.y) >= 32) {
You("smell rotten eggs.");
if (!is_valid_stinking_cloud_pos(cc.x, cc.y, TRUE))
break;
}
(void) create_gas_cloud(cc.x, cc.y, 3+bcsign(sobj),
8+4*bcsign(sobj));
break;
+1 -1
View File
@@ -996,7 +996,7 @@ int damage;
cloud->arg = zeroany;
cloud->arg.a_int = damage;
cloud->visible = TRUE;
cloud->glyph = cmap_to_glyph(S_cloud);
cloud->glyph = cmap_to_glyph(damage ? S_poisoncloud : S_cloud);
add_region(cloud);
return cloud;
}
+4 -4
View File
@@ -718,7 +718,7 @@ xchar ltmp;
/* Remove levels and bones that may have been created.
*/
(void) close(nfd);
(void) nhclose(nfd);
# ifdef AMIGA
clearlocks();
# else
@@ -767,7 +767,7 @@ register int fd;
if (!restgamestate(fd, &stuckid, &steedid)) {
display_nhwindow(WIN_MESSAGE, TRUE);
savelev(-1, 0, FREE_SAVE); /* discard current level */
(void) close(fd);
(void) nhclose(fd);
(void) delete_savefile();
restoring = FALSE;
return(0);
@@ -841,7 +841,7 @@ register int fd;
get_plname_from_file(fd, plname);
getlev(fd, 0, (xchar)0, FALSE);
(void) close(fd);
(void) nhclose(fd);
/* Now set the restore settings to match the
* settings used by the save file output routines
@@ -1558,7 +1558,7 @@ register unsigned int len;
} else {
pline("Read %d instead of %u bytes.", rlen, len);
if(restoring) {
(void) close(fd);
(void) nhclose(fd);
(void) delete_savefile();
error("Error restoring old game.");
}
+10 -9
View File
@@ -162,7 +162,7 @@ dosave0()
nh_uncompress(fq_save);
fd = open_savefile();
if (fd > 0) {
(void) close(fd);
(void) nhclose(fd);
clear_nhwindow(WIN_MESSAGE);
There("seems to be an old save file.");
if (yn("Overwrite the old file?") == 'n') {
@@ -218,7 +218,7 @@ dosave0()
pline("Require %ld bytes but only have %ld.", needed, fds);
}
flushout();
(void) close(fd);
(void) nhclose(fd);
(void) delete_savefile();
return 0;
}
@@ -265,7 +265,7 @@ dosave0()
ofd = open_levelfile(ltmp, whynot);
if (ofd < 0) {
HUP pline1(whynot);
(void) close(fd);
(void) nhclose(fd);
(void) delete_savefile();
HUP Strcpy(killer.name, whynot);
HUP done(TRICKED);
@@ -273,7 +273,7 @@ dosave0()
}
minit(); /* ZEROCOMP */
getlev(ofd, hackpid, ltmp, FALSE);
(void) close(ofd);
(void) nhclose(ofd);
bwrite(fd, (genericptr_t) &ltmp, sizeof ltmp); /* level number*/
savelev(fd, ltmp, WRITE_SAVE | FREE_SAVE); /* actual level*/
delete_levelfile(ltmp);
@@ -404,7 +404,7 @@ savestateinlock()
Strcpy(killer.name, whynot);
done(TRICKED);
}
(void) close(fd);
(void) nhclose(fd);
fd = create_levelfile(0, whynot);
if (fd < 0) {
@@ -742,7 +742,7 @@ def_bclose(fd)
bw_FILE = 0;
} else
#endif
(void) close(fd);
(void) nhclose(fd);
return;
}
@@ -879,7 +879,7 @@ zerocomp_bclose(fd)
int fd;
{
zerocomp_bufoff(fd);
(void) close(fd);
(void) nhclose(fd);
return;
}
#endif /* ZEROCOMP */
@@ -1296,6 +1296,7 @@ void
freedynamicdata()
{
unload_qtlist();
free_menu_coloring();
free_invbuf(); /* let_to_name (invent.c) */
free_youbuf(); /* You_buf,&c (pline.c) */
tmp_at(DISP_FREEMEM, 0); /* temporary display effects */
@@ -1442,8 +1443,8 @@ char *from, *to;
if (nto != nfrom)
panic("Copyfile failed!");
} while (nfrom == BUFSIZ);
(void) close(fdfrom);
(void) close(fdto);
(void) nhclose(fdfrom);
(void) nhclose(fdto);
# endif /* TOS */
}
+221 -115
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1426465441 2015/03/16 00:24:01 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1427934549 2015/04/02 00:29:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
/* NetHack 3.5 sp_lev.c $Date: 2011/01/05 01:28:36 $ $Revision: 1.23 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -15,6 +15,8 @@
#include "sp_lev.h"
typedef void (*select_iter_func)(int, int, genericptr_t);
extern void FDECL(mkmap, (lev_init *));
STATIC_DCL void FDECL(get_room_loc, (schar *, schar *, struct mkroom *));
@@ -35,6 +37,94 @@ STATIC_DCL boolean FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P,
XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P));
long FDECL(opvar_array_length, (struct sp_coder *));
STATIC_DCL void NDECL(solidify_map);
STATIC_DCL void FDECL(splev_stack_init, (struct splevstack *));
STATIC_DCL void FDECL(splev_stack_done, (struct splevstack *));
STATIC_DCL void FDECL(splev_stack_push, (struct splevstack *, struct opvar *));
STATIC_DCL struct opvar * FDECL(splev_stack_pop, (struct splevstack *));
STATIC_DCL struct splevstack * FDECL(splev_stack_reverse, (struct splevstack *));
STATIC_DCL struct opvar * FDECL(opvar_new_str, (char *));
STATIC_DCL struct opvar * FDECL(opvar_new_int, (long));
STATIC_DCL struct opvar * FDECL(opvar_new_coord, (int, int));
STATIC_DCL struct opvar * FDECL(opvar_new_region, (int,int, int,int));
STATIC_DCL void FDECL(opvar_free_x, (struct opvar *));
STATIC_DCL struct opvar * FDECL(opvar_clone, (struct opvar *));
STATIC_DCL struct opvar * FDECL(opvar_var_conversion, (struct sp_coder *, struct opvar *));
STATIC_DCL struct splev_var * FDECL(opvar_var_defined, (struct sp_coder *, char *));
STATIC_DCL struct opvar * FDECL(splev_stack_getdat, (struct sp_coder *, XCHAR_P));
STATIC_DCL struct opvar * FDECL(splev_stack_getdat_any, (struct sp_coder *));
STATIC_DCL void FDECL(variable_list_del, (struct splev_var *));
STATIC_DCL void FDECL(lvlfill_maze_grid, (int,int, int,int, SCHAR_P));
STATIC_DCL void FDECL(lvlfill_solid, (SCHAR_P, SCHAR_P));
STATIC_DCL void NDECL(remove_boundary_syms);
STATIC_DCL void FDECL(maybe_add_door, (int,int, struct mkroom *));
STATIC_DCL void NDECL(link_doors_rooms);
STATIC_DCL void NDECL(fill_rooms);
STATIC_DCL unpacked_coord FDECL(get_unpacked_coord, (long, int));
STATIC_DCL void FDECL(replace_terrain, (replaceterrain *, struct mkroom *));
STATIC_DCL void FDECL(wallify_map, (int,int, int,int));
STATIC_DCL void FDECL(splev_initlev, (lev_init *));
STATIC_DCL struct sp_frame * FDECL(frame_new, (long));
STATIC_DCL void FDECL(frame_del, (struct sp_frame *));
STATIC_DCL void FDECL(spo_frame_push, (struct sp_coder *));
STATIC_DCL void FDECL(spo_frame_pop, (struct sp_coder *));
STATIC_DCL long FDECL(sp_code_jmpaddr, (long, long));
STATIC_DCL void FDECL(spo_call, (struct sp_coder *));
STATIC_DCL void FDECL(spo_return, (struct sp_coder *));
STATIC_DCL void FDECL(spo_end_moninvent, (struct sp_coder *));
STATIC_DCL void FDECL(spo_pop_container, (struct sp_coder *));
STATIC_DCL void FDECL(spo_message, (struct sp_coder *));
STATIC_DCL void FDECL(spo_monster, (struct sp_coder *));
STATIC_DCL void FDECL(spo_object, (struct sp_coder *));
STATIC_DCL void FDECL(spo_level_flags, (struct sp_coder *));
STATIC_DCL void FDECL(spo_initlevel, (struct sp_coder *));
STATIC_DCL void FDECL(spo_engraving, (struct sp_coder *));
STATIC_DCL void FDECL(spo_mineralize, (struct sp_coder *));
STATIC_DCL void FDECL(spo_room, (struct sp_coder *));
STATIC_DCL void FDECL(spo_endroom, (struct sp_coder *));
STATIC_DCL void FDECL(spo_stair, (struct sp_coder *));
STATIC_DCL void FDECL(spo_ladder, (struct sp_coder *));
STATIC_DCL void FDECL(spo_grave, (struct sp_coder *));
STATIC_DCL void FDECL(spo_altar, (struct sp_coder *));
STATIC_DCL void FDECL(spo_trap, (struct sp_coder *));
STATIC_DCL void FDECL(spo_gold, (struct sp_coder *));
STATIC_DCL void FDECL(spo_corridor, (struct sp_coder *));
STATIC_DCL struct opvar * FDECL(selection_opvar, (char *));
STATIC_DCL xchar FDECL(selection_getpoint, (int,int, struct opvar *));
STATIC_DCL void FDECL(selection_setpoint, (int,int, struct opvar *, XCHAR_P));
STATIC_DCL struct opvar * FDECL(selection_not, (struct opvar *));
STATIC_DCL struct opvar * FDECL(selection_logical_oper, (struct opvar *, struct opvar *, CHAR_P));
STATIC_DCL struct opvar * FDECL(selection_filter_mapchar, (struct opvar *, struct opvar *));
STATIC_DCL void FDECL(selection_filter_percent, (struct opvar *, int));
STATIC_DCL int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *));
STATIC_DCL void FDECL(selection_do_grow, (struct opvar *, int));
STATIC_DCL void FDECL(selection_floodfill, (struct opvar *, int,int));
STATIC_DCL void FDECL(selection_do_ellipse, (struct opvar *, int,int, int,int, int));
STATIC_DCL long FDECL(line_dist_coord, (long,long, long,long, long,long));
STATIC_DCL void FDECL(selection_do_gradient, (struct opvar *, long,long, long,long, long,long,long,long));
STATIC_DCL void FDECL(selection_do_line, (SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, struct opvar *));
STATIC_DCL void FDECL(selection_do_randline, (SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, SCHAR_P,SCHAR_P, struct opvar *));
STATIC_DCL void FDECL(selection_iterate, (struct opvar *, select_iter_func, genericptr_t));
STATIC_DCL void FDECL(sel_set_ter, (int,int, genericptr_t));
STATIC_DCL void FDECL(sel_set_feature, (int,int, genericptr_t));
STATIC_DCL void FDECL(sel_set_door, (int,int, genericptr_t));
STATIC_DCL void FDECL(spo_door, (struct sp_coder *));
STATIC_DCL void FDECL(spo_feature, (struct sp_coder *));
STATIC_DCL void FDECL(spo_terrain, (struct sp_coder *));
STATIC_DCL void FDECL(spo_replace_terrain, (struct sp_coder *));
STATIC_DCL void FDECL(spo_levregion, (struct sp_coder *));
STATIC_DCL void FDECL(spo_region, (struct sp_coder *));
STATIC_DCL void FDECL(spo_drawbridge, (struct sp_coder *));
STATIC_DCL void FDECL(spo_mazewalk, (struct sp_coder *));
STATIC_DCL void FDECL(spo_wall_property, (struct sp_coder *));
STATIC_DCL void FDECL(spo_room_door, (struct sp_coder *));
STATIC_DCL void FDECL(sel_set_wallify, (int,int, genericptr_t));
STATIC_DCL void FDECL(spo_wallify, (struct sp_coder *));
STATIC_DCL void FDECL(spo_map, (struct sp_coder *));
STATIC_DCL void FDECL(spo_jmp, (struct sp_coder *, sp_lev *));
STATIC_DCL void FDECL(spo_conditional_jump, (struct sp_coder *, sp_lev *));
STATIC_DCL void FDECL(spo_var_init, (struct sp_coder *));
STATIC_DCL void FDECL(spo_shuffle_array, (struct sp_coder *));
#define LEFT 1
#define H_LEFT 2
@@ -430,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;
}
}
@@ -523,10 +612,9 @@ remove_boundary_syms()
void
maybe_add_door(x,y, droom, i,s)
maybe_add_door(x,y, droom)
int x,y;
struct mkroom *droom;
int i,s;
{
if (droom->hx >= 0 && doorindex < DOORMAX && inside_room(droom, x,y))
add_door(x, y, droom);
@@ -541,9 +629,9 @@ link_doors_rooms()
for (x = 0; x < COLNO; x++)
if (IS_DOOR(levl[x][y].typ) || levl[x][y].typ == SDOOR) {
for (tmpi = 0; tmpi < nroom; tmpi++) {
maybe_add_door(x,y, &rooms[tmpi], tmpi,-1);
maybe_add_door(x,y, &rooms[tmpi]);
for (m = 0; m < rooms[tmpi].nsubrooms; m++) {
maybe_add_door(x,y, rooms[tmpi].sbrooms[m], tmpi,m);
maybe_add_door(x,y, rooms[tmpi].sbrooms[m]);
}
}
}
@@ -1581,24 +1669,28 @@ struct mkroom *croom;
if (!container_idx) {
if (!invent_carrying_monster) {
/*impossible("create_object: no container");*/
/* don't complain, the monster may be gone legally (eg. unique demon already generated)
TODO: In the case of unique demon lords, they should get their inventories even when
they get generated outside the des-file. Maybe another data file that determines what
inventories monsters get by default?
/* don't complain, the monster may be gone legally
(eg. unique demon already generated)
TODO: In the case of unique demon lords, they should
get their inventories even when they get generated
outside the des-file. Maybe another data file that
determines what inventories monsters get by default?
*/
} else {
int c;
int ci;
struct obj *objcheck = otmp;
int inuse = -1;
for (c = 0; c < container_idx; c++)
if (container_obj[c] == objcheck)
inuse = c;
for (ci = 0; ci < container_idx; ci++)
if (container_obj[ci] == objcheck)
inuse = ci;
remove_object(otmp);
if (mpickobj(invent_carrying_monster, otmp)) {
if (inuse > -1) {
impossible("container given to monster was merged or deallocated.");
for (c = inuse; c < container_idx-1; c++)
container_obj[c] = container_obj[c+1];
impossible(
"container given to monster was merged or deallocated.");
for (ci = inuse; ci < container_idx - 1; ci++)
container_obj[ci] = container_obj[ci + 1];
container_obj[container_idx] = NULL;
container_idx--;
}
@@ -2490,6 +2582,7 @@ spo_return(coder)
opvar_free(params);
}
/*ARGUSED*/
void
spo_end_moninvent(coder)
struct sp_coder *coder;
@@ -2499,6 +2592,7 @@ spo_end_moninvent(coder)
invent_carrying_monster = NULL;
}
/*ARGUSED*/
void
spo_pop_container(coder)
struct sp_coder *coder;
@@ -2543,7 +2637,7 @@ spo_monster(coder)
int nparams = 0;
struct opvar *varparam;
struct opvar *id, *coord, *has_inv;
struct opvar *id, *mcoord, *has_inv;
monster tmpmons;
tmpmons.peaceful = -1;
@@ -2660,13 +2754,13 @@ spo_monster(coder)
}
}
if (!OV_pop_c(coord)) panic("no monster coord?");
if (!OV_pop_c(mcoord)) panic("no monster coord?");
if (!OV_pop_typ(id, SPOVAR_MONST)) panic("no mon type");
tmpmons.id = SP_MONST_PM(OV_i(id));
tmpmons.class = SP_MONST_CLASS(OV_i(id));
tmpmons.coord = OV_i(coord);
tmpmons.coord = OV_i(mcoord);
tmpmons.has_invent = OV_i(has_inv);
create_monster(&tmpmons, coder->croom);
@@ -2675,7 +2769,7 @@ spo_monster(coder)
Free(tmpmons.appear_as.str);
opvar_free(id);
opvar_free(coord);
opvar_free(mcoord);
opvar_free(has_inv);
opvar_free(varparam);
}
@@ -2837,22 +2931,23 @@ spo_level_flags(coder)
struct sp_coder *coder;
{
struct opvar *flagdata;
long flags;
long lflags;
if (!OV_pop_i(flagdata)) return;
flags = OV_i(flagdata);
lflags = OV_i(flagdata);
if (flags & NOTELEPORT) level.flags.noteleport = 1;
if (flags & HARDFLOOR) level.flags.hardfloor = 1;
if (flags & NOMMAP) level.flags.nommap = 1;
if (flags & SHORTSIGHTED) level.flags.shortsighted = 1;
if (flags & ARBOREAL) level.flags.arboreal = 1;
if (flags & MAZELEVEL) level.flags.is_maze_lev = 1;
if (flags & PREMAPPED) coder->premapped = TRUE;
if (flags & SHROUD) level.flags.hero_memory = 0;
if (flags & GRAVEYARD) level.flags.graveyard = 1;
if (flags & ICEDPOOLS) icedpools = TRUE;
if (flags & SOLIDIFY) coder->solidify = TRUE;
if (lflags & NOTELEPORT) level.flags.noteleport = 1;
if (lflags & HARDFLOOR) level.flags.hardfloor = 1;
if (lflags & NOMMAP) level.flags.nommap = 1;
if (lflags & SHORTSIGHTED) level.flags.shortsighted = 1;
if (lflags & ARBOREAL) level.flags.arboreal = 1;
if (lflags & MAZELEVEL) level.flags.is_maze_lev = 1;
if (lflags & PREMAPPED) coder->premapped = TRUE;
if (lflags & SHROUD) level.flags.hero_memory = 0;
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);
}
@@ -2902,19 +2997,19 @@ void
spo_engraving(coder)
struct sp_coder *coder;
{
struct opvar *etyp, *txt, *coord;
struct opvar *etyp, *txt, *ecoord;
xchar x,y;
if (!OV_pop_i(etyp) ||
!OV_pop_s(txt) ||
!OV_pop_c(coord)) return;
!OV_pop_c(ecoord)) return;
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
get_location_coord(&x, &y, DRY, coder->croom, OV_i(ecoord));
make_engr_at(x, y, OV_s(txt), 0L, OV_i(etyp));
opvar_free(etyp);
opvar_free(txt);
opvar_free(coord);
opvar_free(ecoord);
}
void
@@ -2940,10 +3035,10 @@ void
spo_room(coder)
struct sp_coder *coder;
{
if (coder->n_subroom > MAX_NESTED_ROOMS)
if (coder->n_subroom > MAX_NESTED_ROOMS) {
panic("Too deeply nested rooms?!");
else {
struct opvar *flags, *h, *w, *yalign, *xalign,
} else {
struct opvar *rflags, *h, *w, *yalign, *xalign,
*y, *x, *rlit, *chance, *rtype;
room tmproom;
@@ -2955,7 +3050,7 @@ spo_room(coder)
!OV_pop_i(x) ||
!OV_pop_i(yalign) ||
!OV_pop_i(xalign) ||
!OV_pop_i(flags) ||
!OV_pop_i(rflags) ||
!OV_pop_i(rlit) ||
!OV_pop_i(chance) ||
!OV_pop_i(rtype)) return;
@@ -2970,9 +3065,9 @@ spo_room(coder)
tmproom.rtype = OV_i(rtype);
tmproom.chance = OV_i(chance);
tmproom.rlit = OV_i(rlit);
tmproom.filled = (OV_i(flags) & (1 << 0));
/*tmproom.irregular = (OV_i(flags) & (1 << 1));*/
tmproom.joined = !(OV_i(flags) & (1 << 2));
tmproom.filled = (OV_i(rflags) & (1 << 0));
/*tmproom.irregular = (OV_i(rflags) & (1 << 1));*/
tmproom.joined = !(OV_i(rflags) & (1 << 2));
opvar_free(x);
opvar_free(y);
@@ -2983,7 +3078,7 @@ spo_room(coder)
opvar_free(rtype);
opvar_free(chance);
opvar_free(rlit);
opvar_free(flags);
opvar_free(rflags);
if (!coder->failed_room[coder->n_subroom-1]) {
tmpcr = build_room(&tmproom, coder->croom);
@@ -3028,18 +3123,18 @@ spo_stair(coder)
struct sp_coder *coder;
{
xchar x,y;
struct opvar *up, *coord;
struct opvar *up, *scoord;
struct trap *badtrap;
if (!OV_pop_i(up) ||
!OV_pop_c(coord)) return;
!OV_pop_c(scoord)) return;
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
get_location_coord(&x, &y, DRY, coder->croom, OV_i(scoord));
if ((badtrap = t_at(x,y)) != 0) deltrap(badtrap);
mkstairs(x, y, (char)OV_i(up), coder->croom);
SpLev_Map[x][y] = 1;
opvar_free(coord);
opvar_free(scoord);
opvar_free(up);
}
@@ -3048,12 +3143,12 @@ spo_ladder(coder)
struct sp_coder *coder;
{
xchar x,y;
struct opvar *up, *coord;
struct opvar *up, *lcoord;
if (!OV_pop_i(up) ||
!OV_pop_c(coord)) return;
!OV_pop_c(lcoord)) return;
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
get_location_coord(&x, &y, DRY, coder->croom, OV_i(lcoord));
levl[x][y].typ = LADDER;
SpLev_Map[x][y] = 1;
@@ -3064,7 +3159,7 @@ spo_ladder(coder)
xdnladder = x; ydnladder = y;
levl[x][y].ladder = LA_DOWN;
}
opvar_free(coord);
opvar_free(lcoord);
opvar_free(up);
}
@@ -3072,13 +3167,13 @@ void
spo_grave(coder)
struct sp_coder *coder;
{
struct opvar *coord, *typ, *txt;
struct opvar *gcoord, *typ, *txt;
schar x,y;
if (!OV_pop_i(typ) ||
!OV_pop_s(txt) ||
!OV_pop_c(coord)) return;
!OV_pop_c(gcoord)) return;
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord));
if (isok(x, y) && !t_at(x, y)) {
levl[x][y].typ = GRAVE;
@@ -3089,7 +3184,7 @@ spo_grave(coder)
}
}
opvar_free(coord);
opvar_free(gcoord);
opvar_free(typ);
opvar_free(txt);
}
@@ -3098,20 +3193,20 @@ void
spo_altar(coder)
struct sp_coder *coder;
{
struct opvar *al, *shrine, *coord;
struct opvar *al, *shrine, *acoord;
altar tmpaltar;
if (!OV_pop_i(al) ||
!OV_pop_i(shrine) ||
!OV_pop_c(coord)) return;
!OV_pop_c(acoord)) return;
tmpaltar.coord = OV_i(coord);
tmpaltar.coord = OV_i(acoord);
tmpaltar.align = OV_i(al);
tmpaltar.shrine = OV_i(shrine);
create_altar(&tmpaltar, coder->croom);
opvar_free(coord);
opvar_free(acoord);
opvar_free(shrine);
opvar_free(al);
}
@@ -3121,17 +3216,17 @@ spo_trap(coder)
struct sp_coder *coder;
{
struct opvar *type;
struct opvar *coord;
struct opvar *tcoord;
trap tmptrap;
if (!OV_pop_i(type) ||
!OV_pop_c(coord)) return;
!OV_pop_c(tcoord)) return;
tmptrap.coord = OV_i(coord);
tmptrap.coord = OV_i(tcoord);
tmptrap.type = OV_i(type);
create_trap(&tmptrap, coder->croom);
opvar_free(coord);
opvar_free(tcoord);
opvar_free(type);
}
@@ -3139,15 +3234,16 @@ void
spo_gold(coder)
struct sp_coder *coder;
{
struct opvar *coord, *amt;
struct opvar *gcoord, *amt;
schar x,y;
long amount;
if (!OV_pop_c(coord) || !OV_pop_i(amt)) return;
if (!OV_pop_c(gcoord) || !OV_pop_i(amt)) return;
amount = OV_i(amt);
get_location_coord(&x, &y, DRY, coder->croom, OV_i(coord));
get_location_coord(&x, &y, DRY, coder->croom, OV_i(gcoord));
if (amount == -1) amount = rnd(200);
mkgold(amount, x,y);
opvar_free(coord);
opvar_free(gcoord);
opvar_free(amt);
}
@@ -3202,7 +3298,7 @@ selection_opvar(nbuf)
return ov;
}
char
xchar
selection_getpoint(x,y,ov)
int x,y;
struct opvar *ov;
@@ -3217,12 +3313,12 @@ void
selection_setpoint(x,y,ov, c)
int x,y;
struct opvar *ov;
char c;
xchar c;
{
if (!ov || ov->spovartyp != SPOVAR_SEL) return;
if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) return;
ov->vardata.str[COLNO*y + x] = (c + 1);
ov->vardata.str[COLNO*y + x] = (char)(c + 1);
}
struct opvar *
@@ -3476,16 +3572,16 @@ line_dist_coord(x1,y1, x2,y2, x3,y3)
long py = y2-y1;
long s = px*px + py*py;
long x, y, dx, dy, dist = 0;
float u = 0;
float lu = 0;
if (x1 == x2 && y1 == y2) return isqrt(dist2(x1,y1, x3,y3));
u = ((x3 - x1) * px + (y3 - y1) * py) / (float)s;
if (u > 1) u = 1;
else if (u < 0) u = 0;
lu = ((x3 - x1) * px + (y3 - y1) * py) / (float)s;
if (lu > 1) lu = 1;
else if (lu < 0) lu = 0;
x = x1 + u * px;
y = y1 + u * py;
x = x1 + lu * px;
y = y1 + lu * py;
dx = x - x3;
dy = y - y3;
dist = isqrt(dx*dx + dy*dy);
@@ -3642,7 +3738,7 @@ selection_do_randline(x1,y1,x2,y2,rough, rec, ov)
void
selection_iterate(ov, func, arg)
struct opvar *ov;
void FDECL((*func), (int,int,genericptr_t));
select_iter_func func;
genericptr_t arg;
{
int x,y;
@@ -3878,19 +3974,19 @@ void
spo_region(coder)
struct sp_coder *coder;
{
struct opvar *rtype, *rlit, *flags, *area;
struct opvar *rtype, *rlit, *rflags, *area;
xchar dx1,dy1,dx2,dy2;
register struct mkroom *troom;
boolean prefilled, room_not_needed, irregular, joined;
if (!OV_pop_i(flags) ||
if (!OV_pop_i(rflags) ||
!OV_pop_i(rtype) ||
!OV_pop_i(rlit) ||
!OV_pop_r(area)) return;
prefilled = !(OV_i(flags) & (1 << 0));
irregular = (OV_i(flags) & (1 << 1));
joined = !(OV_i(flags) & (1 << 2));
prefilled = !(OV_i(rflags) & (1 << 0));
irregular = (OV_i(rflags) & (1 << 1));
joined = !(OV_i(rflags) & (1 << 2));
if(OV_i(rtype) > MAXRTYPE) {
OV_i(rtype) -= MAXRTYPE+1;
@@ -3927,7 +4023,7 @@ spo_region(coder)
light_region(&tmpregion);
opvar_free(area);
opvar_free(flags);
opvar_free(rflags);
opvar_free(rlit);
opvar_free(rtype);
@@ -3973,7 +4069,7 @@ spo_region(coder)
}
opvar_free(area);
opvar_free(flags);
opvar_free(rflags);
opvar_free(rlit);
opvar_free(rtype);
}
@@ -3983,18 +4079,18 @@ spo_drawbridge(coder)
struct sp_coder *coder;
{
xchar x,y;
struct opvar *dir, *db_open, *coord;
struct opvar *dir, *db_open, *dcoord;
if (!OV_pop_i(dir) ||
!OV_pop_i(db_open) ||
!OV_pop_c(coord)) return;
!OV_pop_c(dcoord)) return;
get_location_coord(&x, &y, DRY|WET|HOT, coder->croom, OV_i(coord));
get_location_coord(&x, &y, DRY|WET|HOT, coder->croom, OV_i(dcoord));
if (!create_drawbridge(x, y, OV_i(dir), OV_i(db_open)))
impossible("Cannot create drawbridge.");
SpLev_Map[x][y] = 1;
opvar_free(coord);
opvar_free(dcoord);
opvar_free(db_open);
opvar_free(dir);
}
@@ -4004,25 +4100,21 @@ spo_mazewalk(coder)
struct sp_coder *coder;
{
xchar x,y;
struct opvar *ftyp, *fstocked,*fdir, *coord;
struct opvar *ftyp, *fstocked,*fdir, *mcoord;
int dir;
if (!OV_pop_i(ftyp) ||
!OV_pop_i(fstocked) ||
!OV_pop_i(fdir) ||
!OV_pop_c(coord)) return;
!OV_pop_c(mcoord)) return;
dir = OV_i(fdir);
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(coord));
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(mcoord));
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. */
@@ -4066,7 +4158,7 @@ spo_mazewalk(coder)
walkfrom(x, y, OV_i(ftyp));
if (OV_i(fstocked)) fill_empty_maze();
opvar_free(coord);
opvar_free(mcoord);
opvar_free(fdir);
opvar_free(fstocked);
opvar_free(ftyp);
@@ -4121,6 +4213,7 @@ spo_room_door(coder)
opvar_free(pos);
}
/*ARGSUSED*/
void
sel_set_wallify(x,y,arg)
int x, y;
@@ -4833,7 +4926,7 @@ sp_lev *lvl;
{
struct opvar *sel1, *sel2, *pt;
if (!OV_pop_typ(sel1, SPOVAR_SEL)) panic("no sel1 for add");
if (!OV_pop_typ(sel2, SPOVAR_SEL)) panic("no sel1 for add");
if (!OV_pop_typ(sel2, SPOVAR_SEL)) panic("no sel2 for add");
pt = selection_logical_oper(sel1, sel2, '|');
opvar_free(sel1);
opvar_free(sel2);
@@ -4941,7 +5034,8 @@ sp_lev *lvl;
{
struct opvar *tmp = NULL, *tmp2 = NULL, *pt = selection_opvar(NULL);
schar x1,y1,x2,y2;
if (!OV_pop_c(tmp) || !OV_pop_c(tmp2)) panic("no ter sel linecoord");
if (!OV_pop_c(tmp)) panic("no ter sel linecoord1");
if (!OV_pop_c(tmp2)) panic("no ter sel linecoord2");
get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp));
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2));
x1 = (x1 < 0) ? 0 : x1;
@@ -4958,7 +5052,9 @@ sp_lev *lvl;
{
struct opvar *tmp = NULL, *tmp2 = NULL, *tmp3, *pt = selection_opvar(NULL);
schar x1,y1,x2,y2;
if (!OV_pop_i(tmp3) || !OV_pop_c(tmp) || !OV_pop_c(tmp2)) panic("no ter sel randline");
if (!OV_pop_i(tmp3)) panic("no ter sel randline1");
if (!OV_pop_c(tmp)) panic("no ter sel randline2");
if (!OV_pop_c(tmp2)) panic("no ter sel randline3");
get_location_coord(&x1, &y1, ANY_LOC, coder->croom, OV_i(tmp));
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(tmp2));
x1 = (x1 < 0) ? 0 : x1;
@@ -5029,25 +5125,28 @@ sp_lev *lvl;
break;
case SPO_SEL_GRADIENT:
{
struct opvar *gtyp, *glim, *mind, *maxd, *coord, *coord2;
struct opvar *gtyp, *glim, *mind, *maxd, *gcoord, *coord2;
struct opvar *sel;
schar x,y, x2,y2;
if (!OV_pop_i(gtyp)) panic("no gtyp for grad");
if (!OV_pop_i(glim)) panic("no glim for grad");
if (!OV_pop_c(coord2)) panic("no coord2 for grad");
if (!OV_pop_c(coord)) panic("no coord for grad");
if (!OV_pop_c(gcoord)) panic("no coord for grad");
if (!OV_pop_i(maxd)) panic("no maxd for grad");
if (!OV_pop_i(mind)) panic("no mind for grad");
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(coord));
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(coord2));
get_location_coord(&x, &y, ANY_LOC, coder->croom,
OV_i(gcoord));
get_location_coord(&x2, &y2, ANY_LOC, coder->croom,
OV_i(coord2));
sel = selection_opvar(NULL);
selection_do_gradient(sel, x,y, x2,y2, OV_i(gtyp), OV_i(mind), OV_i(maxd), OV_i(glim));
selection_do_gradient(sel, x,y, x2,y2, OV_i(gtyp),
OV_i(mind), OV_i(maxd), OV_i(glim));
splev_stack_push(coder->stack, sel);
opvar_free(gtyp);
opvar_free(glim);
opvar_free(coord);
opvar_free(gcoord);
opvar_free(coord2);
opvar_free(maxd);
opvar_free(mind);
@@ -5064,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();
+3 -2
View File
@@ -353,8 +353,9 @@ encodexlogflags()
{
long e = 0L;
if (wizard) e |= 1L << 0;
if (discover) e |= 1L << 1;
if (wizard) e |= 1L << 0;
if (discover) e |= 1L << 1;
if (!u.uroleplay.numbones) e |= 1L << 2;
return e;
}
+1 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 trap.c $NHDT-Date: 1427331767 2015/03/26 01:02:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.199 $ */
/* NetHack 3.5 trap.c $NHDT-Date: 1427934551 2015/04/02 00:29:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.223 $ */
/* NetHack 3.5 trap.c $Date: 2013/03/14 01:58:21 $ $Revision: 1.179 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3169,7 +3169,6 @@ struct obj *obj;
const char *ostr;
boolean force;
{
boolean exploded = FALSE;
if (!obj) return ER_NOTHING;
if (snuff_lit(obj))
+11
View File
@@ -121,3 +121,14 @@ OPTIONS=time,noshowexp,number_pad:2,lit_corridor
# DEC Rainbows will hang if rawio is set, so they should instead use:
#OPTIONS=BIOS,DECgraphics
# Colored menus.
#OPTIONS=menucolors
# Syntax is: MENUCOLOR="string_to_match"=color&attribute
# Colors: black, red, green, brown, blue, magenta, cyan, gray, orange,
# lightgreen, yellow, lightblue, lightmagenta, lightcyan, white.
# Attributes: none, bold, dim, underline, blink, inverse.
#MENUCOLOR=" blessed "=green
#MENUCOLOR=" holy "=green
#MENUCOLOR=" cursed "=red
#MENUCOLOR=" unholy "=red
#MENUCOLOR=" cursed .* (being worn)"=orange&underline
+807 -816
View File
File diff suppressed because it is too large Load Diff
+1228 -1126
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -432,7 +432,7 @@ char *argv[];
hackpid = 1;
#endif
write(fd, (genericptr_t) &hackpid, sizeof(hackpid));
close(fd);
nhclose(fd);
}
#ifdef MFLOPPY
level_info[0].where = ACTIVE;
+2 -2
View File
@@ -282,7 +282,7 @@ int start;
if (sysflags.asksavedisk) {
/* Don't prompt if you can find the save file */
if ((fd = open_savefile()) >= 0) {
(void) close(fd);
(void) nhclose(fd);
return 1;
}
clear_nhwindow(WIN_MESSAGE);
@@ -335,7 +335,7 @@ comspec_exists()
if ((comspec = getcomspec()))
if ((fd = open(comspec, O_RDONLY)) >= 0) {
(void) close(fd);
(void) nhclose(fd);
return TRUE;
}
return FALSE;
+2 -2
View File
@@ -150,7 +150,7 @@ getlock()
error("Cannot open %s", fq_lock);
}
(void) close(fd);
(void) nhclose(fd);
if(iflags.window_inited) {
# ifdef SELF_RECOVER
@@ -248,7 +248,7 @@ gotlock:
# endif
error("cannot write lock (%s)", fq_lock);
}
if(close(fd) == -1) {
if(nhclose(fd) == -1) {
# if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
# endif
+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 \
+4 -2
View File
@@ -1,5 +1,5 @@
%{
/* NetHack 3.5 lev_comp.l $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 lev_comp.l $NHDT-Date: 1428240296 2015/04/05 13:24:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */
/* NetHack 3.5 lev_comp.l $Date: 2009/05/06 10:54:31 $ $Revision: 1.9 $ */
/* SCCS Id: @(#)lev_lex.c 3.5 2002/03/27 */
/* Copyright (c) 1989 by Jean-Christophe Collet */
@@ -69,6 +69,7 @@ void FDECL(init_yyout, (FILE *));
long NDECL(handle_varstring_check);
long FDECL(corefunc_str_check, (char *, long));
extern void VDECL(lc_error, (const char *, ...));
extern struct lc_vardefs *FDECL(vardef_defined,(struct lc_vardefs *,char *, int));
extern struct lc_vardefs *variable_definitions;
@@ -111,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 */
@@ -295,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
+184 -87
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,13 +111,36 @@ 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));
char * FDECL(decode_parm_str, (char *));
struct opvar * FDECL(set_opvar_int, (struct opvar *, long));
struct opvar * FDECL(set_opvar_coord, (struct opvar *, long));
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 *, 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 *));
void FDECL(break_stmt_new, (sp_lev *, long));
char *FDECL(funcdef_paramtypes, (struct lc_funcdefs *));
const char *FDECL(spovar2str, (long));
void FDECL(vardef_used, (struct lc_vardefs *, char *));
void FDECL(check_vardef_type, (struct lc_vardefs *, char *, long));
struct lc_vardefs * FDECL(add_vardef_type, (struct lc_vardefs *, char *, long));
int FDECL(reverse_jmp_opcode, (int));
struct opvar * FDECL(opvar_clone, (struct opvar *));
void FDECL(start_level_def, (sp_lev **, char *));
static struct {
@@ -273,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 {
@@ -307,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");
@@ -340,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;
}
@@ -372,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;
}
@@ -478,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;
@@ -490,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;
@@ -502,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) {
@@ -516,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
@@ -763,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;
@@ -838,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;
}
}
@@ -875,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;
@@ -897,15 +995,15 @@ splev_add_from(splev, from_splev)
void
start_level_def(splev, fname)
start_level_def(splev, ldfname)
sp_lev **splev;
char *fname;
char *ldfname;
{
struct lc_funcdefs *f;
if (index(fname, '.'))
lc_error("Invalid dot ('.') in level name '%s'.", fname);
if ((int) strlen(fname) > 14)
lc_error("Level names limited to 14 characters ('%s').", fname);
if (index(ldfname, '.'))
lc_error("Invalid dot ('.') in level name '%s'.", ldfname);
if ((int) strlen(ldfname) > 14)
lc_error("Level names limited to 14 characters ('%s').", ldfname);
f = function_definitions;
while (f) {
f->n_called = 0;
@@ -1088,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);
}
@@ -1111,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) {
@@ -1204,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]);
@@ -1218,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,
@@ -1242,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));
@@ -1253,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;
@@ -1282,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);
@@ -1335,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;
+5 -3
View File
@@ -1294,6 +1294,11 @@ static const char *build_opts[] = {
#ifdef NEWS
"news file",
#endif
#ifdef MENU_COLOR_REGEX
"menu colors via regular expressions",
#else
"menu colors via pmatch",
#endif
#ifdef OVERLAY
# ifdef MOVERLAY
"MOVE overlays",
@@ -1362,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
+282 -225
View File
File diff suppressed because it is too large Load Diff
+13 -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. */
@@ -1462,6 +1462,8 @@ struct WinDesc *cw;
for (page_lines = 0, curr = page_start;
curr != page_end;
page_lines++, curr = curr->next) {
int color = NO_COLOR, attr = ATR_NONE;
boolean menucolr = FALSE;
if (curr->selector)
*rp++ = curr->selector;
@@ -1477,6 +1479,11 @@ struct WinDesc *cw;
* actually output the character. We're faster doing
* this.
*/
if (iflags.use_menu_color &&
(menucolr = get_menu_coloring(curr->str, &color,&attr))) {
term_start_attr(attr);
if (color != NO_COLOR) term_start_color(color);
} else
term_start_attr(curr->attr);
for (n = 0, cp = curr->str;
#ifndef WIN32CON
@@ -1494,6 +1501,10 @@ struct WinDesc *cw;
(void) putchar('#'); /* count selected */
} else
(void) putchar(*cp);
if (iflags.use_menu_color && menucolr) {
if (color != NO_COLOR) term_end_color();
term_end_attr(attr);
} else
term_end_attr(curr->attr);
}
} else {
@@ -1759,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
-1
View File
@@ -45,7 +45,6 @@ static void nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut);
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
static void nhglyph2charcolor(short glyph, uchar* ch, int* color);
#endif
static COLORREF nhcolor_to_RGB(int c);
HWND mswin_init_map_window () {
static int run_once = 0;
+1
View File
@@ -12,6 +12,7 @@
#include "global.h"
COLORREF nhcolor_to_RGB (int c);
HWND mswin_init_map_window (void);
void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw);
int mswin_map_mode(HWND hWnd, int mode);
+10
View File
@@ -917,6 +917,9 @@ BOOL onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
int column;
int spacing = 0;
int color = NO_COLOR, attr;
boolean menucolr = FALSE;
lpdis = (LPDRAWITEMSTRUCT) lParam;
/* If there are no list box items, skip this message. */
@@ -967,6 +970,13 @@ BOOL onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
buf[0] = item->accelerator;
buf[1] = '\x0';
if (iflags.use_menu_color &&
(menucolr = get_menu_coloring(item->str, &color,&attr))) {
/* TODO: use attr too */
if (color != NO_COLOR)
SetTextColor(lpdis->hDC, nhcolor_to_RGB(color));
}
SetRect( &drawRect, x, lpdis->rcItem.top, lpdis->rcItem.right, lpdis->rcItem.bottom );
DrawText(lpdis->hDC, NH_A2W(buf, wbuf, 2), 1, &drawRect, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
}