mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Build tools:
- Fix up and add building instructions for kmd2tool, getdxdidf, and makesdlkeytrans. - Add kmd2tool to "utils" build job. - Fix warning in and cross-platform building of generateicon. - Source and text cleanup! git-svn-id: https://svn.eduke32.com/eduke32@2521 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
64595adfb2
commit
fd71c5ef4c
15 changed files with 272 additions and 184 deletions
|
@ -154,7 +154,25 @@ endif
|
|||
|
||||
ifeq ($(RENDERTYPE),SDL)
|
||||
ENGINEOBJS+= $(OBJ)/sdlayer.$o
|
||||
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS))
|
||||
|
||||
ifeq ($(PLATFORM),DARWIN)
|
||||
ifeq (1,$(SDL_FRAMEWORK))
|
||||
OURCFLAGS += -I$(APPLE_FRAMEWORKS)/SDL.framework/Headers \
|
||||
-I$(APPLE_FRAMEWORKS)/SDL_mixer.framework/Headers
|
||||
UTILLIBS += -read_only_relocs suppress \
|
||||
-Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a
|
||||
else
|
||||
OURCFLAGS += -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL
|
||||
UTILLIBS += -read_only_relocs suppress -lSDL_mixer
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (0,$(SDL_FRAMEWORK))
|
||||
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags))
|
||||
UTILLIBS+= -lSDL_mixer
|
||||
else
|
||||
OURCFLAGS += -DSDL_FRAMEWORK
|
||||
endif
|
||||
|
||||
ifeq (1,$(HAVE_GTK2))
|
||||
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
|
||||
|
@ -177,11 +195,13 @@ OURCFLAGS+= $(BUILDCFLAGS)
|
|||
|
||||
# TARGETS
|
||||
|
||||
UTILOBJS=$(OBJ)/kextract.$o $(OBJ)/kgroup.$o $(OBJ)/transpal.$o $(OBJ)/wad2art.$o $(OBJ)/wad2map.$o $(OBJ)/md2tool.$o \
|
||||
UTILOBJS=$(OBJ)/kextract.$o $(OBJ)/kgroup.$o $(OBJ)/transpal.$o $(OBJ)/wad2art.$o $(OBJ)/wad2map.$o $(OBJ)/kmd2tool.$o \
|
||||
$(OBJ)/md2tool.$o \
|
||||
$(OBJ)/generateicon.$o $(OBJ)/cacheinfo.$o $(OBJ)/enumdisplay.$o $(OBJ)/arttool.$o $(OBJ)/givedepth.$o $(OBJ)/mkpalette.$o \
|
||||
$(OBJ)/unpackssi.$o $(OBJ)/bsuite.$o \
|
||||
$(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(OBJ)/pragmas.$o $(OBJ)/kplib.$o $(OBJ)/cache1d.$o
|
||||
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) md2tool$(EXESUFFIX) \
|
||||
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) kmd2tool$(EXESUFFIX) \
|
||||
md2tool$(EXESUFFIX) \
|
||||
generateicon$(EXESUFFIX) cacheinfo$(EXESUFFIX) arttool$(EXESUFFIX) givedepth$(EXESUFFIX) mkpalette$(EXESUFFIX) \
|
||||
unpackssi$(EXESUFFIX) bsuite$(EXESUFFIX)
|
||||
|
||||
|
@ -227,6 +247,9 @@ wad2art$(EXESUFFIX): $(OBJ)/wad2art.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)
|
|||
wad2map$(EXESUFFIX): $(OBJ)/wad2map.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
|
||||
$(ONESTEP_STATUS)
|
||||
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
|
||||
kmd2tool$(EXESUFFIX): $(OBJ)/kmd2tool.$o $(UTILADDOBJS)
|
||||
$(ONESTEP_STATUS)
|
||||
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
|
||||
md2tool$(EXESUFFIX): $(OBJ)/md2tool.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.$o $(UTILADDOBJS)
|
||||
$(ONESTEP_STATUS)
|
||||
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
|
||||
|
@ -240,6 +263,12 @@ cacheinfo$(EXESUFFIX): $(OBJ)/cacheinfo.$o $(OBJ)/compat.$o $(OBJ)/compat_tools.
|
|||
enumdisplay$(EXESUFFIX): $(OBJ)/enumdisplay.$o $(UTILADDOBJS)
|
||||
$(ONESTEP_STATUS)
|
||||
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS) -I$(DXROOT)/include -lgdi32; then $(ONESTEP_OK); fi
|
||||
getdxdidf$(EXESUFFIX): $(OBJ)/getdxdidf.$o $(UTILADDOBJS)
|
||||
$(ONESTEP_STATUS)
|
||||
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS) -I$(DXROOT)/include -ldinput; then $(ONESTEP_OK); fi
|
||||
makesdlkeytrans$(EXESUFFIX): $(OBJ)/makesdlkeytrans.$o $(UTILADDOBJS)
|
||||
$(ONESTEP_STATUS)
|
||||
if $(CC) -o $@ $^ $(OURLDFLAGS) $(UTILLIBS); then $(ONESTEP_OK); fi
|
||||
arttool$(EXESUFFIX): $(OBJ)/arttool.$o $(UTILADDOBJS)
|
||||
$(ONESTEP_STATUS)
|
||||
if $(CXX) -o $@ $^ $(OURLDFLAGS) $(STATICSTDCPP) $(UTILLIBS); then $(ONESTEP_OK); fi
|
||||
|
@ -326,7 +355,9 @@ clean:
|
|||
echo -n "" > $(OBJ)/keep.me
|
||||
|
||||
cleanutils:
|
||||
-rm -f $(UTILS) $(UTILOBJS) $(UTILADDOBJS)
|
||||
-rm -f $(UTILS) $(UTILOBJS) $(UTILADDOBJS) \
|
||||
enumdisplay$(EXESUFFIX) getdxdidf$(EXESUFFIX) makesdlkeytrans$(EXESUFFIX) \
|
||||
$(OBJ)/compat.$o $(OBJ)/getdxdidf.$o $(OBJ)/makesdlkeytrans.$o
|
||||
|
||||
printutils:
|
||||
echo "$(UTILS)"
|
||||
|
|
|
@ -44,10 +44,13 @@ $(OBJ)/kgroup.$o: $(SRC)/util/kgroup.c $(INC)/compat.h
|
|||
$(OBJ)/transpal.$o: $(SRC)/util/transpal.c $(INC)/compat.h $(INC)/pragmas.h
|
||||
$(OBJ)/wad2art.$o: $(SRC)/util/wad2art.c $(INC)/compat.h $(INC)/pragmas.h
|
||||
$(OBJ)/wad2map.$o: $(SRC)/util/wad2map.c $(INC)/compat.h $(INC)/pragmas.h
|
||||
$(OBJ)/kmd2tool.$o: $(SRC)/util/kmd2tool.c $(INC)/compat.h
|
||||
$(OBJ)/md2tool.$o: $(SRC)/util/md2tool.c $(INC)/compat.h $(INC)/build.h $(INC)/glbuild.h $(INC)/mdsprite.h
|
||||
$(OBJ)/generateicon.$o: $(SRC)/util/generateicon.c $(INC)/kplib.h $(INC)/compat.h
|
||||
$(OBJ)/cacheinfo.$o: $(SRC)/util/cacheinfo.c $(INC)/compat.h
|
||||
$(OBJ)/enumdisplay.$o: $(SRC)/misc/enumdisplay.c
|
||||
$(OBJ)/enumdisplay.$o: $(SRC)/misc/enumdisplay.c $(INC)/compat.h
|
||||
$(OBJ)/getdxdidf.$o: $(SRC)/misc/getdxdidf.c $(INC)/compat.h
|
||||
$(OBJ)/makesdlkeytrans.$o: $(SRC)/misc/makesdlkeytrans.c
|
||||
$(OBJ)/arttool.$o: $(SRC)/util/arttool.cc
|
||||
$(OBJ)/givedepth.$o: $(SRC)/util/givedepth.c
|
||||
$(OBJ)/mkpalette.$o: $(SRC)/util/mkpalette.c
|
||||
|
|
|
@ -117,7 +117,7 @@ CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /W2
|
|||
$(CC) /c $(CFLAGS) /Fo$@ $<
|
||||
|
||||
# TARGETS
|
||||
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) md2tool$(EXESUFFIX) generateicon$(EXESUFFIX) cacheinfo$(EXESUFFIX) arttool$(EXESUFFIX) givedepth$(EXESUFFIX) mkpalette$(EXESUFFIX) unpackssi$(EXESUFFIX) bsuite$(EXESUFFIX)
|
||||
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) kmd2tool$(EXESUFFIX) md2tool$(EXESUFFIX) generateicon$(EXESUFFIX) cacheinfo$(EXESUFFIX) arttool$(EXESUFFIX) givedepth$(EXESUFFIX) mkpalette$(EXESUFFIX) unpackssi$(EXESUFFIX) bsuite$(EXESUFFIX)
|
||||
|
||||
all: $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB);
|
||||
utils: $(UTILS) ;
|
||||
|
@ -151,6 +151,10 @@ wad2art$(EXESUFFIX): $(OBJ)\wad2art.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o $(OBJ)
|
|||
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
||||
$(MT) -manifest $@.manifest -outputresource:$@
|
||||
|
||||
kmd2tool$(EXESUFFIX): $(OBJ)\kmd2tool.$o $(OBJ)\nedmalloc.$o
|
||||
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
||||
$(MT) -manifest $@.manifest -outputresource:$@
|
||||
|
||||
md2tool$(EXESUFFIX): $(OBJ)\md2tool.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o $(OBJ)\nedmalloc.$o
|
||||
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS)
|
||||
$(MT) -manifest $@.manifest -outputresource:$@
|
||||
|
@ -188,7 +192,7 @@ bsuite$(EXESUFFIX): $(OBJ)\bsuite.$o $(OBJ)\nedmalloc.$o
|
|||
|
||||
# PHONIES
|
||||
clean:
|
||||
-del /Q $(ENGINEOBJS) $(EDITOROBJS) $(OBJ)\kextract.$o $(OBJ)\kgroup.$o $(OBJ)\transpal.$o $(OBJ)\wad2art.$o $(OBJ)\wad2map.$o $(OBJ)\md2tool.$o $(OBJ)\generateicon.$o $(OBJ)\cacheinfo.$o $(OBJ)\arttool.$o $(OBJ)\givedepth.$o $(OBJ)\mkpalette.$o $(OBJ)\unpackssi.$o $(OBJ)\bsuite.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o $(OBJ)\pragmas.$o $(OBJ)\kplib.$o $(OBJ)\cache1d.$o $(OBJ)\nedmalloc.$o
|
||||
-del /Q $(ENGINEOBJS) $(EDITOROBJS) $(OBJ)\kextract.$o $(OBJ)\kgroup.$o $(OBJ)\transpal.$o $(OBJ)\wad2art.$o $(OBJ)\wad2map.$o $(OBJ)\kmd2tool.$o $(OBJ)\md2tool.$o $(OBJ)\generateicon.$o $(OBJ)\cacheinfo.$o $(OBJ)\arttool.$o $(OBJ)\givedepth.$o $(OBJ)\mkpalette.$o $(OBJ)\unpackssi.$o $(OBJ)\bsuite.$o $(OBJ)\compat.$o $(OBJ)\compat_tools.$o $(OBJ)\pragmas.$o $(OBJ)\kplib.$o $(OBJ)\cache1d.$o $(OBJ)\nedmalloc.$o
|
||||
veryclean: clean
|
||||
-del /Q $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB) $(UTILS) *.map *.manifest *.pdb
|
||||
|
||||
|
|
|
@ -484,6 +484,8 @@ static inline uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7ff
|
|||
# define Bfprintf fprintf
|
||||
# define Bfscanf fscanf
|
||||
# define Bfseek fseek
|
||||
# define Bftell ftell
|
||||
# define Bputs puts
|
||||
# define Bstrcpy strcpy
|
||||
# define Bstrncpy strncpy
|
||||
# define Bstrcmp strcmp
|
||||
|
@ -518,6 +520,7 @@ static inline uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7ff
|
|||
// return LONG_MAX (== 0x7fffffff on 32-bit archs))
|
||||
# define Batoi(str) ((int32_t)strtol(str, NULL, 10))
|
||||
# define Batol(str) (strtol(str, NULL, 10))
|
||||
# define Batof(str) (strtod(str, NULL))
|
||||
# define Bstrtol strtol
|
||||
# define Bstrtoul strtoul
|
||||
# define Bstrtod strtod
|
||||
|
@ -529,7 +532,9 @@ static inline uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7ff
|
|||
# define Bmemchr memchr
|
||||
# define Bmemset memset
|
||||
# define Bmemcmp memcmp
|
||||
# define Bscanf scanf
|
||||
# define Bprintf printf
|
||||
# define Bsscanf sscanf
|
||||
# define Bsprintf sprintf
|
||||
# ifdef _MSC_VER
|
||||
# define Bsnprintf _snprintf
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <windows.h>
|
||||
#include <dinput.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
char *WhatGUID(const GUID *guid)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ char *WhatGUID(const GUID *guid)
|
|||
|
||||
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
int WINAPI WinMain(HINSTANCE hInstance ATTRIBUTE((unused)), HINSTANCE hPrevInstance ATTRIBUTE((unused)), LPSTR lpCmdLine ATTRIBUTE((unused)), int nCmdShow ATTRIBUTE((unused)))
|
||||
{
|
||||
FILE *fp;
|
||||
DWORD i;
|
||||
|
@ -48,7 +48,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
|
||||
for (i=0; i<c_dfDIKeyboard.dwNumObjs; i++) {
|
||||
fprintf(fp,
|
||||
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
||||
"\t{ %s, %lu, 0x%08lu, 0x%08lu },\n",
|
||||
WhatGUID(c_dfDIKeyboard.rgodf[i].pguid),
|
||||
c_dfDIKeyboard.rgodf[i].dwOfs,
|
||||
c_dfDIKeyboard.rgodf[i].dwType,
|
||||
|
@ -58,7 +58,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
fprintf(fp,
|
||||
"};\n"
|
||||
"\n"
|
||||
"const DIDATAFORMAT c_dfDIKeyboard = { %d, %d, 0x%08X, %d, %d, c_dfDIKeyboard_odf };\n\n",
|
||||
"const DIDATAFORMAT c_dfDIKeyboard = { %lu, %lu, 0x%08lu, %lu, %lu, c_dfDIKeyboard_odf };\n\n",
|
||||
c_dfDIKeyboard.dwSize,
|
||||
c_dfDIKeyboard.dwObjSize,
|
||||
c_dfDIKeyboard.dwFlags,
|
||||
|
@ -76,7 +76,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
|
||||
for (i=0; i<c_dfDIMouse.dwNumObjs; i++) {
|
||||
fprintf(fp,
|
||||
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
||||
"\t{ %s, %lu, 0x%08lu, 0x%08lu },\n",
|
||||
WhatGUID(c_dfDIMouse.rgodf[i].pguid),
|
||||
c_dfDIMouse.rgodf[i].dwOfs,
|
||||
c_dfDIMouse.rgodf[i].dwType,
|
||||
|
@ -86,7 +86,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
fprintf(fp,
|
||||
"};\n"
|
||||
"\n"
|
||||
"const DIDATAFORMAT c_dfDIMouse = { %d, %d, 0x%08X, %d, %d, c_dfDIMouse_odf };\n\n",
|
||||
"const DIDATAFORMAT c_dfDIMouse = { %lu, %lu, 0x%08lu, %lu, %lu, c_dfDIMouse_odf };\n\n",
|
||||
c_dfDIMouse.dwSize,
|
||||
c_dfDIMouse.dwObjSize,
|
||||
c_dfDIMouse.dwFlags,
|
||||
|
@ -104,7 +104,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
|
||||
for (i=0; i<c_dfDIJoystick.dwNumObjs; i++) {
|
||||
fprintf(fp,
|
||||
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
||||
"\t{ %s, %lu, 0x%08lu, 0x%08lu },\n",
|
||||
WhatGUID(c_dfDIJoystick.rgodf[i].pguid),
|
||||
c_dfDIJoystick.rgodf[i].dwOfs,
|
||||
c_dfDIJoystick.rgodf[i].dwType,
|
||||
|
@ -114,7 +114,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
fprintf(fp,
|
||||
"};\n"
|
||||
"\n"
|
||||
"const DIDATAFORMAT c_dfDIJoystick = { %d, %d, 0x%08X, %d, %d, c_dfDIJoystick_odf };\n\n",
|
||||
"const DIDATAFORMAT c_dfDIJoystick = { %lu, %lu, 0x%08lu, %lu, %lu, c_dfDIJoystick_odf };\n\n",
|
||||
c_dfDIJoystick.dwSize,
|
||||
c_dfDIJoystick.dwObjSize,
|
||||
c_dfDIJoystick.dwFlags,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] {-patch,-con,-conpatch}]'
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<search_path_base_dir>] {-patch,-con,-conpatch}]'
|
||||
exit 1
|
||||
fi
|
||||
deffn="$1"
|
||||
|
@ -16,7 +16,7 @@ dopatch=""
|
|||
docon=""
|
||||
if [ -n "$3" ]; then
|
||||
if [ "$3" != "-patch" -a "$3" != "-con" -a "$3" != "-conpatch" ]; then
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] {-patch,-con,-conpatch}]'
|
||||
echo 'Usage: checkdefs.sh <some.def> [[<search_path_base_dir>] {-patch,-con,-conpatch}]'
|
||||
exit 1
|
||||
fi
|
||||
if [ "$3" == "-patch" ]; then
|
||||
|
|
|
@ -14,3 +14,5 @@ void initprintf(const char *f, ...)
|
|||
Bvsnprintf(buf, sizeof(buf), f, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
int32_t editstatus = 1;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include "compat.h"
|
||||
|
||||
struct icon {
|
||||
int width,height;
|
||||
unsigned int *pixels;
|
||||
int32_t width,height;
|
||||
intptr_t *pixels;
|
||||
unsigned char *mask;
|
||||
};
|
||||
|
||||
|
@ -12,31 +12,31 @@ int writeicon(FILE *fp, struct icon *ico)
|
|||
{
|
||||
int i;
|
||||
|
||||
fprintf(fp,
|
||||
Bfprintf(fp,
|
||||
"#include \"sdlayer.h\"\n"
|
||||
"\n"
|
||||
);
|
||||
fprintf(fp,"static unsigned int sdlappicon_pixels[] = {\n");
|
||||
Bfprintf(fp,"static unsigned int sdlappicon_pixels[] = {\n");
|
||||
for (i=0;i<ico->width*ico->height;i++) {
|
||||
if ((i%6) == 0) fprintf(fp,"\t");
|
||||
else fprintf(fp," ");
|
||||
fprintf(fp, "0x%08x,", B_LITTLE32(ico->pixels[i]));
|
||||
if ((i%6) == 5) fprintf(fp,"\n");
|
||||
if ((i%6) == 0) Bfprintf(fp,"\t");
|
||||
else Bfprintf(fp," ");
|
||||
Bfprintf(fp, "0x%08x,", B_LITTLE32(ico->pixels[i]));
|
||||
if ((i%6) == 5) Bfprintf(fp,"\n");
|
||||
}
|
||||
if ((i%16) > 0) fprintf(fp, "\n");
|
||||
fprintf(fp, "};\n\n");
|
||||
if ((i%16) > 0) Bfprintf(fp, "\n");
|
||||
Bfprintf(fp, "};\n\n");
|
||||
|
||||
fprintf(fp,"static unsigned char sdlappicon_mask[] = {\n");
|
||||
Bfprintf(fp,"static unsigned char sdlappicon_mask[] = {\n");
|
||||
for (i=0;i<((ico->width+7)/8)*ico->height;i++) {
|
||||
if ((i%14) == 0) fprintf(fp,"\t");
|
||||
else fprintf(fp," ");
|
||||
fprintf(fp, "%3d,", ico->mask[i]);
|
||||
if ((i%14) == 13) fprintf(fp,"\n");
|
||||
if ((i%14) == 0) Bfprintf(fp,"\t");
|
||||
else Bfprintf(fp," ");
|
||||
Bfprintf(fp, "%3d,", ico->mask[i]);
|
||||
if ((i%14) == 13) Bfprintf(fp,"\n");
|
||||
}
|
||||
if ((i%16) > 0) fprintf(fp, "\n");
|
||||
fprintf(fp, "};\n\n");
|
||||
if ((i%16) > 0) Bfprintf(fp, "\n");
|
||||
Bfprintf(fp, "};\n\n");
|
||||
|
||||
fprintf(fp,
|
||||
Bfprintf(fp,
|
||||
"struct sdlappicon sdlappicon = {\n"
|
||||
" %d,%d, // width,height\n"
|
||||
" sdlappicon_pixels,\n"
|
||||
|
@ -51,33 +51,33 @@ int writeicon(FILE *fp, struct icon *ico)
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
struct icon icon;
|
||||
int bpl;
|
||||
int32_t bpl;
|
||||
int i;
|
||||
unsigned char *maskp, bm, *pp;
|
||||
|
||||
if (argc<2) {
|
||||
fprintf(stderr, "generateicon <picture file>\n");
|
||||
Bfprintf(stderr, "generateicon <picture file>\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(&icon, 0, sizeof(icon));
|
||||
|
||||
kpzload(argv[1], (int*)&icon.pixels, &bpl, (int*)&icon.width, (int*)&icon.height);
|
||||
kpzload(argv[1], icon.pixels, (int32_t*)&bpl, (int32_t*)&icon.width, (int32_t*)&icon.height);
|
||||
if (!icon.pixels) {
|
||||
fprintf(stderr, "Failure loading %s\n", argv[1]);
|
||||
Bfprintf(stderr, "Failure loading %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (bpl != icon.width * 4) {
|
||||
fprintf(stderr, "bpl != icon.width * 4\n");
|
||||
free(icon.pixels);
|
||||
Bfprintf(stderr, "bpl != icon.width * 4\n");
|
||||
Bfree(icon.pixels);
|
||||
return 1;
|
||||
}
|
||||
|
||||
icon.mask = (unsigned char *)calloc(icon.height, (icon.width+7)/8);
|
||||
icon.mask = (unsigned char *)Bcalloc(icon.height, (icon.width+7)/8);
|
||||
if (!icon.mask) {
|
||||
fprintf(stderr, "Out of memory\n");
|
||||
free(icon.pixels);
|
||||
Bfprintf(stderr, "Out of memory\n");
|
||||
Bfree(icon.pixels);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,8 @@ int main(int argc, char **argv)
|
|||
|
||||
writeicon(stdout, &icon);
|
||||
|
||||
free(icon.pixels);
|
||||
free(icon.mask);
|
||||
Bfree(icon.pixels);
|
||||
Bfree(icon.mask);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -41,19 +41,19 @@ int main(int argc, char **argv)
|
|||
|
||||
if (argc < 2)
|
||||
{
|
||||
printf("KEXTRACT <groupfile.grp> [@file or filespec...] by Kenneth Silverman\n");
|
||||
printf(" This program extracts files from a previously grouped group file.\n");
|
||||
printf(" You can extract files using the ? and * wildcards.\n");
|
||||
printf(" Ex: kextract stuff.dat tiles000.art nukeland.map palette.dat\n");
|
||||
printf(" (stuff.dat is the group file, the rest are the files to extract)\n");
|
||||
printf(" kextract stuff.grp\n");
|
||||
printf(" (simply lists the contents of stuff.grp)\n");
|
||||
Bprintf("KEXTRACT <groupfile.grp> [@file or filespec...] by Kenneth Silverman\n");
|
||||
Bprintf(" This program extracts files from a previously grouped group file.\n");
|
||||
Bprintf(" You can extract files using the ? and * wildcards.\n");
|
||||
Bprintf(" Ex: kextract stuff.dat tiles000.art nukeland.map palette.dat\n");
|
||||
Bprintf(" (stuff.dat is the group file, the rest are the files to extract)\n");
|
||||
Bprintf(" kextract stuff.grp\n");
|
||||
Bprintf(" (simply lists the contents of stuff.grp)\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ((fil = Bopen(argv[1],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("Error: %s could not be opened\n",argv[1]);
|
||||
Bprintf("Error: %s could not be opened\n",argv[1]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ int main(int argc, char **argv)
|
|||
(buf[9] != 'm') || (buf[10] != 'a') || (buf[11] != 'n'))
|
||||
{
|
||||
Bclose(fil);
|
||||
printf("Error: %s not a valid group file\n",argv[1]);
|
||||
Bprintf("Error: %s not a valid group file\n",argv[1]);
|
||||
return(0);
|
||||
}
|
||||
numfiles = *((int*)&buf[12]); numfiles = B_LITTLE32(numfiles);
|
||||
|
@ -84,7 +84,7 @@ int main(int argc, char **argv)
|
|||
if (onlylist)
|
||||
{
|
||||
for (i=0; i<numfiles; i++)
|
||||
printf("%s\t\t%d\n", filelist[i], fileoffs[i+1]-fileoffs[i]);
|
||||
Bprintf("%s\t\t%d\n", filelist[i], fileoffs[i+1]-fileoffs[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ int main(int argc, char **argv)
|
|||
if (anyfiles4extraction == 0)
|
||||
{
|
||||
Bclose(fil);
|
||||
printf("No files found in group file with those names\n");
|
||||
Bprintf("No files found in group file with those names\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -134,10 +134,10 @@ int main(int argc, char **argv)
|
|||
|
||||
if ((fil2 = Bopen(filelist[i],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{
|
||||
printf("Error: Could not write to %s\n",filelist[i]);
|
||||
Bprintf("Error: Could not write to %s\n",filelist[i]);
|
||||
continue;
|
||||
}
|
||||
printf("Extracting %s...\n",filelist[i]);
|
||||
Bprintf("Extracting %s...\n",filelist[i]);
|
||||
Blseek(fil,fileoffs[i]+((numfiles+1)<<4),SEEK_SET);
|
||||
for(j=0;j<fileleng[i];j+=65536)
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ int main(int argc, char **argv)
|
|||
Bread(fil,buf,k);
|
||||
if (Bwrite(fil2,buf,k) < k)
|
||||
{
|
||||
printf("Write error (drive full?)\n");
|
||||
Bprintf("Write error (drive full?)\n");
|
||||
Bclose(fil2);
|
||||
Bclose(fil);
|
||||
return(0);
|
||||
|
|
|
@ -81,7 +81,7 @@ void findfiles(const char *dafilespec)
|
|||
numfiles++;
|
||||
if (numfiles > MAXFILES)
|
||||
{
|
||||
printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
|
||||
Bprintf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -95,11 +95,11 @@ int main(int argc, char **argv)
|
|||
|
||||
if (argc < 3)
|
||||
{
|
||||
printf("KGROUP [grouped file][@file or filespec...] by Kenneth Silverman\n");
|
||||
printf(" This program collects many files into 1 big uncompressed file called a\n");
|
||||
printf(" group file\n");
|
||||
printf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n");
|
||||
printf(" (stuff.dat is the group file, the rest are the files to add)\n");
|
||||
Bprintf("KGROUP <grouped file><@file or filespec...> by Kenneth Silverman\n");
|
||||
Bprintf(" This program collects many files into 1 big uncompressed file called a\n");
|
||||
Bprintf(" group file\n");
|
||||
Bprintf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n");
|
||||
Bprintf(" (stuff.dat is the group file, the rest are the files to add)\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ int main(int argc, char **argv)
|
|||
|
||||
if ((fil = Bopen(argv[1],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{
|
||||
printf("Error: %s could not be opened\n",argv[1]);
|
||||
Bprintf("Error: %s could not be opened\n",argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
Bwrite(fil,"KenSilverman",12);
|
||||
|
@ -142,10 +142,10 @@ int main(int argc, char **argv)
|
|||
|
||||
for(i=0;i<numfiles;i++)
|
||||
{
|
||||
printf("Adding %s...\n",filespec[i]);
|
||||
Bprintf("Adding %s...\n",filespec[i]);
|
||||
if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("Error: %s not found\n",filespec[i]);
|
||||
Bprintf("Error: %s not found\n",filespec[i]);
|
||||
Bclose(fil);
|
||||
return(0);
|
||||
}
|
||||
|
@ -157,14 +157,14 @@ int main(int argc, char **argv)
|
|||
{
|
||||
Bclose(fil2);
|
||||
Bclose(fil);
|
||||
printf("OUT OF HD SPACE!\n");
|
||||
Bprintf("OUT OF HD SPACE!\n");
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
Bclose(fil2);
|
||||
}
|
||||
Bclose(fil);
|
||||
printf("Saved to %s.\n",argv[1]);
|
||||
Bprintf("Saved to %s.\n",argv[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,48 +7,91 @@ kmd2tool.exe: kmd2tool.c; cl kmd2tool.c /Ox /G6fy /MD /link /opt:nowin98
|
|||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <math.h>
|
||||
#include "compat.h"
|
||||
|
||||
typedef struct { float x, y, z; } point3d;
|
||||
|
||||
typedef struct
|
||||
{ int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
|
||||
{ int id, vers, skinxsiz, skinysiz, framebytes; // id:"IPD2", vers:8
|
||||
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
|
||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; // ofsskins: skin names (64 bytes each)
|
||||
} md2typ;
|
||||
|
||||
typedef struct { point3d mul, add; } frametyp;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
int main (const int argc, const char **argv)
|
||||
{
|
||||
FILE *fil;
|
||||
BFILE *fil;
|
||||
int i, leng;
|
||||
char *fbuf;
|
||||
float zoffset = 0.0f;
|
||||
md2typ *head;
|
||||
frametyp *fptr;
|
||||
|
||||
if (argc != 4) { puts("KMD2TOOL [MD2 in file] [MD2 out file] [z offset] by Ken Silverman"); return(0); }
|
||||
if (!stricmp(argv[1],argv[2])) { puts("input&output filenames can't be same"); return(0); }
|
||||
|
||||
fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); }
|
||||
leng = filelength(_fileno(fil));
|
||||
fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); }
|
||||
fread(fbuf,leng,1,fil);
|
||||
fclose(fil);
|
||||
|
||||
head = (md2typ *)fbuf;
|
||||
if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2"
|
||||
for(i=0;i<head->numframes;i++)
|
||||
if (argc != 4)
|
||||
{
|
||||
fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i];
|
||||
printf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z);
|
||||
fptr->add.z += atof(argv[3]);
|
||||
Bputs("KMD2TOOL <MD2 in file> <MD2 out file> <z offset> by Ken Silverman");
|
||||
return(1);
|
||||
}
|
||||
if (!Bstrcasecmp(argv[1],argv[2]))
|
||||
{
|
||||
Bputs("Error: input and output filenames cannot be the same");
|
||||
return(2);
|
||||
}
|
||||
|
||||
fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); }
|
||||
fwrite(fbuf,leng,1,fil);
|
||||
fclose(fil);
|
||||
zoffset = Batof(argv[3]);
|
||||
if (0.0f == zoffset)
|
||||
{
|
||||
Bputs("Error: offset of zero");
|
||||
return(3);
|
||||
}
|
||||
|
||||
free(fbuf);
|
||||
fil = Bfopen(argv[1],"rb");
|
||||
if (!fil)
|
||||
{
|
||||
Bputs("Error: could not open input MD2");
|
||||
return(4);
|
||||
}
|
||||
|
||||
Bfseek(fil, 0, SEEK_END);
|
||||
leng = Bftell(fil);
|
||||
Bfseek(fil, 0, SEEK_SET);
|
||||
|
||||
fbuf = (char *)Bmalloc(leng * sizeof(char));
|
||||
if (!fbuf)
|
||||
{
|
||||
Bputs("Error: Could not allocate buffer");
|
||||
return(5);
|
||||
}
|
||||
|
||||
Bfread(fbuf,leng,1,fil);
|
||||
Bfclose(fil);
|
||||
|
||||
head = (md2typ *)fbuf;
|
||||
if ((head->id != 0x32504449) && (head->vers != 8)) // "IDP2"
|
||||
{
|
||||
Bfree(fbuf);
|
||||
Bputs("Error: input is not an MD2 file");
|
||||
return(6);
|
||||
}
|
||||
|
||||
for(i=0; i<head->numframes; ++i)
|
||||
{
|
||||
fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i];
|
||||
Bprintf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z);
|
||||
fptr->add.z += zoffset;
|
||||
}
|
||||
|
||||
fil = Bfopen(argv[2],"wb");
|
||||
if (!fil)
|
||||
{
|
||||
Bputs("Error: could not open output file for writing");
|
||||
return(7);
|
||||
}
|
||||
Bfwrite(fbuf,leng,1,fil);
|
||||
Bfclose(fil);
|
||||
|
||||
Bfree(fbuf);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ static md2model_t *md2load(int *fd, const char *filename, int32_t ronly)
|
|||
fil = Bopen(filename, ronly?BO_RDONLY:BO_RDWR);
|
||||
if (fil<0)
|
||||
{
|
||||
fprintf(stderr, "Couldn't open `%s': %s\n", filename, strerror(errno));
|
||||
Bfprintf(stderr, "Couldn't open `%s': %s\n", filename, strerror(errno));
|
||||
quit(2);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ static md2model_t *md2load(int *fd, const char *filename, int32_t ronly)
|
|||
|
||||
if ((head.id != 0x32504449) || (head.vers != 8))
|
||||
{
|
||||
fprintf(stderr, "File `%s' is not an md2 file.\n", filename);
|
||||
Bfprintf(stderr, "File `%s' is not an md2 file.\n", filename);
|
||||
quit(3);
|
||||
} //"IDP2"
|
||||
|
||||
|
@ -109,7 +109,7 @@ static md2model_t *md2load(int *fd, const char *filename, int32_t ronly)
|
|||
|
||||
static void usage_and_quit()
|
||||
{
|
||||
fprintf(stderr,
|
||||
Bfprintf(stderr,
|
||||
"Usage:\n"
|
||||
" md2tool <modelfile>.md2: display info about model\n"
|
||||
" md2tool -minmax <minx>,<miny>,<minz>:<maxx>,<maxy>,<maxz> <modelfile>.md2:\n"
|
||||
|
@ -154,13 +154,13 @@ int main(int argc, char **argv)
|
|||
doinfo=0;
|
||||
if (i+1 >= argc)
|
||||
usage_and_quit();
|
||||
if (sscanf(argv[i+1], "%f,%f,%f:%f,%f,%f", &dminx,&dminy,&dminz, &dmaxx,&dmaxy,&dmaxz)!=6)
|
||||
if (Bsscanf(argv[i+1], "%f,%f,%f:%f,%f,%f", &dminx,&dminy,&dminz, &dmaxx,&dmaxy,&dmaxz)!=6)
|
||||
usage_and_quit();
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "unrecognized option `%s'\n", cp);
|
||||
Bfprintf(stderr, "unrecognized option `%s'\n", cp);
|
||||
quit(2);
|
||||
}
|
||||
}
|
||||
|
@ -188,23 +188,23 @@ int main(int argc, char **argv)
|
|||
|
||||
if (doinfo)
|
||||
{
|
||||
printf("------ %s ------\n", fn);
|
||||
printf("numframes: %d\n", m->numframes);
|
||||
printf("numverts: %d\n", m->numverts);
|
||||
printf("numtris: %d\n", head.numtris);
|
||||
printf("\n");
|
||||
printf("ofsframes: %x\n", head.ofsframes);
|
||||
printf("framebytes: %d\n", head.framebytes);
|
||||
// printf("framebytes: %d, calculated=%d\n", head.framebytes, sizeof(md2frame_t)+(m->numverts-1)*sizeof(md2vert_t));
|
||||
printf("\n");
|
||||
Bprintf("------ %s ------\n", fn);
|
||||
Bprintf("numframes: %d\n", m->numframes);
|
||||
Bprintf("numverts: %d\n", m->numverts);
|
||||
Bprintf("numtris: %d\n", head.numtris);
|
||||
Bprintf("\n");
|
||||
Bprintf("ofsframes: %x\n", head.ofsframes);
|
||||
Bprintf("framebytes: %d\n", head.framebytes);
|
||||
// Bprintf("framebytes: %d, calculated=%d\n", head.framebytes, sizeof(md2frame_t)+(m->numverts-1)*sizeof(md2vert_t));
|
||||
Bprintf("\n");
|
||||
|
||||
printf("mul=%f %f %f\n", mx, my, mz);
|
||||
printf("add=%f %f %f\n", ax, ay, az);
|
||||
Bprintf("mul=%f %f %f\n", mx, my, mz);
|
||||
Bprintf("add=%f %f %f\n", ax, ay, az);
|
||||
|
||||
printf("min xyz (s+t) = %f %f %f\n", minv[0]*mx+ax, minv[1]*my+ay, minv[2]*mz+az);
|
||||
printf("max xyz (s+t) = %f %f %f\n", maxv[0]*mx+ax, maxv[1]*my+ay, maxv[2]*mz+az);
|
||||
Bprintf("min xyz (s+t) = %f %f %f\n", minv[0]*mx+ax, minv[1]*my+ay, minv[2]*mz+az);
|
||||
Bprintf("max xyz (s+t) = %f %f %f\n", maxv[0]*mx+ax, maxv[1]*my+ay, maxv[2]*mz+az);
|
||||
|
||||
printf("\n");
|
||||
Bprintf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ int main(int argc, char **argv)
|
|||
|
||||
if (mx==0||my==0||mz==0)
|
||||
{
|
||||
fprintf(stderr, "max[x,y,z]-min[x,y,z] must each be grater 0!\n");
|
||||
Bfprintf(stderr, "max[x,y,z]-min[x,y,z] must each be grater 0!\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ int main(int argc, char **argv)
|
|||
if (ISNAN(mx)||ISNAN(my)||ISNAN(mz)||ISNAN(ax)||ISNAN(ay)||ISNAN(az)||
|
||||
ISINF(mx)||ISINF(my)||ISINF(mz)||ISINF(ax)||ISINF(ay)||ISINF(az))
|
||||
{
|
||||
fprintf(stderr, "Calculation resulted in NaN or Inf.\n");
|
||||
Bfprintf(stderr, "Calculation resulted in NaN or Inf.\n");
|
||||
quit(2);
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ int main(int argc, char **argv)
|
|||
if (Bwrite(fd, &az, sizeof(az))!=sizeof(az)) { perror("write"); quit(3); }
|
||||
Bclose(fd);
|
||||
|
||||
printf("wrote scale and translate of `%s'.\n", fn);
|
||||
Bprintf("wrote scale and translate of `%s'.\n", fn);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -163,25 +163,25 @@ int main(int argc, char **argv)
|
|||
|
||||
if ((argc != 3) && (argc != 6))
|
||||
{
|
||||
printf("TRANSPAL [-t] [numshades][trans#(0-inv,256-opa)][r][g][b] by Kenneth Silverman\n");
|
||||
printf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n");
|
||||
printf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n");
|
||||
printf(" Ex #2: transpal 64 160\n\n");
|
||||
printf("Once tables are generated, the optional -t switch determines what to save:\n");
|
||||
printf(" Exclude -t to update both the shade table and transluscent table\n");
|
||||
printf(" Include -t to update the transluscent table ONLY\n");
|
||||
Bprintf("TRANSPAL [-t]<numshades><trans#(0-inv,256-opa)><r><g><b> by Kenneth Silverman\n");
|
||||
Bprintf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n");
|
||||
Bprintf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n");
|
||||
Bprintf(" Ex #2: transpal 64 160\n\n");
|
||||
Bprintf("Once tables are generated, the optional -t switch determines what to save:\n");
|
||||
Bprintf(" Exclude -t to update both the shade table and transluscent table\n");
|
||||
Bprintf(" Include -t to update the transluscent table ONLY\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
strcpy(palettefilename,"palette.dat");
|
||||
numpalookups = atol(argv[1]);
|
||||
transratio = atol(argv[2]);
|
||||
Bstrcpy(palettefilename,"palette.dat");
|
||||
numpalookups = Batol(argv[1]);
|
||||
transratio = Batol(argv[2]);
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
rscale = atol(argv[3]);
|
||||
gscale = atol(argv[4]);
|
||||
bscale = atol(argv[5]);
|
||||
rscale = Batol(argv[3]);
|
||||
gscale = Batol(argv[4]);
|
||||
bscale = Batol(argv[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -191,13 +191,13 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if ((numpalookups < 1) || (numpalookups > 256))
|
||||
{ printf("Invalid number of shades\n"); exit(0); }
|
||||
{ Bprintf("Invalid number of shades\n"); exit(0); }
|
||||
if ((transratio < 0) || (transratio > 256))
|
||||
{ printf("Invalid transluscent ratio\n"); exit(0); }
|
||||
{ Bprintf("Invalid transluscent ratio\n"); exit(0); }
|
||||
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("%s not found",palettefilename);
|
||||
Bprintf("%s not found",palettefilename);
|
||||
return(0);
|
||||
}
|
||||
Bread(fil,palette,768);
|
||||
|
@ -242,28 +242,28 @@ int main(int argc, char **argv)
|
|||
{
|
||||
short s;
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ printf("Couldn't save file %s",palettefilename); return(0); }
|
||||
{ Bprintf("Couldn't save file %s",palettefilename); return(0); }
|
||||
Bwrite(fil,palette,768);
|
||||
s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,palookup,numpalookups<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
printf("Shade table AND transluscent table updated\n");
|
||||
Bprintf("Shade table AND transluscent table updated\n");
|
||||
}
|
||||
else if (ch == 32)
|
||||
{
|
||||
short s;
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ printf("Couldn't save file %s",palettefilename); return(0); }
|
||||
{ Bprintf("Couldn't save file %s",palettefilename); return(0); }
|
||||
Bwrite(fil,palette,768);
|
||||
s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,origpalookup,(int)orignumpalookups<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
printf("Transluscent table updated\n");
|
||||
Bprintf("Transluscent table updated\n");
|
||||
}
|
||||
else
|
||||
printf("Palette file wasn't touched\n");
|
||||
Bprintf("Palette file wasn't touched\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void convpalette(void)
|
|||
Bread(fil1,palookup,8192);
|
||||
|
||||
if ((fil3 = Bopen("palette.dat",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ printf("Cannot save palette.dat\n"); exit(0); }
|
||||
{ Bprintf("Cannot save palette.dat\n"); exit(0); }
|
||||
Bwrite(fil3,pal,768);
|
||||
danumshades = 32;
|
||||
Bwrite(fil3,&danumshades,2);
|
||||
|
@ -83,7 +83,7 @@ void saveart (short tilenum, short xlen, short ylen)
|
|||
tempbuf[i++] = screen[p];
|
||||
if (Bwrite(fil2,&tempbuf[0],i) < 0)
|
||||
{
|
||||
printf("NOT ENOUGH DISK SPACE!\n");
|
||||
Bprintf("NOT ENOUGH DISK SPACE!\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -206,44 +206,44 @@ int main(int argc, char **argv)
|
|||
int i, j, endoffile;
|
||||
char wadfile[80];
|
||||
|
||||
printf("Wad2Art! Copyright 1995 by Ken Silverman\n");
|
||||
Bprintf("Wad2Art! Copyright 1995 by Ken Silverman\n");
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Command line parameters: Wad2Art [Doom IWAD file]\n");
|
||||
printf(" Creates TILES000.ART, PALETTE.DAT, and NAMES.H in current directory.\n");
|
||||
printf(" Ex: wad2art c:\\doom\\doom.wad\n");
|
||||
Bprintf("Command line parameters: Wad2Art <Doom IWAD file>\n");
|
||||
Bprintf(" Creates TILES000.ART, PALETTE.DAT, and NAMES.H in current directory.\n");
|
||||
Bprintf(" Ex: wad2art c:\\doom\\doom.wad\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
strcpy(wadfile,argv[1]);
|
||||
if (strchr(wadfile,'.') == 0) strcat(wadfile,".wad");
|
||||
if ((fil1 = Bopen(wadfile,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{ printf("Wad not found\n"); exit(0); }
|
||||
{ Bprintf("Wad not found\n"); exit(0); }
|
||||
if ((fil2 = Bopen("tiles000.art",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{ printf("Can't open art file\n"); exit(0); }
|
||||
{ Bprintf("Can't open art file\n"); exit(0); }
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<256;i++) { ylookup[i] = j; j += 320; }
|
||||
|
||||
printf("Loading wad header...\n");
|
||||
Bprintf("Loading wad header...\n");
|
||||
loadwadheader();
|
||||
Blseek(fil2,16+(numwads<<3),SEEK_SET);
|
||||
for(i=0;i<numwads;i++)
|
||||
{ tilesizx[i] = 0; tilesizy[i] = 0; picanm[i] = 0L; }
|
||||
|
||||
printf("Saving names.h\n");
|
||||
Bprintf("Saving names.h\n");
|
||||
savenames();
|
||||
printf("Converting palette\n");
|
||||
Bprintf("Converting palette\n");
|
||||
convpalette();
|
||||
|
||||
printf("Saving tiles000.art\n");
|
||||
Bprintf("Saving tiles000.art\n");
|
||||
showart("L_START");
|
||||
showart("S_START");
|
||||
showart("P_START");
|
||||
showart("F_START");
|
||||
|
||||
printf("Saving tiles000.art header\n");
|
||||
Bprintf("Saving tiles000.art header\n");
|
||||
artversion = 1; localtilestart = 0; localtileend = numwads-1;
|
||||
|
||||
endoffile = Btell(fil2);
|
||||
|
@ -260,7 +260,7 @@ int main(int argc, char **argv)
|
|||
Bclose(fil2);
|
||||
Bclose(fil1);
|
||||
|
||||
printf("Congratulations! Your disk actually had enough space this time!\n");
|
||||
Bprintf("Congratulations! Your disk actually had enough space this time!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ void parsescript(void)
|
|||
|
||||
if ((filhandle = Bopen(scriptname,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("Could not find %s\n",scriptname);
|
||||
Bprintf("Could not find %s\n",scriptname);
|
||||
exit(0);
|
||||
}
|
||||
filpos = 0; fileng = Bfilelength(filhandle);
|
||||
|
@ -348,12 +348,12 @@ void parsescript(void)
|
|||
if (tempbuf[k] == '-')
|
||||
{
|
||||
tempbuf[k] = 0;
|
||||
thingnum[numthings] = atol(&tempbuf[lasti]);
|
||||
thingnum2[numthings] = atol(&tempbuf[k+1]);
|
||||
thingnum[numthings] = Batol(&tempbuf[lasti]);
|
||||
thingnum2[numthings] = Batol(&tempbuf[k+1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
thingnum[numthings] = atol(&tempbuf[lasti]);
|
||||
thingnum[numthings] = Batol(&tempbuf[lasti]);
|
||||
thingnum2[numthings] = thingnum[numthings];
|
||||
}
|
||||
|
||||
|
@ -373,13 +373,13 @@ void parsescript(void)
|
|||
if (tempbuf[k] == '-')
|
||||
{
|
||||
tempbuf[k] = 0;
|
||||
tstart = atol(&tempbuf[lasti]);
|
||||
tend = atol(&tempbuf[k+1]);
|
||||
tstart = Batol(&tempbuf[lasti]);
|
||||
tend = Batol(&tempbuf[k+1]);
|
||||
for(k=tstart;k<=tend;k++)
|
||||
tempshort[textnum++] = k;
|
||||
}
|
||||
else
|
||||
tempshort[textnum++] = atol(&tempbuf[lasti]);
|
||||
tempshort[textnum++] = Batol(&tempbuf[lasti]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -419,12 +419,12 @@ void parsescript(void)
|
|||
if (tempbuf[k] == '-')
|
||||
{
|
||||
tempbuf[k] = 0;
|
||||
tagnum[numtags] = atol(&tempbuf[lasti]);
|
||||
tagnum2[numtags] = atol(&tempbuf[k+1]);
|
||||
tagnum[numtags] = Batol(&tempbuf[lasti]);
|
||||
tagnum2[numtags] = Batol(&tempbuf[k+1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tagnum[numtags] = atol(&tempbuf[lasti]);
|
||||
tagnum[numtags] = Batol(&tempbuf[lasti]);
|
||||
tagnum2[numtags] = tagnum[numtags];
|
||||
}
|
||||
|
||||
|
@ -443,12 +443,12 @@ void parsescript(void)
|
|||
if (tempbuf[k] == '-')
|
||||
{
|
||||
tempbuf[k] = 0;
|
||||
secnum[numsecs] = atol(&tempbuf[lasti]);
|
||||
secnum2[numsecs] = atol(&tempbuf[k+1]);
|
||||
secnum[numsecs] = Batol(&tempbuf[lasti]);
|
||||
secnum2[numsecs] = Batol(&tempbuf[k+1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
secnum[numsecs] = atol(&tempbuf[lasti]);
|
||||
secnum[numsecs] = Batol(&tempbuf[lasti]);
|
||||
secnum2[numsecs] = secnum[numsecs];
|
||||
}
|
||||
numsecs++;
|
||||
|
@ -468,7 +468,7 @@ void parsescript(void)
|
|||
}
|
||||
else if (definemode == 2)
|
||||
{
|
||||
defineval[numdefines++] = atol(&tempbuf[lasti]);
|
||||
defineval[numdefines++] = Batol(&tempbuf[lasti]);
|
||||
definemode = 0;
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ void parsescript(void)
|
|||
if (Bstrcasecmp(&tempbuf[lasti],"extra") == 0) thingfield[thingopnum] = 21;
|
||||
|
||||
if ((tempbuf[k+1] >= 48) && (tempbuf[k+1] <= 57))
|
||||
thingval[thingopnum] = atol(&tempbuf[k+1]);
|
||||
thingval[thingopnum] = Batol(&tempbuf[k+1]);
|
||||
else
|
||||
{
|
||||
for(l=0;l<numdefines;l++)
|
||||
|
@ -522,7 +522,7 @@ void parsescript(void)
|
|||
if ((texturelookupmode == 1) && (j == 1))
|
||||
{
|
||||
if ((tempbuf[lasti] >= 48) && (tempbuf[lasti] <= 57))
|
||||
l = atol(&tempbuf[lasti]);
|
||||
l = Batol(&tempbuf[lasti]);
|
||||
else
|
||||
{
|
||||
for(l=0;l<numdefines;l++)
|
||||
|
@ -623,7 +623,7 @@ void parsescript(void)
|
|||
tagfield[tagopnum] += (frontbackstat<<7) + (spritenumstat<<8);
|
||||
|
||||
if ((tempbuf[k+1] >= 48) && (tempbuf[k+1] <= 57))
|
||||
tagval[tagopnum] = atol(&tempbuf[k+1]);
|
||||
tagval[tagopnum] = Batol(&tempbuf[k+1]);
|
||||
else if (Bstrcasecmp("tag",&tempbuf[k+1]) == 0)
|
||||
tagval[tagopnum] = INT32_MIN;
|
||||
else
|
||||
|
@ -704,7 +704,7 @@ void parsescript(void)
|
|||
secfield[secopnum] += (spritenumstat<<8);
|
||||
|
||||
if ((tempbuf[k+1] >= 48) && (tempbuf[k+1] <= 57))
|
||||
secval[secopnum] = atol(&tempbuf[k+1]);
|
||||
secval[secopnum] = Batol(&tempbuf[k+1]);
|
||||
else if (Bstrcasecmp("tag",&tempbuf[k+1]) == 0)
|
||||
secval[secopnum] = INT32_MIN;
|
||||
else
|
||||
|
@ -922,15 +922,15 @@ int main(int argc, char **argv)
|
|||
int mapversion, posx, posy, posz, boardwadindex;
|
||||
short ang, cursectnum;
|
||||
|
||||
printf("Wad2Map! Copyright 1995 by Ken Silverman\n");
|
||||
Bprintf("Wad2Map! Copyright 1995 by Ken Silverman\n");
|
||||
|
||||
if ((argc < 3) || (argc > 5))
|
||||
{
|
||||
printf("Command line parameters: Wad2Map (PWADName) IWADName MapName (ScriptName)\n");
|
||||
printf(" Ex #1: wad2map c:\\doom\\doom.wad e1m1\n");
|
||||
printf(" Ex #2: wad2map c:\\doom\\doom.wad e1m1 kenbuild.txt\n");
|
||||
printf(" Ex #3: wad2map c:\\doom\\mypwad.wad c:\\doom\\doom.wad e1m1\n");
|
||||
printf(" Ex #4: wad2map c:\\doom\\mypwad.wad c:\\doom\\doom.wad e1m1 kenbuild.txt\n");
|
||||
Bprintf("Command line parameters: Wad2Map (PWADName) IWADName MapName (ScriptName)\n");
|
||||
Bprintf(" Ex #1: wad2map c:\\doom\\doom.wad e1m1\n");
|
||||
Bprintf(" Ex #2: wad2map c:\\doom\\doom.wad e1m1 kenbuild.txt\n");
|
||||
Bprintf(" Ex #3: wad2map c:\\doom\\mypwad.wad c:\\doom\\doom.wad e1m1\n");
|
||||
Bprintf(" Ex #4: wad2map c:\\doom\\mypwad.wad c:\\doom\\doom.wad e1m1 kenbuild.txt\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -939,12 +939,12 @@ int main(int argc, char **argv)
|
|||
strcpy(iwadfil,argstring[1]); //"c:\games\doom\doom.wad"
|
||||
if (strchr(iwadfil,'.') == 0) strcat(iwadfil,".wad");
|
||||
if ((ifil = Bopen(iwadfil,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{ printf("Could not find %s\n",iwadfil); exit(0); }
|
||||
{ Bprintf("Could not find %s\n",iwadfil); exit(0); }
|
||||
|
||||
Bread(ifil,&wadtype,4);
|
||||
if (wadtype == 0x44415749) wadtype = 0; //IWAD
|
||||
else if (wadtype == 0x44415750) wadtype = 1; //PWAD
|
||||
else { Bclose(ifil); printf("Invalid WAD header\n"); exit(0); }
|
||||
else { Bclose(ifil); Bprintf("Invalid WAD header\n"); exit(0); }
|
||||
|
||||
strcpy(pwadfil,iwadfil); pfil = ifil;
|
||||
if (wadtype == 1)
|
||||
|
@ -952,13 +952,13 @@ int main(int argc, char **argv)
|
|||
strcpy(iwadfil,argstring[2]);
|
||||
if (strchr(iwadfil,'.') == 0) strcat(iwadfil,".wad");
|
||||
if ((ifil = Bopen(iwadfil,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{ Bclose(pfil); printf("Could not find %s\n",iwadfil); exit(0); }
|
||||
{ Bclose(pfil); Bprintf("Could not find %s\n",iwadfil); exit(0); }
|
||||
|
||||
Bread(ifil,&wadtype,4);
|
||||
if (wadtype != 0x44415749) //!= IWAD
|
||||
{
|
||||
Bclose(ifil); Bclose(pfil);
|
||||
printf("Wad a' you think I am? That ain't no IWAD!\n");
|
||||
Bprintf("Wad a' you think I am? That ain't no IWAD!\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ int main(int argc, char **argv)
|
|||
for(i=0;i<MAXSPRITES;i++) sprite[i].extra = -1;
|
||||
|
||||
if ((w = getwadindex("TEXTURE1")) < 0)
|
||||
{ printf("TEXTURE1 not found!\n"); exit(0); }
|
||||
{ Bprintf("TEXTURE1 not found!\n"); exit(0); }
|
||||
Blseek(ifil,iwadplc[w],BSEEK_SET);
|
||||
Bread(ifil,&numtexts,4);
|
||||
Bread(ifil,textoffs,numtexts*sizeof(int));
|
||||
|
@ -1094,7 +1094,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if ((w = getwadindex("PNAMES")) < 0)
|
||||
{ printf("PNAMES not found!\n"); exit(0); }
|
||||
{ Bprintf("PNAMES not found!\n"); exit(0); }
|
||||
Blseek(ifil,iwadplc[w],BSEEK_SET);
|
||||
Bread(ifil,&numpnames,4);
|
||||
Bread(ifil,tempbuf,numpnames*8);
|
||||
|
@ -1109,7 +1109,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if ((w = getwadindex(doommap)) < 0)
|
||||
{ printf("Board not found!\n"); exit(0); }
|
||||
{ Bprintf("Board not found!\n"); exit(0); }
|
||||
boardwadindex = w;
|
||||
for(w=boardwadindex+10;w>=boardwadindex;w--)
|
||||
{
|
||||
|
@ -1591,7 +1591,7 @@ int main(int argc, char **argv)
|
|||
if (strchr(buildmap,'.') == 0) strcat(buildmap,".map");
|
||||
if ((fil = Bopen(buildmap,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||
{
|
||||
printf("Could not write to %s\n",buildmap);
|
||||
Bprintf("Could not write to %s\n",buildmap);
|
||||
exit(0);
|
||||
}
|
||||
Bwrite(fil,&mapversion,4);
|
||||
|
@ -1608,7 +1608,7 @@ int main(int argc, char **argv)
|
|||
Bwrite(fil,sprite,sizeof(spritetype)*dnumthings);
|
||||
Bclose(fil);
|
||||
|
||||
printf("Map converted.\n");
|
||||
Bprintf("Map converted.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue