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)
{
// 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)
{
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)
#endif
#ifdef CSQC
+void trigger_push_remove()
+{
+ if(self.target)
+ strunzone(self.target);
+ self.target = string_null;
+}
void ent_trigger_push()
{
float sf = ReadByte();
{
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();
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();
}
}
}
+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";
self.origin_z = ReadCoord();
setorigin(self, self.origin);
- self.drawmask = MASK_ENGINE;
+ self.drawmask = MASK_NORMAL;
+ self.entremove = target_push_remove;
}
#endif
+++ /dev/null
-#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