-/* NetHack 3.6 mkmaze.c $NHDT-Date: 1446604114 2015/11/04 02:28:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
+/* NetHack 3.6 mkmaze.c $NHDT-Date: 1448013594 2015/11/20 09:59:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL int FDECL(extend_spine, (int[3][3], int, int, int));
STATIC_DCL boolean FDECL(okay, (int, int, int));
STATIC_DCL void FDECL(maze0xy, (coord *));
-STATIC_DCL boolean
-FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
- XCHAR_P, BOOLEAN_P, d_level *));
+STATIC_DCL boolean FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P,
+ XCHAR_P, XCHAR_P, XCHAR_P,
+ XCHAR_P, BOOLEAN_P, d_level *));
STATIC_DCL void NDECL(fixup_special);
-STATIC_DCL void FDECL(move, (int *, int *, int));
STATIC_DCL void NDECL(setup_waterlevel);
STATIC_DCL void NDECL(unsetup_waterlevel);
+/* adjust a coordinate one step in the specified direction */
+#define mz_move(X, Y, dir) \
+ do { \
+ switch (dir) { \
+ case 0: --(Y); break; \
+ case 1: (X)++; break; \
+ case 2: (Y)++; break; \
+ case 3: --(X); break; \
+ default: panic("mz_move: bad direction %d", dir); \
+ } \
+ } while (0)
+
STATIC_OVL boolean
iswall(x, y)
int x, y;
int x, y;
register int dir;
{
- move(&x, &y, dir);
- move(&x, &y, dir);
+ mz_move(x, y, dir);
+ mz_move(x, y, dir);
if (x < 3 || y < 3 || x > x_maze_max || y > y_maze_max
|| levl[x][y].typ != 0)
return FALSE;
pos--;
else {
dir = dirs[rn2(q)];
- move(&x, &y, dir);
+ mz_move(x, y, dir);
levl[x][y].typ = typ;
- move(&x, &y, dir);
+ mz_move(x, y, dir);
pos++;
if (pos > CELLS)
panic("Overflow in walkfrom");
}
}
}
-#else
+#else /* !MICRO */
void
walkfrom(x, y, typ)
if (!q)
return;
dir = dirs[rn2(q)];
- move(&x, &y, dir);
+ mz_move(x, y, dir);
levl[x][y].typ = typ;
- move(&x, &y, dir);
+ mz_move(x, y, dir);
walkfrom(x, y, typ);
}
}
-#endif /* MICRO */
-
-STATIC_OVL void
-move(x, y, dir)
-register int *x, *y;
-register int dir;
-{
- switch (dir) {
- case 0:
- --(*y);
- break;
- case 1:
- (*x)++;
- break;
- case 2:
- (*y)++;
- break;
- case 3:
- --(*x);
- break;
- default:
- panic("move: bad direction");
- }
-}
+#endif /* ?MICRO */
/* find random point in generated corridors,
so we don't create items in moats, bunkers, or walls */
-/* NetHack 3.6 topten.c $NHDT-Date: 1446887536 2015/11/07 09:12:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
+/* NetHack 3.6 topten.c $NHDT-Date: 1448013597 2015/11/20 09:59:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
switch (killer.format) {
default:
impossible("bad killer format? (%d)", killer.format);
- /*FALLTHRU*/
+ /*FALLTHRU*/
case NO_KILLER_PREFIX:
break;
case KILLED_BY_AN:
kname = an(kname);
- /*FALLTHRU*/
+ /*FALLTHRU*/
case KILLED_BY:
(void) strncat(buf, killed_by_prefix[how], siz - 1);
l = strlen(buf);
buf, /* (already includes separator) */
XLOG_SEP, plname, XLOG_SEP, tt->death);
if (multi)
- Fprintf(rfile, "%cwhile=%s", XLOG_SEP, multi_reason ? multi_reason : "helpless");
+ Fprintf(rfile, "%cwhile=%s", XLOG_SEP,
+ multi_reason ? multi_reason : "helpless");
Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", XLOG_SEP,
encodeconduct(), XLOG_SEP, moves, XLOG_SEP, encodeachieve());
Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", XLOG_SEP,
FILE *xlfile;
#endif /* XLOGFILE */
-/* Under DICE 3.0, this crashes the system consistently, apparently due to
- * corruption of *rfile somewhere. Until I figure this out, just cut out
- * topten support entirely - at least then the game exits cleanly. --AC
- */
#ifdef _DCC
+ /* Under DICE 3.0, this crashes the system consistently, apparently due to
+ * corruption of *rfile somewhere. Until I figure this out, just cut out
+ * topten support entirely - at least then the game exits cleanly. --AC
+ */
return;
#endif
/* create a new 'topten' entry */
t0_used = FALSE;
t0 = newttentry();
+ t0->ver_major = VERSION_MAJOR;
+ t0->ver_minor = VERSION_MINOR;
+ t0->patchlevel = PATCHLEVEL;
+ t0->points = u.urexp;
+ t0->deathdnum = u.uz.dnum;
/* deepest_lev_reached() is in terms of depth(), and reporting the
* deepest level reached in the dungeon death occurred in doesn't
* seem right, so we have to report the death level in depth() terms
* as well (which also seems reasonable since that's all the player
* sees on the screen anyway)
*/
- t0->ver_major = VERSION_MAJOR;
- t0->ver_minor = VERSION_MINOR;
- t0->patchlevel = PATCHLEVEL;
- t0->points = u.urexp;
- t0->deathdnum = u.uz.dnum;
t0->deathlev = observable_depth(&u.uz);
t0->maxlvl = deepest_lev_reached(TRUE);
t0->hp = u.uhp;
if (wizard || discover) {
if (how != PANICKED)
- HUP
- {
+ HUP {
char pbuf[BUFSZ];
topten_print("");
Sprintf(pbuf,
t1->ver_major = t1->ver_minor = t1->patchlevel = 0;
t1->uid = t1->deathdnum = t1->deathlev = 0;
t1->maxlvl = t1->hp = t1->maxhp = t1->deaths = 0;
+ t1->uid = 0;
t1->plrole[0] = t1->plrace[0] = t1->plgend[0] = t1->plalign[0] = '-';
t1->plrole[1] = t1->plrace[1] = t1->plgend[1] = t1->plalign[1] = 0;
t1->birthdate = t1->deathdate = yyyymmdd((time_t) 0L);
#ifdef AMIGA
{
extern winid amii_rawprwin;
+
init_nhwindows(&argc, argv);
amii_rawprwin = create_nhwindow(NHW_TEXT);
}
-/* NetHack 3.6 vision.c $NHDT-Date: 1446861773 2015/11/07 02:02:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
+/* NetHack 3.6 vision.c $NHDT-Date: 1448013598 2015/11/20 09:59:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
/*15*/ 119,
};
-/*===========================================================================*/
+/*==========================================================================*/
/* Vision (arbitrary line of sight)
* =========================================*/
STATIC_DCL void FDECL(fill_point, (int, int));
STATIC_DCL void FDECL(dig_point, (int, int));
STATIC_DCL void NDECL(view_init);
-STATIC_DCL void FDECL(view_from,
- (int, int, char **, char *, char *, int,
- void (*)(int, int, genericptr_t), genericptr_t));
+STATIC_DCL void FDECL(view_from, (int, int, char **, char *, char *, int,
+ void (*)(int, int, genericptr_t),
+ genericptr_t));
STATIC_DCL void FDECL(get_unused_cs, (char ***, char **, char **));
STATIC_DCL void FDECL(rogue_vision, (char **, char *, char *));
#ifdef VISION_TABLES
/* Note: this initializer doesn't do anything except guarantee that
- we're linked properly.
- */
+ * we're linked properly.
+ */
vis_tab_init();
#endif
}
}
}
- /*#define EXTEND_SPINE*/ /* possibly better looking wall-angle */
+/*#define EXTEND_SPINE*/ /* possibly better looking wall-angle */
#ifdef EXTEND_SPINE
/* You see nothing, nothing can see you --- if swallowed or refreshing. */
if (u.uswallow || control == 2) {
/* do nothing -- get_unused_cs() nulls out the new work area */
-
+ ;
} else if (Blind) {
/*
* Calculate the could_see array even when blind so that monsters
next_rmax[row] = max(next_rmax[row], col);
next_array[row][col] = IN_SIGHT | COULD_SEE;
}
- }
/* if in a pit, just update for immediate locations */
- else if (u.utrap && u.utraptype == TT_PIT) {
+ } else if (u.utrap && u.utraptype == TT_PIT) {
for (row = u.uy - 1; row <= u.uy + 1; row++) {
if (row < 0)
continue;
/* Update pos if previously not in sight or new angle. */
if (!(old_row[col] & IN_SIGHT) || oldseenv != lev->seenv)
newsym(col, row);
- }
- else if ((next_row[col] & COULD_SEE)
+ } else if ((next_row[col] & COULD_SEE)
&& (lev->lit || (next_row[col] & TEMP_LIT))) {
/*
* We see this position because it is lit.
*/
lev->waslit = 0; /* remember lit condition */
newsym(col, row);
- }
+
/*
* At this point we know that the row position is *not* in normal
* sight. That is, the position is could be seen, but is dark
* the glyph -- E.g. darken room spot, etc.
* o If we now could see the location (yet the location is not
* lit), but previously we couldn't see the location, or vice
- * versa. Update the spot because there there may be an infrared
- * monster there.
+ * versa. Update the spot because there there may be an
+ * infrared monster there.
*/
- else {
+ } else {
not_in_sight:
if ((old_row[col] & IN_SIGHT)
|| ((next_row[col] & COULD_SEE)
vision_full_recalc = 1;
}
-/*===========================================================================*\
- | |
- | Everything below this line uses (y,x) instead of (x,y) --- the |
- | algorithms are faster if they are less recursive and can scan |
- | on a row longer. |
- | |
-\*===========================================================================*/
+/*==========================================================================*\
+ | |
+ | Everything below this line uses (y,x) instead of (x,y) --- the |
+ | algorithms are faster if they are less recursive and can scan |
+ | on a row longer. |
+ | |
+\*==========================================================================*/
-/* ======================================================================== *\
+/* ======================================================================= *\
Left and Right Pointer Updates
-\* ======================================================================== */
+\* ======================================================================= */
/*
* LEFT and RIGHT pointer rules
for (i = left_ptrs[row][COLNO - 2]; i < COLNO - 1; i++)
right_ptrs[row][i] = COLNO - 2;
}
- }
/*
* At this point, we know we aren't on the boundaries.
*/
- else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) {
+ } else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) {
/* Both sides clear */
for (i = left_ptrs[row][col - 1]; i <= col; i++) {
if (!viz_clear[row][i])
for (i = left_ptrs[row][COLNO - 2]; i < COLNO - 1; i++)
right_ptrs[row][i] = COLNO - 1;
}
- }
/*
* Else we know that we are not on an edge.
*/
- else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) {
+ } else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) {
/* Both sides clear */
for (i = left_ptrs[row][col - 1] + 1; i <= col; i++)
right_ptrs[row][i] = col;
}
}
-/*===========================================================================*/
-/*===========================================================================*/
+/*==========================================================================*/
+/*==========================================================================*/
/* Use either algorithm C or D. See the config.h for more details.
* =========*/
result = 1; \
}
-#else /* quadrants are really functions */
+#else /* !MACRO_CPATH -- quadrants are really functions */
STATIC_DCL int FDECL(_q1_path, (int, int, int, int));
STATIC_DCL int FDECL(_q2_path, (int, int, int, int));
return 1;
}
-#endif /* quadrants are functions */
+#endif /* ?MACRO_CPATH */
/*
* Use vision tables to determine if there is a clear path from
}
#ifdef VISION_TABLES
-/*===========================================================================*\
+/*==========================================================================*\
GENERAL LINE OF SIGHT
Algorithm D
-\*===========================================================================*/
+\*==========================================================================*/
/*
* Indicate caller for the shadow routines.
static close2d *close_dy[CLOSE_MAX_BC_DY];
static far2d *far_dy[FAR_MAX_BC_DY];
-STATIC_DCL void FDECL(right_side,
- (int, int, int, int, int, int, int, char *));
+STATIC_DCL void FDECL(right_side, (int, int, int, int, int,
+ int, int, char *));
STATIC_DCL void FDECL(left_side, (int, int, int, int, int, int, int, char *));
STATIC_DCL int FDECL(close_shadow, (int, int, int, int));
STATIC_DCL int FDECL(far_shadow, (int, int, int, int));
hit_stone = 1;
left = loc_right + 1;
- }
+
/*
* The opening extends beyond the right mark. This means that
* the next far block is the current far block.
*/
- else {
+ } else {
if (vis_func) {
for (i = left; i <= right_shadow; i++)
(*vis_func)(i, row, varg);
hit_stone = 1; /* needed for walls of width 1 */
right = loc_left - 1;
- }
+
/* The opening extends beyond the left mark. */
- else {
+ } else {
if (vis_func) {
for (i = left_shadow; i <= right; i++)
(*vis_func)(i, row, varg);
#else /*===== End of algorithm D =====*/
-/*===========================================================================*\
+/*==========================================================================*\
GENERAL LINE OF SIGHT
Algorithm C
-\*===========================================================================*/
+\*==========================================================================*/
/*
* Defines local to Algorithm C.
if (left > lim_max)
return; /* check (1) */
if (left == lim_max) { /* check (2) */
- if (vis_func)
+ if (vis_func) {
(*vis_func)(lim_max, row, varg);
- else {
+ } else {
set_cs(rowp, lim_max);
set_max(lim_max);
}
if (right > lim_max)
right = lim_max;
/* set the bits */
- if (vis_func)
+ if (vis_func) {
for (i = left; i <= right; i++)
(*vis_func)(i, row, varg);
- else {
+ } else {
for (i = left; i <= right; i++)
set_cs(rowp, i);
set_min(left);
if (right < lim_min)
return;
if (right == lim_min) {
- if (vis_func)
+ if (vis_func) {
(*vis_func)(lim_min, row, varg);
- else {
+ } else {
set_cs(rowp, lim_min);
set_min(lim_min);
}
if (left < lim_min)
left = lim_min;
- if (vis_func)
+ if (vis_func) {
for (i = left; i <= right; i++)
(*vis_func)(i, row, varg);
- else {
+ } else {
for (i = left; i <= right; i++)
set_cs(rowp, i);
set_min(left);
genericptr_t arg;
{
/* If not centered on hero, do the hard work of figuring the area */
- if (scol != u.ux || srow != u.uy)
+ if (scol != u.ux || srow != u.uy) {
view_from(srow, scol, (char **) 0, (char *) 0, (char *) 0, range,
func, arg);
- else {
+ } else {
register int x;
int y, min_x, max_x, max_y, offset;
char *limits;
-/* NetHack 3.6 windows.c $NHDT-Date: 1433806591 2015/06/08 23:36:31 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
+/* NetHack 3.6 windows.c $NHDT-Date: 1448013599 2015/11/20 09:59:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */
/* Copyright (c) D. Cohrs, 1993. */
/* NetHack may be freely redistributed. See license for details. */
#include "wintty.h"
#endif
#ifdef X11_GRAPHICS
-/* cannot just blindly include winX.h without including all of X11 stuff */
-/* and must get the order of include files right. Don't bother */
+/* Cannot just blindly include winX.h without including all of X11 stuff
+ and must get the order of include files right. Don't bother. */
extern struct window_procs X11_procs;
extern void FDECL(win_X11_init, (int));
#endif
FAIL /* be_win_init doesn't exist? XXX*/
#endif
#ifdef AMIGA_INTUITION
- extern struct window_procs amii_procs;
+extern struct window_procs amii_procs;
extern struct window_procs amiv_procs;
extern void FDECL(ami_wininit_data, (int));
#endif
p->nextlink = wl;
return;
}
-#endif
+#endif /* WINCHAIN */
static struct win_choices *last_winchoice = 0;
return &winchoices[i];
}
}
-
- return NULL;
+ return (struct win_choices *) 0;
}
#endif
p = np; /* assignment, not proof */
}
}
-#endif
+#endif /* WINCHAIN */
/*
* tty_message_menu() provides a means to get feedback from the
const char *msg;
boolean is_restoring;
{
-/* window ports can provide
- their own putmsghistory() routine to
- load message history from a saved game.
- The routine is called repeatedly from
- the core restore routine, starting with
- the oldest saved message first, and
- finishing with the latest.
- The window port routine is expected to
- load the message recall buffers in such
- a way that the ordering is preserved.
- The window port routine should make no
- assumptions about how many messages are
- forthcoming, nor should it assume that
- another message will follow this one,
- so it should keep all pointers/indexes
- intact at the end of each call.
- */
+ /* window ports can provide
+ their own putmsghistory() routine to
+ load message history from a saved game.
+ The routine is called repeatedly from
+ the core restore routine, starting with
+ the oldest saved message first, and
+ finishing with the latest.
+ The window port routine is expected to
+ load the message recall buffers in such
+ a way that the ordering is preserved.
+ The window port routine should make no
+ assumptions about how many messages are
+ forthcoming, nor should it assume that
+ another message will follow this one,
+ so it should keep all pointers/indexes
+ intact at the end of each call.
+ */
+
/* this doesn't provide for reloading the message window with the
previous session's messages upon restore, but it does put the quest
message summary lines there by treating them as ordinary messages */
static void FDECL(hup_void_fdecl_constchar_p, (const char *));
static struct window_procs hup_procs = {
- "hup", 0L, 0L, hup_init_nhwindows, hup_void_ndecl, /* player_selection */
+ "hup", 0L, 0L, hup_init_nhwindows,
+ hup_void_ndecl, /* player_selection */
hup_void_ndecl, /* askname */
hup_void_ndecl, /* get_nh_event */
hup_exit_nhwindows, hup_void_fdecl_constchar_p, /* suspend_nhwindows */
hup_curs, hup_putstr, hup_putstr, /* putmixed */
hup_display_file, hup_void_fdecl_winid, /* start_menu */
hup_add_menu, hup_end_menu, hup_select_menu, genl_message_menu,
- hup_void_ndecl, /* update_inventory */
- hup_void_ndecl, /* mark_synch */
- hup_void_ndecl, /* wait_synch */
+ hup_void_ndecl, /* update_inventory */
+ hup_void_ndecl, /* mark_synch */
+ hup_void_ndecl, /* wait_synch */
#ifdef CLIPPING
hup_cliparound,
#endif
#ifdef POSITIONBAR
- (void FDECL(
- (*), (char *))) hup_void_fdecl_constchar_p, /* update_positionbar */
+ (void FDECL((*), (char *))) hup_void_fdecl_constchar_p,
+ /* update_positionbar */
#endif
hup_print_glyph,
- hup_void_fdecl_constchar_p, /* raw_print */
- hup_void_fdecl_constchar_p, /* raw_print_bold */
- hup_nhgetch, hup_nh_poskey, hup_void_ndecl, /* nhbell */
- hup_int_ndecl, /* doprev_message */
- hup_yn_function, hup_getlin, hup_int_ndecl, /* get_ext_cmd */
- hup_void_fdecl_int, /* number_pad */
- hup_void_ndecl, /* delay_output */
+ hup_void_fdecl_constchar_p, /* raw_print */
+ hup_void_fdecl_constchar_p, /* raw_print_bold */
+ hup_nhgetch, hup_nh_poskey, hup_void_ndecl, /* nhbell */
+ hup_int_ndecl, /* doprev_message */
+ hup_yn_function, hup_getlin, hup_int_ndecl, /* get_ext_cmd */
+ hup_void_fdecl_int, /* number_pad */
+ hup_void_ndecl, /* delay_output */
#ifdef CHANGE_COLOR
hup_change_color,
#ifdef MAC
- hup_void_fdecl_int, /* change_background */
+ hup_void_fdecl_int, /* change_background */
hup_set_font_name,
#endif
hup_get_color_string,
-#endif /* CHANGE_COLOR */
- hup_void_ndecl, /* start_screen */
- hup_void_ndecl, /* end_screen */
+#endif /* CHANGE_COLOR */
+ hup_void_ndecl, /* start_screen */
+ hup_void_ndecl, /* end_screen */
hup_outrip, genl_preference_update, genl_getmsghistory,
genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
- hup_void_ndecl, /* status_init */
- hup_void_ndecl, /* status_finish */
+ hup_void_ndecl, /* status_init */
+ hup_void_ndecl, /* status_finish */
genl_status_enablefield, hup_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#ifdef STATUS_VIA_WINDOWPORT
-/*****************************************************************************/
-/* genl backward compat stuff */
-/*****************************************************************************/
+/****************************************************************************/
+/* genl backward compat stuff */
+/****************************************************************************/
const char *status_fieldnm[MAXBLSTATS];
const char *status_fieldfmt[MAXBLSTATS];
enum statusfields fieldorder[2][15] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
- BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH},
+ BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
+ BL_FLUSH },
{ BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX,
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
- BL_CAP, BL_CONDITION, BL_FLUSH}
+ BL_CAP, BL_CONDITION, BL_FLUSH }
};
if (idx != BL_FLUSH) {
Strcat(status_vals[idx], " Slime");
break;
default:
- Sprintf(status_vals[idx], status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s", text);
+ Sprintf(status_vals[idx],
+ status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s", text);
break;
}
}