Mercurial > mm7
annotate ParticleEngine.cpp @ 2044:28cb79ae2f6f
Time.h rename
author | Ritor1 |
---|---|
date | Thu, 28 Nov 2013 17:12:50 +0600 |
parents | 7a9477135943 |
children | 259df09dfb50 |
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 |
143 if (pRenderer->pRenderD3D) | |
144 { | |
145 if (pLines.uNumLines) | |
146 { | |
147 pRenderer->pRenderD3D->pDevice->SetTexture(0, 0); | |
148 pRenderer->pRenderD3D->pDevice->DrawPrimitive( | |
149 D3DPT_LINELIST, | |
150 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
151 pLines.pLineVertices, | |
152 pLines.uNumLines, | |
153 D3DDP_DONOTLIGHT); | |
154 } | |
155 } | |
156 } | |
157 | |
158 //----- (0048AC65) -------------------------------------------------------- | |
159 void ParticleEngine::UpdateParticles() | |
160 { | |
161 unsigned int time; // edi@1 | |
871 | 162 //int v5; // eax@3 |
163 //char v6; // sf@4 | |
0 | 164 float v7; // ST4C_4@11 |
165 double v8; // st7@12 | |
871 | 166 //int v9; // eax@12 |
167 //double v10; // st7@14 | |
0 | 168 signed int v19; // [sp+38h] [bp-14h]@1 |
169 int v20; // [sp+3Ch] [bp-10h]@1 | |
170 unsigned int time_; // [sp+40h] [bp-Ch]@1 | |
171 int v22; // [sp+44h] [bp-8h]@12 | |
172 | |
173 v20 = 0; | |
174 time = pMiscTimer->bPaused == 0 ? pEventTimer->uTimeElapsed : 0; | |
175 v19 = 500; | |
176 time_ = pMiscTimer->bPaused == 0 ? pEventTimer->uTimeElapsed : 0; | |
177 | |
871 | 178 for (uint i = uStartParticle; i <= uEndParticle; ++i) |
0 | 179 { |
1980 | 180 Particle* p = &pParticles[i]; |
0 | 181 |
619 | 182 if (p->type == ParticleType_Invalid) |
0 | 183 continue; |
184 | |
871 | 185 if (p->timeToLive <= time) |
186 { | |
187 p->timeToLive = 0; | |
188 p->type = ParticleType_Invalid; | |
189 continue; | |
190 } | |
0 | 191 p->timeToLive -= time; |
871 | 192 |
193 if (p->type & ParticleType_Line) | |
0 | 194 { |
195 p->_x = p->x; | |
196 p->_y = p->y; | |
197 p->_z = p->z; | |
198 } | |
871 | 199 |
200 if (p->type & ParticleType_1) | |
0 | 201 p->flt_18 = p->flt_18 - (double)(signed int)time_ * 5.0; |
871 | 202 |
203 if (p->type & ParticleType_8) | |
0 | 204 { |
205 v7 = (double)(signed int)time_; | |
206 *(float *)&p->x += (double)(rand() % 5 - 2) * v7 / 16.0f; | |
207 *(float *)&p->y += (double)(rand() % 5 - 2) * v7 / 16.0f; | |
208 *(float *)&p->z += (double)(rand() % 5 + 4) * v7 / 16.0f; | |
209 } | |
210 v8 = (double)(signed int)time_ / 128.0f; | |
871 | 211 //v9 = (signed int)(time * p->rotation_speed) / 16; |
212 | |
213 p->x += v8 * p->flt_10; | |
214 p->y += v8 * p->flt_14; | |
215 p->z += v8 * p->flt_18; | |
216 | |
217 p->angle += time * p->rotation_speed / 16; | |
0 | 218 v22 = 2 * p->timeToLive; |
871 | 219 if (v22 >= 255 ) |
0 | 220 v22 = 255; |
871 | 221 //v10 = (double)v22 * 0.0039215689; |
222 p->uLightColor_bgr = ((uint)floorf(p->b * (v22 / 255.0f) + 0.5) << 16) | | |
223 ((uint)floorf(p->g * (v22 / 255.0f) + 0.5) << 8) | | |
224 ((uint)floorf(p->r * (v22 / 255.0f) + 0.5) << 0); | |
0 | 225 if ( i < v19 ) |
226 v19 = i; | |
227 if ( i > v20 ) | |
228 v20 = i; | |
229 } | |
230 | |
231 uEndParticle = v20; | |
232 uStartParticle = v19; | |
233 } | |
234 | |
235 //----- (0048AE74) -------------------------------------------------------- | |
871 | 236 bool ParticleEngine::ViewProject_TrueIfStillVisible_BLV(unsigned int uParticleID) |
0 | 237 { |
238 Particle *pParticle; // esi@1 | |
619 | 239 //double v56; // ST28_8@2 |
871 | 240 //float v4; // eax@4 |
241 //double v5; // ST34_8@4 | |
0 | 242 signed __int64 v6; // qtt@4 |
619 | 243 //double v7; // st7@4 |
244 //float v8; // ST18_4@4 | |
0 | 245 int v9; // ecx@4 |
619 | 246 //int v10; // eax@4 |
247 //double v11; // ST44_8@7 | |
248 //double v12; // ST4C_8@7 | |
0 | 249 double v13; // ST4C_8@7 |
250 int v14; // ecx@7 | |
871 | 251 //signed __int64 v15; // qtt@7 |
0 | 252 int v16; // eax@7 |
253 int v17; // edx@7 | |
254 float v18; // edx@7 | |
255 int v19; // eax@7 | |
256 int v20; // edx@7 | |
257 int v21; // ST50_4@8 | |
258 int v22; // ebx@8 | |
259 int v23; // ecx@10 | |
260 int v24; // edi@10 | |
871 | 261 //double v25; // ST44_8@12 |
262 //double v26; // ST4C_8@12 | |
0 | 263 int v27; // edi@12 |
264 int v28; // ST40_4@12 | |
265 int v29; // ecx@12 | |
871 | 266 //signed __int64 v30; // qtt@12 |
0 | 267 int v31; // eax@12 |
268 int v32; // edx@12 | |
269 float v33; // edx@12 | |
871 | 270 //int v34; // eax@12 |
0 | 271 int v35; // ecx@12 |
272 int v36; // ST38_4@13 | |
273 int v37; // ST30_4@15 | |
274 int v38; // eax@16 | |
871 | 275 //signed __int64 v40; // qtt@18 |
0 | 276 int v41; // eax@18 |
277 int v42; // ecx@18 | |
278 int v43; // eax@18 | |
279 unsigned __int64 v44; // qax@18 | |
1029 | 280 //double v45; // st7@18 |
281 //int v46; // ecx@18 | |
282 //float v47; // ST18_4@18 | |
283 //unsigned __int64 v48; // qax@18 | |
619 | 284 int y_int_; // [sp+10h] [bp-40h]@2 |
0 | 285 int a2; // [sp+18h] [bp-38h]@10 |
286 int x_int; // [sp+20h] [bp-30h]@2 | |
619 | 287 int z_int_; // [sp+24h] [bp-2Ch]@2 |
0 | 288 int z_int_4; // [sp+28h] [bp-28h]@8 |
289 int z; // [sp+3Ch] [bp-14h]@3 | |
290 double a5; // [sp+40h] [bp-10h]@4 | |
291 int a6; // [sp+48h] [bp-8h]@4 | |
292 int y; // [sp+4Ch] [bp-4h]@3 | |
293 | |
294 pParticle = &this->pParticles[uParticleID]; | |
619 | 295 if (pParticle->type == ParticleType_Invalid) |
0 | 296 return 0; |
619 | 297 //uParticleID = LODWORD(pParticle->x); |
298 //v56 = *(float *)&uParticleID + 6.7553994e15; | |
299 x_int = floorf(pParticle->x + 0.5f); | |
300 //uParticleID = LODWORD(pParticle->y); | |
301 //y_int_ = *(float *)&uParticleID + 6.7553994e15; | |
302 y_int_ = floorf(pParticle->y + 0.5f); | |
303 //uParticleID = LODWORD(pParticle->z); | |
304 //z_int_ = *(float *)&uParticleID + 6.7553994e15; | |
305 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
|
306 /*if ( !pRenderer->pRenderD3D ) |
0 | 307 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
308 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 309 { |
619 | 310 if (pParticle->type & ParticleType_Line) |
0 | 311 { |
619 | 312 //v11 = pParticle->_x + 6.7553994e15; |
313 int _uParticleID = (int)(floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16; | |
314 //v12 = pParticle->_y + 6.7553994e15; | |
315 y = (int)(floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 316 z = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
317 HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) | |
0 | 318 - z; |
1642 | 319 a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
619 | 320 //v13 = pParticle->_z + 6.7553994e15; |
321 _uParticleID = (int)(floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; | |
1642 | 322 z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) |
323 - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); | |
0 | 324 v14 = z; |
1642 | 325 HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; |
326 HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16; | |
871 | 327 //LODWORD(v15) = pBLVRenderParams->field_40 << 16; |
328 //HIDWORD(v15) = pBLVRenderParams->field_40 >> 16; | |
329 //v16 = v15 / z; | |
330 v16 = fixpoint_div(pBLVRenderParams->field_40, z); | |
1642 | 331 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
|
332 pParticle->_screenspace_scale = v16; |
619 | 333 _uParticleID = (unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16; |
0 | 334 LODWORD(v18) = pBLVRenderParams->uViewportCenterX |
335 - ((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
|
336 v19 = pParticle->_screenspace_scale; |
0 | 337 pParticle->uScreenSpaceZ = v18; |
619 | 338 _uParticleID = (unsigned __int64)(v19 * (signed __int64)(HIDWORD(v13) + HIDWORD(a5))) >> 16; |
0 | 339 v20 = pBLVRenderParams->uViewportCenterY |
340 - ((signed int)((unsigned __int64)(v19 * (signed __int64)(HIDWORD(v13) + HIDWORD(a5))) >> 16) >> 16); | |
341 pParticle->sZValue2 = v14; | |
342 pParticle->uScreenSpaceW = v20; | |
343 } | |
619 | 344 int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; |
345 y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 346 HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) |
347 - ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); | |
348 a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; | |
349 z_int_4 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; | |
619 | 350 _uParticleID = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; |
1642 | 351 v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; |
352 v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v21; | |
353 z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - v21; | |
0 | 354 if ( v22 < (signed int)0x40000u || v22 > (signed int)0x1F400000u ) |
355 return 0; | |
356 v23 = a6 + z_int_4; | |
357 a2 = a6 + z_int_4; | |
1642 | 358 v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) |
359 + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); | |
0 | 360 } |
361 else | |
362 { | |
619 | 363 if (pParticle->type & ParticleType_Line) |
0 | 364 { |
871 | 365 //v25 = pParticle->_x + 6.7553994e15; |
366 int _uParticleID = ((int)floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16; | |
367 //v26 = pParticle->_y + 6.7553994e15; | |
368 y = ((int)floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 369 auto _hiword_v25 = (__int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
370 v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25; | |
371 z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - _hiword_v25; | |
372 v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; | |
871 | 373 //a5 = pParticle->_z + 6.7553994e15; |
374 v29 = ((int)floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; | |
375 //LODWORD(v30) = pBLVRenderParams->field_40 << 16; | |
376 //HIDWORD(v30) = pBLVRenderParams->field_40 >> 16; | |
377 //v31 = v30 / z; | |
378 v31 = fixpoint_div(pBLVRenderParams->field_40, z); | |
1642 | 379 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
|
380 pParticle->_screenspace_scale = v31; |
619 | 381 _uParticleID = (unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16; |
871 | 382 LODWORD(v33) = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16) >> 16); |
383 //v34 = pParticle->_screenspace_scale; | |
0 | 384 pParticle->uScreenSpaceZ = v33; |
871 | 385 v35 = pBLVRenderParams->uViewportCenterY - ((signed int)((unsigned __int64)(pParticle->_screenspace_scale * (signed __int64)v29) >> 16) >> 16); |
0 | 386 pParticle->sZValue2 = v27; |
387 pParticle->uScreenSpaceW = v35; | |
388 } | |
619 | 389 int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; |
390 y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; | |
1642 | 391 v36 = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
392 v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v36; | |
393 z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v36; | |
0 | 394 if ( v22 < 262144 || v22 > 524288000 ) |
395 return 0; | |
1642 | 396 v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; |
397 _uParticleID = (unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; | |
398 v23 = v37 + ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); | |
399 a2 = v37 + ((unsigned __int64)(y * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16); | |
619 | 400 v24 = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; |
0 | 401 } |
619 | 402 int _uParticleID = abs(v23); |
0 | 403 v38 = abs(v22); |
619 | 404 if ( v38 >= (signed int)_uParticleID ) |
0 | 405 { |
871 | 406 //LODWORD(v40) = pBLVRenderParams->field_40 << 16; |
407 //HIDWORD(v40) = pBLVRenderParams->field_40 >> 16; | |
408 v41 = fixpoint_div(pBLVRenderParams->field_40, z); | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
409 pParticle->_screenspace_scale = v41; |
619 | 410 _uParticleID = (unsigned __int64)(v41 * (signed __int64)a2) >> 16; |
0 | 411 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
|
412 v43 = pParticle->_screenspace_scale; |
0 | 413 pParticle->uScreenSpaceX = v42; |
414 v44 = v43 * (signed __int64)v24; | |
619 | 415 //uParticleID = v44 >> 16; |
0 | 416 LODWORD(v44) = (signed int)(v44 >> 16) >> 16; |
417 pParticle->uScreenSpaceY = pBLVRenderParams->uViewportCenterY - v44; | |
1643 | 418 pParticle->_screenspace_scale = fixpoint_mul(fixpoint_from_float(pParticle->flt_28), pParticle->_screenspace_scale); |
619 | 419 pParticle->sZValue = z; |
420 return true; | |
0 | 421 } |
619 | 422 return false; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
423 }*/ |
619 | 424 |
425 int x; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
426 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible_BLV( |
0 | 427 x_int, |
619 | 428 y_int_, |
429 z_int_, | |
430 &x, | |
0 | 431 &y, |
432 &z, | |
433 1) ) | |
619 | 434 return false; |
435 pGame->pIndoorCameraD3D->Project(x, y, z, &pParticle->uScreenSpaceX, &pParticle->uScreenSpaceY); | |
0 | 436 pParticle->flt_5C = pGame->pIndoorCameraD3D->fov_x; |
871 | 437 //v4 = pParticle->flt_5C; |
0 | 438 pParticle->flt_60 = pGame->pIndoorCameraD3D->fov_y; |
871 | 439 //v5 = v4 + 6.7553994e15; |
0 | 440 LODWORD(v6) = 0; |
871 | 441 HIDWORD(v6) = floorf(pParticle->flt_5C + 0.5f); |
619 | 442 //v7 = pParticle->flt_28; |
1029 | 443 //pParticle->_screenspace_scale = v6 / x; |
619 | 444 //v8 = v7; |
1643 | 445 pParticle->_screenspace_scale = fixpoint_mul(fixpoint_from_float(pParticle->flt_28), v6 / x); |
619 | 446 pParticle->sZValue = x; |
447 return true; | |
0 | 448 } |
449 | |
450 | |
451 | |
452 | |
453 //----- (0048B5B3) -------------------------------------------------------- | |
871 | 454 bool ParticleEngine::ViewProject_TrueIfStillVisible_ODM(unsigned int uID) |
0 | 455 { |
871 | 456 //ParticleEngine *v2; // ST18_4@1 |
0 | 457 int v3; // ebx@1 |
458 int v4; // edi@1 | |
459 int v5; // ecx@1 | |
460 Particle *v6; // esi@1 | |
871 | 461 //double v7; // ST14_8@2 |
462 //double v8; // ST34_8@4 | |
463 //double v9; // ST3C_8@4 | |
464 //int v10; // ST50_4@4 | |
0 | 465 int v11; // ST44_4@4 |
871 | 466 //double v12; // ST48_8@4 |
0 | 467 signed __int64 v13; // qtt@4 |
871 | 468 //int v14; // eax@4 |
469 //int v15; // ST28_4@4 | |
0 | 470 int v16; // edi@6 |
471 int v17; // eax@6 | |
871 | 472 //double v18; // ST2C_8@8 |
473 //double v19; // ST34_8@8 | |
474 //int v20; // ST50_4@8 | |
475 //double v21; // ST34_8@8 | |
0 | 476 signed __int64 v22; // qtt@8 |
871 | 477 //int v23; // eax@8 |
478 //int v24; // ST28_4@8 | |
479 //int v25; // edx@8 | |
0 | 480 int v26; // edx@9 |
871 | 481 //int v27; // eax@9 |
0 | 482 int v28; // ebx@12 |
483 signed __int64 v29; // qtt@13 | |
871 | 484 //int v30; // eax@13 |
485 //int v31; // ST1C_4@13 | |
1029 | 486 //double v32; // st7@13 |
0 | 487 signed int v33; // eax@13 |
1029 | 488 //int v34; // ecx@13 |
489 //float v35; // ST04_4@13 | |
0 | 490 int v36; // eax@13 |
491 int v37; // esi@15 | |
871 | 492 //double v39; // [sp+10h] [bp-40h]@2 |
0 | 493 int v40; // [sp+14h] [bp-3Ch]@12 |
871 | 494 //int v41; // [sp+1Ch] [bp-34h]@2 |
495 //double v42; // [sp+20h] [bp-30h]@2 | |
496 //int v43; // [sp+24h] [bp-2Ch]@5 | |
0 | 497 int v44; // [sp+2Ch] [bp-24h]@1 |
498 int v45; // [sp+40h] [bp-10h]@5 | |
499 int X_4; // [sp+48h] [bp-8h]@5 | |
871 | 500 //int v47; // [sp+4Ch] [bp-4h]@5 |
501 //int v48; // [sp+4Ch] [bp-4h]@9 | |
502 //int uIDc; // [sp+58h] [bp+8h]@4 | |
503 //int uIDd; // [sp+58h] [bp+8h]@4 | |
504 //int uIDe; // [sp+58h] [bp+8h]@5 | |
505 //int uIDa; // [sp+58h] [bp+8h]@5 | |
506 //int uIDf; // [sp+58h] [bp+8h]@8 | |
507 //int uIDb; // [sp+58h] [bp+8h]@9 | |
0 | 508 |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
509 v3 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
510 v44 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
511 v4 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
512 v5 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
871 | 513 |
514 v6 = &pParticles[uID]; | |
515 if (v6->type == ParticleType_Invalid) | |
516 return false; | |
517 | |
518 //v7 = v6->x + 6.7553994e15; | |
519 //v41 = LODWORD(v7); | |
520 //v39 = v6->y + 6.7553994e15; | |
521 //v42 = v6->z + 6.7553994e15; | |
0 | 522 if ( v3 ) |
523 { | |
619 | 524 if (v6->type & ParticleType_Line) |
0 | 525 { |
871 | 526 //v8 = v6->_x + 6.7553994e15; |
527 //uIDc = (LODWORD(v8) - pIndoorCamera->pos.x) << 16; | |
528 //v9 = v6->_y + 6.7553994e15; | |
529 //v10 = (LODWORD(v9) - pIndoorCamera->pos.y) << 16; | |
1643 | 530 v11 = fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); |
531 //HIDWORD(v8) = fixpoint_sub_unknown(v6->x - pIndoorCamera->pos.x, v5); | |
871 | 532 //v12 = v6->_z + 6.7553994e15; |
533 //uIDd = (LODWORD(v12) - pIndoorCamera->pos.z) << 16; | |
1980 | 534 long long _hidword_v12 = fixpoint_mul(v11, v3) + fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44); |
0 | 535 LODWORD(v13) = 0; |
1637 | 536 HIDWORD(v13) = SLOWORD(pODMRenderParams->int_fov_rad); |
871 | 537 //v14 = v13 / _hidword_v12; |
538 v6->_screenspace_scale = v13 / _hidword_v12; | |
539 //v15 = v6->_screenspace_scale; | |
0 | 540 v6->uScreenSpaceX = pViewport->uScreenCenterX |
871 | 541 - ((signed int)((unsigned __int64)(v6->_screenspace_scale |
1643 | 542 * (signed __int64)(fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) |
543 - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); | |
0 | 544 v6->uScreenSpaceY = pViewport->uScreenCenterY |
871 | 545 - ((signed int)((unsigned __int64)(v6->_screenspace_scale |
1643 | 546 * (signed __int64)(fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) |
0 | 547 - ((unsigned __int64)(v11 * (signed __int64)v44) >> 16))) >> 16) >> 16); |
871 | 548 v6->sZValue = _hidword_v12; |
0 | 549 } |
871 | 550 //uIDe = (v41 - pIndoorCamera->pos.x) << 16; |
551 //v47 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; | |
1643 | 552 v45 = fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); |
553 //HIDWORD(v42) = fixpoint_sub_unknown(v6->x - pIndoorCamera->pos.x, v5); | |
871 | 554 //uIDa = (LODWORD(v42) - pIndoorCamera->pos.z) << 16; |
1643 | 555 X_4 = fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v44) + fixpoint_mul(v45, v3); |
871 | 556 if ( X_4 < 0x40000 ) |
0 | 557 return 0; |
1643 | 558 v16 = fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); |
559 v17 = fixpoint_sub_unknown(v6->z - pGame->pIndoorCameraD3D->vPartyPos.z, v3) - fixpoint_mul(v45, v44); | |
0 | 560 } |
561 else | |
562 { | |
619 | 563 if (v6->type & ParticleType_Line) |
0 | 564 { |
871 | 565 //v18 = v6->_x + 6.7553994e15; |
566 //uIDf = (LODWORD(v18) - pIndoorCamera->pos.x) << 16; | |
567 //v19 = v6->_y + 6.7553994e15; | |
568 //v20 = (LODWORD(v19) - pIndoorCamera->pos.y) << 16; | |
569 //v21 = v6->_z + 6.7553994e15; | |
0 | 570 LODWORD(v22) = 0; |
1637 | 571 HIDWORD(v22) = SLOWORD(pODMRenderParams->int_fov_rad); |
1980 | 572 long long _var_123 = fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4) + fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); |
871 | 573 //v23 = v22 / _var_123; |
574 v6->_screenspace_scale = v22 / _var_123; | |
575 //v24 = v6->_screenspace_scale; | |
0 | 576 v6->uScreenSpaceX = pViewport->uScreenCenterX |
871 | 577 - ((signed int)((unsigned __int64)(v6->_screenspace_scale |
1643 | 578 * (signed __int64)(fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) |
579 - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5))) >> 16) >> 16); | |
580 v6->uScreenSpaceY = pViewport->uScreenCenterY - (fixpoint_sub_unknown(v6->z, v6->_screenspace_scale) >> 16); | |
871 | 581 v6->sZValue = _var_123; |
0 | 582 } |
871 | 583 //uIDb = (v41 - pIndoorCamera->pos.x) << 16; |
584 //v48 = (LODWORD(v39) - pIndoorCamera->pos.y) << 16; | |
1643 | 585 v26 = fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v5); |
871 | 586 //v27 = v26 + ((unsigned __int64)(uIDb * (signed __int64)v4) >> 16); |
1643 | 587 X_4 = v26 + fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v4); |
1637 | 588 if ( X_4 < 0x40000 || X_4 > (pODMRenderParams->uPickDepth - 1000) << 16 ) |
0 | 589 return 0; |
871 | 590 v17 = v6->z; |
1643 | 591 v16 = fixpoint_sub_unknown(v6->y - pGame->pIndoorCameraD3D->vPartyPos.y, v4) - fixpoint_sub_unknown(v6->x - pGame->pIndoorCameraD3D->vPartyPos.x, v5); |
0 | 592 } |
593 v40 = v17; | |
594 v28 = abs(v16); | |
595 if ( abs(X_4) >= v28 ) | |
596 { | |
597 LODWORD(v29) = 0; | |
1637 | 598 HIDWORD(v29) = SLOWORD(pODMRenderParams->int_fov_rad); |
871 | 599 //v30 = v29 / X_4; |
600 v6->_screenspace_scale = v29 / X_4; | |
601 //v31 = v6->_screenspace_scale; | |
0 | 602 v6->uScreenSpaceX = pViewport->uScreenCenterX |
871 | 603 - ((signed int)((unsigned __int64)(v6->_screenspace_scale * (signed __int64)v16) >> 16) >> 16); |
604 v33 = (signed int)((unsigned __int64)(v6->_screenspace_scale * (signed __int64)v40) >> 16) >> 16; | |
1029 | 605 //v34 = pViewport->uScreenCenterY - v33; |
0 | 606 v6->uScreenSpaceY = pViewport->uScreenCenterY - v33; |
1643 | 607 v6->_screenspace_scale = fixpoint_mul(fixpoint_from_float(v6->flt_28), v6->_screenspace_scale); |
0 | 608 v6->sZValue = X_4; |
609 v36 = v6->uScreenSpaceX; | |
693 | 610 if ( v36 >= (signed int)pViewport->uViewportTL_X ) |
0 | 611 { |
693 | 612 if ( v36 < (signed int)pViewport->uViewportBR_X ) |
0 | 613 { |
614 v37 = v6->uScreenSpaceY; | |
693 | 615 if ( v37 >= (signed int)pViewport->uViewportTL_Y ) |
0 | 616 { |
693 | 617 if ( v37 < (signed int)pViewport->uViewportBR_Y ) |
0 | 618 return 1; |
619 } | |
620 } | |
621 } | |
622 } | |
871 | 623 return false; |
0 | 624 } |
625 | |
626 //----- (0048BBA6) -------------------------------------------------------- | |
627 void ParticleEngine::DrawParticles_BLV() | |
628 { | |
629 int v11; // eax@18 | |
630 int v12; // ecx@20 | |
631 int v13; // edx@20 | |
619 | 632 //Particle *v14; // eax@28 |
0 | 633 RenderBillboardTransform_local0 v15; // [sp+Ch] [bp-58h]@1 |
634 | |
2002 | 635 v15.sParentBillboardID = -1; |
0 | 636 |
637 for (uint i = uStartParticle; i < uEndParticle; ++i) | |
638 { | |
1980 | 639 Particle* p = &pParticles[i]; |
0 | 640 |
619 | 641 if (p->type == ParticleType_Invalid) |
0 | 642 continue; |
643 | |
871 | 644 if (!ViewProject_TrueIfStillVisible_BLV(i)) |
0 | 645 continue; |
646 | |
647 if (p->uScreenSpaceX >= pBLVRenderParams->uViewportX && | |
648 p->uScreenSpaceX < pBLVRenderParams->uViewportZ && | |
649 p->uScreenSpaceY >= pBLVRenderParams->uViewportY && | |
650 p->uScreenSpaceY < pBLVRenderParams->uViewportW) | |
651 { | |
652 if (pRenderer->pRenderD3D) | |
653 { | |
619 | 654 if (p->type & ParticleType_Diffuse) |
0 | 655 { |
619 | 656 //v14 = &pParticles[i]; |
657 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale / 4; | |
658 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale / 4; | |
659 v15.uScreenSpaceX = p->uScreenSpaceX; | |
660 v15.uScreenSpaceY = p->uScreenSpaceY; | |
661 v15.sZValue = p->sZValue; | |
871 | 662 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, 0, p->uLightColor_bgr, p->angle); |
0 | 663 return; |
664 } | |
619 | 665 if (p->type & ParticleType_Line) |
0 | 666 { |
667 if (pLines.uNumLines < 100) | |
668 { | |
669 pLines.pLineVertices[2 * pLines.uNumLines].pos.x = p->uScreenSpaceX; | |
670 pLines.pLineVertices[2 * pLines.uNumLines].pos.y = p->uScreenSpaceY; | |
671 pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((short)p->sZValue * 0.061758894); | |
672 pLines.pLineVertices[2 * pLines.uNumLines].rhw = 1.0; | |
871 | 673 pLines.pLineVertices[2 * pLines.uNumLines].diffuse = p->uLightColor_bgr; |
0 | 674 pLines.pLineVertices[2 * pLines.uNumLines].specular = 0; |
675 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.x = 0.0; | |
676 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.y = 0.0; | |
677 | |
678 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.x = p->uScreenSpaceZ; | |
679 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.y = p->uScreenSpaceW; | |
680 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((short)p->sZValue2 * 0.061758894); | |
681 pLines.pLineVertices[2 * pLines.uNumLines + 1].rhw = 1.0; | |
871 | 682 pLines.pLineVertices[2 * pLines.uNumLines + 1].diffuse = p->uLightColor_bgr; |
0 | 683 pLines.pLineVertices[2 * pLines.uNumLines + 1].specular = 0; |
684 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.x = 0.0; | |
685 pLines.pLineVertices[2 * pLines.uNumLines++ + 1].texcoord.y = 0.0; | |
686 } | |
687 } | |
619 | 688 if (p->type & ParticleType_Bitmap) |
0 | 689 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
690 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
691 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; |
0 | 692 v15.uScreenSpaceX = p->uScreenSpaceX; |
693 v15.uScreenSpaceY = p->uScreenSpaceY; | |
694 v15.sZValue = p->sZValue; | |
871 | 695 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pBitmaps_LOD->pHardwareTextures[p->uTextureID], p->uLightColor_bgr, p->angle); |
0 | 696 } |
619 | 697 if (p->type & ParticleType_Sprite) |
0 | 698 { |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
699 v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
700 v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; |
0 | 701 v15.uScreenSpaceX = p->uScreenSpaceX; |
702 v15.uScreenSpaceY = p->uScreenSpaceY; | |
703 v15.sZValue = p->sZValue; | |
871 | 704 pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pSprites_LOD->pHardwareSprites[p->uTextureID].pTexture, p->uLightColor_bgr, p->angle); |
0 | 705 } |
706 } | |
707 else | |
708 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
64
diff
changeset
|
709 v11 = 13 * p->_screenspace_scale >> 16; |
0 | 710 if ( v11 > 30 ) |
711 v11 = 30; | |
712 v12 = p->uScreenSpaceY - v11; | |
713 v13 = p->uScreenSpaceX - (v11 >> 1); | |
693 | 714 if ( v13 + v11 < (signed int)pViewport->uViewportTL_X |
715 || v13 >= (signed int)pViewport->uViewportBR_X | |
716 || v12 + v11 < (signed int)pViewport->uViewportTL_Y | |
717 || v12 >= (signed int)pViewport->uViewportBR_Y ) | |
0 | 718 { |
719 ; | |
720 } | |
721 else | |
722 { | |
871 | 723 pRenderer->MakeParticleBillboardAndPush_BLV_Software(v13, v12, p->sZValue, p->uLightColor_bgr, v11); |
0 | 724 } |
725 } | |
726 } | |
727 } | |
728 } | |
729 | |
730 //----- (0048BEEF) -------------------------------------------------------- | |
731 void ParticleEngine::DrawParticles_ODM() | |
732 { | |
62 | 733 ParticleEngine *pParticleEngine; // esi@1 |
871 | 734 //int pParticleNum; // eax@1 |
0 | 735 unsigned __int8 v3; // zf@1 |
736 char v4; // sf@1 | |
737 unsigned __int8 v5; // of@1 | |
871 | 738 //char *v7; // edi@2 |
739 //int v8; // eax@6 | |
740 //signed int pNumLines; // eax@8 | |
0 | 741 int v10; // eax@14 |
742 int v11; // ecx@16 | |
743 int v12; // edx@16 | |
871 | 744 //Particle *pParticle; // eax@24 |
62 | 745 RenderBillboardTransform_local0 pBillboard; // [sp+Ch] [bp-58h]@1 |
871 | 746 //int v15; // [sp+5Ch] [bp-8h]@9 |
0 | 747 int v16; // [sp+60h] [bp-4h]@1 |
748 | |
2002 | 749 pBillboard.sParentBillboardID = -1; |
62 | 750 pParticleEngine = this; |
751 //v2 = this->uStartParticle; | |
752 //v5 = v2 > this->uEndParticle;// v5 = __OFSUB__(v2, this->uEndParticle); | |
753 //v3 = v2 == this->uEndParticle; | |
754 //v4 = v2 - this->uEndParticle < 0; | |
755 //v16 = this->uStartParticle; | |
871 | 756 for (uint i = uStartParticle; i <= uEndParticle; ++i) |
0 | 757 { |
1980 | 758 Particle* particle = &pParticles[i]; |
871 | 759 if (particle->type == ParticleType_Invalid || !ViewProject_TrueIfStillVisible_ODM(i)) |
760 continue; | |
761 | |
0 | 762 if ( pRenderer->pRenderD3D ) |
763 { | |
871 | 764 //v8 = *(_DWORD *)(v7 - 82); |
765 if (particle->type & ParticleType_Diffuse) | |
0 | 766 { |
871 | 767 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale / 4; |
768 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale / 4; | |
769 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
770 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
771 pBillboard.sZValue = particle->sZValue; | |
772 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, 0, particle->uLightColor_bgr, particle->angle); | |
0 | 773 return; |
774 } | |
871 | 775 if (particle->type & ParticleType_Line) |
0 | 776 { |
871 | 777 if (pLines.uNumLines < 100) |
0 | 778 { |
871 | 779 pLines.pLineVertices[2 * pLines.uNumLines].pos.x = particle->uScreenSpaceX; |
780 pLines.pLineVertices[2 * pLines.uNumLines].pos.y = particle->uScreenSpaceY; | |
1637 | 781 pLines.pLineVertices[2 * pLines.uNumLines].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
871 | 782 pLines.pLineVertices[2 * pLines.uNumLines].rhw = 1.0; |
783 pLines.pLineVertices[2 * pLines.uNumLines].diffuse = particle->uLightColor_bgr; | |
784 pLines.pLineVertices[2 * pLines.uNumLines].specular = 0; | |
785 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.x = 0.0; | |
786 pLines.pLineVertices[2 * pLines.uNumLines].texcoord.y = 0.0; | |
787 | |
788 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.x = particle->uScreenSpaceZ; | |
789 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.y = particle->uScreenSpaceW; | |
1637 | 790 pLines.pLineVertices[2 * pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((double)particle->zbuffer_depth * 1000.0 / (double)pODMRenderParams->shading_dist_mist); |
871 | 791 pLines.pLineVertices[2 * pLines.uNumLines + 1].rhw = 1.0; |
792 pLines.pLineVertices[2 * pLines.uNumLines + 1].diffuse = particle->uLightColor_bgr; | |
793 pLines.pLineVertices[2 * pLines.uNumLines + 1].specular = 0; | |
794 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.x = 0.0; | |
795 pLines.pLineVertices[2 * pLines.uNumLines + 1].texcoord.y = 0.0; | |
796 pLines.uNumLines++; | |
0 | 797 } |
798 } | |
871 | 799 if (particle->type & ParticleType_Bitmap) |
0 | 800 { |
871 | 801 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale; |
802 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale; | |
803 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
804 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
805 pBillboard.sZValue = particle->sZValue; | |
806 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, pBitmaps_LOD->pHardwareTextures[particle->uTextureID], particle->uLightColor_bgr, particle->angle); | |
0 | 807 } |
871 | 808 if (particle->type & ParticleType_Sprite) |
0 | 809 { |
871 | 810 pBillboard._screenspace_x_scaler_packedfloat = particle->_screenspace_scale; |
811 pBillboard._screenspace_y_scaler_packedfloat = particle->_screenspace_scale; | |
812 pBillboard.uScreenSpaceX = particle->uScreenSpaceX; | |
813 pBillboard.uScreenSpaceY = particle->uScreenSpaceY; | |
814 pBillboard.sZValue = particle->sZValue; | |
815 pRenderer->MakeParticleBillboardAndPush_ODM(&pBillboard, pSprites_LOD->pHardwareSprites[particle->uTextureID].pTexture, particle->uLightColor_bgr, particle->angle); | |
0 | 816 } |
817 } | |
818 else | |
819 { | |
871 | 820 v10 = 13 * particle->_screenspace_scale >> 16; |
0 | 821 if ( v10 > 30 ) |
822 v10 = 30; | |
871 | 823 v11 = particle->uScreenSpaceX - (v10 >> 1); |
824 v12 = particle->uScreenSpaceY - v10; | |
693 | 825 if ( v11 + v10 < pViewport->uViewportTL_X |
826 || v11 >= pViewport->uViewportBR_X | |
871 | 827 || particle->uScreenSpaceY < pViewport->uViewportTL_Y |
693 | 828 || v12 >= (signed int)pViewport->uViewportBR_Y ) |
0 | 829 { |
830 ; | |
831 } | |
832 else | |
833 { | |
871 | 834 pRenderer->MakeParticleBillboardAndPush_BLV_Software(v11, v12, particle->sZValue, particle->uLightColor_bgr, v10); |
0 | 835 } |
871 | 836 } |
0 | 837 } |
838 } |