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