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