forked from fte/fteqw
1
0
Fork 0

Compile fixes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5532 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-09-04 09:15:13 +00:00
parent 41b0d993f2
commit 200ec8c246
9 changed files with 66 additions and 42 deletions

View File

@ -4,6 +4,8 @@
//It doesn't implement all validation checks, either. //It doesn't implement all validation checks, either.
//Do NOT use this code to validate any encoders... //Do NOT use this code to validate any encoders...
//Based upon documentation here: https://www.khronos.org/registry/OpenGL/extensions/OES/OES_texture_compression_astc.txt
#ifndef ASTC_PUBLIC #ifndef ASTC_PUBLIC
#define ASTC_PUBLIC #define ASTC_PUBLIC
#endif #endif
@ -371,21 +373,29 @@ static void ASTC_Decode(unsigned char *in, unsigned char *out, int count, unsign
block[1] = ASTC_readbits2(in, &offset, bits); block[1] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 2)<<2; t |= ASTC_readbits2(in, &offset, 2)<<2;
} }
else
block[1] = 0;
if (count > 2) if (count > 2)
{ {
block[2] = ASTC_readbits2(in, &offset, bits); block[2] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 1)<<4; t |= ASTC_readbits2(in, &offset, 1)<<4;
} }
else
block[2] = 0;
if (count > 3) if (count > 3)
{ {
block[3] = ASTC_readbits2(in, &offset, bits); block[3] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 2)<<5; t |= ASTC_readbits2(in, &offset, 2)<<5;
} }
else
block[3] = 0;
if (count > 4) if (count > 4)
{ {
block[4] = ASTC_readbits2(in, &offset, bits); block[4] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 1)<<7; t |= ASTC_readbits2(in, &offset, 1)<<7;
} }
else
block[4] = 0;
//okay, we read the block, now figure out the trits and pack them into the high part of the result //okay, we read the block, now figure out the trits and pack them into the high part of the result
if ((t&0x1c) == 0x1c) if ((t&0x1c) == 0x1c)
@ -447,11 +457,15 @@ static void ASTC_Decode(unsigned char *in, unsigned char *out, int count, unsign
block[1] = ASTC_readbits2(in, &offset, bits); block[1] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 2)<<3; t |= ASTC_readbits2(in, &offset, 2)<<3;
} }
else
block[1] = 0;
if (count > 2) if (count > 2)
{ {
block[2] = ASTC_readbits2(in, &offset, bits); block[2] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 2)<<5; t |= ASTC_readbits2(in, &offset, 2)<<5;
} }
else
block[2] = 0;
//okay, we read the block, now figure out the trits and pack them into the high part of the result //okay, we read the block, now figure out the trits and pack them into the high part of the result
if ((t&6)==6 && !(t&0x60)) if ((t&6)==6 && !(t&0x60))

View File

