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