annotate Engine/Party.cpp @ 2566:30eb6dcac768

big spell fx overhaul
author a.parshin
date Wed, 20 May 2015 21:05:07 +0200
parents 117c219bf913
children dd36326a9994
rev   line source
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7 #include "Engine/Engine.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
9 #include "Party.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
10 #include "Timer.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2499
diff changeset
11 #include "Media/Audio/AudioPlayer.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
12 #include "Engine/Tables/IconFrameTable.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2499
diff changeset
13 #include "IO/Mouse.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
14 #include "Engine/Tables/PlayerFrameTable.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
15 #include "Engine/TurnEngine/TurnEngine.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
16 #include "Engine/Graphics/Viewport.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
17 #include "Engine/Objects/Actor.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2499
diff changeset
18 #include "GUI/GUIWindow.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
19 #include "texts.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
20 #include "Engine/Graphics/Outdoor.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
21 #include "LOD.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
22 #include "Engine/Objects/SpriteObject.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
23 #include "Engine/Objects/ObjectList.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
24
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
25
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
26
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
27
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
28 Party *pParty = nullptr;
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
29
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
30 struct ActionQueue *pPartyActionQueue = new ActionQueue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
31
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
32
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
33 std::array<bool, 4> playerAlreadyPicked; // byte_AE3368_
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
34 char PickedPlayer2_unused; // byte_AE3369_
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
35 char PickedPlayer3_unused; // byte_AE336A_
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
36 char PickedPlayer4_unused; // byte_AE336B_
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
37
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
38
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
39
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
40 //----- (0044A56A) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
41 void Party::CountHirelings()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
42 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
43 field_70A = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
44
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
45 for (unsigned int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
46 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
47 NPCData* npc = &pNPCStats->pNewNPCData[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
48 if (npc->Hired() &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
49 (!pHirelings[0].pName || strcmp(npc->pName, pHirelings[0].pName)))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
50 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
51 if (!pHirelings[1].pName || strcmp(npc->pName, pHirelings[1].pName))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
52 ++field_70A;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
53 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
54 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
55 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
56
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
57
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
58 // inlined
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
59 //----- (mm6c::004858D0) --------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
60 void Party::Zero()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
61 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
62 uFlags2 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
63 uNumGoldInBank = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
64
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
65 uCurrentYear = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
66 uCurrentMonth = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
67 uCurrentMonthWeek = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
68 uDaysPlayed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
69 uCurrentHour = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
70 uCurrentMinute = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
71 uCurrentTimeSecond = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
72
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
73 field_6FC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
74 days_played_without_rest = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
75 vPosition.x = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
76 vPosition.y = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
77 vPosition.z = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
78 uFallStartY = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
79 sRotationY = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
80 sRotationX = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
81 uFallSpeed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
82 field_28 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
83 uDefaultPartyHeight = 192;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
84 field_14_radius = 37;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
85 y_rotation_granularity = 25;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
86 y_rotation_speed = 90;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
87
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
88 uWalkSpeed = 384;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
89 walk_sound_timer = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
90
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
91 field_24 = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
92 field_6FC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
93 field_708 = 15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
94 field_0 = 25;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
95
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
96 uNumDeaths = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
97 uNumPrisonTerms = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
98 uNumBountiesCollected = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
99 monster_for_hunting_killed.fill(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
100 monster_id_for_hunting.fill(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
101 memset(_quest_bits, 0, sizeof(_quest_bits));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
102 pArcomageWins.fill(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
103 uNumArenaPageWins = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
104 uNumArenaSquireWins = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
105 uNumArenaKnightWins = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
106 uNumArenaLordWins = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
107 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
108
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
109 //inlined
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
110 //----- (mm6c::0045BE90) --------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
111 void ActionQueue::Reset()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
112 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
113 uNumActions = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
114 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
115
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
116 //----- (004760C1) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
117 void ActionQueue::Add(PartyAction action)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
118 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
119 if (uNumActions < 30)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
120 pActions[uNumActions++] = action;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
121 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
122
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
123 //----- (00497FC5) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
124 bool Party::_497FC5_check_party_perception_against_level()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
125 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
126 int uMaxPerception; // edi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
127 signed int v5; // eax@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
128 bool result; // eax@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
129
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
130 uMaxPerception = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
131 for (int i = 0; i < 4; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
132 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
133 if ( this->pPlayers[i].CanAct() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
134 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
135 v5 = this->pPlayers[i].GetPerception();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
136 if ( v5 > uMaxPerception )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
137 uMaxPerception = v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
138 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
139 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
140 if ( uLevelMapStatsID && (signed int)uLevelMapStatsID < 77 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
141 result = uMaxPerception >= 2 * pMapStats->pInfos[uLevelMapStatsID]._per;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
142 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
143 result = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
144 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
145 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
146
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
147 //----- (004936E1) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
148 void Party::SetHoldingItem(ItemGen *pItem)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
149 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
150 sub_421B2C_PlaceInInventory_or_DropPickedItem();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
151 memcpy(&pPickedItem, pItem, sizeof(pPickedItem));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
152 pMouse->SetCursorBitmapFromItemID(pPickedItem.uItemID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
153 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
154
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
155 //----- (0049370F) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
156 int Party::GetNextActiveCharacter()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
157 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
158 int v2; // eax@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
159 signed int v8; // esi@23
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
160 int v12; // [sp+Ch] [bp-4h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
161
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
162 v12 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
163 if ( pParty->bTurnBasedModeOn == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
164 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
165 if ( pTurnEngine->turn_stage != TE_ATTACK || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) != OBJECT_Player)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
166 return 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
167 v2 = PID_ID(pTurnEngine->pQueue[0].uPackedID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
168 return v2 + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
169 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
170
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
171 if ( playerAlreadyPicked[0] && playerAlreadyPicked[1] && playerAlreadyPicked[2] && playerAlreadyPicked[3] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
172 playerAlreadyPicked.fill(false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
173 for (int i = 0; i < 4; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
174 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
175 if ( !this->pPlayers[i].CanAct() || this->pPlayers[i].uTimeToRecovery > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
176 playerAlreadyPicked[i] = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
177 else if ( !playerAlreadyPicked[i] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
178 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
179 playerAlreadyPicked[i] = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
180 if (i > 0) //TODO check if this condition really should be here. it is equal to the original source but still seems kind of weird
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
181 return i + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
182 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
183 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
184 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
185
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
186 for (int i = 0; i < 4; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
187 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
188 if ( this->pPlayers[i].CanAct() && this->pPlayers[i].uTimeToRecovery == 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
189 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
190 if ( v12 == 0 || this->pPlayers[i].uSpeedBonus > v8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
191 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
192 v8 = this->pPlayers[i].uSpeedBonus;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
193 v12 = i + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
194 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
195 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
196 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
197 return v12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
198 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
199
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
200
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
201 //----- (00493244) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
202 bool Party::HasItem(unsigned int uItemID)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
203 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
204 for (int player = 0; player < 4; player++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
205 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
206 for (int itemPos = 0; itemPos < 138; itemPos++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
207 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
208 if (pParty->pPlayers[player].pOwnItems[itemPos].uItemID == uItemID)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
209 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
210 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
211 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
212 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
213 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
214
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
215
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
216 //----- (00492AD5) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
217 void Party::SetFood(unsigned int uNumFood)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
218 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
219 pUIAnim_Food->uAnimTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
220 pParty->uNumFoodRations = uNumFood;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
221 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
222 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
223
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
224 //----- (00492B03) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
225 void Party::TakeFood(unsigned int uNumFood)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
226 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
227 if (pParty->uNumFoodRations <= uNumFood)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
228 pParty->uNumFoodRations = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
229 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
230 pParty->uNumFoodRations -= uNumFood;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
231
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
232 pUIAnim_Food->uAnimTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
233 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
234 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
235
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
236 //----- (00492B42) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
237 void Party::GiveFood(unsigned int _this)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
238 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
239 pParty->uNumFoodRations += _this;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
240 pUIAnim_Food->uAnimTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
241 pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
242 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
243
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
244 //----- (00492B70) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
245 void Party::SetGold(unsigned int uNumGold)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
246 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
247 pParty->uNumGold = uNumGold;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
248 pUIAnim_Gold->uAnimTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
249 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength;
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2502
diff changeset
250 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
251 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
252
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
253 //----- (00492BB6) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
254 void Party::TakeGold(unsigned int uNumGold)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
255 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
256 if ( uNumGold <= pParty->uNumGold )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
257 pParty->uNumGold -= uNumGold;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
258 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
259 pParty->uNumGold = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
260 pUIAnim_Gold->uAnimTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
261 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength;
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2502
diff changeset
262 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
263 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
264
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
265 //----- (0049135E) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
266 unsigned int Party::GetPartyFame()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
267 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
268 unsigned __int64 total_exp = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
269 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
270 total_exp += pPlayers[i].uExperience;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
271 return (unsigned int)(min(total_exp / 1000, UINT_MAX)); //min wasn't present, but could be incorrect without it
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
272 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
273
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
274 //----- (0049137D) --------------------------------------------------------
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
275 void Party::CreateDefaultParty(bool bDebugGiveItems)
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
276 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
277 Player *pCharacter; // esi@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
278 int uSkillIdx; // eax@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
279 unsigned int v16; // [sp-4h] [bp-44h]@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
280 signed int uNumPlayers; // [sp+18h] [bp-28h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
281 ItemGen Dst; // [sp+1Ch] [bp-24h]@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
282
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
283 pHireling1Name[0] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
284 pHireling2Name[0] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
285 this->hirelingScrollPosition = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
286 memset(&pHirelings, 0, sizeof(pHirelings));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
287
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
288 strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); // Zoltan
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
289 this->pPlayers[0].uPrevFace = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
290 this->pPlayers[0].uCurrentFace = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
291 this->pPlayers[0].uPrevVoiceID = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
292 this->pPlayers[0].uVoiceID = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
293 this->pPlayers[0].uMight = 30;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
294 this->pPlayers[0].uIntelligence = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
295 this->pPlayers[0].uWillpower = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
296 this->pPlayers[0].uEndurance = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
297 this->pPlayers[0].uAccuracy = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
298 this->pPlayers[0].uSpeed = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
299 this->pPlayers[0].uLuck = 7;
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
300 this->pPlayers[0].pActiveSkills[PLAYER_SKILL_LEATHER] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
301 this->pPlayers[0].pActiveSkills[PLAYER_SKILL_ARMSMASTER] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
302 this->pPlayers[0].pActiveSkills[PLAYER_SKILL_BOW] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
303 this->pPlayers[0].pActiveSkills[PLAYER_SKILL_SWORD] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
304
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
305 strcpy(this->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); // Roderic
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
306 this->pPlayers[1].uPrevFace = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
307 this->pPlayers[1].uCurrentFace = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
308 this->pPlayers[1].uPrevVoiceID = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
309 this->pPlayers[1].uVoiceID = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
310 this->pPlayers[1].uMight = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
311 this->pPlayers[1].uIntelligence = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
312 this->pPlayers[1].uWillpower = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
313 this->pPlayers[1].uEndurance = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
314 this->pPlayers[1].uAccuracy = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
315 this->pPlayers[1].uSpeed = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
316 this->pPlayers[1].uLuck = 13;
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
317 this->pPlayers[1].pActiveSkills[PLAYER_SKILL_LEATHER] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
318 this->pPlayers[1].pActiveSkills[PLAYER_SKILL_STEALING] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
319 this->pPlayers[1].pActiveSkills[PLAYER_SKILL_DAGGER] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
320 this->pPlayers[1].pActiveSkills[PLAYER_SKILL_TRAP_DISARM] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
321
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
322 strcpy(this->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); // Serena
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
323 this->pPlayers[2].uPrevFace = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
324 this->pPlayers[2].uCurrentFace = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
325 this->pPlayers[2].uPrevVoiceID = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
326 this->pPlayers[2].uVoiceID = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
327 this->pPlayers[2].uMight = 12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
328 this->pPlayers[2].uIntelligence = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
329 this->pPlayers[2].uWillpower = 20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
330 this->pPlayers[2].uEndurance = 22;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
331 this->pPlayers[2].uAccuracy = 7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
332 this->pPlayers[2].uSpeed = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
333 this->pPlayers[2].uLuck = 7;
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
334 this->pPlayers[2].pActiveSkills[PLAYER_SKILL_ALCHEMY] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
335 this->pPlayers[2].pActiveSkills[PLAYER_SKILL_LEATHER] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
336 this->pPlayers[2].pActiveSkills[PLAYER_SKILL_BODY] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
337 this->pPlayers[2].pActiveSkills[PLAYER_SKILL_MACE] = 1;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
338
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
339 strcpy(this->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); // Alexis
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
340 this->pPlayers[3].uPrevFace = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
341 this->pPlayers[3].uCurrentFace = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
342 this->pPlayers[3].uEndurance = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
343 this->pPlayers[3].uAccuracy = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
344 this->pPlayers[3].uSpeed = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
345 this->pPlayers[3].uPrevVoiceID = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
346 this->pPlayers[3].uVoiceID = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
347 this->pPlayers[3].uMight = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
348 this->pPlayers[3].uIntelligence = 30;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
349 this->pPlayers[3].uWillpower = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
350 this->pPlayers[3].uLuck = 7;
2566
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2565
diff changeset
351 this->pPlayers[3].pActiveSkills[PLAYER_SKILL_LEATHER] = 1;
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2565
diff changeset
352 this->pPlayers[3].pActiveSkills[PLAYER_SKILL_AIR] = 1;
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2565
diff changeset
353 this->pPlayers[3].pActiveSkills[PLAYER_SKILL_FIRE] = 1;
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2565
diff changeset
354 this->pPlayers[3].pActiveSkills[PLAYER_SKILL_STAFF] = 1;
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
355
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
356 for (uNumPlayers = 0; uNumPlayers < 4; uNumPlayers++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
357 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
358 pCharacter = &pParty->pPlayers[uNumPlayers];
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
359
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
360 if (pCharacter->classType == PLAYER_CLASS_KNIGHT)
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
361 pCharacter->sResMagicBase = 10;
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
362
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
363 pCharacter->lastOpenedSpellbookPage = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
364 for (int i = 0; i < 9; i++)//for Magic Book
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
365 {
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
366 if (pPlayers[uNumPlayers].pActiveSkills[12+i])
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
367 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
368 pCharacter->lastOpenedSpellbookPage = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
369 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
370 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
371 }
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
372
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
373 pCharacter->uExpressionTimePassed = 0;
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
374
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
375 if (bDebugGiveItems)
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
376 {
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
377 Dst.Reset();
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
378 pItemsTable->GenerateItem(2, 40, &Dst); //ring
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
379 pCharacter->AddItem2(-1, &Dst);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
380 for (uSkillIdx = 0; uSkillIdx < 36; uSkillIdx++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
381 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
382 if ( pCharacter->pActiveSkills[uSkillIdx] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
383 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
384 switch ( uSkillIdx )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
385 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
386 case PLAYER_SKILL_STAFF:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
387 pCharacter->WearItem(ITEM_STAFF_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
388 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
389 case PLAYER_SKILL_SWORD:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
390 pCharacter->WearItem(ITEM_LONGSWORD_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
391 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
392 case PLAYER_SKILL_DAGGER:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
393 pCharacter->WearItem(ITEM_DAGGER_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
394 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
395 case PLAYER_SKILL_AXE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
396 pCharacter->WearItem(ITEM_AXE_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
397 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
398 case PLAYER_SKILL_SPEAR:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
399 pCharacter->WearItem(ITEM_SPEAR_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
400 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
401 case PLAYER_SKILL_BOW:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
402 pCharacter->WearItem(ITEM_CROSSBOW_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
403 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
404 case PLAYER_SKILL_MACE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
405 pCharacter->WearItem(ITEM_MACE_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
406 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
407 case PLAYER_SKILL_SHIELD:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
408 pCharacter->WearItem(ITEM_BUCKLER_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
409 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
410 case PLAYER_SKILL_LEATHER:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
411 pCharacter->WearItem(ITEM_LEATHER_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
412 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
413 case PLAYER_SKILL_CHAIN:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
414 pCharacter->WearItem(ITEM_CHAINMAIL_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
415 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
416 case PLAYER_SKILL_PLATE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
417 pCharacter->WearItem(ITEM_PLATE_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
418 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
419 case PLAYER_SKILL_FIRE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
420 pCharacter->AddItem(-1, ITEM_SPELLBOOK_FIRE_STRIKE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
421 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
422 case PLAYER_SKILL_AIR:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
423 pCharacter->AddItem(-1, ITEM_SPELLBOOK_AIR_FEATHER_FALL);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
424 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
425 case PLAYER_SKILL_WATER:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
426 pCharacter->AddItem(-1, ITEM_SPELLBOOK_WATER_POISON_SPRAY);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
427 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
428 case PLAYER_SKILL_EARTH:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
429 pCharacter->AddItem(-1, ITEM_SPELLBOOK_EARTH_SLOW);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
430 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
431 case PLAYER_SKILL_SPIRIT:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
432 pCharacter->AddItem(-1, ITEM_SPELLBOOK_SPIRIT_BLESS);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
433 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
434 case PLAYER_SKILL_MIND:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
435 pCharacter->AddItem(-1, ITEM_SPELLBOOK_MIND_MIND_BLAST);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
436 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
437 case PLAYER_SKILL_BODY:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
438 pCharacter->AddItem(-1, ITEM_SPELLBOOK_BODY_FIRST_AID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
439 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
440 case PLAYER_SKILL_ITEM_ID:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
441 case PLAYER_SKILL_REPAIR:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
442 case PLAYER_SKILL_MEDITATION:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
443 case PLAYER_SKILL_PERCEPTION:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
444 case PLAYER_SKILL_DIPLOMACY:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
445 case PLAYER_SKILL_TRAP_DISARM:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
446 case PLAYER_SKILL_LEARNING:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
447 pCharacter->AddItem(-1, ITEM_POTION_BOTTLE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
448 v16 = 5 * (rand() % 3 + 40); // simple reagent
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
449 pCharacter->AddItem(-1, v16);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
450 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
451 case PLAYER_SKILL_DODGE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
452 pCharacter->AddItem(-1, ITEM_BOOTS_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
453 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
454 case PLAYER_SKILL_UNARMED:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
455 pCharacter->AddItem(-1, ITEM_GAUNTLETS_1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
456 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
457 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
458 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
459 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
460 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
461 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
462 for (int i = 0; i < 138; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
463 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
464 if ( pCharacter->pInventoryItemList[i].uItemID != 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
465 pCharacter->pInventoryItemList[i].SetIdentified();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
466 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
467 }
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
468
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
469 pCharacter->sHealth = pCharacter->GetMaxHealth();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
470 pCharacter->sMana = pCharacter->GetMaxMana();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
471 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
472 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
473
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
474 //----- (004917CE) --------------------------------------------------------
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
475 void Party::Reset()
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
476 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
477 Zero();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
478
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
479 field_708 = 15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
480 sEyelevel = 160;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
481 uNumGold = 200;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
482 uNumFoodRations = 7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
483
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
484 alignment = PartyAlignment_Neutral;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
485 SetUserInterface(alignment, true);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
486
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
487 // 0x21C00 = 138240
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
488 // 138240 x 0.234375 = 32400
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
489 // 32400 / 60 / 60 = 9 am
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
490 uTimePlayed = 0x21C00;
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
491 uLastRegenerationTime = 0x21C00;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
492
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
493 bTurnBasedModeOn = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
494
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
495 uActiveCharacter = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
496 ::pPlayers.ZerothIndex() = &pPlayers[0];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
497 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
498 ::pPlayers[i + 1] = &pPlayers[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
500 pPlayers[0].Reset(PLAYER_CLASS_KNIGHT);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
501 pPlayers[0].uCurrentFace = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
502 pPlayers[0].uPrevVoiceID = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
503 pPlayers[0].uVoiceID = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
504 pPlayers[0].SetInitialStats();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
505
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
506 pPlayers[0].uSex = pPlayers[0].GetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
507 pPlayers[0].RandomizeName();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
508 strcpy(pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
509
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
510
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
511 pPlayers[1].Reset(PLAYER_CLASS_THEIF);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
512 pPlayers[1].uCurrentFace = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
513 pPlayers[1].uPrevVoiceID = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
514 pPlayers[1].uVoiceID = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
515 pPlayers[1].SetInitialStats();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
516 pPlayers[1].uSex = pPlayers[1].GetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
517 pPlayers[1].RandomizeName();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
518 strcpy(pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]);
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
519
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
520 pPlayers[2].Reset(PLAYER_CLASS_CLERIC);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
521 pPlayers[2].uCurrentFace = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
522 pPlayers[2].uPrevVoiceID = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
523 pPlayers[2].uVoiceID = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
524 pPlayers[2].SetInitialStats();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
525 pPlayers[2].uSex = pPlayers[3].GetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
526 pPlayers[2].RandomizeName();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
527 strcpy(pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]);
2565
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
528
117c219bf913 Party, items and stuff are abstracted from savegame file representation
a.parshin
parents: 2544
diff changeset
529 pPlayers[3].Reset(PLAYER_CLASS_SORCERER);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
530 pPlayers[3].uCurrentFace = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
531 pPlayers[3].uPrevVoiceID = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
532 pPlayers[3].uVoiceID = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
533 pPlayers[3].SetInitialStats();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
534 pPlayers[3].uSex = pPlayers[3].GetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
535 pPlayers[3].RandomizeName();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
536 strcpy(pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
537
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
538 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
539 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
540 pPlayers[i].uTimeToRecovery = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
541 for (uint j = 0; j < 20; ++j)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
542 pPlayers[i].pConditions[j] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
543
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
544 for (uint j = 0; j < 24; ++j)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
545 pPlayers[i].pPlayerBuffs[j].Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
546
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
547 pPlayers[i].expression = CHARACTER_EXPRESSION_1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
548 pPlayers[i].uExpressionTimePassed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
549 pPlayers[i].uExpressionTimeLength = rand() % 256 + 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
550 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
551
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
552 for (uint i = 1; i < 20; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
553 pPartyBuffs[i].Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
554
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2542
diff changeset
555 current_character_screen_window = WINDOW_CharacterWindow_Stats; // default character ui - stats
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
556 uFlags = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
557 memset(_autonote_bits, 0, sizeof(_autonote_bits));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
558 memset(_quest_bits, 0, sizeof(_quest_bits));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
559 pIsArtifactFound.fill(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
560
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
561 PartyTimes._shop_ban_times.fill(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
562
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
563 memcpy(pNPCStats->pNewNPCData, pNPCStats->pNPCData, 0x94BCu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
564 memcpy(pNPCStats->pGroups_copy, pNPCStats->pGroups, 0x66u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
565 pNPCStats->pNewNPCData[3].uFlags |= 128;//|= 0x80u; Lady Margaret
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
566 _494035_timed_effects__water_walking_damage__etc();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
567 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
568 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
569
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
570
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
571 //----- (0043AD34) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
572 void Party::Yell()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
573 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
574 Actor *v0; // esi@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
575 int v1; // edi@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
576 int v2; // ebx@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
577 int v3; // eax@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
578
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
579 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
580 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
581 if ( pParty->bTurnBasedModeOn != 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
582 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
583 for (unsigned int i = 0; i < uNumActors; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
584 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
585 v0 = &pActors[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
586 if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
587 && v0->pMonsterInfo.uMovementType != MONSTER_MOVEMENT_TYPE_STAIONARY )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
588 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
589 v1 = abs(v0->vPosition.x - pParty->vPosition.x);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
590 v2 = abs(v0->vPosition.y - pParty->vPosition.y);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
591 v3 = abs(v0->vPosition.z - pParty->vPosition.z);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
592 if (int_get_vector_length(v1, v2, v3) < 512)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
593 Actor::AI_Flee(i, 4, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
594 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
595 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
596 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
597 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
598
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
599 //----- (00491BF9) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
600 void Party::ResetPosMiscAndSpellBuffs()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
601 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
602 this->vPosition.y = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
603 this->vPosition.z = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
604 this->vPosition.x = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
605 this->uFallStartY = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
606 this->sRotationY = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
607 this->sRotationX = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
608 this->uFallSpeed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
609 this->field_28 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
610 this->uDefaultPartyHeight = 120;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
611 this->field_14_radius = 37;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
612 this->y_rotation_granularity = 25;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
613 this->uWalkSpeed = 384;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
614 this->y_rotation_speed = 90;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
615 this->field_24 = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
616 this->field_6FC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
617 this->field_708 = 15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
618 this->field_0 = 25;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
619
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
620 for (int playerId = 0; playerId < 4; playerId++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
621 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
622 for (int buffId = 0; buffId < 24; buffId++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
623 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
624 this->pPlayers[playerId].pPlayerBuffs[buffId].Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
625 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
626 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
627 for (int buffId = 0; buffId < 20; buffId++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
628 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
629 this->pPartyBuffs[buffId].Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
630 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
631 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
632
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
633 //----- (004909F4) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
634 void Party::UpdatePlayersAndHirelingsEmotions()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
635 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
636 int v4; // edx@27
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
637
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
638 for (int i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
639 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
640 Player* player = &pPlayers[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
641 player->uExpressionTimePassed += (unsigned short)pMiscTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
642
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
643 uint condition = player->GetMajorConditionIdx();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
644 if (condition == Condition_Good || condition == Condition_Zombie)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
645 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
646 if (player->uExpressionTimePassed < player->uExpressionTimeLength)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
647 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
648
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
649 player->uExpressionTimePassed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
650 if (player->expression != 1 || rand() % 5)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
651 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
652 player->expression = CHARACTER_EXPRESSION_1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
653 player->uExpressionTimeLength = rand() % 256 + 32;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
654 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
655 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
656 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
657 v4 = rand() % 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
658 if (v4 < 25) player->expression = CHARACTER_EXPRESSION_13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
659 else if (v4 < 31) player->expression = CHARACTER_EXPRESSION_14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
660 else if (v4 < 37) player->expression = CHARACTER_EXPRESSION_15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
661 else if (v4 < 43) player->expression = CHARACTER_EXPRESSION_16;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
662 else if (v4 < 46) player->expression = CHARACTER_EXPRESSION_17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
663 else if (v4 < 52) player->expression = CHARACTER_EXPRESSION_18;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
664 else if (v4 < 58) player->expression = CHARACTER_EXPRESSION_19;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
665 else if (v4 < 64) player->expression = CHARACTER_EXPRESSION_20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
666 else if (v4 < 70) player->expression = CHARACTER_EXPRESSION_54;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
667 else if (v4 < 76) player->expression = CHARACTER_EXPRESSION_55;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
668 else if (v4 < 82) player->expression = CHARACTER_EXPRESSION_56;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
669 else if (v4 < 88) player->expression = CHARACTER_EXPRESSION_57;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
670 else if (v4 < 94) player->expression = CHARACTER_EXPRESSION_29;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
671 else player->expression = CHARACTER_EXPRESSION_30;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
672 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
673
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
674 for (unsigned int j = 0; j < pPlayerFrameTable->uNumFrames; ++j)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
675 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
676 PlayerFrame* frame = &pPlayerFrameTable->pFrames[j];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
677 if (frame->expression == player->expression)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
678 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
679 player->uExpressionTimeLength = 8 * frame->uAnimLength;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
680 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
681 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
682 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
683 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
684 else if (player->expression != CHARACTER_EXPRESSION_DMGRECVD_MINOR &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
685 player->expression != CHARACTER_EXPRESSION_DMGRECVD_MODERATE &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
686 player->expression != CHARACTER_EXPRESSION_DMGRECVD_MAJOR ||
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
687 player->uExpressionTimePassed >= player->uExpressionTimeLength)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
688 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
689 player->uExpressionTimeLength = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
690 player->uExpressionTimePassed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
691
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
692 switch (condition)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
693 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
694 case Condition_Dead: player->expression = CHARACTER_EXPRESSION_DEAD; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
695 case Condition_Pertified: player->expression = CHARACTER_EXPRESSION_PERTIFIED; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
696 case Condition_Eradicated: player->expression = CHARACTER_EXPRESSION_ERADICATED; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
697 case Condition_Cursed: player->expression = CHARACTER_EXPRESSION_CURSED; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
698 case Condition_Weak: player->expression = CHARACTER_EXPRESSION_WEAK; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
699 case Condition_Sleep: player->expression = CHARACTER_EXPRESSION_SLEEP; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
700 case Condition_Fear: player->expression = CHARACTER_EXPRESSION_FEAR; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
701 case Condition_Drunk: player->expression = CHARACTER_EXPRESSION_DRUNK; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
702 case Condition_Insane: player->expression = CHARACTER_EXPRESSION_INSANE; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
703 case Condition_Poison_Weak:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
704 case Condition_Poison_Medium:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
705 case Condition_Poison_Severe: player->expression = CHARACTER_EXPRESSION_POISONED; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
706 case Condition_Disease_Weak:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
707 case Condition_Disease_Medium:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
708 case Condition_Disease_Severe: player->expression = CHARACTER_EXPRESSION_DISEASED; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
709 case Condition_Paralyzed: player->expression = CHARACTER_EXPRESSION_PARALYZED; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
710 case Condition_Unconcious: player->expression = CHARACTER_EXPRESSION_UNCONCIOUS; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
711 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
712 Error("Invalid condition: %u", condition);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
713 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
714 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
715 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
716
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
717 for (int i = 0; i < 2; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
718 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
719 NPCData* hireling = &pParty->pHirelings[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
720 if (!hireling->evt_C)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
721 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
722
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
723 hireling->evt_B += pMiscTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
724 if (hireling->evt_B >= hireling->evt_C)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
725 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
726 hireling->evt_A = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
727 hireling->evt_B = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
728 hireling->evt_C = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
729
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
730 Assert(sizeof(NPCData) == 0x4C);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
731 memset(hireling, 0, sizeof(*hireling));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
732
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
733 pParty->hirelingScrollPosition = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
734 pParty->CountHirelings();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
735 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
736 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
737 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
738 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
739
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
740 //----- (00490D02) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
741 void Party::RestAndHeal()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
742 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
743 Player *pPlayer; // esi@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
744 bool have_vessels_soul; // [sp+10h] [bp-8h]@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
745
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
746 for ( uint i = 0; i < 20; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
747 pParty->pPartyBuffs[i].Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
748
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
749 for ( int pPlayerID = 0; pPlayerID < 4; ++pPlayerID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
750 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
751 pPlayer = &pParty->pPlayers[pPlayerID];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
752 for ( uint i = 0; i < 20; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
753 pPlayer->pPlayerBuffs[i].Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
754
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
755 pPlayer->Zero();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
756 if ( pPlayer->pConditions[Condition_Dead] || pPlayer->pConditions[Condition_Pertified] || pPlayer->pConditions[Condition_Eradicated] )//Dead/Petrified/Eradicated
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
757 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
758 pPlayer->pConditions[Condition_Unconcious] = 0;//Unconcious
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
759 pPlayer->pConditions[Condition_Drunk] = 0;//Drunk
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
760 pPlayer->pConditions[Condition_Fear] = 0;//Fear
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
761 pPlayer->pConditions[Condition_Sleep] = 0;//Sleep
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
762 pPlayer->pConditions[Condition_Weak] = 0;//Weak
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
763 pPlayer->uTimeToRecovery = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
764 pPlayer->sHealth = pPlayer->GetMaxHealth();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
765 pPlayer->sMana = pPlayer->GetMaxMana();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
766 if ( pPlayer->classType == PLAYER_CLASS_LICH )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
767 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
768 have_vessels_soul = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
769 for ( uint i = 0; i < 126; i++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
770 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
771 if ( pPlayer->pInventoryItemList[i].uItemID == ITEM_LICH_JAR_FULL && pPlayer->pInventoryItemList[i].uHolderPlayer == pPlayerID + 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
772 have_vessels_soul = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
773 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
774 if ( !have_vessels_soul )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
775 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
776 pPlayer->sHealth = pPlayer->GetMaxHealth() / 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
777 pPlayer->sMana = pPlayer->GetMaxMana() / 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
778 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
779 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
780
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
781 if (pPlayer->pConditions[Condition_Zombie])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
782 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
783 pPlayer->sMana = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
784 pPlayer->sHealth /= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
785 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
786 else if ( pPlayer->pConditions[Condition_Poison_Severe] || pPlayer->pConditions[Condition_Disease_Severe] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
787 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
788 pPlayer->sHealth /= 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
789 pPlayer->sMana /= 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
790 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
791 else if ( pPlayer->pConditions[Condition_Poison_Medium] || pPlayer->pConditions[Condition_Disease_Medium] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
792 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
793 pPlayer->sHealth /= 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
794 pPlayer->sMana /= 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
795 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
796 else if ( pPlayer->pConditions[Condition_Poison_Weak] || pPlayer->pConditions[Condition_Disease_Weak] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
797 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
798 pPlayer->sHealth /= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
799 pPlayer->sMana /= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
800 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
801 if ( pPlayer->pConditions[Condition_Insane] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
802 pPlayer->sMana = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
803 UpdatePlayersAndHirelingsEmotions();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
804 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
805 pParty->days_played_without_rest = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
806 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
807
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
808 //----- (004938D1) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
809 void __fastcall Rest(unsigned int uHoursToSleep)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
810 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
811 signed __int64 v2; // st7@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
812
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
813 if ( uHoursToSleep > 240 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
814 Actor::InitializeActors();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
815 v2 = (signed __int64)((7680 * uHoursToSleep) * 0.033333335);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
816 pParty->uTimePlayed += v2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
817 for (int i = 1; i <= 4; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
818 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
819 pPlayers[i]->Recover((int)v2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
820 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
821 _494035_timed_effects__water_walking_damage__etc();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
822 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
823 //----- (004B1BDB) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
824 void RestAndHeal(__int64 uNumMinutes)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
825 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
826 signed __int64 v1; // ST2C_8@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
827 signed __int64 v2; // qax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
828 unsigned __int64 v4; // qax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
829 unsigned int v5; // ebx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
830
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
831 pParty->pHirelings[0].bHasUsedTheAbility = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
832 pParty->pHirelings[1].bHasUsedTheAbility = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
833 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
834 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
835 v2 = v1 / 60 / 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
836 v4 = (unsigned int)v2 / 0x18;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
837 v5 = (unsigned int)(v4 / 7) >> 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
838 pParty->uCurrentTimeSecond = v1 % 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
839 pParty->uCurrentMinute = v1 / 60 % 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
840 pParty->uCurrentHour = v2 % 24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
841 pParty->uCurrentMonthWeek = v4 / 7 & 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
842 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
843 pParty->uCurrentMonth = v5 % 0xC;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
844 pParty->uCurrentYear = v5 / 0xC + game_starting_year;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
845 pParty->RestAndHeal();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
846
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
847 for (int i = 0; i < 4; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
848 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
849 pParty->pPlayers[i].uTimeToRecovery = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
850 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
851 pParty->pPlayers[i].uNumArmageddonCasts = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
852 pParty->pPlayers[i].uNumFireSpikeCasts = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
853 pParty->pPlayers[i].field_1B3B = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
854 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
855 pParty->UpdatePlayersAndHirelingsEmotions();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
856 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
857 //----- (0041F5BE) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
858 void Party::Sleep6Hours()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
859 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
860 if ( _506F18_num_minutes_to_sleep < 6 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
861 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
862 if ( _506F18_num_minutes_to_sleep )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
863 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
864 Rest(_506F18_num_minutes_to_sleep);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
865 _506F18_num_minutes_to_sleep = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
866 OutdoorLocation::LoadActualSkyFrame();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
867 }
2542
a.parshin
parents: 2541
diff changeset
868 if ( _506F14_resting_stage == 2 )
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
869 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
870 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
871 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
872 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
873 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
874 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
875 Rest(6u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
876 _506F18_num_minutes_to_sleep -= 6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
877 OutdoorLocation::LoadActualSkyFrame();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
878 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
879 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
880 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
881
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
882 bool TestPartyQuestBit( PARTY_QUEST_BITS bit )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
883 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
884 return _449B57_test_bit(pParty->_quest_bits, bit);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
885 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
886
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
887 //----- (0047752B) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
888 int Party::GetPartyReputation()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
889 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
890 DDM_DLV_Header *v0; // ebx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
891 signed int v1; // esi@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
892
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
893 v0 = &pOutdoor->ddm;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
894 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
895 v0 = &pIndoor->dlv;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
896 v1 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
897 if ( CheckHiredNPCSpeciality(Pirate) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
898 v1 += 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
899 if ( CheckHiredNPCSpeciality(Burglar) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
900 v1 += 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
901 if ( CheckHiredNPCSpeciality(Gypsy) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
902 v1 += 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
903 if ( CheckHiredNPCSpeciality(Duper) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
904 v1 += 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
905 if ( CheckHiredNPCSpeciality(FallenWizard) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
906 v1 += 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
907 return v1 + v0->uReputation;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
908 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
909 //----- (004269A2) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
910 void Party::GivePartyExp(unsigned int pEXPNum)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
911 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
912 signed int pActivePlayerCount; // ecx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
913 int pLearningPercent; // eax@13
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
914
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
915 if ( pEXPNum > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
916 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
917 pActivePlayerCount = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
918 for ( uint i = 0; i < 4; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
919 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
920 if ( !pParty->pPlayers[i].pConditions[Condition_Unconcious] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
921 !pParty->pPlayers[i].pConditions[Condition_Dead] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
922 !pParty->pPlayers[i].pConditions[Condition_Pertified] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
923 !pParty->pPlayers[i].pConditions[Condition_Eradicated] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
924 pActivePlayerCount ++;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
925 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
926 if ( pActivePlayerCount )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
927 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
928 pEXPNum = pEXPNum / pActivePlayerCount;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
929 for ( uint i = 0; i < 4; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
930 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
931 if ( !pParty->pPlayers[i].pConditions[Condition_Unconcious] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
932 !pParty->pPlayers[i].pConditions[Condition_Dead] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
933 !pParty->pPlayers[i].pConditions[Condition_Pertified] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
934 !pParty->pPlayers[i].pConditions[Condition_Eradicated] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
935 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
936 pLearningPercent = pParty->pPlayers[i].GetLearningPercent();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
937 pEXPNum = pEXPNum + pEXPNum * pLearningPercent / 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
938 pParty->pPlayers[i].uExperience += pEXPNum;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
939 if ( pParty->pPlayers[i].uExperience > 4000000000i64 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
940 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
941 pParty->pPlayers[i].uExperience = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
942 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
943 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
944 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
945 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
946 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
947 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
948 //----- (00420C05) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
949 void Party::PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
950 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
951 int hirelingSalaries; // ebp@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
952 unsigned int goldToGain; // esi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
953 NPCData *v12; // ecx@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
954 unsigned int v13; // ecx@23
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
955 signed int hirelingCount; // [sp+Ch] [bp-4h]@6
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
956
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
957 hirelingSalaries = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
958 goldToGain = uNumGold;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
959
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
960 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
961 pTmpBuf2[0] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
962 else if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
963 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
964 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
965 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
966 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
967 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
968 hirelingCount = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
969 for (int i = 0; i < 2; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
970 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
971 if (this->pHirelings[i].pName)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
972 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
973 hirelingCount++;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
974 pTmpBuf[hirelingCount] = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
975 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
976 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
977 for (uint i = 0; i < pNPCStats->uNumNewNPCs; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
978 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
979 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
980 && (!this->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[0].pName))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
981 && (!this->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[1].pName)) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
982 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
983 hirelingCount++;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
984 pTmpBuf[hirelingCount] = i + 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
985 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
986 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
987 for (int i = 0; i < hirelingCount; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
988 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
989 uchar thisBufId = (uchar)pTmpBuf[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
990 if (thisBufId < 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
991 v12 = &this->pHirelings[thisBufId];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
992 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
993 v12 = &pNPCStats->pNPCData[thisBufId + 499];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
994 v13 = v12->uProfession;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
995 if ( v13 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
996 hirelingSalaries += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
997 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
998 if ( CheckHiredNPCSpeciality(Factor) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
999 goldToGain += (signed int)(10 * goldToGain) / 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1000 if ( CheckHiredNPCSpeciality(Banker) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1001 goldToGain += (signed int)(20 * goldToGain) / 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1002 if ( CheckHiredNPCSpeciality(Pirate) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1003 goldToGain += (signed int)(10 * goldToGain) / 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1004 if ( hirelingSalaries )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1005 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1006 hirelingSalaries = (signed int)(goldToGain * hirelingSalaries / 100) / 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1007 if ( hirelingSalaries < 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1008 hirelingSalaries = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1009 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[466], goldToGain, hirelingSalaries);// You found %lu gold (followers take %lu)!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1010 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1011 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1012 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1013 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], goldToGain);// You found %lu gold!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1014 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1015 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1016 this->uNumGold += goldToGain - hirelingSalaries;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1017 pUIAnim_Gold->uAnimTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1018 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1019 if ( pTmpBuf2[0] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1020 ShowStatusBarString(pTmpBuf2.data(), 2u);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2502
diff changeset
1021 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1022 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1023 //----- (00421B2C) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1024 void Party::sub_421B2C_PlaceInInventory_or_DropPickedItem()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1025 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1026 unsigned int v0; // eax@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1027 Texture *v1; // ebx@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1028 int v2; // eax@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1029 int v4; // eax@6
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1030 unsigned __int16 v5; // dx@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1031 signed int v6; // eax@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1032 __int16 v8; // ax@16
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1033 SpriteObject a1; // [sp+4h] [bp-78h]@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1034 int v11; // [sp+74h] [bp-8h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1035 int v12; // [sp+78h] [bp-4h]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1036
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1037 if ( !pParty->pPickedItem.uItemID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1038 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1039 v0 = pIcons_LOD->LoadTexture(
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1040 pParty->pPickedItem.GetIconName(),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1041 TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1042 v1 = pIcons_LOD->GetTexture(v0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1043 v11 = areWeLoadingTexture;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1044 if ( uActiveCharacter
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1045 && (v2 = ::pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1046 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1047 memcpy(&::pPlayers[uActiveCharacter]->pInventoryItemList[v2-1], &pParty->pPickedItem, 0x24u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1048 pMouse->RemoveHoldingItem();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1049 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1050 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1051 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1052 for (v12 = 0; v12 < 4; v12++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1053 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1054 v4 = pParty->pPlayers[v12].AddItem(-1, pParty->pPickedItem.uItemID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1055 if ( v4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1056 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1057 memcpy(&pParty->pPlayers[v12].pInventoryItemList[v4 - 1], &pParty->pPickedItem, sizeof(ItemGen));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1058 pMouse->RemoveHoldingItem();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1059 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1060 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1061 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1062 if ( v12 == 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1063 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1064 v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1065 v6 = 0;
2566
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2565
diff changeset
1066 a1.uType = (SPRITE_OBJECT_TYPE)pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1067 for ( uint i = 0; i < pObjectList->uNumObjects; i++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1068 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1069 if ( v5 == pObjectList->pObjects[i].uObjectID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1070 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1071 v6 = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1072 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1073 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1074 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1075 a1.spell_caster_pid = OBJECT_Player;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1076 a1.uObjectDescID = v6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1077 a1.vPosition.y = pParty->vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1078 a1.vPosition.x = pParty->vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1079 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1080 a1.uSoundID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1081 a1.uFacing = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1082 a1.uAttributes = 8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1083 v8 = pIndoor->GetSector(
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1084 pParty->vPosition.x,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1085 pParty->vPosition.y,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1086 pParty->sEyelevel + pParty->vPosition.z);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1087 a1.uSpriteFrameID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1088 a1.uSectorID = v8;
2566
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2565
diff changeset
1089 memcpy(&a1.containing_item, &pParty->pPickedItem, sizeof(a1.containing_item));
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1090 a1.Create(pParty->sRotationY, 184, 200, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1091 pMouse->RemoveHoldingItem();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1092 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1093 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1094 if ( !v11 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1095 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1096 v1->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1097 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1098 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1099 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1100 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1101
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1102
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1103 //----- (0048C6F6) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1104 bool Party::AddItemToParty(ItemGen *pItem)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1105 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1106 unsigned int v2; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1107 char *v5; // eax@8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1108 Texture *v7; // ebx@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1109 signed int v8; // esi@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1110 Player *v9; // edi@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1111 int v10; // eax@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1112 int v21; // [sp+24h] [bp-4h]@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1113
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1114 v2 = pItem->uItemID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1115 if ( !pItemsTable->pItems[v2].uItemID_Rep_St )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1116 pItem->SetIdentified();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1117
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1118 v5 = pItemsTable->pItems[v2].pIconName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1119 if ( v5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1120 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1121 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1122 v21 = areWeLoadingTexture;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1123 v8 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1124 uint current_player = uActiveCharacter;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1125 for (int i = 0; i < 4; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1126 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1127 current_player = current_player + i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1128 if ( current_player > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1129 current_player = current_player - 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1130 v9 = ::pPlayers[current_player];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1131 v10 = v9->AddItem(-1, pItem->uItemID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1132 if ( v10 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1133 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1134 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1135 pItem->Reset();
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2502
diff changeset
1136 pAudioPlayer->PlaySound(SOUND_gold01, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1137 v9->PlaySound(SPEECH_60, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1138 if ( !v21 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1139 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1140 v7->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1141 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1142 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1143 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1144 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1145 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1146 if ( !v21 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1147 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1148 v7->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1149 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1150 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1151 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1152 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1153 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1154 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1155 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1156 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1157 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1158 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1159 // 506128: using guessed type int areWeLoadingTexture;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1160
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1161 bool Party::IsPartyEvil()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1162 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1163 return _449B57_test_bit(_quest_bits, 100);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1164 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1165
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1166 bool Party::IsPartyGood()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1167 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1168 return _449B57_test_bit(_quest_bits, 99);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1169 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1170
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1171
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1172
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1173 //----- (0046A89E) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1174 int Party::_46A89E_immolation_effect(int* affected, int affectedArrSize, int effectRange)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1175 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1176 int v5; // ebx@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1177 int v17; // [sp+Ch] [bp-10h]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1178 int v18; // [sp+10h] [bp-Ch]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1179 int affectedCount; // [sp+18h] [bp-4h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1180
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1181 affectedCount = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1182 for ( size_t i = 0; i < uNumActors; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1183 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1184 v5 = abs(pActors[i].vPosition.x - this->vPosition.x);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1185 v17 = abs(pActors[i].vPosition.y - this->vPosition.y);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1186 v18 = abs(pActors[i].vPosition.z - this->vPosition.z);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1187 if ( int_get_vector_length(v5, v17, v18) <= effectRange )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1188 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1189 if ( pActors[i].uAIState != Dead && pActors[i].uAIState != Dying && pActors[i].uAIState != Removed
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1190 && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1191 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1192 affected[affectedCount] = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1193 affectedCount++;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1194 if ( affectedCount >= affectedArrSize )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1195 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1196 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1197 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1198 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1199 return affectedCount;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1200 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1201
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1202 //----- (00444D80) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1203 int GetTravelTime()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1204 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1205 signed int new_travel_time; // esi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1206
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1207 new_travel_time = uDefaultTravelTime_ByFoot;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1208 if ( CheckHiredNPCSpeciality(Guide) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1209 --new_travel_time;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1210 if ( CheckHiredNPCSpeciality(Tracker) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1211 new_travel_time -= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1212 if ( CheckHiredNPCSpeciality(Pathfinder) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1213 new_travel_time -= 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1214 if ( CheckHiredNPCSpeciality(Explorer) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1215 --new_travel_time;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1216 if ( new_travel_time < 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1217 new_travel_time = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1218 return new_travel_time;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1219 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1220 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1221
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1222 //----- (00449B57) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1223 bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1224 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1225 return (a1[(a2 - 1) >> 3] & (0x80 >> (a2 - 1) % 8)) != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1226 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1227
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1228 //----- (00449B7E) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1229 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1230 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1231 signed int v3; // esi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1232 unsigned char set_bit; // edx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1233
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1234 v3 = a2 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1235 set_bit = 0x80 >> v3 % 8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1236 if (bToggle)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1237 pArray[v3 / 8] |= set_bit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1238 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1239 pArray[v3 / 8] &= ~set_bit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1240 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1241
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1242 //----- (004760D5) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1243 PartyAction ActionQueue::Next()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1244 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1245 if (!uNumActions)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1246 return PARTY_INVALID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1247
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1248 PartyAction result = pActions[0];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1249 for (unsigned int i = 0; i < uNumActions - 1; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1250 pActions[i] = pActions[i + 1];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1251 --uNumActions;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1252
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1253 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1254 }