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