Mercurial > mm7
annotate mm7_6.cpp @ 1966:7840fe323f67
stru319::LootActor(struct Actor *pActor) to Actor::LootActor
author | Grumpy7 |
---|---|
date | Fri, 25 Oct 2013 13:03:08 -0700 |
parents | 182d49f28170 |
children | 7d2c5fa98584 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
0 | 5 #include "MM7.h" |
6 | |
1016 | 7 |
8 | |
1323 | 9 #include "Weather.h" |
1016 | 10 #include "Sprites.h" |
11 #include "BSPModel.h" | |
12 #include "Mouse.h" | |
13 #include "Keyboard.h" | |
14 #include "stru6.h" | |
15 | |
16 #include "Vis.h" | |
0 | 17 #include "Game.h" |
18 #include "GUIWindow.h" | |
19 #include "GUIFont.h" | |
20 #include "Party.h" | |
21 #include "AudioPlayer.h" | |
22 #include "Outdoor.h" | |
1277 | 23 #include "Outdoor_stuff.h" |
0 | 24 #include "Overlays.h" |
25 #include "LOD.h" | |
26 #include "Actor.h" | |
27 #include "Events.h" | |
28 #include "Viewport.h" | |
29 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
30 #include "SpriteObject.h" |
0 | 31 #include "ObjectList.h" |
32 #include "stru123.h" | |
33 #include "Time.h" | |
34 #include "IconFrameTable.h" | |
35 #include "Awards.h" | |
36 #include "TurnEngine.h" | |
924 | 37 #include "CastSpellInfo.h" |
0 | 38 #include "stru298.h" |
189 | 39 #include "texts.h" |
0 | 40 |
41 #include "mm7_data.h" | |
42 | |
43 | |
44 | |
45 //----- (0042704B) -------------------------------------------------------- | |
1450 | 46 int stru319::special_ability_use_check( struct Actor *pActor, int a2 ) |
47 { | |
0 | 48 stru319 *v3; // edi@1 |
49 signed int v4; // ebx@5 | |
50 signed int v5; // edi@5 | |
51 | |
52 v3 = this; | |
53 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
54 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
55 && rand() % 100 < 5 ) | |
1896
b6a7410ff0ef
renaming dword_4DF380 to dword_4DF380_hostilityRanges, moved it to actor.cpp
Grumpy7
parents:
1861
diff
changeset
|
56 pActor->SummonMinion(a2); |
0 | 57 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); |
58 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
59 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
60 return 2; | |
61 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
62 return 3; | |
1450 | 63 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance?1:0; |
0 | 64 } |
65 | |
66 //----- (00427102) -------------------------------------------------------- | |
67 int stru319::_427102(Actor *pActor, signed int a2) | |
68 { | |
69 unsigned __int8 v3; // cf@11 | |
70 unsigned __int8 v4; // zf@11 | |
71 SpellBuff *v6; // ecx@46 | |
89 | 72 Player *v7; // esi@49 |
0 | 73 signed int v8; // edx@50 |
89 | 74 SpellBuff *v9; // ecx@50 |
0 | 75 |
597 | 76 switch(a2) |
0 | 77 { |
597 | 78 case 77: |
79 { | |
80 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
81 return 0; | |
82 return 1; | |
83 } | |
84 case 80: | |
85 { | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1843
diff
changeset
|
86 v6 = pParty->pPartyBuffs.data(); |
597 | 87 while ( (signed __int64)v6->uExpireTime <= 0 ) |
88 { | |
89 ++v6; | |
1167 | 90 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] ) |
597 | 91 { |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1843
diff
changeset
|
92 v7 = pParty->pPlayers.data();//[0].pPlayerBuffs; |
597 | 93 v8 = 0; |
1826 | 94 v9 = v7->pPlayerBuffs.data(); |
597 | 95 while ( v9->uExpireTime <= 0i64 ) |
96 { | |
97 ++v8; | |
98 ++v9; | |
99 if ( v8 >= 24 ) | |
100 { | |
101 ++v7; | |
102 if ( v7 <= &pParty->pPlayers[3] ) | |
103 { | |
104 v8 = 0; | |
1826 | 105 v9 = v7->pPlayerBuffs.data(); |
597 | 106 } |
107 else | |
108 return 0; | |
109 } | |
110 } | |
111 return 1; | |
112 } | |
113 } | |
114 return 1; | |
115 } | |
116 case 85: | |
117 { | |
1957
3d0c57c4fa83
pActorBuffs[13] to pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION]
Grumpy7
parents:
1955
diff
changeset
|
118 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) < 0 ) |
597 | 119 return 1; |
1957
3d0c57c4fa83
pActorBuffs[13] to pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION]
Grumpy7
parents:
1955
diff
changeset
|
120 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) > 0 ) |
597 | 121 return 0; |
122 v3 = 0; | |
1957
3d0c57c4fa83
pActorBuffs[13] to pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION]
Grumpy7
parents:
1955
diff
changeset
|
123 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) == 0; |
597 | 124 break; |
125 } | |
126 case 86: | |
127 { | |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
128 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) < 0 ) |
597 | 129 return 1; |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
130 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) > 0 ) |
597 | 131 return 0; |
0 | 132 v3 = 0; |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
133 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) == 0; |
597 | 134 break; |
135 } | |
136 case 95: | |
137 { | |
1964
2b6c6ff66823
pActorBuffs[20] to pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION]
Grumpy7
parents:
1963
diff
changeset
|
138 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) < 0 ) |
597 | 139 return 1; |
1964
2b6c6ff66823
pActorBuffs[20] to pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION]
Grumpy7
parents:
1963
diff
changeset
|
140 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) > 0 ) |
597 | 141 return 0; |
0 | 142 v3 = 0; |
1964
2b6c6ff66823
pActorBuffs[20] to pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION]
Grumpy7
parents:
1963
diff
changeset
|
143 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) == 0; |
597 | 144 break; |
145 } | |
146 case 73: | |
147 { | |
1965
182d49f28170
pActorBuffs[21] to pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS]
Grumpy7
parents:
1964
diff
changeset
|
148 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) < 0 ) |
597 | 149 return 1; |
1965
182d49f28170
pActorBuffs[21] to pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS]
Grumpy7
parents:
1964
diff
changeset
|
150 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) > 0 ) |
597 | 151 return 0; |
152 v3 = 0; | |
1965
182d49f28170
pActorBuffs[21] to pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS]
Grumpy7
parents:
1964
diff
changeset
|
153 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) == 0; |
597 | 154 break; |
155 } | |
156 case 5: | |
157 { | |
1963 | 158 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) < 0 ) |
597 | 159 return 1; |
1963 | 160 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) > 0 ) |
597 | 161 return 0; |
162 v3 = 0; | |
1963 | 163 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) == 0; |
597 | 164 break; |
165 } | |
166 case 17: | |
167 { | |
1959 | 168 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) < 0 ) |
597 | 169 return 1; |
1959 | 170 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > 0 ) |
597 | 171 return 0; |
172 v3 = 0; | |
1959 | 173 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) == 0; |
597 | 174 break; |
175 } | |
176 case 38: | |
89 | 177 { |
1960
f92fc67d66cb
pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents:
1959
diff
changeset
|
178 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) < 0 ) |
597 | 179 return 1; |
1960
f92fc67d66cb
pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents:
1959
diff
changeset
|
180 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) > 0 ) |
597 | 181 return 0; |
182 v3 = 0; | |
1960
f92fc67d66cb
pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents:
1959
diff
changeset
|
183 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) == 0; |
597 | 184 } |
185 case 46: | |
186 { | |
1961 | 187 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) < 0 ) |
89 | 188 return 1; |
1961 | 189 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) > 0 ) |
597 | 190 return 0; |
191 v3 = 0; | |
1961 | 192 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) == 0; |
597 | 193 break; |
194 } | |
195 case 47: | |
196 { | |
1955 | 197 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) < 0 ) |
597 | 198 return 1; |
1955 | 199 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) > 0 ) |
597 | 200 return 0; |
201 v3 = 0; | |
1955 | 202 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) == 0; |
597 | 203 break; |
204 } | |
205 case 51: | |
206 { | |
1962
39a68477ead3
pActorBuffs[18] to pActorBuffs[ACTOR_BUFF_HEROISM]
Grumpy7
parents:
1961
diff
changeset
|
207 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) < 0 ) |
597 | 208 return 1; |
1962
39a68477ead3
pActorBuffs[18] to pActorBuffs[ACTOR_BUFF_HEROISM]
Grumpy7
parents:
1961
diff
changeset
|
209 if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) <= 0 ) |
597 | 210 { |
89 | 211 v3 = 0; |
1962
39a68477ead3
pActorBuffs[18] to pActorBuffs[ACTOR_BUFF_HEROISM]
Grumpy7
parents:
1961
diff
changeset
|
212 v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) == 0; |
89 | 213 } |
214 else | |
597 | 215 return 0; |
216 break; | |
217 } | |
218 default: | |
89 | 219 { |
597 | 220 return 1; |
89 | 221 } |
0 | 222 } |
223 if ( !(v3 | v4) ) | |
224 return 0; | |
225 return 1; | |
226 } | |
227 | |
228 //----- (004272F5) -------------------------------------------------------- | |
229 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
230 { | |
231 signed int v5; // esi@1 | |
232 signed int v6; // edi@1 | |
233 int v7; // esi@8 | |
234 int v8; // eax@9 | |
235 int v9; // edx@11 | |
236 int v10; // edx@13 | |
237 int v11; // esi@13 | |
238 unsigned __int8 v12; // sf@13 | |
239 unsigned __int8 v13; // of@13 | |
240 int v14; // edx@14 | |
241 int v15; // eax@14 | |
242 signed int result; // eax@17 | |
243 | |
244 v5 = pActor->pMonsterInfo.uAC; | |
245 v6 = 0; | |
1952
4ed7d18abe93
pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents:
1936
diff
changeset
|
246 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 ) |
0 | 247 v5 /= 2; |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
248 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 ) |
1959 | 249 v6 = pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uPower; |
1960
f92fc67d66cb
pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents:
1959
diff
changeset
|
250 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > v6 ) |
f92fc67d66cb
pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents:
1959
diff
changeset
|
251 v6 = pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower; |
0 | 252 v7 = v6 + v5; |
253 if ( a3 ) | |
254 v8 = pPlayer->GetRangedAttack(); | |
255 else | |
1685
2a309997c42f
Player::StealFromShop started cleanup, fixing a few errors caused by not commiting everything
Grumpy7
parents:
1637
diff
changeset
|
256 v8 = pPlayer->GetActualAttack(false); |
0 | 257 v9 = rand() % (v7 + 2 * v8 + 30); |
258 if ( a3 == 2 ) | |
259 { | |
260 v14 = a4 + v9; | |
261 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1419 | 262 v13 = __OFSUB__(v14, v15); |
263 v12 = v14 - v15 < 0; | |
0 | 264 } |
265 else | |
266 { | |
267 if ( a3 != 3 ) | |
268 { | |
269 v10 = a4 + v9; | |
270 v11 = v7 + 15; | |
271 v13 = __OFSUB__(v10, v11); | |
272 v12 = v10 - v11 < 0; | |
273 } | |
1419 | 274 else |
275 { | |
276 v14 = a4 + v9; | |
277 v15 = 2 * v7 + 30; | |
278 v13 = __OFSUB__(v14, v15); | |
279 v12 = v14 - v15 < 0; | |
280 } | |
0 | 281 } |
282 if ( v12 ^ v13 ) | |
283 result = 0; | |
284 else | |
285 result = 1; | |
286 return result; | |
287 } | |
288 | |
289 //----- (004273BB) -------------------------------------------------------- | |
290 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
291 { | |
292 Actor *v5; // ecx@1 | |
293 signed int v6; // ebx@1 | |
294 signed int v7; // esi@1 | |
295 unsigned __int8 v8; // zf@1 | |
296 unsigned __int8 v9; // sf@1 | |
297 int v10; // ebx@10 | |
298 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
299 | |
300 v5 = a2; | |
301 v6 = a2->pMonsterInfo.uAC; | |
302 v7 = 0; | |
1952
4ed7d18abe93
pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents:
1936
diff
changeset
|
303 v8 = HIDWORD(a2->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime) == 0; |
4ed7d18abe93
pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents:
1936
diff
changeset
|
304 v9 = SHIDWORD(a2->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime) < 0; |
0 | 305 a2a = 0; |
1952
4ed7d18abe93
pActorBuffs[8] to pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC]
Grumpy7
parents:
1936
diff
changeset
|
306 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime) > 0) ) |
0 | 307 v6 /= 2; |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
308 if ( (signed __int64)v5->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 ) |
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
309 v7 = v5->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower; |
1960
f92fc67d66cb
pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents:
1959
diff
changeset
|
310 if ( (signed __int64)v5->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && v5->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > v7 ) |
f92fc67d66cb
pActorBuffs[16] to pActorBuffs[ACTOR_BUFF_STONESKIN]
Grumpy7
parents:
1959
diff
changeset
|
311 v7 = v5->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower; |
0 | 312 v10 = v7 + v6; |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
313 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 ) |
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
314 a2a = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower; |
1961 | 315 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower > a2a ) |
316 a2a = pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower; | |
1955 | 317 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime > 0 ) |
0 | 318 { |
1955 | 319 a2a += pActor->pActorBuffs[ACTOR_BUFF_FATE].uPower; |
320 pActor->pActorBuffs[ACTOR_BUFF_FATE].Reset(); | |
0 | 321 } |
322 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
323 } | |
324 | |
325 //----- (004274AD) -------------------------------------------------------- | |
326 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
327 { | |
328 signed int v3; // edi@1 | |
329 signed int v4; // esi@8 | |
330 int v5; // esi@8 | |
331 | |
332 v3 = 0; | |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
333 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 ) |
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
334 v3 = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower; |
1961 | 335 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower > v3 ) |
336 v3 = pActor->pActorBuffs[ACTOR_BUFF_BLESS].uPower; | |
1955 | 337 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime > 0 ) |
0 | 338 { |
1955 | 339 v3 += pActor->pActorBuffs[ACTOR_BUFF_FATE].uPower; |
340 pActor->pActorBuffs[ACTOR_BUFF_FATE].Reset(); | |
0 | 341 } |
342 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
343 v5 = rand() % v4 + 1; | |
344 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
345 } | |
346 | |
347 //----- (00427546) -------------------------------------------------------- | |
348 int stru319::_427546(int a2) | |
349 { | |
350 int result; // eax@2 | |
351 | |
352 if ( a2 >= 0 ) | |
353 { | |
354 if ( a2 >= 1 ) | |
355 result = (a2 >= 2) + 2; | |
356 else | |
357 result = 1; | |
358 } | |
359 else | |
360 { | |
361 result = 0; | |
362 } | |
363 return result; | |
364 } | |
365 | |
366 //----- (0042756B) -------------------------------------------------------- | |
367 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
368 { | |
369 int v4; // edx@1 | |
370 int v5; // ecx@1 | |
371 signed int v6; // eax@4 | |
372 signed int result; // eax@17 | |
373 signed int v8; // esi@18 | |
374 | |
375 v4 = 0; | |
376 v5 = 0; | |
1958
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
377 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 ) |
95095c2a5e19
pActorBuffs[14] to pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER]
Grumpy7
parents:
1957
diff
changeset
|
378 v5 = pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower; |
0 | 379 switch ( a2 ) |
380 { | |
381 case 0: | |
382 v6 = pActor->pMonsterInfo.uResFire; | |
1419 | 383 v4 = v5; |
384 break; | |
0 | 385 case 1: |
386 v6 = pActor->pMonsterInfo.uResAir; | |
1419 | 387 v4 = v5; |
388 break; | |
0 | 389 case 2: |
390 v6 = pActor->pMonsterInfo.uResWater; | |
1419 | 391 v4 = v5; |
392 break; | |
0 | 393 case 3: |
394 v6 = pActor->pMonsterInfo.uResEarth; | |
1419 | 395 v4 = v5; |
396 break; | |
1765 | 397 case 4: |
398 v6 = pActor->pMonsterInfo.uResPhysical; | |
399 break; | |
0 | 400 case 6: |
401 v6 = pActor->pMonsterInfo.uResSpirit; | |
402 break; | |
403 case 7: | |
404 v6 = pActor->pMonsterInfo.uResMind; | |
1419 | 405 v4 = v5; |
406 break; | |
0 | 407 case 8: |
408 v6 = pActor->pMonsterInfo.uResBody; | |
409 v4 = v5; | |
410 break; | |
411 case 9: | |
412 v6 = pActor->pMonsterInfo.uResLight; | |
413 break; | |
414 case 10: | |
415 v6 = pActor->pMonsterInfo.uResDark; | |
416 break; | |
417 default: | |
418 v6 = 0; | |
419 break; | |
420 } | |
421 if ( v6 < 200 ) | |
422 { | |
423 v8 = v4 + v6 + 30; | |
424 if ( rand() % v8 >= 30 ) | |
425 { | |
426 a3 >>= 1; | |
427 if ( rand() % v8 >= 30 ) | |
428 { | |
429 a3 >>= 1; | |
430 if ( rand() % v8 >= 30 ) | |
431 { | |
432 a3 >>= 1; | |
433 if ( rand() % v8 >= 30 ) | |
434 a3 >>= 1; | |
435 } | |
436 } | |
437 } | |
438 result = a3; | |
439 } | |
440 else | |
441 { | |
442 result = 0; | |
443 } | |
444 return result; | |
445 } | |
446 | |
447 //----- (00427662) -------------------------------------------------------- | |
448 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
449 { | |
1765 | 450 signed int resist; // esi@2 |
0 | 451 bool result; // eax@13 |
452 | |
453 switch ( uType ) | |
454 { | |
1765 | 455 case 0: |
456 resist = pActor->pMonsterInfo.uResFire; | |
457 break; | |
458 case 1: | |
459 resist = pActor->pMonsterInfo.uResAir; | |
460 break; | |
461 case 2: | |
462 resist = pActor->pMonsterInfo.uResWater; | |
463 break; | |
464 case 3: | |
465 resist = pActor->pMonsterInfo.uResEarth; | |
466 break; | |
467 case 4: | |
468 resist = pActor->pMonsterInfo.uResPhysical; | |
469 break; | |
470 case 6: | |
471 resist = pActor->pMonsterInfo.uResSpirit; | |
472 break; | |
473 case 7: | |
474 resist = pActor->pMonsterInfo.uResMind; | |
475 case 8: | |
476 resist = pActor->pMonsterInfo.uResBody; | |
477 break; | |
478 case 9: | |
479 resist = pActor->pMonsterInfo.uResLight; | |
480 break; | |
481 case 10: | |
482 resist = pActor->pMonsterInfo.uResDark; | |
0 | 483 break; |
484 default: | |
1419 | 485 return 1; |
0 | 486 } |
1765 | 487 if ( resist < 200 ) |
488 result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30; | |
1419 | 489 else |
1765 | 490 result = 0; |
0 | 491 return result; |
492 } | |
493 | |
494 //----- (0042EB8D) -------------------------------------------------------- | |
437 | 495 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 496 { |
482 | 497 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 498 if (uNumMessages < 40) |
499 { | |
437 | 500 files[uNumMessages] = file; |
501 lines[uNumMessages] = line; | |
502 | |
0 | 503 pMessages[uNumMessages].eType = msg; |
504 pMessages[uNumMessages].param = param; | |
505 pMessages[uNumMessages++].field_8 = a4; | |
506 } | |
507 } | |
508 | |
509 | |
510 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 511 int stru193_math::Sin(int angle) |
0 | 512 { |
323 | 513 return Cos(angle - this->uIntegerHalfPi); |
0 | 514 } |
515 | |
516 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 517 void _42ECB5_PlayerAttacksActor() |
0 | 518 { |
271 | 519 //unsigned int v0; // ebx@1 |
520 //Player *v1; // esi@1 | |
521 //bool result; // eax@1 | |
295 | 522 //int v3; // edi@2 |
271 | 523 //unsigned int v4; // eax@7 |
0 | 524 char *v5; // eax@8 |
271 | 525 //int v6; // ecx@9 |
526 //signed int v7; // eax@16 | |
295 | 527 //Actor *v8; // edi@20 |
0 | 528 unsigned int v9; // ecx@21 |
295 | 529 //char *v10; // eax@26 |
0 | 530 char *v11; // eax@26 |
531 unsigned int v12; // eax@47 | |
295 | 532 //char *v13; // eax@47 |
533 //char *v14; // eax@47 | |
534 //unsigned int v15; // ebx@54 | |
535 //int v16; // [sp-10h] [bp-4Ch]@24 | |
536 //int v17; // [sp-10h] [bp-4Ch]@44 | |
537 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
538 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
539 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
540 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
541 //int v22; // [sp-4h] [bp-40h]@24 | |
542 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 543 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 544 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 545 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
546 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 547 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 548 //unsigned int *v28b; |
295 | 549 //int v29; // [sp+24h] [bp-18h]@16 |
550 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 551 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 552 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 553 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 554 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 555 |
271 | 556 //v0 = uActiveCharacter; |
557 //v27 = 6972 * uActiveCharacter; | |
558 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
559 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
560 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
561 if (!player->CanAct()) | |
562 return; | |
563 | |
1517 | 564 CastSpellInfoHelpers::_427D48(); |
295 | 565 //v3 = 0; |
271 | 566 if (pParty->Invisible()) |
567 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
568 | |
569 //v31 = player->pEquipment.uBow; | |
570 int bow_idx = player->pEquipment.uBow; | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1558
diff
changeset
|
571 if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken()) |
271 | 572 bow_idx = 0; |
573 | |
295 | 574 //v32 = 0; |
575 int wand_item_id = 0; | |
271 | 576 //v33 = 0; |
577 //v4 = v1->pEquipment.uMainHand; | |
578 int laser_weapon_item_id = 0; | |
579 | |
580 int main_hand_idx = player->pEquipment.uMainHand; | |
581 if (main_hand_idx) | |
0 | 582 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1340
diff
changeset
|
583 auto item = &player->pInventoryItemList[main_hand_idx - 1]; |
112 | 584 //v5 = (char *)v1 + 36 * v4; |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1558
diff
changeset
|
585 if (!item->IsBroken()) |
271 | 586 { |
587 //v28b = &v1->pInventoryItems[v4].uItemID; | |
588 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1685
diff
changeset
|
589 if (item->GetItemEquipType() == EQUIP_WAND) |
0 | 590 { |
295 | 591 if (item->uNumCharges <= 0) |
592 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 593 else |
295 | 594 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 595 } |
271 | 596 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
597 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 598 } |
271 | 599 } |
600 | |
295 | 601 //v30 = 0; |
602 //v29 = 0; | |
603 //v28 = 0; | |
271 | 604 //v7 = pMouse->uPointingObjectID; |
605 | |
606 int target_pid = pMouse->uPointingObjectID; | |
848 | 607 int target_type = PID_TYPE(target_pid), |
608 target_id = PID_ID(target_pid); | |
271 | 609 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
610 { | |
611 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 612 target_type = PID_TYPE(target_pid); |
613 target_id = PID_ID(target_pid); | |
271 | 614 } |
295 | 615 |
616 auto actor = &pActors[target_id]; | |
617 int actor_distance = 0; | |
271 | 618 if (target_type == OBJECT_Actor) |
619 { | |
295 | 620 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
621 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
622 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
623 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
624 if (actor_distance < 0) | |
625 actor_distance = 0; | |
626 } | |
627 | |
628 bool shooting_bow = false, | |
629 shotting_laser = false, | |
816 | 630 shooting_wand = false, |
631 melee_attack = false; | |
295 | 632 if (laser_weapon_item_id) |
633 { | |
634 shotting_laser = true; | |
490 | 635 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 636 } |
637 else if (wand_item_id) | |
638 { | |
639 shooting_wand = true; | |
640 | |
641 int main_hand_idx = player->pEquipment.uMainHand; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1340
diff
changeset
|
642 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 643 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1340
diff
changeset
|
644 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges) |
295 | 645 player->pEquipment.uMainHand = 0; |
646 } | |
303 | 647 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 648 { |
816 | 649 melee_attack = true; |
650 | |
303 | 651 Vec3_int_ a3; |
652 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
653 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
654 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
655 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
656 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
657 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
1080 | 658 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND)) |
295 | 659 _42FA66_do_explosive_impact( |
660 actor->vPosition.x, | |
661 actor->vPosition.y, | |
662 actor->vPosition.z + actor->uActorHeight / 2, | |
663 0, 512, uActiveCharacter); | |
303 | 664 } |
665 else if (bow_idx) | |
666 { | |
667 shooting_bow = true; | |
490 | 668 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 669 } |
670 else | |
671 { | |
816 | 672 melee_attack = true; |
303 | 673 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
674 } | |
675 | |
816 | 676 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 677 { |
816 | 678 int recovery = player->GetAttackRecoveryTime(false); |
303 | 679 if (recovery < 30 ) |
680 recovery = 30; | |
816 | 681 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 682 } |
683 | |
684 | |
685 int v34 = 0; | |
686 if (shooting_wand) | |
687 return; | |
688 else if (shooting_bow) | |
689 { | |
690 v34 = 5; | |
691 player->PlaySound(SPEECH_50, 0); | |
692 } | |
693 if (shotting_laser) | |
694 v34 = 7; | |
695 else | |
696 { | |
697 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 698 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1685
diff
changeset
|
699 v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); |
1448 | 700 pTurnEngine->ApplyPlayerAction(); |
295 | 701 } |
702 | |
703 switch (v34) | |
704 { | |
705 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
706 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
707 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
708 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
709 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
710 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
711 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
712 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
713 } | |
0 | 714 } |
715 | |
716 //----- (0042F184) -------------------------------------------------------- | |
295 | 717 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 718 { |
719 int v4; // edi@1 | |
720 stru319 *v5; // esi@1 | |
721 int v6; // eax@2 | |
722 int v7; // eax@4 | |
723 int result; // eax@5 | |
724 int *v9; // edx@8 | |
725 signed int v10; // ebx@10 | |
726 int v11; // edi@11 | |
727 Actor *v12; // esi@12 | |
728 unsigned __int16 v13; // ax@12 | |
729 int v14; // eax@22 | |
730 char v15; // zf@30 | |
731 int v16; // esi@32 | |
732 int v17; // ecx@34 | |
733 stru319 *v18; // eax@39 | |
734 int v19; // edx@39 | |
735 int v20; // ecx@41 | |
736 unsigned __int16 v21; // ax@42 | |
737 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
738 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
739 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
740 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
741 int *v26; // [sp+18h] [bp-14h]@8 | |
742 int v27; // [sp+1Ch] [bp-10h]@10 | |
743 int *v28; // [sp+20h] [bp-Ch]@10 | |
744 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
745 int v30; // [sp+28h] [bp-4h]@6 | |
746 int i; // [sp+38h] [bp+Ch]@33 | |
747 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
748 | |
749 v4 = 0; | |
750 v5 = this; | |
751 v24 = this; | |
752 if ( pRenderer->pRenderD3D ) | |
753 { | |
754 v6 = a3 != 0; | |
755 if ( a4 ) | |
756 LOBYTE(v6) = v6 | 8; | |
295 | 757 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 758 if ( v7 != -1 ) |
759 return (unsigned __int16)v7; | |
295 | 760 else return 0; |
0 | 761 } |
762 else | |
763 { | |
764 v30 = 0; | |
765 if ( pRenderer->pActiveZBuffer ) | |
766 { | |
692 | 767 v29 = viewparams->uScreen_topL_X; |
768 v23 = viewparams->uScreen_BttmR_X; | |
769 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 770 { |
692 | 771 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
772 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
773 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 774 do |
775 { | |
776 if ( (signed int)v29 < (signed int)v23 ) | |
777 { | |
778 v28 = v9; | |
779 v10 = v4; | |
780 v27 = v23 - v29; | |
781 do | |
782 { | |
783 v22 = *v28; | |
784 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
785 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 786 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
787 v12 = &pActors[PID_ID(v11)]; |
0 | 788 v13 = v12->uAIState; |
789 if ( v13 != 5 ) | |
790 { | |
791 if ( v13 != 4 | |
792 && v13 != 11 | |
793 && v13 != 19 | |
794 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
795 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 796 { |
797 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 798 && v22 <= pick_depth << 16 ) |
0 | 799 { |
800 v14 = 0; | |
801 if ( v10 > 0 ) | |
802 { | |
803 do | |
804 { | |
805 if ( dword_50BDA0[v14] == v11 ) | |
806 break; | |
807 ++v14; | |
808 } | |
809 while ( v14 < v30 ); | |
810 } | |
811 if ( v14 == v30 && v10 < 100 ) | |
812 { | |
813 ++v30; | |
814 dword_50BC10[v10] = v22; | |
815 dword_50BDA0[v10] = v11; | |
816 ++v10; | |
817 } | |
818 } | |
819 } | |
820 } | |
821 } | |
822 ++v28; | |
823 --v27; | |
824 } | |
825 while ( v27 ); | |
826 v4 = v30; | |
827 v5 = v24; | |
828 } | |
829 v9 = v26 + 640; | |
830 v15 = v25-- == 1; | |
831 v26 += 640; | |
832 } | |
833 while ( !v15 ); | |
834 } | |
835 if ( v4 > 0 ) | |
836 { | |
837 v32 = 1; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
838 v16 = (int)dword_50BC10.data(); |
0 | 839 do |
840 { | |
841 for ( i = v32; i < v4; ++i ) | |
842 { | |
843 v17 = dword_50BC10[i]; | |
844 if ( v17 < *(int *)v16 ) | |
845 { | |
846 dword_50BC10[i] = *(int *)v16; | |
847 *(int *)v16 = v17; | |
848 } | |
849 } | |
850 ++v32; | |
851 v16 += 4; | |
852 } | |
853 while ( v32 - 1 < v4 ); | |
854 v5 = v24; | |
855 if ( v4 > 0 ) | |
856 { | |
857 v18 = v24; | |
858 v19 = v4; | |
859 do | |
860 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
861 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF; |
0 | 862 v18 += 4; |
863 --v19; | |
864 } | |
865 while ( v19 ); | |
866 } | |
867 } | |
868 v20 = 0; | |
869 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
870 { | |
871 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
872 if ( v21 != 4 && v21 != 5 ) | |
873 break; | |
874 } | |
875 if ( v20 != v4 ) | |
876 { | |
877 result = 8 * *(int *)&v5[4 * v20].field_0; | |
878 LOBYTE(result) = result | 3; | |
879 return result; | |
880 } | |
881 } | |
882 } | |
883 return 0; | |
884 } | |
885 | |
886 //----- (0042F3D6) -------------------------------------------------------- | |
887 void InitializeTurnBasedAnimations(void *_this) | |
888 { | |
889 unsigned int *v1; // edi@1 | |
890 | |
891 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
892 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
893 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
894 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
895 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
896 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
897 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
898 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
899 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
900 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
901 v1 = pIconIDs_Turn.data(); |
0 | 902 do |
903 { | |
904 pIconsFrameTable->InitializeAnimation(*v1); | |
905 ++v1; | |
906 } | |
907 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
908 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
909 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
910 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
911 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
912 } | |
913 | |
914 //----- (0042F7EB) -------------------------------------------------------- | |
915 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) | |
916 { | |
1406 | 917 unsigned __int16 pObjectDescID; // ax@7 |
918 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1 | |
0 | 919 |
1406 | 920 pSpellObject.stru_24.Reset(); |
0 | 921 if ( a9 ) |
1406 | 922 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24)); |
923 pSpellObject.spell_skill = 0; | |
924 pSpellObject.spell_level = 0; | |
925 pSpellObject.spell_id = 0; | |
926 pSpellObject.field_54 = 0; | |
927 pSpellObject.uType = uSpriteID; | |
0 | 928 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1406 | 929 pObjectDescID = 0; |
0 | 930 else |
931 { | |
1406 | 932 pObjectDescID = 0; |
933 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) | |
0 | 934 { |
1406 | 935 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) |
936 pObjectDescID = i; | |
0 | 937 } |
938 } | |
1406 | 939 pSpellObject.uObjectDescID = pObjectDescID; |
940 pSpellObject.vPosition.x = x; | |
941 pSpellObject.vPosition.y = y; | |
942 pSpellObject.vPosition.z = z; | |
943 pSpellObject.uSoundID = 0; | |
944 pSpellObject.uAttributes = attributes; | |
945 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z); | |
946 pSpellObject.uSpriteFrameID = 0; | |
947 pSpellObject.spell_caster_pid = 0; | |
948 pSpellObject.spell_target_pid = 0; | |
949 if ( !(pSpellObject.uAttributes & 0x10) ) | |
950 { | |
951 if ( pItemsTable->uAllItemsCount ) | |
952 { | |
1729
f44b6e02e81c
pop-up window in character(paperdill) window, alchemy
Ritor1
parents:
1709
diff
changeset
|
953 for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i ) |
1406 | 954 { |
955 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) | |
956 pSpellObject.stru_24.uItemID = i; | |
957 } | |
958 } | |
959 } | |
0 | 960 if ( a7 ) |
961 { | |
962 if ( count > 0 ) | |
963 { | |
1406 | 964 for ( uint i = count; i; --i ) |
0 | 965 { |
1406 | 966 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; |
967 pSpellObject.Create((signed __int16)pSpellObject.uFacing, | |
968 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0); | |
969 | |
0 | 970 } |
971 } | |
972 } | |
973 else | |
974 { | |
1406 | 975 pSpellObject.uFacing = 0; |
0 | 976 if ( count > 0 ) |
977 { | |
1406 | 978 for ( uint i = count; i; --i ) |
0 | 979 { |
1406 | 980 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0); |
0 | 981 } |
982 } | |
983 } | |
1406 | 984 return true; |
0 | 985 } |
986 | |
987 //----- (0042F960) -------------------------------------------------------- | |
988 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
989 { | |
990 int v3; // ebx@1 | |
991 int v4; // edi@1 | |
992 signed int v5; // edx@1 | |
993 char *v6; // ecx@2 | |
994 unsigned __int16 v7; // ax@5 | |
995 signed int v8; // eax@6 | |
996 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
997 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 998 |
999 v3 = x; | |
1000 v4 = y; | |
1001 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1002 SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1003 //SpriteObject::SpriteObject(&a1); |
0 | 1004 a1.stru_24.Reset(); |
1005 | |
1006 v5 = 0; | |
822 | 1007 a1.spell_skill = 0; |
1008 a1.spell_level = 0; | |
1009 a1.spell_id = 0; | |
0 | 1010 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1011 a1.uType = 800; |
0 | 1012 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1013 { | |
1014 LABEL_5: | |
1015 v7 = 0; | |
1016 } | |
1017 else | |
1018 { | |
1019 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
1020 while ( *(short *)v6 != 800 ) | |
1021 { | |
1022 ++v5; | |
1023 v6 += 56; | |
1024 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
1025 goto LABEL_5; | |
1026 } | |
1027 v7 = v5; | |
1028 } | |
1029 a1.uObjectDescID = v7; | |
1030 a1.vPosition.x = v3; | |
1031 a1.vPosition.y = v4; | |
1032 a1.vPosition.z = z; | |
1033 a1.uSoundID = 0; | |
1034 a1.uAttributes = 0; | |
1035 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
1036 a1.uSpriteFrameID = 0; | |
822 | 1037 a1.spell_caster_pid = 0; |
823 | 1038 a1.spell_target_pid = 0; |
0 | 1039 v8 = a1.Create(0, 0, 0, 0); |
1040 if ( v8 != -1 ) | |
1041 { | |
1042 v9 = 8 * v8; | |
1043 LOBYTE(v9) = v9 | 2; | |
1044 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
1045 } | |
1046 } | |
1047 | |
810 | 1048 |
0 | 1049 |
1050 //----- (0042FA66) -------------------------------------------------------- | |
1546 | 1051 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) |
0 | 1052 { |
1053 int v6; // edi@1 | |
1054 int v7; // esi@1 | |
1055 char *v8; // ecx@2 | |
1056 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1057 //int v10; // eax@10 |
1546 | 1058 //signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1059 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1060 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 1061 int v14; // [sp+7Ch] [bp-4h]@1 |
1062 | |
1063 v6 = a1; | |
1064 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1065 SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1066 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1067 a1a.uType = 600; |
0 | 1068 a1a.stru_24.Reset(); |
1069 | |
822 | 1070 a1a.spell_id = SPELL_FIRE_FIREBALL; |
1071 a1a.spell_level = 8; | |
1072 a1a.spell_skill = 3; | |
0 | 1073 v14 = 0; |
1074 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
1075 { | |
1076 LABEL_5: | |
1077 v9 = 0; | |
1078 } | |
1079 else | |
1080 { | |
1081 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1082 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 1083 { |
1084 ++v14; | |
1085 v8 += 56; | |
1086 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
1087 goto LABEL_5; | |
1088 } | |
1089 v9 = v14; | |
1090 } | |
1091 a1a.uObjectDescID = v9; | |
1092 a1a.vPosition.x = v6; | |
1093 a1a.vPosition.y = v7; | |
1094 a1a.vPosition.z = a3; | |
1095 a1a.uAttributes = 0; | |
1096 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
1097 a1a.uSpriteFrameID = 0; | |
823 | 1098 a1a.spell_target_pid = 0; |
0 | 1099 a1a.field_60_distance_related_prolly_lod = 0; |
1100 a1a.uFacing = 0; | |
1101 a1a.uSoundID = 0; | |
1102 if ( a6 >= 1 || a6 <= 4 ) | |
1103 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1104 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 1105 } |
1106 else | |
1107 { | |
822 | 1108 a1a.spell_caster_pid = 0; |
0 | 1109 } |
1546 | 1110 |
1111 int id = a1a.Create(0, 0, 0, 0); | |
1112 if (id != -1) | |
1113 stru_50FE08.Add(PID(OBJECT_Item, id), | |
0 | 1114 a5, |
1115 SLOWORD(a1a.vPosition.x), | |
1116 SLOWORD(a1a.vPosition.y), | |
1117 SLOWORD(a1a.vPosition.z), | |
1118 0, | |
1119 0); | |
1120 } | |
1121 | |
1122 //----- (0042FB5C) -------------------------------------------------------- | |
1458 | 1123 bool _42FB5C_check_spell(signed int a1) |
0 | 1124 { |
1125 int v1; // ecx@3 | |
1126 int v2; // ecx@4 | |
1127 int v3; // ecx@5 | |
1128 int v4; // ecx@6 | |
1129 int v5; // ecx@7 | |
1130 int v6; // ecx@8 | |
1131 char v7; // zf@9 | |
1132 | |
1133 if ( a1 > 39 ) | |
1134 { | |
1135 if ( a1 > 77 ) | |
1136 { | |
1137 if ( a1 == 80 ) | |
1138 return 0; | |
1139 if ( a1 > 84 ) | |
1140 { | |
1141 if ( a1 <= 86 ) | |
1142 return 0; | |
1143 v7 = a1 == 95; | |
1144 goto LABEL_20; | |
1145 } | |
1146 } | |
1147 else | |
1148 { | |
1149 if ( a1 == 77 ) | |
1150 return 0; | |
1151 if ( a1 >= 46 ) | |
1152 { | |
1153 if ( a1 <= 47 || a1 == 51 ) | |
1154 return 0; | |
1155 v7 = a1 == 73; | |
1156 goto LABEL_20; | |
1157 } | |
1158 } | |
1159 return 1; | |
1160 } | |
1161 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
1162 return 1; | |
1163 v2 = v1 - 3; | |
1164 if ( !v2 ) | |
1165 return 0; | |
1166 v3 = v2 - 1; | |
1167 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
1168 return 1; | |
1169 v5 = v4 - 8; | |
1170 if ( !v5 ) | |
1171 return 0; | |
1172 v6 = v5 - 1; | |
1173 if ( !v6 ) | |
1174 return 1; | |
1175 v7 = v6 == 20; | |
1176 LABEL_20: | |
1177 if ( !v7 ) | |
1178 return 1; | |
1179 return 0; | |
1180 } | |
1181 | |
1182 //----- (0042FBDD) -------------------------------------------------------- | |
1458 | 1183 void sub_42FBDD() |
0 | 1184 { |
388 | 1185 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 1186 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
1187 pRenderer->Present(); | |
1188 } | |
1189 | |
1190 //----- (0042FC15) -------------------------------------------------------- | |
1458 | 1191 void CloseWindowBackground() |
0 | 1192 { |
388 | 1193 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 1194 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
1195 pRenderer->Present(); | |
1196 } | |
1197 | |
1198 //----- (0042FC4E) -------------------------------------------------------- | |
1575 | 1199 void ProcessInputActions() |
0 | 1200 { |
1201 char v4; // al@9 | |
1202 char v8; // bl@100 | |
1203 unsigned __int16 v9; // ax@102 | |
1204 int v10; // eax@103 | |
1205 char v14; // al@159 | |
1206 unsigned int v15; // eax@168 | |
1207 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
1208 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
1209 int v24; // [sp+4h] [bp-4h]@87 | |
1210 | |
1211 pGame->pKeyboardInstance->EnterCriticalSection(); | |
1212 auto pKeyboard = pGame->pKeyboardInstance; | |
1213 if (!bAlwaysRun) | |
1214 { | |
1215 if (pKeyboard->IsShiftHeld()) | |
1216 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
1217 else | |
1218 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
1219 } | |
1220 else | |
1221 { | |
1222 if (pKeyboard->IsShiftHeld()) | |
1223 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
1224 else | |
1225 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
1226 } | |
1227 | |
140 | 1228 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
1052 | 1229 |
1230 | |
1231 // WUT? double event trigger | |
1232 /*for ( uint i = 0; i < 30; ++i ) | |
998 | 1233 { |
1234 if ( pKeyActionMap->pToggleTypes[i] ) | |
1235 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1236 else | |
1237 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1052 | 1238 if ( v14 ) |
998 | 1239 { |
1052 | 1240 if (pCurrentScreen == SCREEN_GAME) |
998 | 1241 { |
1242 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
1243 continue; | |
1244 } | |
1245 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
1246 { | |
1247 v15 = pMessageQueue_50CBD0->uNumMessages; | |
1248 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1249 { | |
1250 v15 = 0; | |
1251 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
1252 { | |
1253 v15 = 1; | |
1254 pMessageQueue_50CBD0->uNumMessages = 0; | |
1255 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
1256 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
1257 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1258 ++pMessageQueue_50CBD0->uNumMessages; | |
1259 continue; | |
1260 } | |
1261 pMessageQueue_50CBD0->uNumMessages = 0; | |
1262 } | |
1263 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1264 } | |
1265 } | |
1052 | 1266 }*/ |
0 | 1267 if ( !pEventTimer->bPaused ) |
1268 { | |
998 | 1269 for ( uint i = 0; i < 30; ++i ) |
0 | 1270 { |
998 | 1271 inputAction = (InputAction)i; |
1272 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
1273 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 1274 else |
998 | 1275 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 1276 if ( v4 ) |
1277 { | |
1278 switch ( inputAction ) | |
1279 { | |
1280 case INPUT_MoveForward: | |
271 | 1281 if (pCurrentScreen != SCREEN_GAME) |
0 | 1282 break; |
1283 if (!pParty->bTurnBasedModeOn) | |
1284 { | |
140 | 1285 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 1286 partyAction = PARTY_RunForward; |
1287 else | |
1288 partyAction = PARTY_WalkForward; | |
998 | 1289 pPartyActionQueue->Add(partyAction); |
163 | 1290 break; |
1291 } | |
1340 | 1292 if (pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
163 | 1293 { |
1294 pTurnEngine->uActionPointsLeft -= 26; | |
1295 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
1296 partyAction = PARTY_RunForward; | |
1297 else | |
1298 partyAction = PARTY_WalkForward; | |
998 | 1299 pPartyActionQueue->Add(partyAction); |
163 | 1300 break; |
0 | 1301 } |
1302 break; | |
1303 case INPUT_MoveBackwards: | |
271 | 1304 if (pCurrentScreen != SCREEN_GAME) |
0 | 1305 break; |
1306 if (!pParty->bTurnBasedModeOn) | |
17 | 1307 { |
1308 if ( pParty->uFlags2 & 2 ) | |
1309 partyAction = PARTY_RunBackward; | |
1310 else | |
1311 partyAction = PARTY_WalkBackward; | |
998 | 1312 pPartyActionQueue->Add(partyAction); |
163 | 1313 break; |
17 | 1314 } |
1340 | 1315 if ( pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
0 | 1316 { |
1317 pTurnEngine->uActionPointsLeft -= 26; | |
1318 if ( pParty->uFlags2 & 2 ) | |
1319 partyAction = PARTY_RunBackward; | |
1320 else | |
1321 partyAction = PARTY_WalkBackward; | |
998 | 1322 pPartyActionQueue->Add(partyAction); |
163 | 1323 break; |
0 | 1324 } |
1325 break; | |
1326 case INPUT_StrafeLeft: | |
271 | 1327 if (pCurrentScreen != SCREEN_GAME) |
0 | 1328 break; |
1329 if (!pParty->bTurnBasedModeOn) | |
17 | 1330 { |
1331 partyAction = PARTY_StrafeLeft; | |
998 | 1332 pPartyActionQueue->Add(partyAction); |
163 | 1333 break; |
17 | 1334 } |
1340 | 1335 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1336 break; |
1337 pTurnEngine->uActionPointsLeft -= 26; | |
1338 partyAction = PARTY_StrafeLeft; | |
998 | 1339 pPartyActionQueue->Add(partyAction); |
1340 break; | |
0 | 1341 case INPUT_StrafeRight: |
271 | 1342 if (pCurrentScreen != SCREEN_GAME) |
0 | 1343 break; |
1344 if (!pParty->bTurnBasedModeOn) | |
17 | 1345 { |
1346 partyAction = PARTY_StrafeRight; | |
998 | 1347 pPartyActionQueue->Add(partyAction); |
163 | 1348 break; |
17 | 1349 } |
1340 | 1350 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1351 break; |
1352 pTurnEngine->uActionPointsLeft -= 26; | |
1353 partyAction = PARTY_StrafeRight; | |
998 | 1354 pPartyActionQueue->Add(partyAction); |
163 | 1355 break; |
0 | 1356 case INPUT_TurnLeft: |
271 | 1357 if (pCurrentScreen != SCREEN_GAME) |
0 | 1358 break; |
1359 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
1360 { | |
1361 if (pParty->bTurnBasedModeOn) | |
1362 { | |
1340 | 1363 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1364 break; |
1365 pTurnEngine->uActionPointsLeft -= 26; | |
1366 } | |
998 | 1367 partyAction = PARTY_StrafeLeft; |
0 | 1368 } |
1369 else | |
1370 { | |
1371 if ( pParty->uFlags2 & 2 ) | |
998 | 1372 partyAction = PARTY_FastTurnLeft; |
0 | 1373 else |
998 | 1374 partyAction = PARTY_TurnLeft; |
0 | 1375 } |
998 | 1376 pPartyActionQueue->Add(partyAction); |
0 | 1377 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
1378 { | |
271 | 1379 pWeather->OnPlayerTurn(10); |
0 | 1380 } |
1381 break; | |
1382 case INPUT_TurnRight: | |
271 | 1383 if (pCurrentScreen != SCREEN_GAME) |
0 | 1384 break; |
1385 if ( GetAsyncKeyState(17) ) // strafing | |
1386 { | |
1387 if (pParty->bTurnBasedModeOn) | |
1388 { | |
1340 | 1389 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1390 break; |
1391 pTurnEngine->uActionPointsLeft -= 26; | |
1392 } | |
998 | 1393 partyAction = PARTY_StrafeRight; |
0 | 1394 } |
1395 else | |
1396 { | |
1397 if ( pParty->uFlags2 & 2 ) | |
998 | 1398 partyAction = PARTY_FastTurnRight; |
0 | 1399 else |
998 | 1400 partyAction = PARTY_TurnRight; |
0 | 1401 } |
998 | 1402 pPartyActionQueue->Add(partyAction); |
0 | 1403 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
1404 { | |
271 | 1405 pWeather->OnPlayerTurn(-10); |
0 | 1406 } |
1407 break; | |
1408 case INPUT_Jump: | |
271 | 1409 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 1410 break; |
1411 partyAction = (PartyAction)12; | |
998 | 1412 pPartyActionQueue->Add(partyAction); |
163 | 1413 break; |
0 | 1414 case INPUT_Yell: |
187 | 1415 if (!pCurrentScreen && uActiveCharacter) |
0 | 1416 { |
1417 pParty->Yell(); | |
187 | 1418 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 1419 } |
187 | 1420 break; |
0 | 1421 case INPUT_Pass: |
1422 if ( pCurrentScreen ) | |
1423 break; | |
1340 | 1424 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3) |
17 | 1425 { |
1332 | 1426 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 1427 break; |
1428 } | |
0 | 1429 if ( uActiveCharacter ) |
1430 { | |
998 | 1431 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 1432 { |
998 | 1433 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 1434 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1435 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
1517 | 1436 CastSpellInfoHelpers::_427D48(); |
1448 | 1437 pTurnEngine->ApplyPlayerAction(); |
0 | 1438 } |
1439 } | |
1440 break; | |
998 | 1441 case INPUT_Combat://if press ENTER |
271 | 1442 if (pCurrentScreen == SCREEN_GAME) |
0 | 1443 { |
1444 if (pParty->bTurnBasedModeOn) | |
1445 { | |
1340 | 1446 if (pTurnEngine->turn_stage == 3 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 1447 { |
1448 pParty->bTurnBasedModeOn = 0; | |
1449 pTurnEngine->End(true); | |
1450 } | |
1451 } | |
1452 else | |
1453 { | |
1454 pTurnEngine->Start(); | |
1455 pParty->bTurnBasedModeOn = true; | |
1456 } | |
1457 } | |
1458 break; | |
1459 case INPUT_CastReady: | |
271 | 1460 if (pCurrentScreen != SCREEN_GAME) |
0 | 1461 break; |
1340 | 1462 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3) |
17 | 1463 { |
1332 | 1464 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 1465 break; |
1466 } | |
0 | 1467 if ( !uActiveCharacter ) |
1468 break; | |
998 | 1469 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 1470 if ( !v8 |
1471 || bUnderwater | |
998 | 1472 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
1473 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
1474 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
1475 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
1476 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
1477 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 1478 { |
998 | 1479 pPartyActionQueue = pPartyActionQueue; |
437 | 1480 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
1481 break; | |
0 | 1482 } |
1483 else | |
1484 { | |
1012 | 1485 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); |
0 | 1486 } |
1487 break; | |
1488 case INPUT_Attack: | |
271 | 1489 if (pCurrentScreen != SCREEN_GAME) |
0 | 1490 break; |
1340 | 1491 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3) |
998 | 1492 { |
1332 | 1493 pTurnEngine->field_18 |= TE_FLAG_8; |
998 | 1494 break; |
1495 } | |
1496 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 1497 break; |
1498 case INPUT_EventTrigger: | |
271 | 1499 if (pCurrentScreen == SCREEN_GAME) |
0 | 1500 { |
437 | 1501 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 1502 break; |
0 | 1503 } |
151 | 1504 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 1505 { |
1506 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1507 { | |
437 | 1508 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 1509 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
1510 { | |
1511 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 1512 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 1513 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
1575 | 1514 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 = 0; |
0 | 1515 ++pMessageQueue_50CBD0->uNumMessages; |
1516 break; | |
1517 } | |
437 | 1518 break; |
0 | 1519 } |
437 | 1520 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 1521 } |
1522 break; | |
1523 case INPUT_CharCycle: | |
1012 | 1524 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 1525 break; |
1575 | 1526 |
1012 | 1527 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); |
163 | 1528 break; |
0 | 1529 case INPUT_LookUp: |
1530 if ( pEventTimer->bPaused ) | |
1531 break; | |
1532 partyAction = (PartyAction)7; | |
998 | 1533 pPartyActionQueue->Add(partyAction); |
163 | 1534 break; |
0 | 1535 case INPUT_CenterView: |
1536 if ( pEventTimer->bPaused ) | |
1537 break; | |
1538 partyAction = (PartyAction)9; | |
998 | 1539 pPartyActionQueue->Add(partyAction); |
163 | 1540 break; |
0 | 1541 case INPUT_LookDown: |
1542 if ( pEventTimer->bPaused ) | |
1543 break; | |
1544 partyAction = (PartyAction)8; | |
998 | 1545 pPartyActionQueue->Add(partyAction); |
163 | 1546 break; |
0 | 1547 case INPUT_FlyUp: |
998 | 1548 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 1549 break; |
1550 partyAction = (PartyAction)13; | |
998 | 1551 pPartyActionQueue->Add(partyAction); |
163 | 1552 break; |
0 | 1553 case INPUT_Land: |
998 | 1554 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 1555 break; |
1556 partyAction = (PartyAction)15; | |
998 | 1557 pPartyActionQueue->Add(partyAction); |
163 | 1558 break; |
0 | 1559 case INPUT_FlyDown: |
1560 if ( !pCurrentScreen | |
1561 && !pEventTimer->bPaused ) | |
1562 { | |
1563 partyAction = (PartyAction)14; | |
998 | 1564 pPartyActionQueue->Add(partyAction); |
0 | 1565 } |
1566 break; | |
1567 case INPUT_ZoomIn: | |
1012 | 1568 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); |
163 | 1569 break; |
0 | 1570 case INPUT_ZoomOut: |
1012 | 1571 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); |
0 | 1572 break; |
1573 case INPUT_AlwaysRun: | |
1574 bAlwaysRun = bAlwaysRun == 0; | |
1575 break; | |
17 | 1576 default: |
1577 break; | |
0 | 1578 } |
1579 } | |
1580 } | |
1581 } | |
1582 } |