-void SUB_Null() {};
+void SUB_Null() {}
float SUB_True() { return 1; }
float SUB_False() { return 0; }
void setanim(entity e, vector anim, float looping, float override, float restart)
{
+ if (!anim)
+ return; // no animation was given to us! We can't use this.
+
if (anim_x == e.animstate_startframe)
if (anim_y == e.animstate_numframes)
if (anim_z == e.animstate_framerate)
e.animstate_override = override;
e.frame = e.animstate_startframe;
e.frame1time = servertime;
-};
+}
void updateanim(entity e)
{
}
e.frame = e.animstate_startframe + bound(0, (time - e.animstate_starttime) * e.animstate_framerate, e.animstate_numframes - 1);
//print(ftos(time), " -> ", ftos(e.frame), "\n");
-};
-
-float animparseerror;
-vector animparseline(float animfile)
-{
- local string line;
- local float c;
- local vector anim;
- if (animfile < 0)
- return '0 1 2';
- line = fgets(animfile);
- c = tokenize_console(line);
- if (c < 3)
+}
+
+vector animfixfps(entity e, vector a)
+{
+ // multi-frame anim: keep as-is
+ if(a_y == 1)
{
- animparseerror = TRUE;
- return '0 1 2';
+ float dur;
+ dur = frameduration(e.modelindex, a_x);
+ if(dur > 0)
+ a_z = 1.0 / dur;
}
- anim_x = stof(argv(0));
- anim_y = stof(argv(1));
- anim_z = stof(argv(2));
- // don't allow completely bogus values
- if (anim_x < 0 || anim_y < 1 || anim_z < 0.001)
- anim = '0 1 2';
- return anim;
-};
+ return a;
+}
/*
==================
if (ent.flags & FL_CLIENT)
{
// vanish
- ent.model = "";
+ ent.alpha = -1;
ent.effects = 0;
ent.glow_size = 0;
ent.pflags = 0;
void SUB_SetFade_Think (void)
{
+ if(self.alpha == 0)
+ self.alpha = 1;
self.think = SUB_SetFade_Think;
- self.nextthink = self.fade_time;
- self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
+ self.nextthink = time;
+ self.alpha -= frametime * self.fade_rate;
if (self.alpha < 0.01)
SUB_VanishOrRemove(self);
- self.alpha = bound(0.01, self.alpha, 1);
+ else
+ self.nextthink = time;
}
/*
// return;
//ent.alpha = 1;
ent.fade_rate = 1/fadetime;
- ent.fade_time = when;
ent.think = SUB_SetFade_Think;
ent.nextthink = when;
}
// Very short animations don't really show off the effect
// of controlled animation, so let's just use linear movement.
// Alternatively entities can choose to specify non-controlled movement.
- // The default, controlled movement, is value 0, the only currently
- // implemented alternative movement is linear, which is any other value.
- if (traveltime < 0.15 || self.platmovetype)
+ // The only currently implemented alternative movement is linear (value 1)
+ if (traveltime < 0.15 || self.platmovetype == 1)
{
self.velocity = delta * (1/traveltime); // QuakeC doesn't allow vector/float division
self.nextthink = self.ltime + traveltime;
controller.classname = "SUB_CalcMove_controller";
controller.owner = self;
controller.origin = self.origin; // starting point
- controller.finaldest = (tdest + '0 0 1'); // where do we want to end? Offset to overshoot a bit.
+ controller.finaldest = (tdest + '0 0 0.125'); // where do we want to end? Offset to overshoot a bit.
controller.destvec = delta;
controller.animstate_starttime = time;
controller.animstate_endtime = time + traveltime;
*/
void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag, float wz)
{
- local entity player;
- local float oldsolid;
+ entity player;
+ float oldsolid;
// check whether antilagged traces are enabled
if (lag < 0.001)
if (lag)
{
// take players back into the past
- player = player_list;
- while (player)
- {
- antilag_takeback(player, time - lag);
- player = player.nextplayer;
- }
+ FOR_EACH_PLAYER(player)
+ if(player != forent)
+ antilag_takeback(player, time - lag);
}
// do the trace
// restore players to current positions
if (lag)
{
- player = player_list;
- while (player)
- {
- antilag_restore(player);
- player = player.nextplayer;
- }
+ FOR_EACH_PLAYER(player)
+ if(player != forent)
+ antilag_restore(player);
}
// restore shooter solid type
}
self.angles = '0 0 0';
-};
+}
void InitTrigger()
{
self.movetype = MOVETYPE_NONE;
self.modelindex = 0;
self.model = "";
-};
+}
void InitSolidBSPTrigger()
{
self.movetype = MOVETYPE_NONE; // why was this PUSH? -div0
// self.modelindex = 0;
self.model = "";
-};
+}
float InitMovingBrushTrigger()
{
return 0;
}
return 1;
-};
+}