Mercurial > mm7
annotate ParticleEngine.cpp @ 2229:10c909eb6766
dword_AE336C to NPCStats::dword_AE336C_LastMispronouncedNameFirstLetter,
dword_AE3370 to NPCStats::dword_AE3370_LastMispronouncedNameResult
sub_495366 to NPCStats::sub_495366_MispronounceName + cleanup
author | Grumpy7 |
---|---|
date | Sat, 22 Feb 2014 18:25:18 +0100 |
parents | 3f375342de12 |
children | aff7a7b072b7 |
rev | line source |
---|---|
0 | 1 #include "ParticleEngine.h" |
2044 | 2 #include "Timer.h" |
0 | 3 #include "Render.h" |
4 #include "Viewport.h" | |
5 #include "Outdoor.h" | |
6 #include "Game.h" | |
1637 | 7 #include "Outdoor_stuff.h" |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2002
diff
changeset
|
8 #include "OurMath.h" |
0 | 9 #include "LOD.h" |
10 | |
1016 | 11 #include "Sprites.h" |
0 | 12 #include "mm7_data.h" |
13 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
14 TrailParticleGenerator trail_particle_generator; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
15 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
16 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
17 //----- (00440DF5) -------------------------------------------------------- |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
18 void TrailParticleGenerator::AddParticle(int x, int y, int z, int bgr16) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
19 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
20 particles[num_particles].x = x; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
21 particles[num_particles].y = y; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
22 particles[num_particles].z = z; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
23 particles[num_particles].time_to_live = rand() % 64 + 256; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
24 particles[num_particles].time_left = particles[num_particles].time_to_live; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
25 particles[num_particles].bgr16 = bgr16; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
26 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
27 num_particles++; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
28 assert(num_particles < 100); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
29 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
30 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
31 //----- (00440E91) -------------------------------------------------------- |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
32 void TrailParticleGenerator::GenerateTrailParticles(int x, int y, int z, int bgr16) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
33 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
34 for (int i = 0; i < 5 + rand() % 6; ++i) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
35 AddParticle(rand() % 33 + x - 16, |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
36 rand() % 33 + y - 16, |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
37 rand() % 33 + z, bgr16); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
38 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
39 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
40 //----- (00440F07) -------------------------------------------------------- |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
41 void TrailParticleGenerator::UpdateParticles() |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
42 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
43 for (uint i = 0; i < 100; ++i) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
44 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
45 if (particles[i].time_left > 0) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
46 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
47 particles[i].x += rand() % 5 + 4; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
48 particles[i].y += rand() % 5 - 2; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
49 particles[i].z += rand() % 5 - 2; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
50 particles[i].time_left -= pEventTimer->uTimeElapsed; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
51 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
52 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
53 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1390
diff
changeset
|
54 |
0 | 55 //----- (0048AAC5) -------------------------------------------------------- |
56 ParticleEngine::ParticleEngine() | |
57 { | |
58 for (uint i = 0; i < 500; ++i) | |
59 memset(&pParticles[i], 0, sizeof(pParticles[i])); | |
60 | |
61 ResetParticles(); | |
62 } | |
63 | |
64 //----- (0048AAF6) -------------------------------------------------------- | |
65 void ParticleEngine::ResetParticles() | |
66 { | |
67 memset(pParticles, 0, 500 * sizeof(*pParticles)); | |
68 uStartParticle = 500; | |
69 uEndParticle = 0; | |
70 uTimeElapsed = 0; | |
71 } | |
72 | |
73 //----- (0048AB23) -------------------------------------------------------- | |
619 | 74 void ParticleEngine::AddParticle(Particle_sw *a2) |
0 | 75 { |
76 signed int v2; // eax@2 | |
77 Particle *v3; // edx@2 | |
78 Particle *v4; // esi@10 | |
79 int v5; // ecx@10 | |
619 | 80 //char v6; // zf@10 |
0 | 81 |
82 if ( !pMiscTimer->bPaused ) | |
83 { | |
84 v2 = 0; | |
85 v3 = (Particle *)this; | |
86 do | |
87 { | |
619 | 88 if (v3->type == ParticleType_Invalid) |
0 | 89 break; |
90 ++v2; | |
91 ++v3; | |
92 } | |
93 while ( v2 < 500 ); | |
94 if ( v2 < 500 ) | |
95 { | |
96 if ( v2 < this->uStartParticle ) | |
97 this->uStartParticle = v2; | |
98 if ( v2 > this->uEndParticle ) | |
99 this->uEndParticle = v2; | |
100 v4 = &this->pParticles[v2]; | |
619 | 101 v4->type = a2->type; |
0 | 102 v4->x = a2->x; |
103 v4->y = a2->y; | |
104 v4->z = a2->z; | |
105 v4->_x = a2->x; | |
106 v4->_y = a2->y; | |
107 v4->_z = a2->z; | |
1390 | 108 v4->flt_10 = a2->r; |
109 v4->flt_14 = a2->g; | |
110 v4->flt_18 = a2->b; | |
0 | 111 v5 = a2->uDiffuse; |
112 v4->uParticleColor = v5; | |
871 | 113 v4->uLightColor_bgr = v5; |
619 | 114 //v6 = (v4->uType & 4) == 0; |
0 | 115 v4->timeToLive = a2->timeToLive; |
116 v4->uTextureID = a2->uTextureID; | |
117 v4->flt_28 = a2->flt_28; | |
619 | 118 if (v4->type & ParticleType_Rotating) |
119 { | |
871 | 120 v4->rotation_speed = (rand() % 256) - 128; |
121 v4->angle = rand(); | |
619 | 122 } |
123 else | |
0 | 124 { |
871 | 125 v4->rotation_speed = 0; |
126 v4->angle = 0; | |
0 | 127 } |
128 } | |
129 } | |
130 } | |
131 | |
132 //----- (0048ABF3) -------------------------------------------------------- | |
133 void ParticleEngine::Draw() | |
134 { | |
135 uTimeElapsed += pEventTimer->uTimeElapsed; | |
136 pLines.uNumLines = 0; | |
137 | |
573 | 138 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
139 DrawParticles_BLV(); | |
140 else | |
141 DrawParticles_ODM(); | |
0 | 142 |
2154 | 143 //if (pRenderer->pRenderD3D) |
0 | 144 { |
145 if (pLines.uNumLines) | |
146 { | |
2155 | 147 pRenderer->DrawLines(pLines.pLineVertices, pLines.uNumLines); |
148 /*pRenderer->pRenderD3D->pDevice->SetTexture(0, 0); | |
0 | 149 pRenderer->pRenderD3D->pDevice->DrawPrimitive( |
150 D3DPT_LINELIST, | |
151 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
152 pLines.pLineVertices, | |
153 pLines.uNumLines, | |
2155 | 154 D3DDP_DONOTLIGHT);*/ |
0 | 155 } |
156 } | |
157 } | |
158 | |
159 //----- (0048AC65) -------------------------------------------------------- | |
160 void ParticleEngine::UpdateParticles() | |
161 { | |
162 unsigned int time; // edi@1 | |
871 | 163 //int v5; // eax@3 |
164 //char v6; // sf@4 | |
0 | 165 float v7; // ST4C_4@11 |
166 double v8; // st7@12 | |
871 | 167 //int v9; // eax@12 |
168 //double v10; // st7@14 | |
0 | 169 signed int v19; // [sp+38h] [bp-14h]@1 |
170 int v20; // [sp+3Ch] [bp-10h]@1 | |
171 unsigned int time_; // [sp+40h] [bp-Ch]@1 | |
172 int v22; // [sp+44h] [bp-8h]@12 | |
173 | |
174 v20 = 0; | |
175 time = pMiscTimer->bPaused == 0 ? pEventTimer->uTimeElapsed : 0; | |
176 v19 = 500; | |
177 time_ = pMiscTimer->bPaused == 0 ? pEventTimer->uTimeElapsed : 0; | |
178 | |
871 | 179 for (uint i = uStartParticle; i <= uEndParticle; ++i) |
0 | 180 { |
1980 | 181 Particle* p = &pParticles[i]; |
0 | 182 |
619 | 183 if (p->type == ParticleType_Invalid) |
0 | 184 continue; |
185 | |
871 | 186 if (p->timeToLive <= time) |
187 { | |
188 p->timeToLive = 0; | |
189 p->type = ParticleType_Invalid; | |
190 continue; | |
191 } | |
0 | 192 p->timeToLive -= time; |
871 | 193 |
194 if (p->type & ParticleType_Line) | |
0 | 195 { |
196 p->_x = p->x; | |
197 p->_y = p->y; | |
198 p->_z = p->z; | |
199 } | |
871 | 200 |
201 if (p->type & ParticleType_1) | |
0 | 202 p->flt_18 = p->flt_18 - (double)(signed int)time_ * 5.0; |
871 | 203 |
204 if (p->type & ParticleType_8) | |
0 | 205 { |
206 v7 = (double)(signed int)time_; | |
207 *(float *)&p->x += (double)(rand() % 5 - 2) * v7 / 16.0f; | |
208 *(float *)&p->y += (double)(rand() % 5 - 2) * v7 / 16.0f; | |
209 *(float *)&p->z += (double)(rand() % 5 + 4) * v7 / 16.0f; | |
210 } | |
211 v8 = (double)(signed int)time_ / 128.0f; | |
871 | 212 //v9 = (signed int)(time * p->rotation_speed) / 16; |
213 | |
214 p->x += v8 * p->flt_10; | |
215 p->y += v8 * p->flt_14; | |
216 p->z += v8 * p->flt_18; | |
217 | |
218 p->angle += time * p->rotation_speed / 16; | |
0 | 219 v22 = 2 * p->timeToLive; |
871 | 220 if (v22 >= 255 ) |
0 | 221 v22 = 255; |
871 | 222 //v10 = (double)v22 * 0.0039215689; |
223 p->uLightColor_bgr = ((uint)floorf(p->b * (v22 / 255.0f) + 0.5) << 16) | | |
224 ((uint)floorf(p->g * (v22 / 255.0f) + 0.5) << 8) | | |
225 ((uint)floorf(p->r * (v22 / 255.0f) + 0.5) << 0); | |
0 | 226 if ( i < v19 ) |
227 v19 = i; | |
228 if ( i > v20 ) | |
229 v20 = i; | |
230 } | |
231 | |
232 uEndParticle = v20; | |
233 uStartParticle = v19; | |
234 } | |
235 | |
236 //----- (0048AE74) -------------------------------------------------------- | |
871 | 237 bool ParticleEngine::ViewProject_TrueIfStillVisible_BLV(unsigned int uParticleID) |
0 | 238 { |
239 Particle *pParticle; // esi@1 | |
619 | 240 //double v56; // ST28_8@2 |
871 | 241 //float v4; // eax@4 |
242 //double v5; // ST34_8@4 | |
0 | 243 signed __int64 v6; // qtt@4 |
619 | 244 //double v7; // st7@4 |
245 //float v8; // ST18_4@4 | |
0 | 246 int v9; // ecx@4 |
619 | 247 //int v10; // eax@4 |
248 //double v11; // ST44_8@7 | |
249 //double v12; // ST4C_8@7 | |
0 | 250 double v13; // ST4C_8@7 |
251 int v14; // ecx@7 | |
871 | 252 //signed __int64 v15; // qtt@7 |
0 | 253 int v16; // eax@7 |
254 int v17; // edx@7 | |
255 float v18; // edx@7 | |
256 int v19; // eax@7 | |
257 int v20; // edx@7 | |
258 int v21; // ST50_4@8 | |
259 int v22; // ebx@8 | |
260 int v23; // ecx@10 | |
261 int v24; // edi@10 | |
871 | 262 //double v25; // ST44_8@12 |
263 //double v26; // ST4C_8@12 | |
0 | 264 int v27; // edi@12 |
265 int v28; // ST40_4@12 | |
266 int v29; // ecx@12 | |
871 | 267 //signed __int64 v30; // qtt@12 |
0 | 268 int v31; // eax@12 |
269 int v32; // edx@12 | |
270 float v33; // edx@12 | |
871 | 271 //int v34; // eax@12 |
0 | 272 int v35; // ecx@12 |
273 int v36; // ST38_4@13 | |
274 int v37; // ST30_4@15 | |
275 int v38; // eax@16 | |
871 | 276 //signed __int64 v40; // qtt@18 |
0 | 277 int v41; // eax@18 |
278 int v42; // ecx@18 | |
279 int v43; // eax@18 | |
280 unsigned __int64 v44; // qax@18 | |
1029 | 281 //double v45; // st7@18 |
282 //int v46; // ecx@18 | |
283 //float v47; // ST18_4@18 | |
284 //unsigned __int64 v48; // qax@18 | |
619 | 285 int y_int_; // [sp+10h] [bp-40h]@2 |
0 | 286 int a2; // [sp+18h] [bp-38h]@10 |
287 int x_int; // [sp+20h] [bp-30h]@2 | |
619 | 288 int z_int_; // [sp+24h] [bp-2Ch]@2 |
0 | 289 int z_int_4; // [sp+28h] [bp-28h]@8 |
290 int z; // [sp+3Ch] [bp-14h]@3 | |
291 double a5; // [sp+40h] [bp-10h]@4 | |
292 int a6; // [sp+48h] [bp-8h]@4 | |
293 int y; // [sp+4Ch] [bp-4h]@3 | |
294 | |
295 pParticle = &this->pParticles[uParticleID]; | |
619 | 296 if (pParticle->type == ParticleType_Invalid) |
0 | 297 return 0; |
619 | 298 //uParticleID = LODWORD(pParticle->x); |
299 //v56 = *(float *)&uParticleID + 6.7553994e15; | |
300 x_int = floorf(pParticle->x + 0.5f); | |
301 //uParticleID = LODWORD(pParticle->y); | |
302 //y_int_ = *(float *)&uParticleID + 6.7553994e15; | |
303 y_int_ = floorf(pParticle->y + 0.5f); | |
304 //uParticleID = LODWORD(pParticle->z); | |
305 //z_int_ = *(float *)&uParticleID + 6.7553994e15; | |
306 z_int_ = floorf(pParticle->z + 0.5f); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
307 /*if ( !pRenderer->pRenderD3D ) |
0 | 308 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
309 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 310 { |
619 | 311 if (pParticle->type & ParticleType_Line) |
0 | 312 { |
619 | 313 //v11 = pParticle->_x + 6.7553994e15; |
314 int _uParticleID = (int)(floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16; | |
315 //v12 = pParticle->_y + 6.7553994e15; | |
316 y = (int)(floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 317 z = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
318 HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) | |
0 | 319 - z; |
1642 | 320 a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
619 | 321 //v13 = pParticle->_z + 6.7553994e15; |
322 _uParticleID = (int)(floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; | |
1642 | 323 z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) |
324 - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); | |
0 | 325 v14 = z; |
1642 | 326 HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; |
327 HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16; | |
871 | 328 //LODWORD(v15) = pBLVRenderParams->field_40 << 16; |
329 //HIDWORD(v15) = pBLVRenderParams->field_40 >> 16; | |
330 //v16 = v15 / z; | |
331 v16 = fixpoint_div(pBLVRenderParams->field_40, z); | |
1642 | 332 v17 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
333 pParticle->_screenspace_scale = v16; |
619 | 334 _uParticleID = (unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16; |
0 | 335 LODWORD(v18) = pBLVRenderParams->uViewportCenterX |
336 - ((signed int)((unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16) >> 16); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
337 v19 = pParticle->_screenspace_scale; |
0 | 338 pParticle->uScreenSpaceZ = v18; |
619 | 339 _uParticleID = (unsigned __int64)(v19 * (signed __int64)(HIDWORD(v13) + HIDWORD(a5))) >> 16; |
0 | 340 v20 = pBLVRenderParams->uViewportCenterY |
341 - ((signed int)((unsigned __int64)(v19 * (signed __int64)(HIDWORD(v13) + HIDWORD(a5))) >> 16) >> 16); | |
342 pParticle->sZValue2 = v14; | |
343 pParticle->uScreenSpaceW = v20; | |
344 } | |
619 | 345 int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; |
346 y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 347 HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) |
348 - ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); | |
349 a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; | |
350 z_int_4 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; | |
619 | 351 _uParticleID = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; |
1642 | 352 v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; |
353 v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v21; | |
354 z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v21; | |
0 | 355 if ( v22 < (signed int)0x40000u || v22 > (signed int)0x1F400000u ) |
356 return 0; | |
357 v23 = a6 + z_int_4; | |
358 a2 = a6 + z_int_4; | |
1642 | 359 v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) |
360 + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); | |
0 | 361 } |
362 else | |
363 { | |
619 | 364 if (pParticle->type & ParticleType_Line) |
0 | 365 { |
871 | 366 //v25 = pParticle->_x + 6.7553994e15; |
367 int _uParticleID = ((int)floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16; | |
368 //v26 = pParticle->_y + 6.7553994e15; | |
369 y = ((int)floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 370 auto _hiword_v25 = (__int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
371 v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25; | |
372 z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25; | |
373 v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; | |
871 | 374 //a5 = pParticle->_z + 6.7553994e15; |
375 v29 = ((int)floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; | |
376 //LODWORD(v30) = pBLVRenderParams->field_40 << 16; | |
377 //HIDWORD(v30) = pBLVRenderParams->field_40 >> 16; | |
378 //v31 = v30 / z; | |
379 v31 = fixpoint_div(pBLVRenderParams->field_40, z); | |
1642 | 380 v32 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
381 pParticle->_screenspace_scale = v31; |
619 | 382 _uParticleID = (unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16; |
871 | 383 LODWORD(v33) = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16) >> 16); |
384 //v34 = pParticle->_screenspace_scale; | |
0 | 385 pParticle->uScreenSpaceZ = v33; |
871 | 386 v35 = pBLVRenderParams->uViewportCenterY - ((signed int)((unsigned __int64)(pParticle->_screenspace_scale * (signed __int64)v29) >> 16) >> 16); |
0 | 387 pParticle->sZValue2 = v27; |
388 pParticle->uScreenSpaceW = v35; | |
389 } | |
619 | 390 int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; |
391 y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 392 v36 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
393 v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v36; | |
394 z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v36; | |
0 | 395 if ( v22 < 262144 || v22 > 524288000 ) |
396 return 0; | |
1642 | 397 v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
398 _uParticleID = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; | |
399 v23 = v37 + ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); | |
400 a2 = v37 + ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); | |
619 | 401 v24 = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; |
0 | 402 } |
619 | 403 int _uParticleID = abs(v23); |
0 | 404 v38 = abs(v22); |
619 | 405 if ( v38 >= (signed int)_uParticleID ) |
0 | 406 { |
871 | 407 //LODWORD(v40) = pBLVRenderParams->field_40 << 16; |
408 //HIDWORD(v40) = pBLVRenderParams->field_40 >> 16; | |
409 v41 = fixpoint_div(pBLVRenderParams->field_40, z); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
410 pParticle->_screenspace_scale = v41; |
619 | 411 _uParticleID = (unsigned __int64)(v41 * (signed __int64)a2) >> 16; |
0 | 412 v42 = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v41 * (signed __int64)a2) >> 16) >> 16); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
413 v43 = pParticle->_screenspace_scale; |
0 | 414 pParticle->uScreenSpaceX = v42; |
415 v44 = v43 * (signed __int64)v24; | |
619 | 416 //uParticleID = v44 >> 16; |
0 | 417 LODWORD(v44) = (signed int)(v44 >> 16) >> 16; |
418 pParticle->uScreenSpaceY = pBLVRenderParams->uViewportCenterY - v44; | |
1643 | 419 pParticle->_screenspace_scale = fixpoint_mul(fixpoint_from_float(pParticle->flt_28), pParticle->_screenspace_scale); |
619 | 420 pParticle->sZValue = z; |
421 return true; | |
0 | 422 } |
619 | 423 return false; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
424 }*/ |
619 | 425 |
426 int x; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
427 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV( |
0 | 428 x_int, |
619 | 429 y_int_, |
430 z_int_, | |
431 &x, | |
0 | 432 &y, |
433 &z, | |
434 1) ) | |
619 | 435 return false; |
436 pGame->pIndoorCameraD3D->Project(x, y, z, &pParticle->uScreenSpaceX, &pParticle->uScreenSpaceY); | |
0 | 437 pParticle->flt_5C = pGame->pIndoorCameraD3D->fov_x; |
871 | 438 //v4 = pParticle->flt_5C; |
0 | 439 pParticle->flt_60 = pGame->pIndoorCameraD3D->fov_y; |
871 | 440 //v5 = v4 + 6.7553994e15; |
0 | 441 LODWORD(v6) = 0; |
871 | 442 HIDWORD(v6) = floorf(pParticle->flt_5C + 0.5f); |
619 | 443 //v7 = pParticle->flt_28; |
1029 | 444 //pParticle->_screenspace_scale = v6 / x; |
619 | 445 //v8 = v7; |
1643 | 446 pParticle->_screenspace_scale = fixpoint_mul(fixpoint_from_float(pParticle->flt_28), v6 / x); |
619 | 447 pParticle->sZValue = x; |
448 return true; | |
0 | 449 } |
450 | |
451 | |
452 | |
453 | |
454 //----- (0048B5B3) -------------------------------------------------------- | |
871 | 455 bool ParticleEngine::ViewProject_TrueIfStillVisible_ODM(unsigned int uID) |
0 | 456 { |
457 int v3; // ebx@1 | |
458 int v4; // edi@1 | |
459 int v5; // ecx@1 | |
460 int v11; // ST44_4@4 | |
461 signed __int64 v13; // qtt@4 | |
462 int v16; // edi@6 | |
463 int v17; // eax@6 | |
464 signed __int64 v22; // qtt@8 | |
465 int v26; // edx@9 | |
466 int v28; // ebx@12 | |
467 signed __int64 v29; // qtt@13 | |
468 int v40; // [sp+14h] [bp-3Ch]@12 | |
469 int v44; // [sp+2Ch] [bp-24h]@1 | |
470 int v45; // [sp+40h] [bp-10h]@5 | |
471 int X_4; // [sp+48h] [bp-8h]@5 | |
472 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
473 v3 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
474 v44 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
475 v4 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
476 v5 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
871 | 477 |
2207 | 478 if (pParticles[uID].type == ParticleType_Invalid) |
871 | 479 return false; |
480 | |
2216 | 481 if ( v3 ) |
482 { | |
483 if (pParticles[uID].type & ParticleType_Line) | |
0 | 484 { |
2216 | 485 v11 = fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) |
486 + fixpoint_sub_unknown(pParticles[uID].y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); | |
487 long long _hidword_v12 = fixpoint_mul(v11, v3) + fixpoint_sub_unknown(pParticles[uID].z - pGame->pIndoorCameraD3D->vPartyPos.z, v44); | |
488 LODWORD(v13) = 0; | |
489 HIDWORD(v13) = SLOWORD(pODMRenderParams->int_fov_rad); | |
490 pParticles[uID]._screenspace_scale = v13 / _hidword_v12; | |
491 pParticles[uID].uScreenSpaceX = pViewport->uScreenCenterX | |
492 - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, (fixpoint_sub_unknown(pParticles[uID].y | |
493 - pGame->pIndoorCameraD3D->vPartyPos.y, v4) | |
494 - fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16); | |
495 pParticles[uID].uScreenSpaceY = pViewport->uScreenCenterY | |
496 - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, (fixpoint_sub_unknown(pParticles[uID].z | |
497 - pGame->pIndoorCameraD3D->vPartyPos.z, v3) | |
498 - fixpoint_mul(v11, v44))) >> 16); | |
499 pParticles[uID].sZValue = _hidword_v12; | |
0 | 500 } |
2216 | 501 v45 = fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(pParticles[uID].y |
502 - pGame->pIndoorCameraD3D->vPartyPos.y, v5); | |
503 X_4 = fixpoint_sub_unknown(pParticles[uID].z - pGame->pIndoorCameraD3D->vPartyPos.z, v44) + fixpoint_mul(v45, v3); | |
504 if ( X_4 < 0x40000 ) | |
505 return 0; | |
506 v16 = fixpoint_sub_unknown(pParticles[uID].y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) | |
507 - fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); | |
508 v17 = fixpoint_sub_unknown(pParticles[uID].z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) - fixpoint_mul(v45, v44); | |
509 } | |
510 else | |
511 { | |
512 if (pParticles[uID].type & ParticleType_Line) | |
0 | 513 { |
2216 | 514 LODWORD(v22) = 0; |
515 HIDWORD(v22) = SLOWORD(pODMRenderParams->int_fov_rad); | |
516 long long _var_123 = fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) | |
517 + fixpoint_sub_unknown(pParticles[uID].y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); | |
518 pParticles[uID]._screenspace_scale = v22 / _var_123; | |
519 pParticles[uID].uScreenSpaceX = pViewport->uScreenCenterX | |
520 - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, (fixpoint_sub_unknown(pParticles[uID].y | |
521 - pGame->pIndoorCameraD3D->vPartyPos.y, v4) | |
522 - fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16); | |
523 pParticles[uID].uScreenSpaceY = pViewport->uScreenCenterY - (fixpoint_sub_unknown(pParticles[uID].z, pParticles[uID]._screenspace_scale) >> 16); | |
524 pParticles[uID].sZValue = _var_123; | |
0 | 525 } |
2216 | 526 v26 = fixpoint_sub_unknown(pParticles[uID].y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); |
527 X_4 = v26 + fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v4); | |
528 if ( X_4 < 0x40000 || X_4 > (pODMRenderParams->uPickDepth - 1000) << 16 ) | |
529 return 0; | |
530 v17 = pParticles[uID].z; | |
531 v16 = fixpoint_sub_unknown(pParticles[uID].y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) | |
532 - fixpoint_sub_unknown(pParticles[uID].x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); | |
533 } | |
534 v40 = v17; | |
535 v28 = abs(v16); | |
536 if ( abs(X_4) >= v28 ) | |
537 { | |
538 LODWORD(v29) = 0; | |
539 HIDWORD(v29) = SLOWORD(pODMRenderParams->int_fov_rad); | |
540 pParticles[uID]._screenspace_scale = v29 / X_4; | |
541 pParticles[uID].uScreenSpaceX = pViewport->uScreenCenterX - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, v16) >> 16); | |
542 pParticles[uID].uScreenSpaceY = pViewport->uScreenCenterY - ((signed int)fixpoint_mul(pParticles[uID]._screenspace_scale, v40) >> 16); | |
543 pParticles[uID]._screenspace_scale = fixpoint_mul(fixpoint_from_float(pParticles[uID].flt_28), pParticles[uID]._screenspace_scale); | |
544 pParticles[uID].sZValue = X_4; | |
545 if ( pParticles[uID].uScreenSpaceX >= (signed int)pViewport->uViewportTL_X | |
546 && pParticles[uID].uScreenSpaceX < (signed int)pViewport->uViewportBR_X | |
547 && pParticles[uID].uScreenSpaceY >= (signed int)pViewport->uViewportTL_Y | |
548 && pParticles[uID].uScreenSpaceY < (signed int)pViewport->uViewportBR_Y ) | |
549 return true; | |
550 } | |
551 return false; | |
0 | 552 } |
553 | |
554 //----- (0048BBA6) -------------------------------------------------------- | |
555 void ParticleEngine::DrawParticles_BLV() | |
556 { | |
557 int v11; // eax@18 | |
558 int v12; // ecx@20 | |
559 int v13; // edx@20 | |
619 | 560 //Particle *v14; // eax@28 |
0 | 561 RenderBillboardTransform_local0 v15; // [sp+Ch] [bp-58h]@1 |
562 | |
2002 | 563 v15.sParentBillboardID = -1; |
0 | 564 |
565 for (uint i = uStartParticle; i < uEndParticle; ++i) | |
566 { | |
1980 | 567 Particle* p = &pParticles[i]; |
0 | 568 |
619 | 569 if (p->type == ParticleType_Invalid) |
0 | 570 continue; |
571 | |
871 | 572 if (!ViewProject_TrueIfStillVisible_BLV(i)) |
0 | 573 continue; |
574 | |
575 if (p->uScreenSpaceX >= pBLVRenderParams->uViewportX && | |
576 p->uScreenSpaceX < pBLVRenderParams->uViewportZ && | |
577 p->uScreenSpaceY >= pBLVRenderParams->uViewportY && | |
578 p->uScreenSpaceY < pBLVRenderParams->uViewportW) | |
579 { | |
2155 | 580 /*if (!pRenderer->pRenderD3D) |
0 | 581 { |
2069 | 582 __debugbreak(); |
2155 | 583 v11 = 13 * p->_screenspace_scale >> 16; |
2069 | 584 if ( v11 > 30 ) |
585 v11 = 30; | |
586 v12 = p->uScreenSpaceY - v11; | |
587 v13 = p->uScreenSpaceX - (v11 >> 1); | |
588 if ( v13 + v11 < (signed int)pViewport->uViewportTL_X | |
589 || v13 >= (signed int)pViewport->uViewportBR_X | |
590 || v12 + v11 < (signed int)pViewport->uViewportTL_Y | |
591 || v12 >= (signed int)pViewport->uViewportBR_Y ) | |
592 { | |
593 ; | |
594 } | |
595 else | |
596 { | |
597 pRenderer->MakeParticleBillboardAndPush_BLV_Software(v13, v12, p->sZValue, p->uLightColor_bgr, v11); | |
2155 | 598 } |
2069 | 599 } |
2155 | 600 else*/ |
2069 | 601 |
619 | 602 if (p->type & ParticleType_Diffuse) |
0 | 603 { |
619 | 604 //v14 = &pParticles[i]; |
605 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale / 4; | |
606 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale / 4; | |
607 v15.uScreenSpaceX = p->uScreenSpaceX; | |
608 v15.uScreenSpaceY = p->uScreenSpaceY; | |
609 v15.sZValue = p->sZValue; | |
871 | 610 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, 0, p->uLightColor_bgr, p->angle); |
0 | 611 return; |
612 } | |
619 | 613 if (p->type & ParticleType_Line) |
0 | 614 { |
615 if (pLines.uNumLines < 100) | |
616 { | |
617 pLines.pLineVertices[2 * pLines.uNumLines].pos.x = p->uScreenSpaceX; | |
618 pLines.pLineVertices[2 * pLines.uNumLines].pos.y = p->uScreenSpaceY; | |
619 pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((short)p->sZValue * 0.061758894); | |
620 pLines.pLineVertices[2 * pLines.uNumLines].rhw = 1.0; | |
871 | 621 pLines.pLineVertices[2 * pLines.uNumLines].diffuse = p->uLightColor_bgr; |
0 | 622 pLines.pLineVertices[2 * pLines.uNumLines].specular = 0; |
623 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.x = 0.0; | |
624 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.y = 0.0; | |
625 | |
626 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.x = p->uScreenSpaceZ; | |
627 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.y = p->uScreenSpaceW; | |
628 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((short)p->sZValue2 * 0.061758894); | |
629 pLines.pLineVertices[2 * pLines.uNumLines + 1].rhw = 1.0; | |
871 | 630 pLines.pLineVertices[2 * pLines.uNumLines + 1].diffuse = p->uLightColor_bgr; |
0 | 631 pLines.pLineVertices[2 * pLines.uNumLines + 1].specular = 0; |
632 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.x = 0.0; | |
633 pLines.pLineVertices[2 * pLines.uNumLines++ + 1].texcoord.y = 0.0; | |
634 } | |
635 } | |
619 | 636 if (p->type & ParticleType_Bitmap) |
0 | 637 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
638 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
639 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; |
0 | 640 v15.uScreenSpaceX = p->uScreenSpaceX; |
641 v15.uScreenSpaceY = p->uScreenSpaceY; | |
642 v15.sZValue = p->sZValue; | |
871 | 643 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pBitmaps_LOD->pHardwareTextures[p->uTextureID], p->uLightColor_bgr, p->angle); |
0 | 644 } |
619 | 645 if (p->type & ParticleType_Sprite) |
0 | 646 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
647 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
648 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; |
0 | 649 v15.uScreenSpaceX = p->uScreenSpaceX; |
650 v15.uScreenSpaceY = p->uScreenSpaceY; | |
651 v15.sZValue = p->sZValue; | |
871 | 652 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pSprites_LOD->pHardwareSprites[p->uTextureID].pTexture, p->uLightColor_bgr, p->angle); |
0 | 653 } |
654 } | |
655 } | |
656 } | |
657 | |
658 //----- (0048BEEF) -------------------------------------------------------- | |
659 void ParticleEngine::DrawParticles_ODM() | |
660 { | |
62 | 661 ParticleEngine *pParticleEngine; // esi@1 |
871 | 662 //int pParticleNum; // eax@1 |
0 | 663 unsigned __int8 v3; // zf@1 |
664 char v4; // sf@1 | |
665 unsigned __int8 v5; // of@1 | |
871 | 666 //char *v7; // edi@2 |
667 //int v8; // eax@6 | |
668 //signed int pNumLines; // eax@8 | |
0 | 669 int v10; // eax@14 |
670 int v11; // ecx@16 | |
671 int v12; // edx@16 | |
871 | 672 //Particle *pParticle; // eax@24 |
62 | 673 RenderBillboardTransform_local0 pBillboard; // [sp+Ch] [bp-58h]@1 |
871 | 674 //int v15; // [sp+5Ch] [bp-8h]@9 |
0 | 675 int v16; // [sp+60h] [bp-4h]@1 |
676 | |
2002 | 677 pBillboard.sParentBillboardID = -1; |
62 | 678 pParticleEngine = this; |
679 //v2 = this->uStartParticle; | |
680 //v5 = v2 > this->uEndParticle;// v5 = __OFSUB__(v2, this->uEndParticle); | |
681 //v3 = v2 == this->uEndParticle; | |
682 //v4 = v2 - this->uEndParticle < 0; | |
683 //v16 = this->uStartParticle; | |
871 | 684 for (uint i = uStartParticle; i <= uEndParticle; ++i) |
0 | 685 { |
1980 | 686 Particle* particle = &pParticles[i]; |
871 | 687 if (particle->type == ParticleType_Invalid || !ViewProject_TrueIfStillVisible_ODM(i)) |
688 continue; | |
689 | |
2154 | 690 /*if ( !pRenderer->pRenderD3D ) |
0 | 691 { |
2069 | 692 __debugbreak(); |
2154 | 693 v10 = 13 * particle->_screenspace_scale >> 16; |
2069 | 694 if ( v10 > 30 ) |
695 v10 = 30; | |
696 v11 = particle->uScreenSpaceX - (v10 >> 1); | |
697 v12 = particle->uScreenSpaceY - v10; | |
698 if ( v11 + v10 < pViewport->uViewportTL_X | |
699 || v11 >= pViewport->uViewportBR_X | |
700 || particle->uScreenSpaceY < pViewport->uViewportTL_Y | |
701 || v12 >= (signed int)pViewport->uViewportBR_Y ) | |
702 { | |
703 ; | |
704 } | |
705 else | |
706 { | |
707 pRenderer->MakeParticleBillboardAndPush_BLV_Software(v11, v12, particle->sZValue, particle->uLightColor_bgr, v10); | |
2154 | 708 } |
2069 | 709 } |
2154 | 710 else*/ |
2069 | 711 |
871 | 712 //v8 = *(_DWORD *)(v7 - 82); |
713 if (particle->type & ParticleType_Diffuse) | |
0 | 714 { |
871 | 715 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale / 4; |
716 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale / 4; | |
717 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
718 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
719 pBillboard.sZValue = particle->sZValue; | |
720 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, 0, particle->uLightColor_bgr, particle->angle); | |
0 | 721 return; |
722 } | |
871 | 723 if (particle->type & ParticleType_Line) |
0 | 724 { |
871 | 725 if (pLines.uNumLines < 100) |
0 | 726 { |
871 | 727 pLines.pLineVertices[2 * pLines.uNumLines].pos.x = particle->uScreenSpaceX; |
728 pLines.pLineVertices[2 * pLines.uNumLines].pos.y = particle->uScreenSpaceY; | |
1637 | 729 pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
871 | 730 pLines.pLineVertices[2 * pLines.uNumLines].rhw = 1.0; |
731 pLines.pLineVertices[2 * pLines.uNumLines].diffuse = particle->uLightColor_bgr; | |
732 pLines.pLineVertices[2 * pLines.uNumLines].specular = 0; | |
733 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.x = 0.0; | |
734 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.y = 0.0; | |
735 | |
736 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.x = particle->uScreenSpaceZ; | |
737 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.y = particle->uScreenSpaceW; | |
1637 | 738 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
871 | 739 pLines.pLineVertices[2 * pLines.uNumLines + 1].rhw = 1.0; |
740 pLines.pLineVertices[2 * pLines.uNumLines + 1].diffuse = particle->uLightColor_bgr; | |
741 pLines.pLineVertices[2 * pLines.uNumLines + 1].specular = 0; | |
742 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.x = 0.0; | |
743 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.y = 0.0; | |
744 pLines.uNumLines++; | |
0 | 745 } |
746 } | |
871 | 747 if (particle->type & ParticleType_Bitmap) |
0 | 748 { |
871 | 749 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale; |
750 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale; | |
751 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
752 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
753 pBillboard.sZValue = particle->sZValue; | |
754 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, pBitmaps_LOD->pHardwareTextures[particle->uTextureID], particle->uLightColor_bgr, particle->angle); | |
0 | 755 } |
871 | 756 if (particle->type & ParticleType_Sprite) |
0 | 757 { |
871 | 758 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale; |
759 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale; | |
760 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
761 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
762 pBillboard.sZValue = particle->sZValue; | |
763 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, pSprites_LOD->pHardwareSprites[particle->uTextureID].pTexture, particle->uLightColor_bgr, particle->angle); | |
2069 | 764 } |
0 | 765 } |
766 } |