==================
SUB_SetFade
-Fade 'ent' out when time >= 'when'
+Fade ent out when time >= vanish_time
==================
*/
-void SUB_SetFade (entity ent, float when, float fading_time)
+void SUB_SetFade(entity ent, float vanish_time, float fading_time)
{
+ if (fading_time <= 0)
+ fading_time = 0.01;
ent.fade_rate = 1/fading_time;
setthink(ent, SUB_SetFade_Think);
- ent.nextthink = when;
+ ent.nextthink = vanish_time;
}
/*
// 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 only currently implemented alternative movement is linear (value 1)
+ // The only currently implemented alternative movement is linear (value 1)
if (traveltime < 0.15 || (this.platmovetype_start == 1 && this.platmovetype_end == 1)) // is this correct?
{
this.velocity = delta * (1/traveltime); // QuakeC doesn't allow vector/float division
setsize(e, e.mins, e.maxs);
}
-void SetBrushEntityModel(entity this)
+void SetBrushEntityModel(entity this, bool with_lod)
{
- if(this.model != "")
- {
- precache_model(this.model);
+ if(this.model != "")
+ {
+ precache_model(this.model);
if(this.mins != '0 0 0' || this.maxs != '0 0 0')
{
vector mi = this.mins;
}
else
_setmodel(this, this.model); // no precision needed
- InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
- }
- setorigin(this, this.origin);
- ApplyMinMaxScaleAngles(this);
-}
+ if(with_lod)
+ InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
-void SetBrushEntityModelNoLOD(entity this)
-{
- if(this.model != "")
- {
- precache_model(this.model);
- if(this.mins != '0 0 0' || this.maxs != '0 0 0')
- {
- vector mi = this.mins;
- vector ma = this.maxs;
- _setmodel(this, this.model); // no precision needed
- setsize(this, mi, ma);
- }
- else
- _setmodel(this, this.model); // no precision needed
- }
+ if(endsWith(this.model, ".obj")) // WORKAROUND: darkplaces currently rotates .obj models on entities incorrectly, we need to add 180 degrees to the Y axis
+ this.angles_y = anglemods(this.angles_y - 180);
+ }
setorigin(this, this.origin);
ApplyMinMaxScaleAngles(this);
}
// to mean no restrictions, so use a yaw of 360 instead.
SetMovedir(this);
this.solid = SOLID_TRIGGER;
- SetBrushEntityModelNoLOD(this);
+ SetBrushEntityModel(this, false);
set_movetype(this, MOVETYPE_NONE);
this.modelindex = 0;
this.model = "";
// to mean no restrictions, so use a yaw of 360 instead.
SetMovedir(this);
this.solid = SOLID_BSP;
- SetBrushEntityModelNoLOD(this);
+ SetBrushEntityModel(this, false);
set_movetype(this, MOVETYPE_NONE); // why was this PUSH? -div0
// this.modelindex = 0;
this.model = "";
// trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead.
this.solid = SOLID_BSP;
- SetBrushEntityModel(this);
+ SetBrushEntityModel(this, true);
set_movetype(this, MOVETYPE_PUSH);
if(this.modelindex == 0)
{