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