annotate ParticleEngine.cpp @ 753:e13ce1b0930d

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