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