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 Party *v2; // esi@1
|
|
75
|
|
76 v2 = this;
|
|
77 sub_421B2C_PlaceInInventory_or_DropPickedItem();
|
|
78 memcpy(&v2->pPickedItem, pItem, sizeof(v2->pPickedItem));
|
|
79 pMouse->SetCursorBitmapFromItemID(v2->pPickedItem.uItemID);
|
|
80 }
|
|
81
|
|
82 //----- (0049370F) --------------------------------------------------------
|
|
83 int Party::GetNextActiveCharacter()
|
|
84 {
|
|
85 Party *v1; // esi@1
|
|
86 int v2; // eax@4
|
|
87 signed int v4; // ecx@6
|
89
|
88 Player *v5; // edx@6
|
0
|
89 Player *v6; // eax@7
|
89
|
90 Player *v7; // ecx@23
|
0
|
91 signed int v8; // esi@23
|
|
92 signed int v9; // edx@23
|
|
93 Player **v10; // edi@23
|
|
94 Player *v11; // eax@24
|
|
95 int v12; // [sp+Ch] [bp-4h]@1
|
|
96
|
|
97 v1 = this;
|
|
98 v12 = 0;
|
|
99 if ( pParty->bTurnBasedModeOn == 1 )
|
|
100 {
|
141
|
101 if ( pTurnEngine->field_4 != 2 || (pTurnEngine->pQueue[0].uPackedID & 7) != OBJECT_Player)
|
0
|
102 return 0;
|
|
103 v2 = pTurnEngine->pQueue[0].uPackedID >> 3;
|
|
104 return v2 + 1;
|
|
105 }
|
|
106 v4 = 0;
|
89
|
107 v5 = v1->pPlayers;//[0].uTimeToRecovery;
|
0
|
108 while ( 1 )
|
|
109 {
|
|
110 v6 = ::pPlayers[v4 + 1];
|
|
111 if ( v6->pConditions[2]
|
|
112 || v6->pConditions[12]
|
|
113 || v6->pConditions[13]
|
|
114 || v6->pConditions[14]
|
|
115 || v6->pConditions[15]
|
|
116 || v6->pConditions[16]
|
89
|
117 || v5->uTimeToRecovery )
|
0
|
118 {
|
|
119 byte_AE3368[v4] = 1;
|
|
120 }
|
89
|
121 else if ( !byte_AE3368[v4] )
|
0
|
122 break;
|
|
123 ++v4;
|
89
|
124 ++v5;
|
0
|
125 if ( v4 >= 4 )
|
89
|
126 break;
|
0
|
127 }
|
89
|
128 if(v4<4)
|
|
129 {
|
|
130 v12 = v4;
|
|
131 byte_AE3368[v4] = 1;
|
|
132 }
|
0
|
133 if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] )
|
|
134 memset(byte_AE3368, 0, 4u);
|
|
135 v2 = v12;
|
|
136 if ( v12 )
|
|
137 return v2 + 1;
|
89
|
138 v7 = v1->pPlayers;//[0].uSpeedBonus;
|
0
|
139 v8 = 0;
|
|
140 v9 = 1;
|
|
141 v10 = &::pPlayers[1];
|
|
142 while ( 2 )
|
|
143 {
|
|
144 v11 = *v10;
|
|
145 if ( !(*v10)->pConditions[2]
|
|
146 && !v11->pConditions[12]
|
|
147 && !v11->pConditions[13]
|
|
148 && !v11->pConditions[14]
|
|
149 && !v11->pConditions[15]
|
|
150 && !v11->pConditions[16]
|
89
|
151 && !v7->uTimeToRecovery )
|
0
|
152 {
|
|
153 if ( v12 )
|
|
154 {
|
89
|
155 if ( v7->uSpeedBonus > v8 )
|
0
|
156 {
|
89
|
157 v8 = v7->uSpeedBonus;
|
|
158 v12 = v9;
|
0
|
159 }
|
|
160 }
|
|
161 else
|
|
162 {
|
|
163 v8 = *(short *)v7;
|
|
164 v12 = v9;
|
|
165 }
|
|
166 }
|
|
167 ++v10;
|
|
168 ++v9;
|
89
|
169 ++v7;
|
0
|
170 if ( v9 - 1 < 4 )
|
|
171 continue;
|
|
172 return v12;
|
|
173 }
|
|
174 }
|
|
175
|
|
176
|
|
177 //----- (00493244) --------------------------------------------------------
|
|
178 bool Party::HasItem(unsigned int uItemID)
|
|
179 {
|
89
|
180 Player *v2; // edx@1
|
0
|
181 signed int v3; // ecx@2
|
|
182 ItemGen *v4; // eax@2
|
|
183
|
89
|
184 v2 = pParty->pPlayers;//[0].pInventoryItems;
|
|
185 while ( v2 <= &pParty->pPlayers[3] )
|
0
|
186 {
|
|
187 v3 = 0;
|
89
|
188 v4 = v2->pInventoryItems;
|
0
|
189 do
|
|
190 {
|
|
191 if ( v4->uItemID == uItemID )
|
|
192 return 1;
|
|
193 ++v3;
|
|
194 ++v4;
|
|
195 }
|
|
196 while ( v3 < 138 );
|
89
|
197 ++v2;
|
0
|
198 }
|
|
199 return 0;
|
|
200 }
|
|
201
|
|
202
|
|
203 //----- (00492AD5) --------------------------------------------------------
|
|
204 __int16 Party::SetFood(unsigned int uNumFood)
|
|
205 {
|
|
206 __int16 result; // ax@1
|
|
207
|
|
208 pUIAnim_Food->uAnimTime = 0;
|
|
209 pParty->uNumFoodRations = uNumFood;
|
|
210 result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
211 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
212 return result;
|
|
213 }
|
|
214
|
|
215 //----- (00492B03) --------------------------------------------------------
|
|
216 void Party::TakeFood(unsigned int uNumFood)
|
|
217 {
|
|
218 if ( ((pParty->uNumFoodRations - uNumFood) & 0x80000000u) == 0 )
|
|
219 pParty->uNumFoodRations -= uNumFood;
|
|
220 else
|
|
221 pParty->uNumFoodRations = 0;
|
|
222 pUIAnim_Food->uAnimTime = 0;
|
|
223 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
224 }
|
|
225
|
|
226 //----- (00492B42) --------------------------------------------------------
|
|
227 __int16 Party::GiveFood(unsigned int _this)
|
|
228 {
|
|
229 __int16 result; // ax@1
|
|
230
|
|
231 pParty->uNumFoodRations += _this;
|
|
232 pUIAnim_Food->uAnimTime = 0;
|
|
233 result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
234 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
|
|
235 return result;
|
|
236 }
|
|
237
|
|
238 //----- (00492B70) --------------------------------------------------------
|
|
239 void Party::SetGold(unsigned int uNumGold)
|
|
240 {
|
|
241 pParty->uNumGold = uNumGold;
|
|
242 pUIAnim_Gold->uAnimTime = 0;
|
|
243 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
|
|
244 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
|
|
245 }
|
|
246
|
|
247 //----- (00492BB6) --------------------------------------------------------
|
|
248 void Party::TakeGold(unsigned int uNumGold)
|
|
249 {
|
|
250 if ( uNumGold <= pParty->uNumGold )
|
|
251 pParty->uNumGold -= uNumGold;
|
|
252 else
|
|
253 pParty->uNumGold = 0;
|
|
254 pUIAnim_Gold->uAnimTime = 0;
|
|
255 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
|
|
256 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
|
|
257 }
|
|
258
|
|
259 //----- (0049135E) --------------------------------------------------------
|
|
260 unsigned int Party::GetPartyFame()
|
|
261 {
|
|
262 signed int v1; // eax@1
|
89
|
263 Player *v2; // ecx@1
|
0
|
264 signed int v3; // edx@1
|
|
265
|
|
266 v1 = 0;
|
89
|
267 v2 = this->pPlayers;//[0].uExperience;
|
0
|
268 v3 = 4; // (E exp) / 1000
|
|
269 do
|
|
270 {
|
89
|
271 v1 += (int)v2->uExperience; // needs review
|
|
272 ++v2;
|
0
|
273 --v3;
|
|
274 }
|
|
275 while ( v3 );
|
|
276 return v1 / 1000;
|
|
277 }
|
|
278
|
|
279 //----- (0049137D) --------------------------------------------------------
|
|
280 void Party::CreateDefaultParty(char bGiveItems)
|
|
281 {
|
|
282 Party *pParty; // esi@1
|
|
283 signed __int16 v3; // ax@1
|
135
|
284 //int pResMagicBase; // ecx@1
|
0
|
285 Player *pCharacter; // esi@3
|
|
286 signed int uSpellBookPageCount; // edx@5
|
|
287 int pMagicSkills; // eax@5
|
|
288 int uSkillIdx; // eax@11
|
|
289 //unsigned __int8 v9; // zf@37
|
|
290 //char v10; // sf@37
|
|
291 //unsigned __int8 v11; // of@37
|
|
292 char *pAttributes; // eax@38
|
|
293 signed int v13; // ecx@38
|
|
294 int uMaxSP; // eax@42
|
|
295 unsigned int v15; // [sp-4h] [bp-44h]@14
|
|
296 unsigned int v16; // [sp-4h] [bp-44h]@26
|
|
297 int v17; // [sp+10h] [bp-30h]@1
|
|
298 int v18; // [sp+14h] [bp-2Ch]@11
|
|
299 signed int uNumPlayers; // [sp+18h] [bp-28h]@1
|
|
300 ItemGen Dst; // [sp+1Ch] [bp-24h]@10
|
|
301
|
130
|
302
|
0
|
303 pParty = this;
|
130
|
304
|
|
305 pHireling1Name[0] = 0;
|
|
306 pHireling2Name[0] = 0;
|
134
|
307 pParty->field_709 = 0;
|
130
|
308 memset(pHirelings, 0, 2 * sizeof(*pHirelings));
|
|
309
|
0
|
310 strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan
|
|
311 pParty->pPlayers[0].field_1928 = 17;
|
|
312 pParty->pPlayers[0].uFace = 17;
|
|
313 pParty->pPlayers[0].field_1924 = 17;
|
|
314 pParty->pPlayers[0].uVoiceID = 17;
|
|
315 pParty->pPlayers[0].uMight = 30;
|
|
316 pParty->pPlayers[0].uIntelligence = 5;
|
|
317 pParty->pPlayers[0].uWillpower = 5;
|
|
318 pParty->pPlayers[0].uEndurance = 13;
|
|
319 pParty->pPlayers[0].uAccuracy = 13;
|
|
320 pParty->pPlayers[0].uSpeed = 14;
|
|
321 pParty->pPlayers[0].uLuck = 7;
|
135
|
322 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather
|
|
323 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_ARMSMASTER] = 1; // armsmaster
|
|
324 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_BOW] = 1; // bow
|
|
325 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_SWORD] = 1; // sword
|
0
|
326 pParty->pPlayers[1].field_1928 = 3;
|
|
327 pParty->pPlayers[1].uFace = 3;
|
|
328 pParty->pPlayers[1].field_1924 = 3;
|
|
329 pParty->pPlayers[1].uVoiceID = 3;
|
|
330 strcpy(pParty->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); //Roderic
|
|
331 pParty->pPlayers[1].uMight = 13;
|
|
332 pParty->pPlayers[1].uIntelligence = 9;
|
|
333 pParty->pPlayers[1].uWillpower = 9;
|
|
334 pParty->pPlayers[1].uEndurance = 13;
|
|
335 pParty->pPlayers[1].uAccuracy = 13;
|
|
336 pParty->pPlayers[1].uSpeed = 13;
|
|
337 pParty->pPlayers[1].uLuck = 13;
|
135
|
338 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather
|
|
339 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_STEALING] = 1; // stealing
|
|
340 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_DAGGER] = 1; // dagger
|
|
341 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_TRAP_DISARM] = 1; // disarm trap
|
0
|
342 pParty->pPlayers[2].field_1928 = 14;
|
|
343 pParty->pPlayers[2].uFace = 14;
|
|
344 pParty->pPlayers[2].field_1924 = 14;
|
|
345 pParty->pPlayers[2].uVoiceID = 14;
|
|
346 strcpy(pParty->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); // Serena
|
|
347 pParty->pPlayers[2].uMight = 12;
|
|
348 pParty->pPlayers[2].uIntelligence = 9;
|
|
349 pParty->pPlayers[2].uWillpower = 20;
|
|
350 pParty->pPlayers[2].uEndurance = 22;
|
|
351 pParty->pPlayers[2].uAccuracy = 7;
|
|
352 pParty->pPlayers[2].uSpeed = 13;
|
|
353 pParty->pPlayers[2].uLuck = 7;
|
135
|
354 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_ALCHEMY] = 1; // alchemy
|
|
355 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather
|
|
356 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_BODY] = 1; // body
|
|
357 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_MACE] = 1; // mace
|
0
|
358 strcpy(pParty->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); // Alexis
|
|
359 v3 = 10;
|
|
360 pParty->pPlayers[3].field_1928 = 10;
|
|
361 pParty->pPlayers[3].uFace = 10;
|
135
|
362 //pResMagicBase = (int)&pParty->pPlayers[0].sResMagicBase;
|
0
|
363 pParty->pPlayers[3].uEndurance = 13;
|
|
364 pParty->pPlayers[3].uAccuracy = 13;
|
|
365 pParty->pPlayers[3].uSpeed = 13;
|
|
366 pParty->pPlayers[3].field_1924 = 10;
|
|
367 pParty->pPlayers[3].uVoiceID = 10;
|
|
368 pParty->pPlayers[3].uMight = 5;
|
|
369 pParty->pPlayers[3].uIntelligence = 30;
|
|
370 pParty->pPlayers[3].uWillpower = 9;
|
|
371 pParty->pPlayers[3].uLuck = 7;
|
135
|
372 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather
|
|
373 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_AIR] = 1; // air
|
|
374 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_FIRE] = 1; // fire
|
|
375 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_STAFF] = 1; // staff
|
0
|
376 //uNumPlayers = 4;
|
|
377 //while ( 1 )
|
|
378 for (uNumPlayers = 0; uNumPlayers < 4; uNumPlayers++)
|
|
379 {
|
135
|
380 pCharacter = &pParty->pPlayers[uNumPlayers];
|
|
381 if (pCharacter->classType == PLAYER_CLASS_KNIGHT)
|
|
382 pCharacter->sResMagicBase = v3; //player[i].pResMagicBase
|
0
|
383 uSpellBookPageCount = 0;
|
|
384 //pMagicSkills = pPlayers[uNumPlayers].pActiveSkills[12];// Skills
|
|
385 //while ( !*(short *)pMagicSkills ) //player[i].skillFire
|
|
386 for (int i = 0; i < 9; i++)//for Magic Book
|
|
387 {
|
|
388 //++uSpellBookPageCount;
|
|
389 //pMagicSkills++;
|
|
390 //if ( uSpellBookPageCount >= 9 )
|
|
391 //goto LABEL_10;
|
|
392 if (pPlayers[uNumPlayers].pActiveSkills[12+i])
|
|
393 ++uSpellBookPageCount;
|
|
394 }
|
198
|
395 pCharacter->lastOpenedSpellbookPage = uSpellBookPageCount;
|
0
|
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 uAlignment = 1;
|
|
559
|
|
560 SetUserInterface(uAlignment, true);
|
|
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
|
|
784 //----- (0043AD34) --------------------------------------------------------
|
|
785 void Party::Yell()
|
|
786 {
|
90
|
787 Actor *v0; // esi@5
|
0
|
788 int v1; // edi@9
|
|
789 int v2; // ebx@9
|
|
790 int v3; // eax@9
|
|
791 unsigned int v4; // [sp+8h] [bp-4h]@4
|
|
792
|
|
793 if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime > 0 )
|
|
794 pParty->pPartyBuffs[11].Reset();
|
|
795 if ( pParty->bTurnBasedModeOn != 1 )
|
|
796 {
|
|
797 v4 = 0;
|
|
798 if ( (signed int)uNumActors > 0 )
|
|
799 {
|
90
|
800 v0 = pActors;//[0].pMonsterInfo.uMovementType;
|
0
|
801 do
|
|
802 {
|
90
|
803 if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != 4 && v0->pMonsterInfo.uMovementType != 5 )
|
0
|
804 {
|
90
|
805 v1 = abs(v0->vPosition.x - pParty->vPosition.x);
|
|
806 v2 = abs(v0->vPosition.y - pParty->vPosition.y);
|
|
807 v3 = abs(v0->vPosition.z - pParty->vPosition.z);
|
0
|
808 if ( (double)sub_4621DA(v1, v2, v3) < 512.0 )
|
|
809 Actor::_402968(v4, 4, 0, 0);
|
|
810 }
|
|
811 ++v4;
|
90
|
812 ++v0;
|
0
|
813 }
|
|
814 while ( (signed int)v4 < (signed int)uNumActors );
|
|
815 }
|
|
816 }
|
|
817 }
|
|
818
|
|
819 //----- (00491BF9) --------------------------------------------------------
|
|
820 void Party::ResetPosMiscAndSpellBuffs()
|
|
821 {
|
|
822 Party *v1; // esi@1
|
89
|
823 Player *v2; // edi@1
|
0
|
824 SpellBuff *v3; // ebx@2
|
|
825 SpellBuff *v4; // esi@5
|
|
826 signed int v5; // edi@5
|
|
827 signed int v6; // [sp+8h] [bp-8h]@1
|
|
828 signed int v7; // [sp+Ch] [bp-4h]@2
|
|
829
|
|
830 v1 = this;
|
|
831 this->vPosition.y = 0;
|
|
832 this->vPosition.z = 0;
|
|
833 this->vPosition.x = 0;
|
|
834 this->uFallStartY = 0;
|
|
835 this->sRotationY = 0;
|
|
836 this->sRotationX = 0;
|
|
837 this->uFallSpeed = 0;
|
|
838 this->field_28 = 0;
|
|
839 this->uDefaultPartyHeight = 120;
|
|
840 this->field_14 = 37;
|
120
|
841 this->y_rotation_granularity = 25;
|
0
|
842 this->uWalkSpeed = 384;
|
122
|
843 this->y_rotation_speed = 90;
|
0
|
844 this->field_24 = 5;
|
|
845 this->field_6FC = 0;
|
|
846 this->field_708 = 15;
|
|
847 this->field_0 = 25;
|
89
|
848 v2 = this->pPlayers;//[0].pPlayerBuffs;
|
0
|
849 v6 = 4;
|
|
850 do
|
|
851 {
|
89
|
852 v3 = v2->pPlayerBuffs;
|
0
|
853 v7 = 24;
|
|
854 do
|
|
855 {
|
|
856 v3->Reset();
|
|
857 ++v3;
|
|
858 --v7;
|
|
859 }
|
|
860 while ( v7 );
|
89
|
861 ++v2;
|
0
|
862 --v6;
|
|
863 }
|
|
864 while ( v6 );
|
|
865 v4 = v1->pPartyBuffs;
|
|
866 v5 = 20;
|
|
867 do
|
|
868 {
|
|
869 v4->Reset();
|
|
870 ++v4;
|
|
871 --v5;
|
|
872 }
|
|
873 while ( v5 );
|
|
874 }
|
|
875
|
|
876 //----- (004909F4) --------------------------------------------------------
|
130
|
877 void Party::UpdatePlayersAndHirelingsEmotions()
|
0
|
878 {
|
130
|
879 //Player *v1; // esi@2
|
|
880 //unsigned int v2; // eax@3
|
|
881 //__int16 v3; // cx@5
|
0
|
882 int v4; // edx@27
|
130
|
883 //signed int v5; // eax@52
|
|
884 //PlayerFrame *v6; // edx@53
|
|
885 //NPCData *v7; // esi@60
|
|
886 //signed int v8; // ebp@61
|
|
887 //int v9; // ebx@62
|
|
888 //unsigned int v10; // edi@62
|
|
889 //signed int v11; // [sp+0h] [bp-4h]@2
|
|
890
|
|
891 if (dword_A75070 == stru_51076C.field_8)
|
|
892 return;
|
0
|
893
|
130
|
894 dword_A75070 = stru_51076C.field_8;
|
|
895 //v1 = this->pPlayers;//(char *)&this->pPlayers[0].uExpressionID;
|
|
896 for (int i = 0; i < 4; ++i)
|
0
|
897 {
|
130
|
898 auto player = pPlayers + i;
|
|
899 player->uExpressionTimePassed += (unsigned short)pMiscTimer->uTimeElapsed;
|
|
900
|
|
901
|
|
902 auto condition = player->GetMajorConditionIdx();
|
|
903 if (condition == Player::Condition_Good || condition == Player::Condition_Zombie)
|
0
|
904 {
|
130
|
905 if (player->uExpressionTimePassed < player->uExpressionTimeLength)
|
|
906 continue;
|
|
907
|
|
908 player->uExpressionTimePassed = 0;
|
|
909 if (player->expression != 1 || rand() % 5)
|
0
|
910 {
|
130
|
911 player->expression = CHARACTER_EXPRESSION_1;
|
|
912 player->uExpressionTimeLength = rand() % 256 + 32;
|
0
|
913 }
|
|
914 else
|
|
915 {
|
130
|
916 v4 = rand() % 100;
|
|
917 if (v4 < 25) player->expression = CHARACTER_EXPRESSION_13;
|
|
918 else if (v4 < 31) player->expression = CHARACTER_EXPRESSION_14;
|
|
919 else if (v4 < 37) player->expression = CHARACTER_EXPRESSION_15;
|
|
920 else if (v4 < 43) player->expression = CHARACTER_EXPRESSION_16;
|
|
921 else if (v4 < 46) player->expression = CHARACTER_EXPRESSION_17;
|
|
922 else if (v4 < 52) player->expression = CHARACTER_EXPRESSION_18;
|
|
923 else if (v4 < 58) player->expression = CHARACTER_EXPRESSION_19;
|
|
924 else if (v4 < 64) player->expression = CHARACTER_EXPRESSION_20;
|
|
925 else if (v4 < 70) player->expression = CHARACTER_EXPRESSION_54;
|
|
926 else if (v4 < 76) player->expression = CHARACTER_EXPRESSION_55;
|
|
927 else if (v4 < 82) player->expression = CHARACTER_EXPRESSION_56;
|
|
928 else if (v4 < 88) player->expression = CHARACTER_EXPRESSION_57;
|
|
929 else if (v4 < 94) player->expression = CHARACTER_EXPRESSION_29;
|
|
930 else player->expression = CHARACTER_EXPRESSION_30;
|
|
931 }
|
|
932
|
|
933 for (int j = 0; j < pPlayerFrameTable->uNumFrames; ++j)
|
|
934 {
|
|
935 auto frame = pPlayerFrameTable->pFrames + j;
|
|
936 if (frame->expression == player->expression)
|
0
|
937 {
|
130
|
938 player->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[j].uAnimLength;
|
|
939 break;
|
0
|
940 }
|
|
941 }
|
|
942 }
|
130
|
943 else if (player->expression != 34 &&
|
|
944 player->expression != 35 &&
|
|
945 player->expression != 36 ||
|
|
946 player->uExpressionTimePassed >= player->uExpressionTimeLength)
|
0
|
947 {
|
130
|
948 player->uExpressionTimeLength = 0;
|
|
949 player->uExpressionTimePassed = 0;
|
|
950
|
|
951 switch (condition)
|
0
|
952 {
|
130
|
953 case Player::Condition_Dead: player->expression = CHARACTER_EXPRESSION_DEAD; break;
|
|
954 case Player::Condition_Pertified: player->expression = CHARACTER_EXPRESSION_PERTIFIED; break;
|
|
955 case Player::Condition_Eradicated: player->expression = CHARACTER_EXPRESSION_ERADICATED; break;
|
|
956 case Player::Condition_Cursed: player->expression = CHARACTER_EXPRESSION_CURSED; break;
|
|
957 case Player::Condition_Weak: player->expression = CHARACTER_EXPRESSION_WEAK; break;
|
|
958 case Player::Condition_Sleep: player->expression = CHARACTER_EXPRESSION_SLEEP; break;
|
|
959 case Player::Condition_Fear: player->expression = CHARACTER_EXPRESSION_FEAR; break;
|
|
960 case Player::Condition_Drunk: player->expression = CHARACTER_EXPRESSION_DRUNK; break;
|
|
961 case Player::Condition_Insane: player->expression = CHARACTER_EXPRESSION_INSANE; break;
|
|
962 case Player::Condition_Poison1:
|
|
963 case Player::Condition_Poison2:
|
|
964 case Player::Condition_Poison3: player->expression = CHARACTER_EXPRESSION_POISONED; break;
|
|
965 case Player::Condition_Disease1:
|
|
966 case Player::Condition_Disease2:
|
|
967 case Player::Condition_Disease3: player->expression = CHARACTER_EXPRESSION_DISEASED; break;
|
|
968 case Player::Condition_Paralyzed: player->expression = CHARACTER_EXPRESSION_PARALYZED; break;
|
|
969 case Player::Condition_Unconcious: player->expression = CHARACTER_EXPRESSION_UNCONCIOUS; break;
|
|
970 default:
|
|
971 assert(false);
|
0
|
972 }
|
|
973 }
|
130
|
974 }
|
|
975
|
|
976
|
|
977 for (int i = 0; i < 2; ++i)
|
|
978 {
|
|
979 auto hireling = pParty->pHirelings + i;
|
|
980 if (!hireling->_anim_end_time)
|
|
981 continue;
|
|
982
|
|
983 hireling->_anim_current_time += pMiscTimer->uTimeElapsed;
|
|
984 if (hireling->_anim_current_time >= hireling->_anim_end_time)
|
|
985 {
|
|
986 hireling->bDrawSomeAnim = false;
|
|
987 hireling->_anim_current_time = 0;
|
|
988 hireling->_anim_end_time = 0;
|
|
989
|
|
990 assert(sizeof(NPCData) == 0x4C);
|
|
991 memset(hireling, 0, sizeof(*hireling));
|
|
992
|
|
993 pParty->field_709 = 0;
|
134
|
994 sub_44A56A();
|
130
|
995 viewparams->bRedrawGameUI = 1;
|
|
996 }
|
0
|
997 }
|
|
998 }
|
|
999
|
|
1000 //----- (00490D02) --------------------------------------------------------
|
|
1001 void Party::RestAndHeal()
|
|
1002 {
|
|
1003 SpellBuff *v1; // esi@1
|
|
1004 Player *v2; // esi@4
|
|
1005 signed int v3; // ebx@4
|
|
1006 SpellBuff *v4; // edi@4
|
|
1007 int v5; // eax@9
|
|
1008 char v6; // zf@9
|
83
|
1009 ItemGen *v7; // eax@10
|
0
|
1010 signed int v8; // ecx@10
|
|
1011 int v9; // eax@18
|
|
1012 int v10; // eax@25
|
|
1013 signed int v11; // ecx@26
|
|
1014 signed int v12; // [sp-4h] [bp-1Ch]@26
|
|
1015 Party *v13; // [sp+Ch] [bp-Ch]@1
|
|
1016 signed int v14; // [sp+10h] [bp-8h]@10
|
|
1017 signed int v15; // [sp+14h] [bp-4h]@3
|
|
1018
|
|
1019 v13 = this;
|
|
1020 v1 = pParty->pPartyBuffs;
|
|
1021 do
|
|
1022 {
|
|
1023 v1->Reset();
|
|
1024 ++v1;
|
|
1025 }
|
|
1026 while ( (signed int)v1 < (signed int)pParty->pPlayers );
|
|
1027 v15 = 0;
|
|
1028 do
|
|
1029 {
|
|
1030 v2 = &pParty->pPlayers[v15];
|
|
1031 v3 = 20;
|
|
1032 v4 = v2->pPlayerBuffs;
|
|
1033 do
|
|
1034 {
|
|
1035 v4->Reset();
|
|
1036 ++v4;
|
|
1037 --v3;
|
|
1038 }
|
|
1039 while ( v3 );
|
|
1040 v2->Zero();
|
|
1041 if ( v2->pConditions[14] || v2->pConditions[15] || v2->pConditions[16] )
|
|
1042 goto LABEL_33;
|
|
1043 LODWORD(v2->pConditions[13]) = 0;
|
|
1044 HIDWORD(v2->pConditions[13]) = 0;
|
|
1045 LODWORD(v2->pConditions[4]) = 0;
|
|
1046 HIDWORD(v2->pConditions[4]) = 0;
|
|
1047 LODWORD(v2->pConditions[2]) = 0;
|
|
1048 HIDWORD(v2->pConditions[2]) = 0;
|
|
1049 LODWORD(v2->pConditions[3]) = 0;
|
|
1050 HIDWORD(v2->pConditions[3]) = 0;
|
|
1051 LODWORD(v2->pConditions[1]) = 0;
|
|
1052 HIDWORD(v2->pConditions[1]) = 0;
|
|
1053 v2->uTimeToRecovery = 0;
|
|
1054 v2->sHealth = v2->GetMaxHealth();
|
|
1055 v5 = v2->GetMaxMana();
|
135
|
1056 v6 = v2->classType == PLAYER_CLASS_LICH;
|
0
|
1057 v2->sMana = v5;
|
|
1058 if ( v6 )
|
|
1059 {
|
|
1060 v14 = 0;
|
83
|
1061 v7 = v2->pInventoryItems;//[0].field_1A;
|
0
|
1062 v8 = 138;
|
|
1063 do
|
|
1064 {
|
83
|
1065 if ( v7->uItemID == 601 && (unsigned __int8)v7->field_1A== v15 + 1 )
|
0
|
1066 v14 = 1;
|
83
|
1067 ++v7;
|
0
|
1068 --v8;
|
|
1069 }
|
|
1070 while ( v8 );
|
|
1071 if ( !v14 )
|
|
1072 {
|
|
1073 v2->sHealth = v2->GetMaxHealth() / 2;
|
|
1074 v2->sMana = v2->GetMaxMana() / 2;
|
|
1075 }
|
|
1076 }
|
|
1077 if ( !v2->pConditions[17] )
|
|
1078 {
|
|
1079 if ( v2->pConditions[10] || v2->pConditions[11] )
|
|
1080 {
|
|
1081 v11 = 4;
|
|
1082 v12 = 4;
|
|
1083 }
|
|
1084 else
|
|
1085 {
|
|
1086 if ( !v2->pConditions[8] && !v2->pConditions[9] )
|
|
1087 {
|
|
1088 if ( !v2->pConditions[6] && !v2->pConditions[7] )
|
|
1089 goto LABEL_30;
|
|
1090 v2->sHealth /= 2;
|
|
1091 v10 = v2->sMana / 2;
|
|
1092 goto LABEL_29;
|
|
1093 }
|
|
1094 v11 = 3;
|
|
1095 v12 = 3;
|
|
1096 }
|
|
1097 v2->sHealth /= v11;
|
|
1098 v10 = v2->sMana / v12;
|
|
1099 LABEL_29:
|
|
1100 v2->sMana = v10;
|
|
1101 goto LABEL_30;
|
|
1102 }
|
|
1103 v9 = v2->sHealth;
|
|
1104 v2->sMana = 0;
|
|
1105 v2->sHealth = v9 / 2;
|
|
1106 LABEL_30:
|
|
1107 if ( v2->pConditions[5] )
|
|
1108 v2->sMana = 0;
|
130
|
1109 UpdatePlayersAndHirelingsEmotions();
|
0
|
1110 LABEL_33:
|
|
1111 ++v15;
|
|
1112 }
|
|
1113 while ( v15 < 4 );
|
|
1114 pParty->field_764 = 0;
|
|
1115 } |