annotate LightmapBuilder.cpp @ 6:82f81d5b7221

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