]> granicus.if.org Git - nethack/commitdiff
eliminate hack.h usage from win/share/*.c
authorPatR <rankin@nethack.org>
Sun, 3 May 2020 17:52:54 +0000 (10:52 -0700)
committerPatR <rankin@nethack.org>
Sun, 3 May 2020 17:52:54 +0000 (10:52 -0700)
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.

include/display.h
include/hack.h
include/tileset.h
include/winprocs.h
win/share/safeproc.c
win/share/tile2bmp.c
win/share/tilemap.c
win/share/tileset.c

index aa6af465f8029cc8f5122bb1790831c51efb9300..d92b112f9a9f640cbadcafbaa30a09d3c42ddd1f 100644 (file)
 #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()
  *
  * 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
index cb97a0ac248db7252f151f42d3f9ae6d98555399..d075498ba6cc01b7f572a370276d050abbb37704 100644 (file)
@@ -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 */
index 9f6e86b5b4c9625614456bc0fa6e6b1974208f68..997766434a91776ea98b5f5dca4b8ad6fd0de545 100644 (file)
@@ -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
index d252630dda2a0e2f59376f355d619c0b40ad5162..6506c9af04c11ac20dfa100eaa66565289a4842e 100644 (file)
@@ -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 */
-
index c4e6e7016e15910dc3d4e6c860a816fa8193c2d3..98f8ccca28b95e8f0c4578263b6fa4e78e94da22 100644 (file)
@@ -2,8 +2,11 @@
 /* Copyright (c) Michael Allison, 2018                            */
 /* NetHack may be freely redistributed.  See license for details. */
 
-#include "hack.h"
-#include <stdio.h>
+#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;
index 636cf13967ccf06d9d829aa8fdee091d957b1717..bc7d61ca5008789ee7ca61b7de51cce3a37232af 100644 (file)
 #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 <stdint.h>
 #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",
index 594aa89a873b4ff93f3ad18a95e2baef54356121..3819b1bf8a26540cc07f1d66ddde16314d5ee190 100644 (file)
@@ -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
 
index e9b448ab0b65902f42a9c2f5a6874ce5ce79f40e..2dd8ebefe7107b3edb9b995c0636bf1f9b82ca93 100644 (file)
@@ -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;
 {