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