diff --git a/build_wip.sh b/build_wip.sh index cc0d8ca0..2646b0d1 100755 --- a/build_wip.sh +++ b/build_wip.sh @@ -176,6 +176,8 @@ function build { fi echo -n "Making $NAME... " date > $BUILDLOGFOLDER/$DEST.txt + echo BUILD: $NAME >> $BUILDLOGFOLDER/$DEST.txt + echo PLUGINS: $NATIVE_PLUGINS >> $BUILDLOGFOLDER/$DEST.txt echo make $MAKEARGS $* >> $BUILDLOGFOLDER/$DEST.txt 2>&1 make $MAKEARGS $* >> $BUILDLOGFOLDER/$DEST.txt 2>&1 if [ $? -eq 0 ]; then diff --git a/engine/client/cl_plugin.inc b/engine/client/cl_plugin.inc index e0490ef7..c58edfbc 100644 --- a/engine/client/cl_plugin.inc +++ b/engine/client/cl_plugin.inc @@ -672,7 +672,14 @@ static size_t QDECL Plug_GetServerInfoBlob(const char *key, void *outptr, size_t if (!blob) { //inescapable hacks if (!strcmp(key, "matchstart")) - snprintf(tmp, sizeof(tmp), "%f", cl.playerview[0].statsf[STAT_MATCHSTARTTIME]?cl.playerview[0].statsf[STAT_MATCHSTARTTIME]/1000:cl.matchgametimestart), blob=tmp; + { + float matchstart = cl.matchgametimestart; +#ifdef QUAKEHUD + if (cl.playerview[0].statsf[STAT_MATCHSTARTTIME]) + matchstart = cl.playerview[0].statsf[STAT_MATCHSTARTTIME]/1000; +#endif + snprintf(tmp, sizeof(tmp), "%f", matchstart), blob=tmp; + } else if (!strcmp(key, "demotime")) { extern float demtime; diff --git a/engine/client/m_download.c b/engine/client/m_download.c index 6c88684a..72235c57 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -198,7 +198,9 @@ static char *manifestpackages; //metapackage named by the manicfest. static char *declinedpackages; //metapackage named by the manicfest. static int domanifestinstall; //SECURITY_MANIFEST_* +#ifdef PLUGINS static int pluginsadded; //so we only show prompts for new externally-installed plugins once, instead of every time the file is reloaded. +#endif #ifdef WEBCLIENT static struct @@ -2893,7 +2895,9 @@ static void PM_UpdatePackageList(qboolean autoupdate, int retry) if (autoupdate) { +#ifdef WEBCLIENT doautoupdate = 0; +#endif if (PM_MarkUpdates()) { #ifdef DOWNLOADMENU @@ -5217,6 +5221,7 @@ static void MD_Draw (int x, int y, struct menucustom_s *c, struct emenu_s *m) if (c->dint != downloadablessequence) return; //probably stale +#ifdef WEBCLIENT if (allowphonehome == -2) { allowphonehome = false; @@ -5224,6 +5229,7 @@ static void MD_Draw (int x, int y, struct menucustom_s *c, struct emenu_s *m) Menu_Prompt(PM_AllowPackageListQuery_Callback, NULL, "Query updates list?\n", "Okay", NULL, "Nope", true); #endif } +#endif p = c->dptr; if (p) diff --git a/engine/client/sys_droid.c b/engine/client/sys_droid.c index 888d57f2..2c9bfd90 100644 --- a/engine/client/sys_droid.c +++ b/engine/client/sys_droid.c @@ -105,6 +105,10 @@ void Sys_Vibrate(float count) // vibrateduration += count*10*sys_vibrate.value; } +qboolean INS_KeyToLocalName(int qkey, char *buf, size_t bufsize) +{ //onscreen keyboard? erk. + return false; +} static int mapkey(int androidkey) { switch(androidkey) diff --git a/engine/common/config_fteqw.h b/engine/common/config_fteqw.h index 40d2cffe..74310a79 100644 --- a/engine/common/config_fteqw.h +++ b/engine/common/config_fteqw.h @@ -208,7 +208,9 @@ #ifdef AVAIL_JPEGLIB -DLINK_JPEG #endif -//-DLINK_QUAKE3 //ask the makefile to bake the quake3 plugin into the engine itself. +#if defined(PLUGINS) && (defined(Q3SERVER) || defined(Q3CLIENT)) +-DLINK_QUAKE3 //ask the makefile to bake the quake3 plugin into the engine itself. +#endif //-DNO_OPUS //-DNO_SPEEX //disable static speex diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index a3b259a0..e25f21e0 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -220,9 +220,11 @@ extern qbyte *mod_base; dist = plane->dist - dist; \ break; +#ifdef Q2BSPS #ifdef HAVE_CLIENT static unsigned char q2_palette[256*3]; #endif +#endif /* @@ -1285,7 +1287,7 @@ static qboolean CModQ2_LoadSurfaces (model_t *mod, qbyte *mod_base, lump_t *l) return true; } -#ifndef SERVERONLY +#ifdef HAVE_CLIENT static texture_t *Mod_LoadWall(model_t *loadmodel, char *mapname, char *texname, char *shadername, unsigned int imageflags) { char name[MAX_QPATH]; diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index b52dac18..096b54c9 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -7234,7 +7234,7 @@ static qboolean FTENET_WebRTC_GetPacket(ftenet_generic_connection_t *gcon) const char *s; char *p; - MSG_BeginReading(msg_nullnetprim); + MSG_BeginReading(&net_message, msg_nullnetprim); cmd = MSG_ReadByte(); cl = MSG_ReadShort(); diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 94e3d3c1..beb59271 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -9,10 +9,12 @@ #define FTEENGINE #include "../plugins/plugin.h" +#ifdef PLUGINS + +#if defined(Q3SERVER)||defined(Q3CLIENT) struct q3gamecode_s *q3; static struct plugin_s *q3plug; - -#ifdef PLUGINS +#endif #define Q_snprintf Q_snprintfz #define Q_strlcpy Q_strncpyz @@ -1588,11 +1590,13 @@ void Plug_Close(plugin_t *plug) FS_UnRegisterFileSystemModule(plug); Mod_UnRegisterAllModelFormats(plug); +#if defined(Q3SERVER)||defined(Q3CLIENT) if (q3plug == plug) { q3 = NULL; q3plug = NULL; } +#endif //tell the plugin that everything is closed and that it should free up any lingering memory/stuff //it is still allowed to create/have open files. diff --git a/engine/common/sys.h b/engine/common/sys.h index 867d91b0..534d48ca 100644 --- a/engine/common/sys.h +++ b/engine/common/sys.h @@ -116,6 +116,25 @@ qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refres #define FTE_Atomic32_Dec(ptr) FTE_Atomic32Mutex_Add(ptr, -1) #endif + +typedef enum wgroup_e +{ + WG_MAIN = 0, + WG_LOADER = 1, + WG_COUNT = 2 //main and loaders +} wgroup_t; +typedef struct +{ + void *(QDECL *CreateMutex)(void); + qboolean (QDECL *LockMutex)(void *mutex); + qboolean (QDECL *UnlockMutex)(void *mutex); + void (QDECL *DestroyMutex)(void *mutex); + + void (*AddWork)(wgroup_t thread, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b); //low priority + void (*WaitForCompletion)(void *priorityctx, int *address, int sleepwhilevalue); +#define plugthreadfuncs_name "Threading" +} plugthreadfuncs_t; + #ifdef MULTITHREAD #if defined(_WIN32) && defined(_DEBUG) void Sys_SetThreadName(unsigned int dwThreadID, char *threadName); @@ -149,24 +168,6 @@ qboolean Sys_ConditionSignal(void *condv); //lock first qboolean Sys_ConditionBroadcast(void *condv); //lock first void Sys_DestroyConditional(void *condv); -typedef enum wgroup_e -{ - WG_MAIN = 0, - WG_LOADER = 1, - WG_COUNT = 2 //main and loaders -} wgroup_t; -typedef struct -{ - void *(QDECL *CreateMutex)(void); - qboolean (QDECL *LockMutex)(void *mutex); - qboolean (QDECL *UnlockMutex)(void *mutex); - void (QDECL *DestroyMutex)(void *mutex); - - void (*AddWork)(wgroup_t thread, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b); //low priority - void (*WaitForCompletion)(void *priorityctx, int *address, int sleepwhilevalue); -#define plugthreadfuncs_name "Threading" -} plugthreadfuncs_t; - //to try to catch leaks more easily. #ifdef USE_MSVCRT_DEBUG void *Sys_CreateMutexNamed(char *file, int line); diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 6e9ef9bb..e150ab41 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -4526,7 +4526,7 @@ static void QCBUILTIN PF_getsoundindex (pubprogfuncs_t *prinst, struct globalvar static void QCBUILTIN PF_soundnameforindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { int idx = G_FLOAT(OFS_PARM0); - if (idx >= 0 && idx < MAX_PRECACHE_SOUNDS && sv.strings.sound_precache) + if (idx >= 0 && idx < MAX_PRECACHE_SOUNDS && sv.strings.sound_precache[idx]) RETURN_TSTRING(sv.strings.sound_precache[idx]); else G_INT(OFS_RETURN) = 0; @@ -4625,7 +4625,7 @@ static void QCBUILTIN PF_getmodelindex (pubprogfuncs_t *prinst, struct globalvar static void QCBUILTIN PF_modelnameforindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { int idx = G_FLOAT(OFS_PARM0); - if (idx >= 0 && idx < MAX_PRECACHE_MODELS && sv.strings.model_precache) + if (idx >= 0 && idx < MAX_PRECACHE_MODELS && sv.strings.model_precache[idx]) RETURN_TSTRING(sv.strings.model_precache[idx]); else G_INT(OFS_RETURN) = 0; diff --git a/engine/web/ftejslib.js b/engine/web/ftejslib.js index d991594e..3a4f5edd 100644 --- a/engine/web/ftejslib.js +++ b/engine/web/ftejslib.js @@ -101,7 +101,7 @@ mergeInto(LibraryManager.library, blen = lengthBytesUTF8(mime)+1; let mimeptr = _malloc(blen); stringToUTF8(mime, mimeptr,blen); - {{{makeDynCall('viii')}}}(FTEC.evcb.loadfile, urlptr, mimeptr, handle); + {{{makeDynCall('viii','FTEC.evcb.loadfile')}}}(urlptr, mimeptr, handle); _free(mimeptr); _free(urlptr); window.focus(); @@ -115,7 +115,7 @@ mergeInto(LibraryManager.library, let blen = lengthBytesUTF8(command)+1; let ptr = _malloc(blen); stringToUTF8(command, ptr, blen); - {{{makeDynCall('vi')}}}(FTEC.evcb.cbufaddtext, ptr); + {{{makeDynCall('vi','FTEC.evcb.cbufaddtext')}}}(ptr); _free(ptr); window.focus(); } @@ -129,7 +129,7 @@ mergeInto(LibraryManager.library, try //this try is needed to handle Host_EndGame properly. { - dovsync = {{{makeDynCall('if')}}}(FTEC.evcb.frame,timestamp); + dovsync = {{{makeDynCall('if','FTEC.evcb.frame')}}}(timestamp); } catch(err) { @@ -153,7 +153,7 @@ mergeInto(LibraryManager.library, case 'resize': if (FTEC.evcb.resize != 0) { - {{{makeDynCall('vii')}}}(FTEC.evcb.resize, Module['canvas'].width, Module['canvas'].height); + {{{makeDynCall('vii','FTEC.evcb.resize')}}}(Module['canvas'].width, Module['canvas'].height); } break; case 'mousemove': @@ -171,12 +171,12 @@ mergeInto(LibraryManager.library, event.movementX = event.webkitMovementX; event.movementY = event.webkitMovementY; } - {{{makeDynCall('viiffff')}}}(FTEC.evcb.mouse, 0, false, event.movementX, event.movementY, 0, 0); + {{{makeDynCall('viiffff','FTEC.evcb.mouse')}}}(0, false, event.movementX, event.movementY, 0, 0); } else { var rect = Module['canvas'].getBoundingClientRect(); - {{{makeDynCall('viiffff')}}}(FTEC.evcb.mouse, 0, true, (event.clientX - rect.left)*(Module['canvas'].width/rect.width), (event.clientY - rect.top)*(Module['canvas'].height/rect.height), 0, 0); + {{{makeDynCall('viiffff','FTEC.evcb.mouse')}}}(0, true, (event.clientX - rect.left)*(Module['canvas'].width/rect.width), (event.clientY - rect.top)*(Module['canvas'].height/rect.height), 0, 0); } } break; @@ -187,7 +187,7 @@ mergeInto(LibraryManager.library, //so lets spam requests for it if (!document.fullscreenElement) if (FTEC.evcb.wantfullscreen != 0) - if ({{{makeDynCall('i')}}}(FTEC.evcb.wantfullscreen)) + if ({{{makeDynCall('i','FTEC.evcb.wantfullscreen')}}}()) { try { @@ -214,7 +214,7 @@ mergeInto(LibraryManager.library, case 'mouseup': if (FTEC.evcb.button != 0) { - {{{makeDynCall('viii')}}}(FTEC.evcb.button, 0, event.type=='mousedown', event.button); + {{{makeDynCall('viii','FTEC.evcb.button')}}}(0, event.type=='mousedown', event.button); event.preventDefault(); } break; @@ -222,7 +222,7 @@ mergeInto(LibraryManager.library, case 'wheel': if (FTEC.evcb.button != 0) { - {{{makeDynCall('viii')}}}(FTEC.evcb.button, 0, 2, event.deltaY); + {{{makeDynCall('viii','FTEC.evcb.button')}}}(0, 2, event.deltaY); event.preventDefault(); } break; @@ -230,16 +230,16 @@ mergeInto(LibraryManager.library, if (FTEC.evcb.button != 0) { for (var i = 0; i < 8; i++) - {{{makeDynCall('viii')}}}(FTEC.evcb.button, 0, false, i); + {{{makeDynCall('viii','FTEC.evcb.button')}}}(0, false, i); } if (FTEC.pointerislocked == -1) FTEC.pointerislocked = 0; break; case 'focus': case 'blur': - {{{makeDynCall('iiiii')}}}(FTEC.evcb.key, 0, false, 16, 0); //shift - {{{makeDynCall('iiiii')}}}(FTEC.evcb.key, 0, false, 17, 0); //alt - {{{makeDynCall('iiiii')}}}(FTEC.evcb.key, 0, false, 18, 0); //ctrl + {{{makeDynCall('iiiii','FTEC.evcb.key')}}}(0, false, 16, 0); //shift + {{{makeDynCall('iiiii','FTEC.evcb.key')}}}(0, false, 17, 0); //alt + {{{makeDynCall('iiiii','FTEC.evcb.key')}}}(0, false, 18, 0); //ctrl if (FTEC.pointerislocked == -1) FTEC.pointerislocked = 0; break; @@ -248,8 +248,8 @@ mergeInto(LibraryManager.library, { if (event.charCode >= 122 && event.charCode <= 123) //no f11/f12 break; - {{{makeDynCall('iiiii')}}}(FTEC.evcb.key, 0, 1, 0, event.charCode); - {{{makeDynCall('iiiii')}}}(FTEC.evcb.key, 0, 0, 0, event.charCode); + {{{makeDynCall('iiiii','FTEC.evcb.key')}}}(0, 1, 0, event.charCode); + {{{makeDynCall('iiiii','FTEC.evcb.key')}}}(0, 0, 0, event.charCode); event.preventDefault(); event.stopPropagation(); } @@ -260,7 +260,7 @@ mergeInto(LibraryManager.library, //we don't steal that because its impossible to leave it again once used. if (FTEC.evcb.key != 0 && event.keyCode != 122) { - if ({{{makeDynCall('iiiii')}}}(FTEC.evcb.key, 0, event.type=='keydown', event.keyCode, 0)) + if ({{{makeDynCall('iiiii','FTEC.evcb.key')}}}(0, event.type=='keydown', event.keyCode, 0)) event.preventDefault(); } break; @@ -274,13 +274,13 @@ mergeInto(LibraryManager.library, { var t = touches[i]; if (FTEC.evcb.mouse) - {{{makeDynCall('viiffff')}}}(FTEC.evcb.mouse, t.identifier+1, true, t.pageX, t.pageY, 0, Math.sqrt(t.radiusX*t.radiusX+t.radiusY*t.radiusY)); + {{{makeDynCall('viiffff','FTEC.evcb.mouse')}}}(t.identifier+1, true, t.pageX, t.pageY, 0, Math.sqrt(t.radiusX*t.radiusX+t.radiusY*t.radiusY)); if (FTEC.evcb.button) { if (event.type == 'touchstart') - {{{makeDynCall('viii')}}}(FTEC.evcb.button, t.identifier+1, 1, 0); + {{{makeDynCall('viii','FTEC.evcb.button')}}}(t.identifier+1, 1, 0); else if (event.type != 'touchmove') - {{{makeDynCall('viii')}}}(FTEC.evcb.button, t.identifier+1, 0, 0); + {{{makeDynCall('viii','FTEC.evcb.button')}}}(t.identifier+1, 0, 0); } } event.preventDefault(); @@ -317,10 +317,10 @@ mergeInto(LibraryManager.library, delete FTEH.gamepads[gp.index]; if (FTEC.evcb.jaxis) //try and clear out the axis when released. for (var j = 0; j < 6; j+=1) - {{{makeDynCall('viifi')}}}(FTEC.evcb.jaxis, gp.index, j, 0, true); + {{{makeDynCall('viifi','FTEC.evcb.jaxis')}}}(gp.index, j, 0, true); if (FTEC.evcb.jbutton) //try and clear out the axis when released. for (var j = 0; j < 32+4; j+=1) - {{{makeDynCall('viiii')}}}(FTEC.evcb.jbutton, gp.index, j, 0, true); + {{{makeDynCall('viiii','FTEC.evcb.jbutton')}}}(gp.index, j, 0, true); console.log("Gamepad disconnected from index %d: %s", gp.index, gp.id); break; case 'pointerlockerror': @@ -390,11 +390,11 @@ mergeInto(LibraryManager.library, if (b.lastframe != p) { //cache it to avoid spam b.lastframe = p; - {{{makeDynCall('viiii')}}}(FTEC.evcb.jbutton, gp.index, j, p, gp.mapping=="standard"); + {{{makeDynCall('viiii','FTEC.evcb.jbutton')}}}(gp.index, j, p, gp.mapping=="standard"); } } for (var j = 0; j < gp.axes.length; j+=1) - {{{makeDynCall('viifi')}}}(FTEC.evcb.jaxis, gp.index, j, gp.axes[j], gp.mapping=="standard"); + {{{makeDynCall('viifi','FTEC.evcb.jaxis')}}}(gp.index, j, gp.axes[j], gp.mapping=="standard"); } }, emscriptenfte_setupcanvas__deps: ['$FTEC', '$Browser', 'emscriptenfte_buf_createfromarraybuf'], @@ -477,7 +477,7 @@ mergeInto(LibraryManager.library, Browser.setCanvasSize(rect.width, rect.height, false); } if (FTEC.evcb.resize != 0) - {{{makeDynCall('vii')}}}(FTEC.evcb.resize, Module['canvas'].width, Module['canvas'].height); + {{{makeDynCall('vii','FTEC.evcb.resize')}}}(Module['canvas'].width, Module['canvas'].height); }; window.onresize(); @@ -635,7 +635,7 @@ mergeInto(LibraryManager.library, for (i = 0; i < c; i++) { stringToUTF8(n[i], ctx, sz); - {{{makeDynCall('vii')}}}(cb, ctx, FTEH.f[n[i]].l); + {{{makeDynCall('vii','cb')}}}(ctx, FTEH.f[n[i]].l); } }, emscriptenfte_buf_pushtolocalstore : function(handle) @@ -835,7 +835,7 @@ mergeInto(LibraryManager.library, var stringlen = (stringdata.length*3)+1; var dataptr = _malloc(stringlen); stringToUTF8(stringdata, dataptr, stringlen); - {{{makeDynCall('viiii')}}}(callback, ctxp,ctxi,evtype,dataptr); + {{{makeDynCall('viiii','callback')}}}(ctxp,ctxi,evtype,dataptr); _free(dataptr); } }; @@ -981,7 +981,7 @@ mergeInto(LibraryManager.library, catch(e) { if (onerror) - {{{makeDynCall('vii')}}}(onerror, ctx, 404); + {{{makeDynCall('vii','onerror')}}}(ctx, 404); return; } http.responseType = 'arraybuffer'; @@ -992,12 +992,12 @@ mergeInto(LibraryManager.library, if (http.status == 200) { if (onload) - {{{makeDynCall('vii')}}}(onload, ctx, _emscriptenfte_buf_createfromarraybuf(http.response)); + {{{makeDynCall('vii','onload')}}}(ctx, _emscriptenfte_buf_createfromarraybuf(http.response)); } else { if (onerror) - {{{makeDynCall('vii')}}}(onerror, ctx, http.status); + {{{makeDynCall('vii','onerror')}}}(ctx, http.status); } }; @@ -1005,13 +1005,13 @@ mergeInto(LibraryManager.library, { //console.log("onerror: " + _url); if (onerror) - {{{makeDynCall('vii')}}}(onerror, ctx, 0); + {{{makeDynCall('vii','onerror')}}}(ctx, 0); }; http.onprogress = function(e) { if (onprogress) - {{{makeDynCall('viii')}}}(onprogress, ctx, e.loaded, e.total); + {{{makeDynCall('viii','onprogress')}}}(ctx, e.loaded, e.total); }; try //ffs @@ -1135,7 +1135,7 @@ mergeInto(LibraryManager.library, let stringlen = (text.length*3)+1; let dataptr = _malloc(stringlen); stringToUTF8(text, dataptr, stringlen); - {{{makeDynCall('vii')}}}(callback, ctx, dataptr); + {{{makeDynCall('vii','callback')}}}(ctx, dataptr); _free(dataptr); }catch(e){ } diff --git a/plugins/Makefile b/plugins/Makefile index d2d68238..6a40d885 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -397,7 +397,7 @@ QUAKE3FILES=$(BOTLIBFILES) \ quake3/svq3_game.c \ quake3/q3common.c $(PLUG_PREFIX)quake3$(PLUG_NATIVE_EXT): ${QUAKE3FILES} - $(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -DBOTLIB -DBOTLIB_STATIC -o $@ -shared $(PLUG_CFLAGS) $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS_ZLIB) $(PLUG_LDFLAGS) + $(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -DMULTITHREAD -DBOTLIB -DBOTLIB_STATIC -o $@ -shared $(PLUG_CFLAGS) $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS_ZLIB) $(PLUG_LDFLAGS) $(call EMBEDMETA,quake3,$@,Quake3 Compat,Quake3 Gamecode Compatibility) NATIVE_PLUGINS+=quake3 diff --git a/plugins/quake3/clq3_cg.c b/plugins/quake3/clq3_cg.c index 6043905d..3ecf6d23 100644 --- a/plugins/quake3/clq3_cg.c +++ b/plugins/quake3/clq3_cg.c @@ -833,8 +833,8 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con { if (mod->loadstate == MLS_NOTLOADED) scenefuncs->LoadModel(mod->publicname, MLV_SILENTSYNC); - if (mod->loadstate == MLS_LOADING) - COM_WorkerPartialSync(mod, &mod->loadstate, MLS_LOADING); + if (mod->loadstate == MLS_LOADING && threadfuncs) + threadfuncs->WaitForCompletion(mod, &mod->loadstate, MLS_LOADING); if (mod->loadstate != MLS_LOADED) { memset(results, 0, sizeof(*results)); @@ -905,8 +905,8 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con model_t *mod = scenefuncs->ModelFromId(arg[0]); if (mod) { - if (mod->loadstate == MLS_LOADING) - COM_WorkerPartialSync(mod, &mod->loadstate, MLS_LOADING); + if (mod->loadstate == MLS_LOADING && threadfuncs) + threadfuncs->WaitForCompletion(mod, &mod->loadstate, MLS_LOADING); VectorCopy(mod->mins, ((float*)VM_POINTER(arg[1]))); VectorCopy(mod->maxs, ((float*)VM_POINTER(arg[2]))); diff --git a/plugins/quake3/q3common.c b/plugins/quake3/q3common.c index f077989b..fb6877f2 100644 --- a/plugins/quake3/q3common.c +++ b/plugins/quake3/q3common.c @@ -9,6 +9,7 @@ plugclientfuncs_t *clientfuncs; plugmsgfuncs_t *msgfuncs; plugworldfuncs_t *worldfuncs; plugmasterfuncs_t *masterfuncs; +plugthreadfuncs_t *threadfuncs; #ifndef STATIC_Q3 double realtime; @@ -1722,8 +1723,9 @@ qboolean Plug_Init(void) fsfuncs = plugfuncs->GetEngineInterface(plugfsfuncs_name, sizeof(*fsfuncs)); msgfuncs = plugfuncs->GetEngineInterface(plugmsgfuncs_name, sizeof(*msgfuncs)); worldfuncs = plugfuncs->GetEngineInterface(plugworldfuncs_name, sizeof(*worldfuncs)); + threadfuncs = plugfuncs->GetEngineInterface(plugthreadfuncs_name, sizeof(*threadfuncs)); - if (!vmfuncs || !fsfuncs || !msgfuncs || !worldfuncs) + if (!vmfuncs || !fsfuncs || !msgfuncs || !worldfuncs/* || !threadfuncs -- checked on use*/) { Con_Printf("Engine functionality missing, cannot enable q3 gamecode support.\n"); return false; @@ -1745,7 +1747,7 @@ qboolean Plug_Init(void) clientfuncs = plugfuncs->GetEngineInterface(plugclientfuncs_name, sizeof(*clientfuncs)); audiofuncs = plugfuncs->GetEngineInterface(plugaudiofuncs_name, sizeof(*audiofuncs)); masterfuncs = plugfuncs->GetEngineInterface(plugmasterfuncs_name, sizeof(*masterfuncs)); - if (drawfuncs && scenefuncs && inputfuncs && audiofuncs && masterfuncs && clientfuncs) + if (drawfuncs && scenefuncs && inputfuncs && clientfuncs && audiofuncs && masterfuncs) UI_Init(); return true; } diff --git a/plugins/quake3/q3common.h b/plugins/quake3/q3common.h index 2e575569..85d8d2f1 100644 --- a/plugins/quake3/q3common.h +++ b/plugins/quake3/q3common.h @@ -17,6 +17,7 @@ extern plugq3vmfuncs_t *vmfuncs; extern plugfsfuncs_t *fsfuncs; extern plugmsgfuncs_t *msgfuncs; extern plugworldfuncs_t *worldfuncs; +extern plugthreadfuncs_t *threadfuncs; extern cvar_t *sv_maxclients; extern cvar_t *cl_shownet_ptr, *cl_c2sdupe_ptr, *cl_nodelta_ptr;