annotate LightmapBuilder.cpp @ 38:431e26f265a0

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