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.
//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
#define ASTC_PUBLIC
#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);
t |= ASTC_readbits2(in, &offset, 2)<<2;
}
else
block[1] = 0;
if (count > 2)
{
block[2] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 1)<<4;
}
else
block[2] = 0;
if (count > 3)
{
block[3] = ASTC_readbits2(in, &offset, bits);
t |= ASTC_readbits2(in, &offset, 2)<<5;
}
else
block[3] = 0;
if (count > 4)
{
block[4] = ASTC_readbits2(in, &offset, bits);
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
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);
t |= ASTC_readbits2(in, &offset, 2)<<3;
}
else
block[1] = 0;
if (count > 2)
{
block[2] = ASTC_readbits2(in, &offset, bits);
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
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;
extern qboolean keydown[];
if (!isdown != (key==K_MOUSE1))
if ((!isdown) != (key==K_MOUSE1))
return false; //don't care about releases, unless mouse1.
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);
#ifdef HAVE_SSL
static int QDECL Plug_Net_SetTLSClient(qhandle_t handle, const char *certhostname)
{
#ifndef HAVE_SSL
return -1;
#else
pluginstream_t *stream;
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 0;
#endif
}
static int QDECL Plug_Net_GetTLSBinding(qhandle_t handle, char *outbinddata, int *outbinddatalen)
{
#ifndef HAVE_SSL
return -1;
#else
pluginstream_t *stream;
size_t sz;
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);
*outbinddatalen = sz;
return r;
}
#endif
}
#endif
#ifdef WEBCLIENT
@ -1843,16 +1849,22 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s
{
Plug_CL_GetStats,
Plug_GetPlayerInfo,
Plug_GetTeamInfo,
Plug_GetWeaponStats,
Plug_GetNetworkInfo,
Plug_GetLocalPlayerNumbers,
Plug_GetLocationName,
Plug_GetTrackerOwnFrags,
Plug_GetLastInputFrame,
Plug_GetServerInfo,
Plug_SetUserInfo,
Plug_MapLog_Query,
#ifdef QUAKEHUD
Plug_GetTeamInfo,
Plug_GetWeaponStats,
Plug_GetTrackerOwnFrags,
#else
NULL,
NULL,
NULL,
#endif
};
if (structsize == sizeof(funcs))
return &funcs;
@ -1930,9 +1942,9 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s
}
#endif
#ifdef MULTITHREAD
if (!strcmp(interfacename, "Threading"))
if (!strcmp(interfacename, plugthreadfuncs_name))
{
static threading_t funcs =
static plugthreadfuncs_t funcs =
{
Sys_CreateMutex,
Sys_LockMutex,

View File

@ -134,13 +134,14 @@ qboolean Sys_ConditionSignal(void *condv); //lock first
qboolean Sys_ConditionBroadcast(void *condv); //lock first
void Sys_DestroyConditional(void *condv);
typedef struct threading_s
typedef struct
{
void *(QDECL *CreateMutex)(void);
qboolean (QDECL *LockMutex)(void *mutex);
qboolean (QDECL *UnlockMutex)(void *mutex);
void (QDECL *DestroyMutex)(void *mutex);
} threading_t;
#define plugthreadfuncs_name "Threading"
} plugthreadfuncs_t;
//to try to catch leaks more easily.
#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)
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)
#NATIVE_PLUGINS+=models

View File

@ -5373,7 +5373,7 @@ static void SCR_HUD_DrawTeamInfo(hud_t *hud)
// if ( CURRVIEW != 1 && CURRVIEW != 0)
// 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
for ( maxloc = maxname = i = 0; i < slots_num; i++ ) {
@ -6362,8 +6362,10 @@ void SCR_HUD_DrawOwnFrags(hud_t *hud)
strcpy(ownfragtext, "Own Frags");
age = 0;
}
else
else if (clientfuncs->GetTrackerOwnFrags)
age = clientfuncs->GetTrackerOwnFrags(0, ownfragtext, sizeof(ownfragtext));
else
age = 999999;
width = strlen(ownfragtext)*8;
width *= hud_ownfrags_scale->value;
@ -6410,7 +6412,7 @@ static void SCR_HUD_DrawWeaponStats(hud_t *hud)
int ws;
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)
{

View File

@ -217,9 +217,9 @@ void Mod_ExportIQM(char *fname, int flags, galiasinfo_t *mesh)
struct iqmvertexarray *ovarr;
struct iqmtriangle *otri;
struct iqmmesh *omesh;
struct iqmjoint2 *ojoint;
struct iqmanim *oanim;
struct iqmpose2 *opose;
struct iqmjoint2 *ojoint = NULL;
struct iqmanim *oanim = NULL;
struct iqmpose2 *opose = NULL;
struct
{
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;
vec4_t *otang = NULL;
vec2_t *ost;
bone_vec4_t *oboneidx;
byte_vec4_t *oboneweight;
unsigned short *oposedata;
bone_vec4_t *oboneidx = NULL;
byte_vec4_t *oboneweight = NULL;
unsigned short *oposedata = NULL;
struct iqmheader hdr = {IQM_MAGIC, IQM_VERSION2}, *oh;
hdr.flags = flags;
hdr.num_vertexarrays = 4;

View File

@ -11,13 +11,13 @@
//http://www.zezula.net/en/mpq/main.html
//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
threading_t *threading;
#define Sys_CreateMutex threading->CreateMutex
#define Sys_LockMutex threading->LockMutex
#define Sys_UnlockMutex threading->UnlockMutex
#define Sys_DestroyMutex threading->DestroyMutex
static plugthreadfuncs_t *threading;
#define Sys_CreateMutex if(threading)threading->CreateMutex
#define Sys_LockMutex if(threading)threading->LockMutex
#define Sys_UnlockMutex if(threading)threading->UnlockMutex
#define Sys_DestroyMutex if(threading)threading->DestroyMutex
#endif
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));
if (!f->sectortab)
pSys_Error("out of memory");
plugfuncs->Error("out of memory");
Sys_LockMutex(f->archive->mutex);
VFS_SEEK(f->archive->file, f->archiveoffset);
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);
if (!cdata)
pSys_Error("out of memory");
plugfuncs->Error("out of memory");
if (!f->buffer)
f->buffer = malloc(f->archive->sectorsize);
if (!f->buffer)
pSys_Error("out of memory");
plugfuncs->Error("out of memory");
Sys_LockMutex(f->archive->mutex);
VFS_SEEK(f->archive->file, f->archiveoffset + f->sectortab[sectidx]);
VFS_READ(f->archive->file, cdata, rawsize);
@ -898,25 +898,19 @@ qboolean Plug_Init(void)
mpq_init_cryptography();
#ifdef MULTITHREAD
if (CHECKBUILTIN(Sys_GetThreadingFuncs))
threading = pSys_GetThreadingFuncs(sizeof(*threading));
if (!threading)
{
Con_Printf("mpq: Engine doesn't support threading\n");
return false;
}
threading = plugfuncs->GetEngineInterface("Threading", sizeof(*threading));
#endif
//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.
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");
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");
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(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, GetLocalPlayerNumbers,(size_t firstseat, size_t numseats, int *playernums, int *spectracks));
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(void, GetServerInfo, (char *info, size_t infolen));
@ -257,6 +254,10 @@ typedef struct //q1 client/network info
//FIXME: does this belong here?
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"
} plugclientfuncs_t;