3 void g_model_setcolormaptoactivator (void)
8 self.colormap = (activator.team - 1) * 0x11;
13 self.colormap = floor(random() * 256);
14 self.colormap |= 1024; // RENDER_COLORMAPPED
17 void g_clientmodel_setcolormaptoactivator (void)
19 g_model_setcolormaptoactivator();
23 void g_model_dropbyspawnflags()
25 if(self.spawnflags & 3 == 1) // ALIGN_ORIGIN
27 traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
28 setorigin(self, trace_endpos);
30 else if(self.spawnflags & 3 == 2) // ALIGN_BOTTOM
32 tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
33 setorigin(self, trace_endpos);
35 else if(self.spawnflags & 3 == 3) // ALIGN_ORIGIN | ALIGN_BOTTOM
37 traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
38 setorigin(self, trace_endpos - '0 0 1' * self.mins_z);
42 void g_clientmodel_dropbyspawnflags()
46 g_model_dropbyspawnflags();
51 float g_clientmodel_genericsendentity (entity to, float sf)
54 if(self.angles != '0 0 0')
56 if(self.solid && (self.mins != '0 0 0' || self.maxs != '0 0 0'))
58 if(self.colormap != 0)
60 if(self.lodmodelindex1)
63 WriteByte(MSG_ENTITY, ENT_CLIENT_WALL);
64 WriteByte(MSG_ENTITY, sf);
69 WriteShort(MSG_ENTITY, self.colormap);
74 WriteCoord(MSG_ENTITY, self.origin_x);
75 WriteCoord(MSG_ENTITY, self.origin_y);
76 WriteCoord(MSG_ENTITY, self.origin_z);
83 WriteAngle(MSG_ENTITY, self.angles_x);
84 WriteAngle(MSG_ENTITY, self.angles_y);
85 WriteAngle(MSG_ENTITY, self.angles_z);
93 WriteShort(MSG_ENTITY, self.lodmodelindex0);
94 WriteShort(MSG_ENTITY, bound(0, self.loddistance1, 65535));
95 WriteShort(MSG_ENTITY, self.lodmodelindex1);
96 WriteShort(MSG_ENTITY, bound(0, self.loddistance2, 65535));
97 WriteShort(MSG_ENTITY, self.lodmodelindex2);
100 WriteShort(MSG_ENTITY, self.modelindex);
101 WriteByte(MSG_ENTITY, self.solid);
102 WriteShort(MSG_ENTITY, floor(self.scale * 256));
105 WriteCoord(MSG_ENTITY, self.mins_x);
106 WriteCoord(MSG_ENTITY, self.mins_y);
107 WriteCoord(MSG_ENTITY, self.mins_z);
108 WriteCoord(MSG_ENTITY, self.maxs_x);
109 WriteCoord(MSG_ENTITY, self.maxs_y);
110 WriteCoord(MSG_ENTITY, self.maxs_z);
112 WriteString(MSG_ENTITY, self.bgmscript);
113 if(self.bgmscript != "")
115 WriteByte(MSG_ENTITY, floor(self.bgmscriptattack * 64));
116 WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64));
117 WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255));
118 WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64));
119 WriteCoord(MSG_ENTITY, self.movedir_x);
120 WriteCoord(MSG_ENTITY, self.movedir_y);
121 WriteCoord(MSG_ENTITY, self.movedir_z);
122 WriteByte(MSG_ENTITY, floor(self.lip * 255));
130 #define G_MODEL_INIT(sol) \
131 SetBrushEntityModel(); \
132 if(!self.scale) self.scale = self.modelscale; \
133 self.use = g_model_setcolormaptoactivator; \
134 InitializeEntity(self, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
135 if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT;
137 #define G_CLIENTMODEL_INIT(sol) \
138 SetBrushEntityModel(); \
139 if(!self.scale) self.scale = self.modelscale; \
140 self.use = g_clientmodel_setcolormaptoactivator; \
141 InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
142 if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \
143 if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \
144 Net_LinkEntity(self, TRUE, 0, g_clientmodel_genericsendentity);
146 // non-solid model entities:
147 void spawnfunc_misc_gamemodel() { self.angles_x = -self.angles_x; G_MODEL_INIT (SOLID_NOT) } // model entity
148 void spawnfunc_misc_clientmodel() { self.angles_x = -self.angles_x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
149 void spawnfunc_misc_models() { self.angles_x = -self.angles_x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
151 // non-solid brush entities:
152 void spawnfunc_func_illusionary() { G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
153 void spawnfunc_func_clientillusionary() { G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity
154 void spawnfunc_func_static() { G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game
156 // solid brush entities
157 void spawnfunc_func_wall() { G_MODEL_INIT (SOLID_BSP) } // Q1 name
158 void spawnfunc_func_clientwall() { G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)