Mercurial > mm7
comparison SpriteObject.cpp @ 2486:1e70f8470638
simplified SpriteObject::Create
author | Grumpy7 |
---|---|
date | Sun, 07 Sep 2014 01:36:04 +0200 |
parents | b3f96acf6bab |
children | 0a0c6d75aabe |
comparison
equal
deleted
inserted
replaced
2485:45102c9132e1 | 2486:1e70f8470638 |
---|---|
82 field_64.x = vPosition.x; | 82 field_64.x = vPosition.x; |
83 field_64.y = vPosition.y; | 83 field_64.y = vPosition.y; |
84 field_64.z = vPosition.z; | 84 field_64.z = vPosition.z; |
85 | 85 |
86 assert(sizeof(SpriteObject) == 0x70); | 86 assert(sizeof(SpriteObject) == 0x70); |
87 | |
88 switch (a5) | |
89 { | |
90 case 0: | |
91 break; //do nothing | |
92 case 1: | |
93 Vec3_int_::Rotate(24, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x, | |
94 &vPosition.y, &vPosition.z); | |
95 break; | |
96 case 2: | |
97 Vec3_int_::Rotate(8, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x, | |
98 &vPosition.y, &vPosition.z); | |
99 break; | |
100 case 3: | |
101 Vec3_int_::Rotate(8, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x, | |
102 &vPosition.y, &vPosition.z); | |
103 break; | |
104 case 4: | |
105 Vec3_int_::Rotate(24, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x, | |
106 &vPosition.y, &vPosition.z); | |
107 break; | |
108 default: | |
109 assert(false); | |
110 return 0; | |
111 break; | |
112 } | |
113 | |
114 if ( a4 ) | |
115 { | |
116 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); | |
117 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); | |
118 vVelocity.x = fixpoint_mul(v13, a4); | |
119 vVelocity.y = fixpoint_mul(a5a, a4); | |
120 vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); | |
121 } | |
122 else | |
123 { | |
124 vVelocity.y = 0; | |
125 vVelocity.x = 0; | |
126 vVelocity.z = 0; | |
127 } | |
128 | |
87 memcpy(&pSpriteObjects[v6], this, sizeof(*this)); | 129 memcpy(&pSpriteObjects[v6], this, sizeof(*this)); |
88 if ( a5 == 0 ) | 130 if ( v6 >= (signed int)uNumSpriteObjects ) |
89 { | 131 uNumSpriteObjects = v6 + 1; |
90 pSpriteObjects[v6].vVelocity.z = 0; | 132 return v6; |
91 if ( a4 ) | |
92 { | |
93 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); | |
94 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); | |
95 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); | |
96 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); | |
97 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); | |
98 } | |
99 else | |
100 { | |
101 pSpriteObjects[v6].vVelocity.y = 0; | |
102 pSpriteObjects[v6].vVelocity.x = 0; | |
103 } | |
104 if ( v6 >= (signed int)uNumSpriteObjects ) | |
105 uNumSpriteObjects = v6 + 1; | |
106 return v6; | |
107 } | |
108 if ( a5 == 1 ) | |
109 { | |
110 v17.x = vPosition.x; | |
111 v17.y = vPosition.y; | |
112 v17.z = vPosition.z; | |
113 Vec3_int_::Rotate(24, stru_5C6E00->uIntegerHalfPi + pSpriteObjects[v6].uFacing, 0, v17, &pSpriteObjects[v6].vPosition.x, | |
114 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z); | |
115 pSpriteObjects[v6].vVelocity.z = 0; | |
116 if ( a4 ) | |
117 { | |
118 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); | |
119 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); | |
120 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); | |
121 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); | |
122 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); | |
123 } | |
124 else | |
125 { | |
126 pSpriteObjects[v6].vVelocity.y = 0; | |
127 pSpriteObjects[v6].vVelocity.x = 0; | |
128 } | |
129 if ( v6 >= (signed int)uNumSpriteObjects ) | |
130 uNumSpriteObjects = v6 + 1; | |
131 return v6; | |
132 } | |
133 if ( a5 == 2 ) | |
134 { | |
135 v17.x = vPosition.x; | |
136 v17.y = vPosition.y; | |
137 v17.z = vPosition.z; | |
138 Vec3_int_::Rotate(8, stru_5C6E00->uIntegerHalfPi + pSpriteObjects[v6].uFacing, 0, v17, &pSpriteObjects[v6].vPosition.x, | |
139 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z); | |
140 pSpriteObjects[v6].vVelocity.z = 0; | |
141 if ( a4 ) | |
142 { | |
143 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); | |
144 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); | |
145 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); | |
146 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); | |
147 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); | |
148 } | |
149 else | |
150 { | |
151 pSpriteObjects[v6].vVelocity.y = 0; | |
152 pSpriteObjects[v6].vVelocity.x = 0; | |
153 } | |
154 if ( v6 >= (signed int)uNumSpriteObjects ) | |
155 uNumSpriteObjects = v6 + 1; | |
156 return v6; | |
157 } | |
158 if ( a5 == 3 ) | |
159 { | |
160 v17.x = vPosition.x; | |
161 v17.y = vPosition.y; | |
162 v17.z = vPosition.z; | |
163 Vec3_int_::Rotate(8, pSpriteObjects[v6].uFacing - stru_5C6E00->uIntegerHalfPi, 0, v17, &pSpriteObjects[v6].vPosition.x, | |
164 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z); | |
165 pSpriteObjects[v6].vVelocity.z = 0; | |
166 if ( a4 ) | |
167 { | |
168 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); | |
169 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); | |
170 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); | |
171 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); | |
172 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); | |
173 } | |
174 else | |
175 { | |
176 pSpriteObjects[v6].vVelocity.y = 0; | |
177 pSpriteObjects[v6].vVelocity.x = 0; | |
178 } | |
179 if ( v6 >= (signed int)uNumSpriteObjects ) | |
180 uNumSpriteObjects = v6 + 1; | |
181 return v6; | |
182 } | |
183 if ( a5 == 4 ) | |
184 { | |
185 v17.x = vPosition.x; | |
186 v17.y = vPosition.y; | |
187 v17.z = vPosition.z; | |
188 Vec3_int_::Rotate(24, pSpriteObjects[v6].uFacing - stru_5C6E00->uIntegerHalfPi, 0, v17, &pSpriteObjects[v6].vPosition.x, | |
189 &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z); | |
190 pSpriteObjects[v6].vVelocity.z = 0; | |
191 if ( a4 ) | |
192 { | |
193 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); | |
194 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); | |
195 pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4); | |
196 pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4); | |
197 pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4); | |
198 } | |
199 else | |
200 { | |
201 pSpriteObjects[v6].vVelocity.y = 0; | |
202 pSpriteObjects[v6].vVelocity.x = 0; | |
203 } | |
204 if ( v6 >= (signed int)uNumSpriteObjects ) | |
205 uNumSpriteObjects = v6 + 1; | |
206 return v6; | |
207 } | |
208 | |
209 assert(false); | |
210 return 0; | |
211 } | 133 } |
212 | 134 |
213 //----- (00471C03) -------------------------------------------------------- | 135 //----- (00471C03) -------------------------------------------------------- |
214 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID) | 136 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID) |
215 { | 137 { |