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