Revive Amiga port for NetHack 3.7

Update the Amiga Intuition window port (AMII/AMIV) for the 3.7
window_procs API. Key changes:

- Update all window function signatures for 3.7
- Add assembly trampolines for AmigaOS register-based callbacks
- Convert all K&R function definitions to C99
- Add cross-compilation build system (cross-pre1/pre2/post.370)
  using bebbo's m68k-amigaos-gcc with -noixemul -std=gnu17 -m68000
- Clipping fixes: viewport centering, simplified ScrollRaster,
  duplicate Ctrl-R suppression, glyph buffer invalidation
- Add menucolor support in menu rendering
- Move native txt2iff.c and xpm2iff.c to outdated/
- Add nethack.cnf and README.amiga
This commit is contained in:
Ingo Paschke
2026-03-23 20:48:06 +01:00
parent 7b89255ea8
commit 2d597cb9fa
27 changed files with 1101 additions and 908 deletions
+13 -20
View File
@@ -43,15 +43,15 @@ static struct RastPort *rp;
#include <proto/diskfont.h>
#endif
static char *load_list[] = { "tomb.iff", 0 };
static BitMapHeader tomb_bmhd;
static struct BitMap *tbmp[1] = { 0 };
static struct BitMap *tombimg = NULL;
static int cols[2] = { 154, 319 }; /* X location of center of columns */
static const int cols_base[2] = { 154, 319 }; /* X location of center of columns */
static int cols[2]; /* cols_base[] + xoff, computed per call */
static int cno = 0; /* current column */
#define TEXT_TOP (65 + yoff)
static xoff, yoff; /* image centering */
static int xoff, yoff; /* image centering */
/* terrible kludge */
/* this is why prototypes should have ONLY types in them! */
@@ -100,19 +100,16 @@ int wh; /* was local in outrip, but needed for SCALE macro */
int cmap_white, cmap_black;
void
amii_outrip(tmpwin, how, when)
winid tmpwin;
int how;
time_t when;
amii_outrip(winid tmpwin, int how, time_t when)
{
int just_return = 0;
int done, rtxth;
struct IntuiMessage *imsg;
int i;
register char *dpx;
char *dpx;
char buf[200];
int line, tw, ww;
char *errstr = NULL;
long year;
if (!WINVERS_AMIV || HackScreen->RastPort.BitMap->Depth < 4)
@@ -141,9 +138,7 @@ time_t when;
SetFont(rp, HackFont);
#endif
tomb_bmhd = ReadImageFiles(load_list, tbmp, &errstr);
if (errstr)
goto cleanup;
tomb_bmhd = ReadImageFile("tomb.iff", &tombimg);
if (tomb_bmhd.w > ww || tomb_bmhd.h > wh)
goto cleanup;
@@ -151,12 +146,12 @@ time_t when;
xoff = GENOFF(ww, tomb_bmhd.w);
yoff = GENOFF(wh, tomb_bmhd.h);
for (i = 0; i < SIZE(cols); i++)
cols[i] += xoff;
cols[i] = cols_base[i] + xoff;
cmap_white = search_cmap(0, 0, 0);
cmap_black = search_cmap(15, 15, 15);
BltBitMap(*tbmp, 0, 0, rp->BitMap, xoff, yoff, tomb_bmhd.w, tomb_bmhd.h,
BltBitMap(tombimg, 0, 0, rp->BitMap, xoff, yoff, tomb_bmhd.w, tomb_bmhd.h,
0xc0, 0xff, NULL);
/* Put together death description */
@@ -199,7 +194,7 @@ time_t when;
/* Put death type on stone */
for (line = DEATH_LINE, dpx = buf; line < YEAR_LINE; line++) {
register int i, i0;
int i, i0;
char tmpchar;
if ((i0 = strlen(dpx)) > STONE_LINE_LEN) {
@@ -280,8 +275,7 @@ cleanup:
}
LoadRGB4(&HackScreen->ViewPort, sysflags.amii_curmap, amii_numcolors);
if (tbmp[0])
FreeImageFiles(load_list, tbmp);
FreeImageFile(&tombimg);
if (just_return)
return;
/* fall back to the straight-ASCII version */
@@ -289,8 +283,7 @@ cleanup:
}
static void
tomb_text(p)
char *p;
tomb_text(char *p)
{
char buf[STONE_LINE_LEN * 2];
int l;