Mercurial > mm7
annotate Party.cpp @ 1456:5c95f2246c2a
TE mostly working
author | Gloval |
---|---|
date | Wed, 14 Aug 2013 00:40:23 +0400 |
parents | 16a24dc103e7 |
children | 934074e7fcc1 |
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" |
1295 | 22 #include "Outdoor.h" |
23 #include "Indoor.h" | |
1297 | 24 #include "Texture.h" |
25 #include "LOD.h" | |
26 #include "Sprites.h" | |
27 #include "SpriteObject.h" | |
28 #include "ObjectList.h" | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
29 #include "Conditions.h" |
0 | 30 |
31 Party *pParty; // idb | |
32 | |
33 struct ActionQueue *pPartyActionQueue = new ActionQueue; | |
34 | |
35 | |
36 | |
1035 | 37 |
38 | |
39 //----- (0044A56A) -------------------------------------------------------- | |
40 void Party::CountHirelings() | |
41 { | |
42 field_70A = 0; | |
43 | |
44 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
45 { | |
46 auto npc = pNPCStats->pNewNPCData + i; | |
47 if (npc->Hired() && | |
48 (!pHirelings[0].pName || strcmp(npc->pName, pHirelings[0].pName))) | |
49 { | |
50 if (!pHirelings[1].pName || strcmp(npc->pName, pHirelings[1].pName)) | |
51 ++field_70A; | |
52 } | |
53 } | |
54 } | |
55 | |
56 | |
783 | 57 // inlined |
58 //----- (mm6c::004858D0) -------------------------------------------------- | |
59 void Party::Zero() | |
60 { | |
61 | |
62 uFlags2 = 0; | |
63 uNumGoldInBank = 0; | |
64 | |
65 uCurrentYear = 0; | |
66 uCurrentMonth = 0; | |
67 uCurrentMonthWeek = 0; | |
68 uDaysPlayed = 0; | |
69 uCurrentHour = 0; | |
70 uCurrentMinute = 0; | |
71 uCurrentTimeSecond = 0; | |
72 | |
73 field_6FC = 0; | |
74 days_played_without_rest = 0; | |
75 | |
76 vPosition.y = 0; | |
77 vPosition.z = 0; | |
78 vPosition.x = 0; | |
79 uFallStartY = 0; | |
80 sRotationY = 0; | |
81 sRotationX = 0; | |
82 uFallSpeed = 0; | |
83 field_28 = 0; | |
84 uDefaultPartyHeight = 120; | |
85 field_14 = 37; | |
86 y_rotation_granularity = 25; | |
1425
16a24dc103e7
uninitialized Party::walk_sound_timer leads to crash
Nomad
parents:
1405
diff
changeset
|
87 y_rotation_speed = 90; |
16a24dc103e7
uninitialized Party::walk_sound_timer leads to crash
Nomad
parents:
1405
diff
changeset
|
88 |
783 | 89 uWalkSpeed = 384; |
1425
16a24dc103e7
uninitialized Party::walk_sound_timer leads to crash
Nomad
parents:
1405
diff
changeset
|
90 walk_sound_timer = 0; |
16a24dc103e7
uninitialized Party::walk_sound_timer leads to crash
Nomad
parents:
1405
diff
changeset
|
91 |
783 | 92 field_24 = 5; |
93 field_6FC = 0; | |
94 field_708 = 15; | |
95 field_0 = 25; | |
1425
16a24dc103e7
uninitialized Party::walk_sound_timer leads to crash
Nomad
parents:
1405
diff
changeset
|
96 |
783 | 97 } |
98 | |
99 //inlined | |
100 //----- (mm6c::0045BE90) -------------------------------------------------- | |
101 void ActionQueue::Reset() | |
102 { | |
103 uNumActions = 0; | |
104 } | |
0 | 105 |
106 //----- (004760C1) -------------------------------------------------------- | |
107 void ActionQueue::Add(PartyAction action) | |
108 { | |
109 if (uNumActions < 30) | |
110 pActions[uNumActions++] = action; | |
111 } | |
112 | |
113 //----- (00497FC5) -------------------------------------------------------- | |
114 bool Party::_497FC5_check_party_perception_against_level() | |
115 { | |
116 int uMaxPerception; // edi@1 | |
117 Player *v2; // esi@1 | |
118 signed int v3; // ebx@1 | |
119 Player *v4; // ecx@2 | |
120 signed int v5; // eax@3 | |
121 bool result; // eax@7 | |
122 | |
123 uMaxPerception = 0; | |
124 v2 = this->pPlayers; | |
125 v3 = 4; | |
126 do | |
127 { | |
128 if ( v2->CanAct() ) | |
129 { | |
130 v5 = v2->GetPerception(); | |
131 if ( v5 > uMaxPerception ) | |
132 uMaxPerception = v5; | |
133 } | |
134 ++v2; | |
135 --v3; | |
136 } | |
137 while ( v3 ); | |
138 if ( uLevelMapStatsID && (signed int)uLevelMapStatsID < 77 ) | |
139 result = uMaxPerception >= 2 * pMapStats->pInfos[uLevelMapStatsID]._per; | |
140 else | |
141 result = 0; | |
142 return result; | |
143 } | |
144 | |
145 //----- (004936E1) -------------------------------------------------------- | |
146 void Party::SetHoldingItem(ItemGen *pItem) | |
147 { | |
148 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
201 | 149 memcpy(&pPickedItem, pItem, sizeof(pPickedItem)); |
150 pMouse->SetCursorBitmapFromItemID(pPickedItem.uItemID); | |
0 | 151 } |
152 | |
153 //----- (0049370F) -------------------------------------------------------- | |
154 int Party::GetNextActiveCharacter() | |
155 { | |
156 Party *v1; // esi@1 | |
157 int v2; // eax@4 | |
158 signed int v4; // ecx@6 | |
89 | 159 Player *v5; // edx@6 |
0 | 160 Player *v6; // eax@7 |
89 | 161 Player *v7; // ecx@23 |
0 | 162 signed int v8; // esi@23 |
163 signed int v9; // edx@23 | |
164 Player **v10; // edi@23 | |
165 Player *v11; // eax@24 | |
166 int v12; // [sp+Ch] [bp-4h]@1 | |
167 | |
168 v1 = this; | |
169 v12 = 0; | |
170 if ( pParty->bTurnBasedModeOn == 1 ) | |
171 { | |
1340 | 172 if ( pTurnEngine->turn_stage != 2 || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) != OBJECT_Player) |
0 | 173 return 0; |
848 | 174 v2 = PID_ID(pTurnEngine->pQueue[0].uPackedID); |
0 | 175 return v2 + 1; |
176 } | |
177 v4 = 0; | |
89 | 178 v5 = v1->pPlayers;//[0].uTimeToRecovery; |
0 | 179 while ( 1 ) |
180 { | |
181 v6 = ::pPlayers[v4 + 1]; | |
182 if ( v6->pConditions[2] | |
183 || v6->pConditions[12] | |
184 || v6->pConditions[13] | |
185 || v6->pConditions[14] | |
186 || v6->pConditions[15] | |
187 || v6->pConditions[16] | |
89 | 188 || v5->uTimeToRecovery ) |
0 | 189 { |
190 byte_AE3368[v4] = 1; | |
191 } | |
89 | 192 else if ( !byte_AE3368[v4] ) |
0 | 193 break; |
194 ++v4; | |
89 | 195 ++v5; |
0 | 196 if ( v4 >= 4 ) |
89 | 197 break; |
0 | 198 } |
89 | 199 if(v4<4) |
200 { | |
201 v12 = v4; | |
202 byte_AE3368[v4] = 1; | |
203 } | |
0 | 204 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
|
205 memset(byte_AE3368.data(), 0, 4u); |
0 | 206 v2 = v12; |
207 if ( v12 ) | |
208 return v2 + 1; | |
89 | 209 v7 = v1->pPlayers;//[0].uSpeedBonus; |
0 | 210 v8 = 0; |
211 v9 = 1; | |
212 v10 = &::pPlayers[1]; | |
213 while ( 2 ) | |
214 { | |
215 v11 = *v10; | |
216 if ( !(*v10)->pConditions[2] | |
217 && !v11->pConditions[12] | |
218 && !v11->pConditions[13] | |
219 && !v11->pConditions[14] | |
220 && !v11->pConditions[15] | |
221 && !v11->pConditions[16] | |
89 | 222 && !v7->uTimeToRecovery ) |
0 | 223 { |
224 if ( v12 ) | |
225 { | |
89 | 226 if ( v7->uSpeedBonus > v8 ) |
0 | 227 { |
89 | 228 v8 = v7->uSpeedBonus; |
229 v12 = v9; | |
0 | 230 } |
231 } | |
232 else | |
233 { | |
234 v8 = *(short *)v7; | |
235 v12 = v9; | |
236 } | |
237 } | |
238 ++v10; | |
239 ++v9; | |
89 | 240 ++v7; |
0 | 241 if ( v9 - 1 < 4 ) |
242 continue; | |
243 return v12; | |
244 } | |
245 } | |
246 | |
247 | |
248 //----- (00493244) -------------------------------------------------------- | |
249 bool Party::HasItem(unsigned int uItemID) | |
250 { | |
89 | 251 Player *v2; // edx@1 |
0 | 252 signed int v3; // ecx@2 |
253 ItemGen *v4; // eax@2 | |
254 | |
89 | 255 v2 = pParty->pPlayers;//[0].pInventoryItems; |
256 while ( v2 <= &pParty->pPlayers[3] ) | |
0 | 257 { |
258 v3 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1364
diff
changeset
|
259 v4 = v2->pInventoryItemList; |
0 | 260 do |
261 { | |
262 if ( v4->uItemID == uItemID ) | |
263 return 1; | |
264 ++v3; | |
265 ++v4; | |
266 } | |
267 while ( v3 < 138 ); | |
89 | 268 ++v2; |
0 | 269 } |
270 return 0; | |
271 } | |
272 | |
273 | |
274 //----- (00492AD5) -------------------------------------------------------- | |
593 | 275 void Party::SetFood(unsigned int uNumFood) |
0 | 276 { |
277 pUIAnim_Food->uAnimTime = 0; | |
278 pParty->uNumFoodRations = uNumFood; | |
592 | 279 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; |
0 | 280 } |
281 | |
282 //----- (00492B03) -------------------------------------------------------- | |
283 void Party::TakeFood(unsigned int uNumFood) | |
284 { | |
592 | 285 if (pParty->uNumFoodRations <= uNumFood) |
286 pParty->uNumFoodRations = 0; | |
0 | 287 else |
592 | 288 pParty->uNumFoodRations -= uNumFood; |
289 | |
0 | 290 pUIAnim_Food->uAnimTime = 0; |
592 | 291 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; |
0 | 292 } |
293 | |
294 //----- (00492B42) -------------------------------------------------------- | |
592 | 295 void Party::GiveFood(unsigned int _this) |
0 | 296 { |
297 pParty->uNumFoodRations += _this; | |
298 pUIAnim_Food->uAnimTime = 0; | |
592 | 299 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength; |
0 | 300 } |
301 | |
302 //----- (00492B70) -------------------------------------------------------- | |
303 void Party::SetGold(unsigned int uNumGold) | |
304 { | |
305 pParty->uNumGold = uNumGold; | |
306 pUIAnim_Gold->uAnimTime = 0; | |
592 | 307 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; |
0 | 308 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); |
309 } | |
310 | |
311 //----- (00492BB6) -------------------------------------------------------- | |
312 void Party::TakeGold(unsigned int uNumGold) | |
313 { | |
314 if ( uNumGold <= pParty->uNumGold ) | |
315 pParty->uNumGold -= uNumGold; | |
316 else | |
317 pParty->uNumGold = 0; | |
318 pUIAnim_Gold->uAnimTime = 0; | |
592 | 319 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength; |
0 | 320 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); |
321 } | |
322 | |
323 //----- (0049135E) -------------------------------------------------------- | |
324 unsigned int Party::GetPartyFame() | |
325 { | |
566 | 326 unsigned __int64 total_exp = 0; |
327 for (uint i = 0; i < 4; ++i) | |
328 total_exp += pPlayers[i].uExperience; | |
329 return total_exp / 1000; | |
0 | 330 } |
331 | |
332 //----- (0049137D) -------------------------------------------------------- | |
333 void Party::CreateDefaultParty(char bGiveItems) | |
334 { | |
335 Party *pParty; // esi@1 | |
336 signed __int16 v3; // ax@1 | |
135 | 337 //int pResMagicBase; // ecx@1 |
0 | 338 Player *pCharacter; // esi@3 |
321 | 339 //signed int uSpellBookPageCount; // edx@5 |
0 | 340 int pMagicSkills; // eax@5 |
341 int uSkillIdx; // eax@11 | |
342 //unsigned __int8 v9; // zf@37 | |
343 //char v10; // sf@37 | |
344 //unsigned __int8 v11; // of@37 | |
1071 | 345 ItemGen *pItems; // eax@38 |
0 | 346 signed int v13; // ecx@38 |
347 int uMaxSP; // eax@42 | |
348 unsigned int v15; // [sp-4h] [bp-44h]@14 | |
349 unsigned int v16; // [sp-4h] [bp-44h]@26 | |
350 int v17; // [sp+10h] [bp-30h]@1 | |
351 int v18; // [sp+14h] [bp-2Ch]@11 | |
352 signed int uNumPlayers; // [sp+18h] [bp-28h]@1 | |
353 ItemGen Dst; // [sp+1Ch] [bp-24h]@10 | |
354 | |
130 | 355 |
0 | 356 pParty = this; |
130 | 357 |
358 pHireling1Name[0] = 0; | |
359 pHireling2Name[0] = 0; | |
134 | 360 pParty->field_709 = 0; |
130 | 361 memset(pHirelings, 0, 2 * sizeof(*pHirelings)); |
362 | |
0 | 363 strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan |
1014 | 364 pParty->pPlayers[0].uPrevFace = 17; |
365 pParty->pPlayers[0].uCurrentFace = 17; | |
366 pParty->pPlayers[0].uPrevVoiceID = 17; | |
0 | 367 pParty->pPlayers[0].uVoiceID = 17; |
368 pParty->pPlayers[0].uMight = 30; | |
369 pParty->pPlayers[0].uIntelligence = 5; | |
370 pParty->pPlayers[0].uWillpower = 5; | |
371 pParty->pPlayers[0].uEndurance = 13; | |
372 pParty->pPlayers[0].uAccuracy = 13; | |
373 pParty->pPlayers[0].uSpeed = 14; | |
374 pParty->pPlayers[0].uLuck = 7; | |
135 | 375 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather |
376 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_ARMSMASTER] = 1; // armsmaster | |
377 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_BOW] = 1; // bow | |
378 pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_SWORD] = 1; // sword | |
1014 | 379 pParty->pPlayers[1].uPrevFace = 3; |
380 pParty->pPlayers[1].uCurrentFace = 3; | |
381 pParty->pPlayers[1].uPrevVoiceID = 3; | |
0 | 382 pParty->pPlayers[1].uVoiceID = 3; |
383 strcpy(pParty->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); //Roderic | |
384 pParty->pPlayers[1].uMight = 13; | |
385 pParty->pPlayers[1].uIntelligence = 9; | |
386 pParty->pPlayers[1].uWillpower = 9; | |
387 pParty->pPlayers[1].uEndurance = 13; | |
388 pParty->pPlayers[1].uAccuracy = 13; | |
389 pParty->pPlayers[1].uSpeed = 13; | |
390 pParty->pPlayers[1].uLuck = 13; | |
135 | 391 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather |
392 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_STEALING] = 1; // stealing | |
393 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_DAGGER] = 1; // dagger | |
394 pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_TRAP_DISARM] = 1; // disarm trap | |
1014 | 395 pParty->pPlayers[2].uPrevFace = 14; |
396 pParty->pPlayers[2].uCurrentFace = 14; | |
397 pParty->pPlayers[2].uPrevVoiceID = 14; | |
0 | 398 pParty->pPlayers[2].uVoiceID = 14; |
399 strcpy(pParty->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); // Serena | |
400 pParty->pPlayers[2].uMight = 12; | |
401 pParty->pPlayers[2].uIntelligence = 9; | |
402 pParty->pPlayers[2].uWillpower = 20; | |
403 pParty->pPlayers[2].uEndurance = 22; | |
404 pParty->pPlayers[2].uAccuracy = 7; | |
405 pParty->pPlayers[2].uSpeed = 13; | |
406 pParty->pPlayers[2].uLuck = 7; | |
135 | 407 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_ALCHEMY] = 1; // alchemy |
408 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather | |
409 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_BODY] = 1; // body | |
410 pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_MACE] = 1; // mace | |
0 | 411 strcpy(pParty->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); // Alexis |
412 v3 = 10; | |
1014 | 413 pParty->pPlayers[3].uPrevFace = 10; |
414 pParty->pPlayers[3].uCurrentFace = 10; | |
135 | 415 //pResMagicBase = (int)&pParty->pPlayers[0].sResMagicBase; |
0 | 416 pParty->pPlayers[3].uEndurance = 13; |
417 pParty->pPlayers[3].uAccuracy = 13; | |
418 pParty->pPlayers[3].uSpeed = 13; | |
1014 | 419 pParty->pPlayers[3].uPrevVoiceID = 10; |
0 | 420 pParty->pPlayers[3].uVoiceID = 10; |
421 pParty->pPlayers[3].uMight = 5; | |
422 pParty->pPlayers[3].uIntelligence = 30; | |
423 pParty->pPlayers[3].uWillpower = 9; | |
424 pParty->pPlayers[3].uLuck = 7; | |
135 | 425 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_LEATHER] = 1; // leather |
426 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_AIR] = 1; // air | |
427 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_FIRE] = 1; // fire | |
428 pParty->pPlayers[3].pActiveSkills[PLAYER_SKILL_STAFF] = 1; // staff | |
0 | 429 //uNumPlayers = 4; |
430 //while ( 1 ) | |
431 for (uNumPlayers = 0; uNumPlayers < 4; uNumPlayers++) | |
432 { | |
135 | 433 pCharacter = &pParty->pPlayers[uNumPlayers]; |
434 if (pCharacter->classType == PLAYER_CLASS_KNIGHT) | |
435 pCharacter->sResMagicBase = v3; //player[i].pResMagicBase | |
321 | 436 //uSpellBookPageCount = 0; |
0 | 437 //pMagicSkills = pPlayers[uNumPlayers].pActiveSkills[12];// Skills |
438 //while ( !*(short *)pMagicSkills ) //player[i].skillFire | |
321 | 439 pCharacter->lastOpenedSpellbookPage = 0; |
0 | 440 for (int i = 0; i < 9; i++)//for Magic Book |
441 { | |
442 //++uSpellBookPageCount; | |
443 //pMagicSkills++; | |
444 //if ( uSpellBookPageCount >= 9 ) | |
445 //goto LABEL_10; | |
446 if (pPlayers[uNumPlayers].pActiveSkills[12+i]) | |
321 | 447 { |
448 pCharacter->lastOpenedSpellbookPage = i; | |
449 break; | |
450 } | |
0 | 451 } |
452 //LABEL_10: | |
453 pCharacter->uExpressionTimePassed = 0; | |
454 Dst.Reset(); | |
455 if ( bGiveItems ) | |
456 { | |
439 | 457 pItemsTable->GenerateItem(2, 40, &Dst); //ring |
0 | 458 pCharacter->AddItem2(-1, &Dst); |
459 //uSkillIdx = 0; | |
460 //v18 = 0; | |
461 //do | |
462 for (uSkillIdx = 0; uSkillIdx < 36; uSkillIdx++) | |
463 { | |
464 if ( pCharacter->pActiveSkills[uSkillIdx] ) | |
465 { | |
466 switch ( uSkillIdx ) | |
467 { | |
468 case PLAYER_SKILL_STAFF: | |
469 v15 = ITEM_STAFF_1; | |
470 pCharacter->WearItem(v15); | |
471 break; | |
472 case PLAYER_SKILL_SWORD: | |
473 v15 = ITEM_LONGSWORD_1; | |
474 pCharacter->WearItem(v15); | |
475 break; | |
476 case PLAYER_SKILL_DAGGER: | |
477 v15 = ITEM_DAGGER_1; | |
478 pCharacter->WearItem(v15); | |
479 break; | |
480 case PLAYER_SKILL_AXE: | |
481 v15 = ITEM_AXE_1; | |
482 pCharacter->WearItem(v15); | |
483 break; | |
484 case PLAYER_SKILL_SPEAR: | |
485 v15 = ITEM_SPEAR_1; | |
486 pCharacter->WearItem(v15); | |
487 break; | |
488 case PLAYER_SKILL_BOW: | |
489 v15 = ITEM_CROSSBOW_1; | |
490 pCharacter->WearItem(v15); | |
491 break; | |
492 case PLAYER_SKILL_MACE: | |
493 v15 = ITEM_MACE_1; | |
494 pCharacter->WearItem(v15); | |
495 break; | |
496 case PLAYER_SKILL_SHIELD: | |
497 v15 = ITEM_BUCKLER_1; | |
498 pCharacter->WearItem(v15); | |
499 break; | |
500 case PLAYER_SKILL_LEATHER: | |
501 v15 = ITEM_LEATHER_1; | |
502 pCharacter->WearItem(v15); | |
503 break; | |
504 case PLAYER_SKILL_CHAIN: | |
505 v15 = ITEM_CHAINMAIL_1; | |
506 pCharacter->WearItem(v15); | |
507 break; | |
508 case PLAYER_SKILL_PLATE: | |
509 v15 = ITEM_PLATE_1; | |
510 pCharacter->WearItem(v15); | |
511 break; | |
512 case PLAYER_SKILL_FIRE: | |
513 v16 = ITEM_SPELLBOOK_FIRE_STRIKE; | |
514 pCharacter->AddItem(-1, v16); | |
515 break; | |
516 case PLAYER_SKILL_AIR: | |
517 v16 = ITEM_SPELLBOOK_AIR_FEATHER_FALL; | |
518 pCharacter->AddItem(-1, v16); | |
519 break; | |
520 case PLAYER_SKILL_WATER: | |
521 v16 = ITEM_SPELLBOOK_WATER_POISON_SPRAY; | |
522 pCharacter->AddItem(-1, v16); | |
523 break; | |
524 case PLAYER_SKILL_EARTH: | |
525 v16 = ITEM_SPELLBOOK_EARTH_SLOW; | |
526 pCharacter->AddItem(-1, v16); | |
527 break; | |
528 case PLAYER_SKILL_SPIRIT: | |
529 v16 = ITEM_SPELLBOOK_SPIRIT_BLESS; | |
530 pCharacter->AddItem(-1, v16); | |
531 break; | |
532 case PLAYER_SKILL_MIND: | |
533 v16 = ITEM_SPELLBOOK_MIND_MIND_BLAST; | |
534 pCharacter->AddItem(-1, v16); | |
535 break; | |
536 case PLAYER_SKILL_BODY: | |
537 v16 = ITEM_SPELLBOOK_BODY_FIRST_AID; | |
538 pCharacter->AddItem(-1, v16); | |
539 break; | |
540 case PLAYER_SKILL_ITEM_ID: | |
541 case PLAYER_SKILL_REPAIR: | |
542 case PLAYER_SKILL_MEDITATION: | |
543 case PLAYER_SKILL_PERCEPTION: | |
544 case PLAYER_SKILL_DIPLOMACY: | |
545 case PLAYER_SKILL_TRAP_DISARM: | |
546 case PLAYER_SKILL_LEARNING: | |
547 pCharacter->AddItem(-1, ITEM_POTION_BOTTLE); | |
548 v16 = 5 * (rand() % 3 + 40); // simple reagent | |
549 pCharacter->AddItem(-1, v16); | |
550 break; | |
551 case PLAYER_SKILL_DODGE: | |
552 v16 = ITEM_BOOTS_1; | |
553 pCharacter->AddItem(-1, v16); | |
554 break; | |
555 case PLAYER_SKILL_UNARMED: | |
556 v16 = ITEM_GAUNTLETS_1; | |
557 pCharacter->AddItem(-1, v16); | |
558 break; | |
559 default: | |
560 break; | |
561 } | |
562 } | |
563 //uSkillIdx = v18 + 1; | |
564 //v11 = uSkillIdx > 36; | |
565 //v9 = v18 == 35; | |
566 //v10 = uSkillIdx - 35 < 0; | |
567 } | |
568 //while (uSkillIdx < 36); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1364
diff
changeset
|
569 pItems = pCharacter->pInventoryItemList; |
0 | 570 //v13 = 138; |
1071 | 571 for (int i = 0; i < 138; i++) |
0 | 572 { |
1071 | 573 if ( pItems->uItemID ) |
574 pItems->uAttributes |= 1; | |
575 ++pItems; | |
0 | 576 //--v13; |
577 } | |
578 //while ( v13 ); | |
579 } | |
580 pCharacter->sHealth = pCharacter->GetMaxHealth(); | |
581 pCharacter->sMana = pCharacter->GetMaxMana(); | |
135 | 582 //pCharacter++; |
0 | 583 //uNumPlayers--; |
584 //if (!uNumPlayers) | |
585 //break; | |
135 | 586 //pResMagicBase = (int)pCharacter; |
0 | 587 v3 = 10; |
588 } | |
589 } | |
590 | |
591 //----- (004917CE) -------------------------------------------------------- | |
592 int Party::Reset() | |
593 { | |
594 //Party *v1; // esi@1 | |
595 //unsigned __int64 *pTimePlayed; // edi@1 | |
596 //bool v3; // edx@1 | |
597 //Player **v4; // eax@1 | |
598 //Player *v5; // ecx@1 | |
599 PLAYER_SEX pSex; // cl@3 | |
600 PLAYER_SEX v7; // al@6 | |
601 PLAYER_SEX v8; // al@9 | |
602 PLAYER_SEX v9; // cl@12 | |
603 //Player *v12; // edx@17 | |
604 //signed int v13; // edi@18 | |
605 SpellBuff *v14; // ebx@21 | |
606 signed int v15; // edi@21 | |
783 | 607 |
608 Zero(); | |
0 | 609 |
610 field_708 = 15; | |
611 sEyelevel = 160; | |
612 uNumGold = 200; | |
613 uNumFoodRations = 7; | |
614 | |
783 | 615 |
373 | 616 alignment = PartyAlignment_Neutral; |
617 SetUserInterface(alignment, true); | |
0 | 618 |
619 uTimePlayed = 0x21C00u; | |
620 uLastRegenerationTime = 0x21C00; | |
621 | |
622 bTurnBasedModeOn = false; | |
623 | |
624 uActiveCharacter = 1; | |
625 ::pPlayers[0] = pPlayers; | |
626 for (uint i = 0; i < 4; ++i) | |
627 ::pPlayers[i + 1] = &pPlayers[i]; | |
628 | |
135 | 629 pPlayers[0].Reset(PLAYER_CLASS_KNIGHT); |
630 pPlayers[1].Reset(PLAYER_CLASS_THEIF); | |
631 pPlayers[2].Reset(PLAYER_CLASS_CLERIC); | |
632 pPlayers[3].Reset(PLAYER_CLASS_SORCERER); | |
1014 | 633 pPlayers[0].uCurrentFace = 17; |
634 pPlayers[0].uPrevVoiceID = 17; | |
0 | 635 pPlayers[0].uVoiceID = 17; |
636 pPlayers[0].SetInitialStats(); | |
637 | |
638 switch ( pPlayers[0].uVoiceID ) | |
639 { | |
640 case 0: | |
641 case 1: | |
642 case 2: | |
643 case 3: | |
644 case 8: | |
645 case 9: | |
646 case 12: | |
647 case 13: | |
648 case 16: | |
649 case 17: | |
650 case 20: | |
651 case 23: | |
652 default: | |
653 pSex = SEX_MALE; | |
654 break; | |
655 case 4: | |
656 case 5: | |
657 case 6: | |
658 case 7: | |
659 case 10: | |
660 case 11: | |
661 case 14: | |
662 case 15: | |
663 case 18: | |
664 case 19: | |
665 case 21: | |
666 case 24: | |
667 pSex = SEX_FEMALE; | |
668 break; | |
669 } | |
670 pPlayers[0].uSex = pSex; | |
671 pPlayers[0].RandomizeName(); | |
672 strcpy(pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); | |
673 | |
674 | |
1014 | 675 pPlayers[1].uCurrentFace = 3; |
676 pPlayers[1].uPrevVoiceID = 3; | |
0 | 677 pPlayers[1].uVoiceID = 3; |
678 pPlayers[1].SetInitialStats(); | |
679 v7 = SEX_MALE; | |
680 switch (pPlayers[1].uVoiceID) | |
681 { | |
682 case 0: | |
683 case 1: | |
684 case 2: | |
685 case 3: | |
686 case 8: | |
687 case 9: | |
688 case 0xCu: | |
689 case 0xDu: | |
690 case 0x10u: | |
691 case 0x11u: | |
692 case 0x14u: | |
693 case 0x17u: | |
694 v7 = SEX_MALE; | |
695 break; | |
696 case 4: | |
697 case 5: | |
698 case 6: | |
699 case 7: | |
700 case 0xAu: | |
701 case 0xBu: | |
702 case 0xEu: | |
703 case 0xFu: | |
704 case 0x12u: | |
705 case 0x13u: | |
706 case 0x15u: | |
707 case 0x18u: | |
708 v7 = SEX_FEMALE; | |
709 break; | |
710 default: | |
711 break; | |
712 } | |
713 pPlayers[1].uSex = v7; | |
714 pPlayers[1].RandomizeName(); | |
715 strcpy(pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); | |
1014 | 716 pPlayers[2].uCurrentFace = 14; |
717 pPlayers[2].uPrevVoiceID = 14; | |
0 | 718 pPlayers[2].uVoiceID = 14; |
719 pPlayers[2].SetInitialStats(); | |
720 v8 = SEX_MALE; | |
721 switch (pPlayers[2].uVoiceID) | |
722 { | |
723 case 0: | |
724 case 1: | |
725 case 2: | |
726 case 3: | |
727 case 8: | |
728 case 9: | |
729 case 0xCu: | |
730 case 0xDu: | |
731 case 0x10u: | |
732 case 0x11u: | |
733 case 0x14u: | |
734 case 0x17u: | |
735 v8 = SEX_MALE; | |
736 break; | |
737 case 4: | |
738 case 5: | |
739 case 6: | |
740 case 7: | |
741 case 0xAu: | |
742 case 0xBu: | |
743 case 0xEu: | |
744 case 0xFu: | |
745 case 0x12u: | |
746 case 0x13u: | |
747 case 0x15u: | |
748 case 0x18u: | |
749 v8 = SEX_FEMALE; | |
750 break; | |
751 default: | |
752 break; | |
753 } | |
754 pPlayers[2].uSex = v8; | |
755 pPlayers[2].RandomizeName(); | |
756 strcpy(pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); | |
1014 | 757 pPlayers[3].uCurrentFace = 10; |
758 pPlayers[3].uPrevVoiceID = 10; | |
0 | 759 pPlayers[3].uVoiceID = 10; |
760 pPlayers[3].SetInitialStats(); | |
761 v9 = SEX_MALE; | |
762 switch (pPlayers[3].uVoiceID) | |
763 { | |
764 case 0u: | |
765 case 1u: | |
766 case 2u: | |
767 case 3u: | |
768 case 8u: | |
769 case 9u: | |
770 case 0xCu: | |
771 case 0xDu: | |
772 case 0x10u: | |
773 case 0x11u: | |
774 case 0x14u: | |
775 case 0x17u: | |
776 v9 = SEX_MALE; | |
777 break; | |
778 case 4u: | |
779 case 5u: | |
780 case 6u: | |
781 case 7u: | |
782 case 0xAu: | |
783 case 0xBu: | |
784 case 0xEu: | |
785 case 0xFu: | |
786 case 0x12u: | |
787 case 0x13u: | |
788 case 0x15u: | |
789 case 0x18u: | |
790 v9 = SEX_FEMALE; | |
791 break; | |
792 default: | |
793 break; | |
794 } | |
795 pPlayers[3].uSex = v9; | |
796 pPlayers[3].RandomizeName(); | |
797 strcpy(pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); | |
798 | |
799 | |
800 | |
801 for (uint i = 0; i < 4; ++i) | |
802 { | |
803 pPlayers[i].uTimeToRecovery = 0; | |
804 for (uint j = 0; j < 20; ++j) | |
805 pPlayers[i].pConditions[j] = 0; | |
806 | |
807 for (uint j = 0; j < 24; ++j) | |
808 pPlayers[i].pPlayerBuffs[j].Reset(); | |
809 | |
130 | 810 pPlayers[i].expression = CHARACTER_EXPRESSION_1; |
0 | 811 pPlayers[i].uExpressionTimePassed = 0; |
812 pPlayers[i].uExpressionTimeLength = rand() % 256 + 128; | |
813 } | |
814 | |
815 for (uint i = 1; i < 20; ++i) | |
816 pPartyBuffs[i].Reset(); | |
817 | |
818 | |
1035 | 819 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; // default character ui - stats |
0 | 820 uFlags = 0; |
1310 | 821 memset(_autonote_bits, 0, 26); |
484 | 822 memset(_quest_bits, 0, 64); |
598 | 823 memset(pIsArtifactFound, 0, 29); |
1035 | 824 _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_RED_POTION_ACTIVE, 1); |
825 _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_SEASHELL_ACTIVE, 1); | |
826 _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LONGBOW_ACTIVE, 1); | |
827 _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_PLATE_ACTIVE, 1); | |
828 _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LUTE_ACTIVE, 1); | |
829 _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_HAT_ACTIVE, 1); | |
0 | 830 |
487 | 831 memset(field_3C._shop_ban_times,0,53*sizeof(__int64)); |
0 | 832 |
833 memcpy(pNPCStats->pNewNPCData, pNPCStats->pNPCData, 0x94BCu); | |
834 memcpy(pNPCStats->pGroups_copy, pNPCStats->pGroups, 0x66u); | |
655 | 835 pNPCStats->pNewNPCData[3].uFlags |= 128;//|= 0x80u; Lady Margaret |
0 | 836 _494035_timed_effects__water_walking_damage__etc(); |
837 pEventTimer->Pause(); | |
838 return 0; | |
839 } | |
840 | |
841 | |
842 //----- (0043AD34) -------------------------------------------------------- | |
843 void Party::Yell() | |
844 { | |
90 | 845 Actor *v0; // esi@5 |
0 | 846 int v1; // edi@9 |
847 int v2; // ebx@9 | |
848 int v3; // eax@9 | |
849 unsigned int v4; // [sp+8h] [bp-4h]@4 | |
850 | |
1167 | 851 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 ) |
852 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 853 if ( pParty->bTurnBasedModeOn != 1 ) |
854 { | |
855 v4 = 0; | |
856 if ( (signed int)uNumActors > 0 ) | |
857 { | |
1202 | 858 v0 = pActors.data();//[0].pMonsterInfo.uMovementType; |
0 | 859 do |
860 { | |
1035 | 861 if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long && v0->pMonsterInfo.uMovementType != 5 ) |
0 | 862 { |
90 | 863 v1 = abs(v0->vPosition.x - pParty->vPosition.x); |
864 v2 = abs(v0->vPosition.y - pParty->vPosition.y); | |
865 v3 = abs(v0->vPosition.z - pParty->vPosition.z); | |
322 | 866 if (int_get_vector_length(v1, v2, v3) < 512) |
1060 | 867 Actor::AI_Flee(v4, 4, 0, 0); |
0 | 868 } |
869 ++v4; | |
90 | 870 ++v0; |
0 | 871 } |
872 while ( (signed int)v4 < (signed int)uNumActors ); | |
873 } | |
874 } | |
875 } | |
876 | |
877 //----- (00491BF9) -------------------------------------------------------- | |
878 void Party::ResetPosMiscAndSpellBuffs() | |
879 { | |
880 Party *v1; // esi@1 | |
89 | 881 Player *v2; // edi@1 |
0 | 882 SpellBuff *v3; // ebx@2 |
883 SpellBuff *v4; // esi@5 | |
884 signed int v5; // edi@5 | |
885 signed int v6; // [sp+8h] [bp-8h]@1 | |
886 signed int v7; // [sp+Ch] [bp-4h]@2 | |
887 | |
888 v1 = this; | |
889 this->vPosition.y = 0; | |
890 this->vPosition.z = 0; | |
891 this->vPosition.x = 0; | |
892 this->uFallStartY = 0; | |
893 this->sRotationY = 0; | |
894 this->sRotationX = 0; | |
895 this->uFallSpeed = 0; | |
896 this->field_28 = 0; | |
897 this->uDefaultPartyHeight = 120; | |
898 this->field_14 = 37; | |
120 | 899 this->y_rotation_granularity = 25; |
0 | 900 this->uWalkSpeed = 384; |
122 | 901 this->y_rotation_speed = 90; |
0 | 902 this->field_24 = 5; |
903 this->field_6FC = 0; | |
904 this->field_708 = 15; | |
905 this->field_0 = 25; | |
89 | 906 v2 = this->pPlayers;//[0].pPlayerBuffs; |
0 | 907 v6 = 4; |
908 do | |
909 { | |
89 | 910 v3 = v2->pPlayerBuffs; |
0 | 911 v7 = 24; |
912 do | |
913 { | |
914 v3->Reset(); | |
915 ++v3; | |
916 --v7; | |
917 } | |
918 while ( v7 ); | |
89 | 919 ++v2; |
0 | 920 --v6; |
921 } | |
922 while ( v6 ); | |
923 v4 = v1->pPartyBuffs; | |
924 v5 = 20; | |
925 do | |
926 { | |
927 v4->Reset(); | |
928 ++v4; | |
929 --v5; | |
930 } | |
931 while ( v5 ); | |
932 } | |
933 | |
934 //----- (004909F4) -------------------------------------------------------- | |
130 | 935 void Party::UpdatePlayersAndHirelingsEmotions() |
0 | 936 { |
130 | 937 //Player *v1; // esi@2 |
938 //unsigned int v2; // eax@3 | |
939 //__int16 v3; // cx@5 | |
0 | 940 int v4; // edx@27 |
130 | 941 //signed int v5; // eax@52 |
942 //PlayerFrame *v6; // edx@53 | |
943 //NPCData *v7; // esi@60 | |
944 //signed int v8; // ebp@61 | |
945 //int v9; // ebx@62 | |
946 //unsigned int v10; // edi@62 | |
947 //signed int v11; // [sp+0h] [bp-4h]@2 | |
948 | |
949 //v1 = this->pPlayers;//(char *)&this->pPlayers[0].uExpressionID; | |
950 for (int i = 0; i < 4; ++i) | |
0 | 951 { |
130 | 952 auto player = pPlayers + i; |
953 player->uExpressionTimePassed += (unsigned short)pMiscTimer->uTimeElapsed; | |
954 | |
955 | |
956 auto condition = player->GetMajorConditionIdx(); | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
957 if (condition == Condition_Good || condition == Condition_Zombie) |
0 | 958 { |
130 | 959 if (player->uExpressionTimePassed < player->uExpressionTimeLength) |
960 continue; | |
961 | |
962 player->uExpressionTimePassed = 0; | |
963 if (player->expression != 1 || rand() % 5) | |
0 | 964 { |
130 | 965 player->expression = CHARACTER_EXPRESSION_1; |
966 player->uExpressionTimeLength = rand() % 256 + 32; | |
0 | 967 } |
968 else | |
969 { | |
130 | 970 v4 = rand() % 100; |
971 if (v4 < 25) player->expression = CHARACTER_EXPRESSION_13; | |
972 else if (v4 < 31) player->expression = CHARACTER_EXPRESSION_14; | |
973 else if (v4 < 37) player->expression = CHARACTER_EXPRESSION_15; | |
974 else if (v4 < 43) player->expression = CHARACTER_EXPRESSION_16; | |
975 else if (v4 < 46) player->expression = CHARACTER_EXPRESSION_17; | |
976 else if (v4 < 52) player->expression = CHARACTER_EXPRESSION_18; | |
977 else if (v4 < 58) player->expression = CHARACTER_EXPRESSION_19; | |
978 else if (v4 < 64) player->expression = CHARACTER_EXPRESSION_20; | |
979 else if (v4 < 70) player->expression = CHARACTER_EXPRESSION_54; | |
980 else if (v4 < 76) player->expression = CHARACTER_EXPRESSION_55; | |
981 else if (v4 < 82) player->expression = CHARACTER_EXPRESSION_56; | |
982 else if (v4 < 88) player->expression = CHARACTER_EXPRESSION_57; | |
983 else if (v4 < 94) player->expression = CHARACTER_EXPRESSION_29; | |
984 else player->expression = CHARACTER_EXPRESSION_30; | |
985 } | |
986 | |
987 for (int j = 0; j < pPlayerFrameTable->uNumFrames; ++j) | |
988 { | |
989 auto frame = pPlayerFrameTable->pFrames + j; | |
990 if (frame->expression == player->expression) | |
0 | 991 { |
130 | 992 player->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[j].uAnimLength; |
993 break; | |
0 | 994 } |
995 } | |
996 } | |
130 | 997 else if (player->expression != 34 && |
998 player->expression != 35 && | |
999 player->expression != 36 || | |
1000 player->uExpressionTimePassed >= player->uExpressionTimeLength) | |
0 | 1001 { |
130 | 1002 player->uExpressionTimeLength = 0; |
1003 player->uExpressionTimePassed = 0; | |
1004 | |
1005 switch (condition) | |
0 | 1006 { |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1007 case Condition_Dead: player->expression = CHARACTER_EXPRESSION_DEAD; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1008 case Condition_Pertified: player->expression = CHARACTER_EXPRESSION_PERTIFIED; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1009 case Condition_Eradicated: player->expression = CHARACTER_EXPRESSION_ERADICATED; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1010 case Condition_Cursed: player->expression = CHARACTER_EXPRESSION_CURSED; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1011 case Condition_Weak: player->expression = CHARACTER_EXPRESSION_WEAK; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1012 case Condition_Sleep: player->expression = CHARACTER_EXPRESSION_SLEEP; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1013 case Condition_Fear: player->expression = CHARACTER_EXPRESSION_FEAR; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1014 case Condition_Drunk: player->expression = CHARACTER_EXPRESSION_DRUNK; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1015 case Condition_Insane: player->expression = CHARACTER_EXPRESSION_INSANE; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1016 case Condition_Poison1: |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1017 case Condition_Poison2: |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1018 case Condition_Poison3: player->expression = CHARACTER_EXPRESSION_POISONED; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1019 case Condition_Disease1: |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1020 case Condition_Disease2: |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1021 case Condition_Disease3: player->expression = CHARACTER_EXPRESSION_DISEASED; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1022 case Condition_Paralyzed: player->expression = CHARACTER_EXPRESSION_PARALYZED; break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
1023 case Condition_Unconcious: player->expression = CHARACTER_EXPRESSION_UNCONCIOUS; break; |
130 | 1024 default: |
1025 assert(false); | |
0 | 1026 } |
1027 } | |
130 | 1028 } |
1029 | |
1030 | |
1031 for (int i = 0; i < 2; ++i) | |
1032 { | |
1033 auto hireling = pParty->pHirelings + i; | |
291 | 1034 if (!hireling->evt_C) |
130 | 1035 continue; |
1036 | |
291 | 1037 hireling->evt_B += pMiscTimer->uTimeElapsed; |
1038 if (hireling->evt_B >= hireling->evt_C) | |
130 | 1039 { |
291 | 1040 hireling->evt_A = 0; |
1041 hireling->evt_B = 0; | |
1042 hireling->evt_C = 0; | |
130 | 1043 |
1044 assert(sizeof(NPCData) == 0x4C); | |
1045 memset(hireling, 0, sizeof(*hireling)); | |
1046 | |
1047 pParty->field_709 = 0; | |
1035 | 1048 pParty->CountHirelings(); |
1049 viewparams->bRedrawGameUI = true; | |
130 | 1050 } |
0 | 1051 } |
1052 } | |
1053 | |
1054 //----- (00490D02) -------------------------------------------------------- | |
1055 void Party::RestAndHeal() | |
1056 { | |
910 | 1057 Player *pPlayer; // esi@4 |
83 | 1058 ItemGen *v7; // eax@10 |
0 | 1059 signed int v11; // ecx@26 |
1060 signed int v12; // [sp-4h] [bp-1Ch]@26 | |
910 | 1061 bool have_vessels_soul; // [sp+10h] [bp-8h]@10 |
0 | 1062 |
910 | 1063 /* v1 = pParty->pPartyBuffs; |
0 | 1064 do |
1065 { | |
1066 v1->Reset(); | |
1067 ++v1; | |
1068 } | |
1069 while ( (signed int)v1 < (signed int)pParty->pPlayers ); | |
1070 v15 = 0; | |
1071 do | |
1072 { | |
910 | 1073 pPlayer = &pParty->pPlayers[v15]; |
0 | 1074 v3 = 20; |
910 | 1075 v4 = pPlayer->pPlayerBuffs; |
0 | 1076 do |
1077 { | |
1078 v4->Reset(); | |
1079 ++v4; | |
1080 --v3; | |
1081 } | |
910 | 1082 while ( v3 );*/ |
1083 for ( uint i = 0; i < 20; ++i ) | |
1084 pParty->pPartyBuffs[i].Reset(); | |
1085 for ( int pPlayerID = 0; pPlayerID < 4; ++pPlayerID ) | |
1086 { | |
1087 pPlayer = &pParty->pPlayers[pPlayerID]; | |
1088 for ( uint i = 0; i < 20; ++i ) | |
1089 pPlayer->pPlayerBuffs[i].Reset(); | |
1090 | |
1091 pPlayer->Zero(); | |
1092 if ( pPlayer->pConditions[14] || pPlayer->pConditions[15] || pPlayer->pConditions[16] )//Dead/Petrified/Eradicated | |
1093 continue; | |
1094 pPlayer->pConditions[13] = 0;//Unconcious | |
1095 pPlayer->pConditions[4] = 0;//Drunk | |
1096 pPlayer->pConditions[3] = 0;//Fear | |
1097 pPlayer->pConditions[2] = 0;//Sleep | |
1098 pPlayer->pConditions[1] = 0;//Weak | |
1099 pPlayer->uTimeToRecovery = 0; | |
1100 pPlayer->sHealth = pPlayer->GetMaxHealth(); | |
1101 pPlayer->sMana = pPlayer->GetMaxMana(); | |
1102 if ( pPlayer->classType == PLAYER_CLASS_LICH ) | |
0 | 1103 { |
910 | 1104 have_vessels_soul = false; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1364
diff
changeset
|
1105 v7 = pPlayer->pInventoryItemList;//[0].field_1A; |
910 | 1106 for ( uint i = 138; i; --i ) |
0 | 1107 { |
910 | 1108 if ( v7->uItemID == 601 && (unsigned __int8)v7->uHolderPlayer == pPlayerID + 1 ) |
1109 have_vessels_soul = true; | |
83 | 1110 ++v7; |
0 | 1111 } |
910 | 1112 if ( !have_vessels_soul ) |
0 | 1113 { |
910 | 1114 pPlayer->sHealth = pPlayer->GetMaxHealth() / 2; |
1115 pPlayer->sMana = pPlayer->GetMaxMana() / 2; | |
0 | 1116 } |
1117 } | |
910 | 1118 if ( !pPlayer->pConditions[17] )// Zombie |
0 | 1119 { |
910 | 1120 if ( pPlayer->pConditions[10] || pPlayer->pConditions[11] ) |
0 | 1121 { |
1122 v11 = 4; | |
1123 v12 = 4; | |
1124 } | |
1125 else | |
1126 { | |
910 | 1127 if ( !pPlayer->pConditions[8] && !pPlayer->pConditions[9] ) |
0 | 1128 { |
910 | 1129 if ( !pPlayer->pConditions[6] && !pPlayer->pConditions[7] ) |
1130 { | |
1131 if ( pPlayer->pConditions[5] ) | |
1132 pPlayer->sMana = 0; | |
1133 UpdatePlayersAndHirelingsEmotions(); | |
1134 continue; | |
1135 } | |
1136 pPlayer->sHealth /= 2; | |
1137 pPlayer->sMana = pPlayer->sMana / 2; | |
1138 if ( pPlayer->pConditions[5] ) | |
1139 pPlayer->sMana = 0; | |
1140 UpdatePlayersAndHirelingsEmotions(); | |
1141 continue; | |
0 | 1142 } |
1143 v11 = 3; | |
1144 v12 = 3; | |
1145 } | |
910 | 1146 pPlayer->sHealth /= v11; |
1147 pPlayer->sMana = pPlayer->sMana / v12; | |
1148 if ( pPlayer->pConditions[5] ) | |
1149 pPlayer->sMana = 0; | |
1150 UpdatePlayersAndHirelingsEmotions(); | |
1151 continue; | |
0 | 1152 } |
910 | 1153 pPlayer->sMana = 0; |
1154 pPlayer->sHealth = pPlayer->sHealth / 2; | |
1155 if ( pPlayer->pConditions[5] ) | |
1156 pPlayer->sMana = 0; | |
130 | 1157 UpdatePlayersAndHirelingsEmotions(); |
0 | 1158 } |
766 | 1159 pParty->days_played_without_rest = 0; |
1295 | 1160 } |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1161 |
1295 | 1162 //----- (004938D1) -------------------------------------------------------- |
1163 void __fastcall Rest(unsigned int uHoursToSleep) | |
1164 { | |
1165 unsigned int v1; // esi@1 | |
1166 double v2; // st7@3 | |
1167 Player **v3; // esi@3 | |
1168 | |
1169 v1 = uHoursToSleep; | |
1170 if ( uHoursToSleep > 240 ) | |
1171 InitializeActors(); | |
1172 v2 = (double)(7680 * v1) * 0.033333335; | |
1173 pParty->uTimePlayed += (signed __int64)v2; | |
1174 v3 = &pPlayers[1]; | |
1175 do | |
1176 { | |
1177 (*v3)->Recover((signed __int64)v2); | |
1178 ++v3; | |
1179 } | |
1180 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1181 _494035_timed_effects__water_walking_damage__etc(); | |
1182 } | |
1183 //----- (004B1BDB) -------------------------------------------------------- | |
1184 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
1185 { | |
1186 signed __int64 v1; // ST2C_8@1 | |
1187 signed __int64 v2; // qax@1 | |
1188 signed __int64 v3; // ST1C_8@1 | |
1189 unsigned __int64 v4; // qax@1 | |
1190 unsigned int v5; // ebx@1 | |
1191 Player *v6; // ebx@1 | |
1192 | |
1193 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
1194 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
1195 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
1196 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
1197 v2 = v1 / 60 / 60; | |
1198 v3 = v2; | |
1199 v4 = (unsigned int)v2 / 0x18; | |
1200 v5 = (unsigned int)(v4 / 7) >> 2; | |
1201 pParty->uCurrentTimeSecond = v1 % 60; | |
1202 pParty->uCurrentMinute = v1 / 60 % 60; | |
1203 pParty->uCurrentHour = v3 % 24; | |
1204 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
1205 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
1206 pParty->uCurrentMonth = v5 % 0xC; | |
1207 pParty->uCurrentYear = v5 / 0xC + game_starting_year; | |
1208 pParty->RestAndHeal(); | |
1209 dword_507B94 = 1; | |
1210 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; | |
1211 do | |
1212 { | |
1213 v6->uTimeToRecovery = 0; | |
1214 memset(&v6->uTimeToRecovery, 0, 4u); | |
1215 ++v6; | |
1216 } | |
1217 while ( v6 <= &pParty->pPlayers[3] ); | |
1218 pParty->UpdatePlayersAndHirelingsEmotions(); | |
1219 } | |
1297 | 1220 //----- (0041F5BE) -------------------------------------------------------- |
1221 void __cdecl Sleep6Hours() | |
1222 { | |
1396 | 1223 if ( _506F18_num_minutes_to_sleep < 6 ) |
1297 | 1224 { |
1225 pParty->pPlayers[3].SetAsleep(false); | |
1226 pParty->pPlayers[2].SetAsleep(false); | |
1227 pParty->pPlayers[1].SetAsleep(false); | |
1228 pParty->pPlayers[0].SetAsleep(false); | |
1396 | 1229 if ( _506F18_num_minutes_to_sleep ) |
1297 | 1230 { |
1396 | 1231 Rest(_506F18_num_minutes_to_sleep); |
1232 _506F18_num_minutes_to_sleep = 0; | |
1297 | 1233 LoadActualSkyFrame(); |
1234 } | |
1235 if ( dword_506F14 == 2 ) | |
1236 { | |
1237 pGUIWindow_CurrentMenu->Release(); | |
1238 pEventTimer->Resume(); | |
1239 if ( pTexture_RestUI_CurrentSkyFrame ) | |
1240 pTexture_RestUI_CurrentSkyFrame->Release(); | |
1241 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
1242 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
1243 pTexture_RestUI_CurrentHourglassFrame = 0; | |
1244 pTexture_RestUI_CurrentSkyFrame = 0; | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1245 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1297 | 1246 pIcons_LOD->SyncLoadedFilesCount(); |
1247 pCurrentScreen = SCREEN_GAME; | |
1248 viewparams->bRedrawGameUI = 1; | |
1249 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1250 { | |
1251 pOutdoor->UpdateSunlightVectors(); | |
1252 pOutdoor->UpdateFog(); | |
1253 } | |
1254 } | |
1255 dword_506F14 = 0; | |
1256 } | |
1257 else | |
1258 { | |
1259 Rest(6u); | |
1396 | 1260 _506F18_num_minutes_to_sleep -= 6; |
1297 | 1261 LoadActualSkyFrame(); |
1262 } | |
1263 viewparams->bRedrawGameUI = 1; | |
1264 } | |
1265 | |
1295 | 1266 //----- (0047752B) -------------------------------------------------------- |
1267 int __cdecl GetPartyReputation() | |
1268 { | |
1269 DDM_DLV_Header *v0; // ebx@1 | |
1270 signed int v1; // esi@3 | |
1271 | |
1272 v0 = &pOutdoor->ddm; | |
1273 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
1274 v0 = &pIndoor->dlv; | |
1275 v1 = 0; | |
1276 if ( CheckHiredNPCSpeciality(Pirate) ) | |
1277 v1 += 5; | |
1278 if ( CheckHiredNPCSpeciality(Burglar) ) | |
1279 v1 += 5; | |
1280 if ( CheckHiredNPCSpeciality(Gypsy) ) | |
1281 v1 += 5; | |
1282 if ( CheckHiredNPCSpeciality(Duper) ) | |
1283 v1 += 5; | |
1284 if ( CheckHiredNPCSpeciality(FallenWizard) ) | |
1285 v1 += 5; | |
1286 return v1 + v0->uReputation; | |
1296 | 1287 } |
1288 //----- (004269A2) -------------------------------------------------------- | |
1289 void __fastcall GivePartyExp(unsigned int pEXPNum) | |
1290 { | |
1291 signed int pActivePlayerCount; // ecx@1 | |
1292 int pLearningPercent; // eax@13 | |
1293 | |
1294 pActivePlayerCount = 0; | |
1295 for ( uint i = 0; i < 4; ++i ) | |
1296 { | |
1297 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) | |
1298 pActivePlayerCount ++; | |
1299 } | |
1300 if ( pActivePlayerCount ) | |
1301 { | |
1302 pEXPNum = pEXPNum / pActivePlayerCount; | |
1303 for ( uint i = 0; i < 4; ++i ) | |
1304 { | |
1305 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) | |
1306 { | |
1307 if ( pEXPNum ) | |
1308 { | |
1309 pLearningPercent = pParty->pPlayers[i].GetLearningPercent(); | |
1310 pEXPNum = pEXPNum + pEXPNum * pLearningPercent / 100; | |
1311 pParty->pPlayers[i].uExperience += pEXPNum; | |
1312 if ( pParty->pPlayers[i].uExperience > 4000000000i64 ) | |
1313 { | |
1314 pParty->pPlayers[i].uExperience = 0; | |
1315 } | |
1316 } | |
1317 } | |
1318 } | |
1319 } | |
1320 } | |
1297 | 1321 //----- (00420C05) -------------------------------------------------------- |
1322 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) | |
1323 { | |
1324 unsigned int v2; // edi@1 | |
1325 int v3; // ebp@1 | |
1326 unsigned int v4; // esi@1 | |
1327 int v5; // ecx@6 | |
1328 NPCData *v6; // eax@6 | |
1329 signed int v7; // edx@8 | |
1330 signed int v8; // ebx@10 | |
1331 char *v9; // edi@11 | |
1332 signed int v10; // ecx@17 | |
1333 int v11; // eax@21 | |
1334 NPCData *v12; // ecx@21 | |
1335 unsigned int v13; // ecx@23 | |
1336 signed int v14; // [sp+Ch] [bp-4h]@6 | |
1337 | |
1338 v2 = 0; | |
1339 v3 = 0; | |
1340 v4 = uNumGold; | |
1341 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) | |
1342 { | |
1343 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) | |
1344 { | |
1345 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! | |
1346 } | |
1347 else | |
1348 { | |
1349 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) | |
1350 pTmpBuf2[0] = 0; | |
1351 } | |
1352 } | |
1353 else | |
1354 { | |
1355 v14 = 0; | |
1356 v5 = 0; | |
1357 v6 = pParty->pHirelings; | |
1358 do | |
1359 { | |
1360 if ( v6->pName ) | |
1361 { | |
1362 v7 = v14++; | |
1363 pTmpBuf[v7] = v5; | |
1364 } | |
1365 ++v6; | |
1366 ++v5; | |
1367 } | |
1368 while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); | |
1369 v8 = 0; | |
1370 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
1371 { | |
1372 v9 = (char *)pNPCStats->pNewNPCData; | |
1373 do | |
1374 { | |
1375 if ( v9[8] & 0x80 | |
1376 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) | |
1377 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) | |
1378 { | |
1379 v10 = v14++; | |
1380 pTmpBuf[v10] = v8 + 2; | |
1381 } | |
1382 ++v8; | |
1383 v9 += 76; | |
1384 } | |
1385 while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); | |
1386 v2 = 0; | |
1387 } | |
1388 if ( v14 > 0 ) | |
1389 { | |
1390 do | |
1391 { | |
1392 v11 = (unsigned __int8)pTmpBuf[v2]; | |
1393 v12 = &pNPCStats->pNPCData[v11 + 499]; | |
1394 if ( (unsigned __int8)pTmpBuf[v2] < 2 ) | |
1395 v12 = &pParty->pHirelings[v11]; | |
1396 v13 = v12->uProfession; | |
1397 if ( v13 ) | |
1398 v3 += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); | |
1399 ++v2; | |
1400 } | |
1401 while ( (signed int)v2 < v14 ); | |
1402 } | |
1403 if ( CheckHiredNPCSpeciality(Factor) ) | |
1404 v4 += (signed int)(10 * v4) / 100; | |
1405 if ( CheckHiredNPCSpeciality(Banker) ) | |
1406 v4 += (signed int)(20 * v4) / 100; | |
1407 if ( CheckHiredNPCSpeciality(Pirate) ) | |
1408 v4 += (signed int)(10 * v4) / 100; | |
1409 if ( v3 ) | |
1410 { | |
1411 v3 = (signed int)(v4 * v3 / 100) / 100; | |
1412 if ( v3 < 1 ) | |
1413 v3 = 1; | |
1414 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[466], v4, v3);// You found %lu gold (followers take %lu)! | |
1415 } | |
1416 else | |
1417 { | |
1418 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], v4);// You found %lu gold! | |
1419 } | |
1420 v2 = 0; | |
1421 } | |
1422 pParty->uNumGold += v4 - v3; | |
1423 pUIAnim_Gold->uAnimTime = v2; | |
1424 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; | |
1425 if ( pTmpBuf2[0] ) | |
1426 ShowStatusBarString(pTmpBuf2.data(), 2u); | |
1427 pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); | |
1428 } | |
1429 //----- (00421B2C) -------------------------------------------------------- | |
1430 bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem() | |
1431 { | |
1432 unsigned int v0; // eax@2 | |
1433 Texture *v1; // ebx@2 | |
1434 int v2; // eax@3 | |
1435 Player *v3; // esi@5 | |
1436 int v4; // eax@6 | |
1437 unsigned __int16 v5; // dx@11 | |
1438 signed int v6; // eax@11 | |
1439 char *v7; // edi@12 | |
1440 __int16 v8; // ax@16 | |
1441 SpriteObject a1; // [sp+4h] [bp-78h]@11 | |
1442 int v11; // [sp+74h] [bp-8h]@2 | |
1443 int v12; // [sp+78h] [bp-4h]@5 | |
1444 | |
1445 if ( !pParty->pPickedItem.uItemID ) | |
1446 return 1; | |
1447 v0 = pIcons_LOD->LoadTexture( | |
1448 pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, | |
1449 TEXTURE_16BIT_PALETTE); | |
1450 v1 = pIcons_LOD->GetTexture(v0); | |
1451 v11 = areWeLoadingTexture; | |
1452 if ( uActiveCharacter | |
1453 && (v2 = pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) | |
1454 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1364
diff
changeset
|
1455 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1], &pParty->pPickedItem, 0x24u); |
1297 | 1456 pMouse->RemoveHoldingItem(); |
1457 } | |
1458 else | |
1459 { | |
1460 v12 = 0; | |
1461 v3 = pParty->pPlayers; | |
1462 while ( v3 <= &pParty->pPlayers[3] ) | |
1463 { | |
1464 v4 = v3->AddItem(-1, pParty->pPickedItem.uItemID); | |
1465 if ( v4 ) | |
1466 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1364
diff
changeset
|
1467 memcpy(&pParty->pPlayers[v12].pInventoryItemList[v4 - 1], &pParty->pPickedItem, 0x24u); |
1297 | 1468 pMouse->RemoveHoldingItem(); |
1469 break; | |
1470 } | |
1471 ++v12; | |
1472 ++v3; | |
1473 } | |
1474 if ( v12 == 4 ) | |
1475 { | |
1476 v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; | |
1477 v6 = 0; | |
1478 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; | |
1479 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
1480 { | |
1481 LOWORD(v6) = 0; | |
1482 } | |
1483 else | |
1484 { | |
1485 v7 = (char *)&pObjectList->pObjects->uObjectID; | |
1486 while ( v5 != *(short *)v7 ) | |
1487 { | |
1488 ++v6; | |
1489 v7 += 56; | |
1490 if ( v6 >= (signed int)pObjectList->uNumObjects ) | |
1491 { | |
1492 LOWORD(v6) = 0; | |
1493 break; | |
1494 } | |
1495 } | |
1496 } | |
1497 a1.spell_caster_pid = OBJECT_Player; | |
1498 a1.uObjectDescID = v6; | |
1499 a1.vPosition.y = pParty->vPosition.y; | |
1500 a1.vPosition.x = pParty->vPosition.x; | |
1501 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; | |
1502 a1.uSoundID = 0; | |
1503 a1.uFacing = 0; | |
1504 a1.uAttributes = 8; | |
1505 v8 = pIndoor->GetSector( | |
1506 pParty->vPosition.x, | |
1507 pParty->vPosition.y, | |
1508 pParty->sEyelevel + pParty->vPosition.z); | |
1509 a1.uSpriteFrameID = 0; | |
1510 a1.uSectorID = v8; | |
1511 memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24)); | |
1512 a1.Create(pParty->sRotationY, 184, 200, 0); | |
1513 pMouse->RemoveHoldingItem(); | |
1514 } | |
1515 } | |
1516 if ( !v11 ) | |
1517 { | |
1518 v1->Release(); | |
1519 pIcons_LOD->SyncLoadedFilesCount(); | |
1520 } | |
1521 return 1; | |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1522 } |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1523 |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1524 |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1525 bool Party::IsPartyEvil() |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1526 { |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1527 return _449B57_test_bit(_quest_bits, 100); |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1528 } |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1529 |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1530 bool Party::IsPartyGood() |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1531 { |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1532 return _449B57_test_bit(_quest_bits, 99); |
1297 | 1533 } |