]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
impact handling: instead of detecting teleports by origin or angles changing, detect...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 1 Nov 2011 12:22:59 +0000 (12:22 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 2 Nov 2011 08:08:11 +0000 (09:08 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11511 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=5c7ecb37b25afd86e8af339b4e4b654f5d81881b

clvm_cmds.c
progsvm.h
sv_phys.c
svvm_cmds.c

index a9c30b4297d49526ab10f6461e475270912a6d4e..227e9f2b8759a7a34251e15b7fcf05e0319d0fda 100644 (file)
@@ -59,6 +59,8 @@ void VM_CL_setorigin (void)
        }
        org = PRVM_G_VECTOR(OFS_PARM1);
        VectorCopy (org, PRVM_clientedictvector(e, origin));
+       if(e->priv.required->mark == PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN)
+               e->priv.required->mark = PRVM_EDICT_MARK_SETORIGIN_CAUGHT;
        CL_LinkEdict(e);
 }
 
index ffcf3a16bf6c03f9ebdbcd196c1074a7972ecade..247fea0f7494382816edf8e83679da3ed2c65cec 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -71,7 +71,9 @@ typedef struct prvm_edict_private_s
 {
        qboolean free;
        float freetime;
-       int mark;
+       int mark; // used during leaktest (0 = unref, >0 = referenced); special values during server physics:
+#define PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN -1
+#define PRVM_EDICT_MARK_SETORIGIN_CAUGHT -2
        const char *allocation_origin;
 } prvm_edict_private_t;
 
index db9b4fa06ee60fdd789bd7167672dd05c18ccaa0..f7bfff56d4912d2def7e886b0093902ebf234a64 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1607,7 +1607,6 @@ static qboolean SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, q
        int movetype;
        int type;
        vec3_t mins, maxs;
-       vec3_t original, original_velocity;
        vec3_t start;
        vec3_t end;
 
@@ -1640,8 +1639,7 @@ static qboolean SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, q
 
        VectorCopy(trace->endpos, PRVM_serveredictvector(ent, origin));
 
-       VectorCopy(PRVM_serveredictvector(ent, origin), original);
-       VectorCopy(PRVM_serveredictvector(ent, velocity), original_velocity);
+       ent->priv.required->mark = PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN; // -2: setorigin running
 
        SV_LinkEdict(ent);
 
@@ -1659,7 +1657,21 @@ static qboolean SV_PushEntity (trace_t *trace, prvm_edict_t *ent, vec3_t push, q
        if((PRVM_serveredictfloat(ent, solid) >= SOLID_TRIGGER && trace->ent && (!((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND) || PRVM_serveredictedict(ent, groundentity) != PRVM_EDICT_TO_PROG(trace->ent))))
                SV_Impact (ent, trace);
 
-       return VectorCompare(PRVM_serveredictvector(ent, origin), original);// && VectorCompare(PRVM_serveredictvector(ent, velocity), original_velocity);
+       if(ent->priv.required->mark == PRVM_EDICT_MARK_SETORIGIN_CAUGHT)
+       {
+               ent->priv.required->mark = 0;
+               return false;
+       }
+       else if(ent->priv.required->mark == PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN)
+       {
+               ent->priv.required->mark = 0;
+               return true;
+       }
+       else
+       {
+               Con_Printf("The edict mark had been overwritten! Please debug this.\n");
+               return true;
+       }
 }
 
 
index 7440b8053faed086feab3b7a1b667cbd968af219..ad027b44de315adc63e792d668cb0f95d2e4f05c 100644 (file)
@@ -250,6 +250,8 @@ static void VM_SV_setorigin (void)
        }
        org = PRVM_G_VECTOR(OFS_PARM1);
        VectorCopy (org, PRVM_serveredictvector(e, origin));
+       if(e->priv.required->mark == PRVM_EDICT_MARK_WAIT_FOR_SETORIGIN)
+               e->priv.required->mark = PRVM_EDICT_MARK_SETORIGIN_CAUGHT;
        SV_LinkEdict(e);
 }