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