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)
61 WriteByte(MSG_ENTITY, ENT_CLIENT_WALL);
62 WriteByte(MSG_ENTITY, sf);
67 WriteShort(MSG_ENTITY, self.colormap);
72 WriteCoord(MSG_ENTITY, self.origin_x);
73 WriteCoord(MSG_ENTITY, self.origin_y);
74 WriteCoord(MSG_ENTITY, self.origin_z);
81 WriteAngle(MSG_ENTITY, self.angles_x);
82 WriteAngle(MSG_ENTITY, self.angles_y);
83 WriteAngle(MSG_ENTITY, self.angles_z);
89 WriteShort(MSG_ENTITY, self.modelindex);
90 WriteByte(MSG_ENTITY, self.solid);
91 WriteShort(MSG_ENTITY, floor(self.scale * 256));
94 WriteCoord(MSG_ENTITY, self.mins_x);
95 WriteCoord(MSG_ENTITY, self.mins_y);
96 WriteCoord(MSG_ENTITY, self.mins_z);
97 WriteCoord(MSG_ENTITY, self.maxs_x);
98 WriteCoord(MSG_ENTITY, self.maxs_y);
99 WriteCoord(MSG_ENTITY, self.maxs_z);
101 WriteString(MSG_ENTITY, self.bgmscript);
102 if(self.bgmscript != "")
104 WriteByte(MSG_ENTITY, floor(self.bgmscriptattack * 64));
105 WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64));
106 WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255));
107 WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64));
108 WriteCoord(MSG_ENTITY, self.movedir_x);
109 WriteCoord(MSG_ENTITY, self.movedir_y);
110 WriteCoord(MSG_ENTITY, self.movedir_z);
111 WriteByte(MSG_ENTITY, floor(self.lip * 255));
119 #define G_MODEL_INIT(sol) \
120 SetBrushEntityModel(); \
121 if(!self.scale) self.scale = self.modelscale; \
122 self.use = g_model_setcolormaptoactivator; \
123 InitializeEntity(self, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
124 if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT;
126 #define G_CLIENTMODEL_INIT(sol) \
127 SetBrushEntityModelNoLOD(); \
128 if(!self.scale) self.scale = self.modelscale; \
129 self.use = g_clientmodel_setcolormaptoactivator; \
130 InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
131 if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \
132 if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \
133 Net_LinkEntity(self, TRUE, 0, g_clientmodel_genericsendentity);
135 // non-solid model entities:
136 void spawnfunc_misc_gamemodel() { self.angles_x = -self.angles_x; G_MODEL_INIT (SOLID_NOT) } // model entity
137 void spawnfunc_misc_clientmodel() { self.angles_x = -self.angles_x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
138 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
140 // non-solid brush entities:
141 void spawnfunc_func_illusionary() { G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
142 void spawnfunc_func_clientillusionary() { G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity
143 void spawnfunc_func_static() { G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game
145 // solid brush entities
146 void spawnfunc_func_wall() { G_MODEL_INIT (SOLID_BSP) } // Q1 name
147 void spawnfunc_func_clientwall() { G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)