From: Mario Date: Sun, 29 Nov 2015 10:01:59 +0000 (+1000) Subject: Fix some issues with movetype prediction, also make jumppads predicted X-Git-Tag: xonotic-v0.8.2~1607 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=93e37b5460c3af5bc729e4417905fc120ed45ba4;p=xonotic%2Fxonotic-data.pk3dir.git Fix some issues with movetype prediction, also make jumppads predicted --- diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index d86efb5e9..9f9fa43f3 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -19,12 +19,16 @@ # define TAG_VIEWLOC_NAME tag_networkviewloc # define TAG_VIEWLOC_TYPE int .float tag_networkviewloc; + +# define MOVETYPE_NAME move_movetype #else # define TAG_ENTITY_NAME tag_entity # define TAG_ENTITY_TYPE entity # define TAG_VIEWLOC_NAME viewloc # define TAG_VIEWLOC_TYPE entity + +# define MOVETYPE_NAME movetype #endif // new fields @@ -63,7 +67,8 @@ CSQCMODEL_PROPERTY_SCALED(BIT(12), float, ReadByte, WriteByte, scale, 16, 0, 255) \ CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \ CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) \ - CSQCMODEL_PROPERTY(BIT(15), int, ReadByte, WriteByte, multijump_count) + CSQCMODEL_PROPERTY(BIT(15), int, ReadByte, WriteByte, multijump_count) \ + CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, MOVETYPE_NAME) // TODO get rid of colormod/glowmod here, find good solution for vortex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody // add hook function calls here diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index 07625658b..be592e774 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -343,6 +343,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGr for (entity e = findradius(0.5 * (this.absmin + this.absmax), 0.5 * vlen(this.absmax - this.absmin)); e; e = e.chain) { + if(e.move_nomonsters != MOVE_NOMONSTERS && e.move_nomonsters != MOVE_WORLDONLY) if(e.move_touch && boxesoverlap(e.absmin, e.absmax, this.absmin, this.absmax)) { other = this; @@ -413,7 +414,7 @@ bool _Movetype_TestEntityPosition(entity this, vector ofs) // SV_TestEntityPosi int cont = this.dphitcontentsmask; this.dphitcontentsmask = DPCONTENTS_SOLID; - tracebox(this.move_origin, this.mins, this.maxs, this.move_origin, MOVE_NOMONSTERS, this); + tracebox(this.move_origin, this.mins, this.maxs, this.move_origin, ((this.move_movetype == MOVETYPE_FLY_WORLDONLY) ? MOVE_WORLDONLY : MOVE_NOMONSTERS), this); this.dphitcontentsmask = cont; if(trace_startsolid) @@ -469,6 +470,8 @@ void _Movetype_PushEntityTrace(entity this, vector push) type = max(0, this.move_nomonsters); else if(this.move_movetype == MOVETYPE_FLYMISSILE) type = MOVE_MISSILE; + else if(this.move_movetype == MOVETYPE_FLY_WORLDONLY) + type = MOVE_WORLDONLY; else if(this.solid == SOLID_TRIGGER || this.solid == SOLID_NOT) type = MOVE_NOMONSTERS; else @@ -582,11 +585,51 @@ void _Movetype_Physics_Frame(entity this, float movedt) case MOVETYPE_BOUNCEMISSILE: case MOVETYPE_FLYMISSILE: case MOVETYPE_FLY: + case MOVETYPE_FLY_WORLDONLY: _Movetype_Physics_Toss(this, movedt); break; } } +void _Movetype_Physics_ClientFrame(entity this, float movedt) +{ + this.move_didgravity = -1; + switch (this.move_movetype) + { + case MOVETYPE_PUSH: + case MOVETYPE_FAKEPUSH: + _Movetype_Physics_Pusher(this, movedt); + break; + case MOVETYPE_NONE: + break; + case MOVETYPE_FOLLOW: + _Movetype_Physics_Follow(this); + break; + case MOVETYPE_NOCLIP: + _Movetype_CheckWater(this); + this.move_origin = this.move_origin + TICRATE * this.move_velocity; + this.move_angles = this.move_angles + TICRATE * this.move_avelocity; + _Movetype_LinkEdict(this, false); + break; + case MOVETYPE_STEP: + _Movetype_Physics_Step(this, movedt); + break; + case MOVETYPE_WALK: + case MOVETYPE_FLY: + case MOVETYPE_FLY_WORLDONLY: + _Movetype_Physics_Walk(this, movedt); + break; + case MOVETYPE_TOSS: + case MOVETYPE_BOUNCE: + case MOVETYPE_BOUNCEMISSILE: + case MOVETYPE_FLYMISSILE: + _Movetype_Physics_Toss(this, movedt); + break; + case MOVETYPE_PHYSICS: + break; + } +} + void Movetype_Physics_NoMatchServer(entity this) // optimized { float movedt = time - this.move_time; diff --git a/qcsrc/common/movetypes/movetypes.qh b/qcsrc/common/movetypes/movetypes.qh index d913c5dc5..7578ae2fa 100644 --- a/qcsrc/common/movetypes/movetypes.qh +++ b/qcsrc/common/movetypes/movetypes.qh @@ -69,6 +69,7 @@ const int MOVETYPE_FLYMISSILE = 9; const int MOVETYPE_BOUNCE = 10; const int MOVETYPE_BOUNCEMISSILE = 11; // Like bounce but doesn't lose speed on bouncing const int MOVETYPE_FOLLOW = 12; +const int MOVETYPE_PHYSICS = 32; const int MOVETYPE_FLY_WORLDONLY = 33; const int FL_ITEM = 256; diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 482135ed6..7e85ef3b8 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -1428,7 +1428,11 @@ void PM_Main(entity this) else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod)) { } +#ifdef SVQC else if (this.movetype == MOVETYPE_NOCLIP || this.movetype == MOVETYPE_FLY || this.movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this)) +#elif defined(CSQC) + else if (this.move_movetype == MOVETYPE_NOCLIP || this.move_movetype == MOVETYPE_FLY || this.move_movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this)) +#endif PM_fly(this, maxspeed_mod); else if (this.waterlevel >= WATERLEVEL_SWIMMING) diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index be3671b92..c6ba73b73 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -318,8 +318,8 @@ void trigger_push_findtarget() } #ifdef SVQC -float trigger_push_send(entity to, float sf) -{SELFPARAM(); +float trigger_push_send(entity this, entity to, float sf) +{ WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH); WriteByte(MSG_ENTITY, sf); @@ -349,7 +349,7 @@ void trigger_push_updatelink() void trigger_push_link() { - //Net_LinkEntity(self, false, 0, trigger_push_send); + Net_LinkEntity(self, false, 0, trigger_push_send); } #endif #ifdef SVQC @@ -404,7 +404,7 @@ bool target_push_send(entity this, entity to, float sf) void target_push_link() {SELFPARAM(); - //Net_LinkEntity(self, false, 0, target_push_send); + Net_LinkEntity(self, false, 0, target_push_send); //self.SendFlags |= 1; // update } @@ -432,8 +432,8 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew) self.entremove = trigger_remove_generic; self.solid = SOLID_TRIGGER; - self.draw = trigger_draw_generic; - self.trigger_touch = trigger_push_touch; + //self.draw = trigger_draw_generic; + self.move_touch = trigger_push_touch; self.drawmask = MASK_NORMAL; self.move_time = time; trigger_push_findtarget(); diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index ae29a7534..535bddbc1 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -148,8 +148,7 @@ NET_HANDLE(ENT_CLIENT_SWAMP, bool isnew) self.classname = "trigger_swamp"; self.solid = SOLID_TRIGGER; - self.draw = trigger_draw_generic; - self.trigger_touch = swamp_touch; + self.move_touch = swamp_touch; self.drawmask = MASK_NORMAL; self.move_time = time; self.entremove = trigger_remove_generic; diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 540c8737b..fc6979ed5 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -129,11 +129,11 @@ void CSQCPlayer_SavePrediction(entity this) } void CSQC_ClientMovement_PlayerMove_Frame(entity this); -void _Movetype_Physics_Frame(entity this, float movedt); +void _Movetype_Physics_ClientFrame(entity this, float movedt); void Movetype_Physics_Spam(entity this) // optimized { - _Movetype_Physics_Frame(this, PHYS_INPUT_TIMELENGTH); + _Movetype_Physics_ClientFrame(this, PHYS_INPUT_TIMELENGTH); if(wasfreed(this)) return; @@ -154,7 +154,7 @@ void CSQCPlayer_Physics(entity this) { this.move_origin = this.origin; this.move_angles = this.angles; - this.move_movetype = MOVETYPE_WALK; // temp + //this.move_movetype = MOVETYPE_WALK; // temp this.move_velocity = this.velocity; this.move_avelocity = this.avelocity; this.move_flags = BITSET(this.move_flags, FL_ONGROUND, boolean(this.flags & FL_ONGROUND));