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