From b91b32cd38ae693dfd5d7af4ad375d8655dd8c6c Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 29 Oct 2011 19:01:33 +0000 Subject: [PATCH] Just breaking stuff, trying to get axfte stuff working. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3916 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile | 6 +- engine/client/m_options.c | 2 +- engine/client/merged.h | 24 +++++++- engine/client/render.h | 23 -------- engine/client/sys_axfte.cpp | 52 ++++++++++++----- engine/common/common.c | 6 -- engine/common/pr_bgcmd.c | 2 + engine/common/world.h | 1 + engine/server/pr_cmds.c | 2 - engine/server/sv_main.c | 27 +-------- engine/server/sv_phys.c | 113 ++++++++++++++++++++++-------------- 11 files changed, 138 insertions(+), 120 deletions(-) diff --git a/engine/Makefile b/engine/Makefile index f25094370..d0919bbe0 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -263,7 +263,6 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -v win),) endif IMAGELDFLAGS=$(MINGW_LIBS_DIR)/libpng.a $(MINGW_LIBS_DIR)/libz.a $(MINGW_LIBS_DIR)/libjpeg.a - RELEASE_CFLAGS=$(CPUOPTIMIZATIONS) ifeq ($(shell echo $(FTE_TARGET)|grep -v -i _SDL),) RELEASE_CFLAGS+= -D_SDL @@ -293,6 +292,7 @@ CLIENT_ONLY_CFLAGS=-DCLIENTONLY SERVER_ONLY_CFLAGS=-DSERVERONLY JOINT_CFLAGS= DEBUG_CFLAGS=-ggdb -g +RELEASE_CFLAGS?=-O3 -ffast-math $(CPUOPTIMIZATIONS) #incase our compiler doesn't support it (mingw) ifeq ($(shell $(CC) -rdynamic 2>&1 | grep unrecognised),) @@ -444,7 +444,6 @@ SERVER_OBJS = \ sv_nchan.o \ sv_ents.o \ sv_send.o \ - sv_phys.o \ sv_user.o \ sv_mvd.o \ sv_ccmds.o \ @@ -493,6 +492,7 @@ COMMON_OBJS = \ glmod_doom.o \ q3common.o \ world.o \ + sv_phys.o \ sv_move.o \ pmove.o \ pmovetst.o \ @@ -667,7 +667,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -v "win(32|64)$$"),) NPFTECL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_npfte.o sys_axfte.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START) NPFTE_DLL_NAME=../npfte$(BITS).dll NPFTECL_DLL_NAME=../npftecl$(BITS).dll - NPFTE_LDFLAGS=--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -shared + NPFTE_LDFLAGS=-Wl,--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -loleaut32 -luuid -lstdc++ -shared NPFTE_CFLAGS=$(NPFTECFLAGS) $(GLCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD NPFTEB_DIR=npfte_mgw$(BITS) NPFTECL_DIR=npqtvcl_mgw$(BITS) diff --git a/engine/client/m_options.c b/engine/client/m_options.c index d60372613..a48e6c945 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -442,7 +442,7 @@ const char *presetexec[] = "r_particlesystem classic;" #else "r_particlesystem script;" - "r_particledesc highfps;" + "r_particledesc classic;" #endif "r_drawflat 0;" "r_nolerp 0;" diff --git a/engine/client/merged.h b/engine/client/merged.h index 0263e330c..bb9cca1d5 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -183,7 +183,29 @@ typedef struct texid_s texid_tf; #define TEXASSIGNF(d,s) memcpy(&d,&s,sizeof(d)) #define TEXVALID(t) 1 #endif -typedef enum uploadfmt uploadfmt_t; +typedef enum uploadfmt +{ + TF_INVALID, + TF_RGBA32, /*rgba byte order*/ + TF_BGRA32, /*bgra byte order*/ + TF_RGBX32, /*rgb byte order, with extra wasted byte after blue*/ + TF_RGB24, /*bgr byte order, no alpha channel nor pad, and top down*/ + TF_BGR24_FLIP, /*bgr byte order, no alpha channel nor pad, and bottom up*/ + TF_SOLID8, /*8bit quake-palette image*/ + TF_TRANS8, /*8bit quake-palette image, index 255=transparent*/ + TF_TRANS8_FULLBRIGHT, /*fullbright 8 - fullbright texels have alpha 255, everything else 0*/ + TF_HEIGHT8, /*image data is greyscale, convert to a normalmap and load that, uploaded alpha contains the original heights*/ + TF_HEIGHT8PAL, /*source data is palette values rather than actual heights, generate a fallback heightmap*/ + TF_H2_T7G1, /*8bit data, odd indexes give greyscale transparence*/ + TF_H2_TRANS8_0, /*8bit data, 0 is transparent, not 255*/ + TF_H2_T4A4, /*8bit data, weird packing*/ + + /*anything below requires a palette*/ + TF_PALETTES, + TF_8PAL24, + TF_8PAL32 +} uploadfmt_t; + //not all modes accept meshes - STENCIL(intentional) and DEPTHONLY(not implemented) typedef enum backendmode_e { diff --git a/engine/client/render.h b/engine/client/render.h index ae25bfee2..2cf87db44 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -276,29 +276,6 @@ enum imageflags IF_SUBDIRONLY = 1<<31 }; -enum uploadfmt -{ - TF_INVALID, - TF_RGBA32, /*rgba byte order*/ - TF_BGRA32, /*bgra byte order*/ - TF_RGBX32, /*rgb byte order, with extra wasted byte after blue*/ - TF_RGB24, /*bgr byte order, no alpha channel nor pad, and top down*/ - TF_BGR24_FLIP, /*bgr byte order, no alpha channel nor pad, and bottom up*/ - TF_SOLID8, /*8bit quake-palette image*/ - TF_TRANS8, /*8bit quake-palette image, index 255=transparent*/ - TF_TRANS8_FULLBRIGHT, /*fullbright 8 - fullbright texels have alpha 255, everything else 0*/ - TF_HEIGHT8, /*image data is greyscale, convert to a normalmap and load that, uploaded alpha contains the original heights*/ - TF_HEIGHT8PAL, /*source data is palette values rather than actual heights, generate a fallback heightmap*/ - TF_H2_T7G1, /*8bit data, odd indexes give greyscale transparence*/ - TF_H2_TRANS8_0, /*8bit data, 0 is transparent, not 255*/ - TF_H2_T4A4, /*8bit data, weird packing*/ - - /*anything below requires a palette*/ - TF_PALETTES, - TF_8PAL24, - TF_8PAL32 -}; - #define R_LoadTexture8(id,w,h,d,f,t) R_LoadTexture(id,w,h,t?TF_TRANS8:TF_SOLID8,d,f) #define R_LoadTexture32(id,w,h,d,f) R_LoadTexture(id,w,h,TF_RGBA32,d,f) #define R_LoadTextureFB(id,w,h,d,f) R_LoadTexture(id,w,h,TF_TRANS8_FULLBRIGHT,d,f) diff --git a/engine/client/sys_axfte.cpp b/engine/client/sys_axfte.cpp index c72afc144..15f5db7ac 100644 --- a/engine/client/sys_axfte.cpp +++ b/engine/client/sys_axfte.cpp @@ -3,17 +3,39 @@ #ifdef _WIN32 #include "sys_plugfte.h" +#include #include /*IObjectSafety*/ #include /*DISPID_SECURITYCTX*/ #include /*common dispid values*/ +#ifndef DISPID_READYSTATE +/*my oldctl.h is too old*/ +#define DISPID_READYSTATE -525 +#endif +#ifndef __IOleInPlaceObjectWindowless_INTERFACE_DEFINED__ +/*mshtmdid.h didn't declare this, so fall back*/ +#define IID_IOleInPlaceObjectWindowless IID_IOleInPlaceObject +#define IOleInPlaceObjectWindowless IOleInPlaceObject +#endif + +#ifndef __IOleInPlaceSiteWindowless_INTERFACE_DEFINED__ +#define IOleInPlaceSiteWindowless IOleInPlaceSite +#define IID_IOleInPlaceSiteWindowless IID_IOleInPlaceSite +#endif + const GUID axfte_iid = {0x7d676c9f, 0xfb84, 0x40b6, {0xb3, 0xff, 0xe1, 0x08, 0x31, 0x55, 0x7e, 0xeb}}; #define axfte_iid_str "7d676c9f-fb84-40b6-b3ff-e10831557eeb" -extern "C" extern HINSTANCE global_hInstance; +extern "C" +{ + extern HINSTANCE global_hInstance; +} +#ifdef _MSC_VER #pragma warning(disable:4584) /*shush now*/ -class axfte : public IUnknown, public IDispatch, public IClassFactory, public IObjectSafety, +#endif + +class axfte : public IDispatch, public IClassFactory, public IObjectSafety, public IOleObject, public IOleInPlaceObjectWindowless, public IViewObject, public IPersistPropertyBag2 { private: @@ -42,7 +64,7 @@ public: } static void statuschanged(void *arg) { - axfte *fte = (axfte*)arg; + //axfte *fte = (axfte*)arg; InvalidateRect(NULL, NULL, FALSE); } @@ -52,7 +74,7 @@ public: *ppvObject = NULL; if (riid == IID_IUnknown) { - *ppvObject = (IUnknown*)this; + *ppvObject = (IUnknown*)(IDispatch*)this; ((LPUNKNOWN)*ppvObject)->AddRef(); return S_OK; } @@ -165,7 +187,7 @@ public: { char tmp[1024]; HRESULT ret = S_OK; - int i; + UINT i; int prop; for (i = 0; i < cNames; i++) { @@ -236,7 +258,7 @@ public: else { char tmp[1024]; - sprintf(tmp, "DISPATCH_PROPERTYGET dispIdMember=%i", dispIdMember); + sprintf(tmp, "DISPATCH_PROPERTYGET dispIdMember=%i", (unsigned int)dispIdMember); OutputDebugStringA(tmp); return DISP_E_MEMBERNOTFOUND; } @@ -270,7 +292,7 @@ public: else { char tmp[1024]; - sprintf(tmp, "DISPATCH_PROPERTYPUT dispIdMember=%i", dispIdMember); + sprintf(tmp, "DISPATCH_PROPERTYPUT dispIdMember=%i", (unsigned int)dispIdMember); OutputDebugStringA(tmp); return DISP_E_MEMBERNOTFOUND; } @@ -278,7 +300,7 @@ public: else if (wFlags & DISPATCH_PROPERTYPUTREF) { char tmp[1024]; - sprintf(tmp, "DISPATCH_PROPERTYPUTREF dispIdMember=%i", dispIdMember); + sprintf(tmp, "DISPATCH_PROPERTYPUTREF dispIdMember=%i", (unsigned int)dispIdMember); OutputDebugStringA(tmp); return DISP_E_MEMBERNOTFOUND; } @@ -478,7 +500,11 @@ public: phwnd = frameinfo.hwndFrame; funcs->ChangeWindow(plug, frameinfo.hwndFrame, lprcPosRect->left, lprcPosRect->top, lprcPosRect->right - lprcPosRect->left, lprcPosRect->bottom - lprcPosRect->top); + #ifndef __IOleInPlaceSiteWindowless_INTERFACE_DEFINED__ + oipc->OnInPlaceActivate(); + #else oipc->OnInPlaceActivateEx(NULL, 1); + #endif oipc->Release(); } break; @@ -682,9 +708,9 @@ public: { PROPBAG2 prop[] = { - {PROPBAG2_TYPE_DATA, VT_BSTR, 0, 0, L"splash", NULL}, - {PROPBAG2_TYPE_DATA, VT_BSTR, 0, 0, L"game", NULL}, - {PROPBAG2_TYPE_DATA, VT_BSTR, 0, 0, L"dataDownload", NULL} + {PROPBAG2_TYPE_DATA, VT_BSTR, 0, 0, (WCHAR *)L"splash", {0}}, + {PROPBAG2_TYPE_DATA, VT_BSTR, 0, 0, (WCHAR *)L"game", {0}}, + {PROPBAG2_TYPE_DATA, VT_BSTR, 0, 0, (WCHAR *)L"dataDownload", {0}} }; VARIANT val[sizeof(prop)/sizeof(prop[0])]; HRESULT res[sizeof(prop)/sizeof(prop[0])]; @@ -742,8 +768,8 @@ HRESULT WINAPI DllCanUnloadNow(void) struct { - char *key; - char *value; + const char *key; + const char *value; } regkeys[] = { {"Software\\Classes\\FTE.FTEPlug\\", "FTEPlug Class"}, diff --git a/engine/common/common.c b/engine/common/common.c index c75b703da..7bab3a06e 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -3141,8 +3141,6 @@ void COM_Version_f (void) Con_TPrintf (TL_EXEDATETIME, __DATE__, __TIME__); #ifdef SVNREVISION - #define STRINGIFY2(arg) #arg - #define STRINGIFY(arg) STRINGIFY2(arg) Con_Printf("SVN Revision: %s\n",STRINGIFY(SVNREVISION)); #endif @@ -4376,11 +4374,7 @@ char *version_string(void) #ifdef OFFICIAL_RELEASE Q_snprintfz(s, sizeof(s), "%s v%i.%02i", DISTRIBUTION, FTE_VER_MAJOR, FTE_VER_MINOR); #elif defined(SVNREVISION) -#define STRINGIFY2(arg) #arg -#define STRINGIFY(arg) STRINGIFY2(arg) Q_snprintfz(s, sizeof(s), "%s SVN %s", DISTRIBUTION, STRINGIFY(SVNREVISION)); -#undef STRINGIFY -#undef STRINGIFY2 #else Q_snprintfz(s, sizeof(s), "%s build %s", DISTRIBUTION, __DATE__); #endif diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index fe804e392..b3d1d032f 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -56,6 +56,8 @@ void PF_Common_RegisterCvars(void) Cvar_Register (&pr_tempstringcount, cvargroup_progs); Cvar_Register (&pr_tempstringsize, cvargroup_progs); Cvar_Register (&dpcompat_stats, cvargroup_progs); + + WPhys_Init(); } char *Translate(char *message); diff --git a/engine/common/world.h b/engine/common/world.h index d9fb1d8e3..386c00e43 100644 --- a/engine/common/world.h +++ b/engine/common/world.h @@ -136,6 +136,7 @@ struct world_s int numareanodes; double physicstime; + unsigned int framenum; int lastcheck; // used by PF_checkclient double lastchecktime; // for monster ai diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 53d8aa05f..5680413ec 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -76,7 +76,6 @@ cvar_t pr_droptofloorunits = CVAR("pr_droptofloorunits", ""); cvar_t sv_gameplayfix_honest_tracelines = CVAR("sv_gameplayfix_honest_tracelines", "1"); cvar_t sv_gameplayfix_blowupfallenzombies = CVAR("sv_gameplayfix_blowupfallenzombies", "0"); -extern cvar_t sv_gameplayfix_noairborncorpse; cvar_t sv_addon[MAXADDONS]; char cvargroup_progs[] = "Progs variables"; @@ -1162,7 +1161,6 @@ void PR_Init(void) Cvar_Register (&sv_gameplayfix_honest_tracelines, cvargroup_progs); Cvar_Register (&sv_gameplayfix_blowupfallenzombies, cvargroup_progs); - Cvar_Register (&sv_gameplayfix_noairborncorpse, cvargroup_progs); #ifdef SQL SQL_Init(); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 7cda657ad..7112990c8 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -3814,18 +3814,8 @@ extern void Log_Init (void); void SV_InitLocal (void) { int i, p; - extern cvar_t sv_maxvelocity; - extern cvar_t sv_gravity; - extern cvar_t sv_aim; - extern cvar_t sv_stopspeed; - extern cvar_t sv_spectatormaxspeed; - extern cvar_t sv_accelerate; - extern cvar_t sv_airaccelerate; - extern cvar_t sv_wateraccelerate; - extern cvar_t sv_friction; - extern cvar_t sv_waterfriction; - extern cvar_t sv_sound_watersplash, sv_sound_land; extern cvar_t pr_allowbutton1; + extern cvar_t sv_aim; extern cvar_t pm_bunnyspeedcap; extern cvar_t pm_ktjump; @@ -3833,7 +3823,6 @@ void SV_InitLocal (void) extern cvar_t pm_airstep; extern cvar_t pm_walljump; extern cvar_t pm_slidyslopes; - extern cvar_t pm_stepheight; SV_InitOperatorCommands (); SV_UserInit (); @@ -3884,19 +3873,6 @@ void SV_InitLocal (void) Cvar_Register (&sv_pupglow, cvargroup_serverinfo); Cvar_Register (&sv_loadentfiles, cvargroup_servercontrol); - Cvar_Register (&sv_maxvelocity, cvargroup_serverphysics); - Cvar_Register (&sv_gravity, cvargroup_serverphysics); - Cvar_Register (&sv_stopspeed, cvargroup_serverphysics); - Cvar_Register (&sv_maxspeed, cvargroup_serverphysics); - Cvar_Register (&sv_spectatormaxspeed, cvargroup_serverphysics); - Cvar_Register (&sv_accelerate, cvargroup_serverphysics); - Cvar_Register (&sv_airaccelerate, cvargroup_serverphysics); - Cvar_Register (&sv_wateraccelerate, cvargroup_serverphysics); - Cvar_Register (&sv_friction, cvargroup_serverphysics); - Cvar_Register (&sv_waterfriction, cvargroup_serverphysics); - Cvar_Register (&sv_sound_watersplash, cvargroup_serverphysics); - Cvar_Register (&sv_sound_land, cvargroup_serverphysics); - Cvar_Register (&sv_bigcoords, cvargroup_serverphysics); Cvar_Register (&pm_bunnyspeedcap, cvargroup_serverphysics); @@ -3905,7 +3881,6 @@ void SV_InitLocal (void) Cvar_Register (&pm_slidyslopes, cvargroup_serverphysics); Cvar_Register (&pm_airstep, cvargroup_serverphysics); Cvar_Register (&pm_walljump, cvargroup_serverphysics); - Cvar_Register (&pm_stepheight, cvargroup_serverphysics); Cvar_Register (&sv_compatiblehulls, cvargroup_serverphysics); diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 88ec6b902..e803aea4b 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // sv_phys.c #include "qwsvdef.h" -#ifndef CLIENTONLY +#if !defined(CLIENTONLY) || defined(CSQC_DAT) #include "pr_common.h" @@ -59,8 +59,11 @@ cvar_t sv_wateraccelerate = SCVAR( "sv_wateraccelerate", "10"); cvar_t sv_friction = SCVAR( "sv_friction", "4"); cvar_t sv_waterfriction = SCVAR( "sv_waterfriction", "4"); cvar_t sv_gameplayfix_noairborncorpse = SCVAR( "sv_gameplayfix_noairborncorpse", "0"); +cvar_t sv_gameplayfix_multiplethinks = CVARD( "sv_gameplayfix_multiplethinks", "1", "Enables multiple thinks per entity per frame so small nextthink times are accurate. QuakeWorld mods expect a value of 1."); cvar_t sv_sound_watersplash = CVAR( "sv_sound_watersplash", "misc/h2ohit1.wav"); cvar_t sv_sound_land = CVAR( "sv_sound_land", "demon/dland2.wav"); +cvar_t sv_stepheight = CVARAF("pm_stepheight", "18", + "sv_stepheight", CVAR_SERVERINFO); cvar_t pm_ktjump = SCVARF("pm_ktjump", "0", CVAR_SERVERINFO); cvar_t pm_bunnyspeedcap = SCVARF("pm_bunnyspeedcap", "0", CVAR_SERVERINFO); @@ -68,15 +71,31 @@ cvar_t pm_slidefix = SCVARF("pm_slidefix", "0", CVAR_SERVERINFO); cvar_t pm_slidyslopes = SCVARF("pm_slidyslopes", "0", CVAR_SERVERINFO); cvar_t pm_airstep = SCVARF("pm_airstep", "0", CVAR_SERVERINFO); cvar_t pm_walljump = SCVARF("pm_walljump", "0", CVAR_SERVERINFO); -cvar_t pm_stepheight = CVARAF("pm_stepheight", "18", - "sv_stepheight", CVAR_SERVERINFO); -extern cvar_t sv_nomsec; +#define cvargroup_serverphysics "server physics variables" +void WPhys_Init(void) +{ + Cvar_Register (&sv_maxvelocity, cvargroup_serverphysics); + Cvar_Register (&sv_gravity, cvargroup_serverphysics); + Cvar_Register (&sv_stopspeed, cvargroup_serverphysics); + Cvar_Register (&sv_maxspeed, cvargroup_serverphysics); + Cvar_Register (&sv_spectatormaxspeed, cvargroup_serverphysics); + Cvar_Register (&sv_accelerate, cvargroup_serverphysics); + Cvar_Register (&sv_airaccelerate, cvargroup_serverphysics); + Cvar_Register (&sv_wateraccelerate, cvargroup_serverphysics); + Cvar_Register (&sv_friction, cvargroup_serverphysics); + Cvar_Register (&sv_waterfriction, cvargroup_serverphysics); + Cvar_Register (&sv_sound_watersplash, cvargroup_serverphysics); + Cvar_Register (&sv_sound_land, cvargroup_serverphysics); + Cvar_Register (&sv_stepheight, cvargroup_serverphysics); + Cvar_Register (&sv_gameplayfix_noairborncorpse, cvargroup_serverphysics); + Cvar_Register (&sv_gameplayfix_multiplethinks, cvargroup_serverphysics); +} #define MOVE_EPSILON 0.01 -static void SV_Physics_Toss (edict_t *ent); +static void WPhys_Physics_Toss (world_t *w, wedict_t *ent); // warning: ‘SV_CheckAllEnts’ defined but not used /* @@ -155,7 +174,7 @@ qboolean WPhys_RunThink (world_t *w, wedict_t *ent) { float thinktime; - if (sv_nomsec.ival>=2) //try and imitate nq as closeley as possible + if (!sv_gameplayfix_multiplethinks.ival) //try and imitate nq as closeley as possible { thinktime = ent->v->nextthink; if (thinktime <= 0 || thinktime > w->physicstime + host_frametime) @@ -166,20 +185,8 @@ qboolean WPhys_RunThink (world_t *w, wedict_t *ent) // it is possible to start that way // by a trigger with a local time. ent->v->nextthink = 0; -#if 1 *w->g.time = thinktime; w->Event_Think(w, ent); -#else - pr_global_struct->time = thinktime; - pr_global_struct->self = EDICT_TO_PROG(w->progs, ent); - pr_global_struct->other = EDICT_TO_PROG(w->progs, w->edicts); -#ifdef VM_Q1 - if (svs.gametype == GT_Q1QVM) - Q1QVM_Think(); - else -#endif - PR_ExecuteProgram (svprogfuncs, ent->v->think); -#endif return !ent->isfree; } @@ -197,20 +204,8 @@ qboolean WPhys_RunThink (world_t *w, wedict_t *ent) // by a trigger with a local time. ent->v->nextthink = 0; -#if 1 *w->g.time = thinktime; w->Event_Think(w, ent); -#else - pr_global_struct->time = thinktime; - pr_global_struct->self = EDICT_TO_PROG(w->progs, ent); - pr_global_struct->other = EDICT_TO_PROG(w->progs, w->edicts); -#ifdef VM_Q1 - if (svs.gametype == GT_Q1QVM) - Q1QVM_Think(); - else -#endif - PR_ExecuteProgram (svprogfuncs, ent->v->think); -#endif if (ent->isfree) return false; @@ -333,12 +328,12 @@ static int WPhys_FlyMove (world_t *w, wedict_t *ent, float time, trace_t *steptr break; // moved the entire distance if (!trace.ent) - SV_Error ("SV_FlyMove: !trace.ent"); + Host_Error ("SV_FlyMove: !trace.ent"); if (trace.plane.normal[2] > 0.7) { blocked |= 1; // floor - if (((edict_t *)trace.ent)->v->solid == SOLID_BSP) + if (((wedict_t *)trace.ent)->v->solid == SOLID_BSP) { ent->v->flags = (int)ent->v->flags | FL_ONGROUND; ent->v->groundentity = EDICT_TO_PROG(w->progs, trace.ent); @@ -451,7 +446,12 @@ SV_AddGravity */ static void WPhys_AddGravity (wedict_t *ent, float scale) { - if (!scale && progstype != PROG_QW) + if (!scale +#ifndef CLIENTONLY +#pragma warningmsg("This doesn't do csqc properly") + && progstype != PROG_QW +#endif +) scale = 1; ent->v->velocity[2] -= scale * sv_gravity.value/*movevars.gravity*/ * host_frametime; } @@ -1075,6 +1075,7 @@ static void WPhys_Physics_Toss (world_t *w, wedict_t *ent) float backoff; vec3_t temporg; + int fl; WPhys_CheckVelocity (w, ent); @@ -1116,7 +1117,14 @@ static void WPhys_Physics_Toss (world_t *w, wedict_t *ent) VectorCopy(ent->v->origin, temporg); VectorCopy(temporg, ent->v->origin); - trace = WPhys_PushEntity (w, ent, move, (sv_antilag.ival==2)?MOVE_LAGGED:0); + fl = 0; +#ifndef CLIENTONLY + /*doesn't affect csqc, as it has no lagged ents registered anywhere*/ + if (sv_antilag.ival==2) + fl |= MOVE_LAGGED; +#endif + + trace = WPhys_PushEntity (w, ent, move, fl); if (trace.allsolid) trace.fraction = 0; @@ -1224,6 +1232,7 @@ static void WPhys_Physics_Step (world_t *w, wedict_t *ent) //============================================================================ +#ifndef CLIENTONLY void SV_ProgStartFrame (void) { @@ -1238,7 +1247,7 @@ void SV_ProgStartFrame (void) #endif PR_ExecuteProgram (svprogfuncs, pr_global_struct->StartFrame); } - +#endif @@ -1771,10 +1780,10 @@ static void WPhys_MoveChain(world_t *w, wedict_t *ent, wedict_t *movechain, floa if (movechain->xv->chainmoved && callfunc) { - pr_global_struct->self = EDICT_TO_PROG(w->progs, movechain); - pr_global_struct->other = EDICT_TO_PROG(w->progs, ent); + *w->g.self = EDICT_TO_PROG(w->progs, movechain); + *w->g.other = EDICT_TO_PROG(w->progs, ent); #ifdef VM_Q1 - if (svs.gametype == GT_Q1QVM) + if (svs.gametype == GT_Q1QVM && w == &sv.world) Q1QVM_ChainMoved(); else #endif @@ -1794,9 +1803,10 @@ SV_RunEntity void WPhys_RunEntity (world_t *w, wedict_t *ent) { wedict_t *movechain; - edict_t *svent = (edict_t*)ent; vec3_t initial_origin = {0},initial_angle = {0}; // warning: ‘initial_?[?]’ may be used uninitialized in this function +#ifndef CLIENTONLY + edict_t *svent = (edict_t*)ent; if (ent->entnum > 0 && ent->entnum <= sv.allocated_client_slots && w == &sv.world) { //a client woo. qboolean readyforjump = false; @@ -1837,11 +1847,14 @@ void WPhys_RunEntity (world_t *w, wedict_t *ent) } } else +#endif { - if ((unsigned int)ent->v->lastruntime == svs.framenum) + if ((unsigned int)ent->v->lastruntime == w->framenum) return; - ent->v->lastruntime = svs.framenum; + ent->v->lastruntime = w->framenum; +#ifndef CLIENTONLY svent = NULL; +#endif } @@ -1890,8 +1903,10 @@ void WPhys_RunEntity (world_t *w, wedict_t *ent) WPhys_WalkMove (w, ent); - if (!(ent->entnum > 0 && ent->entnum <= sv.allocated_client_slots)) +#ifndef CLIENTONLY + if (!(ent->entnum > 0 && ent->entnum <= sv.allocated_client_slots) && w == &sv.world) World_LinkEdict (w, ent, true); +#endif break; case MOVETYPE_PHYSICS: @@ -1908,6 +1923,7 @@ void WPhys_RunEntity (world_t *w, wedict_t *ent) WPhys_MoveChain(w, ent, movechain, initial_origin, initial_angle); } +#ifndef CLIENTONLY if (svent) { World_LinkEdict (w, (wedict_t*)svent, true); @@ -1924,6 +1940,7 @@ void WPhys_RunEntity (world_t *w, wedict_t *ent) PR_ExecuteProgram (w->progs, pr_global_struct->PlayerPostThink); } } +#endif } /* @@ -1939,7 +1956,7 @@ void WPhys_RunNewmis (world_t *w) if (!w->g.newmis) //newmis variable is not exported. return; - if (sv_nomsec.ival >= 2) + if (!sv_gameplayfix_multiplethinks.ival) return; if (!*w->g.newmis) @@ -2004,6 +2021,8 @@ void World_Physics_Frame(world_t *w) qboolean retouch; wedict_t *ent; + w->framenum++; + i = *w->g.physics_mode; if (i == 0) { @@ -2040,6 +2059,7 @@ void World_Physics_Frame(world_t *w) if (retouch) World_LinkEdict (w, ent, true); // force retouch even for stationary +#ifndef CLIENTONLY if (i > 0 && i <= sv.allocated_client_slots && w == &sv.world) { if (!svs.clients[i-1].isindependant) @@ -2051,6 +2071,7 @@ void World_Physics_Frame(world_t *w) // World_LinkEdict(w, (wedict_t*)ent, true); continue; // clients are run directly from packets } +#endif WPhys_RunEntity (w, ent); WPhys_RunNewmis (w); @@ -2066,6 +2087,7 @@ void World_Physics_Frame(world_t *w) *w->g.force_retouch-=1; } +#ifndef CLIENTONLY /* ================ SV_Physics @@ -2246,6 +2268,7 @@ qboolean SV_Physics (void) } return moved; } +#endif void SV_SetMoveVars(void) { @@ -2259,8 +2282,8 @@ void SV_SetMoveVars(void) movevars.friction = sv_friction.value; movevars.waterfriction = sv_waterfriction.value; movevars.entgravity = 1.0; - if (*pm_stepheight.string) - movevars.stepheight = pm_stepheight.value; + if (*sv_stepheight.string) + movevars.stepheight = sv_stepheight.value; else movevars.stepheight = PM_DEFAULTSTEPHEIGHT; }