0
|
1 #include "Party.h"
|
|
2 #include "MapInfo.h"
|
|
3 #include "Time.h"
|
|
4 #include "AudioPlayer.h"
|
|
5 #include "IconFrameTable.h"
|
|
6 #include "Mouse.h"
|
|
7 #include "PlayerFrameTable.h"
|
|
8 #include "TurnEngine.h"
|
|
9 #include "stru279.h"
|
|
10 #include "Viewport.h"
|
|
11 #include "Actor.h"
|
|
12 #include "GUIWindow.h"
|
|
13
|
|
14 #include "mm7_data.h"
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
|
20
|
|
21
|
|
22 Party *pParty; // idb
|
|
23
|
|
24 struct ActionQueue *pPartyActionQueue;
|
|
25
|
|
26
|
|
27
|
|
28
|
|
29 //----- (004760C1) --------------------------------------------------------
|
|
30 void ActionQueue::Add(PartyAction action)
|
|
31 {
|
|
32 if (uNumActions < 30)
|
|
33 pActions[uNumActions++] = action;
|
|
34 }
|
|
35
|
|
36 //----- (00497FC5) --------------------------------------------------------
|
|
37 bool Party::_497FC5_check_party_perception_against_level()
|
|
38 {
|
|
39 int uMaxPerception; // edi@1
|
|
40 Player *v2; // esi@1
|
|
41 signed int v3; // ebx@1
|
|
42 Player *v4; // ecx@2
|
|
43 signed int v5; // eax@3
|
|
44 bool result; // eax@7
|
|
45
|
|
46 uMaxPerception = 0;
|
|
47 v2 = this->pPlayers;
|
|
48 v3 = 4;
|
|
49 do
|
|
50 {
|
|
51 if ( v2->CanAct() )
|
|
52 {
|
|
53 v5 = v2->GetPerception();
|
|
54 if ( v5 > uMaxPerception )
|
|
55 uMaxPerception = v5;
|
|
56 }
|
|
57 ++v2;
|
|
58 --v3;
|
|
59 }
|
|
60 while ( v3 );
|
|
61 if ( uLevelMapStatsID && (signed int)uLevelMapStatsID < 77 )
|
|
62 result = uMaxPerception >= 2 * pMapStats->pInfos[uLevelMapStatsID]._per;
|
|
63 else
|
|
64 result = 0;
|
|
65 return result;
|
|
66 }
|
|
67
|
|
68 //----- (004936E1) --------------------------------------------------------
|
|
69 void Party::SetHoldingItem(ItemGen *pItem)
|
|
70 {
|
|
71 Party *v2; // esi@1
|
|
72
|
|
73 v2 = this;
|
|
74 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
75 memcpy(&v2->pPickedItem, pItem, sizeof(v2->pPickedItem));
|
|
76 pMouse->SetCursorBitmapFromItemID(v2->pPickedItem.uItemID);
|
|
77 }
|
|
78
|
|
79 //----- (0049370F) --------------------------------------------------------
|
|
80 int Party::GetNextActiveCharacter()
|
|
81 {
|
|
82 Party *v1; // esi@1
|
|
83 int v2; // eax@4
|
|
84 signed int v4; // ecx@6
|
|
85 char *v5; // edx@6
|
|
86 Player *v6; // eax@7
|
|
87 char *v7; // ecx@23
|
|
88 signed int v8; // esi@23
|
|
89 signed int v9; // edx@23
|
|
90 Player **v10; // edi@23
|
|
91 Player *v11; // eax@24
|
|
92 int v12; // [sp+Ch] [bp-4h]@1
|
|
93
|
|
94 v1 = this;
|
|
95 v12 = 0;
|
|
96 if ( pParty->bTurnBasedModeOn == 1 )
|
|
97 {
|
|
98 if ( pTurnEngine->field_4 != 2 || (pTurnEngine->pQueue[0].uPackedID & 7) != 4 )
|
|
99 return 0;
|
|
100 v2 = pTurnEngine->pQueue[0].uPackedID >> 3;
|
|
101 return v2 + 1;
|
|
102 }
|
|
103 v4 = 0;
|
|
104 v5 = (char *)&v1->pPlayers[0].uTimeToRecovery;
|
|
105 while ( 1 )
|
|
106 {
|
|
107 v6 = ::pPlayers[v4 + 1];
|
|
108 if ( v6->pConditions[2]
|
|
109 || v6->pConditions[12]
|
|
110 || v6->pConditions[13]
|
|
111 || v6->pConditions[14]
|
|
112 || v6->pConditions[15]
|
|
113 || v6->pConditions[16]
|
|
114 || *(short *)v5 )
|
|
115 {
|
|
116 byte_AE3368[v4] = 1;
|
|
117 goto LABEL_21;
|
|
118 }
|
|
119 if ( !byte_AE3368[v4] )
|
|
120 break;
|
|
121 LABEL_21:
|
|
122 ++v4;
|
|
123 v5 += 6972;
|
|
124 if ( v4 >= 4 )
|
|
125 goto LABEL_16;
|
|
126 }
|
|
127 v12 = v4;
|
|
128 byte_AE3368[v4] = 1;
|
|
129 LABEL_16:
|
|
130 if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] )
|
|
131 memset(byte_AE3368, 0, 4u);
|
|
132 v2 = v12;
|
|
133 if ( v12 )
|
|
134 return v2 + 1;
|
|
135 v7 = (char *)&v1->pPlayers[0].uSpeedBonus;
|
|
136 v8 = 0;
|
|
137 v9 = 1;
|
|
138 v10 = &::pPlayers[1];
|
|
139 while ( 2 )
|
|
140 {
|
|
141 v11 = *v10;
|
|
142 if ( !(*v10)->pConditions[2]
|
|
143 && !v11->pConditions[12]
|
|
144 && !v11->pConditions[13]
|
|
145 && !v11->pConditions[14]
|
|
146 && !v11->pConditions[15]
|
|
147 && !v11->pConditions[16]
|
|
148 && !*((short *)v7 + 3123) )
|
|
149 {
|
|
150 if ( v12 )
|
|
151 {
|
|
152 if ( *(short *)v7 > v8 )
|
|
153 {
|
|
154 v8 = *(short *)v7;
|
|
155 goto LABEL_35;
|
|
156 }
|
|
157 }
|
|
158 else
|
|
159 {
|
|
160 v8 = *(short *)v7;
|
|
161 LABEL_35:
|
|
162 v12 = v9;
|
|
163 }
|
|
164 }
|
|
165 ++v10;
|
|
166 ++v9;
|
|
167 v7 += 6972;
|
|
168 if ( v9 - 1 < 4 )
|
|
169 continue;
|
|
170 return v12;
|
|
171 }
|
|
172 }
|
|
173 // AE3369: using guessed type char byte_AE3369;
|
|
174 // AE336A: using guessed type char byte_AE336A;
|
|
175 // AE336B: using guessed type char byte_AE336B;
|
|
176
|
|
177
|
|
178 //----- (00493244) --------------------------------------------------------
|
|
179 bool Party::HasItem(unsigned int uItemID)
|
|
180 {
|
|
181 char *v2; // edx@1
|
|
182 signed int v3; // ecx@2
|
|
183 ItemGen *v4; // eax@2
|
|
184
|
|
185 v2 = (char *)pParty->pPlayers[0].pInventoryItems;
|
|
186 while ( 2 )
|
|
187 {
|
|
188 v3 = 0;
|
|
189 v4 = (ItemGen *)v2;
|
|
190 do
|
|
191 {
|
|
192 if ( v4->uItemID == uItemID )
|
|
193 return 1;
|
|
194 ++v3;
|
|
195 ++v4;
|
|
196 }
|
|
197 while ( v3 < 138 );
|
|
198 v2 += 6972;
|
|
199 if ( (signed int)v2 < (signed int)&pParty->field_777C[85] )
|
|
200 continue;
|
|
201 break;
|
|
202 }
|
|
203 return 0;
|
|
204 }
|
|
205
|
|
206
|
|
207 //----- (00492AD5) --------------------------------------------------------
|
|
208 __int16 Party::SetFood(unsigned int uNumFood)
|
|
209 {
|
|
210 __int16 result; // ax@1
|
|
211
|
|
212 pUIAnim_Food->uAnimTime = 0;
|
|
213 pParty->uNumFoodRations = uNumFood;
|
|
214 result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
215 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
216 return result;
|
|
217 }
|
|
218
|
|
219 //----- (00492B03) --------------------------------------------------------
|
|
220 void Party::TakeFood(unsigned int uNumFood)
|
|
221 {
|
|
222 if ( ((pParty->uNumFoodRations - uNumFood) & 0x80000000u) == 0 )
|
|
223 pParty->uNumFoodRations -= uNumFood;
|
|
224 else
|
|
225 pParty->uNumFoodRations = 0;
|
|
226 pUIAnim_Food->uAnimTime = 0;
|
|
227 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
228 }
|
|
229
|
|
230 //----- (00492B42) --------------------------------------------------------
|
|
231 __int16 Party::GiveFood(unsigned int _this)
|
|
232 {
|
|
233 __int16 result; // ax@1
|
|
234
|
|
235 pParty->uNumFoodRations += _this;
|
|
236 pUIAnim_Food->uAnimTime = 0;
|
|
237 result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
238 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
239 return result;
|
|
240 }
|
|
241
|
|
242 //----- (00492B70) --------------------------------------------------------
|
|
243 void Party::SetGold(unsigned int uNumGold)
|
|
244 {
|
|
245 pParty->uNumGold = uNumGold;
|
|
246 pUIAnim_Gold->uAnimTime = 0;
|
|
247 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
|
|
248 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
|
|
249 }
|
|
250
|
|
251 //----- (00492BB6) --------------------------------------------------------
|
|
252 void Party::TakeGold(unsigned int uNumGold)
|
|
253 {
|
|
254 if ( uNumGold <= pParty->uNumGold )
|
|
255 pParty->uNumGold -= uNumGold;
|
|
256 else
|
|
257 pParty->uNumGold = 0;
|
|
258 pUIAnim_Gold->uAnimTime = 0;
|
|
259 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
|
|
260 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
|
|
261 }
|
|
262
|
|
263 //----- (0049135E) --------------------------------------------------------
|
|
264 unsigned int Party::GetPartyFame()
|
|
265 {
|
|
266 signed int v1; // eax@1
|
|
267 char *v2; // ecx@1
|
|
268 signed int v3; // edx@1
|
|
269
|
|
270 v1 = 0;
|
|
271 v2 = (char *)&this->pPlayers[0].uExperience;
|
|
272 v3 = 4; // (E exp) / 1000
|
|
273 do
|
|
274 {
|
|
275 v1 += *(int *)v2;
|
|
276 v2 += 6972;
|
|
277 --v3;
|
|
278 }
|
|
279 while ( v3 );
|
|
280 return v1 / 1000;
|
|
281 }
|
|
282
|
|
283 //----- (0049137D) --------------------------------------------------------
|
|
284 void Party::CreateDefaultParty(char bGiveItems)
|
|
285 {
|
|
286 Party *v2; // esi@1
|
|
287 signed __int16 v3; // ax@1
|
|
288 int v4; // ecx@1
|
|
289 Player *v5; // esi@3
|
|
290 signed int v6; // edx@5
|
|
291 int v7; // eax@5
|
|
292 int uSkillIdx; // eax@11
|
|
293 unsigned __int8 v9; // zf@37
|
|
294 char v10; // sf@37
|
|
295 unsigned __int8 v11; // of@37
|
|
296 char *v12; // eax@38
|
|
297 signed int v13; // ecx@38
|
|
298 int v14; // eax@42
|
|
299 unsigned int v15; // [sp-4h] [bp-44h]@14
|
|
300 unsigned int v16; // [sp-4h] [bp-44h]@26
|
|
301 int v17; // [sp+10h] [bp-30h]@1
|
|
302 int v18; // [sp+14h] [bp-2Ch]@11
|
|
303 signed int v19; // [sp+18h] [bp-28h]@1
|
|
304 ItemGen Dst; // [sp+1Ch] [bp-24h]@10
|
|
305
|
|
306 v2 = this;
|
|
307 strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]);
|
|
308 v2->pPlayers[0].field_1928 = 17;
|
|
309 v2->pPlayers[0].uFace = 17;
|
|
310 v2->pPlayers[0].field_1924 = 17;
|
|
311 v2->pPlayers[0].uVoiceID = 17;
|
|
312 v2->pPlayers[0].uMight = 30;
|
|
313 v2->pPlayers[0].uIntelligence = 5;
|
|
314 v2->pPlayers[0].uWillpower = 5;
|
|
315 v2->pPlayers[0].uEndurance = 13;
|
|
316 v2->pPlayers[0].uAccuracy = 13;
|
|
317 v2->pPlayers[0].uSpeed = 14;
|
|
318 v2->pPlayers[0].uLuck = 7;
|
|
319 v2->pPlayers[0].pActiveSkills[9] = 1; // leather
|
|
320 v2->pPlayers[0].pActiveSkills[33] = 1; // armsmaster
|
|
321 v2->pPlayers[0].pActiveSkills[5] = 1; // bow
|
|
322 v2->pPlayers[0].pActiveSkills[1] = 1; // sword
|
|
323 v2->pPlayers[1].field_1928 = 3;
|
|
324 v2->pPlayers[1].uFace = 3;
|
|
325 v2->pPlayers[1].field_1924 = 3;
|
|
326 v2->pPlayers[1].uVoiceID = 3;
|
|
327 strcpy(v2->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]);
|
|
328 v2->pPlayers[1].uMight = 13;
|
|
329 v2->pPlayers[1].uIntelligence = 9;
|
|
330 v2->pPlayers[1].uWillpower = 9;
|
|
331 v2->pPlayers[1].uEndurance = 13;
|
|
332 v2->pPlayers[1].uAccuracy = 13;
|
|
333 v2->pPlayers[1].uSpeed = 13;
|
|
334 v2->pPlayers[1].uLuck = 13;
|
|
335 v2->pPlayers[1].pActiveSkills[9] = 1; // leather
|
|
336 v2->pPlayers[1].pActiveSkills[34] = 1; // stealing
|
|
337 v2->pPlayers[1].pActiveSkills[2] = 1; // dagger
|
|
338 v2->pPlayers[1].pActiveSkills[29] = 1; // disarm trap
|
|
339 v2->pPlayers[2].field_1928 = 14;
|
|
340 v2->pPlayers[2].uFace = 14;
|
|
341 v2->pPlayers[2].field_1924 = 14;
|
|
342 v2->pPlayers[2].uVoiceID = 14;
|
|
343 strcpy(v2->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]);
|
|
344 v2->pPlayers[2].uMight = 12;
|
|
345 v2->pPlayers[2].uIntelligence = 9;
|
|
346 v2->pPlayers[2].uWillpower = 20;
|
|
347 v2->pPlayers[2].uEndurance = 22;
|
|
348 v2->pPlayers[2].uAccuracy = 7;
|
|
349 v2->pPlayers[2].uSpeed = 13;
|
|
350 v2->pPlayers[2].uLuck = 7;
|
|
351 v2->pPlayers[2].pActiveSkills[35] = 1; // alchemy
|
|
352 v2->pPlayers[2].pActiveSkills[9] = 1; // leather
|
|
353 v2->pPlayers[2].pActiveSkills[18] = 1; // body
|
|
354 v2->pPlayers[2].pActiveSkills[6] = 1; // mace
|
|
355 strcpy(v2->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]);
|
|
356 v3 = 10;
|
|
357 v2->pPlayers[3].field_1928 = 10;
|
|
358 v2->pPlayers[3].uFace = 10;
|
|
359 v4 = (int)&v2->pPlayers[0].sResMagicBase;
|
|
360 v2->pPlayers[3].uEndurance = 13;
|
|
361 v2->pPlayers[3].uAccuracy = 13;
|
|
362 v2->pPlayers[3].uSpeed = 13;
|
|
363 v2->pPlayers[3].field_1924 = 10;
|
|
364 v2->pPlayers[3].uVoiceID = 10;
|
|
365 v2->pPlayers[3].uMight = 5;
|
|
366 v2->pPlayers[3].uIntelligence = 30;
|
|
367 v2->pPlayers[3].uWillpower = 9;
|
|
368 v2->pPlayers[3].uLuck = 7;
|
|
369 v2->pPlayers[3].pActiveSkills[9] = 1; // leather
|
|
370 v2->pPlayers[3].pActiveSkills[13] = 1; // air
|
|
371 v2->pPlayers[3].pActiveSkills[12] = 1; // fire
|
|
372 v2->pPlayers[3].pActiveSkills[0] = 1; // staff
|
|
373 v17 = (int)&v2->pPlayers[0].sResMagicBase;
|
|
374 v19 = 4;
|
|
375 while ( 1 )
|
|
376 {
|
|
377 v5 = (Player *)(v4 - 6014);
|
|
378 if ( !*(char *)(v4 - 5829) )
|
|
379 *(short *)v4 = v3;
|
|
380 v6 = 0;
|
|
381 v7 = v4 - 5726;
|
|
382 while ( !*(short *)v7 )
|
|
383 {
|
|
384 ++v6;
|
|
385 v7 += 2;
|
|
386 if ( v6 >= 9 )
|
|
387 goto LABEL_10;
|
|
388 }
|
|
389 v5->field_1A4E = v6;
|
|
390 LABEL_10:
|
|
391 v5->uExpressionTimePassed = 0;
|
|
392 Dst.Reset();
|
|
393 if ( bGiveItems )
|
|
394 {
|
|
395 pItemsTable->GenerateItem(2, 40, &Dst);
|
|
396 v5->AddItem2(0xFFFFFFFFu, &Dst);
|
|
397 uSkillIdx = 0;
|
|
398 v18 = 0;
|
|
399 do
|
|
400 {
|
|
401 if ( v5->pActiveSkills[uSkillIdx] )
|
|
402 {
|
|
403 switch ( uSkillIdx )
|
|
404 {
|
|
405 case PLAYER_SKILL_STAFF:
|
|
406 v15 = ITEM_STAFF_1;
|
|
407 goto wear_item;
|
|
408 case PLAYER_SKILL_SWORD:
|
|
409 v15 = 1;
|
|
410 goto wear_item;
|
|
411 case PLAYER_SKILL_DAGGER:
|
|
412 v15 = ITEM_DAGGER_1;
|
|
413 goto wear_item;
|
|
414 case PLAYER_SKILL_AXE:
|
|
415 v15 = ITEM_AXE_1;
|
|
416 goto wear_item;
|
|
417 case PLAYER_SKILL_SPEAR:
|
|
418 v15 = ITEM_SPEAR_1;
|
|
419 goto wear_item;
|
|
420 case PLAYER_SKILL_BOW:
|
|
421 v15 = ITEM_CROSSBOW_1;
|
|
422 goto wear_item;
|
|
423 case PLAYER_SKILL_MACE:
|
|
424 v15 = ITEM_MACE_1;
|
|
425 goto wear_item;
|
|
426 case PLAYER_SKILL_SHIELD:
|
|
427 v15 = ITEM_BUCKLER_1;
|
|
428 goto wear_item;
|
|
429 case PLAYER_SKILL_LEATHER:
|
|
430 v15 = ITEM_LEATHER_1;
|
|
431 goto wear_item;
|
|
432 case PLAYER_SKILL_CHAIN:
|
|
433 v15 = ITEM_CHAINMAIL_1;
|
|
434 goto wear_item;
|
|
435 case PLAYER_SKILL_PLATE:
|
|
436 v15 = ITEM_PLATE_1;
|
|
437 wear_item:
|
|
438 v5->WearItem(v15);
|
|
439 break;
|
|
440 case PLAYER_SKILL_FIRE:
|
|
441 v16 = ITEM_SPELLBOOK_FIRE_STRIKE;
|
|
442 goto add_item;
|
|
443 case PLAYER_SKILL_AIR:
|
|
444 v16 = ITEM_SPELLBOOK_AIR_FEATHER_FALL;
|
|
445 goto add_item;
|
|
446 case PLAYER_SKILL_WATER:
|
|
447 v16 = ITEM_SPELLBOOK_WATER_POISON_SPRAY;
|
|
448 goto add_item;
|
|
449 case PLAYER_SKILL_EARTH:
|
|
450 v16 = ITEM_SPELLBOOK_EARTH_SLOW;
|
|
451 goto add_item;
|
|
452 case PLAYER_SKILL_SPIRIT:
|
|
453 v16 = ITEM_SPELLBOOK_SPIRIT_BLESS;
|
|
454 goto add_item;
|
|
455 case PLAYER_SKILL_MIND:
|
|
456 v16 = ITEM_SPELLBOOK_MIND_MIND_BLAST;
|
|
457 goto add_item;
|
|
458 case PLAYER_SKILL_BODY:
|
|
459 v16 = ITEM_SPELLBOOK_BODY_FIRST_AID;
|
|
460 goto add_item;
|
|
461 case PLAYER_SKILL_ITEM_ID:
|
|
462 case PLAYER_SKILL_REPAIR:
|
|
463 case PLAYER_SKILL_MEDITATION:
|
|
464 case PLAYER_SKILL_PERCEPTION:
|
|
465 case PLAYER_SKILL_DIPLOMACY:
|
|
466 case PLAYER_SKILL_TRAP_DISARM:
|
|
467 case PLAYER_SKILL_LEARNING:
|
|
468 v5->AddItem(0xFFFFFFFFu, ITEM_POTION_BOTTLE);
|
|
469 v16 = 5 * (rand() % 3 + 40); // simple reagent
|
|
470 goto add_item;
|
|
471 case PLAYER_SKILL_DODGE:
|
|
472 v16 = ITEM_BOOTS_1;
|
|
473 goto add_item;
|
|
474 case PLAYER_SKILL_UNARMED:
|
|
475 v16 = ITEM_GAUNTLETS_1;
|
|
476 add_item:
|
|
477 v5->AddItem(0xFFFFFFFFu, v16);
|
|
478 break;
|
|
479 default:
|
|
480 break;
|
|
481 }
|
|
482 }
|
|
483 uSkillIdx = v18 + 1;
|
|
484 v11 = __OFSUB__(v18 + 1, 36);
|
|
485 v9 = v18 == 35;
|
|
486 v10 = v18++ - 35 < 0;
|
|
487 }
|
|
488 while ( (unsigned __int8)(v10 ^ v11) | v9 );
|
|
489 v12 = (char *)&v5->pInventoryItems[0].uAttributtes;
|
|
490 v13 = 138;
|
|
491 do
|
|
492 {
|
|
493 if ( *((int *)v12 - 5) )
|
|
494 *(int *)v12 |= 1u;
|
|
495 v12 += 36;
|
|
496 --v13;
|
|
497 }
|
|
498 while ( v13 );
|
|
499 }
|
|
500 v5->sHealth = v5->GetMaxHealth();
|
|
501 v14 = v5->GetMaxMana();
|
|
502 v17 += 6972;
|
|
503 v9 = v19-- == 1;
|
|
504 v5->sMana = v14;
|
|
505 if ( v9 )
|
|
506 break;
|
|
507 v4 = v17;
|
|
508 v3 = 10;
|
|
509 }
|
|
510 }
|
|
511
|
|
512 //----- (004917CE) --------------------------------------------------------
|
|
513 int Party::Reset()
|
|
514 {
|
3
|
515 //Party *v1; // esi@1
|
0
|
516 unsigned __int64 *pTimePlayed; // edi@1
|
|
517 bool v3; // edx@1
|
|
518 Player **v4; // eax@1
|
|
519 Player *v5; // ecx@1
|
|
520 char v6; // cl@3
|
|
521 char v7; // al@6
|
|
522 char v8; // al@9
|
|
523 char v9; // cl@12
|
|
524 Player **v10; // ebx@15
|
|
525 signed int v11; // eax@16
|
|
526 Player *v12; // edx@17
|
|
527 signed int v13; // edi@18
|
|
528 SpellBuff *v14; // ebx@21
|
|
529 signed int v15; // edi@21
|
|
530 char *v16; // esi@23
|
|
531 Player **v17; // esi@23
|
|
532 int v18; // edx@24
|
|
533 Player *v19; // eax@24
|
|
534
|
3
|
535 //v1 = this;
|
|
536 pTimePlayed = &uTimePlayed;
|
|
537 //memset(&this->uTimePlayed, 0, 0x1620Cu);
|
|
538 field_708 = 15;
|
|
539 sEyelevel = 160;
|
0
|
540 LOBYTE(v3) = 1;
|
3
|
541 uFlags2 = 0;
|
|
542 uNumGold = 200;
|
|
543 uNumGoldInBank = 0;
|
|
544 uNumFoodRations = 7;
|
|
545 uAlignment = 1;
|
0
|
546 SetUserInterface(1, v3);
|
|
547 *((int *)pTimePlayed + 1) = 0;
|
|
548 *(int *)pTimePlayed = 0x21C00u;
|
3
|
549 LODWORD(uLastRegenerationTime) = 0x21C00;
|
|
550 HIDWORD(uLastRegenerationTime) = 0;
|
|
551 bTurnBasedModeOn = 0;
|
0
|
552 uActiveCharacter = 1;
|
3
|
553 ::pPlayers[0] = pPlayers;
|
0
|
554 v4 = &::pPlayers[1];
|
3
|
555 v5 = pPlayers;
|
0
|
556 do
|
|
557 {
|
|
558 *v4 = v5;
|
|
559 ++v4;
|
|
560 ++v5;
|
|
561 }
|
|
562 while ( (signed int)v4 < (signed int)&qword_A750D8 );
|
|
563 pPlayers[0].Reset(0);
|
|
564 pPlayers[0].Reset(4u);
|
|
565 pPlayers[0].Reset(0x18u);
|
|
566 pPlayers[0].Reset(0x20u);
|
3
|
567 pPlayers[0].uFace = 17;
|
|
568 pPlayers[0].field_1924 = 17;
|
|
569 pPlayers[0].uVoiceID = 17;
|
|
570 pPlayers[0].SetInitialStats();
|
0
|
571 v6 = 0;
|
3
|
572 switch ( pPlayers[0].uVoiceID )
|
0
|
573 {
|
|
574 case 0u:
|
|
575 case 1u:
|
|
576 case 2u:
|
|
577 case 3u:
|
|
578 case 8u:
|
|
579 case 9u:
|
|
580 case 0xCu:
|
|
581 case 0xDu:
|
|
582 case 0x10u:
|
|
583 case 0x11u:
|
|
584 case 0x14u:
|
|
585 case 0x17u:
|
|
586 v6 = 0;
|
|
587 break;
|
|
588 case 4u:
|
|
589 case 5u:
|
|
590 case 6u:
|
|
591 case 7u:
|
|
592 case 0xAu:
|
|
593 case 0xBu:
|
|
594 case 0xEu:
|
|
595 case 0xFu:
|
|
596 case 0x12u:
|
|
597 case 0x13u:
|
|
598 case 0x15u:
|
|
599 case 0x18u:
|
|
600 v6 = 1;
|
|
601 break;
|
|
602 default:
|
|
603 break;
|
|
604 }
|
3
|
605 pPlayers[0].uSex = v6;
|
|
606 pPlayers[0].RandomizeName();
|
|
607 strcpy(pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]);
|
|
608 pPlayers[1].uFace = 3;
|
|
609 pPlayers[1].field_1924 = 3;
|
|
610 pPlayers[1].uVoiceID = 3;
|
|
611 pPlayers[1].SetInitialStats();
|
0
|
612 v7 = 0;
|
3
|
613 switch (pPlayers[1].uVoiceID)
|
0
|
614 {
|
|
615 case 0u:
|
|
616 case 1u:
|
|
617 case 2u:
|
|
618 case 3u:
|
|
619 case 8u:
|
|
620 case 9u:
|
|
621 case 0xCu:
|
|
622 case 0xDu:
|
|
623 case 0x10u:
|
|
624 case 0x11u:
|
|
625 case 0x14u:
|
|
626 case 0x17u:
|
|
627 v7 = 0;
|
|
628 break;
|
|
629 case 4u:
|
|
630 case 5u:
|
|
631 case 6u:
|
|
632 case 7u:
|
|
633 case 0xAu:
|
|
634 case 0xBu:
|
|
635 case 0xEu:
|
|
636 case 0xFu:
|
|
637 case 0x12u:
|
|
638 case 0x13u:
|
|
639 case 0x15u:
|
|
640 case 0x18u:
|
|
641 v7 = 1;
|
|
642 break;
|
|
643 default:
|
|
644 break;
|
|
645 }
|
|
646 pPlayers[1].uSex = v7;
|
|
647 pPlayers[1].RandomizeName();
|
3
|
648 strcpy(pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]);
|
0
|
649 pPlayers[2].uFace = 14;
|
|
650 pPlayers[2].field_1924 = 14;
|
|
651 pPlayers[2].uVoiceID = 14;
|
|
652 pPlayers[2].SetInitialStats();
|
|
653 v8 = 0;
|
3
|
654 switch (pPlayers[2].uVoiceID)
|
0
|
655 {
|
|
656 case 0u:
|
|
657 case 1u:
|
|
658 case 2u:
|
|
659 case 3u:
|
|
660 case 8u:
|
|
661 case 9u:
|
|
662 case 0xCu:
|
|
663 case 0xDu:
|
|
664 case 0x10u:
|
|
665 case 0x11u:
|
|
666 case 0x14u:
|
|
667 case 0x17u:
|
|
668 v8 = 0;
|
|
669 break;
|
|
670 case 4u:
|
|
671 case 5u:
|
|
672 case 6u:
|
|
673 case 7u:
|
|
674 case 0xAu:
|
|
675 case 0xBu:
|
|
676 case 0xEu:
|
|
677 case 0xFu:
|
|
678 case 0x12u:
|
|
679 case 0x13u:
|
|
680 case 0x15u:
|
|
681 case 0x18u:
|
|
682 v8 = 1;
|
|
683 break;
|
|
684 default:
|
|
685 break;
|
|
686 }
|
|
687 pPlayers[2].uSex = v8;
|
|
688 pPlayers[2].RandomizeName();
|
3
|
689 strcpy(pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]);
|
0
|
690 pPlayers[3].uFace = 10;
|
|
691 pPlayers[3].field_1924 = 10;
|
|
692 pPlayers[3].uVoiceID = 10;
|
|
693 pPlayers[3].SetInitialStats();
|
|
694 v9 = 0;
|
3
|
695 switch (pPlayers[3].uVoiceID)
|
0
|
696 {
|
|
697 case 0u:
|
|
698 case 1u:
|
|
699 case 2u:
|
|
700 case 3u:
|
|
701 case 8u:
|
|
702 case 9u:
|
|
703 case 0xCu:
|
|
704 case 0xDu:
|
|
705 case 0x10u:
|
|
706 case 0x11u:
|
|
707 case 0x14u:
|
|
708 case 0x17u:
|
|
709 v9 = 0;
|
|
710 break;
|
|
711 case 4u:
|
|
712 case 5u:
|
|
713 case 6u:
|
|
714 case 7u:
|
|
715 case 0xAu:
|
|
716 case 0xBu:
|
|
717 case 0xEu:
|
|
718 case 0xFu:
|
|
719 case 0x12u:
|
|
720 case 0x13u:
|
|
721 case 0x15u:
|
|
722 case 0x18u:
|
|
723 v9 = 1;
|
|
724 break;
|
|
725 default:
|
|
726 break;
|
|
727 }
|
3
|
728 pPlayers[3].uSex = v9;
|
0
|
729 pPlayers[3].RandomizeName();
|
3
|
730 strcpy(pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]);
|
0
|
731 v10 = &::pPlayers[1];
|
|
732 do
|
|
733 {
|
|
734 (*v10)->uTimeToRecovery = 0;
|
|
735 v11 = 0;
|
|
736 do
|
|
737 {
|
|
738 v12 = *v10;
|
|
739 LODWORD((*v10)->pConditions[v11]) = 0;
|
|
740 ++v11;
|
|
741 *(int *)((char *)v12 + v11 * 8 - 4) = 0;
|
|
742 }
|
|
743 while ( v11 < 20 );
|
|
744 v13 = 6048;
|
|
745 do
|
|
746 {
|
|
747 ((SpellBuff *)((char *)*v10 + v13))->Reset();
|
|
748 v13 += 16;
|
|
749 }
|
|
750 while ( v13 < 6432 );
|
|
751 ++v10;
|
|
752 }
|
|
753 while ( (signed int)v10 <= (signed int)&pPlayers[4] );
|
3
|
754 v14 = &pPartyBuffs[1];
|
0
|
755 v15 = 19;
|
|
756 do
|
|
757 {
|
|
758 v14->Reset();
|
|
759 ++v14;
|
|
760 --v15;
|
|
761 }
|
|
762 while ( v15 );
|
|
763 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
|
3
|
764 uFlags = 0;
|
|
765 v16 = (char *)_award_bits;
|
0
|
766 _449B7E_toggle_bit(v16, 1, 1u);
|
|
767 _449B7E_toggle_bit(v16, 2, 1u);
|
|
768 _449B7E_toggle_bit(v16, 3, 1u);
|
|
769 _449B7E_toggle_bit(v16, 4, 1u);
|
|
770 _449B7E_toggle_bit(v16, 5, 1u);
|
|
771 _449B7E_toggle_bit(v16, 6, 1u);
|
|
772 v17 = &::pPlayers[1];
|
|
773 do
|
|
774 {
|
|
775 (*v17)->uExpressionID = 1;
|
|
776 (*v17)->uExpressionTimePassed = 0;
|
|
777 v18 = rand() % 256;
|
|
778 v19 = *v17;
|
|
779 ++v17;
|
|
780 v19->uExpressionTimeLength = v18 + 128;
|
|
781 }
|
|
782 while ( (signed int)v17 <= (signed int)&pPlayers[4] );
|
|
783 memcpy(pNPCStats->pNewNPCData, &pNPCStats, 0x94BCu);
|
|
784 memcpy(pNPCStats->pGroups_copy, pNPCStats->pGroups, 0x66u);
|
|
785 pNPCStats->pNewNPCData[3].uFlags |= 0x80u;
|
|
786 _494035_timed_effects__water_walking_damage__etc();
|
|
787 pEventTimer->Pause();
|
|
788 return 0;
|
|
789 }
|
|
790
|
|
791
|
|
792
|
|
793 //----- (0043AD34) --------------------------------------------------------
|
|
794 void Party::Yell()
|
|
795 {
|
|
796 void *v0; // esi@5
|
|
797 int v1; // edi@9
|
|
798 int v2; // ebx@9
|
|
799 int v3; // eax@9
|
|
800 unsigned int v4; // [sp+8h] [bp-4h]@4
|
|
801
|
|
802 if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime > 0 )
|
|
803 pParty->pPartyBuffs[11].Reset();
|
|
804 if ( pParty->bTurnBasedModeOn != 1 )
|
|
805 {
|
|
806 v4 = 0;
|
|
807 if ( (signed int)uNumActors > 0 )
|
|
808 {
|
|
809 v0 = &pActors[0].pMonsterInfo.uMovementType;
|
|
810 do
|
|
811 {
|
|
812 if ( ((Actor *)((char *)v0 - 59))->Actor::CanAct() && *((char *)v0 + 2) != 4 && *(char *)v0 != 5 )
|
|
813 {
|
|
814 v1 = abs(*(short *)((char *)v0 + 83) - pParty->vPosition.x);
|
|
815 v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.z);
|
|
816 v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.y);
|
|
817 if ( (double)sub_4621DA(v1, v2, v3) < 512.0 )
|
|
818 Actor::_402968(v4, 4, 0, 0);
|
|
819 }
|
|
820 ++v4;
|
|
821 v0 = (char *)v0 + 836;
|
|
822 }
|
|
823 while ( (signed int)v4 < (signed int)uNumActors );
|
|
824 }
|
|
825 }
|
|
826 }
|
|
827
|
|
828 //----- (00491BF9) --------------------------------------------------------
|
|
829 void Party::ResetPosMiscAndSpellBuffs()
|
|
830 {
|
|
831 Party *v1; // esi@1
|
|
832 char *v2; // edi@1
|
|
833 SpellBuff *v3; // ebx@2
|
|
834 SpellBuff *v4; // esi@5
|
|
835 signed int v5; // edi@5
|
|
836 signed int v6; // [sp+8h] [bp-8h]@1
|
|
837 signed int v7; // [sp+Ch] [bp-4h]@2
|
|
838
|
|
839 v1 = this;
|
|
840 this->vPosition.y = 0;
|
|
841 this->vPosition.z = 0;
|
|
842 this->vPosition.x = 0;
|
|
843 this->uFallStartY = 0;
|
|
844 this->sRotationY = 0;
|
|
845 this->sRotationX = 0;
|
|
846 this->uFallSpeed = 0;
|
|
847 this->field_28 = 0;
|
|
848 this->uDefaultPartyHeight = 120;
|
|
849 this->field_14 = 37;
|
|
850 this->field_18 = 25;
|
|
851 this->uWalkSpeed = 384;
|
|
852 this->field_20_prolly_turn_speed = 90;
|
|
853 this->field_24 = 5;
|
|
854 this->field_6FC = 0;
|
|
855 this->field_708 = 15;
|
|
856 this->field_0 = 25;
|
|
857 v2 = (char *)this->pPlayers[0].pPlayerBuffs;
|
|
858 v6 = 4;
|
|
859 do
|
|
860 {
|
|
861 v3 = (SpellBuff *)v2;
|
|
862 v7 = 24;
|
|
863 do
|
|
864 {
|
|
865 v3->Reset();
|
|
866 ++v3;
|
|
867 --v7;
|
|
868 }
|
|
869 while ( v7 );
|
|
870 v2 += 6972;
|
|
871 --v6;
|
|
872 }
|
|
873 while ( v6 );
|
|
874 v4 = v1->pPartyBuffs;
|
|
875 v5 = 20;
|
|
876 do
|
|
877 {
|
|
878 v4->Reset();
|
|
879 ++v4;
|
|
880 --v5;
|
|
881 }
|
|
882 while ( v5 );
|
|
883 }
|
|
884
|
|
885 //----- (004909F4) --------------------------------------------------------
|
|
886 void Party::_4909F4()
|
|
887 {
|
|
888 char *v1; // esi@2
|
|
889 unsigned int v2; // eax@3
|
|
890 __int16 v3; // cx@5
|
|
891 int v4; // edx@27
|
|
892 signed int v5; // eax@52
|
|
893 PlayerFrame *v6; // edx@53
|
|
894 char *v7; // esi@60
|
|
895 signed int v8; // ebp@61
|
|
896 int v9; // ebx@62
|
|
897 unsigned int v10; // edi@62
|
|
898 signed int v11; // [sp+0h] [bp-4h]@2
|
|
899
|
|
900 if ( dword_A75070 != stru_51076C.field_8 )
|
|
901 {
|
|
902 dword_A75070 = stru_51076C.field_8;
|
|
903 v1 = (char *)&this->pPlayers[0].uExpressionID;
|
|
904 v11 = 4;
|
|
905 do
|
|
906 {
|
|
907 v2 = ((Player *)(v1 - 6812))->GetMajorConditionrIdx();
|
|
908 if ( v2 == 18 || v2 == 17 )
|
|
909 {
|
|
910 *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed);
|
|
911 if ( *((short *)v1 + 1) >= *((short *)v1 + 2) )
|
|
912 {
|
|
913 if ( *(short *)v1 != 1 || rand() % 5 )
|
|
914 {
|
|
915 *((short *)v1 + 1) = 0;
|
|
916 *(short *)v1 = 1;
|
|
917 *((short *)v1 + 2) = rand() % 256 + 32;
|
|
918 }
|
|
919 else
|
|
920 {
|
|
921 v4 = rand() % 100;
|
|
922 if ( v4 >= 25 )
|
|
923 {
|
|
924 if ( v4 >= 31 )
|
|
925 {
|
|
926 if ( v4 >= 37 )
|
|
927 {
|
|
928 if ( v4 >= 43 )
|
|
929 {
|
|
930 if ( v4 >= 46 )
|
|
931 {
|
|
932 if ( v4 >= 52 )
|
|
933 {
|
|
934 if ( v4 >= 58 )
|
|
935 {
|
|
936 if ( v4 >= 64 )
|
|
937 {
|
|
938 if ( v4 >= 70 )
|
|
939 {
|
|
940 if ( v4 >= 76 )
|
|
941 {
|
|
942 if ( v4 >= 82 )
|
|
943 {
|
|
944 if ( v4 >= 88 )
|
|
945 *(short *)v1 = (v4 >= 94) + 29;
|
|
946 else
|
|
947 *(short *)v1 = 57;
|
|
948 }
|
|
949 else
|
|
950 {
|
|
951 *(short *)v1 = 56;
|
|
952 }
|
|
953 }
|
|
954 else
|
|
955 {
|
|
956 *(short *)v1 = 55;
|
|
957 }
|
|
958 }
|
|
959 else
|
|
960 {
|
|
961 *(short *)v1 = 54;
|
|
962 }
|
|
963 }
|
|
964 else
|
|
965 {
|
|
966 *(short *)v1 = 20;
|
|
967 }
|
|
968 }
|
|
969 else
|
|
970 {
|
|
971 *(short *)v1 = 19;
|
|
972 }
|
|
973 }
|
|
974 else
|
|
975 {
|
|
976 *(short *)v1 = 18;
|
|
977 }
|
|
978 }
|
|
979 else
|
|
980 {
|
|
981 *(short *)v1 = 17;
|
|
982 }
|
|
983 }
|
|
984 else
|
|
985 {
|
|
986 *(short *)v1 = 16;
|
|
987 }
|
|
988 }
|
|
989 else
|
|
990 {
|
|
991 *(short *)v1 = 15;
|
|
992 }
|
|
993 }
|
|
994 else
|
|
995 {
|
|
996 *(short *)v1 = 14;
|
|
997 }
|
|
998 }
|
|
999 else
|
|
1000 {
|
|
1001 *(short *)v1 = 13;
|
|
1002 }
|
|
1003 v5 = 0;
|
|
1004 *((short *)v1 + 1) = 0;
|
|
1005 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 )
|
|
1006 {
|
|
1007 LABEL_56:
|
|
1008 v5 = 0;
|
|
1009 }
|
|
1010 else
|
|
1011 {
|
|
1012 v6 = pPlayerFrameTable->pFrames;
|
|
1013 while ( v6->uSequenceID != *(short *)v1 )
|
|
1014 {
|
|
1015 ++v5;
|
|
1016 ++v6;
|
|
1017 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames )
|
|
1018 goto LABEL_56;
|
|
1019 }
|
|
1020 }
|
|
1021 *((short *)v1 + 2) = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength;
|
|
1022 }
|
|
1023 }
|
|
1024 }
|
|
1025 else
|
|
1026 {
|
|
1027 v3 = *(short *)v1;
|
|
1028 if ( *(short *)v1 != 34 && v3 != 35 && v3 != 36
|
|
1029 || (signed int)(pMiscTimer->uTimeElapsed + *((short *)v1 + 1)) >= *((short *)v1 + 2) )
|
|
1030 {
|
|
1031 *((short *)v1 + 2) = 0;
|
|
1032 *((short *)v1 + 1) = 0;
|
|
1033 switch ( v2 )
|
|
1034 {
|
|
1035 case 0xEu:
|
|
1036 *(short *)v1 = 98;
|
|
1037 break;
|
|
1038 case 0xFu:
|
|
1039 *(short *)v1 = 12;
|
|
1040 break;
|
|
1041 case 0x10u:
|
|
1042 *(short *)v1 = 99;
|
|
1043 break;
|
|
1044 case 0u:
|
|
1045 *(short *)v1 = 2;
|
|
1046 break;
|
|
1047 case 1u:
|
|
1048 *(short *)v1 = 3;
|
|
1049 break;
|
|
1050 case 2u:
|
|
1051 *(short *)v1 = 4;
|
|
1052 break;
|
|
1053 case 3u:
|
|
1054 *(short *)v1 = 5;
|
|
1055 break;
|
|
1056 case 4u:
|
|
1057 *(short *)v1 = 6;
|
|
1058 break;
|
|
1059 case 5u:
|
|
1060 *(short *)v1 = 7;
|
|
1061 break;
|
|
1062 case 6u:
|
|
1063 case 8u:
|
|
1064 case 0xAu:
|
|
1065 *(short *)v1 = 8;
|
|
1066 break;
|
|
1067 case 7u:
|
|
1068 case 9u:
|
|
1069 case 0xBu:
|
|
1070 *(short *)v1 = 9;
|
|
1071 break;
|
|
1072 case 0xCu:
|
|
1073 *(short *)v1 = 10;
|
|
1074 break;
|
|
1075 case 0xDu:
|
|
1076 *(short *)v1 = 11;
|
|
1077 break;
|
|
1078 default:
|
|
1079 break;
|
|
1080 }
|
|
1081 }
|
|
1082 else
|
|
1083 {
|
|
1084 *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed);
|
|
1085 }
|
|
1086 }
|
|
1087 v1 += 6972;
|
|
1088 --v11;
|
|
1089 }
|
|
1090 while ( v11 );
|
|
1091 v7 = (char *)&pParty->pHirelings[0].evtb;
|
|
1092 do
|
|
1093 {
|
|
1094 v8 = *((int *)v7 + 1);
|
|
1095 if ( v8 )
|
|
1096 {
|
|
1097 v9 = *((int *)v7 - 1);
|
|
1098 v10 = pMiscTimer->uTimeElapsed + *(int *)v7;
|
|
1099 if ( (signed int)v10 >= v8 )
|
|
1100 {
|
|
1101 v9 = 0;
|
|
1102 v8 = 0;
|
|
1103 v10 = 0;
|
|
1104 memset(v7 - 44, 0, 0x4Cu);
|
|
1105 pParty->field_709 = 0;
|
|
1106 sub_44A56A();
|
|
1107 viewparams->bRedrawGameUI = 1;
|
|
1108 }
|
|
1109 *(int *)v7 = v10;
|
|
1110 *((int *)v7 + 1) = v8;
|
|
1111 *((int *)v7 - 1) = v9;
|
|
1112 }
|
|
1113 v7 += 76;
|
|
1114 }
|
|
1115 while ( (signed int)v7 < (signed int)&pParty->field_777C[1] );
|
|
1116 }
|
|
1117 }
|
|
1118 // A75070: using guessed type int dword_A75070;
|
|
1119
|
|
1120 //----- (00490D02) --------------------------------------------------------
|
|
1121 void Party::RestAndHeal()
|
|
1122 {
|
|
1123 SpellBuff *v1; // esi@1
|
|
1124 Player *v2; // esi@4
|
|
1125 signed int v3; // ebx@4
|
|
1126 SpellBuff *v4; // edi@4
|
|
1127 int v5; // eax@9
|
|
1128 char v6; // zf@9
|
|
1129 char *v7; // eax@10
|
|
1130 signed int v8; // ecx@10
|
|
1131 int v9; // eax@18
|
|
1132 int v10; // eax@25
|
|
1133 signed int v11; // ecx@26
|
|
1134 signed int v12; // [sp-4h] [bp-1Ch]@26
|
|
1135 Party *v13; // [sp+Ch] [bp-Ch]@1
|
|
1136 signed int v14; // [sp+10h] [bp-8h]@10
|
|
1137 signed int v15; // [sp+14h] [bp-4h]@3
|
|
1138
|
|
1139 v13 = this;
|
|
1140 v1 = pParty->pPartyBuffs;
|
|
1141 do
|
|
1142 {
|
|
1143 v1->Reset();
|
|
1144 ++v1;
|
|
1145 }
|
|
1146 while ( (signed int)v1 < (signed int)pParty->pPlayers );
|
|
1147 v15 = 0;
|
|
1148 do
|
|
1149 {
|
|
1150 v2 = &pParty->pPlayers[v15];
|
|
1151 v3 = 20;
|
|
1152 v4 = v2->pPlayerBuffs;
|
|
1153 do
|
|
1154 {
|
|
1155 v4->Reset();
|
|
1156 ++v4;
|
|
1157 --v3;
|
|
1158 }
|
|
1159 while ( v3 );
|
|
1160 v2->Zero();
|
|
1161 if ( v2->pConditions[14] || v2->pConditions[15] || v2->pConditions[16] )
|
|
1162 goto LABEL_33;
|
|
1163 LODWORD(v2->pConditions[13]) = 0;
|
|
1164 HIDWORD(v2->pConditions[13]) = 0;
|
|
1165 LODWORD(v2->pConditions[4]) = 0;
|
|
1166 HIDWORD(v2->pConditions[4]) = 0;
|
|
1167 LODWORD(v2->pConditions[2]) = 0;
|
|
1168 HIDWORD(v2->pConditions[2]) = 0;
|
|
1169 LODWORD(v2->pConditions[3]) = 0;
|
|
1170 HIDWORD(v2->pConditions[3]) = 0;
|
|
1171 LODWORD(v2->pConditions[1]) = 0;
|
|
1172 HIDWORD(v2->pConditions[1]) = 0;
|
|
1173 v2->uTimeToRecovery = 0;
|
|
1174 v2->sHealth = v2->GetMaxHealth();
|
|
1175 v5 = v2->GetMaxMana();
|
|
1176 v6 = v2->uClass == 35;
|
|
1177 v2->sMana = v5;
|
|
1178 if ( v6 )
|
|
1179 {
|
|
1180 v14 = 0;
|
|
1181 v7 = &v2->pInventoryItems[0].field_1A;
|
|
1182 v8 = 138;
|
|
1183 do
|
|
1184 {
|
|
1185 if ( *(int *)(v7 - 26) == 601 && (unsigned __int8)*v7 == v15 + 1 )
|
|
1186 v14 = 1;
|
|
1187 v7 += 36;
|
|
1188 --v8;
|
|
1189 }
|
|
1190 while ( v8 );
|
|
1191 if ( !v14 )
|
|
1192 {
|
|
1193 v2->sHealth = v2->GetMaxHealth() / 2;
|
|
1194 v2->sMana = v2->GetMaxMana() / 2;
|
|
1195 }
|
|
1196 }
|
|
1197 if ( !v2->pConditions[17] )
|
|
1198 {
|
|
1199 if ( v2->pConditions[10] || v2->pConditions[11] )
|
|
1200 {
|
|
1201 v11 = 4;
|
|
1202 v12 = 4;
|
|
1203 }
|
|
1204 else
|
|
1205 {
|
|
1206 if ( !v2->pConditions[8] && !v2->pConditions[9] )
|
|
1207 {
|
|
1208 if ( !v2->pConditions[6] && !v2->pConditions[7] )
|
|
1209 goto LABEL_30;
|
|
1210 v2->sHealth /= 2;
|
|
1211 v10 = v2->sMana / 2;
|
|
1212 goto LABEL_29;
|
|
1213 }
|
|
1214 v11 = 3;
|
|
1215 v12 = 3;
|
|
1216 }
|
|
1217 v2->sHealth /= v11;
|
|
1218 v10 = v2->sMana / v12;
|
|
1219 LABEL_29:
|
|
1220 v2->sMana = v10;
|
|
1221 goto LABEL_30;
|
|
1222 }
|
|
1223 v9 = v2->sHealth;
|
|
1224 v2->sMana = 0;
|
|
1225 v2->sHealth = v9 / 2;
|
|
1226 LABEL_30:
|
|
1227 if ( v2->pConditions[5] )
|
|
1228 v2->sMana = 0;
|
|
1229 _4909F4();
|
|
1230 LABEL_33:
|
|
1231 ++v15;
|
|
1232 }
|
|
1233 while ( v15 < 4 );
|
|
1234 pParty->field_764 = 0;
|
|
1235 } |