Mercurial > mm7
annotate ParticleEngine.cpp @ 1623:a6642179aa33
Merge
author | Ritor1 |
---|---|
date | Sun, 15 Sep 2013 19:12:41 +0600 |
parents | 38df78aba732 |
children | 2c71fa8913d2 |
rev | line source |
---|---|
0 | 1 #include "ParticleEngine.h" |
2 #include "Time.h" | |
3 #include "Render.h" | |
4 #include "Viewport.h" | |
5 #include "Outdoor.h" | |
6 #include "Game.h" | |
7 #include "IndoorCamera.h" | |
8 #include "Math.h" | |
9 #include "LOD.h" | |
10 | |
1016 | 11 #include "Sprites.h" |
12 #include "OutdoorCamera.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 |
144 if (pRenderer->pRenderD3D) | |
145 { | |
146 if (pLines.uNumLines) | |
147 { | |
148 pRenderer->pRenderD3D->pDevice->SetTexture(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, | |
154 D3DDP_DONOTLIGHT); | |
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 { |
181 auto p = pParticles + i; | |
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); | |
0 | 307 if ( !pRenderer->pRenderD3D ) |
308 { | |
309 if ( pBLVRenderParams->sPartyRotX ) | |
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; | |
0 | 317 z = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; |
619 | 318 HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) |
0 | 319 - z; |
619 | 320 a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; |
321 //v13 = pParticle->_z + 6.7553994e15; | |
322 _uParticleID = (int)(floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; | |
0 | 323 z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) |
619 | 324 - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); |
0 | 325 v14 = z; |
326 HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
619 | 327 HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 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); | |
0 | 332 v17 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 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; | |
347 HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
0 | 348 - ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16); |
619 | 349 a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; |
350 z_int_4 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
351 _uParticleID = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; | |
352 v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
0 | 353 v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v21; |
354 z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v21; | |
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; | |
619 | 359 v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) |
0 | 360 + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); |
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; | |
370 auto _hiword_v25 = (__int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
371 v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - _hiword_v25; | |
372 z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - _hiword_v25; | |
619 | 373 v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 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); | |
0 | 380 v32 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 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; | |
0 | 392 v36 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; |
619 | 393 v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; |
394 z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; | |
0 | 395 if ( v22 < 262144 || v22 > 524288000 ) |
396 return 0; | |
619 | 397 v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; |
398 _uParticleID = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
0 | 399 v23 = v37 + ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); |
400 a2 = v37 + ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 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; | |
1029 | 419 pParticle->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(pParticle->flt_28), pParticle->_screenspace_scale); |
619 | 420 pParticle->sZValue = z; |
421 return true; | |
0 | 422 } |
619 | 423 return false; |
0 | 424 } |
619 | 425 |
426 int x; | |
0 | 427 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( |
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; |
1029 | 446 pParticle->_screenspace_scale = fixpoint_sub0(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 { |
871 | 457 //ParticleEngine *v2; // ST18_4@1 |
0 | 458 int v3; // ebx@1 |
459 int v4; // edi@1 | |
460 int v5; // ecx@1 | |
461 Particle *v6; // esi@1 | |
871 | 462 //double v7; // ST14_8@2 |
463 //double v8; // ST34_8@4 | |
464 //double v9; // ST3C_8@4 | |
465 //int v10; // ST50_4@4 | |
0 | 466 int v11; // ST44_4@4 |
871 | 467 //double v12; // ST48_8@4 |
0 | 468 signed __int64 v13; // qtt@4 |
871 | 469 //int v14; // eax@4 |
470 //int v15; // ST28_4@4 | |
0 | 471 int v16; // edi@6 |
472 int v17; // eax@6 | |
871 | 473 //double v18; // ST2C_8@8 |
474 //double v19; // ST34_8@8 | |
475 //int v20; // ST50_4@8 | |
476 //double v21; // ST34_8@8 | |
0 | 477 signed __int64 v22; // qtt@8 |
871 | 478 //int v23; // eax@8 |
479 //int v24; // ST28_4@8 | |
480 //int v25; // edx@8 | |
0 | 481 int v26; // edx@9 |
871 | 482 //int v27; // eax@9 |
0 | 483 int v28; // ebx@12 |
484 signed __int64 v29; // qtt@13 | |
871 | 485 //int v30; // eax@13 |
486 //int v31; // ST1C_4@13 | |
1029 | 487 //double v32; // st7@13 |
0 | 488 signed int v33; // eax@13 |
1029 | 489 //int v34; // ecx@13 |
490 //float v35; // ST04_4@13 | |
0 | 491 int v36; // eax@13 |
492 int v37; // esi@15 | |
871 | 493 //double v39; // [sp+10h] [bp-40h]@2 |
0 | 494 int v40; // [sp+14h] [bp-3Ch]@12 |
871 | 495 //int v41; // [sp+1Ch] [bp-34h]@2 |
496 //double v42; // [sp+20h] [bp-30h]@2 | |
497 //int v43; // [sp+24h] [bp-2Ch]@5 | |
0 | 498 int v44; // [sp+2Ch] [bp-24h]@1 |
499 int v45; // [sp+40h] [bp-10h]@5 | |
500 int X_4; // [sp+48h] [bp-8h]@5 | |
871 | 501 //int v47; // [sp+4Ch] [bp-4h]@5 |
502 //int v48; // [sp+4Ch] [bp-4h]@9 | |
503 //int uIDc; // [sp+58h] [bp+8h]@4 | |
504 //int uIDd; // [sp+58h] [bp+8h]@4 | |
505 //int uIDe; // [sp+58h] [bp+8h]@5 | |
506 //int uIDa; // [sp+58h] [bp+8h]@5 | |
507 //int uIDf; // [sp+58h] [bp+8h]@8 | |
508 //int uIDb; // [sp+58h] [bp+8h]@9 | |
0 | 509 |
323 | 510 v3 = stru_5C6E00->Cos(pIndoorCamera->sRotationX); |
511 v44 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); | |
512 v4 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
513 v5 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
871 | 514 |
515 v6 = &pParticles[uID]; | |
516 if (v6->type == ParticleType_Invalid) | |
517 return false; | |
518 | |
519 //v7 = v6->x + 6.7553994e15; | |
520 //v41 = LODWORD(v7); | |
521 //v39 = v6->y + 6.7553994e15; | |
522 //v42 = v6->z + 6.7553994e15; | |
0 | 523 if ( v3 ) |
524 { | |
619 | 525 if (v6->type & ParticleType_Line) |
0 | 526 { |
871 | 527 //v8 = v6->_x + 6.7553994e15; |
528 //uIDc = (LODWORD(v8) - pIndoorCamera->pos.x) << 16; | |
529 //v9 = v6->_y + 6.7553994e15; | |
530 //v10 = (LODWORD(v9) - pIndoorCamera->pos.y) << 16; | |
531 v11 = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v4) + fixpoint_mul(v6->y - pIndoorCamera->pos.y, v5); | |
532 //HIDWORD(v8) = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); | |
533 //v12 = v6->_z + 6.7553994e15; | |
534 //uIDd = (LODWORD(v12) - pIndoorCamera->pos.z) << 16; | |
535 auto _hidword_v12 = fixpoint_sub0(v11, v3) + fixpoint_mul(v6->z - pIndoorCamera->pos.z, v44); | |
0 | 536 LODWORD(v13) = 0; |
537 HIDWORD(v13) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
871 | 538 //v14 = v13 / _hidword_v12; |
539 v6->_screenspace_scale = v13 / _hidword_v12; | |
540 //v15 = v6->_screenspace_scale; | |
0 | 541 v6->uScreenSpaceX = pViewport->uScreenCenterX |
871 | 542 - ((signed int)((unsigned __int64)(v6->_screenspace_scale |
543 * (signed __int64)(fixpoint_mul(v6->y - pIndoorCamera->pos.y, v4) | |
544 - fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5))) >> 16) >> 16); | |
0 | 545 v6->uScreenSpaceY = pViewport->uScreenCenterY |
871 | 546 - ((signed int)((unsigned __int64)(v6->_screenspace_scale |
547 * (signed __int64)(fixpoint_mul(v6->z - pIndoorCamera->pos.z, v3) | |
0 | 548 - ((unsigned __int64)(v11 * (signed __int64)v44) >> 16))) >> 16) >> 16); |
871 | 549 v6->sZValue = _hidword_v12; |
0 | 550 } |
871 | 551 //uIDe = (v41 - pIndoorCamera->pos.x) << 16; |
552 //v47 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; | |
553 v45 = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v4) + fixpoint_mul(v6->y - pIndoorCamera->pos.y, v5); | |
554 //HIDWORD(v42) = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); | |
555 //uIDa = (LODWORD(v42) - pIndoorCamera->pos.z) << 16; | |
556 X_4 = fixpoint_mul(v6->z - pIndoorCamera->pos.z, v44) + fixpoint_sub0(v45, v3); | |
557 if ( X_4 < 0x40000 ) | |
0 | 558 return 0; |
871 | 559 v16 = fixpoint_mul(v6->y - pIndoorCamera->pos.y, v4) - fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); |
560 v17 = fixpoint_mul(v6->z - pIndoorCamera->pos.z, v3) - fixpoint_sub0(v45, v44); | |
0 | 561 } |
562 else | |
563 { | |
619 | 564 if (v6->type & ParticleType_Line) |
0 | 565 { |
871 | 566 //v18 = v6->_x + 6.7553994e15; |
567 //uIDf = (LODWORD(v18) - pIndoorCamera->pos.x) << 16; | |
568 //v19 = v6->_y + 6.7553994e15; | |
569 //v20 = (LODWORD(v19) - pIndoorCamera->pos.y) << 16; | |
570 //v21 = v6->_z + 6.7553994e15; | |
0 | 571 LODWORD(v22) = 0; |
572 HIDWORD(v22) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
871 | 573 auto _var_123 = fixpoint_mul(v6->x - pIndoorCamera->pos.x, v4) + fixpoint_mul(v6->y - pIndoorCamera->pos.y, v5); |
574 //v23 = v22 / _var_123; | |
575 v6->_screenspace_scale = v22 / _var_123; | |
576 //v24 = v6->_screenspace_scale; | |
0 | 577 v6->uScreenSpaceX = pViewport->uScreenCenterX |
871 | 578 - ((signed int)((unsigned __int64)(v6->_screenspace_scale |
579 * (signed __int64)(fixpoint_mul(v6->y - pIndoorCamera->pos.y, v4) | |
580 - fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5))) >> 16) >> 16); | |
581 v6->uScreenSpaceY = pViewport->uScreenCenterY - (fixpoint_mul(v6->z, v6->_screenspace_scale) >> 16); | |
582 v6->sZValue = _var_123; | |
0 | 583 } |
871 | 584 //uIDb = (v41 - pIndoorCamera->pos.x) << 16; |
585 //v48 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; | |
586 v26 = fixpoint_mul(v6->y - pIndoorCamera->pos.y, v5); | |
587 //v27 = v26 + ((unsigned __int64)(uIDb * (signed __int64)v4) >> 16); | |
588 X_4 = v26 + fixpoint_mul(v6->x - pIndoorCamera->pos.x, v4); | |
589 if ( X_4 < 0x40000 || X_4 > (pOutdoorCamera->uPickDepth - 1000) << 16 ) | |
0 | 590 return 0; |
871 | 591 v17 = v6->z; |
592 v16 = fixpoint_mul(v6->y - pIndoorCamera->pos.y, v4) - fixpoint_mul(v6->x - pIndoorCamera->pos.x, v5); | |
0 | 593 } |
594 v40 = v17; | |
595 v28 = abs(v16); | |
596 if ( abs(X_4) >= v28 ) | |
597 { | |
598 LODWORD(v29) = 0; | |
599 HIDWORD(v29) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
871 | 600 //v30 = v29 / X_4; |
601 v6->_screenspace_scale = v29 / X_4; | |
602 //v31 = v6->_screenspace_scale; | |
0 | 603 v6->uScreenSpaceX = pViewport->uScreenCenterX |
871 | 604 - ((signed int)((unsigned __int64)(v6->_screenspace_scale * (signed __int64)v16) >> 16) >> 16); |
605 v33 = (signed int)((unsigned __int64)(v6->_screenspace_scale * (signed __int64)v40) >> 16) >> 16; | |
1029 | 606 //v34 = pViewport->uScreenCenterY - v33; |
0 | 607 v6->uScreenSpaceY = pViewport->uScreenCenterY - v33; |
1029 | 608 v6->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(v6->flt_28), v6->_screenspace_scale); |
0 | 609 v6->sZValue = X_4; |
610 v36 = v6->uScreenSpaceX; | |
693 | 611 if ( v36 >= (signed int)pViewport->uViewportTL_X ) |
0 | 612 { |
693 | 613 if ( v36 < (signed int)pViewport->uViewportBR_X ) |
0 | 614 { |
615 v37 = v6->uScreenSpaceY; | |
693 | 616 if ( v37 >= (signed int)pViewport->uViewportTL_Y ) |
0 | 617 { |
693 | 618 if ( v37 < (signed int)pViewport->uViewportBR_Y ) |
0 | 619 return 1; |
620 } | |
621 } | |
622 } | |
623 } | |
871 | 624 return false; |
0 | 625 } |
626 | |
627 //----- (0048BBA6) -------------------------------------------------------- | |
628 void ParticleEngine::DrawParticles_BLV() | |
629 { | |
630 int v11; // eax@18 | |
631 int v12; // ecx@20 | |
632 int v13; // edx@20 | |
619 | 633 //Particle *v14; // eax@28 |
0 | 634 RenderBillboardTransform_local0 v15; // [sp+Ch] [bp-58h]@1 |
635 | |
636 v15.uParentBillboardID = -1; | |
637 | |
638 for (uint i = uStartParticle; i < uEndParticle; ++i) | |
639 { | |
640 auto p = pParticles + i; | |
641 | |
619 | 642 if (p->type == ParticleType_Invalid) |
0 | 643 continue; |
644 | |
871 | 645 if (!ViewProject_TrueIfStillVisible_BLV(i)) |
0 | 646 continue; |
647 | |
648 if (p->uScreenSpaceX >= pBLVRenderParams->uViewportX && | |
649 p->uScreenSpaceX < pBLVRenderParams->uViewportZ && | |
650 p->uScreenSpaceY >= pBLVRenderParams->uViewportY && | |
651 p->uScreenSpaceY < pBLVRenderParams->uViewportW) | |
652 { | |
653 if (pRenderer->pRenderD3D) | |
654 { | |
619 | 655 if (p->type & ParticleType_Diffuse) |
0 | 656 { |
619 | 657 //v14 = &pParticles[i]; |
658 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale / 4; | |
659 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale / 4; | |
660 v15.uScreenSpaceX = p->uScreenSpaceX; | |
661 v15.uScreenSpaceY = p->uScreenSpaceY; | |
662 v15.sZValue = p->sZValue; | |
871 | 663 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, 0, p->uLightColor_bgr, p->angle); |
0 | 664 return; |
665 } | |
619 | 666 if (p->type & ParticleType_Line) |
0 | 667 { |
668 if (pLines.uNumLines < 100) | |
669 { | |
670 pLines.pLineVertices[2 * pLines.uNumLines].pos.x = p->uScreenSpaceX; | |
671 pLines.pLineVertices[2 * pLines.uNumLines].pos.y = p->uScreenSpaceY; | |
672 pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((short)p->sZValue * 0.061758894); | |
673 pLines.pLineVertices[2 * pLines.uNumLines].rhw = 1.0; | |
871 | 674 pLines.pLineVertices[2 * pLines.uNumLines].diffuse = p->uLightColor_bgr; |
0 | 675 pLines.pLineVertices[2 * pLines.uNumLines].specular = 0; |
676 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.x = 0.0; | |
677 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.y = 0.0; | |
678 | |
679 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.x = p->uScreenSpaceZ; | |
680 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.y = p->uScreenSpaceW; | |
681 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((short)p->sZValue2 * 0.061758894); | |
682 pLines.pLineVertices[2 * pLines.uNumLines + 1].rhw = 1.0; | |
871 | 683 pLines.pLineVertices[2 * pLines.uNumLines + 1].diffuse = p->uLightColor_bgr; |
0 | 684 pLines.pLineVertices[2 * pLines.uNumLines + 1].specular = 0; |
685 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.x = 0.0; | |
686 pLines.pLineVertices[2 * pLines.uNumLines++ + 1].texcoord.y = 0.0; | |
687 } | |
688 } | |
619 | 689 if (p->type & ParticleType_Bitmap) |
0 | 690 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
691 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
692 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; |
0 | 693 v15.uScreenSpaceX = p->uScreenSpaceX; |
694 v15.uScreenSpaceY = p->uScreenSpaceY; | |
695 v15.sZValue = p->sZValue; | |
871 | 696 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pBitmaps_LOD->pHardwareTextures[p->uTextureID], p->uLightColor_bgr, p->angle); |
0 | 697 } |
619 | 698 if (p->type & ParticleType_Sprite) |
0 | 699 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
700 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
701 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; |
0 | 702 v15.uScreenSpaceX = p->uScreenSpaceX; |
703 v15.uScreenSpaceY = p->uScreenSpaceY; | |
704 v15.sZValue = p->sZValue; | |
871 | 705 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pSprites_LOD->pHardwareSprites[p->uTextureID].pTexture, p->uLightColor_bgr, p->angle); |
0 | 706 } |
707 } | |
708 else | |
709 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
710 v11 = 13 * p->_screenspace_scale >> 16; |
0 | 711 if ( v11 > 30 ) |
712 v11 = 30; | |
713 v12 = p->uScreenSpaceY - v11; | |
714 v13 = p->uScreenSpaceX - (v11 >> 1); | |
693 | 715 if ( v13 + v11 < (signed int)pViewport->uViewportTL_X |
716 || v13 >= (signed int)pViewport->uViewportBR_X | |
717 || v12 + v11 < (signed int)pViewport->uViewportTL_Y | |
718 || v12 >= (signed int)pViewport->uViewportBR_Y ) | |
0 | 719 { |
720 ; | |
721 } | |
722 else | |
723 { | |
871 | 724 pRenderer->MakeParticleBillboardAndPush_BLV_Software(v13, v12, p->sZValue, p->uLightColor_bgr, v11); |
0 | 725 } |
726 } | |
727 } | |
728 } | |
729 } | |
730 | |
731 //----- (0048BEEF) -------------------------------------------------------- | |
732 void ParticleEngine::DrawParticles_ODM() | |
733 { | |
62 | 734 ParticleEngine *pParticleEngine; // esi@1 |
871 | 735 //int pParticleNum; // eax@1 |
0 | 736 unsigned __int8 v3; // zf@1 |
737 char v4; // sf@1 | |
738 unsigned __int8 v5; // of@1 | |
871 | 739 //char *v7; // edi@2 |
740 //int v8; // eax@6 | |
741 //signed int pNumLines; // eax@8 | |
0 | 742 int v10; // eax@14 |
743 int v11; // ecx@16 | |
744 int v12; // edx@16 | |
871 | 745 //Particle *pParticle; // eax@24 |
62 | 746 RenderBillboardTransform_local0 pBillboard; // [sp+Ch] [bp-58h]@1 |
871 | 747 //int v15; // [sp+5Ch] [bp-8h]@9 |
0 | 748 int v16; // [sp+60h] [bp-4h]@1 |
749 | |
62 | 750 pBillboard.uParentBillboardID = -1; |
751 pParticleEngine = this; | |
752 //v2 = this->uStartParticle; | |
753 //v5 = v2 > this->uEndParticle;// v5 = __OFSUB__(v2, this->uEndParticle); | |
754 //v3 = v2 == this->uEndParticle; | |
755 //v4 = v2 - this->uEndParticle < 0; | |
756 //v16 = this->uStartParticle; | |
871 | 757 for (uint i = uStartParticle; i <= uEndParticle; ++i) |
0 | 758 { |
871 | 759 auto particle = pParticles + i; |
760 if (particle->type == ParticleType_Invalid || !ViewProject_TrueIfStillVisible_ODM(i)) | |
761 continue; | |
762 | |
0 | 763 if ( pRenderer->pRenderD3D ) |
764 { | |
871 | 765 //v8 = *(_DWORD *)(v7 - 82); |
766 if (particle->type & ParticleType_Diffuse) | |
0 | 767 { |
871 | 768 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale / 4; |
769 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale / 4; | |
770 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
771 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
772 pBillboard.sZValue = particle->sZValue; | |
773 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, 0, particle->uLightColor_bgr, particle->angle); | |
0 | 774 return; |
775 } | |
871 | 776 if (particle->type & ParticleType_Line) |
0 | 777 { |
871 | 778 if (pLines.uNumLines < 100) |
0 | 779 { |
871 | 780 pLines.pLineVertices[2 * pLines.uNumLines].pos.x = particle->uScreenSpaceX; |
781 pLines.pLineVertices[2 * pLines.uNumLines].pos.y = particle->uScreenSpaceY; | |
782 pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
783 pLines.pLineVertices[2 * pLines.uNumLines].rhw = 1.0; | |
784 pLines.pLineVertices[2 * pLines.uNumLines].diffuse = particle->uLightColor_bgr; | |
785 pLines.pLineVertices[2 * pLines.uNumLines].specular = 0; | |
786 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.x = 0.0; | |
787 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.y = 0.0; | |
788 | |
789 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.x = particle->uScreenSpaceZ; | |
790 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.y = particle->uScreenSpaceW; | |
791 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
792 pLines.pLineVertices[2 * pLines.uNumLines + 1].rhw = 1.0; | |
793 pLines.pLineVertices[2 * pLines.uNumLines + 1].diffuse = particle->uLightColor_bgr; | |
794 pLines.pLineVertices[2 * pLines.uNumLines + 1].specular = 0; | |
795 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.x = 0.0; | |
796 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.y = 0.0; | |
797 pLines.uNumLines++; | |
0 | 798 } |
799 } | |
871 | 800 if (particle->type & ParticleType_Bitmap) |
0 | 801 { |
871 | 802 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale; |
803 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale; | |
804 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
805 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
806 pBillboard.sZValue = particle->sZValue; | |
807 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, pBitmaps_LOD->pHardwareTextures[particle->uTextureID], particle->uLightColor_bgr, particle->angle); | |
0 | 808 } |
871 | 809 if (particle->type & ParticleType_Sprite) |
0 | 810 { |
871 | 811 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale; |
812 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale; | |
813 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
814 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
815 pBillboard.sZValue = particle->sZValue; | |
816 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, pSprites_LOD->pHardwareSprites[particle->uTextureID].pTexture, particle->uLightColor_bgr, particle->angle); | |
0 | 817 } |
818 } | |
819 else | |
820 { | |
871 | 821 v10 = 13 * particle->_screenspace_scale >> 16; |
0 | 822 if ( v10 > 30 ) |
823 v10 = 30; | |
871 | 824 v11 = particle->uScreenSpaceX - (v10 >> 1); |
825 v12 = particle->uScreenSpaceY - v10; | |
693 | 826 if ( v11 + v10 < pViewport->uViewportTL_X |
827 || v11 >= pViewport->uViewportBR_X | |
871 | 828 || particle->uScreenSpaceY < pViewport->uViewportTL_Y |
693 | 829 || v12 >= (signed int)pViewport->uViewportBR_Y ) |
0 | 830 { |
831 ; | |
832 } | |
833 else | |
834 { | |
871 | 835 pRenderer->MakeParticleBillboardAndPush_BLV_Software(v11, v12, particle->sZValue, particle->uLightColor_bgr, v10); |
0 | 836 } |
871 | 837 } |
0 | 838 } |
839 } |