From: PatR Date: Sun, 3 May 2020 17:52:54 +0000 (-0700) Subject: eliminate hack.h usage from win/share/*.c X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c6deed5e9e37391af58bc626c3dbf5f842ba7d8;p=nethack eliminate hack.h usage from win/share/*.c Switch win/share/*.c from hack.h to config.h plus miscellaenous other headers. It's possible that there is conditional code that didn't get exercised in my testing. The Unix Makefiles don't deal with safeproc.c or tileset.c so I just compiled those without any attempt to link. --- diff --git a/include/display.h b/include/display.h index aa6af465f..d92b112f9 100644 --- a/include/display.h +++ b/include/display.h @@ -13,6 +13,18 @@ #include "mondata.h" /* for mindless() */ #endif +/* types of explosions */ +enum explosion_types { + EXPL_DARK = 0, + EXPL_NOXIOUS = 1, + EXPL_MUDDY = 2, + EXPL_WET = 3, + EXPL_MAGICAL = 4, + EXPL_FIERY = 5, + EXPL_FROSTY = 6, + EXPL_MAX = 7 +}; + /* * vobj_at() * @@ -260,7 +272,7 @@ * explosions A set of nine for each of the following seven explosion types: * dark, noxious, muddy, wet, magical, fiery, frosty. * The nine positions represent those surrounding the hero. - * Count: MAXEXPCHARS * EXPL_MAX (EXPL_MAX is defined in hack.h) + * Count: MAXEXPCHARS * EXPL_MAX * * zap beam A set of four (there are four directions) for each beam type. * The beam type is shifted over 2 positions and the direction diff --git a/include/hack.h b/include/hack.h index cb97a0ac2..d075498ba 100644 --- a/include/hack.h +++ b/include/hack.h @@ -416,18 +416,6 @@ typedef struct sortloot_item Loot; #define LAUNCH_UNSEEN 0x40 /* hero neither caused nor saw it */ #define LAUNCH_KNOWN 0x80 /* the hero caused this by explicit action */ -/* Macros for explosion types */ -enum explosion_types { - EXPL_DARK = 0, - EXPL_NOXIOUS = 1, - EXPL_MUDDY = 2, - EXPL_WET = 3, - EXPL_MAGICAL = 4, - EXPL_FIERY = 5, - EXPL_FROSTY = 6, - EXPL_MAX = 7 -}; - /* enlightenment control flags */ #define BASICENLIGHTENMENT 1 /* show mundane stuff */ #define MAGICENLIGHTENMENT 2 /* show intrinsics and such */ diff --git a/include/tileset.h b/include/tileset.h index 9f6e86b5b..997766434 100644 --- a/include/tileset.h +++ b/include/tileset.h @@ -18,7 +18,7 @@ struct TileImage { boolean FDECL(read_tiles, (const char *filename, BOOLEAN_P true_color)); const struct Pixel *NDECL(get_palette); -boolean FDECL(set_tile_type, (BOOLEAN_P true_color)); +void FDECL(set_tile_type, (BOOLEAN_P true_color)); void NDECL(free_tiles); const struct TileImage *FDECL(get_tile, (unsigned tile_index)); @@ -42,8 +42,11 @@ struct TileSetImage { unsigned tile_width, tile_height; }; -boolean FDECL(read_bmp_tiles, (const char *filename, struct TileSetImage *image)); -boolean FDECL(read_gif_tiles, (const char *filename, struct TileSetImage *image)); -boolean FDECL(read_png_tiles, (const char *filename, struct TileSetImage *image)); +boolean FDECL(read_bmp_tiles, (const char *filename, + struct TileSetImage *image)); +boolean FDECL(read_gif_tiles, (const char *filename, + struct TileSetImage *image)); +boolean FDECL(read_png_tiles, (const char *filename, + struct TileSetImage *image)); #endif diff --git a/include/winprocs.h b/include/winprocs.h index d252630dd..6506c9af0 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -78,7 +78,8 @@ struct window_procs { void NDECL((*win_status_finish)); void FDECL((*win_status_enablefield), (int, const char *, const char *, BOOLEAN_P)); - void FDECL((*win_status_update), (int, genericptr_t, int, int, int, unsigned long *)); + void FDECL((*win_status_update), (int, genericptr_t, int, int, int, + unsigned long *)); boolean NDECL((*win_can_suspend)); }; @@ -218,15 +219,15 @@ extern #define WC2_RESET_STATUS 0x0100L /* 09 call status_update(BL_RESET) to * indicate 'draw everything' */ #define WC2_TERM_SIZE 0x0200L /* 10 support setting terminal size */ -#define WC2_STATUSLINES 0x0400L /* 16 switch between 2 or 3 lines of status */ -#define WC2_WINDOWBORDERS 0x0800L /* 11 display borders on nh windows */ -#define WC2_PETATTR 0x1000L /* 12 attributes for hilite_pet */ -#define WC2_GUICOLOR 0x2000L /* 13 display colours outside map win */ +#define WC2_STATUSLINES 0x0400L /* 11 switch between 2|3 lines of status */ +#define WC2_WINDOWBORDERS 0x0800L /* 12 display borders on nh windows */ +#define WC2_PETATTR 0x1000L /* 13 attributes for hilite_pet */ +#define WC2_GUICOLOR 0x2000L /* 14 display colours outside map win */ /* pline() can overload the display attributes argument passed to putstr() with one or more flags and at most one of bold/blink/inverse/&c */ -#define WC2_URGENT_MESG 0x4000L /* 14 putstr(WIN_MESSAGE) supports urgency +#define WC2_URGENT_MESG 0x4000L /* 15 putstr(WIN_MESSAGE) supports urgency * via non-display attribute flag */ -#define WC2_SUPPRESS_HIST 0x8000L /* 15 putstr(WIN_MESSAGE) supports history +#define WC2_SUPPRESS_HIST 0x8000L /* 16 putstr(WIN_MESSAGE) supports history * suppression via non-disp attr */ /* 16 free bits */ @@ -378,7 +379,8 @@ struct chain_procs { void FDECL((*win_status_finish), (CARGS)); void FDECL((*win_status_enablefield), (CARGS, int, const char *, const char *, BOOLEAN_P)); - void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int, int, unsigned long *)); + void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int, int, + unsigned long *)); boolean FDECL((*win_can_suspend), (CARGS)); }; #endif /* WINCHAIN */ @@ -446,9 +448,10 @@ extern char *FDECL(safe_getmsghistory, (BOOLEAN_P)); extern void FDECL(safe_putmsghistory, (const char *, BOOLEAN_P)); extern void NDECL(safe_status_init); extern void NDECL(safe_status_finish); -extern void FDECL(safe_status_enablefield, - (int, const char *, const char *, BOOLEAN_P)); -extern void FDECL(safe_status_update, (int, genericptr_t, int, int, int, unsigned long *)); +extern void FDECL(safe_status_enablefield, (int, const char *, const char *, + BOOLEAN_P)); +extern void FDECL(safe_status_update, (int, genericptr_t, int, int, int, + unsigned long *)); extern boolean NDECL(safe_can_suspend); extern void FDECL(stdio_raw_print, (const char *)); extern void FDECL(stdio_nonl_raw_print, (const char *)); @@ -457,4 +460,3 @@ extern void NDECL(stdio_wait_synch); extern int NDECL(stdio_nhgetch); #endif /* SAFEPROCS */ #endif /* WINPROCS_H */ - diff --git a/win/share/safeproc.c b/win/share/safeproc.c index c4e6e7016..98f8ccca2 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -2,8 +2,11 @@ /* Copyright (c) Michael Allison, 2018 */ /* NetHack may be freely redistributed. See license for details. */ -#include "hack.h" -#include +#define SAFEPROCS +#include "config.h" +#include "color.h" +#include "wintype.h" +#include "winprocs.h" /* * *********************************************************** @@ -71,7 +74,7 @@ struct window_procs safe_procs = { safe_init_nhwindows, safe_player_selection, safe_askname, safe_get_nh_event, safe_exit_nhwindows, safe_suspend_nhwindows, safe_resume_nhwindows, safe_create_nhwindow, safe_clear_nhwindow, safe_display_nhwindow, - safe_destroy_nhwindow, safe_curs, safe_putstr, genl_putmixed, + safe_destroy_nhwindow, safe_curs, safe_putstr, safe_putmixed, safe_display_file, safe_start_menu, safe_add_menu, safe_end_menu, safe_select_menu, safe_message_menu, safe_update_inventory, safe_mark_synch, safe_wait_synch, @@ -91,7 +94,7 @@ struct window_procs safe_procs = { #endif safe_get_color_string, #endif - safe_start_screen, safe_end_screen, genl_outrip, + safe_start_screen, safe_end_screen, safe_outrip, safe_preference_update, safe_getmsghistory, safe_putmsghistory, safe_status_init, @@ -217,6 +220,15 @@ const char *str; return; } +void +safe_putmixed(window, attr, str) +winid window; +int attr; +const char *str; +{ + return; +} + void safe_display_file(fname, complain) const char *fname; diff --git a/win/share/tile2bmp.c b/win/share/tile2bmp.c index 636cf1396..bc7d61ca5 100644 --- a/win/share/tile2bmp.c +++ b/win/share/tile2bmp.c @@ -16,8 +16,10 @@ #include "win32api.h" #endif -#include "hack.h" +#include "config.h" #include "tile.h" +extern void NDECL(monst_globals_init); +extern void NDECL(objects_globals_init); #include #if defined(UINT32_MAX) && defined(INT32_MAX) && defined(UINT16_MAX) @@ -160,7 +162,7 @@ static void FDECL(build_bmfh, (BITMAPFILEHEADER *)); static void FDECL(build_bmih, (BITMAPINFOHEADER *)); static void FDECL(build_bmptile, (pixel(*) [TILE_X])); -char *tilefiles[] = { +const char *tilefiles[] = { #if (TILE_X == 32) "../win/share/mon32.txt", "../win/share/obj32.txt", "../win/share/oth32.txt", diff --git a/win/share/tilemap.c b/win/share/tilemap.c index 594aa89a8..3819b1bf8 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -8,7 +8,14 @@ * then again with it defined to produce tiletxt.{o,obj}. */ -#include "hack.h" +#include "config.h" +#include "pm.h" +#include "onames.h" +#include "permonst.h" +#include "objclass.h" +#include "rm.h" +#include "display.h" +extern int FDECL(def_char_to_objclass, (CHAR_P)); #define Fprintf (void) fprintf diff --git a/win/share/tileset.c b/win/share/tileset.c index e9b448ab0..2dd8ebefe 100644 --- a/win/share/tileset.c +++ b/win/share/tileset.c @@ -2,7 +2,9 @@ /* Copyright (c) Ray Chason, 2016. */ /* NetHack may be freely redistributed. See license for details. */ -#include "hack.h" +#include "config.h" +#include "objclass.h" +#include "flag.h" #include "tileset.h" static void FDECL(get_tile_map, (const char *)); @@ -102,7 +104,7 @@ error: } /* Free tile memory not required by the chosen display mode */ -boolean +void set_tile_type(true_color) boolean true_color; {