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