From aa1ec2adb4f71f76a6c6a7f6af7e6338c17da59b Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 18 Feb 2015 15:53:15 +1100 Subject: [PATCH] Some minor cleanup --- qcsrc/common/triggers/trigger/jumppads.qc | 41 ++++++++----- qcsrc/server/t_jumppads.qh | 71 ----------------------- 2 files changed, 28 insertions(+), 84 deletions(-) delete mode 100644 qcsrc/server/t_jumppads.qh diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index d60e4ff9a..dc269bdd5 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -79,9 +79,9 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) solution = solve_quadratic(0.5 * grav, -vz, zdist); // equation "z(ti) = zdist" // ALWAYS solvable because jumpheight >= zdist if(!solution.z) - solution.y = solution.x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) + solution_y = solution.x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) if(zdist == 0) - solution.x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) + solution_x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) if(zdist < 0) { @@ -256,7 +256,7 @@ void trigger_push_findtarget() // first calculate a typical start point for the jump org = (self.absmin + self.absmax) * 0.5; - org.z = self.absmax.z - PL_MIN_z; + org_z = self.absmax.z - PL_MIN_z; if (self.target) { @@ -341,10 +341,6 @@ float trigger_push_send(entity to, float sf) 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) @@ -429,6 +425,12 @@ void spawnfunc_target_position() { target_push_link(); } #endif #ifdef CSQC +void trigger_push_remove() +{ + if(self.target) + strunzone(self.target); + self.target = string_null; +} void ent_trigger_push() { float sf = ReadByte(); @@ -437,16 +439,18 @@ void ent_trigger_push() { self.classname = "jumppad"; self.target = strzone(ReadString()); - float mytm = ReadByte(); if(mytm) { self.team = mytm - 1; } + int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; } self.spawnflags = ReadInt24_t(); self.active = ReadByte(); self.warpzone_isboxy = ReadByte(); self.height = ReadByte(); self.scale = ReadByte(); + self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); self.origin_z = ReadCoord(); setorigin(self, self.origin); + self.mins_x = ReadCoord(); self.mins_y = ReadCoord(); self.mins_z = ReadCoord(); @@ -454,17 +458,16 @@ void ent_trigger_push() self.maxs_y = ReadCoord(); self.maxs_z = ReadCoord(); setsize(self, self.mins, self.maxs); + self.movedir_x = ReadCoord(); self.movedir_y = ReadCoord(); self.movedir_z = ReadCoord(); - self.angles_x = ReadCoord(); - self.angles_y = ReadCoord(); - self.angles_z = ReadCoord(); + self.entremove = trigger_push_remove; self.solid = SOLID_TRIGGER; self.draw = trigger_draw_generic; self.trigger_touch = trigger_push_touch; - self.drawmask = MASK_ENGINE; + self.drawmask = MASK_NORMAL; self.move_time = time; trigger_push_findtarget(); } @@ -476,6 +479,17 @@ void ent_trigger_push() } } +void target_push_remove() +{ + if(self.classname) + strunzone(self.classname); + self.classname = string_null; + + if(self.targetname) + strunzone(self.targetname); + self.targetname = string_null; +} + void ent_target_push() { self.classname = "push_target"; @@ -486,6 +500,7 @@ void ent_target_push() self.origin_z = ReadCoord(); setorigin(self, self.origin); - self.drawmask = MASK_ENGINE; + self.drawmask = MASK_NORMAL; + self.entremove = target_push_remove; } #endif diff --git a/qcsrc/server/t_jumppads.qh b/qcsrc/server/t_jumppads.qh deleted file mode 100644 index 48f4d5cab..000000000 --- a/qcsrc/server/t_jumppads.qh +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef T_JUMPPADS_H -#define T_JUMPPADS_H - -const float PUSH_ONCE = 1; -const float PUSH_SILENT = 2; - -.float pushltime; -.float istypefrag; -.float height; - - -float trigger_push_calculatevelocity_flighttime; - -#ifdef SVQC -void() SUB_UseTargets; -void trigger_push_use(); -#endif - -#ifdef CSQC -.float active; -.string target; -.string targetname; - -const int ACTIVE_NOT = 0; -const int ACTIVE_ACTIVE = 1; -const int ACTIVE_IDLE = 2; -const int ACTIVE_BUSY = 2; -const int ACTIVE_TOGGLE = 3; -#endif - -/* - trigger_push_calculatevelocity - - Arguments: - org - origin of the object which is to be pushed - tgt - target entity (can be either a point or a model entity; if it is - the latter, its midpoint is used) - ht - jump height, measured from the higher one of org and tgt's midpoint - - Returns: velocity for the jump - the global trigger_push_calculatevelocity_flighttime is set to the total - jump time - */ - -vector trigger_push_calculatevelocity(vector org, entity tgt, float ht); - -void trigger_push_touch(); - -.vector dest; -void trigger_push_findtarget(); - -/* - * ENTITY PARAMETERS: - * - * target: target of jump - * height: the absolute value is the height of the highest point of the jump - * trajectory above the higher one of the player and the target. - * the sign indicates whether the highest point is INSIDE (positive) - * or OUTSIDE (negative) of the jump trajectory. General rule: use - * positive values for targets mounted on the floor, and use negative - * values to target a point on the ceiling. - * movedir: if target is not set, this * speed * 10 is the velocity to be reached. - */ -#ifdef SVQC -void spawnfunc_trigger_push(); - -void spawnfunc_target_push(); -void spawnfunc_info_notnull(); -void spawnfunc_target_position(); -#endif -#endif -- 2.39.2