From: Mario Date: Fri, 12 Dec 2014 08:12:26 +0000 (+1100) Subject: Reorder jumppad file a little and get rid of dotproduct usage in physics code X-Git-Tag: xonotic-v0.8.1~38^2~60 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6940a822d4031e429b2dbfa225b73042399f987f;p=xonotic%2Fxonotic-data.pk3dir.git Reorder jumppad file a little and get rid of dotproduct usage in physics code --- diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index a41603e62..ff1aa4a21 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -185,7 +185,7 @@ void PM_ClientMovement_UpdateStatus() SET_ONGROUND(self); // this code actually "predicts" an impact; so let's clip velocity first - float f = dotproduct(self.velocity, trace_plane_normal); + float f = self.velocity * trace_plane_normal; if (f < 0) // only if moving downwards actually self.velocity -= f * trace_plane_normal; } @@ -281,7 +281,7 @@ void PM_ClientMovement_Move() t -= t * trace_fraction; - float f = dotproduct(self.velocity, trace_plane_normal); + float f = self.velocity * trace_plane_normal; self.velocity -= f * trace_plane_normal; } if (pmove_waterjumptime > 0) diff --git a/qcsrc/server/t_jumppads.qc b/qcsrc/server/t_jumppads.qc index b2aa58402..44d7e3ed6 100644 --- a/qcsrc/server/t_jumppads.qc +++ b/qcsrc/server/t_jumppads.qc @@ -4,7 +4,6 @@ .float active; .string target; .string targetname; -.float jpad_time; #define ACTIVE_NOT 0 #define ACTIVE_ACTIVE 1 #define ACTIVE_IDLE 2 @@ -147,7 +146,6 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) return sdir * vs + '0 0 1' * vz; } -void PM_ClientMovement_Move(); void trigger_push_touch() { if (self.active == ACTIVE_NOT) @@ -271,61 +269,9 @@ void trigger_push_touch() #endif } -#ifdef SVQC -float trigger_push_send(entity to, float sf) -{ - WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH); - WriteByte(MSG_ENTITY, sf); - - if(sf & 1) - { - WriteString(MSG_ENTITY, self.target); - WriteByte(MSG_ENTITY, self.team); - WriteByte(MSG_ENTITY, self.active); - WriteByte(MSG_ENTITY, self.warpzone_isboxy); - WriteByte(MSG_ENTITY, self.height); - WriteByte(MSG_ENTITY, self.scale); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); - - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); - - WriteCoord(MSG_ENTITY, self.movedir_x); - WriteCoord(MSG_ENTITY, self.movedir_y); - WriteCoord(MSG_ENTITY, self.movedir_z); - - WriteCoord(MSG_ENTITY, self.angles_x); - WriteCoord(MSG_ENTITY, self.angles_y); - WriteCoord(MSG_ENTITY, self.angles_z); - } - - if(sf & 2) - { - WriteByte(MSG_ENTITY, self.team); - WriteByte(MSG_ENTITY, self.active); - } - - return TRUE; -} - -void trigger_push_updatelink() -{ - self.SendFlags |= 1; -} - -void trigger_push_link() -{ - Net_LinkEntity(self, FALSE, 0, trigger_push_send); -} -#endif - .vector dest; +void trigger_push_link(); +void trigger_push_updatelink(); void trigger_push_findtarget() { entity t; @@ -389,6 +335,60 @@ void trigger_push_findtarget() #endif } +#ifdef SVQC +float trigger_push_send(entity to, float sf) +{ + WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH); + WriteByte(MSG_ENTITY, sf); + + if(sf & 1) + { + WriteString(MSG_ENTITY, self.target); + WriteByte(MSG_ENTITY, self.team); + WriteInt24_t(MSG_ENTITY, self.spawnflags); + WriteByte(MSG_ENTITY, self.active); + WriteByte(MSG_ENTITY, self.warpzone_isboxy); + WriteByte(MSG_ENTITY, self.height); + WriteByte(MSG_ENTITY, self.scale); + WriteCoord(MSG_ENTITY, self.origin_x); + WriteCoord(MSG_ENTITY, self.origin_y); + WriteCoord(MSG_ENTITY, self.origin_z); + + WriteCoord(MSG_ENTITY, self.mins_x); + WriteCoord(MSG_ENTITY, self.mins_y); + WriteCoord(MSG_ENTITY, self.mins_z); + WriteCoord(MSG_ENTITY, self.maxs_x); + WriteCoord(MSG_ENTITY, self.maxs_y); + WriteCoord(MSG_ENTITY, self.maxs_z); + + WriteCoord(MSG_ENTITY, self.movedir_x); + WriteCoord(MSG_ENTITY, self.movedir_y); + WriteCoord(MSG_ENTITY, self.movedir_z); + + WriteCoord(MSG_ENTITY, self.angles_x); + WriteCoord(MSG_ENTITY, self.angles_y); + WriteCoord(MSG_ENTITY, self.angles_z); + } + + if(sf & 2) + { + WriteByte(MSG_ENTITY, self.team); + WriteByte(MSG_ENTITY, self.active); + } + + return TRUE; +} + +void trigger_push_updatelink() +{ + self.SendFlags |= 1; +} + +void trigger_push_link() +{ + Net_LinkEntity(self, FALSE, 0, trigger_push_send); +} +#endif #ifdef SVQC /* * ENTITY PARAMETERS: @@ -463,11 +463,9 @@ void trigger_push_draw() //if(trace_fraction < 1) if(trace_ent) - if(time >= trace_ent.jpad_time) { other = trace_ent; trigger_push_touch(); - trace_ent.jpad_time = time + 0.2; } } @@ -480,6 +478,7 @@ void ent_trigger_push() self.classname = "jumppad"; self.target = strzone(ReadString()); float mytm = ReadByte(); if(mytm) { self.team = mytm - 1; } + self.spawnflags = ReadInt24_t(); self.active = ReadByte(); self.warpzone_isboxy = ReadByte(); self.height = ReadByte(); @@ -504,7 +503,7 @@ void ent_trigger_push() self.solid = SOLID_TRIGGER; //self.draw = trigger_push_draw; - self.drawmask = MASK_NORMAL; + self.drawmask = MASK_ENGINE; self.move_time = time; //self.touch = trigger_push_touch; trigger_push_findtarget(); @@ -527,6 +526,6 @@ void ent_target_push() self.origin_z = ReadCoord(); setorigin(self, self.origin); - self.drawmask = MASK_NORMAL; + self.drawmask = MASK_ENGINE; } #endif