Debian Codegraph @

model/newstyle.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/model/newstyle.cpp $
21 * $Revision: 122 $
22 * $Date: 3/20/00 12:28p $
23 * $Author: Matt $
24 *
25 * Polygon model code
26 *
27 * $Log: /DescentIII/Main/model/newstyle.cpp $
28 *
29 * 122 3/20/00 12:28p Matt
30 * Merge of Duane's post-1.3 changes.
31 * Check for NULL pointer.
32 *
33 * 121 7/08/99 5:47p Jason
34 * changes for new bumpmapping system in 1.1 update patch
35 *
36 * 120 6/08/99 1:00p Jason
37 * changes for bumpmapping
38 *
39 * 119 5/18/99 10:31a Jason
40 * polymodel stuff wasn't getting paged in before drawing
41 *
42 * 118 5/14/99 2:03p Jason
43 * added polymodel errors to catch bugs
44 *
45 * 117 5/14/99 12:02a Jason
46 * more speedups for g3_DrawPoly
47 *
48 * 116 5/13/99 8:33p Matt
49 * Consolidated Mac & Windows code.
50 *
51 * 115 5/13/99 5:07p Ardussi
52 * changes for compiling on the Mac
53 *
54 * 114 5/04/99 4:34p Jason
55 * changes for bumpmapping
56 *
57 * 113 4/22/99 8:29p Kevin
58 * made psrand.h come after stdlib.h
59 *
60 * 112 4/21/99 11:05a Kevin
61 * new ps_rand and ps_srand to replace rand & srand
62 *
63 * 111 4/16/99 5:32p Jason
64 * fixed smooth specularity with objects
65 *
66 * 110 4/14/99 1:36a Jeff
67 * fixed case mismatched #includes
68 *
69 * 109 4/09/99 12:06p Jason
70 * made model setup code faster
71 *
72 * 108 3/31/99 12:26p Jason
73 * fixed some issues related to non wbuffer cards
74 *
75 * 107 3/24/99 10:22a Matt
76 * Fixed null-pointer bug
77 *
78 */
79
80 #include <cstdlib>
81
82 #include "3d.h"cxx . . $ `<file>/lib/3d.h`/
83 #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/
84 #include "fireball.h"cxx . . $ `<file>/Descent3/fireball.h`/
85 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
86 #include "lighting.h"cxx . . $ `<file>/Descent3/lighting.h`/
87 #include "lightmap.h"cxx . . $ `<file>/lib/lightmap.h`/
88 #include "lightmap_info.h"cxx . . $ `<file>/Descent3/lightmap_info.h`/
89 #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/
90 #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/
91 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
92 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
93 #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/
94
95 static float face_depthcxx . . $ face_depth.[MAX_POLYGON_VECScxx . . $ `lib/polymodel_external.h:69:9`!];
96 static uint8_tcxx . . $ uint8_t# triangulated_facescxx . . $ triangulated_faces.[MAX_FACES_PER_ROOMcxx . . $ `Descent3/room_external.h:106:9`!];
97
98 static uint8_tcxx . . $ uint8_t# FacingPasscxx . . $ FacingPass. = 0;
99 static int Multicolor_texturecxx . . $ Multicolor_texture. = -1;
100
101 static vectorcxx . . $ vector# Fog_planecxx . . $ Fog_plane.;
102 static float Fog_distancecxx . . $ Fog_distance., Fog_eye_distancecxx . . $ Fog_eye_distance.;
103 static vectorcxx . . $ vector# Fog_view_poscxx . . $ Fog_view_pos., Specular_view_poscxx . . $ Specular_view_pos., Bump_view_poscxx . . $ Bump_view_pos.;
104 static matrixcxx . . $ matrix# Unscaled_bumpmap_matrixcxx . . $ Unscaled_bumpmap_matrix.;
105
106 static int ModelFaceSortFunccxx . . $ ModelFaceSortFunc(cc1caa6a32f99af5).(const int16_t *a, const int16_t *b);
107 static inline void RenderSubmodelFacecxx . . $ RenderSubmodelFace(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum);
108 static inline void RenderSubmodelLightmapFacecxx . . $ RenderSubmodelLightmapFace(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum);
109 static inline void RenderSubmodelFaceFoggedcxx . . $ RenderSubmodelFaceFogged(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum);
110 static inline void RenderSubmodelFaceSpecularcxx . . $ RenderSubmodelFaceSpecular(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum);
111
112 /// Draws a glowing cone of light.
113 static void DrawGlowEffectcxx . . $ DrawGlowEffect(b077ea2df65a8fd3).(vectorcxx . . $ vector# *pos, float r, float g, float b, vectorcxx . . $ vector# *norm, float size);
114
115 /// Draws a glowing cone of light that represents thrusters
116 static void DrawThrusterEffectcxx . . $ DrawThrusterEffect(44a06a457ad096fd).(vectorcxx . . $ vector# *pos, float r, float g, float b, vectorcxx . . $ vector# *norm, float size, float length);
117
118 static void RenderSubmodelFacesSortedcxx . . $ RenderSubmodelFacesSorted(dea5851e769905e8).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm);
119 static void RenderSubmodelFacesUnsortedcxx . . $ RenderSubmodelFacesUnsorted(dea5851e769905e8).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm);
120
121 /// Rotates all of the points of a submodel, plus supplies color info.
122 static void RotateModelPointscxx . . $ RotateModelPoints(dea5851e769905e8).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm);
123
124 static float ComputeDefaultSizeFunccxx . . $ ComputeDefaultSizeFunc(fb716385a494b69a).(int handle, float *size_ptr, vectorcxx . . $ vector# *offset_ptr, bool f_use_all_frames);
125
126 int ModelFaceSortFunccxx . . $ ModelFaceSortFunc(cc1caa6a32f99af5).(const int16_t *a, const int16_t *b) {
127 float az, bz;
128
129 az = face_depthcxx . . $ face_depth.[*a];
130 bz = face_depthcxx . . $ face_depth.[*b];
131
132 if (az < bz)
133 return -1;
134 else if (az > bz)
135 return 1;
136 else
137 return 0;
138 }
139
140 #ifdef _DEBUGcxx . . $ `<built-in>:480:9`!
141 static void model_draw_outlinecxx . . $ model_draw_outline(53c8ee3251222219).(int nverts, g3Pointcxx . . $ g3Point# **pointlist) {
142 int i;
143
144 for (i = 0; i < nverts - 1; i++)
145 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255), pointlist[i], pointlist[i + 1]);
146
147 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255), pointlist[i], pointlist[0]);
148 }
149
150 static void DrawSubmodelFaceOutlinecxx . . $ DrawSubmodelFaceOutline(53c8ee3251222219).(int nv, g3Pointcxx . . $ g3Point# **pointlist) {
151 int i;
152 g3Pointcxx . . $ g3Point# tpnt[64];
153 g3Pointcxx . . $ g3Point# *tpnt_list[64];
154
155 ASSERTcxx . . $ `misc/pserror.h:246:9`!(nv < 64);
156
157 for (i = 0; i < nv; i++) {
158 tpnt[i] =cxx . . $ g3Point#`operator=`(c45224b80d125eec). *pointlist[i];
159 tpnt_list[i] = &tpnt[i];
160 }
161
162 for (i = 0; i < nv - 1; i++)
163 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 0), tpnt_list[i], tpnt_list[i + 1]);
164 g3_DrawLinecxx . . $ g3_DrawLine(79482445f52a1992).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 0), tpnt_list[i], tpnt_list[0]);
165 }
166 #endif
167
168 #define CROSS_WIDTHcxx . . $ `model/newstyle.cpp:168:9`! 8.0
169 int Lightmap_debug_subnumcxx . . $ Lightmap_debug_subnum. = -1;
170 int Lightmap_debug_facenumcxx . . $ Lightmap_debug_facenum. = -1;
171 int Lightmap_debug_modelcxx . . $ Lightmap_debug_model. = -1;
172
173 inline void RenderSubmodelFacecxx . . $ RenderSubmodelFace(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum) {
174
175 g3Pointcxx . . $ g3Point# *pointlist[100];
176 int bm_handle;
177 int smooth = 0;
178 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[facenum];
179 int modelnum = sm - pm->submodelcxx . . $ poly_model#submodel.;
180 texturecxx . . $ texture# *texp = nullptr;
181 int t;
182 int custom = 0;
183 g3Codescxx . . $ g3Codes# face_cc;
184 int triface = 0;
185
186 face_cc.cc_andcxx . . $ g3Codes#cc_and. = 0xff;
187 face_cc.cc_orcxx . . $ g3Codes#cc_or. = 0;
188
189 triangulated_facescxx . . $ triangulated_faces.[facenum] = 0;
190
191 if (sm->flagscxx . . $ bsp_info#flags. & SOF_CUSTOMcxx . . $ `lib/polymodel_external.h:97:9`!)
192 custom = 1;
193
194 // Setup texturing
195 if (fp->texnumcxx . . $ polyface#texnum. != -1)
196 texp = &GameTexturescxx . . $ GameTextures.[pm->texturescxx . . $ poly_model#textures.[fp->texnumcxx . . $ polyface#texnum.]];
197
198 if (texp && custom && Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_CUSTOM_TEXTUREcxx . . $ `lib/polymodel_external.h:294:9`!))
199 texp = &GameTexturescxx . . $ GameTextures.[Polymodel_effectcxx . . $ Polymodel_effect..custom_texturecxx . . $ polymodel_effect#custom_texture.];
200
201 // Set radiosity lightmaps if needed
202 if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_LIGHTMAPcxx . . $ POLYMODEL_LIGHTING_LIGHTMAP.) {
203 rend_SetOverlayMapcxx . . $ rend_SetOverlayMap(d4f767463ce0a6b3).(
204 LightmapInfocxx . . $ LightmapInfo.[Polylighting_lightmap_objectcxx . . $ Polylighting_lightmap_object.->lightmap_facescxx . . $ lightmap_object#lightmap_faces.[modelnum][facenum].lmi_handlecxx . . $ lightmap_object_face#lmi_handle.].lm_handlecxx . . $ lightmap_info#lm_handle.);
205 }
206
207 // Do bump mapping
208 if ((Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_BUMPMAPPEDcxx . . $ `lib/polymodel_external.h:303:9`!) && texp && texp->bumpmapcxx . . $ texture#bumpmap. != -1 &&
209 Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.) {
210 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
211 rend_SetBumpmapReadyStatecxx . . $ rend_SetBumpmapReadyState(3e454b8ccf442868).(1, texp->bumpmapcxx . . $ texture#bumpmap.);
212 if ((GameTexturescxx . . $ GameTextures.[fp->texnumcxx . . $ polyface#texnum.].flagscxx . . $ texture#flags. & TF_SMOOTH_SPECULARcxx . . $ `Descent3/gametexture.h:232:9`!))
213 smooth = 1;
214 }
215
216 float uchange = 0, vchange = 0;
217
218 // Figure out if there is any texture sliding
219 if (texp && texp->slide_ucxx . . $ texture#slide_u. != 0) {
220 int int_time = Gametimecxx . . $ Gametime. / texp->slide_ucxx . . $ texture#slide_u.;
221 float norm_time = Gametimecxx . . $ Gametime. - (int_time * texp->slide_ucxx . . $ texture#slide_u.);
222 norm_time /= texp->slide_ucxx . . $ texture#slide_u.;
223
224 uchange = norm_time;
225 }
226
227 if (texp && texp->slide_vcxx . . $ texture#slide_v. != 0) {
228 int int_time = Gametimecxx . . $ Gametime. / texp->slide_vcxx . . $ texture#slide_v.;
229 float norm_time = Gametimecxx . . $ Gametime. - (int_time * texp->slide_vcxx . . $ texture#slide_v.);
230 norm_time /= texp->slide_vcxx . . $ texture#slide_v.;
231 vchange = norm_time;
232 }
233
234 ASSERTcxx . . $ `misc/pserror.h:246:9`!(fp->nverts < 100);
235
236 // Setup the points for this face
237 for (t = 0; t < fp->nvertscxx . . $ polyface#nverts.; t++) {
238 g3Pointcxx . . $ g3Point# *p = &Robot_pointscxx . . $ Robot_points.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
239 pointlist[t] = p;
240
241 if (texp) {
242 p->p3_uvlcxx . . $ g3Point#p3_uvl..ucxx . . $ g3UVL#u. = fp->ucxx . . $ polyface#u.[t] + uchange;
243 p->p3_uvlcxx . . $ g3Point#p3_uvl..vcxx . . $ g3UVL#v. = fp->vcxx . . $ polyface#v.[t] + vchange;
244 p->p3_uvlcxx . . $ g3Point#p3_uvl..acxx . . $ g3UVL#a. = sm->alphacxx . . $ bsp_info#alpha.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
245 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_UVcxx . . $ `lib/3d.h:217:9`! + PF_RGBAcxx . . $ `lib/3d.h:219:9`! + PF_Lcxx . . $ `lib/3d.h:218:9`!;
246
247 // Assign bump mapping coords
248 if ((Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_BUMPMAPPEDcxx . . $ `lib/polymodel_external.h:303:9`!) && texp->bumpmapcxx . . $ texture#bumpmap. != -1 &&
249 Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.) {
250 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_UV2cxx . . $ `lib/3d.h:220:9`!;
251
252 vectorcxx . . $ vector# vert = sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
253
254 vectorcxx . . $ vector# vertnorm;
255
256 if (smooth)
257 vertnorm =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). sm->vertnormscxx . . $ bsp_info#vertnorms.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
258 else
259 vertnorm =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). fp->normalcxx . . $ polyface#normal.;
260
261 vectorcxx . . $ vector# subvec = Bump_view_poscxx . . $ Bump_view_pos. -cxx . . $ operator-(b77b703cd1e43e33). vert;
262 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&subvec);
263
264 vectorcxx . . $ vector# incident_norm = vert -cxx . . $ operator-(b77b703cd1e43e33). Polymodel_bump_poscxx . . $ Polymodel_bump_pos.;
265 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&incident_norm);
266
267 float d = incident_norm *cxx . . $ `operator*`(4a721543d64e126a). vertnorm;
268 vectorcxx . . $ vector# upvec = d *cxx . . $ `operator*`(9d6577ff3e9faa29). vertnorm;
269 incident_norm -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (2 *cxx . . $ `operator*`(9d6577ff3e9faa29). upvec);
270
271 float dotp = (subvec *cxx . . $ `operator*`(4a721543d64e126a). incident_norm);
272
273 if (dotp < 0)
274 dotp = 0;
275 if (dotp > 1)
276 dotp = 1;
277
278 float val = dotp * .5;
279
280 p->p3_uvlcxx . . $ g3Point#p3_uvl..u2cxx . . $ g3UVL#u2. = val;
281 p->p3_uvlcxx . . $ g3Point#p3_uvl..v2cxx . . $ g3UVL#v2. = val;
282 }
283 }
284
285 if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_LIGHTMAPcxx . . $ POLYMODEL_LIGHTING_LIGHTMAP.) {
286 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_UV2cxx . . $ `lib/3d.h:220:9`!;
287 p->p3_uvlcxx . . $ g3Point#p3_uvl..u2cxx . . $ g3UVL#u2. = Polylighting_lightmap_objectcxx . . $ Polylighting_lightmap_object.->lightmap_facescxx . . $ lightmap_object#lightmap_faces.[modelnum][facenum].u2cxx . . $ lightmap_object_face#u2.[t];
288 p->p3_uvlcxx . . $ g3Point#p3_uvl..v2cxx . . $ g3UVL#v2. = Polylighting_lightmap_objectcxx . . $ Polylighting_lightmap_object.->lightmap_facescxx . . $ lightmap_object#lightmap_faces.[modelnum][facenum].v2cxx . . $ lightmap_object_face#v2.[t];
289 }
290
291 face_cc.cc_orcxx . . $ g3Codes#cc_or. |= p->p3_codescxx . . $ g3Point#p3_codes.;
292 face_cc.cc_andcxx . . $ g3Codes#cc_and. &= p->p3_codescxx . . $ g3Point#p3_codes.;
293 }
294
295 if (face_cc.cc_orcxx . . $ g3Codes#cc_or. && Polymodel_use_effectcxx . . $ Polymodel_use_effect. &&
296 (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & (PEF_FOGGED_MODELcxx . . $ `lib/polymodel_external.h:295:9`! | PEF_SPECULAR_MODELcxx . . $ `lib/polymodel_external.h:296:9`! | PEF_SPECULAR_FACEScxx . . $ `lib/polymodel_external.h:297:9`!))) {
297 triface = 1;
298 triangulated_facescxx . . $ triangulated_faces.[facenum] = 1;
299 }
300
301 // If there is a texture, set it up
302 if (texp) {
303 bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(texp - GameTexturescxx . . $ GameTextures., 0);
304
305 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_LINEARcxx . . $ TT_LINEAR.);
306 if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.)
307 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
308
309 // If this is a light texture, make the texture full bright
310 if (texp->flagscxx . . $ texture#flags. & TF_LIGHTcxx . . $ `Descent3/gametexture.h:220:9`!) {
311 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_FLAT_GOURAUDcxx . . $ LS_FLAT_GOURAUD.);
312 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255));
313 }
314
315 // Setup custom color if there is one
316 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_CUSTOM_COLORcxx . . $ `lib/polymodel_external.h:293:9`!) &&
317 (texp - GameTexturescxx . . $ GameTextures.) == Multicolor_texturecxx . . $ Multicolor_texture.) {
318 int r, g, b;
319
320 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_FLAT_GOURAUDcxx . . $ LS_FLAT_GOURAUD.);
321
322 r = GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(Polymodel_effectcxx . . $ Polymodel_effect..custom_colorcxx . . $ polymodel_effect#custom_color.);
323 g = GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(Polymodel_effectcxx . . $ Polymodel_effect..custom_colorcxx . . $ polymodel_effect#custom_color.);
324 b = GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(Polymodel_effectcxx . . $ Polymodel_effect..custom_colorcxx . . $ polymodel_effect#custom_color.);
325
326 if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.) {
327 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_COLORcxx . . $ `lib/polymodel_external.h:289:9`!) {
328 r = Polymodel_effectcxx . . $ Polymodel_effect..rcxx . . $ polymodel_effect#r. * (float)r * Polylighting_static_redcxx . . $ Polylighting_static_red.;
329 g = Polymodel_effectcxx . . $ Polymodel_effect..gcxx . . $ polymodel_effect#g. * (float)g * Polylighting_static_greencxx . . $ Polylighting_static_green.;
330 b = Polymodel_effectcxx . . $ Polymodel_effect..bcxx . . $ polymodel_effect#b. * (float)b * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
331 } else {
332 r = (float)r * Polylighting_static_redcxx . . $ Polylighting_static_red.;
333 g = (float)g * Polylighting_static_greencxx . . $ Polylighting_static_green.;
334 b = (float)b * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
335 }
336 }
337
338 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(r, g, b));
339 }
340
341 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`!))
342 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(texp->alphacxx . . $ texture#alpha. * Polymodel_effectcxx . . $ Polymodel_effect..alphacxx . . $ polymodel_effect#alpha. * 255);
343 else
344 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(texp->alphacxx . . $ texture#alpha. * 255);
345
346 if (texp->flagscxx . . $ texture#flags. & TF_SATURATEcxx . . $ `Descent3/gametexture.h:222:9`!)
347 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_CONSTANT_VERTEXcxx . . $ `lib/renderer.h:412:9`!);
348 else {
349 if ((texp->flagscxx . . $ texture#flags. & TF_ALPHAcxx . . $ `Descent3/gametexture.h:223:9`!) || (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`!)))
350 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_VERTEXcxx . . $ `lib/renderer.h:396:9`!);
351 else
352 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_TEXTUREcxx . . $ `lib/renderer.h:395:9`! + ATF_VERTEXcxx . . $ `lib/renderer.h:396:9`!);
353 }
354 } else {
355 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_VERTEXcxx . . $ `lib/renderer.h:396:9`!);
356 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_ALPHAcxx . . $ `lib/polymodel_external.h:287:9`!))
357 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(Polymodel_effectcxx . . $ Polymodel_effect..alphacxx . . $ polymodel_effect#alpha. * 255);
358 else
359 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255);
360
361 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
362 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
363
364 int r, g, b;
365
366 r = GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(fp->colorcxx . . $ polyface#color.);
367 g = GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(fp->colorcxx . . $ polyface#color.);
368 b = GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(fp->colorcxx . . $ polyface#color.);
369
370 if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.) {
371 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_COLORcxx . . $ `lib/polymodel_external.h:289:9`!) {
372 r = Polymodel_effectcxx . . $ Polymodel_effect..rcxx . . $ polymodel_effect#r. * (float)r * Polylighting_static_redcxx . . $ Polylighting_static_red.;
373 g = Polymodel_effectcxx . . $ Polymodel_effect..gcxx . . $ polymodel_effect#g. * (float)g * Polylighting_static_greencxx . . $ Polylighting_static_green.;
374 b = Polymodel_effectcxx . . $ Polymodel_effect..bcxx . . $ polymodel_effect#b. * (float)b * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
375 } else {
376 r = (float)r * Polylighting_static_redcxx . . $ Polylighting_static_red.;
377 g = (float)g * Polylighting_static_greencxx . . $ Polylighting_static_green.;
378 b = (float)b * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
379 }
380 }
381
382 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(r, g, b));
383
384 bm_handle = 0;
385 }
386
387 if (triface)
388 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(1);
389
390 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(fp->nvertscxx . . $ polyface#nverts., pointlist, bm_handle, MAP_TYPE_BITMAPcxx . . $ `lib/renderer.h:362:9`!, &face_cc);
391
392 if (triface)
393 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(0);
394
395 if (texp && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_BUMPMAPPEDcxx . . $ `lib/polymodel_external.h:303:9`!) && texp->bumpmapcxx . . $ texture#bumpmap. != -1 &&
396 Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.) {
397 rend_SetBumpmapReadyStatecxx . . $ rend_SetBumpmapReadyState(3e454b8ccf442868).(0, 0);
398 }
399
400 #ifdef _DEBUGcxx . . $ `<built-in>:480:9`!
401 if (Polymodel_outline_modecxx . . $ Polymodel_outline_mode.)
402 DrawSubmodelFaceOutlinecxx . . $ DrawSubmodelFaceOutline(53c8ee3251222219).(fp->nvertscxx . . $ polyface#nverts., pointlist);
403
404 /* if (Lightmap_debug_model==(pm-Poly_models) && Polymodel_light_type==POLYMODEL_LIGHTING_LIGHTMAP &&
405 Lightmap_debug_subnum==modelnum && Lightmap_debug_facenum==facenum)
406 {
407
408 int lmi_handle=Polylighting_lightmap_object->lightmap_faces[modelnum][facenum].lmi_handle;
409 lightmap_object_face *lfp=&Polylighting_lightmap_object->lightmap_faces[modelnum][facenum];
410 lightmap_info *lmi_ptr=&LightmapInfo[lmi_handle];
411 int w=lmi_w (lmi_handle);
412 int h=lmi_h (lmi_handle);
413 vector rvec=lfp->rvec*lmi_ptr->xspacing;
414 vector uvec=lfp->uvec*lmi_ptr->yspacing;
415 uint16_t *src_data=(uint16_t *)lm_data(lmi_ptr->lm_handle);
416
417 for (int i=0;i<w*h;i++)
418 {
419 int t;
420 g3Point epoints[20];
421 vector evec[20];
422 int y=i/w;
423 int x=i%w;
424
425 evec[0]=lmi_ptr->upper_left-(y*uvec)+(x*rvec);
426 g3_RotatePoint(&epoints[0],&evec[0]);
427 pointlist[0] = &epoints[0];
428
429 evec[1]=lmi_ptr->upper_left-(y*uvec)+((x+1)*rvec);
430 g3_RotatePoint(&epoints[1],&evec[1]);
431 pointlist[1] = &epoints[1];
432
433 evec[2]=lmi_ptr->upper_left-((y+1)*uvec)+((x+1)*rvec);
434 g3_RotatePoint(&epoints[2],&evec[2]);
435 pointlist[2] = &epoints[2];
436
437 evec[3]=lmi_ptr->upper_left-((y+1)*uvec)+(x*rvec);
438 g3_RotatePoint(&epoints[3],&evec[3]);
439 pointlist[3] = &epoints[3];
440
441 if (!(src_data[y*w+x] & OPAQUE_FLAG))
442 {
443 for (t=0;t<4;t++)
444 g3_DrawLine(GR_RGB(255,0,255),pointlist[t],pointlist[(t+1)%4]);
445 }
446 else
447 {
448 for (t=0;t<4;t++)
449 g3_DrawLine(GR_RGB(255,255,255),pointlist[t],pointlist[(t+1)%4]);
450 }
451 }
452
453 // Draw red cross where upper left is
454 uint8_t c0;
455 g3Point p0;
456 p0.p3_flags=0;
457 c0 = g3_RotatePoint(&p0,&LightmapInfo[lmi_handle].upper_left);
458
459 if (! c0)
460 {
461
462 //Draw a little cross at the current vert
463 g3_ProjectPoint(&p0); //make sure projected
464 rend_SetFlatColor(GR_RGB(255,0,0));
465 rend_DrawLine(p0.p3_sx-CROSS_WIDTH,p0.p3_sy,p0.p3_sx,p0.p3_sy-CROSS_WIDTH);
466 rend_DrawLine(p0.p3_sx,p0.p3_sy-CROSS_WIDTH,p0.p3_sx+CROSS_WIDTH,p0.p3_sy);
467 rend_DrawLine(p0.p3_sx+CROSS_WIDTH,p0.p3_sy,p0.p3_sx,p0.p3_sy+CROSS_WIDTH);
468 rend_DrawLine(p0.p3_sx,p0.p3_sy+CROSS_WIDTH,p0.p3_sx-CROSS_WIDTH,p0.p3_sy);
469 }
470
471 }*/
472
473 #endif
474 }
475
476 inline void RenderSubmodelLightmapFacecxx . . $ RenderSubmodelLightmapFace(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum) {
477 g3Pointcxx . . $ g3Point# *pointlist[100];
478
479 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[facenum];
480 int modelnum = sm - pm->submodelcxx . . $ poly_model#submodel.;
481 int t;
482
483 int lm_handle = LightmapInfocxx . . $ LightmapInfo.[Polylighting_lightmap_objectcxx . . $ Polylighting_lightmap_object.->lightmap_facescxx . . $ lightmap_object#lightmap_faces.[modelnum][facenum].lmi_handlecxx . . $ lightmap_object_face#lmi_handle.].lm_handlecxx . . $ lightmap_info#lm_handle.;
484 float xscalar = (float)GameLightmapscxx . . $ GameLightmaps.[lm_handle].widthcxx . . $ bms_lightmap#width. / (float)GameLightmapscxx . . $ GameLightmaps.[lm_handle].square_rescxx . . $ bms_lightmap#square_res.;
485 float yscalar = (float)GameLightmapscxx . . $ GameLightmaps.[lm_handle].heightcxx . . $ bms_lightmap#height. / (float)GameLightmapscxx . . $ GameLightmaps.[lm_handle].square_rescxx . . $ bms_lightmap#square_res.;
486
487 ASSERTcxx . . $ `misc/pserror.h:246:9`!(fp->nverts < 100);
488
489 // Setup the points for this face
490 for (t = 0; t < fp->nvertscxx . . $ polyface#nverts.; t++) {
491 g3Pointcxx . . $ g3Point# *p = &Robot_pointscxx . . $ Robot_points.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
492 pointlist[t] = p;
493
494 p->p3_uvlcxx . . $ g3Point#p3_uvl..ucxx . . $ g3UVL#u. = Polylighting_lightmap_objectcxx . . $ Polylighting_lightmap_object.->lightmap_facescxx . . $ lightmap_object#lightmap_faces.[modelnum][facenum].u2cxx . . $ lightmap_object_face#u2.[t] * xscalar;
495 p->p3_uvlcxx . . $ g3Point#p3_uvl..vcxx . . $ g3UVL#v. = Polylighting_lightmap_objectcxx . . $ Polylighting_lightmap_object.->lightmap_facescxx . . $ lightmap_object#lightmap_faces.[modelnum][facenum].v2cxx . . $ lightmap_object_face#v2.[t] * yscalar;
496 p->p3_uvlcxx . . $ g3Point#p3_uvl..lcxx . . $ g3UVL#$anonymous_type_0#l. = 1.0;
497
498 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_UV2cxx . . $ `lib/3d.h:220:9`! + PF_RGBAcxx . . $ `lib/3d.h:219:9`! + PF_Lcxx . . $ `lib/3d.h:218:9`!;
499 }
500
501 if (triangulated_facescxx . . $ triangulated_faces.[facenum])
502 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(1);
503
504 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(fp->nvertscxx . . $ polyface#nverts., pointlist, lm_handle, MAP_TYPE_LIGHTMAPcxx . . $ `lib/renderer.h:363:9`!);
505
506 if (triangulated_facescxx . . $ triangulated_faces.[facenum])
507 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(0);
508 }
509
510 inline void RenderSubmodelFaceFoggedcxx . . $ RenderSubmodelFaceFogged(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum) {
511 g3Pointcxx . . $ g3Point# *pointlist[100];
512 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[facenum];
513 int modelnum = sm - pm->submodelcxx . . $ poly_model#submodel.;
514 int t;
515
516 for (t = 0; t < fp->nvertscxx . . $ polyface#nverts.; t++) {
517 g3Pointcxx . . $ g3Point# *p = &Robot_pointscxx . . $ Robot_points.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
518 pointlist[t] = p;
519
520 float mag;
521
522 if (Polymodel_effectcxx . . $ Polymodel_effect..fog_plane_checkcxx . . $ polymodel_effect#fog_plane_check. == 1) {
523 mag = vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&Fog_planecxx . . $ Fog_plane., &sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[t]]) + Fog_distancecxx . . $ Fog_distance.;
524 } else {
525 vectorcxx . . $ vector# *vec = &sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
526
527 // Now we must generate the split point. This is simply
528 // an equation in the form Origin + t*Direction
529
530 float dist = (*vec *cxx . . $ `operator*`(4a721543d64e126a). Polymodel_fog_planecxx . . $ Polymodel_fog_plane.) + Fog_distancecxx . . $ Fog_distance.;
531
532 vectorcxx . . $ vector# subvec = *vec -cxx . . $ operator-(b77b703cd1e43e33). Fog_view_poscxx . . $ Fog_view_pos.;
533
534 float t = Fog_eye_distancecxx . . $ Fog_eye_distance. / (Fog_eye_distancecxx . . $ Fog_eye_distance. - dist);
535 vectorcxx . . $ vector# portal_point = Fog_view_poscxx . . $ Fog_view_pos. +cxx . . $ operator+(b77b703cd1e43e33). (t *cxx . . $ `operator*`(9d6577ff3e9faa29). subvec);
536
537 float eye_distance = -(vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&Fog_planecxx . . $ Fog_plane., &portal_point));
538 mag = vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&Fog_planecxx . . $ Fog_plane., vec) + eye_distance;
539 }
540
541 float scalar = mag / Polymodel_effectcxx . . $ Polymodel_effect..fog_depthcxx . . $ polymodel_effect#fog_depth.;
542
543 if (scalar > 1)
544 scalar = 1;
545 if (scalar < 0)
546 scalar = 0;
547 p->p3_acxx . . $ `lib/3d.h:256:9`! = scalar;
548
549 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
550 }
551
552 if (triangulated_facescxx . . $ triangulated_faces.[facenum])
553 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(1);
554
555 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(fp->nvertscxx . . $ polyface#nverts., pointlist, 0);
556
557 if (triangulated_facescxx . . $ triangulated_faces.[facenum])
558 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(0);
559 }
560
561 inline void RenderSubmodelFaceSpecularcxx . . $ RenderSubmodelFaceSpecular(df53ce69827b100f).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, int facenum) {
562 g3Pointcxx . . $ g3Point# *pointlist[100];
563 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[facenum];
564 int modelnum = sm - pm->submodelcxx . . $ poly_model#submodel.;
565 int t;
566 bool smooth = 0;
567
568 if ((Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_SPECULAR_FACEScxx . . $ `lib/polymodel_external.h:297:9`!) && (GameTexturescxx . . $ GameTextures.[fp->texnumcxx . . $ polyface#texnum.].flagscxx . . $ texture#flags. & TF_SMOOTH_SPECULARcxx . . $ `Descent3/gametexture.h:232:9`!))
569 smooth = 1;
570
571 for (t = 0; t < fp->nvertscxx . . $ polyface#nverts.; t++) {
572 g3Pointcxx . . $ g3Point# *p = &Robot_pointscxx . . $ Robot_points.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
573 vectorcxx . . $ vector# vert = sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
574
575 vectorcxx . . $ vector# vertnorm;
576
577 if (smooth)
578 vertnorm =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). sm->vertnormscxx . . $ bsp_info#vertnorms.[fp->vertnumscxx . . $ polyface#vertnums.[t]];
579 else
580 vertnorm =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). fp->normalcxx . . $ polyface#normal.;
581
582 pointlist[t] = p;
583
584 p->p3_flagscxx . . $ g3Point#p3_flags. |= PF_RGBAcxx . . $ `lib/3d.h:219:9`!;
585 p->p3_acxx . . $ `lib/3d.h:256:9`! = 0.0;
586
587 vectorcxx . . $ vector# subvec = Specular_view_poscxx . . $ Specular_view_pos. -cxx . . $ operator-(b77b703cd1e43e33). vert;
588 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&subvec);
589
590 vectorcxx . . $ vector# incident_norm = vert -cxx . . $ operator-(b77b703cd1e43e33). Polymodel_specular_poscxx . . $ Polymodel_specular_pos.;
591 vm_NormalizeVectorFastcxx . . $ vm_NormalizeVectorFast(4939a7e530383cd4).(&incident_norm);
592
593 float d = incident_norm *cxx . . $ `operator*`(4a721543d64e126a). vertnorm;
594 vectorcxx . . $ vector# upvec = d *cxx . . $ `operator*`(9d6577ff3e9faa29). vertnorm;
595 incident_norm -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (2 *cxx . . $ `operator*`(9d6577ff3e9faa29). upvec);
596
597 float dotp = subvec *cxx . . $ `operator*`(4a721543d64e126a). incident_norm;
598
599 if (dotp < 0)
600 continue;
601 if (dotp > 1)
602 dotp = 1;
603
604 if (dotp > 0) {
605 int index = ((float)(MAX_SPECULAR_INCREMENTScxx . . $ `Descent3/lighting.h:38:9`! - 1) * dotp);
606 float val = Specular_tablescxx . . $ Specular_tables.[2][index];
607
608 p->p3_acxx . . $ `lib/3d.h:256:9`! = val * Polymodel_effectcxx . . $ Polymodel_effect..spec_scalarcxx . . $ polymodel_effect#spec_scalar.;
609 }
610 }
611
612 if (triangulated_facescxx . . $ triangulated_faces.[facenum])
613 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(1);
614
615 g3_DrawPolycxx . . $ g3_DrawPoly(eaf0a58e8bd7fbdc).(fp->nvertscxx . . $ polyface#nverts., pointlist, 0);
616
617 if (triangulated_facescxx . . $ triangulated_faces.[facenum])
618 g3_SetTriangulationTestcxx . . $ g3_SetTriangulationTest(d4f767463ce0a6b3).(0);
619 }
620
621 #define MAX_PARTScxx . . $ `model/newstyle.cpp:621:9`! 100
622
623 // Draws a glowing cone of light that represents thrusters
624 void DrawThrusterEffectcxx . . $ DrawThrusterEffect(44a06a457ad096fd).(vectorcxx . . $ vector# *pos, float r, float g, float b, vectorcxx . . $ vector# *norm, float size, float length) {
625 vectorcxx . . $ vector# cur_pos = *pos;
626 float cur_length = 0;
627 vectorcxx . . $ vector# glow_pos[MAX_PARTScxx . . $ `model/newstyle.cpp:621:9`!];
628 float glow_size[MAX_PARTScxx . . $ `model/newstyle.cpp:621:9`!];
629 int total_parts = 0;
630
631 if (length < .1)
632 return;
633
634 int num_divs = length * 3;
635 if (num_divs > MAX_PARTScxx . . $ `model/newstyle.cpp:621:9`!)
636 num_divs = MAX_PARTScxx . . $ `model/newstyle.cpp:621:9`!;
637
638 float size_change = size / num_divs;
639 float pos_change = length / num_divs;
640
641 if (!UseHardwarecxx . . $ UseHardware.)
642 return; // No software stuff here!
643
644 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
645 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
646 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(.3 * 255);
647
648 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
649 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
650
651 ddgr_colorcxx . . $ ddgr_color# color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(r * 255, g * 255, b * 255);
652 int bm_handle = Fireballscxx . . $ Fireballs.[GRADIENT_BALL_INDEXcxx . . $ `Descent3/fireball_external.h:39:9`!].bm_handlecxx . . $ fireball#bm_handle.;
653 int t;
654
655 // We must draw the small ones first, but we're starting the iteration from the
656 // large one. Consequently, we must store our variables so we can draw in reverse order
657 for (t = 0; t < num_divs && size > .05; t++) {
658 glow_pos[t] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). cur_pos;
659 glow_size[t] = size;
660
661 size -= size_change;
662 cur_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). ((*norm) *cxx . . $ `operator*`(252247219a31502c). pos_change);
663
664 total_parts++;
665 }
666
667 for (t = total_parts - 1; t >= 0; t--) {
668 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(-glow_size[t]);
669 g3_DrawBitmapcxx . . $ g3_DrawBitmap(8d67c7afa700cf9).(&glow_pos[t], glow_size[t], (glow_size[t] * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle,
670 color);
671 }
672 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(0.0);
673 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
674 }
675
676 // Draws a glowing cone of light
677 void DrawGlowEffectcxx . . $ DrawGlowEffect(b077ea2df65a8fd3).(vectorcxx . . $ vector# *pos, float r, float g, float b, vectorcxx . . $ vector# *norm, float size) {
678 if (!UseHardwarecxx . . $ UseHardware.)
679 return; // No software stuff here!
680
681 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_NO_GLOWScxx . . $ `lib/polymodel_external.h:301:9`!)
682 return;
683
684 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
685 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
686 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(.8 * 255);
687 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
688 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
689
690 ddgr_colorcxx . . $ ddgr_color# color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(r * 255, g * 255, b * 255);
691 int bm_handle = Fireballscxx . . $ Fireballs.[GRADIENT_BALL_INDEXcxx . . $ `Descent3/fireball_external.h:39:9`!].bm_handlecxx . . $ fireball#bm_handle.;
692
693 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(-size);
694 g3_DrawBitmapcxx . . $ g3_DrawBitmap(8d67c7afa700cf9).(pos, size, (size * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle, color);
695
696 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(0.0);
697 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
698 }
699
700 void RenderSubmodelFacesSortedcxx . . $ RenderSubmodelFacesSorted(dea5851e769905e8).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm) {
701 int i, t;
702
703 int rcount;
704 int model_render_order[MAX_POLYGON_VECScxx . . $ `lib/polymodel_external.h:69:9`!];
705 int modelnum = sm - pm->submodelcxx . . $ poly_model#submodel.;
706
707 ASSERTcxx . . $ `misc/pserror.h:246:9`!(sm->nverts < MAX_POLYGON_VECScxx . . $ `lib/polymodel_external.h:69:9`!);
708
709 // Build list of visible (non-backfacing) faces, & compute average face depths
710 for (i = rcount = 0; i < sm->num_facescxx . . $ bsp_info#num_faces.; i++) {
711 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[i];
712
713 // check for visible face
714 if (g3_CheckNormalFacingcxx . . $ g3_CheckNormalFacing(73e76fc48bf5de61).(&sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[0]], &fp->normalcxx . . $ polyface#normal.)) {
715 face_depthcxx . . $ face_depth.[i] = 0;
716 for (t = 0; t < fp->nvertscxx . . $ polyface#nverts.; t++)
717 face_depthcxx . . $ face_depth.[i] += Robot_pointscxx . . $ Robot_points.[fp->vertnumscxx . . $ polyface#vertnums.[t]].p3_zcxx . . $ `lib/3d.h:247:9`!;
718
719 face_depthcxx . . $ face_depth.[i] /= fp->nvertscxx . . $ polyface#nverts.;
720
721 // initialize order list
722 model_render_order[rcount] = i;
723
724 rcount++;
725
726 ASSERTcxx . . $ `misc/pserror.h:246:9`!(rcount < MAX_POLYGON_VECScxx . . $ `lib/polymodel_external.h:69:9`!);
727 }
728 }
729
730 // Sort the faces
731 qsort(model_render_order, rcount, sizeof(*model_render_order),
732 (int (*)(const void *, const void *))ModelFaceSortFunccxx . . $ ModelFaceSortFunc(cc1caa6a32f99af5).);
733
734 for (i = rcount - 1; i >= 0; i--) {
735 int facenum = model_render_order[i];
736
737 RenderSubmodelFacecxx . . $ RenderSubmodelFace(df53ce69827b100f).(pm, sm, facenum);
738 }
739 }
740 void RenderSubmodelFacesUnsortedcxx . . $ RenderSubmodelFacesUnsorted(dea5851e769905e8).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm) {
741 int i;
742 int modelnum = sm - pm->submodelcxx . . $ poly_model#submodel.;
743 int16_t alpha_faces[MAX_FACES_PER_ROOMcxx . . $ `Descent3/room_external.h:106:9`!], num_alpha_faces = 0;
744 int rcount = 0;
745 vectorcxx . . $ vector# view_pos;
746
747 g3_GetViewPositioncxx . . $ g3_GetViewPosition(ec8cf6451c36d470).(&view_pos);
748 g3_GetUnscaledMatrixcxx . . $ g3_GetUnscaledMatrix(dca75c48c9ab5b54).(&Unscaled_bumpmap_matrixcxx . . $ Unscaled_bumpmap_matrix.);
749
750 Specular_view_poscxx . . $ Specular_view_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). view_pos;
751 Bump_view_poscxx . . $ Bump_view_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). view_pos;
752
753 if (modelnum < 0 || modelnum >= pm->n_modelscxx . . $ poly_model#n_models.) {
754 Errorcxx . . $ Error(326aeb464d16410c).("Got bad model number %d from polymodel %s!", modelnum, pm->namecxx . . $ poly_model#name.);
755 return;
756 }
757
758 if (sm->flagscxx . . $ bsp_info#flags. & SOF_CUSTOMcxx . . $ `lib/polymodel_external.h:97:9`!)
759 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(-.5);
760
761 for (i = 0; i < sm->num_facescxx . . $ bsp_info#num_faces.; i++) {
762 vectorcxx . . $ vector# tempv;
763 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[i];
764 texturecxx . . $ texture# *texp;
765
766 // Check to see if this face even faces us!
767 tempv =cxx . . $ vector#`operator=`(c0842353a20857d). view_pos -cxx . . $ operator-(b77b703cd1e43e33). sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[0]];
768 if ((tempv *cxx . . $ `operator*`(4a721543d64e126a). fp->normalcxx . . $ polyface#normal.) < 0)
769 continue;
770
771 if (fp->texnumcxx . . $ polyface#texnum. != -1) {
772 texp = &GameTexturescxx . . $ GameTextures.[pm->texturescxx . . $ poly_model#textures.[fp->texnumcxx . . $ polyface#texnum.]];
773
774 if (texp->flagscxx . . $ texture#flags. & TF_ALPHAcxx . . $ `Descent3/gametexture.h:223:9`! || texp->flagscxx . . $ texture#flags. & TF_SATURATEcxx . . $ `Descent3/gametexture.h:222:9`!) {
775 alpha_faces[num_alpha_faces++] = i;
776 continue;
777 }
778 }
779
780 if (StateLimitedcxx . . $ StateLimited.) {
781 State_elementscxx . . $ State_elements.[rcount].facenumcxx . . $ state_limited_element#facenum. = i;
782 State_elementscxx . . $ State_elements.[rcount].sort_keycxx . . $ state_limited_element#sort_key. = pm->texturescxx . . $ poly_model#textures.[fp->texnumcxx . . $ polyface#texnum.];
783 rcount++;
784 } else
785 RenderSubmodelFacecxx . . $ RenderSubmodelFace(df53ce69827b100f).(pm, sm, i);
786 }
787
788 if (StateLimitedcxx . . $ StateLimited.) {
789 SortStatescxx . . $ SortStates(b1f17b8c50be1530).(State_elementscxx . . $ State_elements., rcount);
790 for (i = rcount - 1; i >= 0; i--) {
791 int facenum = State_elementscxx . . $ State_elements.[i].facenumcxx . . $ state_limited_element#facenum.;
792 RenderSubmodelFacecxx . . $ RenderSubmodelFace(df53ce69827b100f).(pm, sm, facenum);
793 }
794
795 if (!NoLightmapscxx . . $ NoLightmaps.) {
796 if (!UseMultitexturecxx . . $ UseMultitexture. && Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_LIGHTMAPcxx . . $ POLYMODEL_LIGHTING_LIGHTMAP.) {
797 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_LIGHTMAP_BLENDcxx . . $ `lib/renderer.h:407:9`!);
798 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_GOURAUDcxx . . $ LS_GOURAUD.);
799 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
800 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
801 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_PERSPECTIVEcxx . . $ TT_PERSPECTIVE.);
802 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.);
803 rend_SetMipStatecxx . . $ rend_SetMipState(4af4fd0e2b26c4ac).(0);
804
805 for (i = rcount - 1; i >= 0; i--) {
806 int facenum = State_elementscxx . . $ State_elements.[i].facenumcxx . . $ state_limited_element#facenum.;
807 RenderSubmodelLightmapFacecxx . . $ RenderSubmodelLightmapFace(df53ce69827b100f).(pm, sm, facenum);
808 }
809
810 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.);
811 rend_SetMipStatecxx . . $ rend_SetMipState(4af4fd0e2b26c4ac).(1);
812 }
813 }
814 }
815
816 // Now render all alpha faces
817 // rend_SetZBufferWriteMask (0);
818 for (i = 0; i < num_alpha_faces; i++)
819 RenderSubmodelFacecxx . . $ RenderSubmodelFace(df53ce69827b100f).(pm, sm, alpha_faces[i]);
820 // rend_SetZBufferWriteMask (1);
821
822 if (sm->flagscxx . . $ bsp_info#flags. & SOF_CUSTOMcxx . . $ `lib/polymodel_external.h:97:9`!)
823 rend_SetZBiascxx . . $ rend_SetZBias(9364e6e7bff7660).(0);
824
825 // Draw specular faces if needed
826 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & (PEF_SPECULAR_MODELcxx . . $ `lib/polymodel_external.h:296:9`! | PEF_SPECULAR_FACEScxx . . $ `lib/polymodel_external.h:297:9`!)) {
827 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
828 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
829 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
830 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
831 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_VERTEXcxx . . $ `lib/renderer.h:411:9`!);
832 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255);
833 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
834
835 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).((int)(Polymodel_effectcxx . . $ Polymodel_effect..spec_rcxx . . $ polymodel_effect#spec_r. * 255.0), (int)(Polymodel_effectcxx . . $ Polymodel_effect..spec_gcxx . . $ polymodel_effect#spec_g. * 255.0),
836 (int)(Polymodel_effectcxx . . $ Polymodel_effect..spec_bcxx . . $ polymodel_effect#spec_b. * 255.0)));
837
838 for (i = 0; i < sm->num_facescxx . . $ bsp_info#num_faces.; i++) {
839 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[i];
840
841 if (!g3_CheckNormalFacingcxx . . $ g3_CheckNormalFacing(73e76fc48bf5de61).(&sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[0]], &fp->normalcxx . . $ polyface#normal.))
842 continue;
843
844 /* vector subvec=sm->verts[fp->vertnums[0]]-Polymodel_specular_pos;
845 if ((fp->normal * subvec)> 0)
846 continue;*/
847
848 if ((Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_SPECULAR_MODELcxx . . $ `lib/polymodel_external.h:296:9`!) ||
849 (fp->texnumcxx . . $ polyface#texnum. != -1 && GameTexturescxx . . $ GameTextures.[pm->texturescxx . . $ poly_model#textures.[fp->texnumcxx . . $ polyface#texnum.]].flagscxx . . $ texture#flags. & TF_SPECULARcxx . . $ `Descent3/gametexture.h:236:9`!))
850 RenderSubmodelFaceSpecularcxx . . $ RenderSubmodelFaceSpecular(df53ce69827b100f).(pm, sm, i);
851 }
852
853 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
854 }
855
856 // Draw fog if need be
857 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_FOGGED_MODELcxx . . $ `lib/polymodel_external.h:295:9`!) {
858 matrixcxx . . $ matrix# mat;
859
860 g3_GetUnscaledMatrixcxx . . $ g3_GetUnscaledMatrix(dca75c48c9ab5b54).(&mat);
861 g3_GetViewPositioncxx . . $ g3_GetViewPosition(ec8cf6451c36d470).(&Fog_view_poscxx . . $ Fog_view_pos.);
862 Fog_planecxx . . $ Fog_plane. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). mat.fveccxx . . $ matrix#fvec.;
863
864 if (Polymodel_effectcxx . . $ Polymodel_effect..fog_plane_checkcxx . . $ polymodel_effect#fog_plane_check. == 1)
865 Fog_distancecxx . . $ Fog_distance. = -(vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&Fog_planecxx . . $ Fog_plane., &Fog_view_poscxx . . $ Fog_view_pos.));
866 else {
867 Fog_distancecxx . . $ Fog_distance. = -(vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(&Polymodel_fog_planecxx . . $ Polymodel_fog_plane., &Polymodel_fog_portal_vertcxx . . $ Polymodel_fog_portal_vert.));
868 Fog_eye_distancecxx . . $ Fog_eye_distance. = (Fog_view_poscxx . . $ Fog_view_pos. *cxx . . $ `operator*`(4a721543d64e126a). Polymodel_fog_planecxx . . $ Polymodel_fog_plane.) + Fog_distancecxx . . $ Fog_distance.;
869 }
870
871 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
872 rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.);
873 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
874 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
875 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_VERTEXcxx . . $ `lib/renderer.h:403:9`!);
876 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255);
877 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
878 rend_SetCoplanarPolygonOffsetcxx . . $ rend_SetCoplanarPolygonOffset(9364e6e7bff7660).(1);
879 rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).((int)(Polymodel_effectcxx . . $ Polymodel_effect..fog_rcxx . . $ polymodel_effect#fog_r. * 255.0), (int)(Polymodel_effectcxx . . $ Polymodel_effect..fog_gcxx . . $ polymodel_effect#fog_g. * 255.0),
880 (int)(Polymodel_effectcxx . . $ Polymodel_effect..fog_bcxx . . $ polymodel_effect#fog_b. * 255.0)));
881
882 for (i = 0; i < sm->num_facescxx . . $ bsp_info#num_faces.; i++) {
883 polyfacecxx . . $ polyface# *fp = &sm->facescxx . . $ bsp_info#faces.[i];
884
885 if (!g3_CheckNormalFacingcxx . . $ g3_CheckNormalFacing(73e76fc48bf5de61).(&sm->vertscxx . . $ bsp_info#verts.[fp->vertnumscxx . . $ polyface#vertnums.[0]], &fp->normalcxx . . $ polyface#normal.))
886 continue;
887
888 RenderSubmodelFaceFoggedcxx . . $ RenderSubmodelFaceFogged(df53ce69827b100f).(pm, sm, i);
889 }
890
891 rend_SetCoplanarPolygonOffsetcxx . . $ rend_SetCoplanarPolygonOffset(9364e6e7bff7660).(0);
892 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
893 }
894 }
895
896 // Rotates all of the points of a submodel, plus supplies color info
897 void RotateModelPointscxx . . $ RotateModelPoints(dea5851e769905e8).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm) {
898
899 // Figure out lighting
900 if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_STATICcxx . . $ POLYMODEL_LIGHTING_STATIC.) {
901 if ((Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!)) || (sm->flagscxx . . $ bsp_info#flags. & SOF_JITTERcxx . . $ `lib/polymodel_external.h:99:9`!)) {
902 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
903 vectorcxx . . $ vector# vec = sm->vertscxx . . $ bsp_info#verts.[i];
904
905 float val = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500.0) / 500.0;
906 vec *=cxx . . $ `operator*=`(f132838b2cd11d6). 1.0 + (Polymodel_effectcxx . . $ Polymodel_effect..deform_rangecxx . . $ polymodel_effect#deform_range. * val);
907
908 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &vec);
909 }
910 } else {
911 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++)
912 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &sm->vertscxx . . $ bsp_info#verts.[i]);
913 }
914 } else if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_LIGHTMAPcxx . . $ POLYMODEL_LIGHTING_LIGHTMAP.) {
915 if ((Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!)) || (sm->flagscxx . . $ bsp_info#flags. & SOF_JITTERcxx . . $ `lib/polymodel_external.h:99:9`!)) {
916 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
917 vectorcxx . . $ vector# vec = sm->vertscxx . . $ bsp_info#verts.[i];
918 float val = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500.0) / 500.0;
919 vec *=cxx . . $ `operator*=`(f132838b2cd11d6). 1.0 + (Polymodel_effectcxx . . $ Polymodel_effect..deform_rangecxx . . $ polymodel_effect#deform_range. * val);
920
921 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &vec);
922
923 Robot_pointscxx . . $ Robot_points.[i].p3_rcxx . . $ `lib/3d.h:253:9`! = 1.0;
924 Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`! = 1.0;
925 Robot_pointscxx . . $ Robot_points.[i].p3_bcxx . . $ `lib/3d.h:255:9`! = 1.0;
926 }
927 } else {
928 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
929 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &sm->vertscxx . . $ bsp_info#verts.[i]);
930 Robot_pointscxx . . $ Robot_points.[i].p3_rcxx . . $ `lib/3d.h:253:9`! = 1.0;
931 Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`! = 1.0;
932 Robot_pointscxx . . $ Robot_points.[i].p3_bcxx . . $ `lib/3d.h:255:9`! = 1.0;
933 }
934 }
935 } else if (Polymodel_light_typecxx . . $ Polymodel_light_type. == POLYMODEL_LIGHTING_GOURAUDcxx . . $ POLYMODEL_LIGHTING_GOURAUD.) {
936 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_COLORcxx . . $ `lib/polymodel_external.h:289:9`!) {
937 if ((Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!)) || (sm->flagscxx . . $ bsp_info#flags. & SOF_JITTERcxx . . $ `lib/polymodel_external.h:99:9`!)) {
938 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
939 vectorcxx . . $ vector# vec = sm->vertscxx . . $ bsp_info#verts.[i];
940 float val = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500.0) / 500.0;
941 vec *=cxx . . $ `operator*=`(f132838b2cd11d6). 1.0 + (Polymodel_effectcxx . . $ Polymodel_effect..deform_rangecxx . . $ polymodel_effect#deform_range. * val);
942
943 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &vec);
944
945 vectorcxx . . $ vector# normvec = sm->vertnormscxx . . $ bsp_info#vertnorms.[i];
946 val = (-vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(Polymodel_light_directioncxx . . $ Polymodel_light_direction., &normvec) + 1.0) / 2;
947
948 Robot_pointscxx . . $ Robot_points.[i].p3_rcxx . . $ `lib/3d.h:253:9`! = Polymodel_effectcxx . . $ Polymodel_effect..rcxx . . $ polymodel_effect#r. * val * Polylighting_static_redcxx . . $ Polylighting_static_red.;
949 Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`! = Polymodel_effectcxx . . $ Polymodel_effect..gcxx . . $ polymodel_effect#g. * val * Polylighting_static_greencxx . . $ Polylighting_static_green.;
950 Robot_pointscxx . . $ Robot_points.[i].p3_bcxx . . $ `lib/3d.h:255:9`! = Polymodel_effectcxx . . $ Polymodel_effect..bcxx . . $ polymodel_effect#b. * val * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
951 }
952 } else {
953 if ((Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!)) || (sm->flagscxx . . $ bsp_info#flags. & SOF_JITTERcxx . . $ `lib/polymodel_external.h:99:9`!)) {
954 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
955 vectorcxx . . $ vector# vec = sm->vertscxx . . $ bsp_info#verts.[i];
956 float val = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500.0) / 500.0;
957 vec *=cxx . . $ `operator*=`(f132838b2cd11d6). 1.0 + (Polymodel_effectcxx . . $ Polymodel_effect..deform_rangecxx . . $ polymodel_effect#deform_range. * val);
958
959 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &vec);
960
961 vectorcxx . . $ vector# normvec = sm->vertnormscxx . . $ bsp_info#vertnorms.[i];
962 val = (-vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(Polymodel_light_directioncxx . . $ Polymodel_light_direction., &normvec) + 1.0) / 2;
963
964 Robot_pointscxx . . $ Robot_points.[i].p3_rcxx . . $ `lib/3d.h:253:9`! = Polymodel_effectcxx . . $ Polymodel_effect..rcxx . . $ polymodel_effect#r. * val * Polylighting_static_redcxx . . $ Polylighting_static_red.;
965 Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`! = Polymodel_effectcxx . . $ Polymodel_effect..gcxx . . $ polymodel_effect#g. * val * Polylighting_static_greencxx . . $ Polylighting_static_green.;
966 Robot_pointscxx . . $ Robot_points.[i].p3_bcxx . . $ `lib/3d.h:255:9`! = Polymodel_effectcxx . . $ Polymodel_effect..bcxx . . $ polymodel_effect#b. * val * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
967 }
968 } else {
969 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
970 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &sm->vertscxx . . $ bsp_info#verts.[i]);
971 vectorcxx . . $ vector# normvec = sm->vertnormscxx . . $ bsp_info#vertnorms.[i];
972 float val = (-vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(Polymodel_light_directioncxx . . $ Polymodel_light_direction., &normvec) + 1.0) / 2;
973
974 Robot_pointscxx . . $ Robot_points.[i].p3_rcxx . . $ `lib/3d.h:253:9`! = Polymodel_effectcxx . . $ Polymodel_effect..rcxx . . $ polymodel_effect#r. * val * Polylighting_static_redcxx . . $ Polylighting_static_red.;
975 Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`! = Polymodel_effectcxx . . $ Polymodel_effect..gcxx . . $ polymodel_effect#g. * val * Polylighting_static_greencxx . . $ Polylighting_static_green.;
976 Robot_pointscxx . . $ Robot_points.[i].p3_bcxx . . $ `lib/3d.h:255:9`! = Polymodel_effectcxx . . $ Polymodel_effect..bcxx . . $ polymodel_effect#b. * val * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
977 }
978 }
979 }
980 } else {
981 if ((Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_DEFORMcxx . . $ `lib/polymodel_external.h:288:9`!)) || (sm->flagscxx . . $ bsp_info#flags. & SOF_JITTERcxx . . $ `lib/polymodel_external.h:99:9`!)) {
982 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
983 vectorcxx . . $ vector# vec = sm->vertscxx . . $ bsp_info#verts.[i];
984 float val = ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 1000) - 500.0) / 500.0;
985 vec *=cxx . . $ `operator*=`(f132838b2cd11d6). 1.0 + (Polymodel_effectcxx . . $ Polymodel_effect..deform_rangecxx . . $ polymodel_effect#deform_range. * val);
986
987 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &vec);
988 vectorcxx . . $ vector# normvec = sm->vertnormscxx . . $ bsp_info#vertnorms.[i];
989 val = (-vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(Polymodel_light_directioncxx . . $ Polymodel_light_direction., &normvec) + 1.0) / 2;
990
991 Robot_pointscxx . . $ Robot_points.[i].p3_rcxx . . $ `lib/3d.h:253:9`! = val * Polylighting_static_redcxx . . $ Polylighting_static_red.;
992 Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`! = val * Polylighting_static_greencxx . . $ Polylighting_static_green.;
993 Robot_pointscxx . . $ Robot_points.[i].p3_bcxx . . $ `lib/3d.h:255:9`! = val * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
994 }
995 } else {
996 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++) {
997 g3_RotatePointcxx . . $ g3_RotatePoint(fd2e8930c920e2b9).(&Robot_pointscxx . . $ Robot_points.[i], &sm->vertscxx . . $ bsp_info#verts.[i]);
998 vectorcxx . . $ vector# normvec = sm->vertnormscxx . . $ bsp_info#vertnorms.[i];
999 float val = (-vm_DotProductcxx . . $ vm_DotProduct(e65d563e2b53cc54).(Polymodel_light_directioncxx . . $ Polymodel_light_direction., &normvec) + 1.0) / 2;
1000
1001 Robot_pointscxx . . $ Robot_points.[i].p3_rcxx . . $ `lib/3d.h:253:9`! = val * Polylighting_static_redcxx . . $ Polylighting_static_red.;
1002 Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`! = val * Polylighting_static_greencxx . . $ Polylighting_static_green.;
1003 Robot_pointscxx . . $ Robot_points.[i].p3_bcxx . . $ `lib/3d.h:255:9`! = val * Polylighting_static_bluecxx . . $ Polylighting_static_blue.;
1004 }
1005 }
1006 }
1007 }
1008
1009 #ifndef RELEASE
1010 if (!UseHardwarecxx . . $ UseHardware.) {
1011 for (int i = 0; i < sm->nvertscxx . . $ bsp_info#nverts.; i++)
1012 Robot_pointscxx . . $ Robot_points.[i].p3_lcxx . . $ `lib/3d.h:252:9`! = Robot_pointscxx . . $ Robot_points.[i].p3_gcxx . . $ `lib/3d.h:254:9`!;
1013 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
1014 }
1015 #endif
1016 }
1017
1018 void RenderSubmodelcxx . . $ RenderSubmodel(3a5661cc5f0d8c55).(poly_modelcxx . . $ poly_model# *pm, bsp_infocxx . . $ bsp_info# *sm, uint32_tcxx . . $ uint32_t# f_render_sub) {
1019 int i;
1020 matrixcxx . . $ matrix# lightmatrix;
1021
1022 // Don't render door housings
1023 if (IsNonRenderableSubmodelcxx . . $ IsNonRenderableSubmodel(bb32db98789388a4).(pm, sm - pm->submodelcxx . . $ poly_model#submodel.))
1024 return;
1025
1026 if (Polymodel_light_typecxx . . $ Polymodel_light_type. != POLYMODEL_LIGHTING_LIGHTMAPcxx . . $ POLYMODEL_LIGHTING_LIGHTMAP.) {
1027 // Turn off bumpmapping if not needed
1028 rend_SetBumpmapReadyStatecxx . . $ rend_SetBumpmapReadyState(3e454b8ccf442868).(0, 0);
1029 } else {
1030 if (!StateLimitedcxx . . $ StateLimited. || UseMultitexturecxx . . $ UseMultitexture.)
1031 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_BLENDcxx . . $ `lib/renderer.h:334:9`!);
1032 }
1033
1034 if (Multicolor_texturecxx . . $ Multicolor_texture. == -1 && Polymodel_use_effectcxx . . $ Polymodel_use_effect. && (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_CUSTOM_COLORcxx . . $ `lib/polymodel_external.h:293:9`!))
1035 Multicolor_texturecxx . . $ Multicolor_texture. = FindTextureNamecxx . . $ FindTextureName(5c4306d8553b3696).("MultiColor");
1036
1037 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_RGBcxx . . $ CM_RGB.);
1038 StartPolyModelPosInstancecxx . . $ StartPolyModelPosInstance(ec8cf6451c36d470).(&sm->mod_poscxx . . $ bsp_info#mod_pos.);
1039 vectorcxx . . $ vector# temp_vec = sm->mod_poscxx . . $ bsp_info#mod_pos. +cxx . . $ operator+(b77b703cd1e43e33). sm->offsetcxx . . $ bsp_info#offset.;
1040 g3_StartInstanceAnglescxx . . $ g3_StartInstanceAngles(5a7036e8e0f776d8).(&temp_vec, &sm->angscxx . . $ bsp_info#angs.);
1041
1042 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&lightmatrix, sm->angscxx . . $ bsp_info#angs..pcxx . . $ angvec#p., sm->angscxx . . $ bsp_info#angs..hcxx . . $ angvec#h., sm->angscxx . . $ bsp_info#angs..bcxx . . $ angvec#b.);
1043 StartLightInstancecxx . . $ StartLightInstance(bc315f98e1febb02).(&temp_vec, &lightmatrix);
1044
1045 // Check my bit to see if I get drawn
1046 if (f_render_sub & (0x00000001 << (sm - pm->submodelcxx . . $ poly_model#submodel.))) {
1047 if (sm->flagscxx . . $ bsp_info#flags. & SOF_CUSTOMcxx . . $ `lib/polymodel_external.h:97:9`!) {
1048 if (!(Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_CUSTOM_TEXTUREcxx . . $ `lib/polymodel_external.h:294:9`!))
1049 goto pop_lighting;
1050 }
1051
1052 // Check to draw glow faces
1053 if (sm->flagscxx . . $ bsp_info#flags. & (SOF_GLOWcxx . . $ `lib/polymodel_external.h:96:9`! | SOF_THRUSTERcxx . . $ `lib/polymodel_external.h:98:9`!)) {
1054 if (!FacingPasscxx . . $ FacingPass.)
1055 goto pop_lighting;
1056
1057 vectorcxx . . $ vector# zero_pos = {0, 0, 0};
1058 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
1059
1060 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_GLOW_SCALARcxx . . $ `lib/polymodel_external.h:298:9`!) {
1061 if (Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_CUSTOM_GLOWcxx . . $ `lib/polymodel_external.h:302:9`!)
1062 DrawThrusterEffectcxx . . $ DrawThrusterEffect(44a06a457ad096fd).(&zero_pos, Polymodel_effectcxx . . $ Polymodel_effect..glow_rcxx . . $ polymodel_effect#glow_r., Polymodel_effectcxx . . $ Polymodel_effect..glow_gcxx . . $ polymodel_effect#glow_g., Polymodel_effectcxx . . $ Polymodel_effect..glow_bcxx . . $ polymodel_effect#glow_b.,
1063 &sm->glow_infocxx . . $ bsp_info#glow_info.->normalcxx . . $ glowinfo#normal., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_sizecxx . . $ glowinfo#glow_size. * Polymodel_effectcxx . . $ Polymodel_effect..glow_size_scalarcxx . . $ polymodel_effect#glow_size_scalar.,
1064 3 * Polymodel_effectcxx . . $ Polymodel_effect..glow_length_scalarcxx . . $ polymodel_effect#glow_length_scalar.);
1065 else
1066 DrawThrusterEffectcxx . . $ DrawThrusterEffect(44a06a457ad096fd).(&zero_pos, sm->glow_infocxx . . $ bsp_info#glow_info.->glow_rcxx . . $ glowinfo#glow_r., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_gcxx . . $ glowinfo#glow_g., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_bcxx . . $ glowinfo#glow_b.,
1067 &sm->glow_infocxx . . $ bsp_info#glow_info.->normalcxx . . $ glowinfo#normal., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_sizecxx . . $ glowinfo#glow_size. * Polymodel_effectcxx . . $ Polymodel_effect..glow_size_scalarcxx . . $ polymodel_effect#glow_size_scalar.,
1068 3 * Polymodel_effectcxx . . $ Polymodel_effect..glow_length_scalarcxx . . $ polymodel_effect#glow_length_scalar.);
1069 } else {
1070 if (Polymodel_use_effectcxx . . $ Polymodel_use_effect. && Polymodel_effectcxx . . $ Polymodel_effect..typecxx . . $ polymodel_effect#type. & PEF_CUSTOM_GLOWcxx . . $ `lib/polymodel_external.h:302:9`!)
1071 DrawGlowEffectcxx . . $ DrawGlowEffect(b077ea2df65a8fd3).(&zero_pos, Polymodel_effectcxx . . $ Polymodel_effect..glow_rcxx . . $ polymodel_effect#glow_r., Polymodel_effectcxx . . $ Polymodel_effect..glow_gcxx . . $ polymodel_effect#glow_g., Polymodel_effectcxx . . $ Polymodel_effect..glow_bcxx . . $ polymodel_effect#glow_b.,
1072 &sm->glow_infocxx . . $ bsp_info#glow_info.->normalcxx . . $ glowinfo#normal., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_sizecxx . . $ glowinfo#glow_size.);
1073 else
1074 DrawGlowEffectcxx . . $ DrawGlowEffect(b077ea2df65a8fd3).(&zero_pos, sm->glow_infocxx . . $ bsp_info#glow_info.->glow_rcxx . . $ glowinfo#glow_r., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_gcxx . . $ glowinfo#glow_g., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_bcxx . . $ glowinfo#glow_b.,
1075 &sm->glow_infocxx . . $ bsp_info#glow_info.->normalcxx . . $ glowinfo#normal., sm->glow_infocxx . . $ bsp_info#glow_info.->glow_sizecxx . . $ glowinfo#glow_size.);
1076 }
1077
1078 goto pop_lighting;
1079 } else if (sm->flagscxx . . $ bsp_info#flags. & SOF_FACINGcxx . . $ `lib/polymodel_external.h:92:9`!) {
1080 if (!FacingPasscxx . . $ FacingPass.)
1081 goto pop_lighting;
1082
1083 vectorcxx . . $ vector# pos;
1084 rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.);
1085 rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.);
1086 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
1087
1088 int bm_handle = GetTextureBitmapcxx . . $ GetTextureBitmap(6009f2e2e1989200).(pm->texturescxx . . $ poly_model#textures.[sm->facescxx . . $ bsp_info#faces.[0].texnumcxx . . $ polyface#texnum.], 0);
1089 rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(GameTexturescxx . . $ GameTextures.[pm->texturescxx . . $ poly_model#textures.[sm->facescxx . . $ bsp_info#faces.[0].texnumcxx . . $ polyface#texnum.]].alphacxx . . $ texture#alpha. * 255);
1090
1091 vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&pos);
1092
1093 if (GameTexturescxx . . $ GameTextures.[pm->texturescxx . . $ poly_model#textures.[sm->facescxx . . $ bsp_info#faces.[0].texnumcxx . . $ polyface#texnum.]].flagscxx . . $ texture#flags. & TF_SATURATEcxx . . $ `Descent3/gametexture.h:222:9`!)
1094 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_SATURATE_TEXTUREcxx . . $ `lib/renderer.h:408:9`!);
1095 else
1096 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_TEXTUREcxx . . $ `lib/renderer.h:395:9`!);
1097
1098 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(0);
1099 g3_DrawBitmapcxx . . $ g3_DrawBitmap(8d67c7afa700cf9).(&pos, sm->radcxx . . $ bsp_info#rad., (sm->radcxx . . $ bsp_info#rad. * bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(bm_handle, 0)) / bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(bm_handle, 0), bm_handle);
1100 rend_SetZBufferWriteMaskcxx . . $ rend_SetZBufferWriteMask(d4f767463ce0a6b3).(1);
1101
1102 goto pop_lighting;
1103 } else {
1104 if (FacingPasscxx . . $ FacingPass.)
1105 goto pop_lighting;
1106 }
1107
1108 RotateModelPointscxx . . $ RotateModelPoints(dea5851e769905e8).(pm, sm);
1109
1110 if (!UseHardwarecxx . . $ UseHardware.)
1111 RenderSubmodelFacesSortedcxx . . $ RenderSubmodelFacesSorted(dea5851e769905e8).(pm, sm);
1112 else
1113 RenderSubmodelFacesUnsortedcxx . . $ RenderSubmodelFacesUnsorted(dea5851e769905e8).(pm, sm);
1114 }
1115
1116 pop_lighting:
1117
1118 for (i = 0; i < sm->num_childrencxx . . $ bsp_info#num_children.; i++) {
1119 RenderSubmodelcxx . . $ RenderSubmodel(3a5661cc5f0d8c55).(pm, &pm->submodelcxx . . $ poly_model#submodel.[sm->childrencxx . . $ bsp_info#children.[i]], f_render_sub);
1120 }
1121
1122 g3_DoneInstancecxx . . $ g3_DoneInstance(49f6e7a06ebc5aa8).();
1123 DonePolyModelPosInstancecxx . . $ DonePolyModelPosInstance(49f6e7a06ebc5aa8).();
1124 DoneLightInstancecxx . . $ DoneLightInstance(49f6e7a06ebc5aa8).();
1125 }
1126
1127 int RenderPolygonModelcxx . . $ RenderPolygonModel(f5dd01fd8e510d62).(poly_modelcxx . . $ poly_model# *pm, uint32_tcxx . . $ uint32_t# f_render_sub) {
1128 ASSERTcxx . . $ `misc/pserror.h:246:9`!(pm->new_style == 1);
1129 int i = 0;
1130
1131 rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(ATF_CONSTANTcxx . . $ `lib/renderer.h:394:9`! + ATF_VERTEXcxx . . $ `lib/renderer.h:396:9`!);
1132 rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_WRAPcxx . . $ WT_WRAP.);
1133
1134 FacingPasscxx . . $ FacingPass. = 0;
1135 for (i = 0; i < pm->n_modelscxx . . $ poly_model#n_models.; i++) {
1136 bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[i];
1137 if (sm->parentcxx . . $ bsp_info#parent. == -1)
1138 RenderSubmodelcxx . . $ RenderSubmodel(3a5661cc5f0d8c55).(pm, sm, f_render_sub);
1139 }
1140
1141 // Now render any facing submodels
1142 if (pm->flagscxx . . $ poly_model#flags. & PMF_FACINGcxx . . $ `lib/polymodel_external.h:224:9`!) {
1143 // Don't render if we have it set for no glows
1144 FacingPasscxx . . $ FacingPass. = 1;
1145 rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!);
1146 for (i = 0; i < pm->n_modelscxx . . $ poly_model#n_models.; i++) {
1147 bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[i];
1148 if (sm->parentcxx . . $ bsp_info#parent. == -1)
1149 RenderSubmodelcxx . . $ RenderSubmodel(3a5661cc5f0d8c55).(pm, sm, f_render_sub);
1150 }
1151 }
1152
1153 FacingPasscxx . . $ FacingPass. = 0;
1154
1155 return 1;
1156 }
1157
1158 float ComputeDefaultSizeFunccxx . . $ ComputeDefaultSizeFunc(fb716385a494b69a).(int handle, float *size_ptr, vectorcxx . . $ vector# *offset_ptr, bool f_use_all_frames) {
1159 poly_modelcxx . . $ poly_model# *pm;
1160 matrixcxx . . $ matrix# m;
1161 float normalized_time[MAX_SUBOBJECTScxx . . $ `lib/polymodel_external.h:76:9`!];
1162 int model_index, sm_vert_index, frame_index;
1163 float cur_dist;
1164 float size = 0.0;
1165 int start_frame = 0;
1166 int end_frame = 0;
1167
1168 vectorcxx . . $ vector# geometric_center = Zero_vectorcxx . . $ Zero_vector.;
1169
1170 // Chris: Come see me when you are ready to deal with the paging problem - JL
1171 pm = GetPolymodelPointercxx . . $ GetPolymodelPointer(ac85e77c73ebf794).(handle);
1172
1173 ASSERTcxx . . $ `misc/pserror.h:246:9`!(start_frame <= end_frame);
1174 ASSERTcxx . . $ `misc/pserror.h:246:9`!(end_frame <= pm->frame_max);
1175
1176 if (f_use_all_frames) {
1177 end_frame = pm->frame_maxcxx . . $ poly_model#frame_max.;
1178 }
1179
1180 if (offset_ptr) {
1181 vectorcxx . . $ vector# min_xyz;
1182 vectorcxx . . $ vector# max_xyz;
1183 bool first_pnt = true;
1184
1185 for (frame_index = start_frame; frame_index <= end_frame; frame_index++) {
1186 // Because size changes with animation, we need the worst case point -- so, check every keyframe
1187 // NOTE: This code does not currently account for all $turret and $rotate positions
1188
1189 SetNormalizedTimeAnimcxx . . $ SetNormalizedTimeAnim(40d1f0252a152310).(frame_index, normalized_time, pm);
1190
1191 SetModelAnglesAndPoscxx . . $ SetModelAnglesAndPos(a00e94110fc4ea4c).(pm, normalized_time);
1192
1193 for (model_index = 0; model_index < pm->n_modelscxx . . $ poly_model#n_models.; model_index++) {
1194 bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[model_index];
1195
1196 // For every vertex
1197 for (sm_vert_index = 0; sm_vert_index < sm->nvertscxx . . $ bsp_info#nverts.; sm_vert_index++) {
1198 vectorcxx . . $ vector# pnt;
1199 int mn;
1200
1201 // Get the point and its current sub-object
1202 pnt =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). sm->vertscxx . . $ bsp_info#verts.[sm_vert_index];
1203 mn = model_index;
1204
1205 // Instance up the tree
1206 while (mn != -1) {
1207 vectorcxx . . $ vector# tpnt;
1208
1209 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&m, pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..pcxx . . $ angvec#p., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..hcxx . . $ angvec#h., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..bcxx . . $ angvec#b.);
1210 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
1211
1212 tpnt =cxx . . $ vector#`operator=`(c0842353a20857d). pnt *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
1213
1214 pnt =cxx . . $ vector#`operator=`(c0842353a20857d). tpnt +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].offsetcxx . . $ bsp_info#offset. +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].mod_poscxx . . $ bsp_info#mod_pos.;
1215
1216 mn = pm->submodelcxx . . $ poly_model#submodel.[mn].parentcxx . . $ bsp_info#parent.;
1217 }
1218
1219 // Maybe use for other code -- Accounts for world coordinates
1220 // m = obj->orient;
1221 // vm_TransposeMatrix(&m);
1222 //
1223 // pnt = pnt * m;
1224 //
1225 // *gun_point += obj->pos;
1226
1227 // Find the min_xyz and max_xyz
1228 if (first_pnt) {
1229 first_pnt = false;
1230 min_xyz =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). max_xyz =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pnt;
1231 } else {
1232 if (pnt.xcxx . . $ vector#x. < min_xyz.xcxx . . $ vector#x.)
1233 min_xyz.xcxx . . $ vector#x. = pnt.xcxx . . $ vector#x.;
1234 else if (pnt.xcxx . . $ vector#x. > max_xyz.xcxx . . $ vector#x.)
1235 max_xyz.xcxx . . $ vector#x. = pnt.xcxx . . $ vector#x.;
1236
1237 if (pnt.ycxx . . $ vector#y. < min_xyz.ycxx . . $ vector#y.)
1238 min_xyz.ycxx . . $ vector#y. = pnt.ycxx . . $ vector#y.;
1239 else if (pnt.ycxx . . $ vector#y. > max_xyz.ycxx . . $ vector#y.)
1240 max_xyz.ycxx . . $ vector#y. = pnt.ycxx . . $ vector#y.;
1241
1242 if (pnt.zcxx . . $ vector#z. < min_xyz.zcxx . . $ vector#z.)
1243 min_xyz.zcxx . . $ vector#z. = pnt.zcxx . . $ vector#z.;
1244 else if (pnt.zcxx . . $ vector#z. > max_xyz.zcxx . . $ vector#z.)
1245 max_xyz.zcxx . . $ vector#z. = pnt.zcxx . . $ vector#z.;
1246 }
1247 }
1248 }
1249 }
1250
1251 geometric_center =cxx . . $ vector#`operator=`(c0842353a20857d). (max_xyz +cxx . . $ operator+(b77b703cd1e43e33). min_xyz) /cxx . . $ `operator/`(252247219a31502c). 2.0;
1252 *offset_ptr =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). geometric_center;
1253 }
1254
1255 for (frame_index = start_frame; frame_index <= end_frame; frame_index++) {
1256 // Because size changes with animation, we need the worst case point -- so, check every keyframe
1257 // NOTE: This code does not currently account for all $turret and $rotate positions
1258
1259 SetNormalizedTimeAnimcxx . . $ SetNormalizedTimeAnim(40d1f0252a152310).(frame_index, normalized_time, pm);
1260
1261 SetModelAnglesAndPoscxx . . $ SetModelAnglesAndPos(a00e94110fc4ea4c).(pm, normalized_time);
1262
1263 for (model_index = 0; model_index < pm->n_modelscxx . . $ poly_model#n_models.; model_index++) {
1264 bsp_infocxx . . $ bsp_info# *sm = &pm->submodelcxx . . $ poly_model#submodel.[model_index];
1265
1266 // For every vertex
1267 for (sm_vert_index = 0; sm_vert_index < sm->nvertscxx . . $ bsp_info#nverts.; sm_vert_index++) {
1268 vectorcxx . . $ vector# pnt;
1269 int mn;
1270
1271 // Get the point and its current sub-object
1272 pnt =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). sm->vertscxx . . $ bsp_info#verts.[sm_vert_index];
1273 mn = model_index;
1274
1275 // Instance up the tree
1276 while (mn != -1) {
1277 vectorcxx . . $ vector# tpnt;
1278
1279 vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&m, pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..pcxx . . $ angvec#p., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..hcxx . . $ angvec#h., pm->submodelcxx . . $ poly_model#submodel.[mn].angscxx . . $ bsp_info#angs..bcxx . . $ angvec#b.);
1280 vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&m);
1281
1282 tpnt =cxx . . $ vector#`operator=`(c0842353a20857d). pnt *cxx . . $ `operator*`(14b8f9ac5c1e7b85). m;
1283
1284 pnt =cxx . . $ vector#`operator=`(c0842353a20857d). tpnt +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].offsetcxx . . $ bsp_info#offset. +cxx . . $ operator+(b77b703cd1e43e33). pm->submodelcxx . . $ poly_model#submodel.[mn].mod_poscxx . . $ bsp_info#mod_pos.;
1285
1286 mn = pm->submodelcxx . . $ poly_model#submodel.[mn].parentcxx . . $ bsp_info#parent.;
1287 }
1288
1289 // Maybe use for other code -- Accounts for world coordinates
1290 // m = obj->orient;
1291 // vm_TransposeMatrix(&m);
1292 //
1293 // pnt = pnt * m;
1294 //
1295 // *gun_point += obj->pos;
1296
1297 cur_dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&geometric_center, &pnt);
1298 if (cur_dist > size)
1299 size = cur_dist;
1300 }
1301 }
1302 }
1303
1304 // This is a arbitary value. It allows for some turret and rotations to be caught
1305 size = size + 0.01f;
1306
1307 if (size_ptr) // DAJ
1308 *size_ptr = size;
1309
1310 return size;
1311 }
1312
1313 float ComputeDefaultSizecxx . . $ ComputeDefaultSize(30915566dd087c6c).(int type, int handle, float *size_ptr) {
1314 float size = ComputeDefaultSizeFunccxx . . $ ComputeDefaultSizeFunc(fb716385a494b69a).(handle, size_ptr, nullptr, true);
1315
1316 if (type != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`! && type != OBJ_DEBRIScxx . . $ `Descent3/object_external.h:168:9`! && type != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) {
1317 ComputeDefaultSizeFunccxx . . $ ComputeDefaultSizeFunc(fb716385a494b69a).(handle, &Poly_modelscxx . . $ Poly_models.[handle].wall_sizecxx . . $ poly_model#wall_size., &Poly_modelscxx . . $ Poly_models.[handle].wall_size_offsetcxx . . $ poly_model#wall_size_offset., false);
1318 ComputeDefaultSizeFunccxx . . $ ComputeDefaultSizeFunc(fb716385a494b69a).(handle, &Poly_modelscxx . . $ Poly_models.[handle].anim_sizecxx . . $ poly_model#anim_size., &Poly_modelscxx . . $ Poly_models.[handle].anim_size_offsetcxx . . $ poly_model#anim_size_offset., true);
1319
1320 if (type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
1321 Poly_modelscxx . . $ Poly_models.[handle].anim_sizecxx . . $ poly_model#anim_size. *= PLAYER_SIZE_SCALARcxx . . $ `physics/findintersection.h:230:9`!;
1322 Poly_modelscxx . . $ Poly_models.[handle].anim_size_offsetcxx . . $ poly_model#anim_size_offset. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1323 }
1324 } else {
1325 if (type == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) {
1326 size *= 2.0f;
1327 *size_ptr *= 2.0f;
1328 }
1329
1330 Poly_modelscxx . . $ Poly_models.[handle].wall_sizecxx . . $ poly_model#wall_size. = size;
1331 Poly_modelscxx . . $ Poly_models.[handle].wall_size_offsetcxx . . $ poly_model#wall_size_offset. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1332
1333 Poly_modelscxx . . $ Poly_models.[handle].anim_sizecxx . . $ poly_model#anim_size. = size;
1334 Poly_modelscxx . . $ Poly_models.[handle].anim_size_offsetcxx . . $ poly_model#anim_size_offset. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.;
1335 }
1336
1337 Poly_modelscxx . . $ Poly_models.[handle].flagscxx . . $ poly_model#flags. |= PMF_SIZE_COMPUTEDcxx . . $ `lib/polymodel_external.h:226:9`!;
1338
1339 return size;
1340 }