2498
|
1 #define _CRTDBG_MAP_ALLOC
|
|
2 #include <stdlib.h>
|
|
3 #include <crtdbg.h>
|
|
4
|
|
5 #define _CRT_SECURE_NO_WARNINGS
|
|
6 #include "Engine/Graphics/Sprites.h"
|
|
7 #include "Engine/Graphics/BSPModel.h"
|
|
8 #include "SpriteObject.h"
|
2499
|
9 #include "../Party.h"
|
|
10 #include "../TurnEngine/TurnEngine.h"
|
|
11 #include "../OurMath.h"
|
2498
|
12 #include "ObjectList.h"
|
|
13 #include "Engine/Graphics/Outdoor.h"
|
|
14 #include "Engine/Graphics/ParticleEngine.h"
|
2499
|
15 #include "../Timer.h"
|
|
16 #include "../Game.h"
|
|
17 #include "../LOD.h"
|
2498
|
18 #include "Actor.h"
|
2499
|
19 #include "../Events.h"
|
2502
|
20 #include "Media/Audio/AudioPlayer.h"
|
2498
|
21 #include "Engine/Graphics/Level/Decoration.h"
|
|
22
|
2499
|
23 #include "../MM7.h"
|
2498
|
24
|
2499
|
25 #include "../stru298.h"
|
|
26 #include "../Random.h"
|
2498
|
27
|
|
28
|
|
29
|
|
30
|
|
31
|
|
32
|
|
33
|
|
34
|
|
35 size_t uNumSpriteObjects;
|
|
36 std::array<SpriteObject, MAX_SPRITE_OBJECTS> pSpriteObjects;
|
|
37
|
|
38 //----- (00404828) --------------------------------------------------------
|
|
39 SpriteObject::SpriteObject()
|
|
40 {
|
|
41 field_22_glow_radius_multiplier = 1;
|
|
42 uSoundID = 0;
|
|
43 uFacing = 0;
|
|
44 vVelocity.z = 0;
|
|
45 vVelocity.y = 0;
|
|
46 vVelocity.x = 0;
|
|
47 uType = 0;
|
|
48 uObjectDescID = 0;
|
|
49 field_61 = 0;
|
|
50 field_60_distance_related_prolly_lod = 0;
|
|
51 field_20 = 0;
|
|
52 uSpriteFrameID = 0;
|
|
53 spell_skill = 0;
|
|
54 spell_level = 0;
|
|
55 spell_id = 0;
|
|
56 field_54 = 0;
|
|
57 }
|
|
58
|
|
59 //----- (0042F5ED) --------------------------------------------------------
|
|
60 int SpriteObject::Create(int yaw, int pitch, int a4, int a5)
|
|
61 {
|
|
62 signed int v6; // ebx@2
|
|
63 int v13; // ST2C_4@20
|
|
64 Vec3_int_ v17; // [sp-20h] [bp-30h]@11
|
|
65 int angle; // [sp+Ch] [bp-4h]@1
|
|
66 int a5a; // [sp+20h] [bp+10h]@20
|
|
67
|
|
68 angle = yaw;
|
|
69 if (!uObjectDescID)
|
|
70 return -1;
|
|
71
|
|
72 v6 = 1000;
|
|
73 for (uint i = 0; i < MAX_SPRITE_OBJECTS; ++i)
|
|
74 if (!pSpriteObjects[i].uObjectDescID)
|
|
75 {
|
|
76 v6 = i;
|
|
77 break;
|
|
78 }
|
|
79
|
|
80 if ( v6 >= 1000 )
|
|
81 return -1;
|
|
82 field_64.x = vPosition.x;
|
|
83 field_64.y = vPosition.y;
|
|
84 field_64.z = vPosition.z;
|
|
85
|
|
86 assert(sizeof(SpriteObject) == 0x70);
|
|
87
|
|
88 switch (a5)
|
|
89 {
|
|
90 case 0:
|
|
91 break; //do nothing
|
|
92 case 1:
|
|
93 Vec3_int_::Rotate(24, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x,
|
|
94 &vPosition.y, &vPosition.z);
|
|
95 break;
|
|
96 case 2:
|
|
97 Vec3_int_::Rotate(8, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x,
|
|
98 &vPosition.y, &vPosition.z);
|
|
99 break;
|
|
100 case 3:
|
|
101 Vec3_int_::Rotate(8, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x,
|
|
102 &vPosition.y, &vPosition.z);
|
|
103 break;
|
|
104 case 4:
|
|
105 Vec3_int_::Rotate(24, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x,
|
|
106 &vPosition.y, &vPosition.z);
|
|
107 break;
|
|
108 default:
|
|
109 assert(false);
|
|
110 return 0;
|
|
111 break;
|
|
112 }
|
|
113
|
|
114 if ( a4 )
|
|
115 {
|
|
116 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
|
|
117 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
|
|
118 vVelocity.x = fixpoint_mul(v13, a4);
|
|
119 vVelocity.y = fixpoint_mul(a5a, a4);
|
|
120 vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
|
|
121 }
|
|
122 else
|
|
123 {
|
|
124 vVelocity.y = 0;
|
|
125 vVelocity.x = 0;
|
|
126 vVelocity.z = 0;
|
|
127 }
|
|
128
|
|
129 memcpy(&pSpriteObjects[v6], this, sizeof(*this));
|
|
130 if ( v6 >= (signed int)uNumSpriteObjects )
|
|
131 uNumSpriteObjects = v6 + 1;
|
|
132 return v6;
|
|
133 }
|
|
134
|
|
135 //----- (00471C03) --------------------------------------------------------
|
|
136 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID)
|
|
137 {
|
|
138 ObjectDesc *object; // ebx@1
|
|
139 int v6; // eax@1
|
|
140 int v7; // ecx@1
|
|
141 int v8; // edi@1
|
|
142 int v9; // eax@4
|
|
143 // int v17; // ST10_4@25
|
|
144 //signed int v19; // eax@28
|
|
145 //Actor *v20; // edi@31
|
|
146 int v21; // eax@41
|
|
147 // int v22; // ecx@43
|
|
148 // __int16 v23; // bx@45
|
|
149 // char v24; // al@46
|
|
150 signed int i; // edi@50
|
|
151 int v26; // edi@52
|
|
152 int v27; // eax@52
|
|
153 __int16 v28; // cx@55
|
|
154 int v29; // eax@55
|
|
155 //signed int v30; // edi@59
|
|
156 BSPModel *bmodel; // ecx@61
|
|
157 ODMFace *face; // edi@61
|
|
158 // int v33; // eax@62
|
|
159 // int v34; // ecx@62
|
|
160 int v35; // eax@63
|
|
161 int v36; // ecx@67
|
|
162 __int16 v37; // ax@67
|
|
163 int v38; // eax@72
|
|
164 //int v39; // eax@72
|
|
165 // unsigned __int64 v40; // qax@72
|
|
166 // int v41; // eax@72
|
|
167 // unsigned __int8 v42; // sf@74
|
|
168 // unsigned __int8 v43; // of@74
|
|
169 int v44; // eax@77
|
|
170 // __int16 v45; // bx@81
|
|
171 // int v46; // eax@85
|
|
172 // const char *v47; // [sp-8h] [bp-B0h]@83
|
|
173 // enum TEXTURE_TYPE v48; // [sp-4h] [bp-ACh]@46
|
|
174 int v49; // [sp+Ch] [bp-9Ch]@52
|
|
175 int v50; // [sp+10h] [bp-98h]@52
|
|
176 Vec3_int_ v51; // [sp+14h] [bp-94h]@11
|
|
177 Particle_sw Dst; // [sp+20h] [bp-88h]@45
|
|
178 int v54; // [sp+8Ch] [bp-1Ch]@1
|
|
179 int v55; // [sp+90h] [bp-18h]@1
|
|
180 int v56; // [sp+94h] [bp-14h]@11
|
|
181 int v57; // [sp+98h] [bp-10h]@1
|
|
182 int v58; // [sp+9Ch] [bp-Ch]@1
|
|
183 int on_water; // [sp+A0h] [bp-8h]@1
|
|
184 int v60; // [sp+A4h] [bp-4h]@11
|
|
185
|
|
186 v58 = 0;
|
|
187 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
|
|
188 v57 = IsTerrainSlopeTooHigh(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y);
|
|
189 v55 = 0;
|
|
190 v6 = ODM_GetFloorLevel(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uHeight, &on_water, &v55, 0);
|
|
191 v7 = v6;
|
|
192 v54 = v6;
|
|
193 v8 = v6 + 1;
|
|
194 if ( pSpriteObjects[uLayingItemID].vPosition.z <= v6 + 1 )
|
|
195 {
|
|
196 if ( on_water )
|
|
197 {
|
|
198 v9 = v6 + 60;
|
|
199 if ( v55 )
|
|
200 v9 = v6 + 30;
|
|
201 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9);
|
|
202 SpriteObject::OnInteraction(uLayingItemID);
|
|
203 }
|
|
204 }
|
|
205 else
|
|
206 v58 = 1;
|
|
207 if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) )
|
|
208 {
|
|
209 if ( v58 )
|
|
210 {
|
|
211 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
212 goto LABEL_13;
|
|
213 }
|
|
214 if ( v57 )
|
|
215 {
|
|
216 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
|
217 ODM_GetTerrainNormalAt(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, &v51);
|
|
218 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
219 v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y + v51.z * pSpriteObjects[uLayingItemID].vVelocity.z + v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16;
|
|
220 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
|
|
221 pSpriteObjects[uLayingItemID].vVelocity.x += fixpoint_mul(v56, v51.x);
|
|
222 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
|
|
223 pSpriteObjects[uLayingItemID].vVelocity.y += fixpoint_mul(v56, v51.y);
|
|
224 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
|
|
225 pSpriteObjects[uLayingItemID].vVelocity.z += fixpoint_mul(v56, v51.z);
|
|
226 v7 = v54;
|
|
227 goto LABEL_13;
|
|
228 }
|
|
229 if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
|
|
230 {
|
|
231 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
|
|
232 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
|
233 if ( !_46BFFA_check_object_intercept(uLayingItemID, 0) )
|
|
234 return;
|
|
235 }
|
|
236 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
|
237 if ( !(object->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1, pSpriteObjects[uLayingItemID].vVelocity.z = v21, (signed __int16)v21 < 10) )
|
|
238 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
239
|
|
240 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
|
|
241 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
|
|
242 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
|
|
243 if ( (pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y
|
|
244 + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x) < 400 )
|
|
245 {
|
|
246 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
247 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
248 memset(&Dst, 0, 0x68u);
|
|
249 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
|
|
250 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
|
|
251 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
|
|
252 Dst.r = 0.0;
|
|
253 Dst.g = 0.0;
|
|
254 Dst.b = 0.0;
|
|
255 if (object->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
256 {
|
|
257 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
258 Dst.uDiffuse = 0xFF3C1E;
|
|
259 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
260 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
|
261 Dst.flt_28 = 1.0;
|
|
262 pGame->pParticleEngine->AddParticle(&Dst);
|
|
263 }
|
|
264 else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE)
|
|
265 {
|
|
266 Dst.type = ParticleType_Line;
|
|
267 Dst.uDiffuse = rand();
|
|
268 Dst.timeToLive = 64;
|
|
269 Dst.uTextureID = 0;
|
|
270 Dst.flt_28 = 1.0;
|
|
271 pGame->pParticleEngine->AddParticle(&Dst);
|
|
272 }
|
|
273 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE )
|
|
274 {
|
|
275 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
276 Dst.uDiffuse = rand();
|
|
277 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
278 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
|
279 Dst.flt_28 = 1.0;
|
|
280 pGame->pParticleEngine->AddParticle(&Dst);
|
|
281 }
|
|
282 return;
|
|
283 }
|
|
284 }
|
|
285 LABEL_13:
|
|
286 if ( pSpriteObjects[uLayingItemID].vPosition.x >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.x <= 0x8000
|
|
287 && pSpriteObjects[uLayingItemID].vPosition.y >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.y <= 0x8000
|
|
288 && pSpriteObjects[uLayingItemID].vPosition.z > v7 && pSpriteObjects[uLayingItemID].vPosition.z <= 13000
|
|
289 || !(object->uFlags & OBJECT_DESC_INTERACTABLE) )
|
|
290 goto LABEL_92;
|
|
291 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
|
|
292 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
|
293 if ( _46BFFA_check_object_intercept(uLayingItemID, 0) )
|
|
294 {
|
|
295 LABEL_92:
|
|
296 stru_721530.field_0 = 0;
|
|
297 stru_721530.prolly_normal_d = object->uRadius;
|
|
298 stru_721530.height = object->uHeight;
|
|
299 stru_721530.field_8_radius = 0;
|
|
300 stru_721530.field_70 = 0;
|
|
301 for ( v55 = 0; v55 < 100; ++v55 )
|
|
302 {
|
|
303 stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x;
|
|
304 stru_721530.normal.x = stru_721530.position.x;
|
|
305 stru_721530.uSectorID = 0;
|
|
306 stru_721530.position.y = pSpriteObjects[uLayingItemID].vPosition.y;
|
|
307 stru_721530.normal.y = pSpriteObjects[uLayingItemID].vPosition.y;
|
|
308 stru_721530.position.z = pSpriteObjects[uLayingItemID].vPosition.z + stru_721530.prolly_normal_d + 1;
|
|
309 stru_721530.normal.z = stru_721530.position.z;
|
|
310 stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x;
|
|
311 stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y;
|
|
312 stru_721530.velocity.z = pSpriteObjects[uLayingItemID].vVelocity.z;
|
|
313 if ( stru_721530._47050A(0) )
|
|
314 return;
|
|
315 _46E889_collide_against_bmodels(0);
|
|
316 _46E26D_collide_against_sprites(WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x), WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y));
|
|
317 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
|
|
318 _46EF01_collision_chech_player(0);
|
|
319 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor)
|
|
320 {
|
|
321 if (( PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) >= 0 )
|
|
322 &&( PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < (signed int)(uNumActors - 1) ))
|
|
323 {
|
|
324 for (v56 =0; v56 < uNumActors; ++v56)
|
|
325 {
|
|
326 if ( pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[v56]) )
|
|
327 Actor::_46DF1A_collide_against_actor(v56, 0);
|
|
328 }
|
|
329 }
|
|
330 }
|
|
331 else
|
|
332 {
|
|
333 for ( i = 0; i < (signed int)uNumActors; ++i )
|
|
334 Actor::_46DF1A_collide_against_actor(i, 0);
|
|
335 }
|
|
336 v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
|
|
337 v27 = ODM_GetFloorLevel( stru_721530.normal2.x, stru_721530.normal2.y, stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
|
|
338 object->uHeight, &v49, &v50, 0);
|
|
339 if ( on_water && v26 < v27 + 60 )
|
|
340 {
|
|
341 if ( v50 )
|
|
342 v44 = v27 + 30;
|
|
343 else
|
|
344 v44 = v54 + 60;
|
|
345 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v44);
|
|
346 SpriteObject::OnInteraction(uLayingItemID);
|
|
347 return;
|
|
348 }
|
|
349 if ( stru_721530.field_7C >= stru_721530.field_6C )
|
|
350 {
|
|
351 pSpriteObjects[uLayingItemID].vPosition.x = stru_721530.normal2.x;
|
|
352 pSpriteObjects[uLayingItemID].vPosition.y = stru_721530.normal2.y;
|
|
353 pSpriteObjects[uLayingItemID].vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
|
|
354 pSpriteObjects[uLayingItemID].uSectorID = LOWORD(stru_721530.uSectorID);
|
|
355 memset(&Dst, 0, 0x68u);
|
|
356 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
|
|
357 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
|
|
358 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
|
|
359 Dst.r = 0.0;
|
|
360 Dst.g = 0.0;
|
|
361 Dst.b = 0.0;
|
|
362 if ( object->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
363 {
|
|
364 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
365 Dst.uDiffuse = 0xFF3C1E;
|
|
366 Dst.timeToLive = (unsigned __int8)( rand() & 0x80) + 128;
|
|
367 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
|
368 Dst.flt_28 = 1.0;
|
|
369 pGame->pParticleEngine->AddParticle(&Dst);
|
|
370 return;
|
|
371 }
|
|
372 else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE )
|
|
373 {
|
|
374 Dst.type = ParticleType_Line;
|
|
375 Dst.uTextureID = 0;
|
|
376 Dst.uDiffuse = rand();
|
|
377 Dst.timeToLive = 64;
|
|
378 Dst.flt_28 = 1.0;
|
|
379 pGame->pParticleEngine->AddParticle(&Dst);
|
|
380 return;
|
|
381 }
|
|
382 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
383 {
|
|
384 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
385 Dst.uDiffuse = rand();
|
|
386 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
387 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
|
388 Dst.flt_28 = 1.0;
|
|
389 pGame->pParticleEngine->AddParticle(&Dst);
|
|
390 }
|
|
391 return;
|
|
392 }
|
|
393 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
|
|
394 pSpriteObjects[uLayingItemID].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
|
|
395 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
|
|
396 pSpriteObjects[uLayingItemID].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
|
|
397 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
|
|
398 v28 = LOWORD(stru_721530.uSectorID);
|
|
399 pSpriteObjects[uLayingItemID].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
|
|
400 v29 = pSpriteObjects[uLayingItemID].vPosition.z;
|
|
401 pSpriteObjects[uLayingItemID].uSectorID = v28;
|
|
402 stru_721530.field_70 += stru_721530.field_7C;
|
|
403 if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
|
|
404 {
|
|
405 if ( v29 < v54 )
|
|
406 pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1;
|
|
407 if ( !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) )
|
|
408 return;
|
|
409 }
|
|
410 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
|
|
411 break;
|
|
412 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
|
|
413 {
|
|
414 bmodel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
|
|
415 face = &bmodel->pFaces[PID_ID(stru_721530.uFaceID) & 0x3F];
|
|
416 if ( face->uPolygonType == POLYGON_Floor )
|
|
417 {
|
|
418 pSpriteObjects[uLayingItemID].vPosition.z = bmodel->pVertices.pVertices[face->pVertexIDs[0]].z + 1;
|
|
419 if ( pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x
|
|
420 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400 )
|
|
421 {
|
|
422 if ( face->uAttributes & FACE_UNKNOW2 )
|
|
423 EventProcessor(face->sCogTriggeredID, 0, 1);
|
|
424 }
|
|
425 else
|
|
426 {
|
|
427 LOWORD(v35) = 0;
|
|
428 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
429 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
430 pSpriteObjects[uLayingItemID].vVelocity.y = v35;
|
|
431 }
|
|
432 }
|
|
433 else
|
|
434 {
|
|
435 v56 = abs(face->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x
|
|
436 + face->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y
|
|
437 + face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >> 16;
|
|
438 if ( (stru_721530.speed >> 3) > v56 )
|
|
439 v56 = stru_721530.speed >> 3;
|
|
440 //v57 = fixpoint_mul(v56, face->pFacePlane.vNormal.x);
|
|
441 //v58 = fixpoint_mul(v56, face->pFacePlane.vNormal.y);
|
|
442 v60 = fixpoint_mul(v56, face->pFacePlane.vNormal.z);
|
|
443 pSpriteObjects[uLayingItemID].vVelocity.x += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.x);
|
|
444 pSpriteObjects[uLayingItemID].vVelocity.y += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.y);
|
|
445 if ( face->pFacePlane.vNormal.z <= 32000 )
|
|
446 v37 = 2 * (short)v60;
|
|
447 else
|
|
448 {
|
|
449 v36 = v60;
|
|
450 pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60;
|
|
451 v58 = fixpoint_mul(0x7D00, v36);
|
|
452 v37 = fixpoint_mul(32000, v36);
|
|
453 }
|
|
454 pSpriteObjects[uLayingItemID].vVelocity.z += v37;
|
|
455 if ( face->uAttributes & FACE_UNKNOW2 )
|
|
456 EventProcessor(face->sCogTriggeredID, 0, 1);
|
|
457 }
|
|
458 }
|
|
459 LABEL_74:
|
|
460 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
|
|
461 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
|
|
462 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
|
|
463 }
|
|
464 v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x
|
|
465 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y);
|
|
466 v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.x,
|
|
467 pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.y);
|
|
468 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v38), v57);
|
|
469 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi), v57);
|
|
470 goto LABEL_74;
|
|
471 }
|
|
472 }
|
|
473
|
|
474 //----- (0047136C) --------------------------------------------------------
|
|
475 void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID)
|
|
476 {
|
|
477 SpriteObject *pSpriteObject; // esi@1
|
|
478 ObjectDesc *pObject; // edi@1
|
|
479 // int v9; // ecx@16
|
|
480 // __int16 v10; // di@18
|
|
481 // int v14; // ebx@34
|
|
482 signed int v15; // ebx@46
|
|
483 int v17; // eax@50
|
|
484 // int v18; // eax@52
|
|
485 // int v19; // ecx@52
|
|
486 // Vec3_short_ *v20; // ecx@53
|
|
487 __int16 v22; // ax@57
|
|
488 int v23; // edi@62
|
|
489 // unsigned __int8 v27; // sf@64
|
|
490 // unsigned __int8 v28; // of@64
|
|
491 // __int16 v29; // di@67
|
|
492 // char v30; // al@68
|
|
493 Particle_sw Dst; // [sp+Ch] [bp-84h]@18
|
|
494 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4
|
|
495 int v39; // [sp+80h] [bp-10h]@33
|
|
496 int v40; // [sp+84h] [bp-Ch]@28
|
|
497 int v42; // [sp+8Ch] [bp-4h]@4
|
|
498
|
|
499 pSpriteObject = &pSpriteObjects[uLayingItemID];
|
|
500 pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID];
|
|
501 pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z);
|
|
502 v42 = BLV_GetFloorLevel(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID);
|
|
503 if ( abs(pSpriteObject->vPosition.x) > 32767
|
|
504 || abs(pSpriteObject->vPosition.y) > 32767
|
|
505 || abs(pSpriteObject->vPosition.z) > 20000
|
|
506 || v42 <= -30000
|
|
507 && (pSpriteObject->uSectorID == 0))
|
|
508 // || (v42 = _46CEC3_get_floor_level(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, v4, &uFaceID), v42 == -30000)) )
|
|
509 {
|
|
510 SpriteObject::OnInteraction(uLayingItemID);
|
|
511 return;
|
|
512 }
|
|
513 if ( pObject->uFlags & OBJECT_DESC_NO_GRAVITY )//íå ïàäàþùèå îáúåêòû
|
|
514 {
|
|
515 LABEL_25:
|
|
516 stru_721530.field_0 = 0;
|
|
517 stru_721530.prolly_normal_d = pObject->uRadius;
|
|
518 stru_721530.field_84 = -1;
|
|
519 stru_721530.height = pObject->uHeight;
|
|
520 stru_721530.field_8_radius = 0;
|
|
521 stru_721530.field_70 = 0;
|
|
522 for ( uFaceID = 0; uFaceID < 100; uFaceID++ )
|
|
523 {
|
|
524 stru_721530.position.x = pSpriteObject->vPosition.x;
|
|
525 stru_721530.position.y = pSpriteObject->vPosition.y;
|
|
526 stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
|
|
527
|
|
528 stru_721530.normal.x = stru_721530.position.x;
|
|
529 stru_721530.normal.y = stru_721530.position.y;
|
|
530 stru_721530.normal.z = stru_721530.position.z;
|
|
531
|
|
532 stru_721530.velocity.x = pSpriteObject->vVelocity.x;
|
|
533 stru_721530.velocity.y = pSpriteObject->vVelocity.y;
|
|
534 stru_721530.velocity.z = pSpriteObject->vVelocity.z;
|
|
535
|
|
536 stru_721530.uSectorID = pSpriteObject->uSectorID;
|
|
537 if ( stru_721530._47050A(0) )
|
|
538 return;
|
|
539
|
|
540 for ( v40 = 0; v40 < 100; ++v40 )
|
|
541 {
|
|
542 _46E44E_collide_against_faces_and_portals(0);
|
|
543 _46E0B2_collide_against_decorations();
|
|
544 if (PID_TYPE(pSpriteObject->spell_caster_pid) != OBJECT_Player)
|
|
545 _46EF01_collision_chech_player(1);
|
|
546 if (PID_TYPE(pSpriteObject->spell_caster_pid) == OBJECT_Actor)
|
|
547 {
|
|
548 for ( v42 = 0; v42 < (signed int)uNumActors; ++v42 )
|
|
549 {
|
|
550 if( pActors[pSpriteObject->spell_caster_pid >> 3].pMonsterInfo.uID != pActors[v42].pMonsterInfo.uID )
|
|
551 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius
|
|
552 Actor::_46DF1A_collide_against_actor(v42, pMonsterList->pMonsters[pActors[v42].word_000086_some_monster_id-1].uToHitRadius);
|
|
553 }
|
|
554 }
|
|
555 else
|
|
556 {
|
|
557 for ( v42 = 0; v42 < (signed int)uNumActors; v42++ )
|
|
558 Actor::_46DF1A_collide_against_actor(v42, pMonsterList->pMonsters[pActors[v42].word_000086_some_monster_id-1].uToHitRadius);
|
|
559 }
|
|
560 if ( _46F04E_collide_against_portals() )
|
|
561 break;
|
|
562 }
|
|
563 if ( stru_721530.field_7C >= stru_721530.field_6C )
|
|
564 {
|
|
565 pSpriteObject->vPosition.x = stru_721530.normal2.x;
|
|
566 pSpriteObject->vPosition.y = stru_721530.normal2.y;
|
|
567 pSpriteObject->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
|
|
568 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID);
|
|
569 if ( !(HIBYTE(pObject->uFlags) & 1) )
|
|
570 return;
|
|
571 memset(&Dst, 0, 0x68u);
|
|
572 Dst.x = (double)pSpriteObject->vPosition.x;
|
|
573 Dst.y = (double)pSpriteObject->vPosition.y;
|
|
574 Dst.z = (double)pSpriteObject->vPosition.z;
|
|
575 Dst.r = 0.0;
|
|
576 Dst.g = 0.0;
|
|
577 Dst.b = 0.0;
|
|
578 if ( pObject->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
579 {
|
|
580 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
581 Dst.uDiffuse = 0xFF3C1E;
|
|
582 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
583 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
|
584 Dst.flt_28 = 1.0;
|
|
585 pGame->pParticleEngine->AddParticle(&Dst);
|
|
586 return;
|
|
587 }
|
|
588 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_LINE )
|
|
589 {
|
|
590 Dst.type = ParticleType_Line;
|
|
591 Dst.uDiffuse = rand();
|
|
592 Dst.timeToLive = 64;
|
|
593 Dst.uTextureID = 0;
|
|
594 Dst.flt_28 = 1.0;
|
|
595 pGame->pParticleEngine->AddParticle(&Dst);
|
|
596 return;
|
|
597 }
|
|
598 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
599 {
|
|
600 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
601 Dst.uDiffuse = rand();
|
|
602 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
603 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
|
604 Dst.flt_28 = 1.0;
|
|
605 pGame->pParticleEngine->AddParticle(&Dst);
|
|
606 }
|
|
607 return;
|
|
608 }
|
|
609 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
|
|
610 pSpriteObject->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
|
|
611 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
|
|
612 pSpriteObject->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
|
|
613 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
|
|
614 pSpriteObject->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
|
|
615 pSpriteObject->uSectorID = stru_721530.uSectorID;
|
|
616 stru_721530.field_70 += stru_721530.field_7C;
|
|
617 if ( pObject->uFlags & OBJECT_DESC_INTERACTABLE && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) )
|
|
618 return;
|
|
619 v15 = (signed int)stru_721530.uFaceID >> 3;
|
|
620 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
|
|
621 {
|
|
622 v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y);
|
|
623 v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x,
|
|
624 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y);
|
|
625 pSpriteObject->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v23), v40);
|
|
626 pSpriteObject->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v23), v40);
|
|
627 }
|
|
628 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
|
|
629 {
|
|
630 stru_721530.field_84 = (signed int)PID_ID(stru_721530.uFaceID);
|
|
631 if ( pIndoor->pFaces[v15].uPolygonType != POLYGON_Floor )
|
|
632 {
|
|
633 v42 = abs(pIndoor->pFaces[v15].pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x
|
|
634 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y
|
|
635 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z) >> 16;
|
|
636 if ( (stru_721530.speed >> 3) > v42 )
|
|
637 v42 = stru_721530.speed >> 3;
|
|
638 pSpriteObject->vVelocity.x += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.x);
|
|
639 pSpriteObject->vVelocity.y += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.y);
|
|
640 v39 = fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.z);
|
|
641 if ( pIndoor->pFaces[v15].pFacePlane_old.vNormal.z <= 32000 )
|
|
642 v22 = 2 * v39;
|
|
643 else
|
|
644 {
|
|
645 pSpriteObject->vVelocity.z += v39;
|
|
646 v22 = fixpoint_mul(32000, v39);
|
|
647 }
|
|
648 pSpriteObject->vVelocity.z += v22;
|
|
649 if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
|
|
650 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
|
|
651 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
652 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
653 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
654 continue;
|
|
655 }
|
|
656 if ( pObject->uFlags & OBJECT_DESC_BOUNCE )
|
|
657 {
|
|
658 v17 = -pSpriteObject->vVelocity.z / 2;
|
|
659 pSpriteObject->vVelocity.z = v17;
|
|
660 if ( (signed __int16)v17 < 10 )
|
|
661 pSpriteObject->vVelocity.z = 0;
|
|
662 if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
|
|
663 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
|
|
664 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
665 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
666 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
667 continue;
|
|
668 }
|
|
669 pSpriteObject->vVelocity.z = 0;
|
|
670 if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y >= 400 )
|
|
671 {
|
|
672 if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
|
|
673 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
|
|
674 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
675 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
676 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
677 continue;
|
|
678 }
|
|
679 pSpriteObject->vVelocity.z = 0;
|
|
680 pSpriteObject->vVelocity.y = 0;
|
|
681 pSpriteObject->vVelocity.x = 0;
|
|
682 pSpriteObject->vPosition.z = pIndoor->pVertices[*pIndoor->pFaces[v15].pVertexIDs].z + 1;
|
|
683 }
|
|
684 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
685 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
686 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
687 }
|
|
688 }
|
|
689 //äëÿ ïàäàþùèõ îáúåêòîâ(äëÿ ïðèìåðà âûáðîñ âåùè èç èíâåíòàðÿ)
|
|
690 if ( v42 <= pSpriteObject->vPosition.z - 3 )
|
|
691 {
|
|
692 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
693 goto LABEL_25;
|
|
694 }
|
|
695 if ( !(pObject->uFlags & OBJECT_DESC_INTERACTABLE) || _46BFFA_check_object_intercept(uLayingItemID, 0) )
|
|
696 {
|
|
697 pSpriteObject->vPosition.z = v42 + 1;
|
|
698 if ( pIndoor->pFaces[uFaceID].uPolygonType == POLYGON_Floor )
|
|
699 pSpriteObject->vVelocity.z = 0;
|
|
700 else
|
|
701 {
|
|
702 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 45000 )
|
|
703 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
704 }
|
|
705 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
706 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
707 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
708 if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 )
|
|
709 {
|
|
710 pSpriteObject->vVelocity.x = 0;
|
|
711 pSpriteObject->vVelocity.y = 0;
|
|
712 pSpriteObject->vVelocity.z = 0;
|
|
713 if ( !(pObject->uFlags & OBJECT_DESC_NO_SPRITE) )
|
|
714 return;
|
|
715 memset(&Dst, 0, 0x68u);
|
|
716 Dst.x = (double)pSpriteObject->vPosition.x;
|
|
717 Dst.y = (double)pSpriteObject->vPosition.y;
|
|
718 Dst.z = (double)pSpriteObject->vPosition.z;
|
|
719 Dst.r = 0.0;
|
|
720 Dst.g = 0.0;
|
|
721 Dst.b = 0.0;
|
|
722 if ( pObject->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
723 {
|
|
724 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
725 Dst.uDiffuse = 0xFF3C1E;
|
|
726 Dst.flt_28 = 1.0;
|
|
727 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
728 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
|
729 pGame->pParticleEngine->AddParticle(&Dst);
|
|
730 return;
|
|
731 }
|
|
732 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_LINE )
|
|
733 {
|
|
734 Dst.type = ParticleType_Line;
|
|
735 Dst.uDiffuse = rand();
|
|
736 Dst.timeToLive = 64;
|
|
737 Dst.uTextureID = 0;
|
|
738 Dst.flt_28 = 1.0;
|
|
739 pGame->pParticleEngine->AddParticle(&Dst);
|
|
740 return;
|
|
741 }
|
|
742 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
743 {
|
|
744 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
745 Dst.uDiffuse = rand();
|
|
746 Dst.flt_28 = 1.0;
|
|
747 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
748 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
|
749 pGame->pParticleEngine->AddParticle(&Dst);
|
|
750 }
|
|
751 return;
|
|
752 }
|
|
753 goto LABEL_25;
|
|
754 }
|
|
755 }
|
|
756 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
|
|
757
|
|
758 //----- (00438E35) --------------------------------------------------------
|
|
759 void SpriteObject::ExplosionTraps()
|
|
760 {
|
|
761 MapInfo *pMapInfo; // esi@1
|
|
762 int dir_x; // ebx@1
|
|
763 int v7; // edx@2
|
|
764 unsigned int v10; // eax@7
|
|
765 signed int v11; // ebx@8
|
|
766 signed int v13; // edi@20
|
|
767 int dir_y; // [sp+Ch] [bp-Ch]@1
|
|
768 int dir_z; // [sp+10h] [bp-8h]@1
|
|
769 DAMAGE_TYPE pDamageType; // [sp+14h] [bp-4h]@14
|
|
770
|
|
771 pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)];
|
|
772 dir_x = abs(pParty->vPosition.x - this->vPosition.x);
|
|
773 dir_y = abs(pParty->vPosition.y - this->vPosition.y);
|
|
774 dir_z = abs(pParty->vPosition.z + pParty->sEyelevel - this->vPosition.z);
|
|
775 if ( dir_x < dir_y )
|
|
776 {
|
|
777 v7 = dir_x;
|
|
778 dir_x = dir_y;
|
|
779 dir_y = v7;
|
|
780 }
|
|
781 if ( dir_x < dir_z )
|
|
782 {
|
|
783 v7 = dir_x;
|
|
784 dir_x = dir_z;
|
|
785 dir_z = v7;
|
|
786 }
|
|
787 if ( dir_y < dir_z )
|
|
788 {
|
|
789 v7 = dir_z;
|
|
790 dir_z = dir_y;
|
|
791 dir_y = v7;
|
|
792 }
|
|
793 v10 = ((unsigned int)(11 * dir_y) >> 5) + (dir_z / 4) + dir_x;
|
|
794 if ( (signed int)v10 <= 768 )
|
|
795 {
|
|
796 v11 = 5;
|
|
797 if ( pMapInfo->Trap_D20 )
|
|
798 {
|
|
799 for ( uint i = 0; i < pMapInfo->Trap_D20; ++i )
|
|
800 v11 += rand() % 20 + 1;
|
|
801 }
|
|
802 switch ( this->uType )
|
|
803 {
|
|
804 case 811:
|
|
805 pDamageType = DMGT_FIRE;
|
|
806 break;
|
|
807 case 812:
|
|
808 pDamageType = DMGT_ELECTR;
|
|
809 break;
|
|
810 case 813:
|
|
811 pDamageType = DMGT_COLD;
|
|
812 break;
|
|
813 case 814:
|
|
814 pDamageType = DMGT_BODY;
|
|
815 break;
|
|
816 default:
|
|
817 return;
|
|
818 }
|
|
819 for ( uint i = 1; i <= 4; ++i )
|
|
820 {
|
|
821 if ( pPlayers[i]->CanAct() && (v13 = pPlayers[i]->GetPerception() + 20, rand() % v13 > 20) )
|
|
822 pPlayers[i]->PlaySound(SPEECH_6, 0);
|
|
823 else
|
|
824 pPlayers[i]->ReceiveDamage(v11, pDamageType);
|
|
825 }
|
|
826 }
|
|
827 }
|
|
828
|
|
829 //----- (0042F933) --------------------------------------------------------
|
|
830 void SpriteObject::OnInteraction(unsigned int uLayingItemID)
|
|
831 {
|
|
832 pSpriteObjects[uLayingItemID].uObjectDescID = 0;
|
|
833 if ( pParty->bTurnBasedModeOn == 1 )
|
|
834 {
|
|
835 if (pSpriteObjects[uLayingItemID].uAttributes & 4 )
|
|
836 {
|
|
837 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB;//~0x00000004
|
|
838 --pTurnEngine->pending_actions;
|
|
839 }
|
|
840 }
|
|
841 }
|
|
842
|
|
843
|
|
844 //----- (0042FA22) --------------------------------------------------------
|
|
845 void CompactLayingItemsList()
|
|
846 {
|
|
847 int new_obj_pos = 0;
|
|
848
|
|
849 for ( int i = 0; i < MAX_SPRITE_OBJECTS; ++i )
|
|
850 {
|
|
851 if ( pSpriteObjects[i].uObjectDescID )
|
|
852 {
|
|
853 if ( i != new_obj_pos )//
|
|
854 {
|
|
855 memcpy(&pSpriteObjects[new_obj_pos], &pSpriteObjects[i],sizeof(SpriteObject));
|
|
856 pSpriteObjects[i].uObjectDescID = 0;
|
|
857 }
|
|
858 new_obj_pos++;
|
|
859 }
|
|
860 }
|
|
861 uNumSpriteObjects = new_obj_pos;
|
|
862 }
|
|
863 //----- (00408896) --------------------------------------------------------
|
|
864 void SpriteObject::InitializeSpriteObjects()
|
|
865 {
|
|
866 for (uint i = 0; i < uNumSpriteObjects; ++i)
|
|
867 {
|
|
868 SpriteObject* item = &pSpriteObjects[i];
|
|
869
|
|
870 if (item->uType && (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & OBJECT_DESC_UNPICKABLE))
|
|
871 SpriteObject::OnInteraction(i);
|
|
872 }
|
|
873 }
|
|
874 //----- (0046BEF1) --------------------------------------------------------
|
|
875 void SpriteObject::_46BEF1_apply_spells_aoe()
|
|
876 {
|
|
877 //SpriteObject *v1; // edi@1
|
|
878 //Actor *v2; // esi@2
|
|
879 //__int16 v3; // fps@4
|
|
880 //unsigned __int8 v4; // c0@4
|
|
881 //unsigned __int8 v5; // c3@4
|
|
882 //signed int v6; // [sp+8h] [bp-4h]@1
|
|
883
|
|
884 int v7,v9,v10,v11;
|
|
885 __debugbreak();//Ritor1
|
|
886 if ( (signed int)uNumActors > 0 )
|
|
887 {
|
|
888 for ( uint i = 0; i < uNumActors; ++i )
|
|
889 {
|
|
890 if ( pActors[i].CanAct() )
|
|
891 {
|
|
892 //UNDEF(v3);
|
|
893 //.text:0046BF26 movsx eax, word ptr [esi-2]
|
|
894 //.text:0046BF2A sub eax, [edi+4]
|
|
895 //.text:0046BF31 mov [ebp+var_8], eax
|
|
896 //.text:0046BF37 fild [ebp+var_8]
|
|
897 // v7 pushed to stack
|
|
898 v7 = pActors[i].vPosition.x - this->vPosition.x;
|
|
899
|
|
900 //.text:0046BF2D movsx ecx, word ptr [esi+2]
|
|
901 //v8 = pActors[i].vPosition.z;
|
|
902
|
|
903 //.text:0046BF34 movsx eax, word ptr [esi]
|
|
904 //.text:0046BF3A sub eax, [edi+8]
|
|
905 //.text:0046BF3D mov [ebp+var_8], eax
|
|
906 //.text:0046BF44 fild [ebp+var_8]
|
|
907 // v9 pushed to stack
|
|
908 v9 = pActors[i].vPosition.y - this->vPosition.y;
|
|
909
|
|
910 //.text:0046BF40 movsx eax, word ptr [esi-6]
|
|
911 //.text:0046BF47 sar eax, 1
|
|
912 //.text:0046BF49 add eax, ecx
|
|
913 //.text:0046BF4B sub eax, [edi+0Ch]
|
|
914 //.text:0046BF4E mov [ebp+var_8], eax
|
|
915 //.text:0046BF51 fild [ebp+var_8]
|
|
916 //.text:0046BF58 fld st
|
|
917 // v10 pushed to stack, two times
|
|
918 v10 = pActors[i].uActorHeight / 2 + pActors[i].vPosition.z - this->vVelocity.y;
|
|
919
|
|
920 //.text:0046BF54 movsx eax, word ptr [esi-8]
|
|
921 //.text:0046BF5A add eax, 100h
|
|
922 //.text:0046BF63 mov ecx, eax
|
|
923 //v11 = this->vVelocity.x;
|
|
924
|
|
925 //.text:0046BF5F fmul st, st(1)
|
|
926 // stack: v10*v10, v10, v9, v7
|
|
927 //.text:0046BF61 fld st(2)
|
|
928 // stack: v7, v10*v10, v10, v9, v7
|
|
929
|
|
930
|
|
931 //.text:0046BF65 fmul st, st(3)
|
|
932 // stack: v7*v9, v10*v10, v10, v9, v7
|
|
933
|
|
934 //.text:0046BF67 imul ecx, eax
|
|
935 v11 = this->vVelocity.x * this->vVelocity.x;
|
|
936
|
|
937 //.text:0046BF6A faddp st(1), st
|
|
938 // stack: v10*v10+v7*v9, v10, v9, v7
|
|
939 //.text:0046BF6C fld st(3)
|
|
940 // stack: v7, v10*v10+v7*v9, v10, v9, v7
|
|
941 //.text:0046BF6E fmul st, st(4)
|
|
942 // stack: v7*v7, v10*v10+v7*v9, v10, v9, v7
|
|
943 //.text:0046BF70 faddp st(1), st
|
|
944 // stack: v10*v10+v7*v9+v7*v7, v10, v9, v7
|
|
945
|
|
946 //.text:0046BF72 mov [ebp+var_8], ecx
|
|
947 //.text:0046BF75 fild [ebp+var_8]
|
|
948 // v11 pushed to stack
|
|
949
|
|
950 //.text:0046BF78 fcompp
|
|
951 // if ( v11 > v10*v10+v7*v9+v7*v7 )
|
|
952 // stack: v10, v9, v7
|
|
953
|
|
954 //.text:0046BF7A fstp st
|
|
955 // stack: v9, v7
|
|
956
|
|
957 //.text:0046BF7C fnstsw ax
|
|
958 //.text:0046BF7E fstp st
|
|
959 // stack: v7
|
|
960
|
|
961 //.text:0046BF80 test ah, 41h
|
|
962 //.text:0046BF83 fstp st
|
|
963 //.text:0046BF85 jnz short loc_46BFDD
|
|
964
|
|
965 if ( v11 >= v7 * v7 + v9 * v9 + v10 * v10 )
|
|
966 {
|
|
967 if ( pActors[i].DoesDmgTypeDoDamage((DAMAGE_TYPE)0xAu) )
|
|
968 {
|
|
969 pActors[i].pActorBuffs[this->spell_id].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(this->spell_level << 7) * 0.033333335),
|
|
970 this->spell_skill, 4, 0, 0);
|
|
971 HIWORD(pActors[i].uAttributes) |= 8;
|
|
972 }
|
|
973 }
|
|
974 }
|
|
975 }
|
|
976 }
|
|
977 }
|
|
978
|
|
979
|
|
980 //----- (0042F7EB) --------------------------------------------------------
|
|
981 bool SpriteObject::sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
|
|
982 {
|
|
983 unsigned __int16 pObjectDescID; // ax@7
|
|
984 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
|
|
985
|
|
986 pSpellObject.stru_24.Reset();
|
|
987 if ( a9 )
|
|
988 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24));
|
|
989 pSpellObject.spell_skill = 0;
|
|
990 pSpellObject.spell_level = 0;
|
|
991 pSpellObject.spell_id = 0;
|
|
992 pSpellObject.field_54 = 0;
|
|
993 pSpellObject.uType = uSpriteID;
|
|
994 pObjectDescID = 0;
|
|
995 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
|
|
996 {
|
|
997 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
|
|
998 pObjectDescID = i;
|
|
999 }
|
|
1000 pSpellObject.uObjectDescID = pObjectDescID;
|
|
1001 pSpellObject.vPosition.x = x;
|
|
1002 pSpellObject.vPosition.y = y;
|
|
1003 pSpellObject.vPosition.z = z;
|
|
1004 pSpellObject.uSoundID = 0;
|
|
1005 pSpellObject.uAttributes = attributes;
|
|
1006 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
|
|
1007 pSpellObject.uSpriteFrameID = 0;
|
|
1008 pSpellObject.spell_caster_pid = 0;
|
|
1009 pSpellObject.spell_target_pid = 0;
|
|
1010 if ( !(pSpellObject.uAttributes & 0x10) )
|
|
1011 {
|
|
1012 if ( pItemsTable->uAllItemsCount )
|
|
1013 {
|
|
1014 for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i )
|
|
1015 {
|
|
1016 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID )
|
|
1017 pSpellObject.stru_24.uItemID = i;
|
|
1018 }
|
|
1019 }
|
|
1020 }
|
|
1021 if ( a7 )
|
|
1022 {
|
|
1023 if ( count > 0 )
|
|
1024 {
|
|
1025 for ( uint i = count; i; --i )
|
|
1026 {
|
|
1027 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
|
|
1028 pSpellObject.Create((signed __int16)pSpellObject.uFacing,
|
|
1029 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0);
|
|
1030
|
|
1031 }
|
|
1032 }
|
|
1033 }
|
|
1034 else
|
|
1035 {
|
|
1036 pSpellObject.uFacing = 0;
|
|
1037 if ( count > 0 )
|
|
1038 {
|
|
1039 for ( uint i = count; i; --i )
|
|
1040 {
|
|
1041 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0);
|
|
1042 }
|
|
1043 }
|
|
1044 }
|
|
1045 return true;
|
|
1046 }
|
|
1047
|
|
1048 //----- (0042F960) --------------------------------------------------------
|
|
1049 void SpriteObject::sub_42F960_create_object(int x, int y, int z)
|
|
1050 {
|
|
1051 unsigned __int16 v7; // ax@5
|
|
1052 signed int v8; // eax@6
|
|
1053 signed int v9; // eax@7
|
|
1054
|
|
1055 SpriteObject a1; // [sp+Ch] [bp-70h]@1
|
|
1056 //SpriteObject::SpriteObject(&a1);
|
|
1057 a1.stru_24.Reset();
|
|
1058
|
|
1059 a1.spell_skill = 0;
|
|
1060 a1.spell_level = 0;
|
|
1061 a1.spell_id = 0;
|
|
1062 a1.field_54 = 0;
|
|
1063 a1.uType = 800;
|
|
1064 v7 = 0;
|
|
1065 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
|
|
1066 {
|
|
1067 if ( a1.uType == pObjectList->pObjects[i].uObjectID )
|
|
1068 v7 = i;
|
|
1069 }
|
|
1070 a1.uObjectDescID = v7;
|
|
1071 a1.vPosition.x = x;
|
|
1072 a1.vPosition.y = y;
|
|
1073 a1.vPosition.z = z;
|
|
1074 a1.uSoundID = 0;
|
|
1075 a1.uAttributes = 0;
|
|
1076 a1.uSectorID = pIndoor->GetSector(x, y, z);
|
|
1077 a1.uSpriteFrameID = 0;
|
|
1078 a1.spell_caster_pid = 0;
|
|
1079 a1.spell_target_pid = 0;
|
|
1080 v8 = a1.Create(0, 0, 0, 0);
|
|
1081 if ( v8 != -1 )
|
|
1082 {
|
|
1083 v9 = 8 * v8;
|
|
1084 LOBYTE(v9) = v9 | 2;
|
|
1085 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
|
|
1086 }
|
|
1087 }
|
|
1088
|
|
1089 //----- (0046BFFA) --------------------------------------------------------
|
|
1090 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2)
|
|
1091 {
|
|
1092 ObjectDesc *object; // ebx@1
|
|
1093 unsigned int v8; // eax@19
|
|
1094 signed int v10; // ebx@19
|
|
1095 char *v11; // edx@20
|
|
1096 unsigned __int16 v12; // ax@23
|
|
1097 int v13; // eax@27
|
|
1098 int v16; // eax@36
|
|
1099 __int16 v18; // di@37
|
|
1100 signed int v19; // edx@37
|
|
1101 unsigned __int16 v22; // ax@41
|
|
1102 signed int v24; // ebx@46
|
|
1103 char *v25; // edx@47
|
|
1104 signed int v34; // edx@65
|
|
1105 unsigned __int16 v36; // ax@69
|
|
1106 int v37; // ST14_4@72
|
|
1107 int v38; // eax@72
|
|
1108 int v39; // ST10_4@72
|
|
1109 int v40; // ST0C_4@72
|
|
1110 unsigned __int8 v44; // zf@79
|
|
1111 int v47; // eax@81
|
|
1112 signed int v52; // ebx@93
|
|
1113 signed int v56; // ebx@98
|
|
1114 unsigned __int16 v58; // ax@102
|
|
1115 unsigned __int16 v59; // ax@107
|
|
1116 signed int v61; // ebx@107
|
|
1117 unsigned __int16 v63; // ax@111
|
|
1118 int v64; // ebx@114
|
|
1119 signed int v65; // eax@114
|
|
1120 signed int v69; // ebx@124
|
|
1121 unsigned __int16 v71; // ax@128
|
|
1122 unsigned int v72; // ebx@131
|
|
1123 int v78; // eax@133
|
|
1124 signed int v81; // edx@140
|
|
1125 unsigned __int16 v83; // ax@144
|
|
1126 signed int v86; // ebx@151
|
|
1127 unsigned __int16 v88; // ax@155
|
|
1128 unsigned int v89; // eax@158
|
|
1129 int v90; // ST34_4@159
|
|
1130 int v91; // eax@159
|
|
1131 unsigned int v92; // eax@163
|
|
1132 unsigned __int16 v95; // ax@181
|
|
1133 unsigned __int16 v96; // ax@184
|
|
1134 int v97; // eax@185
|
|
1135 char v100; // ST18_1@198
|
|
1136 int v102; // eax@198
|
|
1137 signed int v106; // eax@208
|
|
1138 unsigned int v107; // edx@220
|
|
1139 signed int v108; // ebx@225
|
|
1140 signed int v110; // ebx@234
|
|
1141 unsigned __int16 v112; // ax@238
|
|
1142 unsigned __int16 v113; // si@241
|
|
1143 int v114; // eax@242
|
|
1144 int v115; // eax@245
|
|
1145 signed int v119; // ebx@251
|
|
1146 unsigned __int16 v121; // ax@255
|
|
1147 int v124; // eax@267
|
|
1148 int v125; // [sp-20h] [bp-4Ch]@28
|
|
1149 char v132; // [sp-8h] [bp-34h]@131
|
|
1150 char v134; // [sp-4h] [bp-30h]@131
|
|
1151 signed int v135; // [sp-4h] [bp-30h]@217
|
|
1152 int v136; // [sp+Ch] [bp-20h]@208
|
|
1153 int v137; // [sp+10h] [bp-1Ch]@208
|
|
1154 signed int v138; // [sp+14h] [bp-18h]@207
|
|
1155 signed int v139; // [sp+18h] [bp-14h]@208
|
|
1156 signed int v141; // [sp+1Ch] [bp-10h]@117
|
|
1157 unsigned int v142; // [sp+1Ch] [bp-10h]@158
|
|
1158 signed int v143; // [sp+1Ch] [bp-10h]@172
|
|
1159 signed int v146; // [sp+20h] [bp-Ch]@60
|
|
1160 int v147; // [sp+20h] [bp-Ch]@72
|
|
1161 signed int v148; // [sp+20h] [bp-Ch]@158
|
|
1162 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208
|
|
1163 signed int v152; // [sp+24h] [bp-8h]@208
|
|
1164
|
|
1165 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
|
|
1166 //v151 = PID_TYPE(a2);
|
|
1167 if (PID_TYPE(a2) == OBJECT_Actor)
|
|
1168 {
|
|
1169 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor
|
|
1170 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]))
|
|
1171 return 1;
|
|
1172 }
|
|
1173 else
|
|
1174 {
|
|
1175 if (PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player)
|
|
1176 return 1;
|
|
1177 }
|
|
1178 if (pParty->bTurnBasedModeOn == 1)
|
|
1179 {
|
|
1180 if (pSpriteObjects[uLayingItemID].uAttributes & 4)
|
|
1181 {
|
|
1182 --pTurnEngine->pending_actions;
|
|
1183 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB;//~0x00000004
|
|
1184 }
|
|
1185 }
|
|
1186 if (PID_TYPE(a2) == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
|
|
1187 {
|
|
1188 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000
|
|
1189 pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= ACTOR_UNKNOW5;
|
|
1190 }
|
|
1191
|
|
1192 //v6 = v2->uType;
|
|
1193 //v7 = v2->uType;
|
|
1194
|
|
1195 switch (pSpriteObjects[uLayingItemID].uType)
|
|
1196 {
|
|
1197
|
|
1198 case 1060:
|
|
1199 case 2030:
|
|
1200 case 9010:
|
|
1201 {
|
|
1202 //v9 = 0;
|
|
1203 if (PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2))
|
|
1204 return 1;
|
|
1205 if (PID_TYPE(a2) != 2)
|
|
1206 {
|
|
1207 sub_43A97E(uLayingItemID, a2);
|
|
1208 ++pSpriteObjects[uLayingItemID].uType;
|
|
1209 v95 = 0;
|
|
1210 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1211 {
|
|
1212 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1213 v95 = v52;
|
|
1214 }
|
|
1215 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1216 if (!v95)
|
|
1217 SpriteObject::OnInteraction(uLayingItemID);
|
|
1218 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1219 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1220 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1221 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1222 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1223 v97 = 0;
|
|
1224 else
|
|
1225 v97 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1226 v124 = 8 * uLayingItemID;
|
|
1227 LOBYTE(v124) = v124 | 2;
|
|
1228 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1229 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1230 return 0;
|
|
1231 }
|
|
1232 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
|
|
1233 v121 = 0;
|
|
1234 for (v119 = 0; v119 < (signed int)pObjectList->uNumObjects; ++v119)
|
|
1235 {
|
|
1236 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v119].uObjectID)
|
|
1237 v121 = v119;
|
|
1238 }
|
|
1239 pSpriteObjects[uLayingItemID].uObjectDescID = v121;
|
|
1240 if (!v121)
|
|
1241 SpriteObject::OnInteraction(uLayingItemID);
|
|
1242 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1243 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1244 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1245 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1246 v13 = 8 * uLayingItemID;
|
|
1247 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
|
2506
|
1248 pAudioPlayer->PlaySound(SOUND_Explosion, v13, 0, -1, 0, 0, 0, 0);
|
2498
|
1249 return 0;
|
|
1250 }
|
|
1251
|
|
1252
|
|
1253 case 500:
|
|
1254 case 505:
|
|
1255 case 510:
|
|
1256 case 515:
|
|
1257 case 520:
|
|
1258 case 525:
|
|
1259 case 530:
|
|
1260 case 535:
|
|
1261 case 540:
|
|
1262 {
|
|
1263 sub_43A97E(uLayingItemID, a2);
|
|
1264 ++pSpriteObjects[uLayingItemID].uType;
|
|
1265 v12 = 0;
|
|
1266 for (v10 = 0; v10 < (signed int)pObjectList->uNumObjects; ++v10)
|
|
1267 {
|
|
1268 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v10].uObjectID)
|
|
1269 v12 = v10;
|
|
1270 }
|
|
1271 pSpriteObjects[uLayingItemID].uObjectDescID = v12;
|
|
1272 if (!v12)
|
|
1273 SpriteObject::OnInteraction(uLayingItemID);
|
|
1274 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1275 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1276 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1277 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1278 if (pSpriteObjects[uLayingItemID].uType == 555)
|
|
1279 {
|
|
1280 v13 = 8 * uLayingItemID;
|
|
1281 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
|
2506
|
1282 pAudioPlayer->PlaySound(SOUND_Explosion, v13, 0, -1, 0, 0, 0, 0);
|
2498
|
1283 }
|
|
1284 return 0;
|
|
1285 }
|
|
1286
|
|
1287 case 545:
|
|
1288 case 550:
|
|
1289 {
|
|
1290 if (pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3)
|
|
1291 {
|
|
1292 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1293 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1294 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1295 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1296 sub_43A97E(uLayingItemID, a2);
|
|
1297 SpriteObject::OnInteraction(uLayingItemID);
|
|
1298 if (pSpriteObjects[uLayingItemID].uSoundID == 0)
|
|
1299 v16 = 0;
|
|
1300 else
|
|
1301 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1302 v124 = 8 * uLayingItemID;
|
|
1303 LOBYTE(v124) = v124 | 2;
|
|
1304 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
|
|
1305 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1306 return 0;
|
|
1307 }
|
|
1308 v18 = 0;
|
|
1309 pSpriteObjects[uLayingItemID].uType = 600;
|
|
1310 v22 = 0;
|
|
1311 for (v19 = 0; v19 < (signed int)pObjectList->uNumObjects; ++v19)
|
|
1312 {
|
|
1313 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v19].uObjectID)
|
|
1314 v22 = v19;
|
|
1315 }
|
|
1316 pSpriteObjects[uLayingItemID].uObjectDescID = v22;
|
|
1317 if (!v22)
|
|
1318 SpriteObject::OnInteraction(uLayingItemID);
|
|
1319 pSpriteObjects[uLayingItemID].vVelocity.z = v18;
|
|
1320 pSpriteObjects[uLayingItemID].vVelocity.y = v18;
|
|
1321 pSpriteObjects[uLayingItemID].vVelocity.x = v18;
|
|
1322 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18;
|
|
1323 v12 = 0;
|
|
1324 for (v10; v10 < (signed int)v8; ++v10)
|
|
1325 {
|
|
1326 v11 += 56;
|
|
1327 if (pSpriteObjects[uLayingItemID].uType != *(short *)v11)
|
|
1328 v12 = v10;
|
|
1329 }
|
|
1330 pSpriteObjects[uLayingItemID].uObjectDescID = v12;
|
|
1331 if (!v12)
|
|
1332 SpriteObject::OnInteraction(uLayingItemID);
|
|
1333 v44 = pSpriteObjects[uLayingItemID].uType == 555;
|
|
1334 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1335 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1336 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1337 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1338 if (!v44)
|
|
1339 {
|
|
1340 v13 = 8 * uLayingItemID;
|
|
1341 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
|
2506
|
1342 pAudioPlayer->PlaySound(SOUND_Explosion, v13, 0, -1, 0, 0, 0, 0);
|
2498
|
1343 return 0;
|
|
1344 }
|
|
1345 return 0;
|
|
1346 }
|
|
1347
|
|
1348 case 600:
|
|
1349 {
|
|
1350 pSpriteObjects[uLayingItemID].uType = 601;
|
|
1351 v36 = 0;
|
|
1352 for (v34 = 0; v34 < (signed int)pObjectList->uNumObjects; ++v34)
|
|
1353 {
|
|
1354 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v34].uObjectID)
|
|
1355 v36 = v34;
|
|
1356 }
|
|
1357 pSpriteObjects[uLayingItemID].uObjectDescID = v36;
|
|
1358 if (!v36)
|
|
1359 SpriteObject::OnInteraction(uLayingItemID);
|
|
1360 v37 = pSpriteObjects[uLayingItemID].vPosition.z;
|
|
1361 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1362 v38 = 8 * uLayingItemID;
|
|
1363 v39 = pSpriteObjects[uLayingItemID].vPosition.y;
|
|
1364 LOBYTE(v38) = PID(OBJECT_Item, uLayingItemID);
|
|
1365 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1366 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1367 v40 = pSpriteObjects[uLayingItemID].vPosition.x;
|
|
1368 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1369 v147 = v38;
|
|
1370 AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0);
|
|
1371 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
1372 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
|
2506
|
1373 pAudioPlayer->PlaySound(SOUND_Explosion, v147, 0, -1, 0, 0, 0, 0);
|
2498
|
1374 return 0;
|
|
1375 }
|
|
1376
|
|
1377 case 1010:
|
|
1378 case 1100:
|
|
1379 case 2060:
|
|
1380 case 3010:
|
|
1381 case 3030:
|
|
1382 case 3060:
|
|
1383 case 4000:
|
|
1384 case 4030:
|
|
1385 case 4050:
|
|
1386 case 4100:
|
|
1387 case 6010:
|
|
1388 case 6090:
|
|
1389 {
|
|
1390 sub_43A97E(uLayingItemID, a2);
|
|
1391 ++pSpriteObjects[uLayingItemID].uType;
|
|
1392 v95 = 0;
|
|
1393 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1394 {
|
|
1395 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1396 v95 = v52;
|
|
1397 }
|
|
1398 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1399 if (!v95)
|
|
1400 SpriteObject::OnInteraction(uLayingItemID);
|
|
1401 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1402 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1403 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1404 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1405 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1406 if (!v96)
|
|
1407 v97 = 0;
|
|
1408 else
|
|
1409 v97 = (signed __int16)v96 + 4;
|
|
1410 v124 = 8 * uLayingItemID;
|
|
1411 LOBYTE(v124) = v124 | 2;
|
|
1412 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1413 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1414 return 0;
|
|
1415 }
|
|
1416
|
|
1417
|
|
1418 case 555:
|
|
1419 {
|
|
1420 sub_43A97E(uLayingItemID, a2);
|
|
1421 ++pSpriteObjects[uLayingItemID].uType;
|
|
1422 v18 = 0;
|
|
1423 v22 = 0;
|
|
1424 v25 = (char *)&pObjectList->pObjects->uObjectID;
|
|
1425 for (v24 = 0; v24 < (signed int)pObjectList->uNumObjects; ++v24)
|
|
1426 {
|
|
1427 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v24].uObjectID)
|
|
1428 v22 = v24;
|
|
1429 }
|
|
1430 pSpriteObjects[uLayingItemID].uObjectDescID = v22;
|
|
1431 if (v22 == v18)
|
|
1432 SpriteObject::OnInteraction(uLayingItemID);
|
|
1433 pSpriteObjects[uLayingItemID].vVelocity.z = v18;
|
|
1434 pSpriteObjects[uLayingItemID].vVelocity.y = v18;
|
|
1435 pSpriteObjects[uLayingItemID].vVelocity.x = v18;
|
|
1436 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18;
|
|
1437 return 0;
|
|
1438 }
|
|
1439
|
|
1440 case 3090:
|
|
1441 {
|
|
1442 //v9 = 0;
|
|
1443 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2;
|
|
1444 v63 = 0;
|
|
1445 for (v61 = 0; v61 < (signed int)pObjectList->uNumObjects; ++v61)
|
|
1446 {
|
|
1447 if (v59 == pObjectList->pObjects[v61].uObjectID)
|
|
1448 v63 = v61;
|
|
1449 }
|
|
1450 pSpriteObjects[uLayingItemID].uObjectDescID = v63;
|
|
1451 if (!v63)
|
|
1452 SpriteObject::OnInteraction(uLayingItemID);
|
|
1453 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
|
|
1454 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4;
|
|
1455 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1456 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1457 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1458 v65 = 7;
|
|
1459 if (v44)
|
|
1460 v65 = 9;
|
|
1461 if (v65 > 0)
|
|
1462 {
|
|
1463 v141 = v65;
|
|
1464 do
|
|
1465 {
|
|
1466 v64 += (signed int)stru_5C6E00->uIntegerHalfPi / 2;
|
|
1467 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0);
|
|
1468 --v141;
|
|
1469 } while (v141);
|
|
1470 }
|
|
1471 SpriteObject::OnInteraction(uLayingItemID);
|
|
1472 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1473 v16 = 0;
|
|
1474 else
|
|
1475 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1476 v124 = 8 * uLayingItemID;
|
|
1477 LOBYTE(v124) = v124 | 2;
|
|
1478 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1479 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1480 return 0;
|
|
1481 }
|
|
1482
|
|
1483 case 3092:
|
|
1484 {
|
|
1485 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType - 1;
|
|
1486 v58 = 0;
|
|
1487 for (v56 = 0; v56 < (signed int)pObjectList->uNumObjects; ++v56)
|
|
1488 {
|
|
1489 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v56].uObjectID)
|
|
1490 v58 = v56;
|
|
1491 }
|
|
1492 pSpriteObjects[uLayingItemID].uObjectDescID = v58;
|
|
1493 if (!v58)
|
|
1494 SpriteObject::OnInteraction(uLayingItemID);
|
|
1495 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1496 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1497 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1498 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1499 sub_43A97E(uLayingItemID, a2);
|
|
1500 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1501 v16 = 0;
|
|
1502 else
|
|
1503 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1504 v124 = 8 * uLayingItemID;
|
|
1505 LOBYTE(v124) = v124 | 2;
|
|
1506 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1507 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1508 return 0;
|
|
1509 }
|
|
1510
|
|
1511 case 4070:
|
|
1512 {
|
|
1513 if (PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2))
|
|
1514 return 1;
|
|
1515 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
|
|
1516 v71 = 0;
|
|
1517 for (v69 = 0; v69 < (signed int)pObjectList->uNumObjects; ++v69)
|
|
1518 {
|
|
1519 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v69].uObjectID)
|
|
1520 v71 = v69;
|
|
1521 }
|
|
1522 pSpriteObjects[uLayingItemID].uObjectDescID = v71;
|
|
1523 if (!v71)
|
|
1524 SpriteObject::OnInteraction(uLayingItemID);
|
|
1525 v134 = 0;
|
|
1526 v72 = uLayingItemID;
|
|
1527 v132 = 0;
|
|
1528 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1529 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1530 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1531 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1532 AttackerInfo.Add(PID(OBJECT_Item, v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
|
|
1533 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1534 v78 = 0;
|
|
1535 else
|
|
1536 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1537 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1538 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0);
|
|
1539 return 0;
|
|
1540 }
|
|
1541
|
|
1542 case 4090:
|
|
1543 {
|
|
1544 //v9 = 0;
|
|
1545 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2;
|
|
1546 v88 = 0;
|
|
1547 for (v86 = 0; v86 < (signed int)pObjectList->uNumObjects; ++v86)
|
|
1548 {
|
|
1549 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v86].uObjectID)
|
|
1550 v88 = v86;
|
|
1551 }
|
|
1552 pSpriteObjects[uLayingItemID].uObjectDescID = v88;
|
|
1553 if (!v88)
|
|
1554 SpriteObject::OnInteraction(uLayingItemID);
|
|
1555 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
|
|
1556 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1557 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1558 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1559 v142 = v89;
|
|
1560 v148 = 7;
|
|
1561 do
|
|
1562 {
|
|
1563 pRnd->SetRange(-128, 128);
|
|
1564 v90 = pRnd->GetInRange();
|
|
1565 pRnd->SetRange(5, 500);
|
|
1566 v91 = pRnd->GetInRange();
|
|
1567 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1;
|
|
1568 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0);
|
|
1569 --v148;
|
|
1570 } while (v148);
|
|
1571 SpriteObject::OnInteraction(uLayingItemID);
|
|
1572 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1573 v16 = 0;
|
|
1574 else
|
|
1575 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1576 v124 = 8 * uLayingItemID;
|
|
1577 LOBYTE(v124) = v124 | 2;
|
|
1578 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1579 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1580 return 0;
|
|
1581 }
|
|
1582
|
|
1583 case 4092:
|
|
1584 {
|
|
1585 pSpriteObjects[uLayingItemID].uType = 4091;
|
|
1586 v83 = 0;
|
|
1587 for (v81 = 0; v81 < (signed int)pObjectList->uNumObjects; ++v81)
|
|
1588 {
|
|
1589 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v81].uObjectID)
|
|
1590 v83 = v81;
|
|
1591 }
|
|
1592 pSpriteObjects[uLayingItemID].uObjectDescID = v83;
|
|
1593 if (!v83)
|
|
1594 SpriteObject::OnInteraction(uLayingItemID);
|
|
1595 v134 = 0;
|
|
1596 //v72 = uLayingItemID;
|
|
1597 v132 = pSpriteObjects[uLayingItemID].field_61;
|
|
1598 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1599 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1600 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1601 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1602 AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
|
|
1603 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1604 v78 = 0;
|
|
1605 else
|
|
1606 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1607 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1608 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0);
|
|
1609 return 0;
|
|
1610 }
|
|
1611
|
|
1612 case 8010:
|
|
1613 {
|
|
1614 if (PID_TYPE(a2) == 3
|
|
1615 && MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
|
|
1616 sub_43A97E(uLayingItemID, a2);
|
|
1617 ++pSpriteObjects[uLayingItemID].uType;
|
|
1618 //v9 = 0;
|
|
1619 v95 = 0;
|
|
1620 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1621 {
|
|
1622 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1623 v95 = v52;
|
|
1624 }
|
|
1625 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1626 if (!v95)
|
|
1627 SpriteObject::OnInteraction(uLayingItemID);
|
|
1628 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1629 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1630 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1631 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1632 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1633 if (!v96)
|
|
1634 v97 = 0;
|
|
1635 else
|
|
1636 v97 = (signed __int16)v96 + 4;
|
|
1637 v92 = uLayingItemID;
|
|
1638 v124 = 8 * v92;
|
|
1639 LOBYTE(v124) = v124 | 2;
|
|
1640 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1641 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1642 return 0;
|
|
1643 }
|
|
1644
|
|
1645 case 7030:
|
|
1646 case 7090:
|
|
1647 case 8000:
|
|
1648 case 8090:
|
|
1649 {
|
|
1650 sub_43A97E(uLayingItemID, a2);
|
|
1651 ++pSpriteObjects[uLayingItemID].uType;
|
|
1652 v95 = 0;
|
|
1653 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1654 {
|
|
1655 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1656 v95 = v52;
|
|
1657 }
|
|
1658 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1659 if (!v95)
|
|
1660 SpriteObject::OnInteraction(uLayingItemID);
|
|
1661 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1662 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1663 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1664 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1665 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1666 if (!v96)
|
|
1667 v97 = 0;
|
|
1668 else
|
|
1669 v97 = (signed __int16)v96 + 4;
|
|
1670 v124 = 8 * uLayingItemID;
|
|
1671 LOBYTE(v124) = v124 | 2;
|
|
1672 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1673 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1674 return 0;
|
|
1675 }
|
|
1676
|
|
1677 case 6040:
|
|
1678 case 8030:
|
|
1679 case 9030:
|
|
1680 {
|
|
1681 v143 = 17030;
|
|
1682 switch (pSpriteObjects[uLayingItemID].uType)
|
|
1683 {
|
|
1684 case 0x1798u:
|
|
1685 v143 = 15040;
|
|
1686 break;
|
|
1687 case 0xFAAu:
|
|
1688 v143 = 13010;
|
|
1689 break;
|
|
1690 case 0x2346u:
|
|
1691 v143 = 18030;
|
|
1692 break;
|
|
1693 }
|
|
1694 v138 = 1;
|
|
1695 if (PID_TYPE(a2) != OBJECT_Actor)
|
|
1696 {
|
|
1697 if (pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4)
|
|
1698 {
|
|
1699 SpriteObject::OnInteraction(uLayingItemID);
|
|
1700 return 0;
|
|
1701 }
|
|
1702 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
|
|
1703 if (!v138)
|
|
1704 {
|
|
1705 ++pSpriteObjects[uLayingItemID].uType;
|
|
1706 v112 = 0;
|
|
1707 for (v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110)
|
|
1708 {
|
|
1709 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID)
|
|
1710 v112 = v110;
|
|
1711 }
|
|
1712 pSpriteObjects[uLayingItemID].uObjectDescID = v112;
|
|
1713 if (!v112)
|
|
1714 SpriteObject::OnInteraction(uLayingItemID);
|
|
1715 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1716 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1717 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1718 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1719 v113 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1720 if (v113)
|
|
1721 v114 = (signed __int16)v113 + 4;
|
|
1722 else
|
|
1723 v114 = 0;
|
|
1724 v115 = 8 * uLayingItemID;
|
|
1725 LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID);
|
|
1726 v125 = v143 + 1;
|
|
1727 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0);
|
|
1728 }
|
|
1729 else
|
|
1730 SpriteObject::OnInteraction(uLayingItemID);
|
|
1731 return 0;
|
|
1732 }
|
|
1733 v106 = a2;
|
|
1734 v150 = 0;
|
|
1735 v139 = PID_ID(v106);
|
|
1736 v137 = pSpriteObjects[uLayingItemID].spell_level;
|
|
1737 v152 = pSpriteObjects[uLayingItemID].spell_skill;
|
|
1738 v136 = pSpriteObjects[uLayingItemID].spell_id;
|
|
1739 if (pSpriteObjects[uLayingItemID].uType == 9030)
|
|
1740 {
|
|
1741 v150 = 2;
|
|
1742 if (v152 == 2)
|
|
1743 v150 = 3;
|
|
1744 else
|
|
1745 {
|
|
1746 if (v152 >= 3)
|
|
1747 v150 = 4;
|
|
1748 }
|
|
1749 pActors[v139].uAttributes |= ACTOR_AGGRESSOR;
|
|
1750 v107 = v135;
|
|
1751 }
|
|
1752 if (pSpriteObjects[uLayingItemID].uType == 6040)
|
|
1753 {
|
|
1754 v135 = 7;
|
|
1755 v107 = v135;
|
|
1756 }
|
|
1757 else
|
|
1758 {
|
|
1759 if (pSpriteObjects[uLayingItemID].uType == 8030)
|
|
1760 {
|
|
1761 v135 = 9;
|
|
1762 v107 = v135;
|
|
1763 }
|
|
1764 else
|
|
1765 {
|
|
1766 if (pSpriteObjects[uLayingItemID].uType != 9030)
|
|
1767 {
|
|
1768 v107 = v136;
|
|
1769 }
|
|
1770 if (pSpriteObjects[uLayingItemID].uType == 9030)
|
|
1771 {
|
|
1772 v135 = 10;
|
|
1773 v107 = v135;
|
|
1774 }
|
|
1775 }
|
|
1776 }
|
|
1777 if (pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4)
|
|
1778 {
|
|
1779 v108 = v139;
|
|
1780 if (pActors[v139].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107))
|
|
1781 {
|
|
1782 v138 = 0;
|
|
1783 if (pSpriteObjects[uLayingItemID].uType == 8030)
|
|
1784 {
|
|
1785 pActors[v108].uAIState = Standing;
|
|
1786 pActors[v108].UpdateAnimation();
|
|
1787 }
|
|
1788 pActors[v108].pActorBuffs[v136].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335),
|
|
1789 v152, v150, 0, 0);
|
|
1790 }
|
|
1791 }
|
|
1792 else
|
|
1793 {
|
|
1794 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
|
|
1795 }
|
|
1796 pSpriteObjects[uLayingItemID].spell_level = 0;
|
|
1797 pSpriteObjects[uLayingItemID].spell_skill = 0;
|
|
1798 pSpriteObjects[uLayingItemID].spell_id = 0;
|
|
1799 if (!v138)
|
|
1800 {
|
|
1801 ++pSpriteObjects[uLayingItemID].uType;
|
|
1802 v112 = 0;
|
|
1803 for (v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110)
|
|
1804 {
|
|
1805 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID)
|
|
1806 v112 = v110;
|
|
1807 }
|
|
1808 pSpriteObjects[uLayingItemID].uObjectDescID = v112;
|
|
1809 if (!v112)
|
|
1810 SpriteObject::OnInteraction(uLayingItemID);
|
|
1811 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1812 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1813 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1814 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1815 v113 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1816 if (v113)
|
|
1817 v114 = (signed __int16)v113 + 4;
|
|
1818 else
|
|
1819 v114 = 0;
|
|
1820 v115 = 8 * uLayingItemID;
|
|
1821 LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID);
|
|
1822 v125 = v143 + 1;
|
|
1823 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0);
|
|
1824 }
|
|
1825 else
|
|
1826 SpriteObject::OnInteraction(uLayingItemID);
|
|
1827 return 0;
|
|
1828 }
|
|
1829
|
|
1830 case 9040:
|
|
1831 {
|
|
1832 sub_43A97E(uLayingItemID, a2);
|
|
1833 ++pSpriteObjects[uLayingItemID].uType;
|
|
1834 v95 = 0;
|
|
1835 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1836 {
|
|
1837 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1838 v95 = v52;
|
|
1839 }
|
|
1840 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1841 if (!v95)
|
|
1842 SpriteObject::OnInteraction(uLayingItemID);
|
|
1843 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1844 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1845 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1846 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1847 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1848 if (!v96)
|
|
1849 v97 = 0;
|
|
1850 else
|
|
1851 v97 = (signed __int16)v96 + 4;
|
|
1852 v124 = 8 * uLayingItemID;
|
|
1853 LOBYTE(v124) = v124 | 2;
|
|
1854 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1855 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1856 return 0;
|
|
1857 }
|
|
1858
|
|
1859 /*
|
|
1860 case 1080:
|
|
1861 case 2100:
|
|
1862 {
|
|
1863 if (PID_TYPE(a2) != 3)
|
|
1864 {
|
|
1865 //v32 = 0;
|
|
1866 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
|
|
1867 v46 = 0;
|
|
1868 for (v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146)
|
|
1869 {
|
|
1870 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID)
|
|
1871 v46 = v146;
|
|
1872 }
|
|
1873 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
|
|
1874 if (!v46)
|
|
1875 SpriteObject::OnInteraction(uLayingItemID);
|
|
1876 v100 = pSpriteObjects[uLayingItemID].field_61;
|
|
1877 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1878 v102 = 8 * uLayingItemID;
|
|
1879 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
|
|
1880 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1881 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1882 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1883 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
|
|
1884 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
1885 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
|
|
1886 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1887 v47 = 0;
|
|
1888 else
|
|
1889 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1890 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1891 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
|
|
1892 return 0;
|
|
1893 }
|
|
1894 return 1;
|
|
1895 }*/
|
|
1896
|
|
1897 case 1080:
|
|
1898 case 2100:
|
|
1899 {
|
|
1900 if (PID_TYPE(a2) == 3)
|
|
1901 return 1;
|
|
1902 //else go to next case
|
|
1903 }
|
|
1904
|
|
1905 case 1050:
|
|
1906 case 9080:
|
|
1907 {
|
|
1908 v95 = 0;
|
|
1909 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
|
|
1910 for (v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146)
|
|
1911 {
|
|
1912 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID)
|
|
1913 v95 = v146;
|
|
1914 }
|
|
1915 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1916 if (!v95)
|
|
1917 SpriteObject::OnInteraction(uLayingItemID);
|
|
1918 v100 = pSpriteObjects[uLayingItemID].field_61;
|
|
1919 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1920 v102 = 8 * uLayingItemID;
|
|
1921 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
|
|
1922 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1923 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1924 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1925 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
|
|
1926 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
1927 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
|
|
1928 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1929 v47 = 0;
|
|
1930 else
|
|
1931 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1932 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1933 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
|
|
1934 return 0;
|
|
1935 }
|
|
1936
|
|
1937 default:
|
|
1938 return 0;
|
|
1939 }
|
|
1940
|
|
1941 }
|
|
1942
|
|
1943 //----- (0043A97E) --------------------------------------------------------
|
|
1944 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
|
|
1945 {
|
|
1946 if (PID_TYPE(a2) == OBJECT_Player)
|
|
1947 {
|
|
1948 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
|
|
1949 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
|
|
1950 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
|
|
1951
|
|
1952 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
|
|
1953 DamagePlayerFromMonster(PID(OBJECT_Item, uLayingItemID), pSpriteObjects[uLayingItemID].field_61, &layingitem_vel_50FDFC, -1);
|
|
1954 }
|
|
1955 else if (PID_TYPE(a2) == OBJECT_Actor)
|
|
1956 {
|
|
1957 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
|
|
1958 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
|
|
1959 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
|
|
1960
|
|
1961 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
|
|
1962 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid))
|
|
1963 {
|
|
1964 case OBJECT_Actor:
|
|
1965 Actor::ActorDamageFromMonster(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61);
|
|
1966 break;
|
|
1967 case OBJECT_Player:
|
|
1968 Actor::DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
|
|
1969 break;
|
|
1970 case OBJECT_Item:
|
|
1971 ItemDamageFromActor(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
|
|
1972 break;
|
|
1973 }
|
|
1974 }
|
|
1975 }
|