From d99eeb17c2c5acbcac1f519909348de116af27a1 Mon Sep 17 00:00:00 2001 From: Ingo Paschke Date: Tue, 12 May 2026 15:21:23 +0200 Subject: [PATCH] Amiga: header hygiene and palette-size constants Add AMII_PALETTE_SIZE / AMIV_PALETTE_SIZE in amiconf.h to make the actual populated portion of the init-map arrays explicit. Drop the redundant extern void exit() declaration. Annotate Abort with NORETURN in both amiconf.h and winproto.h; drop the duplicate Abort declaration further down winproto.h. Convert the bare-token "CLIPPING must be defined" assertion in windefs.h into a real #error directive. Comment in winext.h to disambiguate the three similarly named amii*_init*map palette arrays. --- include/amiconf.h | 7 +++++-- sys/amiga/windefs.h | 2 +- sys/amiga/winext.h | 11 +++++++++++ sys/amiga/winproto.h | 4 +--- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/amiconf.h b/include/amiconf.h index 47306f9d2..593f3e470 100644 --- a/include/amiconf.h +++ b/include/amiconf.h @@ -48,9 +48,8 @@ extern void nethack_exit(int); extern void amii_setpens(int); extern void getlind(const char *, char *, const char *); -extern void exit(int); extern void CleanUp(void); -extern void Abort(long); +extern void Abort(long) NORETURN; extern int getpid(void); extern int kbhit(void); extern int WindowGetchar(void); @@ -84,6 +83,10 @@ extern void ami_wininit_data(int); #define CHANGE_COLOR 1 #define DEPTH 6 /* Maximum depth of the screen allowed */ #define AMII_MAXCOLORS (1L << DEPTH) +/* Number of palette entries actually populated in amii_init_map[] (AMII text + * mode) and amiv_init_map[] (AMIV tile mode). Indices beyond these read 0. */ +#define AMII_PALETTE_SIZE 8 +#define AMIV_PALETTE_SIZE 32 typedef unsigned short AMII_COLOR_TYPE; #define PORT_HELP "amii.hlp" diff --git a/sys/amiga/windefs.h b/sys/amiga/windefs.h index 234d213a8..84faf98ff 100644 --- a/sys/amiga/windefs.h +++ b/sys/amiga/windefs.h @@ -29,7 +29,7 @@ #include "func_tab.h" #ifndef CLIPPING -CLIPPING must be defined for the AMIGA version +#error "CLIPPING must be defined for the AMIGA version" #endif #undef LI diff --git a/sys/amiga/winext.h b/sys/amiga/winext.h index 02d1436a6..0ceff1d6b 100644 --- a/sys/amiga/winext.h +++ b/sys/amiga/winext.h @@ -23,6 +23,17 @@ extern struct amii_DisplayDesc *amiIDisplay; /* the Amiga Intuition descriptor */ extern struct window_procs amii_procs; extern struct window_procs amiv_procs; +/* Three similarly-named palette arrays. Note the position of the + * second underscore distinguishes them: + * amii_initmap = working/runtime palette (mutated by tile/tomb load + * and the in-game color editor). + * amii_init_map = AMII (text-mode) compile-time defaults, 8 entries. + * amiv_init_map = AMIV (tile-mode) compile-time defaults, 32 entries + * (mutated by ReadImageFile when a tile/tomb IFF + * carries its own CMAP). + * The naming is historical; sysflags.amii_curmap is yet another related + * array holding the user's saved color choices. + */ extern unsigned short amii_initmap[AMII_MAXCOLORS]; extern unsigned short amiv_init_map[AMII_MAXCOLORS]; extern unsigned short amii_init_map[AMII_MAXCOLORS]; diff --git a/sys/amiga/winproto.h b/sys/amiga/winproto.h index 831db69a3..60bb1adf9 100644 --- a/sys/amiga/winproto.h +++ b/sys/amiga/winproto.h @@ -59,7 +59,7 @@ int amikbhit(void); int WindowGetchar(void); WETYPE WindowGetevent(void); void amii_cleanup(void); -void Abort(long rc); +void Abort(long rc) NORETURN; void CleanUp(void); void flush_glyph_buffer(struct Window *w); void amiga_print_glyph(winid window, int color_index, int glyph); @@ -120,8 +120,6 @@ void amii_display_file(const char *fn, boolean complain); void SetBorder(struct Gadget *gd); /* malloc/free provided by stdlib.h */ -void Abort(long rc); - win_request_info *amii_ctrl_nhwindow(winid, int, win_request_info *); /* amirip.c */