Commit d25fef7d authored by Florian Schulze's avatar Florian Schulze

Enabled support for gzip compressed levels and added support for bzip2 compressed levels.

parent 9b10b247
30 Mar 2004 - 1.42
- added support for gzip and bzip2 packed levels.
21 Mar 2003 - 1.41
- new scaling filter which works with 8bit graphics. Removed the old scaler
completely, now fading and everything else works in scaled up mode.
......
SDL_CFLAGS = `sdl-config --cflags`
SDL_LIBS = `sdl-config --libs`
CFLAGS = -Wall -O2 -ffast-math -funroll-loops -Dstricmp=strcasecmp \
-Dstrnicmp=strncasecmp -DUSE_SDL -DNDEBUG -I. $(SDL_CFLAGS) -DUSE_NET
LIBS = -lm $(SDL_LIBS) -lSDL_mixer -lSDL_net
-Dstrnicmp=strncasecmp -DUSE_SDL -DNDEBUG -I. $(SDL_CFLAGS) \
-DUSE_NET -DZLIB_SUPPORT -DBZLIB_SUPPORT
LIBS = -lm $(SDL_LIBS) -lSDL_mixer -lSDL_net -lbz2 -lz
SDL_TARGET = sdl.a
MODIFY_TARGET = gobpack jnbpack jnbunpack
OBJS = fireworks.o main.o menu.o filter.o
......
......@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "USE_SDL" /D "USE_NET" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "USE_SDL" /D "USE_NET" /D "ZLIB_SUPPORT" /D "BZLIB_SUPPORT" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
......@@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDLmain.lib SDL.lib SDL_mixer.lib SDL_net.lib /nologo /subsystem:windows /profile /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDLmain.lib SDL.lib SDL_mixer.lib SDL_net.lib zlib.lib libbz2.lib /nologo /subsystem:windows /profile /machine:I386
# SUBTRACT LINK32 /debug
# Begin Custom Build
ProjDir=.
......@@ -93,7 +93,7 @@ BuildCmds= \
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "USE_SDL" /D "USE_NET" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "USE_SDL" /D "USE_NET" /D "ZLIB_SUPPORT" /D "BZLIB_SUPPORT" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
......@@ -103,7 +103,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDLmain.lib SDL.lib SDL_mixer.lib SDL_net.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDLmain.lib SDL.lib SDL_mixer.lib SDL_net.lib zlib.lib libbz2.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# Begin Custom Build
ProjDir=.
InputPath=.\Debug\jumpnbump.exe
......
/*
* globals.h
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
*
* Copyright (C) 2001 Chuck Mason <[email protected]>
*
* Copyright (C) 2002 Florian Schulze <[email protected]>
......@@ -79,7 +79,7 @@ void tellServerPlayerMoved(int playerid, int movement_type, int newval);
#define MOVEMENT_RIGHT 2
#define MOVEMENT_UP 3
#define JNB_VERSION "1.41"
#define JNB_VERSION "1.42"
#define JNB_WIDTH 400
#define JNB_HEIGHT 256
......
......@@ -29,6 +29,14 @@
#include <unistd.h>
#endif
#ifdef BZLIB_SUPPORT
#include "bzlib.h"
#endif
#ifdef ZLIB_SUPPORT
#include "zlib.h"
#endif
#ifdef USE_NET
#include "SDL_net.h"
#endif /* USE_NET */
......@@ -2629,16 +2637,70 @@ static void preread_datafile(const char *fname)
int len;
#ifdef ZLIB_SUPPORT
char *gzfilename = alloca(strlen(fname) + 4);
int bufsize = 0;
int bufpos = 0;
char *gzfilename;
gzFile gzf;
#endif
#ifdef BZLIB_SUPPORT
char *bzfilename;
BZFILE *bzf;
#endif
#ifdef BZLIB_SUPPORT
bzfilename = malloc(strlen(fname) + 5);
strcpy(bzfilename, fname);
strcat(bzfilename, ".bz2");
bzf = BZ2_bzopen(bzfilename, "rb");
free(bzfilename);
bzfilename = NULL;
if (bzf != NULL) {
int bufsize = 0;
int bufpos = 0;
int br;
unsigned char *ptr;
do {
if (bufpos >= bufsize) {
bufsize += 1024 * 1024;
datafile_buffer = (unsigned char *) realloc(datafile_buffer, bufsize);
if (datafile_buffer == NULL) {
perror("realloc()");
exit(42);
}
}
br = BZ2_bzread(bzf, datafile_buffer + bufpos, bufsize - bufpos);
if (br == -1) {
fprintf(stderr, "gzread failed.\n");
exit(42);
}
bufpos += br;
} while (br>0);
/* try to shrink buffer... */
ptr = (unsigned char *) realloc(datafile_buffer, bufpos);
if (ptr != NULL)
datafile_buffer = ptr;
BZ2_bzclose(bzf);
return;
}
/* drop through and try for an gzip compressed or uncompressed datafile... */
#endif
#ifdef ZLIB_SUPPORT
gzfilename = malloc(strlen(fname) + 4);
strcpy(gzfilename, fname);
strcat(gzfilename, ".gz");
gzf = gzopen(gzfilename, "rb");
free(gzfilename);
gzfilename = NULL;
if (gzf != NULL) {
int bufsize = 0;
int bufpos = 0;
unsigned char *ptr;
do {
int br;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment