Merge branch 'master' into win32-x64-working

* master: (354 commits)
  Add missing protos
  a warning bout lc_error
  Add S_poisoncloud to Guidebooks
  ...

Conflicts:
	.gitattributes
	dat/.gitattributes
	doc/.gitattributes
	doc/Guidebook.mn
	include/config.h
	include/decl.h
	include/extern.h
	include/flag.h
	include/hack.h
	include/ntconf.h
	include/sys.h
	include/wceconf.h
	src/apply.c
	src/attrib.c
	src/bones.c
	src/botl.c
	src/dbridge.c
	src/dig.c
	src/do.c
	src/do_name.c
	src/dog.c
	src/dungeon.c
	src/eat.c
	src/end.c
	src/files.c
	src/fountain.c
	src/hack.c
	src/invent.c
	src/light.c
	src/makemon.c
	src/mhitu.c
	src/mklev.c
	src/mkmaze.c
	src/mkobj.c
	src/mkroom.c
	src/mon.c
	src/objnam.c
	src/options.c
	src/pager.c
	src/pickup.c
	src/potion.c
	src/pray.c
	src/questpgr.c
	src/read.c
	src/restore.c
	src/rnd.c
	src/role.c
	src/rumors.c
	src/save.c
	src/shk.c
	src/sit.c
	src/sp_lev.c
	src/sys.c
	src/teleport.c
	src/trap.c
	src/u_init.c
	src/uhitm.c
	src/wield.c
	src/worn.c
	src/zap.c
	sys/amiga/.gitattributes
	sys/mac/.gitattributes
	sys/msdos/.gitattributes
	sys/msdos/pctiles.c
	sys/msdos/vidvga.c
	sys/os2/.gitattributes
	sys/share/.gitattributes
	sys/share/pcmain.c
	sys/unix/.gitattributes
	sys/unix/hints/.gitattributes
	sys/unix/sysconf
	sys/unix/unixmain.c
	sys/vms/.gitattributes
	sys/wince/.gitattributes
	sys/wince/mhstatus.c
	sys/winnt/.gitattributes
	sys/winnt/Makefile.msc
	sys/winnt/nhsetup.bat
	util/lev_comp.l
	util/makedefs.c
	win/X11/winmenu.c
	win/X11/winstat.c
	win/gnome/gnstatus.c
	win/share/tilemap.c
	win/tty/termcap.c
	win/tty/topl.c
	win/tty/wintty.c
