ApplyMinMaxScaleAngles(this);
}
+bool LOD_customize(entity this, entity client)
+{
+ if(autocvar_loddebug)
+ {
+ int d = autocvar_loddebug;
+ if(d == 1)
+ this.modelindex = this.lodmodelindex0;
+ else if(d == 2 || !this.lodmodelindex2)
+ this.modelindex = this.lodmodelindex1;
+ else // if(d == 3)
+ this.modelindex = this.lodmodelindex2;
+ return true;
+ }
+
+ // TODO csqc network this so it only gets sent once
+ vector near_point = NearestPointOnBox(this, client.origin);
+ if(vdist(near_point - client.origin, <, this.loddistance1))
+ this.modelindex = this.lodmodelindex0;
+ else if(!this.lodmodelindex2 || vdist(near_point - client.origin, <, this.loddistance2))
+ this.modelindex = this.lodmodelindex1;
+ else
+ this.modelindex = this.lodmodelindex2;
+
+ return true;
+}
+
+void LOD_uncustomize(entity this)
+{
+ this.modelindex = this.lodmodelindex0;
+}
+
+void LODmodel_attach(entity this)
+{
+ entity e;
+
+ if(!this.loddistance1)
+ this.loddistance1 = 1000;
+ if(!this.loddistance2)
+ this.loddistance2 = 2000;
+ this.lodmodelindex0 = this.modelindex;
+
+ if(this.lodtarget1 != "")
+ {
+ e = find(NULL, targetname, this.lodtarget1);
+ if(e)
+ {
+ this.lodmodel1 = e.model;
+ delete(e);
+ }
+ }
+ if(this.lodtarget2 != "")
+ {
+ e = find(NULL, targetname, this.lodtarget2);
+ if(e)
+ {
+ this.lodmodel2 = e.model;
+ delete(e);
+ }
+ }
+
+ if(autocvar_loddebug < 0)
+ {
+ this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
+ }
+
+ if(this.lodmodel1 != "")
+ {
+ vector mi, ma;
+ mi = this.mins;
+ ma = this.maxs;
+
+ precache_model(this.lodmodel1);
+ _setmodel(this, this.lodmodel1);
+ this.lodmodelindex1 = this.modelindex;
+
+ if(this.lodmodel2 != "")
+ {
+ precache_model(this.lodmodel2);
+ _setmodel(this, this.lodmodel2);
+ this.lodmodelindex2 = this.modelindex;
+ }
+
+ this.modelindex = this.lodmodelindex0;
+ setsize(this, mi, ma);
+ }
+
+ if(this.lodmodelindex1)
+ if (!getSendEntity(this))
+ SetCustomizer(this, LOD_customize, LOD_uncustomize);
+}
+
/*
================
InitTrigger
#pragma once
#include "defs.qh"
-void SUB_SetFade (entity ent, float when, float fading_time);
-void SUB_VanishOrRemove (entity ent);
+.float friction;
+void SUB_Friction(entity this);
+
+void SUB_NullThink(entity this);
+
+/*
+==================
+SUB_VanishOrRemove
+
+Makes client invisible or removes non-client
+==================
+*/
+void SUB_VanishOrRemove(entity ent);
+
+void SUB_SetFade_Think(entity this);
+
+/*
+==================
+SUB_SetFade
+
+Fade 'ent' out when time >= 'when'
+==================
+*/
+void SUB_SetFade(entity ent, float when, float fading_time);
.vector finaldest, finalangle; //plat.qc stuff
.void(entity this) think1;
void SetBrushEntityModel(entity this);
void SetBrushEntityModelNoLOD(entity this);
+
+int autocvar_loddebug;
+.string lodtarget1;
+.string lodtarget2;
+.string lodmodel1;
+.string lodmodel2;
+.float lodmodelindex0;
+.float lodmodelindex1;
+.float lodmodelindex2;
+.float loddistance1;
+.float loddistance2;
+
+bool LOD_customize(entity this, entity client);
+
+void LOD_uncustomize(entity this);
+
+void LODmodel_attach(entity this);
#endif
/*
//int autocvar_leadlimit;
int autocvar_leadlimit_and_fraglimit;
int autocvar_leadlimit_override;
-int autocvar_loddebug;
int autocvar_minplayers;
string autocvar_nextmap;
string autocvar_quit_and_redirect;
#include "../lib/warpzone/common.qh"
#include "../common/mapobjects/subs.qh"
-
-/*
-==================
-main
-
-unused but required by the engine
-==================
-*/
-void main ()
-{
-
-}
-
-// Misc
-
/*
==================
traceline_antilag
return org;
}
-
-bool LOD_customize(entity this, entity client)
-{
- if(autocvar_loddebug)
- {
- int d = autocvar_loddebug;
- if(d == 1)
- this.modelindex = this.lodmodelindex0;
- else if(d == 2 || !this.lodmodelindex2)
- this.modelindex = this.lodmodelindex1;
- else // if(d == 3)
- this.modelindex = this.lodmodelindex2;
- return true;
- }
-
- // TODO csqc network this so it only gets sent once
- vector near_point = NearestPointOnBox(this, client.origin);
- if(vdist(near_point - client.origin, <, this.loddistance1))
- this.modelindex = this.lodmodelindex0;
- else if(!this.lodmodelindex2 || vdist(near_point - client.origin, <, this.loddistance2))
- this.modelindex = this.lodmodelindex1;
- else
- this.modelindex = this.lodmodelindex2;
-
- return true;
-}
-
-void LOD_uncustomize(entity this)
-{
- this.modelindex = this.lodmodelindex0;
-}
-
-void LODmodel_attach(entity this)
-{
- entity e;
-
- if(!this.loddistance1)
- this.loddistance1 = 1000;
- if(!this.loddistance2)
- this.loddistance2 = 2000;
- this.lodmodelindex0 = this.modelindex;
-
- if(this.lodtarget1 != "")
- {
- e = find(NULL, targetname, this.lodtarget1);
- if(e)
- {
- this.lodmodel1 = e.model;
- delete(e);
- }
- }
- if(this.lodtarget2 != "")
- {
- e = find(NULL, targetname, this.lodtarget2);
- if(e)
- {
- this.lodmodel2 = e.model;
- delete(e);
- }
- }
-
- if(autocvar_loddebug < 0)
- {
- this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
- }
-
- if(this.lodmodel1 != "")
- {
- vector mi, ma;
- mi = this.mins;
- ma = this.maxs;
-
- precache_model(this.lodmodel1);
- _setmodel(this, this.lodmodel1);
- this.lodmodelindex1 = this.modelindex;
-
- if(this.lodmodel2 != "")
- {
- precache_model(this.lodmodel2);
- _setmodel(this, this.lodmodel2);
- this.lodmodelindex2 = this.modelindex;
- }
-
- this.modelindex = this.lodmodelindex0;
- setsize(this, mi, ma);
- }
-
- if(this.lodmodelindex1)
- if (!getSendEntity(this))
- SetCustomizer(this, LOD_customize, LOD_uncustomize);
-}
#pragma once
-void SUB_NullThink(entity this);
-
-/*
-==================
-SUB_Friction
-
-Applies some friction to this
-==================
-*/
-.float friction;
-void SUB_Friction (entity this);
-
-/*
-==================
-SUB_VanishOrRemove
-
-Makes client invisible or removes non-client
-==================
-*/
-void SUB_VanishOrRemove (entity ent);
-
-void SUB_SetFade_Think (entity this);
-
-/*
-==================
-SUB_SetFade
-
-Fade 'ent' out when time >= 'when'
-==================
-*/
-void SUB_SetFade (entity ent, float when, float fadetime);
-
-/*
-==================
-main
-
-unused but required by the engine
-==================
-*/
-void main ();
-
-// Misc
-
/*
==================
traceline_antilag
==================
*/
vector findbetterlocation (vector org, float mindist);
-
-
-.string lodtarget1;
-.string lodtarget2;
-.string lodmodel1;
-.string lodmodel2;
-.float lodmodelindex0;
-.float lodmodelindex1;
-.float lodmodelindex2;
-.float loddistance1;
-.float loddistance2;
-
-bool LOD_customize(entity this, entity client);
-
-void LOD_uncustomize(entity this);
-
-void LODmodel_attach(entity this);
}
delete(tracetest_ent);
}
+
+/*
+==================
+main
+
+unused but required by the engine
+==================
+*/
+void main ()
+{
+
+}
#pragma once
bool expr_evaluate(string s);
+
+/*
+==================
+main
+
+unused but required by the engine
+==================
+*/
+void main ();