From 68e535c5b28126272840a3adb4c96dc2542440de Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 21 Dec 2016 15:48:52 +0000 Subject: [PATCH] fix misc compile issues for minor ports. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5036 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/botlib/q_platform.h | 45 ++++++++++++++++++++++++++++++++------ engine/client/pr_csqc.c | 1 + engine/client/snd_al.c | 1 + engine/common/bothdefs.h | 2 +- engine/gl/gl_hlmdl.c | 7 +++++- engine/qclib/qcd_main.c | 5 ++--- 6 files changed, 49 insertions(+), 12 deletions(-) diff --git a/engine/botlib/q_platform.h b/engine/botlib/q_platform.h index b6dabc3f4..fd3862020 100644 --- a/engine/botlib/q_platform.h +++ b/engine/botlib/q_platform.h @@ -161,11 +161,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA //================================================================= LINUX === -#if defined(__linux__) || defined(__FreeBSD_kernel__) +#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(ANDROID) || defined(__ANDROID__) #include -#if defined(__linux__) +#if defined(ANDROID) || defined(__ANDROID__) +#define OS_STRING "android" +#elif defined(__linux__) #define OS_STRING "linux" #else #define OS_STRING "kFreeBSD" @@ -330,6 +332,30 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif +#ifdef FTE_TARGET_WEB +#define OS_STRING "emscripten" +#define ID_INLINE static inline +#define PATH_SEP '/' + +#define ARCH_STRING "web" + +#define Q3_LITTLE_ENDIAN + +#define DLL_EXT ".so" +#endif + +#ifdef NACL +#define OS_STRING "nacl" +#define ID_INLINE static inline +#define PATH_SEP '/' + +#define ARCH_STRING "web" + +#define Q3_LITTLE_ENDIAN + +#define DLL_EXT ".so" +#endif + //================================================================== Q3VM === #ifdef Q3_VM @@ -348,23 +374,28 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA //catch missing defines in above blocks #if !defined( OS_STRING ) -#error "Operating system not supported" +#define ARCH_STRING "unknown" +//#error "Operating system not supported" #endif #if !defined( ARCH_STRING ) -#error "Architecture not supported" +#define ARCH_STRING "unk" +//#error "Architecture not supported" #endif #ifndef ID_INLINE -#error "ID_INLINE not defined" +#define ID_INLINE static +//#error "ID_INLINE not defined" #endif #ifndef PATH_SEP -#error "PATH_SEP not defined" +#define PATH_SEP '/' +//#error "PATH_SEP not defined" #endif #ifndef DLL_EXT -#error "DLL_EXT not defined" +#define DLL_EXT ".so" +//#error "DLL_EXT not defined" #endif diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 4e7726542..59d73ecca 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -5672,6 +5672,7 @@ static struct { // {"bulleten", PF_bulleten, 243}, (removed builtin) {"rotatevectorsbytag", PF_rotatevectorsbytag, 244}, + {"mod", PF_mod, 245}, {"sqlconnect", PF_NoCSQC, 250}, // #250 float([string host], [string user], [string pass], [string defaultdb], [string driver]) sqlconnect (FTE_SQL) {"sqldisconnect", PF_NoCSQC, 251}, // #251 void(float serveridx) sqldisconnect (FTE_SQL) diff --git a/engine/client/snd_al.c b/engine/client/snd_al.c index 910c5c5a6..87a234e4d 100644 --- a/engine/client/snd_al.c +++ b/engine/client/snd_al.c @@ -1132,6 +1132,7 @@ static void OpenAL_Shutdown (soundcardinfo_t *sc) Z_Free(oali->effecttype); #endif + palcMakeContextCurrent(NULL); palcDestroyContext(oali->OpenAL_Context); palcCloseDevice(oali->OpenAL_Device); Z_Free(oali); diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 8cb541033..18152e21d 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -109,7 +109,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #if !defined(_MSC_VER) || _MSC_VER > 1200 #define HAVE_WINSSPI //built in component, checks against windows' root ca database and revocations etc. #endif -#elif defined(__linux__) || defined(__CYGWIN__) +#elif (defined(__linux__) || defined(__CYGWIN__)) && !defined(ANDROID) #define HAVE_GNUTLS //currently disabled as it does not validate the server's certificate, beware the mitm attack. #endif #endif diff --git a/engine/gl/gl_hlmdl.c b/engine/gl/gl_hlmdl.c index 1423bf74c..4b300c63b 100644 --- a/engine/gl/gl_hlmdl.c +++ b/engine/gl/gl_hlmdl.c @@ -195,8 +195,10 @@ static void HLMDL_PrepareVerticies (hlmodel_t *model, hlmdl_submodel_t *amodel, mesh->lmst_array[0] = ZG_Malloc(model->memgroup, sizeof(*mesh->lmst_array[0])*uvertcount); mesh->xyz_array = ZG_Malloc(model->memgroup, sizeof(*mesh->xyz_array)*uvertcount); mesh->normals_array = ZG_Malloc(model->memgroup, sizeof(*mesh->normals_array)*uvertcount); +#if defined(RTLIGHTS) mesh->snormals_array = ZG_Malloc(model->memgroup, sizeof(*mesh->snormals_array)*uvertcount); mesh->tnormals_array = ZG_Malloc(model->memgroup, sizeof(*mesh->tnormals_array)*uvertcount); +#endif mesh->bonenums = ZG_Malloc(model->memgroup, sizeof(*mesh->bonenums)*uvertcount); mesh->boneweights = ZG_Malloc(model->memgroup, sizeof(*mesh->boneweights)*uvertcount); @@ -220,8 +222,10 @@ static void HLMDL_PrepareVerticies (hlmodel_t *model, hlmdl_submodel_t *amodel, free(uvert); free(index); +#if defined(RTLIGHTS) //treat this as the base pose, and calculate the sdir+tdir for bumpmaps. R_Generate_Mesh_ST_Vectors(mesh); +#endif } #endif @@ -875,9 +879,10 @@ qboolean HLMDL_Trace (model_t *model, int hulloverride, framestate_t *framestat { startout = false; endout = false; - enterplane= 0; + enterplane = 0; enterfrac = -1; exitfrac = 10; + enterdist = 0; //fixme: would be nice to check if there's a possible collision a bit faster, without needing to do lots of excess maths. diff --git a/engine/qclib/qcd_main.c b/engine/qclib/qcd_main.c index 56e626592..dd278aa1c 100644 --- a/engine/qclib/qcd_main.c +++ b/engine/qclib/qcd_main.c @@ -1,7 +1,7 @@ #include "progsint.h" #include "qcc.h" -#if !defined(NO_ZLIB) && !defined(FTE_TARGET_WEB) +#if !defined(NO_ZLIB) && !defined(FTE_TARGET_WEB) && !defined(NACL) #define AVAIL_ZLIB #endif @@ -104,7 +104,6 @@ int SafeSeek(int hand, int ofs, int mode); //we are allowed to trash our input here. int QC_encode(progfuncs_t *progfuncs, int len, int method, const char *in, int handle) { - int i; if (method == 0) //copy, allows a lame pass-through. { SafeWrite(handle, in, len); @@ -121,6 +120,7 @@ int QC_encode(progfuncs_t *progfuncs, int len, int method, const char *in, int h { #ifdef AVAIL_ZLIB char out[8192]; + int i=0; z_stream strm = { (char *)in, @@ -142,7 +142,6 @@ int QC_encode(progfuncs_t *progfuncs, int len, int method, const char *in, int h 0, 0 }; - i=0; if (method == 8) deflateInit2(&strm, 9, Z_DEFLATED, -MAX_WBITS, 9, Z_DEFAULT_STRATEGY); //zip deflate compression