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