Mercurial > mm7
annotate mm7_6.cpp @ 1863:97b75e6100ff
Actor::Explode cleaned up
author | Grumpy7 |
---|---|
date | Mon, 14 Oct 2013 07:40:44 +0200 |
parents | a86c60679949 |
children | b6a7410ff0ef |
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 //----- (00426A5A) -------------------------------------------------------- | |
46 void stru319::LootActor(Actor *pActor) | |
47 { | |
48 signed int v2; // edi@1 | |
49 char v3; // zf@1 | |
50 unsigned int v4; // eax@13 | |
51 unsigned int v5; // esi@13 | |
52 int v6; // eax@14 | |
53 unsigned __int8 v7; // al@30 | |
54 Party *v8; // esi@34 | |
55 char *v9; // [sp-4h] [bp-3Ch]@10 | |
56 char *v10; // [sp-4h] [bp-3Ch]@31 | |
57 char *v11; // [sp-4h] [bp-3Ch]@38 | |
58 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
59 int v13; // [sp+30h] [bp-8h]@1 | |
60 int v14; // [sp+34h] [bp-4h]@1 | |
61 | |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
62 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 63 Dst.Reset(); |
64 v2 = 0; | |
65 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
66 v13 = 0; | |
67 v14 = 0; | |
68 if ( v3 ) | |
69 { | |
1419 | 70 if ( pActor->pMonsterInfo.uTreasureDiceRolls ) |
1786 | 71 { |
1419 | 72 do |
73 { | |
74 ++v2; | |
75 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
76 } | |
77 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
78 if ( v14 ) | |
79 { | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1826
diff
changeset
|
80 pParty->PartyFindsGold(v14, 0); |
1419 | 81 viewparams->bRedrawGameUI = 1; |
82 } | |
83 } | |
0 | 84 } |
85 else | |
86 { | |
1759 | 87 if ( pActor->array_000234[3].uItemID != 0 && pActor->array_000234[3].GetItemEquipType() == 18 ) |
1419 | 88 { |
89 v14 = pActor->array_000234[3].uSpecEnchantmentType; | |
90 pActor->array_000234[3].Reset(); | |
91 if ( v14 ) | |
92 { | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1826
diff
changeset
|
93 pParty->PartyFindsGold(v14, 0); |
1419 | 94 viewparams->bRedrawGameUI = 1; |
95 } | |
96 } | |
0 | 97 } |
98 if ( pActor->uCarriedItemID ) | |
99 { | |
100 Dst.Reset(); | |
101 Dst.uItemID = pActor->uCarriedItemID; | |
102 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
103 if ( v14 ) | |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1829
diff
changeset
|
104 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 105 else |
1843
2e6d3cd052e0
some char* cast removal + adding const_casts where appropriate
Grumpy7
parents:
1829
diff
changeset
|
106 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
107 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 108 v4 = Dst.uItemID; |
109 v5 = Dst.uItemID; | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1685
diff
changeset
|
110 if ( Dst.GetItemEquipType() == 12 ) |
0 | 111 { |
112 v5 = Dst.uItemID; | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1685
diff
changeset
|
113 v6 = rand() % 6 + Dst.GetDamageMod() + 1; |
0 | 114 Dst.uNumCharges = v6; |
115 Dst.uMaxCharges = v6; | |
116 v4 = Dst.uItemID; | |
117 } | |
118 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 119 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 120 pItemsTable->SetSpecialBonus(&Dst); |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
121 if ( !pParty->AddItemToParty(&Dst) ) |
0 | 122 pParty->SetHoldingItem(&Dst); |
123 pActor->uCarriedItemID = 0; | |
124 if ( pActor->array_000234[0].uItemID ) | |
125 { | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
126 if ( !pParty->AddItemToParty(pActor->array_000234) ) |
0 | 127 { |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
128 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 129 pParty->SetHoldingItem(pActor->array_000234); |
130 } | |
131 pActor->array_000234[0].Reset(); | |
132 } | |
133 if ( pActor->array_000234[1].uItemID ) | |
134 { | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
135 if ( !pParty->AddItemToParty(&pActor->array_000234[1]) ) |
0 | 136 { |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
137 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 138 pParty->SetHoldingItem(&pActor->array_000234[1]); |
139 } | |
140 pActor->array_000234[1].Reset(); | |
141 } | |
142 pActor->Remove(); | |
143 return; | |
144 } | |
145 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
146 { | |
147 if ( pActor->array_000234[3].uItemID ) | |
148 { | |
149 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
150 pActor->array_000234[3].Reset(); | |
151 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
152 if ( v14 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
153 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 154 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
155 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
156 ShowStatusBarString(pTmpBuf2.data(), 2u); |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
157 if ( !pParty->AddItemToParty(&Dst) ) |
0 | 158 pParty->SetHoldingItem(&Dst); |
159 v13 = 1; | |
160 } | |
1765 | 161 v8 = pParty; |
162 goto LABEL_45; | |
0 | 163 } |
164 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
165 { | |
166 v8 = pParty; | |
167 goto LABEL_45; | |
168 } | |
169 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
170 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
171 if ( v14 ) | |
1765 | 172 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Âû íàøëè ^I[%d] çîëîò^L[îé;ûõ;ûõ] è ïðåäìåò (%s)! |
0 | 173 else |
1765 | 174 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Âû íàøëè ^Pv[%s]! |
175 ShowStatusBarString(pTmpBuf2.data(), 2); | |
0 | 176 v8 = pParty; |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
177 if ( !pParty->AddItemToParty(&Dst) ) |
0 | 178 pParty->SetHoldingItem(&Dst); |
179 v13 = 1; | |
180 LABEL_45: | |
181 if ( pActor->array_000234[0].uItemID ) | |
182 { | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
183 if ( !v8->AddItemToParty(pActor->array_000234) ) |
0 | 184 { |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
185 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 186 v8->SetHoldingItem(pActor->array_000234); |
187 v13 = 1; | |
188 } | |
189 pActor->array_000234[0].Reset(); | |
190 } | |
191 if ( pActor->array_000234[1].uItemID ) | |
192 { | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1546
diff
changeset
|
193 if ( !v8->AddItemToParty(&pActor->array_000234[1]) ) |
0 | 194 { |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
195 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 196 v8->SetHoldingItem(&pActor->array_000234[1]); |
197 v13 = 1; | |
198 } | |
199 pActor->array_000234[1].Reset(); | |
200 } | |
201 if ( !v13 || rand() % 100 < 90 ) | |
1419 | 202 { |
203 pActor->Remove(); | |
204 } | |
0 | 205 } |
206 | |
207 //----- (00426E10) -------------------------------------------------------- | |
208 int stru319::which_player_would_attack(Actor *pActor) | |
209 { | |
210 signed int v2; // ebx@1 | |
211 int v3; // ecx@2 | |
212 signed int v4; // edx@3 | |
213 char v5; // zf@3 | |
214 unsigned int v6; // eax@3 | |
215 int v7; // eax@6 | |
216 int v8; // eax@7 | |
217 int v9; // eax@8 | |
218 int v10; // eax@9 | |
219 int v11; // eax@10 | |
220 int v12; // eax@11 | |
221 int v13; // esi@35 | |
222 signed int v14; // edi@37 | |
223 enum CHARACTER_RACE v15; // eax@44 | |
224 Player *v16; // ecx@47 | |
225 unsigned __int8 v17; // sf@50 | |
226 unsigned __int8 v18; // of@50 | |
227 int v19; // esi@52 | |
228 Player *v20; // ecx@53 | |
229 int result; // eax@57 | |
230 int v22[16]; // [sp+8h] [bp-140h]@3 | |
231 int v23[60]; // [sp+48h] [bp-100h]@48 | |
232 int v24; // [sp+138h] [bp-10h]@2 | |
233 int v25; // [sp+13Ch] [bp-Ch]@1 | |
234 int v26; // [sp+140h] [bp-8h]@1 | |
235 int v27; // [sp+144h] [bp-4h]@1 | |
236 | |
237 v27 = -1; | |
238 v26 = -1; | |
239 v25 = -1; | |
240 v2 = 0; | |
241 if ( pActor->pMonsterInfo.uAttackPreference ) | |
242 { | |
243 v3 = 0; | |
244 v24 = 0; | |
245 do | |
246 { | |
247 v4 = 1; | |
248 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
249 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
250 v22[v3] = v6; | |
251 if ( !v5 ) | |
252 { | |
253 if ( (signed int)v6 > 128 ) | |
254 { | |
255 switch ( v6 ) | |
256 { | |
257 case 0x100u: | |
258 v27 = 8; | |
259 break; | |
260 case 0x200u: | |
261 v25 = 0; | |
262 break; | |
263 case 0x400u: | |
264 v25 = 1; | |
265 break; | |
266 case 0x800u: | |
267 v26 = 0; | |
268 break; | |
269 case 0x1000u: | |
270 v26 = 1; | |
271 break; | |
272 case 0x2000u: | |
273 v26 = 3; | |
274 break; | |
275 case 0x4000u: | |
276 v26 = 2; | |
277 break; | |
278 } | |
279 } | |
280 else | |
281 { | |
282 if ( v6 == 128 ) | |
283 { | |
284 v27 = 4; | |
285 } | |
286 else | |
287 { | |
288 v7 = v6 - 1; | |
289 if ( v7 ) | |
290 { | |
291 v8 = v7 - 1; | |
292 if ( v8 ) | |
293 { | |
294 v9 = v8 - 2; | |
295 if ( v9 ) | |
296 { | |
297 v10 = v9 - 4; | |
298 if ( v10 ) | |
299 { | |
300 v11 = v10 - 8; | |
301 if ( v11 ) | |
302 { | |
303 v12 = v11 - 16; | |
304 if ( v12 ) | |
305 { | |
306 if ( v12 == 32 ) | |
307 v27 = 20; | |
308 } | |
309 else | |
310 { | |
311 v27 = 32; | |
312 } | |
313 } | |
314 else | |
315 { | |
316 v27 = 24; | |
317 } | |
318 } | |
319 else | |
320 { | |
321 v27 = 28; | |
322 } | |
323 } | |
324 else | |
325 { | |
326 v27 = 16; | |
327 } | |
328 } | |
329 else | |
330 { | |
331 v27 = 12; | |
332 } | |
333 } | |
334 else | |
335 { | |
336 v27 = 0; | |
337 } | |
338 } | |
339 } | |
340 v2 = 0; | |
341 v13 = 0; | |
342 while ( 1 ) | |
343 { | |
344 v14 = 0; | |
135 | 345 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 346 v14 = v4; |
347 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
348 v14 = v4; | |
349 if ( v26 != -1 ) | |
350 { | |
351 v15 = pPlayers[v13 + 1]->GetRace(); | |
352 if ( v26 == v15 ) | |
353 v14 = 1; | |
354 } | |
355 if ( v14 == 1 ) | |
356 { | |
357 v16 = pPlayers[v13 + 1]; | |
358 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
359 v23[v2++] = v13; | |
360 } | |
361 ++v13; | |
362 if ( v13 >= 4 ) | |
363 break; | |
364 v4 = 1; | |
365 } | |
366 } | |
367 v3 = v24 + 1; | |
368 v18 = __OFSUB__(v24 + 1, 15); | |
369 v17 = v24++ - 14 < 0; | |
370 } | |
371 while ( v17 ^ v18 ); | |
372 if ( v2 ) | |
1419 | 373 return v23[rand() % v2]; |
0 | 374 } |
375 v19 = 0; | |
376 do | |
377 { | |
378 v20 = pPlayers[v19 + 1]; | |
379 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
380 v23[v2++] = v19; | |
381 ++v19; | |
382 } | |
383 while ( v19 < 4 ); | |
384 if ( v2 ) | |
385 result = v23[rand() % v2]; | |
386 else | |
387 result = 0; | |
388 return result; | |
389 } | |
390 | |
391 //----- (0042704B) -------------------------------------------------------- | |
1450 | 392 int stru319::special_ability_use_check( struct Actor *pActor, int a2 ) |
393 { | |
0 | 394 stru319 *v3; // edi@1 |
395 signed int v4; // ebx@5 | |
396 signed int v5; // edi@5 | |
397 | |
398 v3 = this; | |
399 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
400 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
401 && rand() % 100 < 5 ) | |
402 pActor->_44FD29(a2); | |
403 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
404 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
405 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
406 return 2; | |
407 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
408 return 3; | |
1450 | 409 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance?1:0; |
0 | 410 } |
411 | |
412 //----- (00427102) -------------------------------------------------------- | |
413 int stru319::_427102(Actor *pActor, signed int a2) | |
414 { | |
415 unsigned __int8 v3; // cf@11 | |
416 unsigned __int8 v4; // zf@11 | |
417 SpellBuff *v6; // ecx@46 | |
89 | 418 Player *v7; // esi@49 |
0 | 419 signed int v8; // edx@50 |
89 | 420 SpellBuff *v9; // ecx@50 |
0 | 421 |
597 | 422 switch(a2) |
0 | 423 { |
597 | 424 case 77: |
425 { | |
426 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
427 return 0; | |
428 return 1; | |
429 } | |
430 case 80: | |
431 { | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1843
diff
changeset
|
432 v6 = pParty->pPartyBuffs.data(); |
597 | 433 while ( (signed __int64)v6->uExpireTime <= 0 ) |
434 { | |
435 ++v6; | |
1167 | 436 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] ) |
597 | 437 { |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1843
diff
changeset
|
438 v7 = pParty->pPlayers.data();//[0].pPlayerBuffs; |
597 | 439 v8 = 0; |
1826 | 440 v9 = v7->pPlayerBuffs.data(); |
597 | 441 while ( v9->uExpireTime <= 0i64 ) |
442 { | |
443 ++v8; | |
444 ++v9; | |
445 if ( v8 >= 24 ) | |
446 { | |
447 ++v7; | |
448 if ( v7 <= &pParty->pPlayers[3] ) | |
449 { | |
450 v8 = 0; | |
1826 | 451 v9 = v7->pPlayerBuffs.data(); |
597 | 452 } |
453 else | |
454 return 0; | |
455 } | |
456 } | |
457 return 1; | |
458 } | |
459 } | |
460 return 1; | |
461 } | |
462 case 85: | |
463 { | |
464 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
465 return 1; | |
466 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
467 return 0; | |
468 v3 = 0; | |
469 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
470 break; | |
471 } | |
472 case 86: | |
473 { | |
0 | 474 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 475 return 1; |
0 | 476 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 477 return 0; |
0 | 478 v3 = 0; |
479 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 480 break; |
481 } | |
482 case 95: | |
483 { | |
484 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
485 return 1; | |
0 | 486 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 487 return 0; |
0 | 488 v3 = 0; |
489 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 490 break; |
491 } | |
492 case 73: | |
493 { | |
494 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
495 return 1; | |
496 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
497 return 0; | |
498 v3 = 0; | |
499 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
500 break; | |
501 } | |
502 case 5: | |
503 { | |
504 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
505 return 1; | |
506 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
507 return 0; | |
508 v3 = 0; | |
509 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
510 break; | |
511 } | |
512 case 17: | |
513 { | |
514 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
515 return 1; | |
516 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
517 return 0; | |
518 v3 = 0; | |
519 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
520 break; | |
521 } | |
522 case 38: | |
89 | 523 { |
597 | 524 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
525 return 1; | |
526 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
527 return 0; | |
528 v3 = 0; | |
529 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
530 } | |
531 case 46: | |
532 { | |
533 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 534 return 1; |
597 | 535 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
536 return 0; | |
537 v3 = 0; | |
538 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
539 break; | |
540 } | |
541 case 47: | |
542 { | |
543 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
544 return 1; | |
545 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
546 return 0; | |
547 v3 = 0; | |
548 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
549 break; | |
550 } | |
551 case 51: | |
552 { | |
553 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
554 return 1; | |
555 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
556 { | |
89 | 557 v3 = 0; |
558 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
559 } | |
560 else | |
597 | 561 return 0; |
562 break; | |
563 } | |
564 default: | |
89 | 565 { |
597 | 566 return 1; |
89 | 567 } |
0 | 568 } |
569 if ( !(v3 | v4) ) | |
570 return 0; | |
571 return 1; | |
572 } | |
573 | |
574 //----- (004272F5) -------------------------------------------------------- | |
575 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
576 { | |
577 signed int v5; // esi@1 | |
578 signed int v6; // edi@1 | |
579 int v7; // esi@8 | |
580 int v8; // eax@9 | |
581 int v9; // edx@11 | |
582 int v10; // edx@13 | |
583 int v11; // esi@13 | |
584 unsigned __int8 v12; // sf@13 | |
585 unsigned __int8 v13; // of@13 | |
586 int v14; // edx@14 | |
587 int v15; // eax@14 | |
588 signed int result; // eax@17 | |
589 | |
590 v5 = pActor->pMonsterInfo.uAC; | |
591 v6 = 0; | |
592 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
593 v5 /= 2; | |
594 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
595 v6 = pActor->pActorBuffs[15].uPower; | |
596 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
597 v6 = pActor->pActorBuffs[16].uPower; | |
598 v7 = v6 + v5; | |
599 if ( a3 ) | |
600 v8 = pPlayer->GetRangedAttack(); | |
601 else | |
1685
2a309997c42f
Player::StealFromShop started cleanup, fixing a few errors caused by not commiting everything
Grumpy7
parents:
1637
diff
changeset
|
602 v8 = pPlayer->GetActualAttack(false); |
0 | 603 v9 = rand() % (v7 + 2 * v8 + 30); |
604 if ( a3 == 2 ) | |
605 { | |
606 v14 = a4 + v9; | |
607 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1419 | 608 v13 = __OFSUB__(v14, v15); |
609 v12 = v14 - v15 < 0; | |
0 | 610 } |
611 else | |
612 { | |
613 if ( a3 != 3 ) | |
614 { | |
615 v10 = a4 + v9; | |
616 v11 = v7 + 15; | |
617 v13 = __OFSUB__(v10, v11); | |
618 v12 = v10 - v11 < 0; | |
619 } | |
1419 | 620 else |
621 { | |
622 v14 = a4 + v9; | |
623 v15 = 2 * v7 + 30; | |
624 v13 = __OFSUB__(v14, v15); | |
625 v12 = v14 - v15 < 0; | |
626 } | |
0 | 627 } |
628 if ( v12 ^ v13 ) | |
629 result = 0; | |
630 else | |
631 result = 1; | |
632 return result; | |
633 } | |
634 | |
635 //----- (004273BB) -------------------------------------------------------- | |
636 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
637 { | |
638 Actor *v5; // ecx@1 | |
639 signed int v6; // ebx@1 | |
640 signed int v7; // esi@1 | |
641 unsigned __int8 v8; // zf@1 | |
642 unsigned __int8 v9; // sf@1 | |
643 int v10; // ebx@10 | |
644 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
645 | |
646 v5 = a2; | |
647 v6 = a2->pMonsterInfo.uAC; | |
648 v7 = 0; | |
649 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
650 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
651 a2a = 0; | |
652 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
653 v6 /= 2; | |
654 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
655 v7 = v5->pActorBuffs[14].uPower; | |
656 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
657 v7 = v5->pActorBuffs[16].uPower; | |
658 v10 = v7 + v6; | |
659 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
660 a2a = pActor->pActorBuffs[14].uPower; | |
661 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
662 a2a = pActor->pActorBuffs[17].uPower; | |
663 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
664 { | |
665 a2a += pActor->pActorBuffs[11].uPower; | |
666 pActor->pActorBuffs[11].Reset(); | |
667 } | |
668 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
669 } | |
670 | |
671 //----- (004274AD) -------------------------------------------------------- | |
672 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
673 { | |
674 signed int v3; // edi@1 | |
675 signed int v4; // esi@8 | |
676 int v5; // esi@8 | |
677 | |
678 v3 = 0; | |
679 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
680 v3 = pActor->pActorBuffs[14].uPower; | |
681 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
682 v3 = pActor->pActorBuffs[17].uPower; | |
683 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
684 { | |
685 v3 += pActor->pActorBuffs[11].uPower; | |
686 pActor->pActorBuffs[11].Reset(); | |
687 } | |
688 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
689 v5 = rand() % v4 + 1; | |
690 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
691 } | |
692 | |
693 //----- (00427546) -------------------------------------------------------- | |
694 int stru319::_427546(int a2) | |
695 { | |
696 int result; // eax@2 | |
697 | |
698 if ( a2 >= 0 ) | |
699 { | |
700 if ( a2 >= 1 ) | |
701 result = (a2 >= 2) + 2; | |
702 else | |
703 result = 1; | |
704 } | |
705 else | |
706 { | |
707 result = 0; | |
708 } | |
709 return result; | |
710 } | |
711 | |
712 //----- (0042756B) -------------------------------------------------------- | |
713 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
714 { | |
715 int v4; // edx@1 | |
716 int v5; // ecx@1 | |
717 signed int v6; // eax@4 | |
718 signed int result; // eax@17 | |
719 signed int v8; // esi@18 | |
720 | |
721 v4 = 0; | |
722 v5 = 0; | |
723 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
724 v5 = pActor->pActorBuffs[14].uPower; | |
725 switch ( a2 ) | |
726 { | |
727 case 0: | |
728 v6 = pActor->pMonsterInfo.uResFire; | |
1419 | 729 v4 = v5; |
730 break; | |
0 | 731 case 1: |
732 v6 = pActor->pMonsterInfo.uResAir; | |
1419 | 733 v4 = v5; |
734 break; | |
0 | 735 case 2: |
736 v6 = pActor->pMonsterInfo.uResWater; | |
1419 | 737 v4 = v5; |
738 break; | |
0 | 739 case 3: |
740 v6 = pActor->pMonsterInfo.uResEarth; | |
1419 | 741 v4 = v5; |
742 break; | |
1765 | 743 case 4: |
744 v6 = pActor->pMonsterInfo.uResPhysical; | |
745 break; | |
0 | 746 case 6: |
747 v6 = pActor->pMonsterInfo.uResSpirit; | |
748 break; | |
749 case 7: | |
750 v6 = pActor->pMonsterInfo.uResMind; | |
1419 | 751 v4 = v5; |
752 break; | |
0 | 753 case 8: |
754 v6 = pActor->pMonsterInfo.uResBody; | |
755 v4 = v5; | |
756 break; | |
757 case 9: | |
758 v6 = pActor->pMonsterInfo.uResLight; | |
759 break; | |
760 case 10: | |
761 v6 = pActor->pMonsterInfo.uResDark; | |
762 break; | |
763 default: | |
764 v6 = 0; | |
765 break; | |
766 } | |
767 if ( v6 < 200 ) | |
768 { | |
769 v8 = v4 + v6 + 30; | |
770 if ( rand() % v8 >= 30 ) | |
771 { | |
772 a3 >>= 1; | |
773 if ( rand() % v8 >= 30 ) | |
774 { | |
775 a3 >>= 1; | |
776 if ( rand() % v8 >= 30 ) | |
777 { | |
778 a3 >>= 1; | |
779 if ( rand() % v8 >= 30 ) | |
780 a3 >>= 1; | |
781 } | |
782 } | |
783 } | |
784 result = a3; | |
785 } | |
786 else | |
787 { | |
788 result = 0; | |
789 } | |
790 return result; | |
791 } | |
792 | |
793 //----- (00427662) -------------------------------------------------------- | |
794 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
795 { | |
1765 | 796 signed int resist; // esi@2 |
0 | 797 bool result; // eax@13 |
798 | |
799 switch ( uType ) | |
800 { | |
1765 | 801 case 0: |
802 resist = pActor->pMonsterInfo.uResFire; | |
803 break; | |
804 case 1: | |
805 resist = pActor->pMonsterInfo.uResAir; | |
806 break; | |
807 case 2: | |
808 resist = pActor->pMonsterInfo.uResWater; | |
809 break; | |
810 case 3: | |
811 resist = pActor->pMonsterInfo.uResEarth; | |
812 break; | |
813 case 4: | |
814 resist = pActor->pMonsterInfo.uResPhysical; | |
815 break; | |
816 case 6: | |
817 resist = pActor->pMonsterInfo.uResSpirit; | |
818 break; | |
819 case 7: | |
820 resist = pActor->pMonsterInfo.uResMind; | |
821 case 8: | |
822 resist = pActor->pMonsterInfo.uResBody; | |
823 break; | |
824 case 9: | |
825 resist = pActor->pMonsterInfo.uResLight; | |
826 break; | |
827 case 10: | |
828 resist = pActor->pMonsterInfo.uResDark; | |
0 | 829 break; |
830 default: | |
1419 | 831 return 1; |
0 | 832 } |
1765 | 833 if ( resist < 200 ) |
834 result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30; | |
1419 | 835 else |
1765 | 836 result = 0; |
0 | 837 return result; |
838 } | |
839 | |
840 //----- (0042EB8D) -------------------------------------------------------- | |
437 | 841 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 842 { |
482 | 843 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 844 if (uNumMessages < 40) |
845 { | |
437 | 846 files[uNumMessages] = file; |
847 lines[uNumMessages] = line; | |
848 | |
0 | 849 pMessages[uNumMessages].eType = msg; |
850 pMessages[uNumMessages].param = param; | |
851 pMessages[uNumMessages++].field_8 = a4; | |
852 } | |
853 } | |
854 | |
855 | |
856 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 857 int stru193_math::Sin(int angle) |
0 | 858 { |
323 | 859 return Cos(angle - this->uIntegerHalfPi); |
0 | 860 } |
861 | |
862 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 863 void _42ECB5_PlayerAttacksActor() |
0 | 864 { |
271 | 865 //unsigned int v0; // ebx@1 |
866 //Player *v1; // esi@1 | |
867 //bool result; // eax@1 | |
295 | 868 //int v3; // edi@2 |
271 | 869 //unsigned int v4; // eax@7 |
0 | 870 char *v5; // eax@8 |
271 | 871 //int v6; // ecx@9 |
872 //signed int v7; // eax@16 | |
295 | 873 //Actor *v8; // edi@20 |
0 | 874 unsigned int v9; // ecx@21 |
295 | 875 //char *v10; // eax@26 |
0 | 876 char *v11; // eax@26 |
877 unsigned int v12; // eax@47 | |
295 | 878 //char *v13; // eax@47 |
879 //char *v14; // eax@47 | |
880 //unsigned int v15; // ebx@54 | |
881 //int v16; // [sp-10h] [bp-4Ch]@24 | |
882 //int v17; // [sp-10h] [bp-4Ch]@44 | |
883 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
884 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
885 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
886 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
887 //int v22; // [sp-4h] [bp-40h]@24 | |
888 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 889 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 890 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 891 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
892 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 893 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 894 //unsigned int *v28b; |
295 | 895 //int v29; // [sp+24h] [bp-18h]@16 |
896 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 897 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 898 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 899 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 900 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 901 |
271 | 902 //v0 = uActiveCharacter; |
903 //v27 = 6972 * uActiveCharacter; | |
904 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
905 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
906 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
907 if (!player->CanAct()) | |
908 return; | |
909 | |
1517 | 910 CastSpellInfoHelpers::_427D48(); |
295 | 911 //v3 = 0; |
271 | 912 if (pParty->Invisible()) |
913 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
914 | |
915 //v31 = player->pEquipment.uBow; | |
916 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
|
917 if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken()) |
271 | 918 bow_idx = 0; |
919 | |
295 | 920 //v32 = 0; |
921 int wand_item_id = 0; | |
271 | 922 //v33 = 0; |
923 //v4 = v1->pEquipment.uMainHand; | |
924 int laser_weapon_item_id = 0; | |
925 | |
926 int main_hand_idx = player->pEquipment.uMainHand; | |
927 if (main_hand_idx) | |
0 | 928 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1340
diff
changeset
|
929 auto item = &player->pInventoryItemList[main_hand_idx - 1]; |
112 | 930 //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
|
931 if (!item->IsBroken()) |
271 | 932 { |
933 //v28b = &v1->pInventoryItems[v4].uItemID; | |
934 //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
|
935 if (item->GetItemEquipType() == EQUIP_WAND) |
0 | 936 { |
295 | 937 if (item->uNumCharges <= 0) |
938 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 939 else |
295 | 940 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 941 } |
271 | 942 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
943 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 944 } |
271 | 945 } |
946 | |
295 | 947 //v30 = 0; |
948 //v29 = 0; | |
949 //v28 = 0; | |
271 | 950 //v7 = pMouse->uPointingObjectID; |
951 | |
952 int target_pid = pMouse->uPointingObjectID; | |
848 | 953 int target_type = PID_TYPE(target_pid), |
954 target_id = PID_ID(target_pid); | |
271 | 955 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
956 { | |
957 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 958 target_type = PID_TYPE(target_pid); |
959 target_id = PID_ID(target_pid); | |
271 | 960 } |
295 | 961 |
962 auto actor = &pActors[target_id]; | |
963 int actor_distance = 0; | |
271 | 964 if (target_type == OBJECT_Actor) |
965 { | |
295 | 966 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
967 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
968 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
969 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
970 if (actor_distance < 0) | |
971 actor_distance = 0; | |
972 } | |
973 | |
974 bool shooting_bow = false, | |
975 shotting_laser = false, | |
816 | 976 shooting_wand = false, |
977 melee_attack = false; | |
295 | 978 if (laser_weapon_item_id) |
979 { | |
980 shotting_laser = true; | |
490 | 981 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 982 } |
983 else if (wand_item_id) | |
984 { | |
985 shooting_wand = true; | |
986 | |
987 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
|
988 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 989 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1340
diff
changeset
|
990 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges) |
295 | 991 player->pEquipment.uMainHand = 0; |
992 } | |
303 | 993 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 994 { |
816 | 995 melee_attack = true; |
996 | |
303 | 997 Vec3_int_ a3; |
998 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
999 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
1000 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
1001 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
1002 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1003 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
1080 | 1004 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND)) |
295 | 1005 _42FA66_do_explosive_impact( |
1006 actor->vPosition.x, | |
1007 actor->vPosition.y, | |
1008 actor->vPosition.z + actor->uActorHeight / 2, | |
1009 0, 512, uActiveCharacter); | |
303 | 1010 } |
1011 else if (bow_idx) | |
1012 { | |
1013 shooting_bow = true; | |
490 | 1014 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 1015 } |
1016 else | |
1017 { | |
816 | 1018 melee_attack = true; |
303 | 1019 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
1020 } | |
1021 | |
816 | 1022 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 1023 { |
816 | 1024 int recovery = player->GetAttackRecoveryTime(false); |
303 | 1025 if (recovery < 30 ) |
1026 recovery = 30; | |
816 | 1027 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 1028 } |
1029 | |
1030 | |
1031 int v34 = 0; | |
1032 if (shooting_wand) | |
1033 return; | |
1034 else if (shooting_bow) | |
1035 { | |
1036 v34 = 5; | |
1037 player->PlaySound(SPEECH_50, 0); | |
1038 } | |
1039 if (shotting_laser) | |
1040 v34 = 7; | |
1041 else | |
1042 { | |
1043 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 1044 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
|
1045 v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); |
1448 | 1046 pTurnEngine->ApplyPlayerAction(); |
295 | 1047 } |
1048 | |
1049 switch (v34) | |
1050 { | |
1051 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
1052 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
1053 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
1054 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
1055 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
1056 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
1057 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
1058 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
1059 } | |
0 | 1060 } |
1061 | |
1062 //----- (0042F184) -------------------------------------------------------- | |
295 | 1063 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 1064 { |
1065 int v4; // edi@1 | |
1066 stru319 *v5; // esi@1 | |
1067 int v6; // eax@2 | |
1068 int v7; // eax@4 | |
1069 int result; // eax@5 | |
1070 int *v9; // edx@8 | |
1071 signed int v10; // ebx@10 | |
1072 int v11; // edi@11 | |
1073 Actor *v12; // esi@12 | |
1074 unsigned __int16 v13; // ax@12 | |
1075 int v14; // eax@22 | |
1076 char v15; // zf@30 | |
1077 int v16; // esi@32 | |
1078 int v17; // ecx@34 | |
1079 stru319 *v18; // eax@39 | |
1080 int v19; // edx@39 | |
1081 int v20; // ecx@41 | |
1082 unsigned __int16 v21; // ax@42 | |
1083 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
1084 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
1085 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
1086 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
1087 int *v26; // [sp+18h] [bp-14h]@8 | |
1088 int v27; // [sp+1Ch] [bp-10h]@10 | |
1089 int *v28; // [sp+20h] [bp-Ch]@10 | |
1090 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
1091 int v30; // [sp+28h] [bp-4h]@6 | |
1092 int i; // [sp+38h] [bp+Ch]@33 | |
1093 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
1094 | |
1095 v4 = 0; | |
1096 v5 = this; | |
1097 v24 = this; | |
1098 if ( pRenderer->pRenderD3D ) | |
1099 { | |
1100 v6 = a3 != 0; | |
1101 if ( a4 ) | |
1102 LOBYTE(v6) = v6 | 8; | |
295 | 1103 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 1104 if ( v7 != -1 ) |
1105 return (unsigned __int16)v7; | |
295 | 1106 else return 0; |
0 | 1107 } |
1108 else | |
1109 { | |
1110 v30 = 0; | |
1111 if ( pRenderer->pActiveZBuffer ) | |
1112 { | |
692 | 1113 v29 = viewparams->uScreen_topL_X; |
1114 v23 = viewparams->uScreen_BttmR_X; | |
1115 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 1116 { |
692 | 1117 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
1118 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
1119 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 1120 do |
1121 { | |
1122 if ( (signed int)v29 < (signed int)v23 ) | |
1123 { | |
1124 v28 = v9; | |
1125 v10 = v4; | |
1126 v27 = v23 - v29; | |
1127 do | |
1128 { | |
1129 v22 = *v28; | |
1130 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1131 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 1132 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1133 v12 = &pActors[PID_ID(v11)]; |
0 | 1134 v13 = v12->uAIState; |
1135 if ( v13 != 5 ) | |
1136 { | |
1137 if ( v13 != 4 | |
1138 && v13 != 11 | |
1139 && v13 != 19 | |
1140 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1141 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 1142 { |
1143 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 1144 && v22 <= pick_depth << 16 ) |
0 | 1145 { |
1146 v14 = 0; | |
1147 if ( v10 > 0 ) | |
1148 { | |
1149 do | |
1150 { | |
1151 if ( dword_50BDA0[v14] == v11 ) | |
1152 break; | |
1153 ++v14; | |
1154 } | |
1155 while ( v14 < v30 ); | |
1156 } | |
1157 if ( v14 == v30 && v10 < 100 ) | |
1158 { | |
1159 ++v30; | |
1160 dword_50BC10[v10] = v22; | |
1161 dword_50BDA0[v10] = v11; | |
1162 ++v10; | |
1163 } | |
1164 } | |
1165 } | |
1166 } | |
1167 } | |
1168 ++v28; | |
1169 --v27; | |
1170 } | |
1171 while ( v27 ); | |
1172 v4 = v30; | |
1173 v5 = v24; | |
1174 } | |
1175 v9 = v26 + 640; | |
1176 v15 = v25-- == 1; | |
1177 v26 += 640; | |
1178 } | |
1179 while ( !v15 ); | |
1180 } | |
1181 if ( v4 > 0 ) | |
1182 { | |
1183 v32 = 1; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1184 v16 = (int)dword_50BC10.data(); |
0 | 1185 do |
1186 { | |
1187 for ( i = v32; i < v4; ++i ) | |
1188 { | |
1189 v17 = dword_50BC10[i]; | |
1190 if ( v17 < *(int *)v16 ) | |
1191 { | |
1192 dword_50BC10[i] = *(int *)v16; | |
1193 *(int *)v16 = v17; | |
1194 } | |
1195 } | |
1196 ++v32; | |
1197 v16 += 4; | |
1198 } | |
1199 while ( v32 - 1 < v4 ); | |
1200 v5 = v24; | |
1201 if ( v4 > 0 ) | |
1202 { | |
1203 v18 = v24; | |
1204 v19 = v4; | |
1205 do | |
1206 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1207 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF; |
0 | 1208 v18 += 4; |
1209 --v19; | |
1210 } | |
1211 while ( v19 ); | |
1212 } | |
1213 } | |
1214 v20 = 0; | |
1215 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
1216 { | |
1217 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
1218 if ( v21 != 4 && v21 != 5 ) | |
1219 break; | |
1220 } | |
1221 if ( v20 != v4 ) | |
1222 { | |
1223 result = 8 * *(int *)&v5[4 * v20].field_0; | |
1224 LOBYTE(result) = result | 3; | |
1225 return result; | |
1226 } | |
1227 } | |
1228 } | |
1229 return 0; | |
1230 } | |
1231 | |
1232 //----- (0042F3D6) -------------------------------------------------------- | |
1233 void InitializeTurnBasedAnimations(void *_this) | |
1234 { | |
1235 unsigned int *v1; // edi@1 | |
1236 | |
1237 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
1238 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
1239 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
1240 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
1241 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
1242 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
1243 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
1244 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
1245 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
1246 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1247 v1 = pIconIDs_Turn.data(); |
0 | 1248 do |
1249 { | |
1250 pIconsFrameTable->InitializeAnimation(*v1); | |
1251 ++v1; | |
1252 } | |
1253 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
1254 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
1255 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
1256 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
1257 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
1258 } | |
1259 | |
1260 //----- (0042F4DA) -------------------------------------------------------- | |
1458 | 1261 int _42F4DA_check_actor_proximity() |
0 | 1262 { |
1263 signed int v0; // edi@1 | |
82 | 1264 Actor *v1; // esi@4 |
0 | 1265 int v2; // ebx@5 |
1266 int v3; // eax@5 | |
1267 int v4; // ebx@5 | |
1268 unsigned int v5; // ecx@5 | |
1269 int v6; // edx@6 | |
1270 unsigned int v7; // edx@8 | |
1271 unsigned int v8; // edx@10 | |
1272 __int16 v9; // ax@12 | |
1273 signed int result; // eax@20 | |
1274 int v11; // [sp+Ch] [bp-10h]@5 | |
1275 int v12; // [sp+10h] [bp-Ch]@5 | |
1276 signed int v13; // [sp+14h] [bp-8h]@3 | |
1277 | |
1278 v0 = 5120; | |
1279 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1280 v0 = 2560; | |
1281 v13 = 0; | |
1282 if ( (signed int)uNumActors <= 0 ) | |
1283 { | |
1284 result = 0; | |
1285 } | |
1286 else | |
1287 { | |
1202 | 1288 v1 = pActors.data(); |
0 | 1289 while ( 1 ) |
1290 { | |
82 | 1291 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
1292 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
1293 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 1294 v3 = v2; |
1295 v4 = v11; | |
1296 v5 = v12; | |
1297 if ( v3 < v11 ) | |
1298 { | |
1299 v6 = v3; | |
1300 v3 = v11; | |
1301 v4 = v6; | |
1302 } | |
1303 if ( v3 < v12 ) | |
1304 { | |
1305 v7 = v3; | |
1306 v3 = v12; | |
1307 v5 = v7; | |
1308 } | |
1309 if ( v4 < (signed int)v5 ) | |
1310 { | |
1311 v8 = v5; | |
1312 v5 = v4; | |
1313 v4 = v8; | |
1314 } | |
1315 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
1316 { | |
82 | 1317 v9 = v1->uAIState; |
1318 if ( v1->uAIState != 5 ) | |
0 | 1319 { |
1320 if ( v9 != 4 | |
1321 && v9 != 11 | |
1322 && v9 != 19 | |
1323 && v9 != 17 | |
82 | 1324 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 1325 break; |
1326 } | |
1327 } | |
1328 ++v13; | |
82 | 1329 ++v1; |
0 | 1330 if ( v13 >= (signed int)uNumActors ) |
1419 | 1331 return 0; |
0 | 1332 } |
1333 result = 1; | |
1334 } | |
1335 return result; | |
1336 } | |
1337 | |
1338 //----- (0042F7EB) -------------------------------------------------------- | |
1339 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) | |
1340 { | |
1406 | 1341 unsigned __int16 pObjectDescID; // ax@7 |
1342 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1 | |
0 | 1343 |
1406 | 1344 pSpellObject.stru_24.Reset(); |
0 | 1345 if ( a9 ) |
1406 | 1346 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24)); |
1347 pSpellObject.spell_skill = 0; | |
1348 pSpellObject.spell_level = 0; | |
1349 pSpellObject.spell_id = 0; | |
1350 pSpellObject.field_54 = 0; | |
1351 pSpellObject.uType = uSpriteID; | |
0 | 1352 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1406 | 1353 pObjectDescID = 0; |
0 | 1354 else |
1355 { | |
1406 | 1356 pObjectDescID = 0; |
1357 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) | |
0 | 1358 { |
1406 | 1359 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) |
1360 pObjectDescID = i; | |
0 | 1361 } |
1362 } | |
1406 | 1363 pSpellObject.uObjectDescID = pObjectDescID; |
1364 pSpellObject.vPosition.x = x; | |
1365 pSpellObject.vPosition.y = y; | |
1366 pSpellObject.vPosition.z = z; | |
1367 pSpellObject.uSoundID = 0; | |
1368 pSpellObject.uAttributes = attributes; | |
1369 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z); | |
1370 pSpellObject.uSpriteFrameID = 0; | |
1371 pSpellObject.spell_caster_pid = 0; | |
1372 pSpellObject.spell_target_pid = 0; | |
1373 if ( !(pSpellObject.uAttributes & 0x10) ) | |
1374 { | |
1375 if ( pItemsTable->uAllItemsCount ) | |
1376 { | |
1729
f44b6e02e81c
pop-up window in character(paperdill) window, alchemy
Ritor1
parents:
1709
diff
changeset
|
1377 for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i ) |
1406 | 1378 { |
1379 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) | |
1380 pSpellObject.stru_24.uItemID = i; | |
1381 } | |
1382 } | |
1383 } | |
0 | 1384 if ( a7 ) |
1385 { | |
1386 if ( count > 0 ) | |
1387 { | |
1406 | 1388 for ( uint i = count; i; --i ) |
0 | 1389 { |
1406 | 1390 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; |
1391 pSpellObject.Create((signed __int16)pSpellObject.uFacing, | |
1392 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0); | |
1393 | |
0 | 1394 } |
1395 } | |
1396 } | |
1397 else | |
1398 { | |
1406 | 1399 pSpellObject.uFacing = 0; |
0 | 1400 if ( count > 0 ) |
1401 { | |
1406 | 1402 for ( uint i = count; i; --i ) |
0 | 1403 { |
1406 | 1404 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0); |
0 | 1405 } |
1406 } | |
1407 } | |
1406 | 1408 return true; |
0 | 1409 } |
1410 | |
1411 //----- (0042F960) -------------------------------------------------------- | |
1412 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
1413 { | |
1414 int v3; // ebx@1 | |
1415 int v4; // edi@1 | |
1416 signed int v5; // edx@1 | |
1417 char *v6; // ecx@2 | |
1418 unsigned __int16 v7; // ax@5 | |
1419 signed int v8; // eax@6 | |
1420 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1421 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 1422 |
1423 v3 = x; | |
1424 v4 = y; | |
1425 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1426 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
|
1427 //SpriteObject::SpriteObject(&a1); |
0 | 1428 a1.stru_24.Reset(); |
1429 | |
1430 v5 = 0; | |
822 | 1431 a1.spell_skill = 0; |
1432 a1.spell_level = 0; | |
1433 a1.spell_id = 0; | |
0 | 1434 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1435 a1.uType = 800; |
0 | 1436 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1437 { | |
1438 LABEL_5: | |
1439 v7 = 0; | |
1440 } | |
1441 else | |
1442 { | |
1443 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
1444 while ( *(short *)v6 != 800 ) | |
1445 { | |
1446 ++v5; | |
1447 v6 += 56; | |
1448 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
1449 goto LABEL_5; | |
1450 } | |
1451 v7 = v5; | |
1452 } | |
1453 a1.uObjectDescID = v7; | |
1454 a1.vPosition.x = v3; | |
1455 a1.vPosition.y = v4; | |
1456 a1.vPosition.z = z; | |
1457 a1.uSoundID = 0; | |
1458 a1.uAttributes = 0; | |
1459 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
1460 a1.uSpriteFrameID = 0; | |
822 | 1461 a1.spell_caster_pid = 0; |
823 | 1462 a1.spell_target_pid = 0; |
0 | 1463 v8 = a1.Create(0, 0, 0, 0); |
1464 if ( v8 != -1 ) | |
1465 { | |
1466 v9 = 8 * v8; | |
1467 LOBYTE(v9) = v9 | 2; | |
1468 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
1469 } | |
1470 } | |
1471 | |
810 | 1472 |
0 | 1473 |
1474 //----- (0042FA66) -------------------------------------------------------- | |
1546 | 1475 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) |
0 | 1476 { |
1477 int v6; // edi@1 | |
1478 int v7; // esi@1 | |
1479 char *v8; // ecx@2 | |
1480 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1481 //int v10; // eax@10 |
1546 | 1482 //signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1483 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1484 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 1485 int v14; // [sp+7Ch] [bp-4h]@1 |
1486 | |
1487 v6 = a1; | |
1488 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1489 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
|
1490 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1491 a1a.uType = 600; |
0 | 1492 a1a.stru_24.Reset(); |
1493 | |
822 | 1494 a1a.spell_id = SPELL_FIRE_FIREBALL; |
1495 a1a.spell_level = 8; | |
1496 a1a.spell_skill = 3; | |
0 | 1497 v14 = 0; |
1498 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
1499 { | |
1500 LABEL_5: | |
1501 v9 = 0; | |
1502 } | |
1503 else | |
1504 { | |
1505 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
1506 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 1507 { |
1508 ++v14; | |
1509 v8 += 56; | |
1510 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
1511 goto LABEL_5; | |
1512 } | |
1513 v9 = v14; | |
1514 } | |
1515 a1a.uObjectDescID = v9; | |
1516 a1a.vPosition.x = v6; | |
1517 a1a.vPosition.y = v7; | |
1518 a1a.vPosition.z = a3; | |
1519 a1a.uAttributes = 0; | |
1520 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
1521 a1a.uSpriteFrameID = 0; | |
823 | 1522 a1a.spell_target_pid = 0; |
0 | 1523 a1a.field_60_distance_related_prolly_lod = 0; |
1524 a1a.uFacing = 0; | |
1525 a1a.uSoundID = 0; | |
1526 if ( a6 >= 1 || a6 <= 4 ) | |
1527 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1528 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 1529 } |
1530 else | |
1531 { | |
822 | 1532 a1a.spell_caster_pid = 0; |
0 | 1533 } |
1546 | 1534 |
1535 int id = a1a.Create(0, 0, 0, 0); | |
1536 if (id != -1) | |
1537 stru_50FE08.Add(PID(OBJECT_Item, id), | |
0 | 1538 a5, |
1539 SLOWORD(a1a.vPosition.x), | |
1540 SLOWORD(a1a.vPosition.y), | |
1541 SLOWORD(a1a.vPosition.z), | |
1542 0, | |
1543 0); | |
1544 } | |
1545 | |
1546 //----- (0042FB5C) -------------------------------------------------------- | |
1458 | 1547 bool _42FB5C_check_spell(signed int a1) |
0 | 1548 { |
1549 int v1; // ecx@3 | |
1550 int v2; // ecx@4 | |
1551 int v3; // ecx@5 | |
1552 int v4; // ecx@6 | |
1553 int v5; // ecx@7 | |
1554 int v6; // ecx@8 | |
1555 char v7; // zf@9 | |
1556 | |
1557 if ( a1 > 39 ) | |
1558 { | |
1559 if ( a1 > 77 ) | |
1560 { | |
1561 if ( a1 == 80 ) | |
1562 return 0; | |
1563 if ( a1 > 84 ) | |
1564 { | |
1565 if ( a1 <= 86 ) | |
1566 return 0; | |
1567 v7 = a1 == 95; | |
1568 goto LABEL_20; | |
1569 } | |
1570 } | |
1571 else | |
1572 { | |
1573 if ( a1 == 77 ) | |
1574 return 0; | |
1575 if ( a1 >= 46 ) | |
1576 { | |
1577 if ( a1 <= 47 || a1 == 51 ) | |
1578 return 0; | |
1579 v7 = a1 == 73; | |
1580 goto LABEL_20; | |
1581 } | |
1582 } | |
1583 return 1; | |
1584 } | |
1585 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
1586 return 1; | |
1587 v2 = v1 - 3; | |
1588 if ( !v2 ) | |
1589 return 0; | |
1590 v3 = v2 - 1; | |
1591 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
1592 return 1; | |
1593 v5 = v4 - 8; | |
1594 if ( !v5 ) | |
1595 return 0; | |
1596 v6 = v5 - 1; | |
1597 if ( !v6 ) | |
1598 return 1; | |
1599 v7 = v6 == 20; | |
1600 LABEL_20: | |
1601 if ( !v7 ) | |
1602 return 1; | |
1603 return 0; | |
1604 } | |
1605 | |
1606 //----- (0042FBDD) -------------------------------------------------------- | |
1458 | 1607 void sub_42FBDD() |
0 | 1608 { |
388 | 1609 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 1610 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
1611 pRenderer->Present(); | |
1612 } | |
1613 | |
1614 //----- (0042FC15) -------------------------------------------------------- | |
1458 | 1615 void CloseWindowBackground() |
0 | 1616 { |
388 | 1617 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 1618 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
1619 pRenderer->Present(); | |
1620 } | |
1621 | |
1622 //----- (0042FC4E) -------------------------------------------------------- | |
1575 | 1623 void ProcessInputActions() |
0 | 1624 { |
1625 char v4; // al@9 | |
1626 char v8; // bl@100 | |
1627 unsigned __int16 v9; // ax@102 | |
1628 int v10; // eax@103 | |
1629 char v14; // al@159 | |
1630 unsigned int v15; // eax@168 | |
1631 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
1632 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
1633 int v24; // [sp+4h] [bp-4h]@87 | |
1634 | |
1635 pGame->pKeyboardInstance->EnterCriticalSection(); | |
1636 auto pKeyboard = pGame->pKeyboardInstance; | |
1637 if (!bAlwaysRun) | |
1638 { | |
1639 if (pKeyboard->IsShiftHeld()) | |
1640 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
1641 else | |
1642 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
1643 } | |
1644 else | |
1645 { | |
1646 if (pKeyboard->IsShiftHeld()) | |
1647 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
1648 else | |
1649 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
1650 } | |
1651 | |
140 | 1652 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
1052 | 1653 |
1654 | |
1655 // WUT? double event trigger | |
1656 /*for ( uint i = 0; i < 30; ++i ) | |
998 | 1657 { |
1658 if ( pKeyActionMap->pToggleTypes[i] ) | |
1659 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1660 else | |
1661 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1052 | 1662 if ( v14 ) |
998 | 1663 { |
1052 | 1664 if (pCurrentScreen == SCREEN_GAME) |
998 | 1665 { |
1666 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
1667 continue; | |
1668 } | |
1669 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
1670 { | |
1671 v15 = pMessageQueue_50CBD0->uNumMessages; | |
1672 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1673 { | |
1674 v15 = 0; | |
1675 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
1676 { | |
1677 v15 = 1; | |
1678 pMessageQueue_50CBD0->uNumMessages = 0; | |
1679 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
1680 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
1681 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1682 ++pMessageQueue_50CBD0->uNumMessages; | |
1683 continue; | |
1684 } | |
1685 pMessageQueue_50CBD0->uNumMessages = 0; | |
1686 } | |
1687 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1688 } | |
1689 } | |
1052 | 1690 }*/ |
0 | 1691 if ( !pEventTimer->bPaused ) |
1692 { | |
998 | 1693 for ( uint i = 0; i < 30; ++i ) |
0 | 1694 { |
998 | 1695 inputAction = (InputAction)i; |
1696 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
1697 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 1698 else |
998 | 1699 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 1700 if ( v4 ) |
1701 { | |
1702 switch ( inputAction ) | |
1703 { | |
1704 case INPUT_MoveForward: | |
271 | 1705 if (pCurrentScreen != SCREEN_GAME) |
0 | 1706 break; |
1707 if (!pParty->bTurnBasedModeOn) | |
1708 { | |
140 | 1709 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 1710 partyAction = PARTY_RunForward; |
1711 else | |
1712 partyAction = PARTY_WalkForward; | |
998 | 1713 pPartyActionQueue->Add(partyAction); |
163 | 1714 break; |
1715 } | |
1340 | 1716 if (pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
163 | 1717 { |
1718 pTurnEngine->uActionPointsLeft -= 26; | |
1719 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
1720 partyAction = PARTY_RunForward; | |
1721 else | |
1722 partyAction = PARTY_WalkForward; | |
998 | 1723 pPartyActionQueue->Add(partyAction); |
163 | 1724 break; |
0 | 1725 } |
1726 break; | |
1727 case INPUT_MoveBackwards: | |
271 | 1728 if (pCurrentScreen != SCREEN_GAME) |
0 | 1729 break; |
1730 if (!pParty->bTurnBasedModeOn) | |
17 | 1731 { |
1732 if ( pParty->uFlags2 & 2 ) | |
1733 partyAction = PARTY_RunBackward; | |
1734 else | |
1735 partyAction = PARTY_WalkBackward; | |
998 | 1736 pPartyActionQueue->Add(partyAction); |
163 | 1737 break; |
17 | 1738 } |
1340 | 1739 if ( pTurnEngine->turn_stage != 1 && pTurnEngine->turn_stage != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
0 | 1740 { |
1741 pTurnEngine->uActionPointsLeft -= 26; | |
1742 if ( pParty->uFlags2 & 2 ) | |
1743 partyAction = PARTY_RunBackward; | |
1744 else | |
1745 partyAction = PARTY_WalkBackward; | |
998 | 1746 pPartyActionQueue->Add(partyAction); |
163 | 1747 break; |
0 | 1748 } |
1749 break; | |
1750 case INPUT_StrafeLeft: | |
271 | 1751 if (pCurrentScreen != SCREEN_GAME) |
0 | 1752 break; |
1753 if (!pParty->bTurnBasedModeOn) | |
17 | 1754 { |
1755 partyAction = PARTY_StrafeLeft; | |
998 | 1756 pPartyActionQueue->Add(partyAction); |
163 | 1757 break; |
17 | 1758 } |
1340 | 1759 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1760 break; |
1761 pTurnEngine->uActionPointsLeft -= 26; | |
1762 partyAction = PARTY_StrafeLeft; | |
998 | 1763 pPartyActionQueue->Add(partyAction); |
1764 break; | |
0 | 1765 case INPUT_StrafeRight: |
271 | 1766 if (pCurrentScreen != SCREEN_GAME) |
0 | 1767 break; |
1768 if (!pParty->bTurnBasedModeOn) | |
17 | 1769 { |
1770 partyAction = PARTY_StrafeRight; | |
998 | 1771 pPartyActionQueue->Add(partyAction); |
163 | 1772 break; |
17 | 1773 } |
1340 | 1774 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1775 break; |
1776 pTurnEngine->uActionPointsLeft -= 26; | |
1777 partyAction = PARTY_StrafeRight; | |
998 | 1778 pPartyActionQueue->Add(partyAction); |
163 | 1779 break; |
0 | 1780 case INPUT_TurnLeft: |
271 | 1781 if (pCurrentScreen != SCREEN_GAME) |
0 | 1782 break; |
1783 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
1784 { | |
1785 if (pParty->bTurnBasedModeOn) | |
1786 { | |
1340 | 1787 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1788 break; |
1789 pTurnEngine->uActionPointsLeft -= 26; | |
1790 } | |
998 | 1791 partyAction = PARTY_StrafeLeft; |
0 | 1792 } |
1793 else | |
1794 { | |
1795 if ( pParty->uFlags2 & 2 ) | |
998 | 1796 partyAction = PARTY_FastTurnLeft; |
0 | 1797 else |
998 | 1798 partyAction = PARTY_TurnLeft; |
0 | 1799 } |
998 | 1800 pPartyActionQueue->Add(partyAction); |
0 | 1801 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
1802 { | |
271 | 1803 pWeather->OnPlayerTurn(10); |
0 | 1804 } |
1805 break; | |
1806 case INPUT_TurnRight: | |
271 | 1807 if (pCurrentScreen != SCREEN_GAME) |
0 | 1808 break; |
1809 if ( GetAsyncKeyState(17) ) // strafing | |
1810 { | |
1811 if (pParty->bTurnBasedModeOn) | |
1812 { | |
1340 | 1813 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
0 | 1814 break; |
1815 pTurnEngine->uActionPointsLeft -= 26; | |
1816 } | |
998 | 1817 partyAction = PARTY_StrafeRight; |
0 | 1818 } |
1819 else | |
1820 { | |
1821 if ( pParty->uFlags2 & 2 ) | |
998 | 1822 partyAction = PARTY_FastTurnRight; |
0 | 1823 else |
998 | 1824 partyAction = PARTY_TurnRight; |
0 | 1825 } |
998 | 1826 pPartyActionQueue->Add(partyAction); |
0 | 1827 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
1828 { | |
271 | 1829 pWeather->OnPlayerTurn(-10); |
0 | 1830 } |
1831 break; | |
1832 case INPUT_Jump: | |
271 | 1833 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 1834 break; |
1835 partyAction = (PartyAction)12; | |
998 | 1836 pPartyActionQueue->Add(partyAction); |
163 | 1837 break; |
0 | 1838 case INPUT_Yell: |
187 | 1839 if (!pCurrentScreen && uActiveCharacter) |
0 | 1840 { |
1841 pParty->Yell(); | |
187 | 1842 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 1843 } |
187 | 1844 break; |
0 | 1845 case INPUT_Pass: |
1846 if ( pCurrentScreen ) | |
1847 break; | |
1340 | 1848 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3) |
17 | 1849 { |
1332 | 1850 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 1851 break; |
1852 } | |
0 | 1853 if ( uActiveCharacter ) |
1854 { | |
998 | 1855 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 1856 { |
998 | 1857 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 1858 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
1859 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
1517 | 1860 CastSpellInfoHelpers::_427D48(); |
1448 | 1861 pTurnEngine->ApplyPlayerAction(); |
0 | 1862 } |
1863 } | |
1864 break; | |
998 | 1865 case INPUT_Combat://if press ENTER |
271 | 1866 if (pCurrentScreen == SCREEN_GAME) |
0 | 1867 { |
1868 if (pParty->bTurnBasedModeOn) | |
1869 { | |
1340 | 1870 if (pTurnEngine->turn_stage == 3 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 1871 { |
1872 pParty->bTurnBasedModeOn = 0; | |
1873 pTurnEngine->End(true); | |
1874 } | |
1875 } | |
1876 else | |
1877 { | |
1878 pTurnEngine->Start(); | |
1879 pParty->bTurnBasedModeOn = true; | |
1880 } | |
1881 } | |
1882 break; | |
1883 case INPUT_CastReady: | |
271 | 1884 if (pCurrentScreen != SCREEN_GAME) |
0 | 1885 break; |
1340 | 1886 if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == 3) |
17 | 1887 { |
1332 | 1888 pTurnEngine->field_18 |= TE_FLAG_8; |
17 | 1889 break; |
1890 } | |
0 | 1891 if ( !uActiveCharacter ) |
1892 break; | |
998 | 1893 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 1894 if ( !v8 |
1895 || bUnderwater | |
998 | 1896 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
1897 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
1898 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
1899 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
1900 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
1901 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 1902 { |
998 | 1903 pPartyActionQueue = pPartyActionQueue; |
437 | 1904 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
1905 break; | |
0 | 1906 } |
1907 else | |
1908 { | |
1012 | 1909 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); |
0 | 1910 } |
1911 break; | |
1912 case INPUT_Attack: | |
271 | 1913 if (pCurrentScreen != SCREEN_GAME) |
0 | 1914 break; |
1340 | 1915 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3) |
998 | 1916 { |
1332 | 1917 pTurnEngine->field_18 |= TE_FLAG_8; |
998 | 1918 break; |
1919 } | |
1920 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 1921 break; |
1922 case INPUT_EventTrigger: | |
271 | 1923 if (pCurrentScreen == SCREEN_GAME) |
0 | 1924 { |
437 | 1925 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 1926 break; |
0 | 1927 } |
151 | 1928 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 1929 { |
1930 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1931 { | |
437 | 1932 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 1933 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
1934 { | |
1935 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 1936 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 1937 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
1575 | 1938 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 = 0; |
0 | 1939 ++pMessageQueue_50CBD0->uNumMessages; |
1940 break; | |
1941 } | |
437 | 1942 break; |
0 | 1943 } |
437 | 1944 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 1945 } |
1946 break; | |
1947 case INPUT_CharCycle: | |
1012 | 1948 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 1949 break; |
1575 | 1950 |
1012 | 1951 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); |
163 | 1952 break; |
0 | 1953 case INPUT_LookUp: |
1954 if ( pEventTimer->bPaused ) | |
1955 break; | |
1956 partyAction = (PartyAction)7; | |
998 | 1957 pPartyActionQueue->Add(partyAction); |
163 | 1958 break; |
0 | 1959 case INPUT_CenterView: |
1960 if ( pEventTimer->bPaused ) | |
1961 break; | |
1962 partyAction = (PartyAction)9; | |
998 | 1963 pPartyActionQueue->Add(partyAction); |
163 | 1964 break; |
0 | 1965 case INPUT_LookDown: |
1966 if ( pEventTimer->bPaused ) | |
1967 break; | |
1968 partyAction = (PartyAction)8; | |
998 | 1969 pPartyActionQueue->Add(partyAction); |
163 | 1970 break; |
0 | 1971 case INPUT_FlyUp: |
998 | 1972 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 1973 break; |
1974 partyAction = (PartyAction)13; | |
998 | 1975 pPartyActionQueue->Add(partyAction); |
163 | 1976 break; |
0 | 1977 case INPUT_Land: |
998 | 1978 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 1979 break; |
1980 partyAction = (PartyAction)15; | |
998 | 1981 pPartyActionQueue->Add(partyAction); |
163 | 1982 break; |
0 | 1983 case INPUT_FlyDown: |
1984 if ( !pCurrentScreen | |
1985 && !pEventTimer->bPaused ) | |
1986 { | |
1987 partyAction = (PartyAction)14; | |
998 | 1988 pPartyActionQueue->Add(partyAction); |
0 | 1989 } |
1990 break; | |
1991 case INPUT_ZoomIn: | |
1012 | 1992 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); |
163 | 1993 break; |
0 | 1994 case INPUT_ZoomOut: |
1012 | 1995 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); |
0 | 1996 break; |
1997 case INPUT_AlwaysRun: | |
1998 bAlwaysRun = bAlwaysRun == 0; | |
1999 break; | |
17 | 2000 default: |
2001 break; | |
0 | 2002 } |
2003 } | |
2004 } | |
2005 } | |
2006 } |