This commit is contained in:
Derek S. Ray
2015-04-05 23:42:15 -04:00
197 changed files with 29181 additions and 15618 deletions

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 mkmaze.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mkmaze.c $Date: 2009/05/06 10:46:56 $ $Revision: 1.18 $ */
/* NetHack 3.5 mkmaze.c $NHDT-Date: 1426465437 2015/03/16 00:23:57 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.20 $ */
/* SCCS Id: @(#)mkmaze.c 3.5 2007/06/18 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -344,7 +343,8 @@ fixup_special()
was_waterlevel = FALSE;
u.uinwater = 0;
unsetup_waterlevel();
} else if (Is_waterlevel(&u.uz)) {
}
if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) {
level.flags.hero_memory = 0;
was_waterlevel = TRUE;
/* water level is an odd beast - it has to be set up
@@ -406,10 +406,6 @@ fixup_special()
place_lregion(0,0,0,0,0,0,0,0,LR_BRANCH,(d_level *)0);
}
/* KMH -- Sokoban levels */
if(In_sokoban(&u.uz))
sokoban_detect();
/* Still need to add some stuff to level file */
if (Is_medusa_level(&u.uz)) {
struct obj *otmp;
@@ -556,7 +552,7 @@ register const char *s;
#endif
maze0xy(&mm);
walkfrom((int) mm.x, (int) mm.y);
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);
@@ -589,7 +585,7 @@ register const char *s;
if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN ||
(x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE))
debugpline("inv_pos: maze is too small! (%d x %d)",
debugpline2("inv_pos: maze is too small! (%d x %d)",
x_maze_max, y_maze_max);
inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do {
@@ -644,14 +640,21 @@ register const char *s;
* that is totally safe.
*/
void
walkfrom(x,y)
walkfrom(x,y,typ)
int x,y;
schar typ;
{
#define CELLS (ROWNO * COLNO) / 4 /* a maze cell is 4 squares */
char mazex[CELLS + 1], mazey[CELLS + 1]; /* char's are OK */
int q, a, dir, pos;
int dirs[4];
#ifndef WALLIFIED_MAZE
if (!typ) typ = CORR;
#else
if (!typ) typ = ROOM;
#endif
pos = 1;
mazex[pos] = (char) x;
mazey[pos] = (char) y;
@@ -660,11 +663,7 @@ int x,y;
y = (int) mazey[pos];
if(!IS_DOOR(levl[x][y].typ)) {
/* might still be on edge of MAP, so don't overwrite */
#ifndef WALLIFIED_MAZE
levl[x][y].typ = CORR;
#else
levl[x][y].typ = ROOM;
#endif
levl[x][y].typ = typ;
levl[x][y].flags = 0;
}
q = 0;
@@ -675,11 +674,7 @@ int x,y;
else {
dir = dirs[rn2(q)];
move(&x, &y, dir);
#ifndef WALLIFIED_MAZE
levl[x][y].typ = CORR;
#else
levl[x][y].typ = ROOM;
#endif
levl[x][y].typ = typ;
move(&x, &y, dir);
pos++;
if (pos > CELLS)
@@ -692,19 +687,22 @@ int x,y;
#else
void
walkfrom(x,y)
walkfrom(x,y,typ)
int x,y;
schar typ;
{
register int q,a,dir;
int dirs[4];
#ifndef WALLIFIED_MAZE
if (!typ) typ = CORR;
#else
if (!typ) typ = ROOM;
#endif
if(!IS_DOOR(levl[x][y].typ)) {
/* might still be on edge of MAP, so don't overwrite */
#ifndef WALLIFIED_MAZE
levl[x][y].typ = CORR;
#else
levl[x][y].typ = ROOM;
#endif
levl[x][y].typ = typ;
levl[x][y].flags = 0;
}
@@ -715,13 +713,9 @@ int x,y;
if(!q) return;
dir = dirs[rn2(q)];
move(&x,&y,dir);
#ifndef WALLIFIED_MAZE
levl[x][y].typ = CORR;
#else
levl[x][y].typ = ROOM;
#endif
levl[x][y].typ = typ;
move(&x,&y,dir);
walkfrom(x,y);
walkfrom(x,y,typ);
}
}
#endif /* MICRO */
@@ -877,13 +871,33 @@ register xchar x, y, todnum, todlevel;
impossible("portal on top of portal??");
return;
}
debugpline("mkportal: at (%d,%d), to %s, level %d",
debugpline4("mkportal: at <%d,%d>, to %s, level %d",
x, y, dungeons[todnum].dname, todlevel);
ttmp->dst.dnum = todnum;
ttmp->dst.dlevel = 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);
struct trap *ttmp = t_at(x,y);
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).
*
@@ -921,99 +935,111 @@ 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, 0 };
/* set up the portal the first time bubbles are moved */
if (!wportal) set_wportal();
vision_recalc(2);
/* keep attached ball&chain separate from bubble objects */
if (Punished) unplacebc();
/*
* Pick up everything inside of a bubble then fill all bubble
* locations.
*/
if (Is_waterlevel(&u.uz)) {
for (b = up ? bbubbles : ebubbles; b; b = up ? b->next : b->prev) {
if (b->cons) panic("movebubbles: cons != null");
for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++)
for (j = 0, y = b->y; j < (int) b->bm[1]; j++, y++)
if (b->bm[j + 2] & (1 << i)) {
if (!isok(x,y)) {
impossible("movebubbles: bad pos (%d,%d)", x,y);
continue;
}
/* keep attached ball&chain separate from bubble objects */
if (Punished) unplacebc();
/* pick up objects, monsters, hero, and traps */
if (OBJ_AT(x,y)) {
struct obj *olist = (struct obj *) 0, *otmp;
struct container *cons = (struct container *)
alloc(sizeof(struct container));
/*
* Pick up everything inside of a bubble then fill all bubble
* locations.
*/
while ((otmp = level.objects[x][y]) != 0) {
remove_object(otmp);
otmp->ox = otmp->oy = 0;
otmp->nexthere = olist;
olist = otmp;
for (b = up ? bbubbles : ebubbles; b; b = up ? b->next : b->prev) {
if (b->cons) panic("movebubbles: cons != null");
for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++)
for (j = 0, y = b->y; j < (int) b->bm[1]; j++, y++)
if (b->bm[j + 2] & (1 << i)) {
if (!isok(x,y)) {
impossible("movebubbles: bad pos (%d,%d)", x,y);
continue;
}
cons->x = x;
cons->y = y;
cons->what = CONS_OBJ;
cons->list = (genericptr_t) olist;
cons->next = b->cons;
b->cons = cons;
/* pick up objects, monsters, hero, and traps */
if (OBJ_AT(x,y)) {
struct obj *olist = (struct obj *) 0, *otmp;
struct container *cons = (struct container *)
alloc(sizeof(struct container));
while ((otmp = level.objects[x][y]) != 0) {
remove_object(otmp);
otmp->ox = otmp->oy = 0;
otmp->nexthere = olist;
olist = otmp;
}
cons->x = x;
cons->y = y;
cons->what = CONS_OBJ;
cons->list = (genericptr_t) olist;
cons->next = b->cons;
b->cons = cons;
}
if (MON_AT(x,y)) {
struct monst *mon = m_at(x,y);
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_MON;
cons->list = (genericptr_t) mon;
cons->next = b->cons;
b->cons = cons;
if(mon->wormno)
remove_worm(mon);
else
remove_monster(x, y);
newsym(x,y); /* clean up old position */
mon->mx = mon->my = 0;
}
if (!u.uswallow && x == u.ux && y == u.uy) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_HERO;
cons->list = (genericptr_t) 0;
cons->next = b->cons;
b->cons = cons;
}
if ((btrap = t_at(x,y)) != 0) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_TRAP;
cons->list = (genericptr_t) btrap;
cons->next = b->cons;
b->cons = cons;
}
levl[x][y] = water_pos;
block_point(x,y);
}
if (MON_AT(x,y)) {
struct monst *mon = m_at(x,y);
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_MON;
cons->list = (genericptr_t) mon;
cons->next = b->cons;
b->cons = cons;
if(mon->wormno)
remove_worm(mon);
else
remove_monster(x, y);
newsym(x,y); /* clean up old position */
mon->mx = mon->my = 0;
}
if (!u.uswallow && x == u.ux && y == u.uy) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_HERO;
cons->list = (genericptr_t) 0;
cons->next = b->cons;
b->cons = cons;
}
if ((btrap = t_at(x,y)) != 0) {
struct container *cons = (struct container *)
alloc(sizeof(struct container));
cons->x = x;
cons->y = y;
cons->what = CONS_TRAP;
cons->list = (genericptr_t) btrap;
cons->next = b->cons;
b->cons = cons;
}
levl[x][y] = water_pos;
block_point(x,y);
}
}
} else if (Is_airlevel(&u.uz)) {
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
levl[x][y] = air_pos;
unblock_point(x,y);
}
}
/*
@@ -1032,7 +1058,7 @@ movebubbles()
}
/* put attached ball&chain back */
if (Punished) placebc();
if (Is_waterlevel(&u.uz) && Punished) placebc();
vision_full_recalc = 1;
}
@@ -1076,7 +1102,7 @@ int fd, mode;
{
register struct bubble *b;
if (!Is_waterlevel(&u.uz)) return;
if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) return;
if (perform_bwrite(mode)) {
int n = 0;
@@ -1101,7 +1127,7 @@ register int fd;
register int i;
int n;
if (!Is_waterlevel(&u.uz)) return;
if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) return;
set_wportal();
mread(fd,(genericptr_t)&n,sizeof(int));
@@ -1177,6 +1203,7 @@ setup_waterlevel()
register int x, y;
register int xskip, yskip;
register int water_glyph = cmap_to_glyph(S_water);
register int air_glyph = cmap_to_glyph(S_air);
/* ouch, hardcoded... */
@@ -1189,12 +1216,18 @@ setup_waterlevel()
for (x = xmin; x <= xmax; x++)
for (y = ymin; y <= ymax; y++)
levl[x][y].glyph = water_glyph;
levl[x][y].glyph = Is_waterlevel(&u.uz) ? water_glyph : air_glyph;
/* make bubbles */
xskip = 10 + rn2(10);
yskip = 4 + rn2(4);
if (Is_waterlevel(&u.uz)) {
xskip = 10 + rn2(10);
yskip = 4 + rn2(4);
} else {
xskip = 6 + rn2(4);
yskip = 3 + rn2(3);
}
for (x = bxmin; x <= bxmax; x += xskip)
for (y = bymin; y <= bymax; y += yskip)
mk_bubble(x,y,rn2(7));
@@ -1280,67 +1313,76 @@ register boolean ini;
register int x, y, i, j, colli = 0;
struct container *cons, *ctemp;
/* move bubble */
if (dx < -1 || dx > 1 || dy < -1 || dy > 1) {
/* pline("mv_bubble: dx = %d, dy = %d", dx, dy); */
dx = sgn(dx);
dy = sgn(dy);
/* clouds move slowly */
if (!Is_airlevel(&u.uz) || !rn2(6)) {
/* move bubble */
if (dx < -1 || dx > 1 || dy < -1 || dy > 1) {
/* pline("mv_bubble: dx = %d, dy = %d", dx, dy); */
dx = sgn(dx);
dy = sgn(dy);
}
/*
* collision with level borders?
* 1 = horizontal border, 2 = vertical, 3 = corner
*/
if (b->x <= bxmin) colli |= 2;
if (b->y <= bymin) colli |= 1;
if ((int) (b->x + b->bm[0] - 1) >= bxmax) colli |= 2;
if ((int) (b->y + b->bm[1] - 1) >= bymax) colli |= 1;
if (b->x < bxmin) {
pline("bubble xmin: x = %d, xmin = %d", b->x, bxmin);
b->x = bxmin;
}
if (b->y < bymin) {
pline("bubble ymin: y = %d, ymin = %d", b->y, bymin);
b->y = bymin;
}
if ((int) (b->x + b->bm[0] - 1) > bxmax) {
pline("bubble xmax: x = %d, xmax = %d",
b->x + b->bm[0] - 1, bxmax);
b->x = bxmax - b->bm[0] + 1;
}
if ((int) (b->y + b->bm[1] - 1) > bymax) {
pline("bubble ymax: y = %d, ymax = %d",
b->y + b->bm[1] - 1, bymax);
b->y = bymax - b->bm[1] + 1;
}
/* bounce if we're trying to move off the border */
if (b->x == bxmin && dx < 0) dx = -dx;
if (b->x + b->bm[0] - 1 == bxmax && dx > 0) dx = -dx;
if (b->y == bymin && dy < 0) dy = -dy;
if (b->y + b->bm[1] - 1 == bymax && dy > 0) dy = -dy;
b->x += dx;
b->y += dy;
}
/*
* collision with level borders?
* 1 = horizontal border, 2 = vertical, 3 = corner
*/
if (b->x <= bxmin) colli |= 2;
if (b->y <= bymin) colli |= 1;
if ((int) (b->x + b->bm[0] - 1) >= bxmax) colli |= 2;
if ((int) (b->y + b->bm[1] - 1) >= bymax) colli |= 1;
if (b->x < bxmin) {
pline("bubble xmin: x = %d, xmin = %d", b->x, bxmin);
b->x = bxmin;
}
if (b->y < bymin) {
pline("bubble ymin: y = %d, ymin = %d", b->y, bymin);
b->y = bymin;
}
if ((int) (b->x + b->bm[0] - 1) > bxmax) {
pline("bubble xmax: x = %d, xmax = %d",
b->x + b->bm[0] - 1, bxmax);
b->x = bxmax - b->bm[0] + 1;
}
if ((int) (b->y + b->bm[1] - 1) > bymax) {
pline("bubble ymax: y = %d, ymax = %d",
b->y + b->bm[1] - 1, bymax);
b->y = bymax - b->bm[1] + 1;
}
/* bounce if we're trying to move off the border */
if (b->x == bxmin && dx < 0) dx = -dx;
if (b->x + b->bm[0] - 1 == bxmax && dx > 0) dx = -dx;
if (b->y == bymin && dy < 0) dy = -dy;
if (b->y + b->bm[1] - 1 == bymax && dy > 0) dy = -dy;
b->x += dx;
b->y += dy;
/* void positions inside bubble */
/* draw the bubbles */
for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++)
for (j = 0, y = b->y; j < (int) b->bm[1]; j++, y++)
if (b->bm[j + 2] & (1 << i)) {
if (Is_waterlevel(&u.uz)) {
levl[x][y].typ = AIR;
levl[x][y].lit = 1;
unblock_point(x,y);
} else if (Is_airlevel(&u.uz)) {
levl[x][y].typ = CLOUD;
levl[x][y].lit = 1;
block_point(x,y);
}
}
/* replace contents of bubble */
for (cons = b->cons; cons; cons = ctemp) {
ctemp = cons->next;
cons->x += dx;
cons->y += dy;
if (Is_waterlevel(&u.uz)) {
/* replace contents of bubble */
for (cons = b->cons; cons; cons = ctemp) {
ctemp = cons->next;
cons->x += dx;
cons->y += dy;
switch(cons->what) {
switch(cons->what) {
case CONS_OBJ: {
struct obj *olist, *otmp;
@@ -1381,13 +1423,13 @@ register boolean ini;
default:
impossible("mv_bubble: unknown bubble contents");
break;
}
free((genericptr_t)cons);
}
free((genericptr_t)cons);
b->cons = 0;
}
b->cons = 0;
/* boing? */
switch (colli) {
case 1: b->dy = -b->dy; break;
case 3: b->dy = -b->dy; /* fall through */