annotate Party.cpp @ 91:471b1354cc73

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