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