@ -430,7 +430,7 @@ static qboolean Prompt_MenuKeyEvent(struct menu_s *gm, qboolean isdown, unsigned
void *ctx = m->ctx; void *ctx = m->ctx;
extern qboolean keydown[]; extern qboolean keydown[];
if (!isdown != (key==K_MOUSE1)) if ((!isdown) != (key==K_MOUSE1))
return false; //don't care about releases, unless mouse1. return false; //don't care about releases, unless mouse1.
if (key == 'n' || key == 'N') if (key == 'n' || key == 'N')

View File

@ -802,9 +802,11 @@ static qhandle_t QDECL Plug_Net_TCPConnect(const char *remoteip, int remoteport)
void Plug_Net_Close_Internal(qhandle_t handle); void Plug_Net_Close_Internal(qhandle_t handle);
#ifdef HAVE_SSL
static int QDECL Plug_Net_SetTLSClient(qhandle_t handle, const char *certhostname) static int QDECL Plug_Net_SetTLSClient(qhandle_t handle, const char *certhostname)
{ {
#ifndef HAVE_SSL
return -1;
#else
pluginstream_t *stream; pluginstream_t *stream;
if (handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug) if (handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug)
{ {
@ -825,10 +827,14 @@ static int QDECL Plug_Net_SetTLSClient(qhandle_t handle, const char *certhostnam
return -1; return -1;
} }
return 0; return 0;
#endif
} }
static int QDECL Plug_Net_GetTLSBinding(qhandle_t handle, char *outbinddata, int *outbinddatalen) static int QDECL Plug_Net_GetTLSBinding(qhandle_t handle, char *outbinddata, int *outbinddatalen)
{ {
#ifndef HAVE_SSL
return -1;
#else
pluginstream_t *stream; pluginstream_t *stream;
size_t sz; size_t sz;
int r; int r;
@ -848,8 +854,8 @@ static int QDECL Plug_Net_GetTLSBinding(qhandle_t handle, char *outbinddata, int
r = TLS_GetChannelBinding(stream->vfs, outbinddata, &sz); r = TLS_GetChannelBinding(stream->vfs, outbinddata, &sz);
*outbinddatalen = sz; *outbinddatalen = sz;
return r; return r;
}
#endif #endif
}
#endif #endif
#ifdef WEBCLIENT #ifdef WEBCLIENT
@ -1843,16 +1849,22 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s
{ {
Plug_CL_GetStats, Plug_CL_GetStats,
Plug_GetPlayerInfo, Plug_GetPlayerInfo,
Plug_GetTeamInfo,
Plug_GetWeaponStats,
Plug_GetNetworkInfo, Plug_GetNetworkInfo,
Plug_GetLocalPlayerNumbers, Plug_GetLocalPlayerNumbers,
Plug_GetLocationName, Plug_GetLocationName,
Plug_GetTrackerOwnFrags,
Plug_GetLastInputFrame, Plug_GetLastInputFrame,
Plug_GetServerInfo, Plug_GetServerInfo,
Plug_SetUserInfo, Plug_SetUserInfo,
Plug_MapLog_Query, Plug_MapLog_Query,
#ifdef QUAKEHUD
Plug_GetTeamInfo,
Plug_GetWeaponStats,
Plug_GetTrackerOwnFrags,
#else
NULL,
NULL,
NULL,
#endif
}; };
if (structsize == sizeof(funcs)) if (structsize == sizeof(funcs))
return &funcs; return &funcs;
@ -1930,9 +1942,9 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s
} }
#endif #endif
#ifdef MULTITHREAD #ifdef MULTITHREAD
if (!strcmp(interfacename, "Threading")) if (!strcmp(interfacename, plugthreadfuncs_name))
{ {
static threading_t funcs = static plugthreadfuncs_t funcs =
{ {
Sys_CreateMutex, Sys_CreateMutex,
Sys_LockMutex, Sys_LockMutex,

View File

@ -134,13 +134,14 @@ qboolean Sys_ConditionSignal(void *condv); //lock first
qboolean Sys_ConditionBroadcast(void *condv); //lock first qboolean Sys_ConditionBroadcast(void *condv); //lock first
void Sys_DestroyConditional(void *condv); void Sys_DestroyConditional(void *condv);
typedef struct threading_s typedef struct
{ {
void *(QDECL *CreateMutex)(void); void *(QDECL *CreateMutex)(void);
qboolean (QDECL *LockMutex)(void *mutex); qboolean (QDECL *LockMutex)(void *mutex);
qboolean (QDECL *UnlockMutex)(void *mutex); qboolean (QDECL *UnlockMutex)(void *mutex);
void (QDECL *DestroyMutex)(void *mutex); void (QDECL *DestroyMutex)(void *mutex);
} threading_t; #define plugthreadfuncs_name "Threading"
} plugthreadfuncs_t;
//to try to catch leaks more easily. //to try to catch leaks more easily.
#ifdef USE_MSVCRT_DEBUG #ifdef USE_MSVCRT_DEBUG

View File

@ -304,7 +304,7 @@ $(PLUG_PREFIX)ezhud$(PLUG_NATIVE_EXT): ezhud/ezquakeisms.c ezhud/hud.c ezhud/hud
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Iezhud $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Iezhud $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
NATIVE_PLUGINS+=ezhud NATIVE_PLUGINS+=ezhud
$(PLUG_PREFIX)models$(PLUG_NATIVE_EXT): models/gltf.c models/models.c plugin.c $(PLUG_PREFIX)models$(PLUG_NATIVE_EXT): models/gltf.c models/exportiqm.c models/models.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Imodels $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Imodels $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
#NATIVE_PLUGINS+=models #NATIVE_PLUGINS+=models

View File

@ -5373,7 +5373,7 @@ static void SCR_HUD_DrawTeamInfo(hud_t *hud)
// if ( CURRVIEW != 1 && CURRVIEW != 0) // if ( CURRVIEW != 1 && CURRVIEW != 0)
// return; // return;
slots_num = clientfuncs->GetTeamInfo(ti_clients, countof(ti_clients), hud_teaminfo_show_enemies->ival, hud_teaminfo_show_self->ival?-1:0); slots_num = clientfuncs->GetTeamInfo?clientfuncs->GetTeamInfo(ti_clients, countof(ti_clients), hud_teaminfo_show_enemies->ival, hud_teaminfo_show_self->ival?-1:0):0;
// fill data we require to draw teaminfo // fill data we require to draw teaminfo
for ( maxloc = maxname = i = 0; i < slots_num; i++ ) { for ( maxloc = maxname = i = 0; i < slots_num; i++ ) {
@ -6362,8 +6362,10 @@ void SCR_HUD_DrawOwnFrags(hud_t *hud)
strcpy(ownfragtext, "Own Frags"); strcpy(ownfragtext, "Own Frags");
age = 0; age = 0;
} }
else else if (clientfuncs->GetTrackerOwnFrags)
age = clientfuncs->GetTrackerOwnFrags(0, ownfragtext, sizeof(ownfragtext)); age = clientfuncs->GetTrackerOwnFrags(0, ownfragtext, sizeof(ownfragtext));
else
age = 999999;
width = strlen(ownfragtext)*8; width = strlen(ownfragtext)*8;
width *= hud_ownfrags_scale->value; width *= hud_ownfrags_scale->value;
@ -6410,7 +6412,7 @@ static void SCR_HUD_DrawWeaponStats(hud_t *hud)
int ws; int ws;
struct wstats_s wstats[16]; struct wstats_s wstats[16];
ws = clientfuncs->GetWeaponStats(-1, wstats, countof(wstats)); ws = clientfuncs->GetWeaponStats?clientfuncs->GetWeaponStats(-1, wstats, countof(wstats)):0;
if (hud_editor) if (hud_editor)
{ {

View File

@ -217,9 +217,9 @@ void Mod_ExportIQM(char *fname, int flags, galiasinfo_t *mesh)
struct iqmvertexarray *ovarr; struct iqmvertexarray *ovarr;
struct iqmtriangle *otri; struct iqmtriangle *otri;
struct iqmmesh *omesh; struct iqmmesh *omesh;
struct iqmjoint2 *ojoint; struct iqmjoint2 *ojoint = NULL;
struct iqmanim *oanim; struct iqmanim *oanim = NULL;
struct iqmpose2 *opose; struct iqmpose2 *opose = NULL;
struct struct
{ {
float min[10], max[10], scale[10]; float min[10], max[10], scale[10];
@ -235,9 +235,9 @@ void Mod_ExportIQM(char *fname, int flags, galiasinfo_t *mesh)
vec3_t *onorm = NULL; vec3_t *onorm = NULL;
vec4_t *otang = NULL; vec4_t *otang = NULL;
vec2_t *ost; vec2_t *ost;
bone_vec4_t *oboneidx; bone_vec4_t *oboneidx = NULL;
byte_vec4_t *oboneweight; byte_vec4_t *oboneweight = NULL;
unsigned short *oposedata; unsigned short *oposedata = NULL;
struct iqmheader hdr = {IQM_MAGIC, IQM_VERSION2}, *oh; struct iqmheader hdr = {IQM_MAGIC, IQM_VERSION2}, *oh;
hdr.flags = flags; hdr.flags = flags;
hdr.num_vertexarrays = 4; hdr.num_vertexarrays = 4;

View File

@ -11,13 +11,13 @@
//http://www.zezula.net/en/mpq/main.html //http://www.zezula.net/en/mpq/main.html
//http://www.wc3c.net/tools/specs/QuantamMPQFormat.txt //http://www.wc3c.net/tools/specs/QuantamMPQFormat.txt
size_t activempqcount; //number of active archives. we can't unload the dll while we still have files open. static size_t activempqcount; //number of active archives. we can't unload the dll while we still have files open.
#ifdef MULTITHREAD #ifdef MULTITHREAD
threading_t *threading; static plugthreadfuncs_t *threading;
#define Sys_CreateMutex threading->CreateMutex #define Sys_CreateMutex if(threading)threading->CreateMutex
#define Sys_LockMutex threading->LockMutex #define Sys_LockMutex if(threading)threading->LockMutex
#define Sys_UnlockMutex threading->UnlockMutex #define Sys_UnlockMutex if(threading)threading->UnlockMutex
#define Sys_DestroyMutex threading->DestroyMutex #define Sys_DestroyMutex if(threading)threading->DestroyMutex
#endif #endif
typedef unsigned long long ofs_t; typedef unsigned long long ofs_t;
@ -735,7 +735,7 @@ static int MPQF_readbytes (struct vfsfile_s *file, void *buffer, int bytestoread
{ {
f->sectortab = malloc((numsects+1) * sizeof(*f->sectortab)); f->sectortab = malloc((numsects+1) * sizeof(*f->sectortab));
if (!f->sectortab) if (!f->sectortab)
pSys_Error("out of memory"); plugfuncs->Error("out of memory");
Sys_LockMutex(f->archive->mutex); Sys_LockMutex(f->archive->mutex);
VFS_SEEK(f->archive->file, f->archiveoffset); VFS_SEEK(f->archive->file, f->archiveoffset);
VFS_READ(f->archive->file, f->sectortab, (numsects+1) * sizeof(*f->sectortab)); VFS_READ(f->archive->file, f->sectortab, (numsects+1) * sizeof(*f->sectortab));
@ -749,11 +749,11 @@ static int MPQF_readbytes (struct vfsfile_s *file, void *buffer, int bytestoread
cdata = malloc(rawsize); cdata = malloc(rawsize);
if (!cdata) if (!cdata)
pSys_Error("out of memory"); plugfuncs->Error("out of memory");
if (!f->buffer) if (!f->buffer)
f->buffer = malloc(f->archive->sectorsize); f->buffer = malloc(f->archive->sectorsize);
if (!f->buffer) if (!f->buffer)
pSys_Error("out of memory"); plugfuncs->Error("out of memory");
Sys_LockMutex(f->archive->mutex); Sys_LockMutex(f->archive->mutex);
VFS_SEEK(f->archive->file, f->archiveoffset + f->sectortab[sectidx]); VFS_SEEK(f->archive->file, f->archiveoffset + f->sectortab[sectidx]);
VFS_READ(f->archive->file, cdata, rawsize); VFS_READ(f->archive->file, cdata, rawsize);
@ -898,25 +898,19 @@ qboolean Plug_Init(void)
mpq_init_cryptography(); mpq_init_cryptography();
#ifdef MULTITHREAD #ifdef MULTITHREAD
if (CHECKBUILTIN(Sys_GetThreadingFuncs)) threading = plugfuncs->GetEngineInterface("Threading", sizeof(*threading));
threading = pSys_GetThreadingFuncs(sizeof(*threading));
if (!threading)
{
Con_Printf("mpq: Engine doesn't support threading\n");
return false;
}
#endif #endif
//we can't cope with being closed randomly. files cannot be orphaned safely. //we can't cope with being closed randomly. files cannot be orphaned safely.
//so ask the engine to ensure we don't get closed before everything else is. //so ask the engine to ensure we don't get closed before everything else is.
pPlug_ExportFunction("MayShutdown", NULL); plugfuncs->ExportFunction("MayShutdown", NULL);
if (!pPlug_ExportFunction("FS_RegisterArchiveType_mpq", MPQ_OpenArchive)) if (!plugfuncs->ExportFunction("FS_RegisterArchiveType_mpq", MPQ_OpenArchive))
{ {
Con_Printf("mpq: Engine doesn't support filesystem plugins\n"); Con_Printf("mpq: Engine doesn't support filesystem plugins\n");
return false; return false;
} }
if (!pPlug_ExportFunction("FS_RegisterArchiveType_MPQ", MPQ_OpenArchive)) if (!plugfuncs->ExportFunction("FS_RegisterArchiveType_MPQ", MPQ_OpenArchive))
{ {
Con_Printf("mpq: Engine doesn't support filesystem plugins\n"); Con_Printf("mpq: Engine doesn't support filesystem plugins\n");
return false; return false;

View File

@ -243,12 +243,9 @@ typedef struct //q1 client/network info
{ {
F(int, GetStats, (int seat, unsigned int *stats, int maxstats)); F(int, GetStats, (int seat, unsigned int *stats, int maxstats));
F(void, GetPlayerInfo, (int seat, plugclientinfo_t *info)); F(void, GetPlayerInfo, (int seat, plugclientinfo_t *info));
F(size_t, GetTeamInfo, (teamplayerinfo_t *clients, size_t maxclients, qboolean showenemies, int seat));
F(int, GetWeaponStats, (int player, struct wstats_s *result, size_t maxresults));
F(size_t, GetNetworkInfo, (plugnetinfo_t *ni, size_t sizeofni)); F(size_t, GetNetworkInfo, (plugnetinfo_t *ni, size_t sizeofni));
F(size_t, GetLocalPlayerNumbers,(size_t firstseat, size_t numseats, int *playernums, int *spectracks)); F(size_t, GetLocalPlayerNumbers,(size_t firstseat, size_t numseats, int *playernums, int *spectracks));
F(void, GetLocationName, (const float *pos, char *outbuffer, size_t bufferlen)); F(void, GetLocationName, (const float *pos, char *outbuffer, size_t bufferlen));
F(float, GetTrackerOwnFrags, (int seat, char *text, size_t textsize));
F(qboolean, GetLastInputFrame, (int seat, usercmd_t *outcmd)); F(qboolean, GetLastInputFrame, (int seat, usercmd_t *outcmd));
F(void, GetServerInfo, (char *info, size_t infolen)); F(void, GetServerInfo, (char *info, size_t infolen));
@ -257,6 +254,10 @@ typedef struct //q1 client/network info
//FIXME: does this belong here? //FIXME: does this belong here?
F(qboolean, MapLog_Query, (const char *packagename, const char *mapname, float *stats)); F(qboolean, MapLog_Query, (const char *packagename, const char *mapname, float *stats));
F(size_t, GetTeamInfo, (teamplayerinfo_t *clients, size_t maxclients, qboolean showenemies, int seat));
F(int, GetWeaponStats, (int player, struct wstats_s *result, size_t maxresults));
F(float, GetTrackerOwnFrags, (int seat, char *text, size_t textsize));
#define plugclientfuncs_name "Client" #define plugclientfuncs_name "Client"
} plugclientfuncs_t; } plugclientfuncs_t;