From 0c8ea188530523353c0ad2b15f8caa886700b8e1 Mon Sep 17 00:00:00 2001 From: janwas Date: Wed, 26 May 2004 19:28:42 +0000 Subject: [PATCH] upgrade to new libpng and zlib (see announcements thread) This was SVN commit r270. --- source/lib/res/tex.cpp | 4 ++-- source/lib/res/zip.cpp | 27 +++++++++++++++++++++++++-- source/main.cpp | 18 +++++++++--------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/source/lib/res/tex.cpp b/source/lib/res/tex.cpp index 044e66d51d..687426d039 100755 --- a/source/lib/res/tex.cpp +++ b/source/lib/res/tex.cpp @@ -43,8 +43,8 @@ #define WINAPIV __cdecl #ifndef NO_PNG -#include -#pragma comment(lib, "libpng.lib") +#include +#pragma comment(lib, "libpng10.lib") #endif diff --git a/source/lib/res/zip.cpp b/source/lib/res/zip.cpp index 4ed130e2e2..d9f14b3713 100755 --- a/source/lib/res/zip.cpp +++ b/source/lib/res/zip.cpp @@ -21,9 +21,13 @@ #include "lib.h" #include "res.h" +//#define NO_ZLIB + +#ifndef NO_ZLIB #include #ifdef _MSC_VER -#pragma comment(lib, "zlib.lib") +#pragma comment(lib, "zdll.lib") +#endif #endif #include @@ -609,6 +613,9 @@ int zip_enum(const Handle ha, const ZipFileCB cb, const uintptr_t user) uintptr_t inf_init_ctx() { +#ifdef NO_ZLIB + return 0; +#else // allocate ZLib stream z_stream* stream = (z_stream*)mem_alloc(round_up(sizeof(z_stream), 32), 32, MEM_ZERO); if(inflateInit2(stream, -MAX_WBITS) != Z_OK) @@ -616,11 +623,15 @@ uintptr_t inf_init_ctx() return 0; return (uintptr_t)stream; +#endif } int inf_start_read(uintptr_t ctx, void* out, size_t out_size) { +#ifdef NO_ZLIB + return -1; +#else if(!ctx) return ERR_INVALID_PARAM; z_stream* stream = (z_stream*)ctx; @@ -633,11 +644,15 @@ int inf_start_read(uintptr_t ctx, void* out, size_t out_size) stream->next_out = (Byte*)out; stream->avail_out = (uInt)out_size; return 0; +#endif } ssize_t inf_inflate(uintptr_t ctx, void* in, size_t in_size) { +#ifdef NO_ZLIB + return -1; +#else if(!ctx) return ERR_INVALID_PARAM; z_stream* stream = (z_stream*)ctx; @@ -660,11 +675,15 @@ ssize_t inf_inflate(uintptr_t ctx, void* in, size_t in_size) // it isn't treated as 'bytes read', i.e. > 0. return nread; +#endif } int inf_finish_read(uintptr_t ctx) { +#ifdef NO_ZLIB + return -1; +#else if(!ctx) return ERR_INVALID_PARAM; z_stream* stream = (z_stream*)ctx; @@ -678,13 +697,16 @@ int inf_finish_read(uintptr_t ctx) stream->next_in = 0; stream->next_out = 0; - return 0; +#endif } int inf_free_ctx(uintptr_t ctx) { +#ifdef NO_ZLIB + return -1; +#else if(!ctx) return ERR_INVALID_PARAM; z_stream* stream = (z_stream*)ctx; @@ -694,6 +716,7 @@ int inf_free_ctx(uintptr_t ctx) inflateEnd(stream); mem_free(stream); return 0; +#endif } diff --git a/source/main.cpp b/source/main.cpp index e1bdee80f3..638c6f0605 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -397,15 +397,6 @@ int main(int argc, char* argv[]) display_startup_error(err_msg); } - -// default to loading map for convenience during development -// override by passing any parameter. - if(argc < 2) - { - argc = 2; - argv[1] = "-m=test01.pmp"; - } - ParseArgs(argc, argv); @@ -497,6 +488,15 @@ int main(int argc, char* argv[]) g_EntityTemplateCollection.loadTemplates(); + + +// if no map name specified, load test01.pmp (for convenience during +// development. that means loading no map at all is currently impossible. +// is that a problem? +if(!g_MapFile) + g_MapFile = "test01.pmp"; + + // load a map if we were given one if (g_MapFile) { CStr mapfilename("mods/official/maps/scenarios/");