annotate LightmapBuilder.cpp @ 59:5159d2e6f559

BLV render
author Nomad
date Fri, 26 Oct 2012 02:38:26 +0200
parents fde5c5acb66e
children fdacbc653945
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include "LightmapBuilder.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 #include "Game.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 #include "stru314.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "Outdoor.h"
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
5 #include "Log.h"
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14
29
e62134245ab0 On BLV loading.
Nomad
parents: 3
diff changeset
15 LightsStack_StationaryLight_ *pStationaryLightsStack = new LightsStack_StationaryLight_;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
16 //StationaryLight pStationaryLights[400];
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
17 //int uNumStationaryLightsApplied; // weak
29
e62134245ab0 On BLV loading.
Nomad
parents: 3
diff changeset
18 LightsStack_MobileLight_ *pMobileLightsStack = new LightsStack_MobileLight_;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
19 //MobileLight pMobileLights[400];
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
20 //int uNumMobileLightsApplied;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26 //----- (0045DF13) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 Lightmap::Lightmap()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 field_C18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 //----- (0045BB06) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 LightmapBuilder::LightmapBuilder()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45 //----- (0045BC07) --------------------------------------------------------
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
46 bool LightmapBuilder::ApplyLights(stru320 *a2, stru154 *a3, unsigned int uNumVertices, RenderVertexSoft *a5, IndoorCameraD3D_Vec4 *a6, char uClipFlag)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
48 Vec3_int_ pos; // [sp+2Ch] [bp-40h]@21
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
49 RenderVertexSoft *a9; // [sp+68h] [bp-4h]@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
50
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
51 if (!uNumVertices)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
52 return false;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
53
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
54 static RenderVertexSoft static_69B140[64];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
56 a9 = a5;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
57 if (a6)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
58 {
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
59 for (uint i = 0; i < uNumVertices; ++i)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
60 memcpy(static_69B140 + i, a5 + i, sizeof(RenderVertexSoft));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
62 __debugbreak();
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
63 if (pGame->pIndoorCameraD3D->_437376(
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
64 a3,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
65 static_69B140,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
66 &uNumVertices) == 1)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
67 {
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
68 if ( !uNumVertices )
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
69 return false;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
70 a9 = static_69B140;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
71 }
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
73
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
74 static stru314 static_69B110;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
75 static_69B110.field_4.x = a3->face_plane.vNormal.x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
76 static_69B110.field_4.y = a3->face_plane.vNormal.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
77 static_69B110.field_4.z = a3->face_plane.vNormal.z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
78 static_69B110.dist = a3->face_plane.dist;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
79 if (!pGame->pIndoorCameraD3D->GetFacetOrientation(
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
80 a3->polygonType,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
81 &static_69B110.field_4,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
82 &static_69B110.field_10,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
83 &static_69B110.field_1C))
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:119", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 ExitProcess(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
88
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
89 for (uint i = 0; i < a2->uNumLightsApplied; ++i)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
91 pos.x = a2->_blv_lights_xs[i];
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
92 pos.y = a2->_blv_lights_ys[i];
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
93 pos.z = a2->_blv_lights_zs[i];
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
94
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
95 uint uColorR = (uint)floorf(a2->_blv_lights_rs[i] * 255.0 + 0.5f) & 0xFF,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
96 uColorG = (uint)floorf(a2->_blv_lights_gs[i] * 255.0 + 0.5f) & 0xFF,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
97 uColorB = (uint)floorf(a2->_blv_lights_bs[i] * 255.0 + 0.5f) & 0xFF;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
98 uint uColor = (uColorR << 16) | (uColorG << 8) | uColorB;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
99 if (!uColor)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
100 uColor = 0x00FFFFF;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
101
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
102 if (!_45BE86_build_light_polygon(
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
103 &pos,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
104 a2->_blv_lights_radii[i],
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
105 uColor,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
106 a2->_blv_lights_light_dot_faces[i],
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
107 a2->_blv_lights_types[i],
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
108 &static_69B110,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
109 uNumVertices,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
110 a9,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
111 uClipFlag) )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
113 MessageBoxW(nullptr, L"Error: Failed to build light polygon", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:138", 0);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
116 return true;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 //----- (0045BE86) --------------------------------------------------------
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
120 bool LightmapBuilder::_45BE86_build_light_polygon(Vec3_int_ *pos, float radius, unsigned int uColorMask, float dot_dist, int uLightType, stru314 *a7, signed int a2, RenderVertexSoft *a9, char uClipFlag)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
122 //LightmapBuilder *v10; // esi@1
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 Lightmap *v11; // edi@3
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
124 //double v12; // st7@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
125 //double v13; // st7@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
126 //stru314 *v14; // ebx@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
127 //double v15; // st7@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
128 //RenderVertexSoft *pLightmapVertices; // edx@5
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 double v17; // st7@5
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
130 //double v18; // st7@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
131 //char *v19; // eax@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
132 //double v20; // st6@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
133 //double v21; // st5@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
134 //signed int v22; // ecx@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
135 //double v23; // st5@5
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 double v24; // st7@6
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
137 //int v25; // ebx@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
138 //double v26; // st7@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
139 //int v27; // eax@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
140 //double v28; // st6@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
141 //double v29; // st6@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
142 //double v30; // st5@8
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 int v31; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 int v32; // ebx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 unsigned int v33; // ecx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146 int v34; // edx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147 int v35; // edx@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148 unsigned int v36; // edx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 int v37; // ecx@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150 double v38; // st7@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 double v39; // st7@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152 double v40; // st7@16
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
153 //double v41; // st7@22
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
154 //stru9 *v42; // ecx@22
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
155 //char result; // al@22
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
156 //unsigned int *v44; // ebx@23
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157 int v45; // eax@24
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
158 //RenderVertexSoft *v46; // edi@27
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
159 //std::string *v47; // ecx@34
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
160 //char *v48; // esi@39
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
161 //int v49; // eax@39
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
162 //unsigned __int8 v50; // sf@39
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
163 //unsigned __int8 v51; // of@39
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
164 //const char *v52; // [sp-Ch] [bp-58h]@34
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165 int v53; // [sp-8h] [bp-54h]@34
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
166 //std::string v54; // [sp-4h] [bp-50h]@19
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
167 //float v55; // [sp+0h] [bp-4Ch]@22
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
168 //float v56; // [sp+4h] [bp-48h]@22
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
169 //int v57; // [sp+8h] [bp-44h]@22
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
170 //unsigned int v58; // [sp+Ch] [bp-40h]@16
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
171 //void *v59; // [sp+10h] [bp-3Ch]@16
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
172 //float v60; // [sp+20h] [bp-2Ch]@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
173 //float v61; // [sp+24h] [bp-28h]@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
174 //float v62; // [sp+28h] [bp-24h]@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
175 //Vec3_float_ a1; // [sp+2Ch] [bp-20h]@8
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
176 //double v64; // [sp+38h] [bp-14h]@8
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
177 //int pLightmapVertices_; // [sp+40h] [bp-Ch]@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
178 //float v66; // [sp+44h] [bp-8h]@5
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
179 //char v67; // [sp+4Bh] [bp-1h]@2
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
180 //float arg0b; // [sp+54h] [bp+8h]@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
181 //int arg0c; // [sp+54h] [bp+8h]@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
182 //int arg0a; // [sp+54h] [bp+8h]@8
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
183
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
184 //auto a4 = radius;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
185 //auto a5 = dot_dist;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
186
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
187 //v10 = this;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
188 if (fabsf(radius) < 1e-6f)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
189 return true;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
190
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
191 //v67 = uLightType & 1;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
192 v11 = uLightType & 1 ? &std__vector_000004[std__vector_000004_size] :
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
193 &std__vector_183808[std__vector_183808_size];
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
194 //v12 = radius - dot_dist;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
195 flt_3C8C24 = radius - dot_dist;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
196 //v13 = sqrt((radius + dot_dist) * (radius - dot_dist));
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
197 flt_3C8C28 = sqrt((radius + dot_dist) * (radius - dot_dist));
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
198 //v14 = a7;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
199 //v66 = 1.0 / radius;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
200 flt_3C8C2C_lightmaps_brightness = 1.0 - (radius - flt_3C8C28) / radius;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
201 v11->field_C08 = (double)pos->x - dot_dist * a7->field_4.x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
202 v11->field_C0A = (double)pos->y - dot_dist * a7->field_4.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
203 v11->field_C0C = (double)pos->z - dot_dist * a7->field_4.z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
204 //v15 = a4;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
205 //pLightmapVertices = v11->pVertices;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
206 v17 = radius * flt_3C8C2C_lightmaps_brightness;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
207 //pLightmapVertices_ = (int)v11->pVertices;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
208 flt_3C8C30 = v17;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
209 flt_3C8C0C = v17 * a7->field_10.x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
210 flt_3C8C10 = v17 * a7->field_10.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
211 flt_3C8C14 = v17 * a7->field_10.z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
212 flt_3C8C18 = v17 * a7->field_1C.x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
213 flt_3C8C1C = v17 * a7->field_1C.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
214 flt_3C8C20 = v17 * a7->field_1C.z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
215 //LODWORD(a5) = v11->field_C08;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
216 //v18 = (double)SLODWORD(a5);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
217 //LODWORD(a5) = v11->field_C0A;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
218 //v19 = (char *)&v11->pVertices[0].vWorldPosition.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
219 //v20 = (double)SLODWORD(a5);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
220 //v21 = v11->field_C0A - flt_3C8C1C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
221 //LODWORD(a5) = v11->field_C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
222 //v22 = 4;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
223 //v23 = (double)SLODWORD(a5);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
224 //a5 = v23;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
225
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
226
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
227 /*
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
228 v11->pVertices[0].vWorldPosition.x = v11->field_C08 - flt_3C8C18 + flt_3C8C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
229 v11->pVertices[0].vWorldPosition.y = v11->field_C0A - flt_3C8C1C + flt_3C8C10;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
230 v11->pVertices[0].vWorldPosition.z = v11->field_C0C - flt_3C8C20 + flt_3C8C14;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
231 v11->pVertices[0].u = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
232 v11->pVertices[0].v = 0.0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
233
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
234 v11->pVertices[1].vWorldPosition.x = v11->field_C08 - flt_3C8C18 - flt_3C8C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
235 v11->pVertices[1].vWorldPosition.y = v11->field_C0A - flt_3C8C1C - flt_3C8C10;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
236 v11->pVertices[1].vWorldPosition.z = v11->field_C0C - flt_3C8C20 - flt_3C8C14;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
237 v11->pVertices[1].u = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
238 v11->pVertices[1].v = 1.0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
239
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
240 v11->pVertices[2].vWorldPosition.x = v11->field_C08 + flt_3C8C18 - flt_3C8C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
241 v11->pVertices[2].vWorldPosition.y = v11->field_C0A + flt_3C8C1C - flt_3C8C10;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
242 v11->pVertices[2].vWorldPosition.z = v11->field_C0C + flt_3C8C20 - flt_3C8C14;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
243 v11->pVertices[2].u = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
244 v11->pVertices[2].v = 1.0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
245
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
246 v11->pVertices[3].vWorldPosition.x = v11->field_C08 + flt_3C8C18 + flt_3C8C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
247 v11->pVertices[3].vWorldPosition.y = v11->field_C0A + flt_3C8C1C + flt_3C8C10;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
248 v11->pVertices[3].vWorldPosition.z = v11->field_C0C + flt_3C8C20 + flt_3C8C14;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
249 v11->pVertices[3].u = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
250 v11->pVertices[3].v = 0.0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
251 */
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
252 //v19 = (char *)&v11->pVertices[0].vWorldPosition.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
253 for (uint i = 0; i < 4; ++i)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
254 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
255 v11->pVertices[i].vWorldPosition.x = v11->field_C08 - flt_3C8C18 + flt_3C8C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
256 v11->pVertices[i].vWorldPosition.y = v11->field_C0A - flt_3C8C1C + flt_3C8C10;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
257 v11->pVertices[i].vWorldPosition.z = v11->field_C0C - flt_3C8C20 + flt_3C8C14;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
258 v11->pVertices[i].u = 0.0;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
259 v11->pVertices[i].v = 0.0;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
260
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
261 v24 = a7->field_4.y * v11->pVertices[i].vWorldPosition.y
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
262 + a7->field_4.z * v11->pVertices[i].vWorldPosition.z
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
263 + a7->field_4.x * v11->pVertices[i].vWorldPosition.x
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
264 + a7->dist;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
265
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
266 v11->pVertices[i].vWorldPosition.x -= v24 * a7->field_4.x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
267 v11->pVertices[i].vWorldPosition.y -= v24 * a7->field_4.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
268 v11->pVertices[i].vWorldPosition.z -= v24 * a7->field_4.z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
269 //v19 += 48;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
270 //--v22;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
271 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
272 //while ( v22 );
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
273
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
274 v11->uColorMask = uColorMask;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
275 v11->uNumVertices = 4;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
276
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
277 if (~pGame->uFlags2 & 4)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
278 v11->fBrightness = flt_3C8C2C_lightmaps_brightness;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
279 else
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
280 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
281 //LODWORD(a5) = v11->field_C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
282 //v25 = pos;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
283 //v26 = v11->field_C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
284 //LODWORD(a5) = v11->field_C0A;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
285 //v27 = v11->field_C08;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
286 //a5 = v11->field_C0A;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
287 //uColorMask = v27;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
288 //v28 = (double)v27;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
289 //v61 = a5;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
290 //v60 = v27;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
291 //v62 = v26;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
292 //*(float *)&uColorMask = (double)pos->z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
293 //arg0b = (double)pos->y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
294 //v29 = (double)pos->x - v11->field_C08;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
295 //v30 = (double)pos->y - v11->field_C0A;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
296 //a5 = (double)pos->z - v11->field_C0C;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
297 Vec3_float_ a1; // [sp+2Ch] [bp-20h]@8
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
298 a1.x = (double)pos->x - v11->field_C08;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
299 a1.y = (double)pos->y - v11->field_C0A;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
300 a1.z = (double)pos->z - v11->field_C0C;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
301 a1.Normalize();
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
302 //v64 = v62 + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
303 //LODWORD(a5) = LODWORD(v64);
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
304 //LODWORD(a5) = floorf(v11->field_C0C + 0.5f);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
305 //v64 = v61 + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
306 //arg0c = LODWORD(v64);
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
307 //arg0c = floorf(v11->field_C0A + 0.5f);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
308 //v64 = v60 + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
309 //arg8 = LODWORD(v64);
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
310 //uColorMask = floorf(v11->field_C08 + 0.5f);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
311 //auto _v64 /*HIDWORD(v64)*/ = abs(pos->z - v11->field_C0C);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
312 //arg0a = abs(pos->y - v11->field_C0A);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
313 //v31 = abs(pos->x - v11->field_C08);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
314 //LODWORD(a5) = v31;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
315 //v32 = arg0a;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
316 //v33 = _v64;//HIDWORD(v64);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
317 auto dist_x = abs(pos->x - v11->field_C08), //v31
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
318 dist_y = abs(pos->y - v11->field_C0A), //v32 arg0a
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
319 dist_z = abs(pos->z - v11->field_C0C); //v33 _v64
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
320 v31 = dist_x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
321 v32 = dist_y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
322 v33 = dist_z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
323 if (v31 < dist_y)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
324 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
325 v34 = v31;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
326 v31 = dist_y;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
327 v32 = v34;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
328 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
329 if (v31 < dist_z)//SHIDWORD(v64) )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
330 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
331 v35 = v31;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
332 v31 = dist_z;//HIDWORD(v64);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
333 v33 = v35;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
334 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
335 if ( v32 < (signed int)v33 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
336 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
337 v36 = v33;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
338 v33 = v32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
339 v32 = v36;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
340 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
341 v37 = v33 >> 2;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
342 //LODWORD(a5) = ((unsigned int)(11 * v32) >> 5) + v37 + v31;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
343 v38 = (double)(signed)(((unsigned int)(11 * v32) >> 5) + v37 + v31);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
344 if (v38 > radius)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
345 return true;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
346 //radius = (1 / radius) * v38;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
347 if ( uLightType & 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
348 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
349 //v59 = (void *)v37;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
350 //uLightType = flt_4D86CC;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
351 //v58 = v37;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
352 v39 = fabs(a1.x * a7->field_4.x + a1.z * a7->field_4.z + a1.y * a7->field_4.y);
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
353 v40 = v39 * 1.0 * flt_4D86CC;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
354
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
355 v11->fBrightness = v40 - (1 / radius) * v38 * v40;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
356 }
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
357 else if ( uLightType & 8 )
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
358 {
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
359 v40 = 1.0 * 1.0;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
360 v11->fBrightness = v40 - (1 / radius) * v38;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
361 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
362 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
363 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
364 MessageBoxW(nullptr, L"Invalid light type!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:277", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
365 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
366 //v14 = a7;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
367 //pLightmapVertices = (RenderVertexSoft *)pLightmapVertices_;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
368 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
369
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
370
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
371 //v41 = a7->field_4.z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
372 //v42 = pGame->pStru9Instance;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
373 //v59 = &v11->uNumVertices;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
374 //v58 = (unsigned int)pLightmapVertices;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
375 //*(float *)&v57 = v41;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
376 //v56 = a7->field_4.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
377 //v55 = a7->field_4.x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
378 //result = v42->_4980B9(a9, a2, v55, v56, *(float *)&v57, pLightmapVertices, &v11->uNumVertices);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
379 if (pGame->pStru9Instance->_4980B9(a9, a2,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
380 a7->field_4.x, a7->field_4.y, a7->field_4.z,
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
381 v11->pVertices, &v11->uNumVertices))
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
382 return false;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
383
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
384 //v44 = &v11->uNumVertices;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
385 if (!v11->uNumVertices)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
386 return true;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
387
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
388 v45 = _45C6D6(a2, a9, v11);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
389 if ( v45 != a2 && v45 > 0 )
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
390 _45C4B9(a2, a9, v11);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
391 //v59 = v11->uNumVertices;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
392 //v46 = (RenderVertexSoft *)pLightmapVertices_;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
393 pGame->pIndoorCameraD3D->ViewTransform(v11->pVertices, v11->uNumVertices);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
394 //v59 = 0;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
395 //v58 = v11->uNumVertices;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
396 pGame->pIndoorCameraD3D->Project(v11->pVertices, v11->uNumVertices, 0);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
397
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
398 unsigned int _a4 = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
399 if ( !(uClipFlag & 1) )
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
400 _a4 = 1;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
401 else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
402 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
403 if ( uClipFlag & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
404 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
405 //v59 = &a4;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
406 //v58 = (unsigned int)field_3C8C34;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
407 //v57 = *v44;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
408 pGame->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(v11->pVertices, v11->uNumVertices, field_3C8C34, &_a4);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
409
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
410 //v59 = v44;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
411 //v58 = (unsigned int)field_3C8C34;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
412 //v57 = (int)v46;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
413 //v56 = a4;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
414 pGame->pIndoorCameraD3D->_437143(_a4, v11->pVertices, field_3C8C34, &v11->uNumVertices);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
415 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
416 else if ( uClipFlag & 4 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
417 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
418 //v59 = &a4;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
419 //v58 = (unsigned int)field_3C8C34;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
420 //v57 = *v44;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
421 pGame->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(v11->pVertices, v11->uNumVertices, field_3C8C34, &_a4);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
422
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
423 //v59 = v44;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
424 //v58 = (unsigned int)field_3C8C34;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
425 //v57 = (int)v46;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
426 //v56 = a4;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
427 pGame->pIndoorCameraD3D->_437143(_a4, v11->pVertices, field_3C8C34, &v11->uNumVertices);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
428 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
429 else
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
430 MessageBoxW(nullptr, L"Undefined clip flag specified", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:330", 0);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
431 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
432 else
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
433 MessageBoxW(nullptr, L"Lightpoly builder native indoor clipping not implemented", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:335", 0);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
434
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
435 if (_a4)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
436 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
437 if (uLightType & 1)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
438 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
439 //v48 = (char *)&std__vector_000004_size;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
440 //v49 = std__vector_000004_size;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
441 //v51 = __OFSUB__(std__vector_000004_size, 511);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
442 //v50 = std__vector_000004_size - 511 < 0;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
443 if (std__vector_000004_size < 512 - 1)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
444 ++std__vector_000004_size;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
445 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
446 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
447 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
448 //v48 = (char *)&std__vector_183808_size;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
449 //v49 = std__vector_183808_size;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
450 //v51 = __OFSUB__(std__vector_183808_size, 767);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
451 //v50 = std__vector_183808_size - 767 < 0;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
452 if (std__vector_183808_size < 768 - 1)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
453 ++std__vector_183808_size;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
454 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
455 //if ( v50 ^ v51 )
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
456 // *(unsigned int *)v48 = v49 + 1;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
457 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
458 return true;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
459 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
460
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
461 //----- (0045C4B9) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
462 int LightmapBuilder::_45C4B9(int a2, RenderVertexSoft *a3, Lightmap *pLightmap)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
463 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
464 Lightmap *v4; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
465 int v5; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
466 signed int v6; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
467 RenderVertexSoft *v7; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
468 int v8; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
469 RenderVertexSoft *v9; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
470 int v10; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
471 char *v11; // edi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
472 RenderVertexSoft *v12; // ecx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
473 char v13; // bl@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
474 signed int v14; // edx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
475 double v15; // st6@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
476 double v16; // st6@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
477 double v17; // st6@24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
478 signed int v18; // edx@33
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
479 int v20; // [sp+4h] [bp-1Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
480 int v21; // [sp+8h] [bp-18h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
481 float v22; // [sp+Ch] [bp-14h]@23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
482 float v23; // [sp+10h] [bp-10h]@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
483 int v24; // [sp+14h] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
484 RenderVertexSoft *v25; // [sp+18h] [bp-8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
485 char v26; // [sp+1Eh] [bp-2h]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
486 char v27; // [sp+1Fh] [bp-1h]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
487
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
488 v4 = pLightmap;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
489 v5 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
490 v6 = pLightmap->uNumVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
491 v24 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
492 if ( v6 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
493 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
494 v7 = pLightmap->pVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
495 v25 = pLightmap->pVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
496 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
497 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
498 v20 = v5 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
499 v8 = (v5 + 1) % v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
500 v9 = &v4->pVertices[v8];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
501 if ( v7->vWorldPosition.x != v9->vWorldPosition.x
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
502 || v7->vWorldPosition.y != v4->pVertices[v8].vWorldPosition.y
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
503 || v7->vWorldPosition.z != v4->pVertices[v8].vWorldPosition.z )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
504 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
505 v10 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
506 if ( a2 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
507 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
508 v11 = (char *)&a3->vWorldPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
509 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
510 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
511 v21 = v10 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
512 v12 = &a3[(v10 + 1) % a2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
513 if ( (*((float *)v11 - 2) != v12->vWorldPosition.x
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
514 || *((float *)v11 - 1) != v12->vWorldPosition.y
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
515 || *(float *)v11 != v12->vWorldPosition.z)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
516 && v7->vWorldPosition.x == *((float *)v11 - 2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
517 && v7->vWorldPosition.y == *((float *)v11 - 1)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
518 && v7->vWorldPosition.z == *(float *)v11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
519 && (v9->vWorldPosition.x != v12->vWorldPosition.x
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
520 || v9->vWorldPosition.y != v12->vWorldPosition.y
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
521 || v9->vWorldPosition.z != v12->vWorldPosition.z) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
522 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
523 v13 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
524 v14 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
525 v27 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
526 v26 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
527 if ( v9->vWorldPosition.x <= (double)v12->vWorldPosition.x )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
528 v15 = v12->vWorldPosition.x - v9->vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
529 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
530 v15 = v9->vWorldPosition.x - v12->vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
531 v23 = v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
532 if ( v9->vWorldPosition.y <= (double)v12->vWorldPosition.y )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
533 v16 = v12->vWorldPosition.y - v9->vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
534 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
535 v16 = v9->vWorldPosition.y - v12->vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
536 v22 = v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
537 if ( v9->vWorldPosition.z <= (double)v12->vWorldPosition.z )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
538 v17 = v12->vWorldPosition.z - v9->vWorldPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
539 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
540 v17 = v9->vWorldPosition.z - v12->vWorldPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
541 if ( v23 < 1.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
542 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
543 v13 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
544 v14 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
545 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
546 if ( v22 < 1.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
547 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
548 v27 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
549 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
550 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
551 if ( v17 < 1.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
552 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
553 v26 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
554 ++v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
555 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
556 if ( v14 > 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
557 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
558 v18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
559 if ( v13 && v9->vWorldPosition.x != v12->vWorldPosition.x )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
560 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
561 v18 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
562 v9->vWorldPosition.x = v12->vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
563 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
564 if ( v27 && v9->vWorldPosition.y != v12->vWorldPosition.y )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
565 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
566 ++v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
567 v9->vWorldPosition.y = v12->vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
568 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
569 if ( v26 && v9->vWorldPosition.z != v12->vWorldPosition.z )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
570 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
571 ++v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
572 v9->vWorldPosition.z = v12->vWorldPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
573 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
574 if ( v18 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
575 ++v24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
576 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
577 v7 = v25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
578 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
579 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
580 v11 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
581 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
582 while ( v21 < a2 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
583 v4 = pLightmap;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
584 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
585 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
586 v5 = v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
587 v6 = v4->uNumVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
588 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
589 v25 = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
590 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
591 while ( v20 < v6 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
592 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
593 return v24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
594 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
595
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
596 //----- (0045C6D6) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
597 int LightmapBuilder::_45C6D6(int a2, RenderVertexSoft *a3, Lightmap *pLightmap)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
598 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
599 Lightmap *v4; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
600 signed int v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
601 signed int v6; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
602 RenderVertexSoft *v7; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
603 char *v8; // edx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
604 double v9; // st7@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
605 double v10; // st6@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
606 double v11; // st5@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
607 double v12; // st7@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
608 RenderVertexSoft *v13; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
609 int v15; // [sp+Ch] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
610 float v16; // [sp+10h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
611 int pLightmapa; // [sp+24h] [bp+10h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
612
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
613 v4 = pLightmap;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
614 v5 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
615 v6 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
616 v16 = 3.4028235e38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
617 v15 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
618 if ( (signed int)pLightmap->uNumVertices > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
619 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
620 v7 = pLightmap->pVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
621 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
622 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
623 pLightmapa = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
624 if ( a2 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
625 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
626 v8 = (char *)&a3->vWorldPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
627 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
628 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
629 if ( v7->vWorldPosition.x <= (double)*((float *)v8 - 2) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
630 v9 = *((float *)v8 - 2) - v7->vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
631 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
632 v9 = v7->vWorldPosition.x - *((float *)v8 - 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
633 if ( v9 < 2.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
634 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
635 v10 = v7->vWorldPosition.y <= (double)*((float *)v8 - 1) ? *((float *)v8 - 1) - v7->vWorldPosition.y : v7->vWorldPosition.y - *((float *)v8 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
636 if ( v10 < 2.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
637 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
638 v11 = v7->vWorldPosition.z <= (double)*(float *)v8 ? *(float *)v8 - v7->vWorldPosition.z : v7->vWorldPosition.z - *(float *)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
639 if ( v11 < 2.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
640 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
641 v12 = v9 + v11 + v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
642 if ( v12 < v16 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
643 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
644 v16 = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
645 v6 = pLightmapa;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
646 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
647 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
648 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
649 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
650 ++pLightmapa;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
651 v8 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
652 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
653 while ( pLightmapa < a2 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
654 if ( v6 != -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
655 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
656 v13 = &a3[v6];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
657 ++v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
658 v7->vWorldPosition.x = v13->vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
659 v7->vWorldPosition.y = v13->vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
660 v7->vWorldPosition.z = v13->vWorldPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
661 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
662 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
663 v6 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
664 ++v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
665 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
666 v16 = 3.4028235e38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
667 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
668 while ( v5 < (signed int)v4->uNumVertices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
669 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
670 return v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
671 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
672
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
673 //----- (0045C7F6) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
674 bool LightmapBuilder::ApplyLights_IndoorFace(unsigned int uFaceID)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
675 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
676 auto pFace = &pIndoor->pFaces[uFaceID];
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
677 auto pSector = pIndoor->pSectors + pFace->uSectorID;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
678
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
679 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + pSector->uMinAmbientLightLevel) << 16;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
680
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
681 uint uNumLightsApplied = 0;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
682 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
683 {
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
684 if (uNumLightsApplied >= 20)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
685 break;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
686
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
687 ApplyLight_BLV((StationaryLight *)(pMobileLightsStack->pLights + i), pFace, &uNumLightsApplied, true, 0);
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
688 }
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
689
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
690 for (uint i = 0; i < pSector->uNumLights; ++i)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
691 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
692 if (uNumLightsApplied >= 20 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
693 break;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
694
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
695 auto pLight = &pIndoor->pLights[pSector->pLights[i]];
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
696 if (~pLight->uAtributes & 0x08)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
697 ApplyLight_BLV((StationaryLight *)pLight, pFace, &uFaceID, false, &byte_4E94D0);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
698 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
699
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
700 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
701 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
702 if (uNumLightsApplied >= 20)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
703 break;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
704
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
705 ApplyLight_BLV(pStationaryLightsStack->pLights + i, pFace, &uNumLightsApplied, false, &byte_4E94D0);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
706 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
707
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
708 stru_F8AD28.uNumLightsApplied = uNumLightsApplied;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
709 return true;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
710 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
711
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
712 //----- (0045C911) --------------------------------------------------------
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
713 bool LightmapBuilder::ApplyLight_BLV(StationaryLight *pLight, BLVFace *a2, unsigned int *pSlot, bool bLightBackfaces, char *a5)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
714 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
715 double v13; // st7@8
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
716
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
717 if (!pLight->uRadius)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
718 return false;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
719
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
720 if (pLight->vPosition.x > a2->pBounding.x1 - pLight->uRadius &&
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
721 pLight->vPosition.x < a2->pBounding.x2 + pLight->uRadius &&
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
722 pLight->vPosition.y > a2->pBounding.y1 - pLight->uRadius &&
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
723 pLight->vPosition.y < a2->pBounding.y2 + pLight->uRadius &&
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
724 pLight->vPosition.z > a2->pBounding.z1 - pLight->uRadius &&
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
725 pLight->vPosition.z < a2->pBounding.z2 + pLight->uRadius)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
726 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
727 v13 = (double)pLight->vPosition.z * a2->pFacePlane.vNormal.z +
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
728 (double)pLight->vPosition.y * a2->pFacePlane.vNormal.y +
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
729 (double)pLight->vPosition.x * a2->pFacePlane.vNormal.x +
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
730 a2->pFacePlane.dist;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
731 if ((bLightBackfaces || v13 >= 0.0f) && fabsf(v13) <= pLight->uRadius)
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
732 {
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
733 auto slot = *pSlot;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
734
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
735 stru_F8AD28._blv_lights_radii[slot] = pLight->uRadius;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
736 stru_F8AD28._blv_lights_inv_radii[slot] = 65536 / pLight->uRadius;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
737 stru_F8AD28._blv_lights_xs[slot] = pLight->vPosition.x;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
738 stru_F8AD28._blv_lights_ys[slot] = pLight->vPosition.y;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
739 stru_F8AD28._blv_lights_zs[slot] = pLight->vPosition.z;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
740 stru_F8AD28._blv_lights_rs[slot] = (double)pLight->uLightColorR / 255.0f;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
741 stru_F8AD28._blv_lights_gs[slot] = (double)pLight->uLightColorG / 255.0f;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
742 stru_F8AD28._blv_lights_bs[slot] = (double)pLight->uLightColorB / 255.0f;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
743 stru_F8AD28._blv_lights_light_dot_faces[slot] = abs((int)floorf(v13 + 0.5f));
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
744 stru_F8AD28._blv_lights_types[slot] = pLight->uLightType;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
745
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
746 *pSlot += 1;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
747 return true;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
748 }
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
749 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
750
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
751 return false;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
752 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
753
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
754 //----- (0045CA88) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
755 int LightmapBuilder::_45CA88(stru320 *a2, RenderVertexSoft *a3, int a4, Vec3_float_ *pNormal)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
756 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
757 int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
758 stru320 *v6; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
759 RenderVertexSoft *v7; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
760 double v8; // st7@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
761 double v9; // st6@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
762 char *v10; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
763 double v11; // st7@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
764 __int64 v12; // ST2C_8@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
765 float v13; // edx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
766 int v14; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
767 float v15; // ST10_4@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
768 Vec3_float_ v16; // ST00_12@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
769 double v17; // st7@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
770 int a5; // [sp+2Ch] [bp-1Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
771 float v19; // [sp+30h] [bp-18h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
772 float v20; // [sp+34h] [bp-14h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
773 LightmapBuilder *thisa; // [sp+38h] [bp-10h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
774 int v22; // [sp+3Ch] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
775 int *j; // [sp+40h] [bp-8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
776 int i; // [sp+44h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
777 int a3a; // [sp+58h] [bp+10h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
778
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
779 *(float *)&a5 = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
780 v19 = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
781 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
782 v20 = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
783 result = _45CBD4(a3, a4, dword_69B010, &v22);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
784 for ( i = 0; i < v22; result = i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
785 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
786 v6 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
787 a3a = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
788 v7 = &a3[dword_69B010[i]];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
789 v8 = v7->vWorldPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
790 v9 = v7->vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
791 *(float *)&a5 = v7->vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
792 v19 = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
793 v20 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
794 v7->flt_2C = 0.0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
795 if ( a2->uNumLightsApplied > 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
796 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
797 v10 = (char *)a2->_blv_lights_ys;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
798 for ( j = a2->_blv_lights_ys; ; v10 = (char *)j )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
799 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
800 v11 = (double)*((signed int *)v10 - 60);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
801 LODWORD(v12) = *((unsigned int *)v10 - 20);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
802 HIDWORD(v12) = *(unsigned int *)v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
803 LODWORD(v13) = *((unsigned int *)v10 + 60);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
804 v14 = a3a;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
805 LOBYTE(v14) = v6->_blv_lights_types[a3a];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
806 v15 = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
807 *(_QWORD *)&v16.x = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
808 v16.z = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
809 v17 = _45CC0C_light(v16/*COERCE_VEC3_FLOAT_(v16.x)*/, 1.0, v15, pNormal, *(float *)&a5/*COERCE_FLOAT(&a5)*/, v14)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
810 + v7->flt_2C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
811 ++a3a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
812 ++j;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
813 v7->flt_2C = v17;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
814 if ( a3a >= a2->uNumLightsApplied )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
815 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
816 v6 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
817 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
818 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
819 ++i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
820 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
821 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
822 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
823
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
824 //----- (0045CB89) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
825 int LightmapBuilder::_45CB89(RenderVertexSoft *a1, int a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
826 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
827 int v3; // edx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
828 int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
829 char *v5; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
830 double v6; // st7@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
831 __int16 v7; // fps@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
832 char v8; // c0@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
833 char v9; // c2@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
834 char v10; // c3@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
835 double v11; // st7@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
836 double v12; // st7@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
837 __int16 v13; // fps@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
838 char v14; // c0@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
839 char v15; // c2@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
840 char v16; // c3@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
841
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
842 v3 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
843 if ( a2 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
844 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
845 HIWORD(result) = HIWORD(a1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
846 v5 = (char *)&a1->flt_2C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
847 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
848 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
849 if ( *(float *)v5 < 0.0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
850 || (v6 = *(float *)v5, /*UNDEF(v7),*/ v8 = 1.0 < v6, v9 = 0, v10 = 1.0 == v6, LOWORD(result) = v7, v6 <= 1.0) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
851 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
852 v12 = *(float *)v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
853 //UNDEF(v13);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
854 v14 = 0.0 < v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
855 v15 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
856 v16 = 0.0 == v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
857 LOWORD(result) = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
858 if ( v12 >= 0.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
859 v11 = *(float *)v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
860 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
861 v11 = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
862 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
863 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
864 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
865 v11 = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
866 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
867 *(float *)v5 = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
868 v5 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
869 --v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
870 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
871 while ( v3 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
872 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
873 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
874 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
875
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
876 //----- (0045CBD4) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
877 int LightmapBuilder::_45CBD4(RenderVertexSoft *a2, int a3, int *a4, int *a5)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
878 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
879 int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
880 int v6; // edx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
881 int v7; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
882 int v8; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
883
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
884 result = (int)a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
885 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
886 for ( *a5 = 0; v6 < a3; ++v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
887 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
888 v7 = *a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
889 v8 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
890 if ( *a5 <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
891 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
892 LABEL_5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
893 a4[v7] = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
894 ++*a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
895 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
896 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
897 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
898 while ( a4[v8] != v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
899 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
900 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
901 if ( v8 >= v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
902 goto LABEL_5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
903 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
904 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
905 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
906 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
907 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
908
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
909 //----- (0045CC0C) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
910 double LightmapBuilder::_45CC0C_light(Vec3_float_ a1, float a2, float a3, Vec3_float_ *pNormal, float a5, int uLightType)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
911 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
912 float v7; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
913 int v8; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
914 int v9; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
915 unsigned int v10; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
916 int v11; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
917 int v12; // edx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
918 unsigned int v13; // edx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
919 double v14; // st7@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
920 double result; // st7@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
921 double v16; // st7@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
922 int v17; // esi@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
923 const char *v18; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
924 double v19; // st7@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
925 double v20; // st7@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
926 std::string v21; // [sp-10h] [bp-40h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
927 const char *v22[6]; // [sp+0h] [bp-30h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
928 double v23; // [sp+18h] [bp-18h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
929 double v24; // [sp+20h] [bp-10h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
930 int v25; // [sp+28h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
931 int v26; // [sp+2Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
932
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
933 v7 = a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
934 LODWORD(a5) = *(unsigned int *)(LODWORD(a5) + 8);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
935 //v24 = a5 + 6.7553994e15;
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
936 v26 = floorf(a5 + 0.5f);//LODWORD(v24);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
937 LODWORD(a5) = *(unsigned int *)(LODWORD(v7) + 4);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
938 //v24 = a5 + 6.7553994e15;
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
939 auto _v24 = floorf(a5 + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
940 LODWORD(a5) = *(unsigned int *)LODWORD(v7);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
941 //v23 = a5 + 6.7553994e15;
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
942 auto _v23 = floorf(a5 + 0.5f);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
943 //*(_QWORD *)((char *)&v24 + 4) = __PAIR__(LODWORD(v24), LODWORD(v23));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
944 v26 = abs((signed)LODWORD(a1.z) - v26);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
945 //v25 = abs((signed)LODWORD(a1.y) - (signed)LODWORD(v24));
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
946 //v8 = abs((int)a1.x - (signed)LODWORD(v23));
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
947 v25 = abs((signed)LODWORD(a1.y) - (signed)_v24);
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
948 v8 = abs((int)a1.x - (signed)_v23);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
949 LODWORD(a5) = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
950 v9 = v25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
951 v10 = v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
952 if ( v8 < v25 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
953 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
954 v11 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
955 v8 = v25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
956 v9 = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
957 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
958 if ( v8 < v26 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
959 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
960 v12 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
961 v8 = v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
962 v10 = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
963 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
964 if ( v9 < (signed int)v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
965 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
966 v13 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
967 v10 = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
968 v9 = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
969 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
970 v14 = (double)(signed int)(((unsigned int)(11 * v9) >> 5) + (v10 >> 2) + v8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
971 if ( v14 <= a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
972 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
973 a5 = v14 / a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
974 v16 = (double)(signed int)a1.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
975 *(float *)&v23 = (double)SLODWORD(a1.y);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
976 LODWORD(a1.x) = *(unsigned int *)LODWORD(v7);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
977 v17 = LODWORD(v7) + 4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
978 *((float *)&v23 + 1) = (double)SLODWORD(a1.z);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
979 LODWORD(a1.y) = *(unsigned int *)v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
980 LODWORD(a1.z) = *(unsigned int *)(v17 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
981 a3 = *((float *)&v23 + 1) - a1.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
982 a1.z = a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
983 a1.x = v16 - a1.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
984 a1.y = (float)v23 - a1.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
985 a1.Normalize();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
986 if ( uLightType & 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
987 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
988 v22[1] = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
989 uLightType = dword_4D86D8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
990 v22[0] = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
991 v19 = fabs(a1.z * pNormal->z + a1.y * pNormal->y + a1.x * pNormal->x);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
992 v20 = v19 * *(float *)&uLightType * a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
993 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
994 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
995 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
996 if ( uLightType & 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
997 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
998 v20 = 1.3 * a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
999 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1000 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1001 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1002 MessageBoxW(nullptr, L"Invalid light type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:783", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1003 v20 = *(float *)&uLightType;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1004 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1005 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1006 result = v20 - a5 * v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1007 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1008 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1009 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1010 result = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1011 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1012 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1013 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1014 // 4D86D8: using guessed type int dword_4D86D8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1015
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1016 //----- (0045CDB7) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1017 bool LightmapBuilder::ApplyLights_OutdoorFace(ODMFace *pFace)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1018 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1019 int v2; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1020 int v3; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1021 MobileLight *pMobileLight; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1022 int v5; // esi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1023 StationaryLight *pStationaryLight; // ebx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1024 bool result; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1025 LightmapBuilder *thisa; // [sp+Ch] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1026 int pSlot; // [sp+10h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1027
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1028 v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1029 thisa = this;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1030 v3 = stru_F8AD28.uDefaultAmbientLightLevel + pFace->uShadeType;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1031 pSlot = 0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1032 stru_F8AD28.uCurrentAmbientLightLevel = v3 << 16;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1033 if ( pMobileLightsStack->uNumLightsActive > 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1034 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1035 pMobileLight = pMobileLightsStack->pLights;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1036 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1037 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1038 if ( pSlot >= 20 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1039 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1040 ApplyLight_ODM((StationaryLight *)pMobileLight, pFace, (unsigned int *)&pSlot, 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1041 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1042 ++pMobileLight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1043 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1044 while ( v2 < pMobileLightsStack->uNumLightsActive );
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1045 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1046 v5 = 0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1047 if ( pStationaryLightsStack->uNumLightsActive > 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1048 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1049 pStationaryLight = pStationaryLightsStack->pLights;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1050 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1051 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1052 if ( pSlot >= 20 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1053 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1054 ApplyLight_ODM(pStationaryLight, pFace, (unsigned int *)&pSlot, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1055 ++v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1056 ++pStationaryLight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1057 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1058 while ( v5 < pStationaryLightsStack->uNumLightsActive );
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1059 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1060 result = pSlot;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1061 stru_F8AD28.uNumLightsApplied = pSlot;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1062 return true;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1063 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1064
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1065 //----- (0045CE50) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1066 bool LightmapBuilder::ApplyLight_ODM(StationaryLight *pLight, ODMFace *pFace, unsigned int *pSlot, char a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1067 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1068 int result; // eax@0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1069 signed int v6; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1070 int v7; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1071 int v8; // esi@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1072 int v9; // edx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1073 int v10; // ecx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1074 int v11; // eax@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1075 unsigned int v12; // ebx@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1076 RenderD3D *v13; // ecx@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1077 char v14; // dl@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1078
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1079 __debugbreak();
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1080
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1081 v6 = pLight->uRadius;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1082 if ( v6 > 0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1083 && (result = (int)pFace, v7 = pLight->vPosition.x, v7 > pFace->pBoundingBox.x1 - v6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1084 && v7 < v6 + pFace->pBoundingBox.x2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1085 && (v8 = pLight->vPosition.y, v8 > pFace->pBoundingBox.y1 - v6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1086 && v8 < v6 + pFace->pBoundingBox.y2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1087 && (v9 = pLight->vPosition.z, v9 > pFace->pBoundingBox.z1 - v6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1088 && v9 < v6 + pFace->pBoundingBox.z2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1089 && ((v10 = (pFace->pFacePlane.dist
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1090 + pLight->vPosition.x * pFace->pFacePlane.vNormal.x
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1091 + v8 * pFace->pFacePlane.vNormal.y
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1092 + v9 * pFace->pFacePlane.vNormal.z) >> 16,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1093 a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1094 || v10 >= 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1095 && v10 <= v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1096 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1097 stru_F8AD28._blv_lights_radii[*pSlot] = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1098 stru_F8AD28._blv_lights_inv_radii[*pSlot] = 65536 / v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1099 stru_F8AD28._blv_lights_xs[*pSlot] = pLight->vPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1100 stru_F8AD28._blv_lights_ys[*pSlot] = pLight->vPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1101 stru_F8AD28._blv_lights_zs[*pSlot] = pLight->vPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1102 stru_F8AD28._blv_lights_rs[*pSlot] = (double)pLight->uLightColorR * 0.0039215689;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1103 stru_F8AD28._blv_lights_gs[*pSlot] = (double)pLight->uLightColorG * 0.0039215689;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1104 stru_F8AD28._blv_lights_bs[*pSlot] = (double)pLight->uLightColorB * 0.0039215689;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1105 v11 = abs(v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1106 v12 = pRenderer->bUsingSpecular;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1107 stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = v11;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1108 stru_F8AD28._blv_lights_types[*pSlot] = pLight->uLightType;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1109 v13 = pRenderer->pRenderD3D;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1110 v14 = stru_F8AD28._blv_lights_types[*pSlot];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1111 if ( pRenderer->pRenderD3D && v12 && v14 & 4 )
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1112 v14 = _4E94D2_light_type;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1113 stru_F8AD28._blv_lights_types[*pSlot] = v14;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1114 result = 4 * *pSlot;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1115 if ( v13 && v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1116 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1117 if ( stru_F8AD28._blv_lights_types[*pSlot] & 4 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1118 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1119 *(float *)((char *)stru_F8AD28._blv_lights_rs + result) = *(float *)((char *)stru_F8AD28._blv_lights_rs + result)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1120 * 0.33000001;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1121 *(float *)((char *)stru_F8AD28._blv_lights_gs + result) = *(float *)((char *)stru_F8AD28._blv_lights_gs + result)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1122 * 0.33000001;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1123 *(float *)((char *)stru_F8AD28._blv_lights_bs + result) = *(float *)((char *)stru_F8AD28._blv_lights_bs + result)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1124 * 0.33000001;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1125 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1126 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1127 ++*pSlot;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1128 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1129 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1130 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1131 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1132 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1133 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1134 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1135 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1136 // 4E94D2: using guessed type char _4E94D2_light_type;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1137
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1138 //----- (0045D036) --------------------------------------------------------
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1139 bool LightmapBuilder::StackLights_TerrainFace(Vec3_float_ *pNormal, float *a3, RenderVertexSoft *a1, unsigned int uStripType, bool bLightBackfaces)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1140 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1141 int v6; // esi@1
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1142 //LightmapBuilder *v7; // edi@1
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1143 MobileLight *v8; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1144 int v9; // esi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1145 StationaryLight *v10; // ebx@6
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1146 //bool result; // eax@9
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1147 unsigned int a7; // [sp+Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1148
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1149 v6 = 0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1150 //v7 = this;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1151 a7 = 0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1152 stru_F8AD28.uCurrentAmbientLightLevel = pOutdoor->field_CBC_terrain_triangles_shade_type;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1153 if ( pMobileLightsStack->uNumLightsActive > 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1154 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1155 v8 = pMobileLightsStack->pLights;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1156 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1157 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1158 if ( (signed int)a7 >= 20 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1159 break;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1160 StackLight_TerrainFace((StationaryLight *)v8, pNormal, a3, a1, uStripType, bLightBackfaces, &a7);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1161 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1162 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1163 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1164 while ( v6 < pMobileLightsStack->uNumLightsActive );
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1165 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1166 v9 = 0;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1167 if ( pStationaryLightsStack->uNumLightsActive > 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1168 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1169 v10 = pStationaryLightsStack->pLights;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1170 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1171 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1172 if ( (signed int)a7 >= 20 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1173 break;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1174 StackLight_TerrainFace(v10, pNormal, a3, a1, uStripType, bLightBackfaces, &a7);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1175 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1176 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1177 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1178 while ( v9 < pStationaryLightsStack->uNumLightsActive );
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1179 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1180
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1181 stru_F8AD28.uNumLightsApplied = a7;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1182 return true;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1183 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1184 // 519AB4: using guessed type int uNumStationaryLightsApplied;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1185
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1186 //----- (0045D0D5) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1187 bool LightmapBuilder::StackLight_TerrainFace(StationaryLight *pLight, Vec3_float_ *pNormal, float *a3, RenderVertexSoft *a1, unsigned int uStripType, int X, unsigned int *pSlot)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1188 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1189 StationaryLight *v8; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1190 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1191 unsigned int v10; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1192 RenderVertexSoft *v11; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1193 float v12; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1194 float v13; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1195 double v14; // st7@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1196 double maxz; // st7@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1197 double v16; // st7@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1198 double v17; // st6@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1199 __int16 v18; // fps@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1200 char v19; // c0@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1201 char v20; // c2@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1202 char v21; // c3@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1203 double v22; // st6@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1204 __int16 v23; // fps@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1205 char v24; // c0@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1206 char v25; // c2@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1207 char v26; // c3@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1208 double v27; // st7@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1209 double v28; // st6@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1210 __int16 v29; // fps@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1211 char v30; // c0@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1212 char v31; // c2@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1213 char v32; // c3@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1214 double v33; // st6@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1215 __int16 v34; // fps@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1216 char v35; // c0@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1217 char v36; // c2@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1218 char v37; // c3@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1219 double v38; // st7@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1220 double v39; // st6@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1221 __int16 v40; // fps@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1222 char v41; // c0@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1223 char v42; // c2@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1224 char v43; // c3@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1225 double v44; // st6@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1226 __int16 v45; // fps@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1227 char v46; // c0@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1228 char v47; // c2@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1229 char v48; // c3@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1230 Vec3_float_ *v49; // esi@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1231 double v50; // st7@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1232 double v51; // st6@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1233 signed int v52; // ecx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1234 unsigned int *v53; // esi@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1235 int v54; // eax@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1236 unsigned int v55; // ebx@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1237 RenderD3D *v56; // ecx@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1238 char v57; // dl@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1239 std::string v58; // [sp-18h] [bp-38h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1240 const char *v59; // [sp-8h] [bp-28h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1241 signed int v60; // [sp-4h] [bp-24h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1242 double v61; // [sp+Ch] [bp-14h]@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1243 float minz; // [sp+14h] [bp-Ch]@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1244 int v63; // [sp+18h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1245 float v64; // [sp+1Ch] [bp-4h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1246
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1247 v8 = pLight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1248 result = pLight->uRadius;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1249 v63 = pLight->uRadius;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1250 if ( result <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1251 goto LABEL_27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1252 v10 = uStripType;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1253 v11 = a1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1254 if ( uStripType == 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1255 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1256 pLight = (StationaryLight *)LODWORD(a1->vWorldPosition.x);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1257 v12 = a1[3].vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1258 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1259 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1260 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1261 if ( uStripType != 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1262 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1263 MessageBoxW(nullptr, L"Uknown strip type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:981", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1264 goto LABEL_11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1265 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1266 if ( (unsigned char)X )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1267 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1268 pLight = (StationaryLight *)LODWORD(a1->vWorldPosition.x);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1269 uStripType = LODWORD(a1[2].vWorldPosition.x);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1270 a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1271 v13 = v11[2].vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1272 goto LABEL_5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1273 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1274 pLight = (StationaryLight *)LODWORD(a1[1].vWorldPosition.x);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1275 v12 = a1[2].vWorldPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1276 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1277 uStripType = LODWORD(v12);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1278 a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1279 v13 = v11->vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1280 LABEL_5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1281 v64 = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1282 LABEL_11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1283 v60 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1284 v59 = (const char *)v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1285 v14 = pGame->pIndoorCameraD3D->GetPolygonMinZ(v11, v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1286 v60 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1287 minz = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1288 maxz = pGame->pIndoorCameraD3D->GetPolygonMaxZ(v11, v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1289 result = v8->vPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1290 *((float *)&v61 + 1) = maxz;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1291 v16 = (double)result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1292 *(float *)&X = (double)v63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1293 v17 = *(float *)&pLight - *(float *)&X;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1294 //UNDEF(v18);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1295 v19 = v16 < v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1296 v20 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1297 v21 = v16 == v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1298 BYTE1(result) = HIBYTE(v18);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1299 if ( v16 <= v17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1300 || (v22 = *(float *)&X + *(float *)&uStripType,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1301 //UNDEF(v23),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1302 v24 = v16 < v22,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1303 v25 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1304 v26 = v16 == v22,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1305 BYTE1(result) = HIBYTE(v23),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1306 v16 >= v22)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1307 || (result = v8->vPosition.y,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1308 pLight = (StationaryLight *)v8->vPosition.y,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1309 v27 = (double)(signed int)pLight,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1310 v28 = *(float *)&a1 - *(float *)&X,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1311 //UNDEF(v29),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1312 v30 = v27 < v28,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1313 v31 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1314 v32 = v27 == v28,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1315 BYTE1(result) = HIBYTE(v29),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1316 v27 <= v28)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1317 || (v33 = *(float *)&X + v64,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1318 //UNDEF(v34),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1319 v35 = v27 < v33,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1320 v36 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1321 v37 = v27 == v33,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1322 BYTE1(result) = HIBYTE(v34),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1323 v27 >= v33)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1324 || (result = v8->vPosition.z,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1325 pLight = (StationaryLight *)v8->vPosition.z,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1326 v38 = (double)(signed int)pLight,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1327 v39 = minz - *(float *)&X,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1328 //UNDEF(v40),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1329 v41 = v38 < v39,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1330 v42 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1331 v43 = v38 == v39,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1332 BYTE1(result) = HIBYTE(v40),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1333 v38 <= v39)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1334 || (v44 = *(float *)&X + *((float *)&v61 + 1),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1335 //UNDEF(v45),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1336 v46 = v38 < v44,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1337 v47 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1338 v48 = v38 == v44,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1339 BYTE1(result) = HIBYTE(v45),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1340 v38 >= v44)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1341 || (v49 = pNormal,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1342 Vec3_float_::NegDot(&v11->vWorldPosition, pNormal, a3),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1343 X = v8->vPosition.y,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1344 v50 = (double)X * v49->y,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1345 X = v8->vPosition.z,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1346 v51 = (double)X * v49->z,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1347 X = v8->vPosition.x,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1348 *(float *)&a3 = v50 + v51 + (double)X * v49->x + *a3,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1349 v61 = *(float *)&a3 + 6.7553994e15,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1350 result = LODWORD(v61),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1351 X = LODWORD(v61),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1352 v52 = v63,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1353 SLODWORD(v61) > v63) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1354 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1355 LABEL_27:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1356 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1357 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1358 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1359 v53 = pSlot;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1360 v60 = X;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1361 stru_F8AD28._blv_lights_radii[*pSlot] = v63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1362 stru_F8AD28._blv_lights_inv_radii[*v53] = 65536 / v52;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1363 stru_F8AD28._blv_lights_xs[*v53] = v8->vPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1364 stru_F8AD28._blv_lights_ys[*v53] = v8->vPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1365 stru_F8AD28._blv_lights_zs[*v53] = v8->vPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1366 a3 = (float *)v8->uLightColorR;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1367 stru_F8AD28._blv_lights_rs[*v53] = (double)(signed int)a3 * 0.0039215689;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1368 a3 = (float *)v8->uLightColorG;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1369 stru_F8AD28._blv_lights_gs[*v53] = (double)(signed int)a3 * 0.0039215689;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1370 a3 = (float *)v8->uLightColorB;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1371 stru_F8AD28._blv_lights_bs[*v53] = (double)(signed int)a3 * 0.0039215689;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1372 v54 = abs(v60);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1373 v55 = pRenderer->bUsingSpecular;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1374 stru_F8AD28._blv_lights_light_dot_faces[*v53] = v54;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1375 stru_F8AD28._blv_lights_types[*v53] = v8->uLightType;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1376 v56 = pRenderer->pRenderD3D;
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1377 v57 = stru_F8AD28._blv_lights_types[*v53];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1378 if ( pRenderer->pRenderD3D && v55 && v57 & 4 )
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1379 v57 = _4E94D2_light_type;
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1380 stru_F8AD28._blv_lights_types[*v53] = v57;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1381 result = 4 * *v53;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1382 if ( v56 && v55 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1383 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1384 if ( stru_F8AD28._blv_lights_types[*v53] & 4 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1385 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1386 *(float *)((char *)stru_F8AD28._blv_lights_rs + result) = *(float *)((char *)stru_F8AD28._blv_lights_rs + result)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1387 * 0.33000001;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1388 *(float *)((char *)stru_F8AD28._blv_lights_gs + result) = *(float *)((char *)stru_F8AD28._blv_lights_gs + result)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1389 * 0.33000001;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1390 *(float *)((char *)stru_F8AD28._blv_lights_bs + result) = *(float *)((char *)stru_F8AD28._blv_lights_bs + result)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1391 * 0.33000001;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1392 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1393 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1394 ++*v53;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1395 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1396 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1397 }
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
1398 // 4E94D2: using guessed type char _4E94D2_light_type;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1399
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1400 //----- (0045D3C7) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1401 bool LightmapBuilder::_45D3C7(stru148 *a1)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1402 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1403 LightmapBuilder *v2; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1404 stru148 *result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1405 float v4; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1406 Span *i; // edi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1407
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1408 v2 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1409 result = (stru148 *)a1->prolly_head;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1410 if ( result && (v4 = result->field_4, *(int *)&v4) != 0 && *(unsigned int *)(LODWORD(v4) + 60) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1411 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1412 for ( i = a1->prolly_head; ; i = i->pNext )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1413 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1414 result = i->pParent;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1415 if ( result->field_108 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1416 result = (stru148 *)_45D426(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1417 i,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1418 a1->pEdgeList1,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1419 a1->uEdgeList1Size,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1420 (Edge *)a1->pEdgeList2,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1421 a1->uEdgeList2Size);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1422 if ( a1->prolly_tail == i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1423 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1424 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1425 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1426 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1427 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1428 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1429 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1430 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1431 return (bool)result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1432 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1433
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1434 //----- (0045D426) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1435 int LightmapBuilder::_45D426(Span *a1, Edge **a2, unsigned int a3, Edge *a4, int a5)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1436 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1437 int v6; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1438 signed int v7; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1439 signed int v8; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1440 Span *v9; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1441 double v10; // st7@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1442 Edge *v11; // edx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1443 double v12; // st7@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1444 int v13; // edx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1445 int v14; // ebx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1446 Edge *v15; // edi@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1447 float v16; // ST04_4@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1448 float v17; // ST04_4@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1449 double v18; // st7@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1450 int result; // eax@19
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1451 //double v20; // ST14_8@20
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1452 //double v21; // ST14_8@20
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1453 double v22; // st7@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1454 int v23; // ecx@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1455 double v24; // st6@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1456 double v25; // st7@23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1457 double v26; // st7@28
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1458 __int16 v27; // fps@28
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1459 char v28; // c0@28
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1460 char v29; // c2@28
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1461 char v30; // c3@28
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1462 double v31; // st7@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1463 double v32; // st7@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1464 __int16 v33; // fps@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1465 char v34; // c0@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1466 char v35; // c2@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1467 char v36; // c3@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1468 LightmapBuilder *this_4; // [sp+14h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1469 signed int v38; // [sp+18h] [bp-4h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1470 float a1a; // [sp+24h] [bp+8h]@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1471 float a2a; // [sp+28h] [bp+Ch]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1472 float a3a; // [sp+2Ch] [bp+10h]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1473 float a5a; // [sp+34h] [bp+18h]@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1474 float a5b; // [sp+34h] [bp+18h]@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1475
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1476 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1477 this_4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1478 if ( a5 && a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1479 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1480 v7 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1481 v8 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1482 v9 = a1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1483 v38 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1484 if ( (signed int)a3 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1485 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1486 v10 = (double)a1->field_A;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1487 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1488 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1489 v11 = a2[v8];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1490 if ( v10 >= v11->field_2C )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1491 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1492 if ( v10 <= v11->field_30 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1493 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1494 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1495 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1496 if ( v8 >= (signed int)a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1497 goto LABEL_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1498 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1499 v38 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1500 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1501 LABEL_10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1502 if ( a5 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1503 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1504 v12 = (double)a1->field_A;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1505 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1506 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1507 v13 = *((unsigned int *)&a4->field_0 + v6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1508 if ( v12 >= *(float *)(v13 + 44) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1509 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1510 if ( v12 <= *(float *)(v13 + 48) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1511 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1512 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1513 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1514 if ( v6 >= a5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1515 goto LABEL_17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1516 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1517 v7 = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1518 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1519 LABEL_17:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1520 v14 = *((unsigned int *)&a4->field_0 + v7);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1521 v15 = a2[v38];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1522 v16 = (double)a1->field_A;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1523 a3a = _45D643(a2[v38], v16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1524 v17 = (double)a1->field_A;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1525 v18 = _45D643((Edge *)v14, v17);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1526 a2a = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1527 if ( byte_4D864C && BYTE1(pGame->uFlags) & 0x80 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1528 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1529 HIWORD(result) = HIWORD(a3a);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1530 a1->field_14 = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1531 a1->field_10 = a3a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1532 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1533 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1534 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1535 a5a = ((double)a1->field_A - v15->field_2C) * v15->field_4 + v15->field_24 - 0.5;
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1536 //v20 = a5a + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1537 //a5b = (double)SLODWORD(v20);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1538 a5b = (double)floorf(a5a + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1539 a1a = ((double)a1->field_A - *(float *)(v14 + 44)) * *(float *)(v14 + 4) + *(float *)(v14 + 36) + 0.5;
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1540 //v21 = a1a + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1541 //v22 = (double)SLODWORD(v21);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1542 v22 = (double)floorf(a1a + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1543 result = v9->field_8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1544 v23 = v9->field_C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1545 v24 = -((a3a - a2a) / (v22 - a5b));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1546 v9->field_10 = ((double)result - a5b) * v24 + a3a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1547 v9->field_14 = a2a - (v22 - (double)(result + v23)) * v24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1548 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1549 if ( v9->field_10 < 0.0 || v9->field_10 <= 1.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1550 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1551 if ( v9->field_10 >= 0.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1552 v25 = v9->field_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1553 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1554 v25 = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1555 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1556 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1557 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1558 v25 = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1559 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1560 v9->field_10 = v25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1561 if ( v9->field_14 < 0.0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1562 || (v26 = v9->field_14,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1563 //UNDEF(v27),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1564 v28 = 1.0 < v26,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1565 v29 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1566 v30 = 1.0 == v26,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1567 BYTE1(result) = HIBYTE(v27),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1568 v26 <= 1.0) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1569 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1570 v32 = v9->field_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1571 //UNDEF(v33);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1572 v34 = 0.0 < v32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1573 v35 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1574 v36 = 0.0 == v32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1575 BYTE1(result) = HIBYTE(v33);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1576 if ( v32 >= 0.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1577 v31 = v9->field_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1578 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1579 v31 = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1580 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1581 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1582 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1583 v31 = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1584 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1585 v9->field_14 = v31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1586 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1587 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1588 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1589 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1590 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1591 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1592 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1593 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1594 // 4D864C: using guessed type char byte_4D864C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1595
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1596 //----- (0045D643) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1597 double LightmapBuilder::_45D643(Edge *a1, float a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1598 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1599 double result; // st7@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1600
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1601 result = (a1->field_1C - a1->field_20) * -1.0 / (a1->field_30 - a1->field_2C) * (a2 - a1->field_2C) + a1->field_1C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1602 if ( result < 0.0 || result <= 1.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1603 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1604 if ( result < 0.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1605 result = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1606 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1607 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1608 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1609 result = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1610 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1611 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1612 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1613
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1614 //----- (0045D698) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1615 bool LightmapBuilder::DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1616 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1617 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1618 LightmapBuilder *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1619 RenderVertexSoft *v4; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1620 RenderVertexSoft *v5; // edi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1621 IndoorCameraD3D *thisa; // [sp+10h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1622 bool v7; // [sp+14h] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1623 bool a2a; // [sp+20h] [bp+8h]@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1624
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1625 result = (bool)pGame->pIndoorCameraD3D;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1626 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1627 thisa = pGame->pIndoorCameraD3D;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1628 if ( bit_one_for_list1__bit_two_for_list2 & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1629 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1630 v7 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1631 if ( (signed int)this->std__vector_000004_size > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1632 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1633 v4 = this->std__vector_000004[0].pVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1634 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1635 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1636 pGame->pIndoorCameraD3D->debug_outline_sw(v4, *((unsigned int *)v4 - 1), 0xFF00u, 0.0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1637 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1638 v4 = (RenderVertexSoft *)((char *)v4 + 3100);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1639 result = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1640 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1641 while ( v7 < (signed int)v3->std__vector_000004_size );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1642 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1643 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1644 if ( bit_one_for_list1__bit_two_for_list2 & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1645 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1646 a2a = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1647 if ( (signed int)v3->std__vector_183808_size > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1648 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1649 v5 = v3->std__vector_183808[0].pVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1650 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1651 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1652 pGame->pIndoorCameraD3D->debug_outline_sw(v5, *((unsigned int *)v5 - 1), 0xC04000u, 0.00019999999);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1653 ++a2a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1654 v5 = (RenderVertexSoft *)((char *)v5 + 3100);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1655 result = a2a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1656 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1657 while ( a2a < (signed int)v3->std__vector_183808_size );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1658 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1659 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1660 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1661 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1662 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1663
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1664 //----- (0045D73F) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1665 void LightmapBuilder::DrawLightmaps(int a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1666 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1667 if ( a2 == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1668 DoDrawLightmaps();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1669 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1670
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1671 //----- (0045D74F) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1672 char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1673 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1674 char v3; // zf@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1675 IDirect3DDevice3 *v4; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1676 HRESULT v5; // eax@2
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1677 //char *v6; // eax@2
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1678 struct IDirect3DTexture2 *v7; // edi@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1679 HRESULT v8; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1680 HRESULT v9; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1681 HRESULT v10; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1682 HRESULT v11; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1683 HRESULT v12; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1684 int *v13; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1685 float v14; // ecx@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1686 IDirect3DDevice3 *v15; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1687 HRESULT v16; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1688 IDirect3DDevice3 *v17; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1689 HRESULT v18; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1690 IDirect3DDevice3 *v19; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1691 HRESULT v20; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1692 IDirect3DDevice3 *v21; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1693 HRESULT v22; // eax@21
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1694 //IDirect3DDevice3 *v23; // eax@23
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1695 std::string v25; // [sp+44h] [bp-44h]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1696 signed int v26; // [sp+48h] [bp-40h]@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1697 signed int v27; // [sp+4Ch] [bp-3Ch]@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1698 Lightmap *v28; // [sp+50h] [bp-38h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1699 int v29; // [sp+54h] [bp-34h]@2
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1700 //float v30; // [sp+58h] [bp-30h]@2
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1701 int arg4; // [sp+68h] [bp-20h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1702 float v32; // [sp+6Ch] [bp-1Ch]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1703 float v33; // [sp+70h] [bp-18h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1704 int v34; // [sp+74h] [bp-14h]@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1705 int v35; // [sp+78h] [bp-10h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1706 int *v36; // [sp+7Ch] [bp-Ch]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1707 int a1; // [sp+80h] [bp-8h]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1708 float v38; // [sp+84h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1709
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1710 v3 = this->std__vector_000004_size == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1711 LODWORD(v38) = (int)this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1712 if ( !v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1713 {
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1714 //v30 = 0.0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1715 //v4 = pRenderer->pRenderD3D->pDevice;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1716 ErrD3D(v4->SetTextureStageState(0, D3DTSS_ADDRESS, 3u));
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1717 //v6 = (char *)stru_69BD44.c_str();
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1718 //if ( !stru_69BD44.c_str() )
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1719 // v6 = (char *)&dword_4D86F0;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1720 v7 = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03");
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1721 if ( pRenderer->bUsingSpecular )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1722 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1723 if ( !byte_4D864C || !(pGame->uFlags & 1) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1724 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1725 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1726 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1727 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, v7));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1728 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1729 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1730 v13 = a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1731 v33 = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1732 v32 = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1733 *(float *)&arg4 = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1734 if ( a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1735 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1736 if ( *a3 != -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1737 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1738 v36 = a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1739 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1740 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1741 v28 = (Lightmap *)(3100 * *v13 + LODWORD(v38) + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1742 if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1743 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1744 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1230", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1745 a1 = 5080812;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1746 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1747 v13 = v36 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1748 v36 = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1749 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1750 while ( *v13 != -1 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1751 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1752 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1753 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1754 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1755 v14 = v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1756 v36 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1757 if ( *(unsigned int *)(LODWORD(v38) + 1587204) > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1758 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1759 a1 = LODWORD(v38) + 4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1760 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1761 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1762 if ( !DrawLightmap((Lightmap *)a1, (Vec3_float_ *)&arg4, 0.0) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1763 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1764 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1765 v35 = 5080812;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1766 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1767 v36 = (int *)((char *)v36 + 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1768 a1 += 3100;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1769 if ( (signed int)v36 >= *(unsigned int *)(LODWORD(v38) + 1587204) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1770 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1771 v14 = v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1772 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1773 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1774 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1775 v15 = pRenderer->pRenderD3D->pDevice;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1776 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1777 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1778 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1779 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1780 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1781 if ( pRenderer->bUsingSpecular )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1782 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1783 //LODWORD(v30) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1784 //v29 = 28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1785 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice;
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1786 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1787 //v30 = pRenderer->uFogColor;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1788 //v23 = pRenderer->pRenderD3D->pDevice;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1789 //v29 = 34;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1790 //v28 = (Lightmap *)v23;
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1791 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, pRenderer->uFogColor));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1792 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice;
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1793 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, false));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1794 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1795 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1796 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1797 }
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1798
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1799
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1800 //----- (0045DA56) --------------------------------------------------------
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1801 bool LightmapBuilder::DrawLightmaps2(float z_bias)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1802 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1803 Vec3_float_ v; // [sp+Ch] [bp-1Ch]@2
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1804 v.z = 1.0;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1805 v.y = 1.0;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1806 v.x = 1.0;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1807
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1808 for (uint i = 0; i < std__vector_183808_size; ++i)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1809 if (!DrawLightmap(std__vector_183808 + i, &v, z_bias))
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1810 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1288", 0);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1811
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1812 return true;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1813 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1814
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1815 //----- (0045DAE8) --------------------------------------------------------
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1816 bool LightmapBuilder::DrawLightmap(Lightmap *pLightmap, Vec3_float_ *pColorMult, float z_bias)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1817 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1818 double v10; // st7@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1819 double v14; // st7@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1820 __int16 v15; // fps@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1821 double v18; // st3@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1822 signed int v24; // [sp-1Ch] [bp-670h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1823 const char *v25; // [sp-18h] [bp-66Ch]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1824 int v26; // [sp-14h] [bp-668h]@13
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1825 RenderVertexD3D3 a2[32]; // [sp+0h] [bp-654h]@7
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1826
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1827
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1828 if (pLightmap->uNumVertices < 3)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1829 {
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1830 Log::Warning(L"Lightmap uNumVertices < 3");
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1831 return false;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1832 }
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1833
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1834 uint uLightmapColorMaskR = (pLightmap->uColorMask >> 16) & 0xFF;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1835 uint uLightmapColorR = floorf(uLightmapColorMaskR * pLightmap->fBrightness * pColorMult->x + 0.5f);
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1836
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1837 uint uLightmapColorMaskG = (pLightmap->uColorMask >> 8) & 0xFF;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1838 uint uLightmapColorG = floorf(uLightmapColorMaskG * pLightmap->fBrightness * pColorMult->y + 0.5f);
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1839
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1840 uint uLightmapColorMaskB = pLightmap->uColorMask & 0xFF;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1841 uint uLightmapColorB = floorf(uLightmapColorMaskB * pLightmap->fBrightness * pColorMult->z + 0.5f);
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1842
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1843 uint uLightmapColor = uLightmapColorB | (uLightmapColorMaskG << 8) | (uLightmapColorMaskR << 16);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
1844
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1845 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1846 v10 = (double)pOutdoorCamera->shading_dist_mist;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1847 else
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1848 v10 = 16192.0;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1849 v14 = 1.0 / v10;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1850
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1851 for (uint i = 0; i < pLightmap->uNumVertices; ++i)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1852 {
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1853 v18 = 1.0 - 1.0 / (v14 * pLightmap->pVertices[i].vWorldViewPosition.x * 1000.0);
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1854 if (fabsf(z_bias) < 1e-5f)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1855 {
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1856 v18 = v18 - z_bias;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1857 if (v18 < 0.000099999997)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1858 v18 = 0.000099999997;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1859 }
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1860
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1861 a2[i].pos.x = pLightmap->pVertices[i].vWorldViewProjX;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1862 a2[i].pos.z = v18;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1863 a2[i].pos.y = pLightmap->pVertices[i].vWorldViewProjY;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1864 a2[i].rhw = 1.0 / pLightmap->pVertices[i].vWorldViewPosition.x;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1865 a2[i].diffuse = uLightmapColor;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1866 a2[i].specular = 0;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1867 a2[i].texcoord.x = pLightmap->pVertices[i].u;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1868 a2[i].texcoord.y = pLightmap->pVertices[i].v;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1869 }
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1870
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1871 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1872 v24 = D3DDP_DONOTLIGHT | D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1873 else
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1874 v24 = D3DDP_DONOTLIGHT;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1875
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1876 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1877 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1878 a2,
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1879 pLightmap->uNumVertices,
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1880 v24));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1881
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1882 return true;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1883 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1884
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1885 //----- (0045DCA9) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1886 void LightmapBuilder::DoDrawLightmaps()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1887 {
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1888 if (!std__vector_183808_size)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1889 return;
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1890
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1891 if (pRenderer->bUsingSpecular)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1892 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1893
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1894 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1895 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1896 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1897 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1898
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1899 auto pTex = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03");
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1900 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTex));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1901
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1902 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1903 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1904
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1905 DrawLightmaps2(0.00050000002);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1906
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1907 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1908 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1909 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1910 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1911 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u));
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1912 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1913
45
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1914 if (pRenderer->bUsingSpecular)
bcc051713d20 BLV render & seffects
Nomad
parents: 29
diff changeset
1915 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1u));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1916 }