annotate SpriteObject.cpp @ 2107:85e9766d6124

sub_427769_spell to sub_427769_isSpellQuickCastableOnShiftClick
author Grumpy7
date Fri, 20 Dec 2013 01:25:52 +0100
parents 52abdea20b9e
children 7f403ebf619f
rev   line source
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 838
diff changeset
1 #include "BSPModel.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
2 #include "SpriteObject.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
3 #include "Party.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
4 #include "TurnEngine.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
5 #include "MapInfo.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 1980
diff changeset
6 #include "OurMath.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
7 #include "ObjectList.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
8 #include "Indoor.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
9 #include "Outdoor.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
10 #include "ParticleEngine.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2037
diff changeset
11 #include "Timer.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
12 #include "Game.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
13 #include "LOD.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
14 #include "Actor.h"
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
15 #include "Events.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
16 #include "Level/Decoration.h"
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
17
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
18 #include "mm7_data.h"
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
19 #include "MM7.h"
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
20
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
21
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
22
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
23
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
24
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
25
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
26
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
27
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
28 size_t uNumSpriteObjects;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1205
diff changeset
29 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
30
781
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
31 //----- (00404828) --------------------------------------------------------
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
32 SpriteObject::SpriteObject()
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
33 {
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
34 field_22_glow_radius_multiplier = 1;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
35 uSoundID = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
36 uFacing = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
37 vVelocity.z = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
38 vVelocity.y = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
39 vVelocity.x = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
40 uType = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
41 uObjectDescID = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
42 field_61 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
43 field_60_distance_related_prolly_lod = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
44 field_20 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
45 uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 810
diff changeset
46 spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 810
diff changeset
47 spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 810
diff changeset
48 spell_id = 0;
781
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
49 field_54 = 0;
d170f23f70d1 tidy, code moving
zipi
parents: 723
diff changeset
50 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
51
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
52 //----- (0042F5ED) --------------------------------------------------------
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
53 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
54 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
55 signed int v6; // ebx@2
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
56 int v13; // ST2C_4@20
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
57 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
58 int angle; // [sp+Ch] [bp-4h]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
59 int a5a; // [sp+20h] [bp+10h]@20
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
60
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
61 angle = yaw;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
62 if (!uObjectDescID)
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
63 return -1;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
64
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
65 v6 = 1000;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 781
diff changeset
66 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
67 if (!pSpriteObjects[i].uObjectDescID)
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
68 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
69 v6 = i;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
70 break;
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
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
73 if ( v6 >= 1000 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
74 return -1;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
75 field_64.x = vPosition.x;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
76 field_64.y = vPosition.y;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
77 field_64.z = vPosition.z;
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 assert(sizeof(SpriteObject) == 0x70);
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
80 memcpy(&pSpriteObjects[v6], this, sizeof(*this));
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
81 if ( a5 == 0 )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
82 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
83 pSpriteObjects[v6].vVelocity.z = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
84 if ( a4 )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
85 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
86 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
87 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
88 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
89 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
90 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
91 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
92 else
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
93 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
94 pSpriteObjects[v6].vVelocity.y = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
95 pSpriteObjects[v6].vVelocity.x = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
96 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
97 if ( v6 >= (signed int)uNumSpriteObjects )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
98 uNumSpriteObjects = v6 + 1;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
99 return v6;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
100 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
101 if ( a5 == 1 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
102 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
103 v17.x = vPosition.x;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
104 v17.y = vPosition.y;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
105 v17.z = vPosition.z;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
106 Vec3_int_::Rotate(24, stru_5C6E00->uIntegerHalfPi + pSpriteObjects[v6].uFacing, 0, v17, &pSpriteObjects[v6].vPosition.x,
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
107 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
108 pSpriteObjects[v6].vVelocity.z = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
109 if ( a4 )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
110 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
111 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
112 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
113 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
114 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
115 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
116 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
117 else
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
118 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
119 pSpriteObjects[v6].vVelocity.y = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
120 pSpriteObjects[v6].vVelocity.x = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
121 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
122 if ( v6 >= (signed int)uNumSpriteObjects )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
123 uNumSpriteObjects = v6 + 1;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
124 return v6;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
125 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
126 if ( a5 == 2 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
127 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
128 v17.x = vPosition.x;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
129 v17.y = vPosition.y;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
130 v17.z = vPosition.z;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
131 Vec3_int_::Rotate(8, stru_5C6E00->uIntegerHalfPi + pSpriteObjects[v6].uFacing, 0, v17, &pSpriteObjects[v6].vPosition.x,
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
132 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
133 pSpriteObjects[v6].vVelocity.z = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
134 if ( a4 )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
135 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
136 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16;
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
137 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16;
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
138 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
139 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
140 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
141 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
142 else
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
143 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
144 pSpriteObjects[v6].vVelocity.y = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
145 pSpriteObjects[v6].vVelocity.x = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
146 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
147 if ( v6 >= (signed int)uNumSpriteObjects )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
148 uNumSpriteObjects = v6 + 1;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
149 return v6;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
150 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
151 if ( a5 == 3 )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
152 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
153 v17.x = vPosition.x;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
154 v17.y = vPosition.y;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
155 v17.z = vPosition.z;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
156 Vec3_int_::Rotate(8, pSpriteObjects[v6].uFacing - stru_5C6E00->uIntegerHalfPi, 0, v17, &pSpriteObjects[v6].vPosition.x,
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
157 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
158 pSpriteObjects[v6].vVelocity.z = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
159 if ( a4 )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
160 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
161 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
162 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
163 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
164 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
165 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
166 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
167 else
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
168 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
169 pSpriteObjects[v6].vVelocity.y = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
170 pSpriteObjects[v6].vVelocity.x = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
171 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
172 if ( v6 >= (signed int)uNumSpriteObjects )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
173 uNumSpriteObjects = v6 + 1;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
174 return v6;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
175 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
176 if ( a5 == 4 )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
177 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
178 v17.x = vPosition.x;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
179 v17.y = vPosition.y;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
180 v17.z = vPosition.z;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
181 Vec3_int_::Rotate(24, pSpriteObjects[v6].uFacing - stru_5C6E00->uIntegerHalfPi, 0, v17, &pSpriteObjects[v6].vPosition.x,
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
182 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
183 pSpriteObjects[v6].vVelocity.z = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
184 if ( a4 )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
185 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
186 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
187 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
188 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
189 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
190 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
191 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
192 else
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
193 {
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
194 pSpriteObjects[v6].vVelocity.y = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
195 pSpriteObjects[v6].vVelocity.x = 0;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
196 }
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
197 if ( v6 >= (signed int)uNumSpriteObjects )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
198 uNumSpriteObjects = v6 + 1;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
199 return v6;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
200 }
1409
c9e3b93ec570 Highlighted locations with "using uninitialized variable" warning.
Nomad
parents: 1406
diff changeset
201
c9e3b93ec570 Highlighted locations with "using uninitialized variable" warning.
Nomad
parents: 1406
diff changeset
202 assert(false);
c9e3b93ec570 Highlighted locations with "using uninitialized variable" warning.
Nomad
parents: 1406
diff changeset
203 return 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
204 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
205
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
206 //----- (00471C03) --------------------------------------------------------
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
207 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
208 {
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
209 ObjectDesc *object; // ebx@1
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
210 int v6; // eax@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
211 int v7; // ecx@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
212 int v8; // edi@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
213 int v9; // eax@4
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
214 int v17; // ST10_4@25
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
215 //signed int v19; // eax@28
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
216 //Actor *v20; // edi@31
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
217 int v21; // eax@41
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
218 int v22; // ecx@43
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
219 __int16 v23; // bx@45
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
220 char v24; // al@46
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
221 signed int i; // edi@50
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
222 int v26; // edi@52
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
223 int v27; // eax@52
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
224 __int16 v28; // cx@55
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
225 int v29; // eax@55
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
226 //signed int v30; // edi@59
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
227 BSPModel *bmodel; // ecx@61
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
228 ODMFace *face; // edi@61
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
229 int v33; // eax@62
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
230 int v34; // ecx@62
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
231 int v35; // eax@63
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
232 int v36; // ecx@67
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
233 __int16 v37; // ax@67
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
234 int v38; // eax@72
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
235 //int v39; // eax@72
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
236 unsigned __int64 v40; // qax@72
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
237 int v41; // eax@72
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
238 unsigned __int8 v42; // sf@74
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
239 unsigned __int8 v43; // of@74
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
240 int v44; // eax@77
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
241 __int16 v45; // bx@81
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
242 int v46; // eax@85
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
243 const char *v47; // [sp-8h] [bp-B0h]@83
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
244 enum TEXTURE_TYPE v48; // [sp-4h] [bp-ACh]@46
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
245 int v49; // [sp+Ch] [bp-9Ch]@52
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
246 int v50; // [sp+10h] [bp-98h]@52
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
247 Vec3_int_ v51; // [sp+14h] [bp-94h]@11
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
248 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
249 int v54; // [sp+8Ch] [bp-1Ch]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
250 int v55; // [sp+90h] [bp-18h]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
251 int v56; // [sp+94h] [bp-14h]@11
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
252 int v57; // [sp+98h] [bp-10h]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
253 int v58; // [sp+9Ch] [bp-Ch]@1
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
254 int on_water; // [sp+A0h] [bp-8h]@1
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
255 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
256
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
257 v58 = 0;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
258 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
259 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
260 v55 = 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
261 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
262 v7 = v6;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
263 v54 = v6;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
264 v8 = v6 + 1;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
265 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
266 {
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
267 if ( on_water )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
268 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
269 v9 = v6 + 60;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
270 if ( v55 )
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
271 v9 = v6 + 30;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
272 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
273 SpriteObject::OnInteraction(uLayingItemID);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
274 }
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 else
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
277 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
278 v58 = 1;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
279 }
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
280 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
281 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
282 if ( v58 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
283 {
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
284 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
285 goto LABEL_13;
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 ( v57 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
288 {
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
289 pSpriteObjects[uLayingItemID].vPosition.z = v8;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
290 ODM_GetTerrainNormalAt(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, &v51);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
291 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
292 v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y + v51.z * pSpriteObjects[uLayingItemID].vVelocity.z + v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
293 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
294 pSpriteObjects[uLayingItemID].vVelocity.x += fixpoint_mul(v56, v51.x);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
295 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
296 pSpriteObjects[uLayingItemID].vVelocity.y += fixpoint_mul(v56, v51.y);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
297 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
298 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
299 v7 = v54;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
300 goto LABEL_13;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
301 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
302 if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
303 {
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
304 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
305 pSpriteObjects[uLayingItemID].vPosition.z = v8;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
306 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
307 return;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
308 }
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
309 pSpriteObjects[uLayingItemID].vPosition.z = v8;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
310 if ( !(object->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1, pSpriteObjects[uLayingItemID].vVelocity.z = v21, (signed __int16)v21 < 10) )
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
311 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
312
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
313 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
314 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
315 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
316 if ( (pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
317 + 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
318 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
319 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
320 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
321 memset(&Dst, 0, 0x68u);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
322 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
323 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
324 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
325 Dst.r = 0.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
326 Dst.g = 0.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
327 Dst.b = 0.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
328 if (object->uFlags & OBJECT_DESC_TRIAL_FIRE )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
329 {
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
330 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
331 Dst.uDiffuse = 0xFF3C1E;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
332 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
333 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
334 Dst.flt_28 = 1.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
335 pGame->pParticleEngine->AddParticle(&Dst);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
336 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
337 else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE)
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
338 {
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
339 Dst.type = ParticleType_Line;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
340 Dst.uDiffuse = rand();
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
341 Dst.timeToLive = 64;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
342 Dst.uTextureID = 0;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
343 Dst.flt_28 = 1.0;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
344 pGame->pParticleEngine->AddParticle(&Dst);
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
345 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
346 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
347 {
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
348 Dst.type = ParticleType_Bitmap | ParticleType_8;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
349 Dst.uDiffuse = rand();
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
350 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
351 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
352 Dst.flt_28 = 1.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
353 pGame->pParticleEngine->AddParticle(&Dst);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
354 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
355 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
356 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
357 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
358 LABEL_13:
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
359 if ( pSpriteObjects[uLayingItemID].vPosition.x >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.x <= 0x8000
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
360 && pSpriteObjects[uLayingItemID].vPosition.y >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.y <= 0x8000
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
361 && pSpriteObjects[uLayingItemID].vPosition.z > v7 && pSpriteObjects[uLayingItemID].vPosition.z <= 13000
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
362 || !(object->uFlags & OBJECT_DESC_INTERACTABLE) )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
363 goto LABEL_92;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
364 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
365 pSpriteObjects[uLayingItemID].vPosition.z = v8;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
366 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
367 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
368 LABEL_92:
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
369 stru_721530.field_0 = 0;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
370 stru_721530.prolly_normal_d = object->uRadius;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
371 stru_721530.height = object->uHeight;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
372 stru_721530.field_8_radius = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
373 stru_721530.field_70 = 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
374 for ( v55 = 0; v55 < 100; ++v55 )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
375 {
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
376 stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
377 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
378 stru_721530.uSectorID = 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
379 stru_721530.position.y = pSpriteObjects[uLayingItemID].vPosition.y;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
380 stru_721530.normal.y = pSpriteObjects[uLayingItemID].vPosition.y;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
381 stru_721530.position.z = pSpriteObjects[uLayingItemID].vPosition.z + stru_721530.prolly_normal_d + 1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
382 stru_721530.normal.z = stru_721530.position.z;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
383 stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
384 stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
385 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
386 if ( stru_721530._47050A(0) )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
387 return;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
388 _46E889_collide_against_bmodels(0);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
389 _46E26D_collide_against_sprites(WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x), WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y));
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
390 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
391 _46EF01_collision_chech_player(0);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
392 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
393 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
394 if (( PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) >= 0 )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
395 &&( 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
396 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
397 for (v56 =0; v56 < uNumActors; ++v56)
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
398 {
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
399 if ( pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[v56]) )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
400 Actor::_46DF1A_collide_against_actor(v56, 0);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
401 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
402 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
403 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
404 else
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
405 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
406 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
407 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
408 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
409 v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
410 v27 = ODM_GetFloorLevel( stru_721530.normal2.x, stru_721530.normal2.y, stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
411 object->uHeight, &v49, &v50, 0);
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
412 if ( on_water && v26 < v27 + 60 )
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 if ( v50 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
415 v44 = v27 + 30;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
416 else
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
417 v44 = v54 + 60;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
418 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v44);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
419 SpriteObject::OnInteraction(uLayingItemID);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
420 return;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
421 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
422 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
423 {
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
424 pSpriteObjects[uLayingItemID].vPosition.x = stru_721530.normal2.x;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
425 pSpriteObjects[uLayingItemID].vPosition.y = stru_721530.normal2.y;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
426 pSpriteObjects[uLayingItemID].vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
427 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
428 memset(&Dst, 0, 0x68u);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
429 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
430 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
431 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
432 Dst.r = 0.0;
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
433 Dst.g = 0.0;
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
434 Dst.b = 0.0;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
435 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
436 {
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
437 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
438 Dst.uDiffuse = 0xFF3C1E;
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
439 Dst.timeToLive = (unsigned __int8)( rand() & 0x80) + 128;
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
440 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
441 Dst.flt_28 = 1.0;
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
442 pGame->pParticleEngine->AddParticle(&Dst);
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
443 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
444 }
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
445 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
446 {
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
447 Dst.type = ParticleType_Line;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
448 Dst.uTextureID = 0;
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
449 Dst.uDiffuse = rand();
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
450 Dst.timeToLive = 64;
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
451 Dst.flt_28 = 1.0;
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
452 pGame->pParticleEngine->AddParticle(&Dst);
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
453 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
454 }
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
455 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
456 {
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
457 Dst.type = ParticleType_Bitmap | ParticleType_8;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
458 Dst.uDiffuse = rand();
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
459 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
460 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
461 Dst.flt_28 = 1.0;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
462 pGame->pParticleEngine->AddParticle(&Dst);
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
463 }
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
464 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
465 }
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
466 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
467 pSpriteObjects[uLayingItemID].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
468 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
469 pSpriteObjects[uLayingItemID].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
470 //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
471 v28 = LOWORD(stru_721530.uSectorID);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
472 pSpriteObjects[uLayingItemID].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
473 v29 = pSpriteObjects[uLayingItemID].vPosition.z;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
474 pSpriteObjects[uLayingItemID].uSectorID = v28;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
475 stru_721530.field_70 += stru_721530.field_7C;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
476 if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
477 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
478 if ( v29 < v54 )
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
479 pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
480 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
481 return;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
482 }
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
483 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
484 break;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
485 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
486 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
487 bmodel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
488 face = &bmodel->pFaces[PID_ID(stru_721530.uFaceID) & 0x3F];
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
489 if ( face->uPolygonType != POLYGON_Floor )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
490 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
491 v56 = abs(face->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
492 + face->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
493 + face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
494 if ( (stru_721530.speed >> 3) > v56 )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
495 v56 = stru_721530.speed >> 3;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
496 v57 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.x) >> 16;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
497 v58 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.y) >> 16;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
498 v60 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.z) >> 16;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
499 pSpriteObjects[uLayingItemID].vVelocity.x += 2 * v57;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
500 pSpriteObjects[uLayingItemID].vVelocity.y += 2 * v58;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
501 if ( face->pFacePlane.vNormal.z <= 32000 )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
502 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
503 v37 = 2 * (short)v60;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
504 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
505 else
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
506 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
507 v36 = v60;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
508 pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60;
1267
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
509 v58 = (unsigned __int64)(32000 * (signed __int64)(signed int)v36) >> 16;
33e360a9b4bf some fixes in normals
Gloval
parents: 1207
diff changeset
510 v37 = (unsigned int)(32000 * v36) >> 16;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
511 }
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
512 pSpriteObjects[uLayingItemID].vVelocity.z += v37;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
513 if ( BYTE3(face->uAttributes) & 0x10 )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
514 EventProcessor(face->sCogTriggeredID, 0, 1);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
515 goto LABEL_74;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
516 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
517 pSpriteObjects[uLayingItemID].vPosition.z = bmodel->pVertices.pVertices[face->pVertexIDs[0]].z + 1;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
518 if ( pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
519 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400 )
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
520 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
521 if ( BYTE3(face->uAttributes) & 0x10 )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
522 EventProcessor(face->sCogTriggeredID, 0, 1);
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
523 goto LABEL_74;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
524 }
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
525 LOWORD(v35) = 0;
2068
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
526 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
527 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
a290d9fbdc95 ODM_GetFloorLevel small fix
Ritor1
parents: 2044
diff changeset
528 pSpriteObjects[uLayingItemID].vVelocity.y = v35;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
529 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
530 LABEL_74:
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
531 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
532 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
533 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
534 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
535 v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
536 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
537 v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.x,
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
538 pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.y);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
539 pSpriteObjects[uLayingItemID].vVelocity.x = (unsigned __int64)(stru_5C6E00->Cos(v38) * (signed __int64)v57) >> 16;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
540 pSpriteObjects[uLayingItemID].vVelocity.y = (unsigned __int64)(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)v57) >> 16;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
541 goto LABEL_74;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
542 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
543 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
544
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
545 //----- (0047136C) --------------------------------------------------------
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
546 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
547 {
717
Ritor1
parents: 619
diff changeset
548 SpriteObject *pSpriteObject; // esi@1
Ritor1
parents: 619
diff changeset
549 ObjectDesc *pObject; // edi@1
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
550 int v9; // ecx@16
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
551 __int16 v10; // di@18
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
552 int v14; // ebx@34
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
553 signed int v15; // ebx@46
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
554 int v17; // eax@50
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
555 int v18; // eax@52
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
556 int v19; // ecx@52
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
557 Vec3_short_ *v20; // ecx@53
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
558 __int16 v22; // ax@57
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
559 int v23; // edi@62
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
560 unsigned __int8 v27; // sf@64
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
561 unsigned __int8 v28; // of@64
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
562 __int16 v29; // di@67
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
563 char v30; // al@68
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
564 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
565 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
566 int v39; // [sp+80h] [bp-10h]@33
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
567 int v40; // [sp+84h] [bp-Ch]@28
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
568 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
569
717
Ritor1
parents: 619
diff changeset
570 pSpriteObject = &pSpriteObjects[uLayingItemID];
Ritor1
parents: 619
diff changeset
571 pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID];
Ritor1
parents: 619
diff changeset
572 pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z);
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 717
diff changeset
573 v42 = BLV_GetFloorLevel(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID);
717
Ritor1
parents: 619
diff changeset
574 if ( abs(pSpriteObject->vPosition.x) > 32767
Ritor1
parents: 619
diff changeset
575 || abs(pSpriteObject->vPosition.y) > 32767
Ritor1
parents: 619
diff changeset
576 || abs(pSpriteObject->vPosition.z) > 20000
Ritor1
parents: 619
diff changeset
577 || v42 <= -30000
Ritor1
parents: 619
diff changeset
578 && (pSpriteObject->uSectorID == 0))
Ritor1
parents: 619
diff changeset
579 // || (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
580 {
717
Ritor1
parents: 619
diff changeset
581 SpriteObject::OnInteraction(uLayingItemID);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
582 return;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
583 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
584 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
585 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
586 LABEL_25:
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
587 stru_721530.field_0 = 0;
717
Ritor1
parents: 619
diff changeset
588 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
589 stru_721530.field_84 = -1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
590 stru_721530.height = pObject->uHeight;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
591 stru_721530.field_8_radius = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
592 stru_721530.field_70 = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
593 for ( uFaceID = 0; uFaceID < 100; uFaceID++ )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
594 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
595 stru_721530.position.x = pSpriteObject->vPosition.x;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
596 stru_721530.position.y = pSpriteObject->vPosition.y;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
597 stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
598
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
599 stru_721530.normal.x = stru_721530.position.x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
600 stru_721530.normal.y = stru_721530.position.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
601 stru_721530.normal.z = stru_721530.position.z;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
602
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
603 stru_721530.velocity.x = pSpriteObject->vVelocity.x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
604 stru_721530.velocity.y = pSpriteObject->vVelocity.y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
605 stru_721530.velocity.z = pSpriteObject->vVelocity.z;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
606
717
Ritor1
parents: 619
diff changeset
607 stru_721530.uSectorID = pSpriteObject->uSectorID;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
608 if ( stru_721530._47050A(0) )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
609 return;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
610
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
611 for ( v40 = 0; v40 < 100; ++v40 )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
612 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
613 _46E44E_collide_against_faces_and_portals(0);
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
614 _46E0B2_collide_against_decorations();
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
615 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
616 _46EF01_collision_chech_player(1);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
617 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
618 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
619 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
620 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
621 if( pActors[pSpriteObject->spell_caster_pid >> 3].pMonsterInfo.uID != pActors[v42].pMonsterInfo.uID )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
622 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
623 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
624 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
625 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
626 else
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
627 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
628 for ( v42 = 0; v42 < (signed int)uNumActors; v42++ )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
629 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
630 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
631 if ( _46F04E_collide_against_portals() )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
632 break;
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 ( 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
635 {
717
Ritor1
parents: 619
diff changeset
636 pSpriteObject->vPosition.x = stru_721530.normal2.x;
Ritor1
parents: 619
diff changeset
637 pSpriteObject->vPosition.y = stru_721530.normal2.y;
Ritor1
parents: 619
diff changeset
638 pSpriteObject->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
Ritor1
parents: 619
diff changeset
639 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID);
Ritor1
parents: 619
diff changeset
640 if ( !(HIBYTE(pObject->uFlags) & 1) )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
641 return;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
642 memset(&Dst, 0, 0x68u);
717
Ritor1
parents: 619
diff changeset
643 Dst.x = (double)pSpriteObject->vPosition.x;
Ritor1
parents: 619
diff changeset
644 Dst.y = (double)pSpriteObject->vPosition.y;
Ritor1
parents: 619
diff changeset
645 Dst.z = (double)pSpriteObject->vPosition.z;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
646 Dst.r = 0.0;
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
647 Dst.g = 0.0;
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
648 Dst.b = 0.0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
649 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
650 {
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
651 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
652 Dst.uDiffuse = 0xFF3C1E;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
653 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
654 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
655 Dst.flt_28 = 1.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
656 pGame->pParticleEngine->AddParticle(&Dst);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
657 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
658 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
659 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
660 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
661 Dst.type = ParticleType_Line;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
662 Dst.uDiffuse = rand();
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
663 Dst.timeToLive = 64;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
664 Dst.uTextureID = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
665 Dst.flt_28 = 1.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
666 pGame->pParticleEngine->AddParticle(&Dst);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
667 return;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
668 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
669 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
670 {
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
671 Dst.type = ParticleType_Bitmap | ParticleType_8;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
672 Dst.uDiffuse = rand();
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
673 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
674 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
675 Dst.flt_28 = 1.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
676 pGame->pParticleEngine->AddParticle(&Dst);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
677 }
717
Ritor1
parents: 619
diff changeset
678 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
679 }
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
680 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
681 pSpriteObject->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
682 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
683 pSpriteObject->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
684 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
685 pSpriteObject->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
1574
2d9c8f609a3c Here and there cleanings.
Nomad
parents: 1546
diff changeset
686 pSpriteObject->uSectorID = stru_721530.uSectorID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
687 stru_721530.field_70 += stru_721530.field_7C;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
688 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
689 return;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
690 v15 = (signed int)stru_721530.uFaceID >> 3;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
691 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
692 {
717
Ritor1
parents: 619
diff changeset
693 v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y);
Ritor1
parents: 619
diff changeset
694 v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x,
Ritor1
parents: 619
diff changeset
695 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y);
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
696 pSpriteObject->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v23), v40);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
697 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
698 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
699 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
700 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 822
diff changeset
701 stru_721530.field_84 = (signed int)PID_ID(stru_721530.uFaceID);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
702 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
703 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
704 v42 = abs(pIndoor->pFaces[v15].pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
705 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
706 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
707 if ( (stru_721530.speed >> 3) > v42 )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
708 v42 = stru_721530.speed >> 3;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
709 pSpriteObject->vVelocity.x += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.x);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
710 pSpriteObject->vVelocity.y += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.y);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
711 v39 = fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.z);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
712 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
713 v22 = 2 * v39;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
714 else
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
715 {
717
Ritor1
parents: 619
diff changeset
716 pSpriteObject->vVelocity.z += v39;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
717 v22 = fixpoint_mul(32000, v39);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
718 }
717
Ritor1
parents: 619
diff changeset
719 pSpriteObject->vVelocity.z += v22;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
720 if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
721 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
722 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
723 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
724 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
725 continue;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
726 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
727 if ( pObject->uFlags & OBJECT_DESC_BOUNCE )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
728 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
729 v17 = -pSpriteObject->vVelocity.z / 2;
717
Ritor1
parents: 619
diff changeset
730 pSpriteObject->vVelocity.z = v17;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
731 if ( (signed __int16)v17 < 10 )
717
Ritor1
parents: 619
diff changeset
732 pSpriteObject->vVelocity.z = 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
733 if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
734 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
735 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
736 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
737 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
738 continue;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
739 }
717
Ritor1
parents: 619
diff changeset
740 pSpriteObject->vVelocity.z = 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
741 if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y >= 400 )
717
Ritor1
parents: 619
diff changeset
742 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
743 if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 )
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
744 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
745 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
746 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
747 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
748 continue;
717
Ritor1
parents: 619
diff changeset
749 }
Ritor1
parents: 619
diff changeset
750 pSpriteObject->vVelocity.z = 0;
Ritor1
parents: 619
diff changeset
751 pSpriteObject->vVelocity.y = 0;
Ritor1
parents: 619
diff changeset
752 pSpriteObject->vVelocity.x = 0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
753 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
754 }
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
755 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
756 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
757 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
758 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
759 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
760 //äëÿ ïàäàþùèõ îáúåêòîâ(äëÿ ïðèìåðà âûáðîñ âåùè èç èíâåíòàðÿ)
717
Ritor1
parents: 619
diff changeset
761 if ( v42 <= pSpriteObject->vPosition.z - 3 )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
762 {
717
Ritor1
parents: 619
diff changeset
763 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
764 goto LABEL_25;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
765 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
766 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
767 {
717
Ritor1
parents: 619
diff changeset
768 pSpriteObject->vPosition.z = v42 + 1;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
769 if ( pIndoor->pFaces[uFaceID].uPolygonType == POLYGON_Floor )
717
Ritor1
parents: 619
diff changeset
770 pSpriteObject->vVelocity.z = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
771 else
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
772 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
773 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 45000 )
717
Ritor1
parents: 619
diff changeset
774 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
775 }
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
776 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
777 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
7182930263b3 fixpoint functions renaming
zipi
parents: 1574
diff changeset
778 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
779 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
780 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
781 pSpriteObject->vVelocity.x = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
782 pSpriteObject->vVelocity.y = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
783 pSpriteObject->vVelocity.z = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
784 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
785 return;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
786 memset(&Dst, 0, 0x68u);
717
Ritor1
parents: 619
diff changeset
787 Dst.x = (double)pSpriteObject->vPosition.x;
Ritor1
parents: 619
diff changeset
788 Dst.y = (double)pSpriteObject->vPosition.y;
Ritor1
parents: 619
diff changeset
789 Dst.z = (double)pSpriteObject->vPosition.z;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
790 Dst.r = 0.0;
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
791 Dst.g = 0.0;
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1306
diff changeset
792 Dst.b = 0.0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
793 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
794 {
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
795 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
796 Dst.uDiffuse = 0xFF3C1E;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
797 Dst.flt_28 = 1.0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
798 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
799 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
800 pGame->pParticleEngine->AddParticle(&Dst);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
801 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
802 }
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
803 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
804 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
805 Dst.type = ParticleType_Line;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
806 Dst.uDiffuse = rand();
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
807 Dst.timeToLive = 64;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
808 Dst.uTextureID = 0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
809 Dst.flt_28 = 1.0;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
810 pGame->pParticleEngine->AddParticle(&Dst);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
811 return;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
812 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
813 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
814 {
619
574cc56e05e9 ParticleEngine crash in temple
Nomad
parents: 515
diff changeset
815 Dst.type = ParticleType_Bitmap | ParticleType_8;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
816 Dst.uDiffuse = rand();
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
817 Dst.flt_28 = 1.0;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
818 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
819 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
820 pGame->pParticleEngine->AddParticle(&Dst);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
821 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
822 return;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
823 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
824 goto LABEL_25;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
825 }
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 // 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
828
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
829 //----- (00438E35) --------------------------------------------------------
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
830 void SpriteObject::ExplosionTraps()
515
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 MapInfo *pMapInfo; // esi@1
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
833 int dir_x; // ebx@1
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
834 int v7; // edx@2
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
835 unsigned int v10; // eax@7
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
836 signed int v11; // ebx@8
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
837 signed int v13; // edi@20
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
838 int dir_y; // [sp+Ch] [bp-Ch]@1
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
839 int dir_z; // [sp+10h] [bp-8h]@1
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
840 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
841
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1450
diff changeset
842 pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)];
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
843 dir_x = abs(pParty->vPosition.x - this->vPosition.x);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
844 dir_y = abs(pParty->vPosition.y - this->vPosition.y);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
845 dir_z = abs(pParty->vPosition.z + pParty->sEyelevel - this->vPosition.z);
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
846 if ( dir_x < dir_y )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
847 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
848 v7 = dir_x;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
849 dir_x = dir_y;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
850 dir_y = v7;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
851 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
852 if ( dir_x < dir_z )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
853 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
854 v7 = dir_x;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
855 dir_x = dir_z;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
856 dir_z = v7;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
857 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
858 if ( dir_y < dir_z )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
859 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
860 v7 = dir_z;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
861 dir_z = dir_y;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
862 dir_y = v7;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
863 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
864 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
865 if ( (signed int)v10 <= 768 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
866 {
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
867 v11 = 5;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
868 if ( pMapInfo->Trap_D20 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
869 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
870 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
871 v11 += rand() % 20 + 1;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
872 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
873 switch ( this->uType )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
874 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
875 case 811:
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
876 pDamageType = DMGT_FIRE;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
877 break;
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
878 case 812:
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
879 pDamageType = DMGT_ELECTR;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
880 break;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
881 case 813:
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
882 pDamageType = DMGT_COLD;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
883 break;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
884 case 814:
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
885 pDamageType = DMGT_BODY;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
886 break;
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
887 default:
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
888 return;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
889 }
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
890 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
891 {
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
892 if ( pPlayers[i]->CanAct() && (v13 = pPlayers[i]->GetPerception() + 20, rand() % v13 > 20) )
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
893 pPlayers[i]->PlaySound(SPEECH_6, 0);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
894 else
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1390
diff changeset
895 pPlayers[i]->ReceiveDamage(v11, pDamageType);
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
896 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
897 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
898 }
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 //----- (0042F933) --------------------------------------------------------
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
901 void SpriteObject::OnInteraction(unsigned int uLayingItemID)
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
902 {
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 810
diff changeset
903 pSpriteObjects[uLayingItemID].uObjectDescID = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
904 if ( pParty->bTurnBasedModeOn == 1 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
905 {
837
bebc19f3d2af Save/load work with some problems
Gloval
parents: 810
diff changeset
906 if (pSpriteObjects[uLayingItemID].uAttributes & 4 )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
907 {
1062
e23a79658fc5 some BYTE errors fixed
zipi
parents: 1036
diff changeset
908 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1410
diff changeset
909 --pTurnEngine->pending_actions;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
910 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
911 }
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
diff changeset
912 }
810
f5156b8c61ad savegame refactoring
Gloval
parents: 781
diff changeset
913
f5156b8c61ad savegame refactoring
Gloval
parents: 781
diff changeset
914
f5156b8c61ad savegame refactoring
Gloval
parents: 781
diff changeset
915 //----- (0042FA22) --------------------------------------------------------
f5156b8c61ad savegame refactoring
Gloval
parents: 781
diff changeset
916 void CompactLayingItemsList()
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
917 {
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
918 int new_obj_pos = 0;
810
f5156b8c61ad savegame refactoring
Gloval
parents: 781
diff changeset
919
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
920 for (int i=0; i < MAX_SPRITE_OBJECTS; ++i)
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
921 {
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
922 if (pSpriteObjects[i].uObjectDescID)
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
923 memcpy(&pSpriteObjects[new_obj_pos++], &pSpriteObjects[i],sizeof(SpriteObject));
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
924 }
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
925 uNumSpriteObjects = new_obj_pos;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
926 }
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
927 //----- (00408896) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
928 void InitializeSpriteObjects()
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
929 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
930 for (uint i = 0; i < uNumSpriteObjects; ++i)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
931 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1897
diff changeset
932 SpriteObject* item = &pSpriteObjects[i];
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
933
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
934 if (item->uType && (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & OBJECT_DESC_UNPICKABLE))
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
935 SpriteObject::OnInteraction(i);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
936 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
937 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
938 //----- (0046BEF1) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
939 void SpriteObject::_46BEF1_apply_spells_aoe()
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
940 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
941 //SpriteObject *v1; // edi@1
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
942 //Actor *v2; // esi@2
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
943 //__int16 v3; // fps@4
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
944 //unsigned __int8 v4; // c0@4
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
945 //unsigned __int8 v5; // c3@4
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
946 //signed int v6; // [sp+8h] [bp-4h]@1
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
947
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
948 int v7,v9,v10,v11;
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
949 __debugbreak();//Ritor1
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
950 if ( (signed int)uNumActors > 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
951 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
952 for ( uint i = 0; i < uNumActors; ++i )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
953 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
954 if ( pActors[i].CanAct() )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
955 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
956 //UNDEF(v3);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
957 //.text:0046BF26 movsx eax, word ptr [esi-2]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
958 //.text:0046BF2A sub eax, [edi+4]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
959 //.text:0046BF31 mov [ebp+var_8], eax
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
960 //.text:0046BF37 fild [ebp+var_8]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
961 // v7 pushed to stack
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
962 v7 = pActors[i].vPosition.x - this->vPosition.x;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
963
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
964 //.text:0046BF2D movsx ecx, word ptr [esi+2]
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
965 //v8 = pActors[i].vPosition.z;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
966
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
967 //.text:0046BF34 movsx eax, word ptr [esi]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
968 //.text:0046BF3A sub eax, [edi+8]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
969 //.text:0046BF3D mov [ebp+var_8], eax
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
970 //.text:0046BF44 fild [ebp+var_8]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
971 // v9 pushed to stack
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
972 v9 = pActors[i].vPosition.y - this->vPosition.y;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
973
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
974 //.text:0046BF40 movsx eax, word ptr [esi-6]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
975 //.text:0046BF47 sar eax, 1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
976 //.text:0046BF49 add eax, ecx
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
977 //.text:0046BF4B sub eax, [edi+0Ch]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
978 //.text:0046BF4E mov [ebp+var_8], eax
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
979 //.text:0046BF51 fild [ebp+var_8]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
980 //.text:0046BF58 fld st
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
981 // v10 pushed to stack, two times
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
982 v10 = pActors[i].uActorHeight / 2 + pActors[i].vPosition.z - this->vVelocity.y;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
983
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
984 //.text:0046BF54 movsx eax, word ptr [esi-8]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
985 //.text:0046BF5A add eax, 100h
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
986 //.text:0046BF63 mov ecx, eax
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
987 //v11 = this->vVelocity.x;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
988
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
989 //.text:0046BF5F fmul st, st(1)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
990 // stack: v10*v10, v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
991 //.text:0046BF61 fld st(2)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
992 // stack: v7, v10*v10, v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
993
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
994
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
995 //.text:0046BF65 fmul st, st(3)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
996 // stack: v7*v9, v10*v10, v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
997
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
998 //.text:0046BF67 imul ecx, eax
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
999 v11 = this->vVelocity.x * this->vVelocity.x;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1000
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1001 //.text:0046BF6A faddp st(1), st
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1002 // stack: v10*v10+v7*v9, v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1003 //.text:0046BF6C fld st(3)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1004 // stack: v7, v10*v10+v7*v9, v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1005 //.text:0046BF6E fmul st, st(4)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1006 // stack: v7*v7, v10*v10+v7*v9, v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1007 //.text:0046BF70 faddp st(1), st
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1008 // stack: v10*v10+v7*v9+v7*v7, v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1009
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1010 //.text:0046BF72 mov [ebp+var_8], ecx
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1011 //.text:0046BF75 fild [ebp+var_8]
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1012 // v11 pushed to stack
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1013
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1014 //.text:0046BF78 fcompp
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1015 // if ( v11 > v10*v10+v7*v9+v7*v7 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1016 // stack: v10, v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1017
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1018 //.text:0046BF7A fstp st
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1019 // stack: v9, v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1020
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1021 //.text:0046BF7C fnstsw ax
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1022 //.text:0046BF7E fstp st
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1023 // stack: v7
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1024
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1025 //.text:0046BF80 test ah, 41h
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1026 //.text:0046BF83 fstp st
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1027 //.text:0046BF85 jnz short loc_46BFDD
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1028
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
1029 if ( v11 >= v7 * v7 + v9 * v9 + v10 * v10 )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1030 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
1031 if ( stru_50C198.GetMagicalResistance(&pActors[i], 0xAu) )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1032 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
1033 pActors[i].pActorBuffs[this->spell_id].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(this->spell_level << 7) * 0.033333335),
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
1034 this->spell_skill, 4, 0, 0);
52abdea20b9e Door_switch_animation
Ritor1
parents: 2068
diff changeset
1035 HIWORD(pActors[i].uAttributes) |= 8;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1036 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1037 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1038 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1039 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1040 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1267
diff changeset
1041 }