Module dpmod: Change committed
havoc at icculus.org
havoc at icculus.org
Thu Aug 28 08:55:33 EDT 2003
Commiter : havoc
CVSROOT : /cvs/cvsroot/twilight
Module : dpmod
Commit time: 2003-08-28 12:55:32 UTC
Log message:
fixed jumppads to act more like q3 (calculates trajectory based on player origin)
Modified files:
qc/trig_original.qc
------=MIME.501b645de955f25dc2dff8cb61efc139
Content-Type: text/plain; name="dpmod.20030828.125532.havoc.diff"
Content-Disposition: attachment; filename="dpmod.20030828.125532.havoc.diff"
Content-Transfer-Encoding: 8bit
Index: dpmod/qc/trig_original.qc
diff -u dpmod/qc/trig_original.qc:1.1.1.1 dpmod/qc/trig_original.qc:1.2
--- dpmod/qc/trig_original.qc:1.1.1.1 Thu Sep 19 15:07:51 2002
+++ dpmod/qc/trig_original.qc Thu Aug 28 08:55:22 2003
@@ -709,26 +709,50 @@
float PUSH_ONCE = 1;
float PUSH_SILENT = 2;
+void() target_position = {};
+
void() trigger_push_touch =
{
- local float t;
+ local float flighttime, dist, grav, t;
+ local vector org, v;
if (other.movetype == MOVETYPE_NONE || other.movetype == MOVETYPE_PUSH)
return;
other.velocity = self.movedir;
- /*
if (self.enemy)
{
+ /*
// old code for hitting a target landing spot
if (self.wait) // flight time
t = self.wait;
else
t = vlen(self.enemy.origin - other.origin) / self.speed - 0.1;
- direct path, with boost to counter gravity
+ // direct path, with boost to counter gravity
other.velocity = (self.enemy.origin - other.origin) * (1 / t) + '0 0 1' * (t * t * cvar("sv_gravity"));
+ */
+
+ // start point
+ org = other.origin;
+
+ // figure out how long it will take to hit the point considering gravity
+ grav = cvar("sv_gravity");
+ flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
+ if (!flighttime)
+ {
+ remove(self);
+ return;
+ }
+
+ // how far in X and Y to move
+ v = (self.enemy.origin - org);
+ v_z = 0;
+ dist = vlen(v);
+
+ // finally calculate the velocity
+ other.velocity = normalize(v) * (dist / flighttime);
+ other.velocity_z = flighttime * grav;
}
else
other.velocity = self.movedir;
- */
if (!(self.spawnflags & PUSH_SILENT))
if (other.classname == "player" || (other.flags & FL_MONSTER))
if (other.fly_sound < time)
@@ -754,34 +778,10 @@
void() trigger_push_findtarget =
{
- local float flighttime, dist, grav;
- local vector org;
-
// find the target
self.enemy = find(world, targetname, self.target);
if (!self.enemy)
objerror("trigger_push: target not found\n");
-
- // where the center is
- org = (self.absmin + self.absmax) * 0.5;
-
- // figure out how long it will take to hit the point considering gravity
- grav = cvar("sv_gravity");
- flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
- if (!flighttime)
- {
- remove(self);
- return;
- }
-
- // how far in X and Y to move
- self.movedir = (self.enemy.origin - org);
- self.movedir_z = 0;
- dist = vlen(self.movedir);
-
- // finally calculate the velocity
- self.movedir = normalize(self.movedir) * (dist / flighttime);
- self.movedir_z = flighttime * grav;
};
/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE SILENT
More information about the twilight-commits
mailing list