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