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