win32: Allow 32x32 tile builder to be built.
This commit is contained in:
+51
-9
@@ -156,8 +156,11 @@ TILERES = $(O)console.res
|
|||||||
TILEINCL =
|
TILEINCL =
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
TILEUTIL = $(UTIL)\tile2bmp.exe
|
TILEUTIL16 = $(UTIL)\tile2bmp.exe
|
||||||
TILEBMP = $(SRC)\tiles.bmp
|
TILEBMP16 = $(SRC)\tiles.bmp
|
||||||
|
|
||||||
|
TILEUTIL32 = $(UTIL)\til2bm32.exe
|
||||||
|
TILEBMP32 = $(SRC)\tiles32.bmp
|
||||||
|
|
||||||
#SOUND = $(OBJ)\ntsound.o
|
#SOUND = $(OBJ)\ntsound.o
|
||||||
|
|
||||||
@@ -327,7 +330,11 @@ TILEFILES = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt
|
|||||||
TEXT_IO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o \
|
TEXT_IO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o \
|
||||||
$(O)decl.o $(O)monst.o $(O)objects.o
|
$(O)decl.o $(O)monst.o $(O)objects.o
|
||||||
|
|
||||||
|
TEXT_IO32 = $(O)tilete32.o $(O)tiletx32.o $(O)drawing.o \
|
||||||
|
$(O)decl.o $(O)monst.o $(O)objects.o
|
||||||
|
|
||||||
GIFREADERS = $(O)gifread.o $(O)alloc.o $(O)panic.o
|
GIFREADERS = $(O)gifread.o $(O)alloc.o $(O)panic.o
|
||||||
|
GIFREADERS32 = $(O)gifrd32.o $(O)alloc.o $(O)panic.o
|
||||||
|
|
||||||
PPMWRITERS = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o
|
PPMWRITERS = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o
|
||||||
|
|
||||||
@@ -516,11 +523,11 @@ $(O)utility.tag: $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \
|
|||||||
@echo utilities made >$@
|
@echo utilities made >$@
|
||||||
@echo utilities made.
|
@echo utilities made.
|
||||||
|
|
||||||
tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe
|
tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe
|
||||||
@echo Optional tile development utilities are up to date.
|
@echo Optional tile development utilities are up to date.
|
||||||
|
|
||||||
!IF "$(GRAPHICAL)"=="Y"
|
!IF "$(GRAPHICAL)"=="Y"
|
||||||
$(TILERES): $(TILEBMP) $(WIN32)\winhack.rc
|
$(TILERES): $(TILEBMP16) $(WIN32)\winhack.rc
|
||||||
@$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc
|
@$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc
|
||||||
!ELSE
|
!ELSE
|
||||||
$(TILERES): $(NTSYS)\console.rc
|
$(TILERES): $(NTSYS)\console.rc
|
||||||
@@ -832,18 +839,27 @@ $(U)tilemap.exe: $(O)tilemap.o
|
|||||||
$(O)tilemap.o: $(WSHR)\tilemap.c $(HACK_H)
|
$(O)tilemap.o: $(WSHR)\tilemap.c $(HACK_H)
|
||||||
@$(CC) $(CFLAGSU) -Fo$@ $(WSHR)\tilemap.c
|
@$(CC) $(CFLAGSU) -Fo$@ $(WSHR)\tilemap.c
|
||||||
|
|
||||||
|
$(O)tiletx32.o: $(WSHR)\tilemap.c $(HACK_H)
|
||||||
|
@$(CC) $(CFLAGS) /DTILETEXT /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tilemap.c
|
||||||
|
|
||||||
$(O)tiletxt.o: $(WSHR)\tilemap.c $(HACK_H)
|
$(O)tiletxt.o: $(WSHR)\tilemap.c $(HACK_H)
|
||||||
@$(CC) $(CFLAGS) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c
|
@$(CC) $(CFLAGS) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c
|
||||||
|
|
||||||
$(O)gifread.o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H)
|
$(O)gifread.o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H)
|
||||||
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\gifread.c
|
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\gifread.c
|
||||||
|
|
||||||
|
$(O)gifrd32.o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H)
|
||||||
|
@$(CC) $(CFLAGS) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\gifread.c
|
||||||
|
|
||||||
$(O)ppmwrite.o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H)
|
$(O)ppmwrite.o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H)
|
||||||
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\ppmwrite.c
|
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\ppmwrite.c
|
||||||
|
|
||||||
$(O)tiletext.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H)
|
$(O)tiletext.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H)
|
||||||
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\tiletext.c
|
@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\tiletext.c
|
||||||
|
|
||||||
|
$(O)tilete32.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H)
|
||||||
|
@$(CC) $(CFLAGS) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tiletext.c
|
||||||
|
|
||||||
#==========================================
|
#==========================================
|
||||||
# Optional Tile Utilities
|
# Optional Tile Utilities
|
||||||
#==========================================
|
#==========================================
|
||||||
@@ -857,6 +873,15 @@ $(U)gif2txt.exe: $(GIFREADERS) $(TEXT_IO)
|
|||||||
)
|
)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(U)gif2tx32.exe: $(GIFREADERS32) $(TEXT_IO32)
|
||||||
|
@echo Linking $@...
|
||||||
|
@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
|
||||||
|
$(GIFREADERS32:^ =^
|
||||||
|
)
|
||||||
|
$(TEXT_IO32:^ =^
|
||||||
|
)
|
||||||
|
<<
|
||||||
|
|
||||||
$(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
|
$(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
|
||||||
@echo Linking $@...
|
@echo Linking $@...
|
||||||
@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
|
@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
|
||||||
@@ -867,11 +892,16 @@ $(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
|
|||||||
<<
|
<<
|
||||||
|
|
||||||
!IF "$(GRAPHICAL)"=="Y"
|
!IF "$(GRAPHICAL)"=="Y"
|
||||||
$(TILEBMP): $(TILEUTIL) $(TILEFILES)
|
$(TILEBMP16): $(TILEUTIL16) $(TILEFILES)
|
||||||
@echo Creating binary tile files (this may take some time)
|
@echo Creating 16x16 binary tile files (this may take some time)
|
||||||
@$(U)tile2bmp $(TILEBMP)
|
@$(U)tile2bmp $(TILEBMP16)
|
||||||
|
#$(TILEBMP32): $(TILEUTIL32) $(TILEFILES32)
|
||||||
|
# @echo Creating 32x32 binary tile files (this may take some time)
|
||||||
|
# @$(U)til2bm32 $(TILEBMP32)
|
||||||
|
|
||||||
!ELSE
|
!ELSE
|
||||||
$(TILEBMP):
|
$(TILEBMP16):
|
||||||
|
$(TILEBMP32):
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
|
$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
|
||||||
@@ -882,9 +912,20 @@ $(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
|
|||||||
)
|
)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32)
|
||||||
|
@echo Linking $@...
|
||||||
|
@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
|
||||||
|
$(O)til2bm32.o
|
||||||
|
$(TEXT_IO32:^ =^
|
||||||
|
)
|
||||||
|
<<
|
||||||
|
|
||||||
$(O)tile2bmp.o: $(WIN32)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
|
$(O)tile2bmp.o: $(WIN32)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
|
||||||
@$(CC) $(CFLAGS) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WIN32)\tile2bmp.c
|
@$(CC) $(CFLAGS) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WIN32)\tile2bmp.c
|
||||||
|
|
||||||
|
$(O)til2bm32.o: $(WIN32)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
|
||||||
|
@$(CC) $(CFLAGS) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WIN32)\tile2bmp.c
|
||||||
|
|
||||||
#==========================================
|
#==========================================
|
||||||
# Housekeeping
|
# Housekeeping
|
||||||
#==========================================
|
#==========================================
|
||||||
@@ -950,7 +991,8 @@ clean:
|
|||||||
if exist $(SRC)\*.lnk del $(SRC)\*.lnk
|
if exist $(SRC)\*.lnk del $(SRC)\*.lnk
|
||||||
if exist $(SRC)\*.map del $(SRC)\*.map
|
if exist $(SRC)\*.map del $(SRC)\*.map
|
||||||
! IF ("$(TILEDEF)"!="")
|
! IF ("$(TILEDEF)"!="")
|
||||||
if exist $(TILEBMP) del $(TILEBMP)
|
if exist $(TILEBMP16) del $(TILEBMP16)
|
||||||
|
if exist $(TILEBMP32) del $(TILEBMP32)
|
||||||
! ENDIF
|
! ENDIF
|
||||||
|
|
||||||
#===================================================================
|
#===================================================================
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ extern int colorsinmainmap;
|
|||||||
#ifndef TILE_X
|
#ifndef TILE_X
|
||||||
#define TILE_X 16
|
#define TILE_X 16
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef TILE_Y
|
||||||
#define TILE_Y 16
|
#define TILE_Y 16
|
||||||
|
#endif
|
||||||
|
|
||||||
#define Fprintf (void) fprintf
|
#define Fprintf (void) fprintf
|
||||||
|
|
||||||
|
|||||||
+65
-17
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)tile2bmp.c 3.4 1999/08/29 */
|
/* SCCS Id: @(#)tile2bmp.c 3.4 2002/02/24 */
|
||||||
/* Copyright (c) NetHack PC Development Team 1995 */
|
/* Copyright (c) NetHack PC Development Team 1995 */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -18,7 +18,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #define COLORS_IN_USE MAXCOLORMAPSIZE /* 256 colors */
|
/* #define COLORS_IN_USE MAXCOLORMAPSIZE /* 256 colors */
|
||||||
|
#if (TILE_X==32)
|
||||||
|
#define COLORS_IN_USE 256
|
||||||
|
#else
|
||||||
#define COLORS_IN_USE 16 /* 16 colors */
|
#define COLORS_IN_USE 16 /* 16 colors */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BITCOUNT 8
|
#define BITCOUNT 8
|
||||||
|
|
||||||
@@ -26,10 +30,16 @@ extern char *FDECL(tilename, (int, int));
|
|||||||
|
|
||||||
#if BITCOUNT==4
|
#if BITCOUNT==4
|
||||||
#define MAX_X 320 /* 2 per byte, 4 bits per pixel */
|
#define MAX_X 320 /* 2 per byte, 4 bits per pixel */
|
||||||
#else
|
|
||||||
#define MAX_X 640 /* 1 per byte, 8 bits per pixel */
|
|
||||||
#endif
|
|
||||||
#define MAX_Y 480
|
#define MAX_Y 480
|
||||||
|
#else
|
||||||
|
# if (TILE_X==32)
|
||||||
|
#define MAX_X (32 * 40)
|
||||||
|
#define MAX_Y 960
|
||||||
|
# else
|
||||||
|
#define MAX_X 640 /* 1 per byte, 8 bits per pixel */
|
||||||
|
#define MAX_Y 480
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* GCC fix by Paolo Bonzini 1999/03/28 */
|
/* GCC fix by Paolo Bonzini 1999/03/28 */
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
@@ -85,13 +95,18 @@ struct tagBMP{
|
|||||||
#define RGBQUAD_COUNT 16
|
#define RGBQUAD_COUNT 16
|
||||||
RGBQUAD bmaColors[RGBQUAD_COUNT];
|
RGBQUAD bmaColors[RGBQUAD_COUNT];
|
||||||
#else
|
#else
|
||||||
|
#if (TILE_X==32)
|
||||||
|
#define RGBQUAD_COUNT 256
|
||||||
|
#else
|
||||||
#define RGBQUAD_COUNT 16
|
#define RGBQUAD_COUNT 16
|
||||||
|
#endif
|
||||||
RGBQUAD bmaColors[RGBQUAD_COUNT];
|
RGBQUAD bmaColors[RGBQUAD_COUNT];
|
||||||
#endif
|
#endif
|
||||||
#if COLORS_IN_USE==16
|
#if (COLORS_IN_USE==16)
|
||||||
uchar packtile[MAX_Y][MAX_X];
|
uchar packtile[MAX_Y][MAX_X];
|
||||||
#else
|
#else
|
||||||
uchar packtile[TILE_Y][TILE_X];
|
uchar packtile[MAX_Y][MAX_X];
|
||||||
|
/* uchar packtile[TILE_Y][TILE_X]; */
|
||||||
#endif
|
#endif
|
||||||
} PACK bmp;
|
} PACK bmp;
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
@@ -106,9 +121,17 @@ static void FDECL(build_bmfh,(BITMAPFILEHEADER *));
|
|||||||
static void FDECL(build_bmih,(BITMAPINFOHEADER *));
|
static void FDECL(build_bmih,(BITMAPINFOHEADER *));
|
||||||
static void FDECL(build_bmptile,(pixel (*)[TILE_X]));
|
static void FDECL(build_bmptile,(pixel (*)[TILE_X]));
|
||||||
|
|
||||||
char *tilefiles[] = { "../win/share/monsters.txt",
|
char *tilefiles[] = {
|
||||||
"../win/share/objects.txt",
|
#if (TILE_X == 32)
|
||||||
"../win/share/other.txt"};
|
"../win/share/mon32.txt",
|
||||||
|
"../win/share/obj32.txt",
|
||||||
|
"../win/share/oth32.txt"
|
||||||
|
#else
|
||||||
|
"../win/share/monsters.txt",
|
||||||
|
"../win/share/objects.txt",
|
||||||
|
"../win/share/other.txt"
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
int num_colors = 0;
|
int num_colors = 0;
|
||||||
int tilecount;
|
int tilecount;
|
||||||
@@ -125,10 +148,10 @@ main(argc, argv)
|
|||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
Fprintf(stderr, "usage: tile2bmp outfile.bmp\n");
|
Fprintf(stderr, "usage: %s outfile.bmp\n", argv[0]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
} else
|
} else
|
||||||
strcpy(bmpname, argv[1]);
|
strcpy(bmpname, argv[1]);
|
||||||
@@ -151,7 +174,7 @@ char *argv[];
|
|||||||
printf("Error creating tile file %s, aborting.\n",bmpname);
|
printf("Error creating tile file %s, aborting.\n",bmpname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
while (filenum < 3) {
|
while (filenum < (sizeof(tilefiles) / sizeof(char *))) {
|
||||||
if (!fopen_text_file(tilefiles[filenum], RDTMODE)) {
|
if (!fopen_text_file(tilefiles[filenum], RDTMODE)) {
|
||||||
Fprintf(stderr,
|
Fprintf(stderr,
|
||||||
"usage: tile2bmp (from the util directory)\n");
|
"usage: tile2bmp (from the util directory)\n");
|
||||||
@@ -165,8 +188,9 @@ char *argv[];
|
|||||||
if (!initflag) {
|
if (!initflag) {
|
||||||
build_bmfh(&bmp.bmfh);
|
build_bmfh(&bmp.bmfh);
|
||||||
build_bmih(&bmp.bmih);
|
build_bmih(&bmp.bmih);
|
||||||
memset(&bmp.packtile,0,
|
for (i = 0; i < MAX_Y; ++i)
|
||||||
(MAX_X * MAX_Y * sizeof(uchar)));
|
for (j = 0; j < MAX_X; ++j)
|
||||||
|
bmp.packtile[i][j] = (uchar)0;
|
||||||
for (i = 0; i < num_colors; i++) {
|
for (i = 0; i < num_colors; i++) {
|
||||||
bmp.bmaColors[i].rgbRed = ColorMap[CM_RED][i];
|
bmp.bmaColors[i].rgbRed = ColorMap[CM_RED][i];
|
||||||
bmp.bmaColors[i].rgbGreen = ColorMap[CM_GREEN][i];
|
bmp.bmaColors[i].rgbGreen = ColorMap[CM_GREEN][i];
|
||||||
@@ -219,6 +243,7 @@ static void
|
|||||||
build_bmih(pbmih)
|
build_bmih(pbmih)
|
||||||
BITMAPINFOHEADER *pbmih;
|
BITMAPINFOHEADER *pbmih;
|
||||||
{
|
{
|
||||||
|
WORD cClrBits;
|
||||||
pbmih->biSize = (DWORD) sizeof(bmp.bmih);
|
pbmih->biSize = (DWORD) sizeof(bmp.bmih);
|
||||||
#if BITCOUNT==4
|
#if BITCOUNT==4
|
||||||
pbmih->biWidth = (LONG) MAX_X * 2;
|
pbmih->biWidth = (LONG) MAX_X * 2;
|
||||||
@@ -232,12 +257,35 @@ BITMAPINFOHEADER *pbmih;
|
|||||||
#else
|
#else
|
||||||
pbmih->biBitCount = (WORD) 8;
|
pbmih->biBitCount = (WORD) 8;
|
||||||
#endif
|
#endif
|
||||||
|
cClrBits = (WORD)(pbmih->biPlanes * pbmih->biBitCount);
|
||||||
|
if (cClrBits == 1)
|
||||||
|
cClrBits = 1;
|
||||||
|
else if (cClrBits <= 4)
|
||||||
|
cClrBits = 4;
|
||||||
|
else if (cClrBits <= 8)
|
||||||
|
cClrBits = 8;
|
||||||
|
else if (cClrBits <= 16)
|
||||||
|
cClrBits = 16;
|
||||||
|
else if (cClrBits <= 24)
|
||||||
|
cClrBits = 24;
|
||||||
|
else cClrBits = 32;
|
||||||
pbmih->biCompression = (DWORD) BI_RGB;
|
pbmih->biCompression = (DWORD) BI_RGB;
|
||||||
pbmih->biSizeImage = (DWORD)0;
|
|
||||||
pbmih->biXPelsPerMeter = (LONG)0;
|
pbmih->biXPelsPerMeter = (LONG)0;
|
||||||
pbmih->biYPelsPerMeter = (LONG)0;
|
pbmih->biYPelsPerMeter = (LONG)0;
|
||||||
pbmih->biClrUsed = (DWORD)RGBQUAD_COUNT;
|
#if (TILE_X==32)
|
||||||
pbmih->biClrImportant = (DWORD)0;
|
if (cClrBits < 24)
|
||||||
|
pbmih->biClrUsed = (1<<cClrBits);
|
||||||
|
#else
|
||||||
|
pbmih->biClrUsed = (DWORD)RGBQUAD_COUNT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (TILE_X==16)
|
||||||
|
pbmih->biSizeImage = 0;
|
||||||
|
#else
|
||||||
|
pbmih->biSizeImage = ((pbmih->biWidth * cClrBits +31) & ~31) /8
|
||||||
|
* pbmih->biHeight;
|
||||||
|
#endif
|
||||||
|
pbmih->biClrImportant = (DWORD)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user