annotate Engine/Party.cpp @ 2575:a76d408c5132 tip

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