Mercurial > mm7
annotate mm7_4.cpp @ 2253:aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
author | Grumpy7 |
---|---|
date | Wed, 26 Feb 2014 23:35:23 +0100 |
parents | 3cc3a29f073b |
children | 4c9fef516e0a |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2250
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
2152 | 2 #include "mm7_data.h" |
3 #include "mm7_unsorted_subs.h" | |
1262 | 4 #include "Texture.h" |
1016 | 5 #include "VideoPlayer.h" |
6 #include "Sprites.h" | |
7 #include "BSPModel.h" | |
8 #include "Mouse.h" | |
9 #include "stru6.h" | |
10 | |
11 #include "LightmapBuilder.h" | |
341 | 12 #include "MM7.h" |
0 | 13 #include "MapInfo.h" |
14 #include "Game.h" | |
15 #include "GUIWindow.h" | |
16 #include "GUIFont.h" | |
17 #include "Party.h" | |
18 #include "AudioPlayer.h" | |
19 #include "Outdoor.h" | |
1277 | 20 #include "Outdoor_stuff.h" |
0 | 21 #include "LOD.h" |
22 #include "Actor.h" | |
23 #include "Events.h" | |
24 #include "Viewport.h" | |
25 #include "FrameTableInc.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2030
diff
changeset
|
26 #include "OurMath.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
27 #include "SpriteObject.h" |
0 | 28 #include "ObjectList.h" |
29 #include "DecorationList.h" | |
2044 | 30 #include "Timer.h" |
0 | 31 #include "IconFrameTable.h" |
32 #include "PlayerFrameTable.h" | |
33 #include "Awards.h" | |
34 #include "TurnEngine.h" | |
35 #include "Events2D.h" | |
36 #include "stru159.h" | |
189 | 37 #include "texts.h" |
0 | 38 #include "Log.h" |
1299 | 39 #include "UI\UIHouses.h" |
1262 | 40 #include "Lights.h" |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1827
diff
changeset
|
41 #include "Level/Decoration.h" |
0 | 42 |
43 //----- (0046CC4B) -------------------------------------------------------- | |
1459 | 44 void check_event_triggers() |
0 | 45 { |
1513 | 46 for (size_t i = 0; i < num_event_triggers; i++) |
0 | 47 { |
2117 | 48 if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH |
49 && pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pParty->vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange) | |
0 | 50 { |
2117 | 51 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, PID(OBJECT_Decoration,i), 1); |
0 | 52 } |
2117 | 53 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER) |
0 | 54 { |
1513 | 55 for (size_t j = 0; j < uNumActors; j++) |
0 | 56 { |
2117 | 57 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pActors[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange) |
58 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1); | |
0 | 59 } |
60 } | |
2117 | 61 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT) |
0 | 62 { |
1513 | 63 for (size_t j = 0; j < uNumSpriteObjects; j++) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
64 { |
2117 | 65 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pSpriteObjects[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange) |
66 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1); | |
0 | 67 } |
68 } | |
69 } | |
70 } | |
71 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
72 | |
73 //----- (0046DEF2) -------------------------------------------------------- | |
74 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
75 { | |
76 unsigned int result; // eax@1 | |
77 | |
78 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
79 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 80 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
81 return result; | |
82 } | |
83 | |
84 //----- (0046E0B2) -------------------------------------------------------- | |
1458 | 85 void _46E0B2_collide_against_decorations() |
0 | 86 { |
2117 | 87 BLVSector *sector; // ebp@1 |
88 LevelDecoration *decor; // edi@2 | |
89 DecorationDesc *decor_desc; // esi@3 | |
0 | 90 int v8; // ebx@10 |
91 int v9; // esi@11 | |
92 int v11; // eax@12 | |
93 int v12; // esi@14 | |
94 unsigned int v13; // eax@17 | |
95 signed int i; // [sp+4h] [bp-14h]@1 | |
96 int v15; // [sp+8h] [bp-10h]@10 | |
97 int v16; // [sp+Ch] [bp-Ch]@10 | |
98 int v17; // [sp+10h] [bp-8h]@10 | |
99 | |
2117 | 100 sector = &pIndoor->pSectors[stru_721530.uSectorID]; |
101 for ( i = 0; i < sector->uNumDecorations; ++i ) | |
0 | 102 { |
2117 | 103 decor = &pLevelDecorations[sector->pDecorationIDs[i]]; |
104 if (!(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) | |
0 | 105 { |
2117 | 106 decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID]; |
107 if (!decor_desc->CanMoveThrough()) | |
0 | 108 { |
2117 | 109 if ( stru_721530.sMaxX <= decor->vPosition.x + decor_desc->uRadius && stru_721530.sMinX >= decor->vPosition.x - decor_desc->uRadius |
110 && stru_721530.sMaxY <= decor->vPosition.y + decor_desc->uRadius && stru_721530.sMinY >= decor->vPosition.y - decor_desc->uRadius | |
111 && stru_721530.sMaxZ <= decor->vPosition.z + decor_desc->uDecorationHeight && stru_721530.sMinZ >= decor->vPosition.z ) | |
0 | 112 { |
2117 | 113 v16 = decor->vPosition.x - stru_721530.normal.x; |
114 v15 = decor->vPosition.y - stru_721530.normal.y; | |
115 v8 = stru_721530.prolly_normal_d + decor_desc->uRadius; | |
116 v17 = ((decor->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y | |
117 - (decor->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16; | |
118 if ( abs(v17) <= stru_721530.prolly_normal_d + decor_desc->uRadius ) | |
0 | 119 { |
2117 | 120 v9 = (v16 * stru_721530.direction.x + v15 * stru_721530.direction.y) >> 16; |
121 if ( v9 > 0 ) | |
0 | 122 { |
2117 | 123 v11 = stru_721530.normal.z + fixpoint_mul(stru_721530.direction.z, v9); |
124 if ( v11 >= decor->vPosition.z ) | |
0 | 125 { |
2117 | 126 if ( v11 <= decor_desc->uDecorationHeight + decor->vPosition.z ) |
0 | 127 { |
2117 | 128 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
129 if ( v12 < 0 ) | |
130 v12 = 0; | |
131 if ( v12 < stru_721530.field_7C ) | |
0 | 132 { |
2117 | 133 stru_721530.field_7C = v12; |
134 v13 = 8 * sector->pDecorationIDs[i]; | |
135 LOBYTE(v13) = v13 | 5; | |
136 stru_721530.uFaceID = v13; | |
0 | 137 } |
138 } | |
139 } | |
140 } | |
141 } | |
142 } | |
143 } | |
144 } | |
145 } | |
146 } | |
147 | |
148 //----- (00487DA9) -------------------------------------------------------- | |
1583 | 149 void sub_487DA9() |
0 | 150 { |
1413 | 151 for (int i = 0; i < 20000; ++i) |
152 array_77EC08[i].field_108 = 0; | |
0 | 153 } |
154 | |
155 //----- (0048A959) -------------------------------------------------------- | |
2006 | 156 signed int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) |
0 | 157 { |
158 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
159 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
160 b = (uColor & 0x000000FF) / 255.0f; | |
161 | |
162 float h, s, v; | |
163 RGB2HSV(&h, &s, r, g, b, &v); | |
164 | |
165 if ( h_replace != -1.0 ) | |
166 h = h_replace; | |
167 if ( s_replace != -1.0 ) | |
168 s = s_replace; | |
169 if ( v_replace != -1.0 ) | |
170 v = v_replace; | |
171 HSV2RGB(&r, &g, &b, h, s, v); | |
172 | |
2125 | 173 return (((uint)round_to_int(r * 255.0f) & 0xFF) << 16) | |
174 (((uint)round_to_int(g * 255.0f) & 0xFF) << 8) | | |
175 (((uint)round_to_int(b * 255.0f) & 0xFF)); | |
0 | 176 } |
177 | |
178 //----- (0048B561) -------------------------------------------------------- | |
1029 | 179 int fixpoint_from_float(float val) |
0 | 180 { |
1029 | 181 // float X.Yf -> int XXXX YYYY |
182 int left = floorf((val - 0.5f) + 0.5f); | |
183 int right = floorf((val - left) * 65536.0f); | |
184 return (left << 16) | right; | |
0 | 185 } |
186 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
187 int fixpoint_from_int(int lhv, int rhv) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
188 { |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
189 return (lhv << 16) | rhv; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
190 } |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
191 |
0 | 192 //----- (00491E3A) -------------------------------------------------------- |
1459 | 193 void sub_491E3A() |
0 | 194 { |
195 signed int v1; // esi@3 | |
196 unsigned int v3; // eax@7 | |
197 unsigned int v4; // edx@8 | |
198 int v6; // edi@17 | |
199 int v12; // eax@26 | |
200 | |
2163 | 201 //__debugbreak();//Ritor1 |
2117 | 202 for ( uint pl = 0; pl < 4; pl++ ) |
0 | 203 { |
203 | 204 if (SoundSetAction[24][0]) |
0 | 205 { |
2117 | 206 v3 = 0; |
207 for ( v1 = 0; v1 < (signed int)pSoundList->sNumSounds; ++v1 ) | |
0 | 208 { |
2163 | 209 int ps = 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998;//6728 |
2117 | 210 if ( pSoundList->pSL_Sounds[v1].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998 ) |
211 v3 = v1; | |
0 | 212 } |
764 | 213 pSoundList->UnloadSound(v3, 1); |
2117 | 214 for ( v4 = 0; (signed int)v4 < (signed int)pSoundList->sNumSounds; ++v4 ) |
0 | 215 { |
2117 | 216 if ( pSoundList->pSL_Sounds[v4].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4999 ) |
217 pSoundList->UnloadSound(v4, 1); | |
0 | 218 } |
219 } | |
220 } | |
221 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 222 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 223 { |
224 do | |
225 { | |
2117 | 226 pIcons_LOD->pTextures[v6].Release(); |
227 if ( pIcons_LOD->pHardwareTextures ) | |
0 | 228 { |
2117 | 229 if ( pIcons_LOD->pHardwareTextures[v6] ) |
0 | 230 { |
2117 | 231 pIcons_LOD->pHardwareTextures[v6]->Release(); |
0 | 232 pIcons_LOD->pHardwareTextures[v6] = 0; |
233 } | |
234 } | |
2117 | 235 if ( pIcons_LOD->pHardwareSurfaces ) |
0 | 236 { |
2117 | 237 if ( pIcons_LOD->pHardwareSurfaces[v6] ) |
0 | 238 { |
2117 | 239 pIcons_LOD->pHardwareSurfaces[v6]->Release(); |
0 | 240 pIcons_LOD->pHardwareSurfaces[v6] = 0; |
241 } | |
242 } | |
243 --v6; | |
244 } | |
33 | 245 while ( v6 >= pIcons_LOD->pFacesLock ); |
246 } | |
247 v12 = pIcons_LOD->pFacesLock; | |
248 pIcons_LOD->pFacesLock = 0; | |
0 | 249 pIcons_LOD->uNumLoadedFiles = v12; |
250 } | |
251 // 4ED498: using guessed type char byte_4ED498; | |
252 | |
253 //----- (00493938) -------------------------------------------------------- | |
2155 | 254 void _493938_regenerate() |
0 | 255 { |
2060 | 256 int current_time; // edi@1 |
257 int last_reg_time; // qax@1 | |
0 | 258 int v4; // eax@2 |
259 int v5; // edi@5 | |
2030 | 260 bool cursed_flag; // ecx@5 |
0 | 261 char v7; // sf@5 |
112 | 262 int *v8; // ecx@10 |
0 | 263 int v9; // edi@15 |
264 signed int v10; // eax@15 | |
265 __int16 *v11; // edx@16 | |
266 int v12; // eax@20 | |
267 int v13; // ebx@20 | |
268 unsigned int *v14; // esi@21 | |
269 unsigned int v15; // ecx@21 | |
270 unsigned int v16; // eax@21 | |
271 int v18; // eax@21 | |
272 signed int v19; // eax@21 | |
2060 | 273 bool recovery_HP; // ebx@25 |
0 | 274 ITEM_EQUIP_TYPE v22; // edi@30 |
275 signed int v25; // eax@33 | |
276 int v26; // eax@35 | |
277 int v27; // eax@36 | |
278 int v28; // eax@37 | |
279 signed int v31; // ecx@53 | |
2155 | 280 int v41[100]; // [sp+4h] [bp-22Ch]@20 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
281 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 282 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2060 | 283 bool has_dragon_flag; // [sp+210h] [bp-20h]@22 |
284 bool lich_jar_flag; // [sp+214h] [bp-1Ch]@25 | |
285 bool zombie_flag; // [sp+218h] [bp-18h]@25 | |
286 bool decrease_HP; // [sp+21Ch] [bp-14h]@25 | |
287 bool lich_flag; // [sp+220h] [bp-10h]@25 | |
0 | 288 int v49; // [sp+224h] [bp-Ch]@24 |
2060 | 289 bool recovery_SP; // [sp+228h] [bp-8h]@25 |
290 bool redraw_flag; // [sp+22Ch] [bp-4h]@2 | |
0 | 291 |
2060 | 292 current_time = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; |
293 last_reg_time = (signed int)(signed __int64)((double)pParty->uLastRegenerationTime * 0.234375) / 60; | |
294 if ( current_time >= (signed int)last_reg_time + 5 ) | |
0 | 295 { |
2060 | 296 redraw_flag = false; |
297 v4 = (current_time - last_reg_time) / 5; | |
0 | 298 if (pParty->FlyActive()) |
299 { | |
300 if ( pParty->bFlying ) | |
301 { | |
569 | 302 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2030 | 303 { |
569 | 304 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; |
2060 | 305 cursed_flag = pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[Condition_Cursed];//cursed |
2030 | 306 v7 = cursed_flag < v5; |
307 //cursed_flag -= v5; | |
308 if ( !v7 ) | |
0 | 309 { |
310 pParty->uFlags &= 0xFFFFFFBFu; | |
2030 | 311 pParty->bFlying = false; |
2060 | 312 redraw_flag = true; |
0 | 313 } |
314 } | |
315 } | |
316 } | |
569 | 317 |
0 | 318 if (pParty->WaterWalkActive()) |
319 { | |
569 | 320 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
321 { | |
322 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
323 { // taking on water | |
2184 | 324 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[Condition_Cursed];//&AA1058_PartyQuickSpellSound[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; |
112 | 325 v7 = *v8 < v4; |
326 *v8 -= v4; | |
0 | 327 if ( v7 ) |
328 { | |
112 | 329 *v8 = 0; |
569 | 330 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
2060 | 331 redraw_flag = true; |
0 | 332 } |
333 } | |
334 } | |
335 } | |
569 | 336 |
2060 | 337 if (pParty->ImmolationActive())//Жертва |
0 | 338 { |
339 a3.z = 0; | |
340 a3.y = 0; | |
341 a3.x = 0; | |
342 a1.stru_24.Reset(); | |
822 | 343 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
344 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 345 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
346 a1.uType = 1070; |
822 | 347 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 348 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
349 { | |
350 LABEL_19: | |
351 LOWORD(v10) = 0; | |
352 } | |
353 else | |
354 { | |
355 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 356 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 357 { |
358 ++v10; | |
359 v11 += 28; | |
360 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
361 goto LABEL_19; | |
362 } | |
363 } | |
364 a1.uObjectDescID = v10; | |
365 a1.field_60_distance_related_prolly_lod = 0; | |
1167 | 366 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; |
303 | 367 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 368 a1.uAttributes = 0; |
369 a1.uSectorID = 0; | |
370 a1.uSpriteFrameID = 0; | |
822 | 371 a1.spell_caster_pid = v12; |
0 | 372 a1.uFacing = 0; |
373 a1.uSoundID = 0; | |
1459 | 374 v13 = _46A89E_immolation_effect((int)v41, 100, 307); |
2060 | 375 for ( v9 = 0; v9 < v13; ++v9 ) |
0 | 376 { |
2155 | 377 v14 = (unsigned int *)&v41[v9]; |
2060 | 378 v15 = *v14; |
379 v16 = *v14; | |
380 a1.vPosition.x = pActors[v16].vPosition.x; | |
381 a1.vPosition.y = pActors[v16].vPosition.y; | |
382 a1.vPosition.z = pActors[v16].vPosition.z; | |
383 v18 = 8 * v15; | |
384 LOBYTE(v18) = PID(OBJECT_Actor,v15); | |
385 a1.spell_target_pid = v18; | |
386 v19 = a1.Create(0, 0, 0, 0); | |
387 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); | |
0 | 388 } |
389 } | |
2060 | 390 |
391 has_dragon_flag = false; | |
248 | 392 if (PartyHasDragon()) |
2060 | 393 has_dragon_flag = true; |
394 | |
395 for ( v49 = 0; v49 < 4; v49++ ) | |
0 | 396 { |
2060 | 397 recovery_HP = false; |
398 recovery_SP = false; | |
399 decrease_HP = false; | |
400 lich_flag = false; | |
401 lich_jar_flag = false; | |
402 zombie_flag = false; | |
403 | |
404 for ( int v22 = 0; (signed int)v22 < 16; v22++ ) | |
0 | 405 { |
2060 | 406 if ( pParty->pPlayers[v49].HasItemEquipped((ITEM_EQUIP_TYPE)v22) ) |
0 | 407 { |
2060 | 408 uint _idx = pParty->pPlayers[v49].pEquipment.pIndices[v22]; |
409 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID > 134 ) | |
2030 | 410 { |
2060 | 411 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_RELIC_ETHRICS_STAFF ) |
412 decrease_HP = true; | |
413 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HERMES_SANDALS ) | |
414 { | |
415 recovery_HP = true; | |
416 recovery_SP = true; | |
417 } | |
418 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_MINDS_EYE ) | |
419 recovery_SP = true; | |
420 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HEROS_BELT ) | |
421 recovery_HP = true; | |
0 | 422 } |
423 else | |
424 { | |
2060 | 425 v25 = pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uSpecEnchantmentType; |
426 if ( v25 == 37 //of Regeneration("Regenerate 1hp/x while walking, etc") | |
2155 | 427 || v25 == 44 //of Life("HP (+10), Regen hpts") |
428 || v25 == 50 //of The Phoenix("Fire Res (+30), Regen hpts") && | |
429 || v25 == 54 )// of The Troll("End (+15), Regen hpts") | |
2060 | 430 recovery_HP = true; |
431 if ( v25 == 38 //of Mana("Regenerate 1sp/x while walking, etc") | |
2155 | 432 || v25 == 47 //of The Eclipse("SP (+10), Regen spts") |
433 || v25 == 55 )//of The Unicorn("Luck (+15), Regen spts") | |
2060 | 434 recovery_SP = true; |
435 if ( v25 == 66 )// of Plenty("Regenerate 1 hp/x and 1 sp/x while walking, etc.") | |
2030 | 436 { |
2060 | 437 recovery_HP = true; |
438 recovery_SP = true; | |
2030 | 439 } |
0 | 440 } |
2060 | 441 |
2155 | 442 if (recovery_HP && |
443 !pParty->pPlayers[v49].pConditions[Condition_Dead] && | |
444 !pParty->pPlayers[v49].pConditions[Condition_Eradicated]) | |
2060 | 445 { |
2155 | 446 if ( pParty->pPlayers[v49].sHealth < pParty->pPlayers[v49].GetMaxHealth() ) |
447 ++pParty->pPlayers[v49].sHealth; | |
2060 | 448 if ( pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0 ) |
449 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0; | |
450 redraw_flag = true; | |
451 } | |
452 | |
2155 | 453 if (recovery_SP && |
454 !pParty->pPlayers[v49].pConditions[Condition_Dead] && | |
455 !pParty->pPlayers[v49].pConditions[Condition_Eradicated]) | |
0 | 456 { |
2155 | 457 if ( pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana() ) |
458 ++pParty->pPlayers[v49].sMana; | |
2060 | 459 redraw_flag = true; |
460 } | |
461 | |
2155 | 462 if (decrease_HP && |
463 !pParty->pPlayers[v49].pConditions[Condition_Dead] && | |
464 !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
2060 | 465 { |
466 --pParty->pPlayers[v49].sHealth; | |
467 if ( !(pParty->pPlayers[v49].pConditions[Condition_Unconcious]) && pParty->pPlayers[v49].sHealth < 0 ) | |
468 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed; | |
469 if ( pParty->pPlayers[v49].sHealth < 1 ) | |
0 | 470 { |
2060 | 471 if ( pParty->pPlayers[v49].sHealth + pParty->pPlayers[v49].uEndurance + pParty->pPlayers[v49].GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1 |
472 || (signed __int64)pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) | |
473 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed; | |
474 else | |
0 | 475 { |
2060 | 476 if ( !pParty->pPlayers[v49].pConditions[Condition_Dead] ) |
477 pParty->pPlayers[v49].pConditions[Condition_Dead] = pParty->uTimePlayed; | |
0 | 478 } |
479 } | |
2060 | 480 redraw_flag = true; |
0 | 481 } |
482 } | |
483 } | |
2060 | 484 |
485 //regeneration | |
486 if ( pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uExpireTime > 0 | |
487 && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
488 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
0 | 489 { |
2060 | 490 pParty->pPlayers[v49].sHealth += 5 * pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uPower; |
491 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() ) | |
492 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].GetMaxHealth(); | |
493 if ( pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0 ) | |
494 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0; | |
495 redraw_flag = true; | |
496 } | |
497 | |
498 //for warlock | |
499 if ( has_dragon_flag && pParty->pPlayers[v49].classType == PLAYER_CLASS_WARLOCK ) | |
500 { | |
2155 | 501 if ( pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana() ) |
502 ++pParty->pPlayers[v49].sMana; | |
2060 | 503 redraw_flag = true; |
504 } | |
505 | |
506 //for lich | |
507 if ( pParty->pPlayers[v49].classType == PLAYER_CLASS_LICH ) | |
508 { | |
2085 | 509 for ( v31 = 0; v31 < 126; ++v31 ) |
0 | 510 { |
2060 | 511 if ( pParty->pPlayers[v49].pInventoryItemList[v31].uItemID == ITEM_LICH_JAR_FULL ) |
512 lich_jar_flag = true; | |
0 | 513 } |
2060 | 514 lich_flag = true; |
515 } | |
516 if ( lich_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
517 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
518 { | |
519 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2 ) | |
520 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 2; | |
521 if ( pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() / 2 ) | |
522 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 2; | |
523 } | |
524 if ( lich_jar_flag ) | |
525 { | |
2155 | 526 if ( pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana() ) |
527 ++pParty->pPlayers[v49].sMana; | |
2060 | 528 } |
529 | |
530 //for zombie | |
531 if ( pParty->pPlayers[v49].pConditions[Condition_Zombie] ) | |
532 zombie_flag = true; | |
533 if ( zombie_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
534 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
535 { | |
536 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2 ) | |
537 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 1; | |
538 if ( pParty->pPlayers[v49].sMana > 0 ) | |
539 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 1; | |
0 | 540 } |
541 } | |
2060 | 542 pParty->uLastRegenerationTime = pParty->uTimePlayed; |
543 if ( !viewparams->bRedrawGameUI ) | |
544 viewparams->bRedrawGameUI = redraw_flag; | |
0 | 545 } |
546 } | |
547 | |
548 //----- (00493F79) -------------------------------------------------------- | |
1459 | 549 void init_summoned_item(stru351_summoned_item *_this, __int64 duration) |
0 | 550 { |
551 signed __int64 v2; // ST2C_8@1 | |
552 signed __int64 v3; // qax@1 | |
351 | 553 //signed __int64 v4; // ST1C_8@1 |
0 | 554 unsigned __int64 v5; // qax@1 |
555 unsigned int v6; // ebx@1 | |
556 | |
1459 | 557 v2 = (signed __int64)((double)duration * 0.234375); |
0 | 558 v3 = v2 / 60 / 60; |
351 | 559 //v4 = v3; |
0 | 560 v5 = (unsigned int)v3 / 0x18; |
561 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 562 _this->field_0_expire_second = v2 % 60; |
563 _this->field_4_expire_minute = v2 / 60 % 60; | |
564 _this->field_8_expire_hour = v3 % 24; | |
565 _this->field_10_expire_week = v5 / 7 & 3; | |
566 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
567 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 568 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 569 } |
570 | |
571 //----- (00494035) -------------------------------------------------------- | |
1031 | 572 void _494035_timed_effects__water_walking_damage__etc() |
0 | 573 { |
574 signed __int64 v0; // qax@1 | |
575 unsigned int v4; // edi@1 | |
576 signed int v12; // edi@29 | |
577 int v24; // ecx@60 | |
578 int v26; // ecx@64 | |
579 int v28; // ecx@68 | |
580 int v30; // ecx@72 | |
581 int v32; // ecx@76 | |
582 int v34; // ecx@80 | |
583 int v36; // ecx@84 | |
584 int v38; // ecx@88 | |
585 int v40; // ecx@92 | |
586 int v42; // ecx@96 | |
587 bool v43; // ebx@102 | |
588 bool v46; // edi@111 | |
589 unsigned int v56; // [sp-8h] [bp-38h]@55 | |
590 int v59; // [sp-4h] [bp-34h]@55 | |
591 unsigned int v61; // [sp+14h] [bp-1Ch]@1 | |
592 signed int a2a; // [sp+18h] [bp-18h]@47 | |
2062 | 593 signed int old_day; // [sp+1Ch] [bp-14h]@47 |
594 signed int old_hour; | |
0 | 595 |
2062 | 596 old_day = pParty->uDaysPlayed; |
597 old_hour = pParty->uCurrentHour; | |
816 | 598 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 599 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2062 | 600 v0 = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60)/60i64; |
601 v4 = (unsigned int)(((unsigned int)v0 / 24) / 7) >> 2; | |
0 | 602 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; |
2062 | 603 pParty->uCurrentMinute = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) % 60; |
604 pParty->uCurrentHour = v0 % 24; | |
605 pParty->uCurrentMonthWeek = ((unsigned int)v0 / 24) / 7 & 3; | |
606 pParty->uDaysPlayed = (unsigned int)((unsigned int)v0 / 24) % 28; | |
0 | 607 pParty->uCurrentMonth = v4 % 12; |
352 | 608 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
2062 | 609 if ( pParty->uCurrentHour >= 3 && (old_hour < 3 || pParty->uDaysPlayed > old_day) ) // new day dawns |
0 | 610 { |
611 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
612 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
613 | |
614 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
615 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
616 | |
766 | 617 ++pParty->days_played_without_rest; |
618 if (pParty->days_played_without_rest > 1) | |
0 | 619 { |
620 for (uint i = 0; i < 4; ++i) | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
621 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0); |
766 | 622 |
623 if (pParty->uNumFoodRations) | |
624 Party::TakeFood(1); | |
0 | 625 else |
626 for (uint i = 0; i < 4; ++i) | |
766 | 627 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
628 | |
629 if (pParty->days_played_without_rest > 3) | |
2062 | 630 for ( uint i = 0; i < 4; ++i ) |
631 { | |
632 pParty->pPlayers[i].Zero(); | |
633 if (!pParty->pPlayers[i].IsPertified() && !pParty->pPlayers[i].IsEradicated() | |
634 && !pParty->pPlayers[i].IsDead()) | |
0 | 635 { |
2062 | 636 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
637 pParty->pPlayers[i].SetCondDeadWithBlockCheck(0); | |
638 if (rand() % 100 < 10 * pParty->days_played_without_rest) | |
639 pParty->pPlayers[i].SetCondInsaneWithBlockCheck(0); | |
0 | 640 } |
2062 | 641 } |
766 | 642 } |
643 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 644 pOutdoor->SetFog(); |
645 | |
646 for (uint i = 0; i < 4; ++i) | |
647 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
648 } | |
766 | 649 |
2062 | 650 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage |
0 | 651 { |
2062 | 652 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128; |
653 viewparams->bRedrawGameUI = true; | |
654 for ( uint pl = 1; pl <= 4; ++pl ) | |
0 | 655 { |
2062 | 656 if ( pPlayers[pl]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
657 || pPlayers[pl]->HasEnchantedItemEquipped(71) | |
658 || pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].uExpireTime > 0 ) | |
659 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); | |
0 | 660 else |
661 { | |
2062 | 662 if ( !pPlayers[pl]->HasUnderwaterSuitEquipped() ) |
0 | 663 { |
2062 | 664 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE); |
0 | 665 if ( pParty->uFlags & 4 ) |
666 { | |
2062 | 667 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);// Вы тонете! |
783 | 668 GameUI_Footer_TimeLeft = 128; |
0 | 669 } |
670 } | |
2062 | 671 else |
672 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); | |
0 | 673 } |
2062 | 674 } |
0 | 675 } |
2062 | 676 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) //lava damage |
0 | 677 { |
2062 | 678 viewparams->bRedrawGameUI = true; |
679 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128; | |
680 | |
681 for ( uint pl = 1; pl <= 4; pl++ ) | |
0 | 682 { |
2062 | 683 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE); |
0 | 684 if ( pParty->uFlags & 0x200 ) |
685 { | |
2062 | 686 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); //Вы горите! |
783 | 687 GameUI_Footer_TimeLeft = 128; |
0 | 688 } |
689 } | |
690 } | |
691 _493938_regenerate(); | |
2062 | 692 uint party_condition_flag = 4; |
816 | 693 a2a = pEventTimer->uTimeElapsed; |
2063 | 694 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING )//замедление восстановления при беге |
816 | 695 { |
696 a2a *= 0.5f; | |
697 if (a2a < 1) | |
0 | 698 a2a = 1; |
699 } | |
2062 | 700 |
701 for ( uint pl = 1; pl <= 4; pl++ ) | |
0 | 702 { |
2062 | 703 if ( pPlayers[pl]->uTimeToRecovery ) |
2063 | 704 pPlayers[pl]->Recover(a2a);//восстановление активности |
2062 | 705 if ( pPlayers[pl]->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + pPlayers[pl]->sHealth + pPlayers[pl]->uEndurance >= 1 |
706 || (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) | |
0 | 707 { |
2062 | 708 if ( pPlayers[pl]->sHealth < 1 ) |
709 pPlayers[pl]->SetCondition(Condition_Unconcious, 0); | |
0 | 710 } |
711 else | |
2062 | 712 pPlayers[pl]->SetCondition(Condition_Dead, 0); |
713 if ( pPlayers[pl]->field_E0 ) | |
0 | 714 { |
2062 | 715 v24 = pPlayers[pl]->field_E0 - pEventTimer->uTimeElapsed; |
0 | 716 if ( v24 > 0 ) |
2062 | 717 pPlayers[pl]->field_E0 = v24; |
0 | 718 else |
719 { | |
2062 | 720 pPlayers[pl]->field_E0 = 0; |
721 viewparams->bRedrawGameUI = true; | |
0 | 722 } |
723 } | |
2062 | 724 if ( pPlayers[pl]->field_E4 ) |
0 | 725 { |
2062 | 726 v26 = pPlayers[pl]->field_E4 - pEventTimer->uTimeElapsed; |
0 | 727 if ( v26 > 0 ) |
2062 | 728 pPlayers[pl]->field_E4 = v26; |
0 | 729 else |
730 { | |
2062 | 731 pPlayers[pl]->field_E4 = 0; |
732 viewparams->bRedrawGameUI = true; | |
0 | 733 } |
734 } | |
2062 | 735 if ( pPlayers[pl]->field_E8 ) |
0 | 736 { |
2062 | 737 v28 = pPlayers[pl]->field_E8 - pEventTimer->uTimeElapsed; |
0 | 738 if ( v28 > 0 ) |
2062 | 739 pPlayers[pl]->field_E8 = v28; |
0 | 740 else |
741 { | |
2062 | 742 pPlayers[pl]->field_E8 = 0; |
743 viewparams->bRedrawGameUI = true; | |
0 | 744 } |
745 } | |
2062 | 746 if ( pPlayers[pl]->field_EC ) |
0 | 747 { |
2062 | 748 v30 = pPlayers[pl]->field_EC - pEventTimer->uTimeElapsed; |
0 | 749 if ( v30 > 0 ) |
2062 | 750 pPlayers[pl]->field_EC = v30; |
0 | 751 else |
752 { | |
2062 | 753 pPlayers[pl]->field_EC = 0; |
754 viewparams->bRedrawGameUI = true; | |
755 } | |
756 } | |
757 if ( pPlayers[pl]->field_F0 ) | |
758 { | |
759 v32 = pPlayers[pl]->field_F0 - pEventTimer->uTimeElapsed; | |
760 if ( v32 > 0 ) | |
761 pPlayers[pl]->field_F0 = v32; | |
762 else | |
763 { | |
764 pPlayers[pl]->field_F0 = 0; | |
765 viewparams->bRedrawGameUI = true; | |
0 | 766 } |
767 } | |
2062 | 768 if ( pPlayers[pl]->field_F4 ) |
0 | 769 { |
2062 | 770 v34 = pPlayers[pl]->field_F4 - pEventTimer->uTimeElapsed; |
771 if ( v34 > 0 ) | |
772 pPlayers[pl]->field_F4 = v34; | |
0 | 773 else |
774 { | |
2062 | 775 pPlayers[pl]->field_F4 = 0; |
776 viewparams->bRedrawGameUI = true; | |
0 | 777 } |
778 } | |
2062 | 779 if ( pPlayers[pl]->field_F8 ) |
0 | 780 { |
2062 | 781 v36 = pPlayers[pl]->field_F8 - pEventTimer->uTimeElapsed; |
782 if ( v36 > 0 ) | |
783 pPlayers[pl]->field_F8 = v36; | |
0 | 784 else |
785 { | |
2062 | 786 pPlayers[pl]->field_F8 = 0; |
787 viewparams->bRedrawGameUI = true; | |
0 | 788 } |
789 } | |
2062 | 790 if ( pPlayers[pl]->field_FC ) |
0 | 791 { |
2062 | 792 v38 = pPlayers[pl]->field_FC - pEventTimer->uTimeElapsed; |
793 if ( v38 > 0 ) | |
794 pPlayers[pl]->field_FC = v38; | |
0 | 795 else |
796 { | |
2062 | 797 pPlayers[pl]->field_FC = 0; |
798 viewparams->bRedrawGameUI = true; | |
0 | 799 } |
800 } | |
2062 | 801 if ( pPlayers[pl]->field_100 ) |
0 | 802 { |
2062 | 803 v40 = pPlayers[pl]->field_100 - pEventTimer->uTimeElapsed; |
804 if ( v40 > 0 ) | |
805 pPlayers[pl]->field_100 = v40; | |
0 | 806 else |
807 { | |
2062 | 808 pPlayers[pl]->field_100 = 0; |
809 viewparams->bRedrawGameUI = true; | |
0 | 810 } |
811 } | |
2062 | 812 if ( pPlayers[pl]->field_104 ) |
0 | 813 { |
2062 | 814 v42 = pPlayers[pl]->field_104 - pEventTimer->uTimeElapsed; |
815 if ( v42 > 0 ) | |
816 pPlayers[pl]->field_104 = v42; | |
0 | 817 else |
818 { | |
2062 | 819 pPlayers[pl]->field_104 = 0; |
820 viewparams->bRedrawGameUI = true; | |
0 | 821 } |
822 } | |
2062 | 823 if ( pPlayers[pl]->pConditions[Condition_Sleep] | pPlayers[pl]->pConditions[Condition_Paralyzed] |
824 | pPlayers[pl]->pConditions[Condition_Unconcious] | pPlayers[pl]->pConditions[Condition_Dead] | |
825 | pPlayers[pl]->pConditions[Condition_Pertified] | pPlayers[pl]->pConditions[Condition_Eradicated] ) | |
826 --party_condition_flag; | |
827 v43 = (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0; //спешка | |
0 | 828 |
2062 | 829 for ( uint k = 0; k < 24; ++k ) |
830 pPlayers[pl]->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed); | |
0 | 831 |
2062 | 832 if ( v43 && (signed __int64)pPlayers[pl]->pPlayerBuffs[7].uExpireTime <= 0 ) |
833 pPlayers[pl]->SetCondition(Condition_Weak, 0); | |
0 | 834 } |
2062 | 835 |
1167 | 836 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; |
0 | 837 |
838 for (uint i = 0; i < 20; ++i) | |
839 { | |
1340 | 840 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1) |
2062 | 841 viewparams->bRedrawGameUI = true; |
0 | 842 } |
843 | |
1167 | 844 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) |
0 | 845 { |
846 for (uint i = 0; i < 4; ++i) | |
847 pParty->pPlayers[i].SetCondition(1, 0); | |
848 } | |
849 | |
2182 | 850 for (uint i = 0; i < 2; ++i)//Проверка в сознании ли перс сделавший закл на полёт и хождение по воде |
0 | 851 { |
2182 | 852 SpellBuff* pBuf = &pParty->pPartyBuffs[Party_Spec_Motion_status_ids[i]]; |
0 | 853 if (pBuf->uExpireTime == 0) |
854 continue; | |
855 | |
856 if ( !(pBuf->uFlags & 1) ) | |
857 { | |
858 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
859 { | |
860 pBuf->Reset(); | |
2182 | 861 if (Party_Spec_Motion_status_ids[i] == PARTY_BUFF_FLY ) |
0 | 862 pParty->bFlying = false; |
863 } | |
864 } | |
865 } | |
866 | |
2062 | 867 if ( !party_condition_flag ) |
0 | 868 { |
151 | 869 if ( pCurrentScreen != SCREEN_REST ) |
0 | 870 { |
2062 | 871 for ( uint pl = 1; pl <= 4; pl++ ) |
0 | 872 { |
2062 | 873 if ( pPlayers[pl]->pConditions[Condition_Sleep] ) |
874 { | |
875 pPlayers[pl]->pConditions[Condition_Sleep] = 0; | |
876 party_condition_flag = 1; | |
877 break; | |
878 } | |
879 } | |
2154 | 880 if ( !party_condition_flag || _5C35C0_force_party_death ) |
2062 | 881 uGameState = GAME_STATE_PARTY_DIED; |
882 } | |
883 } | |
884 | |
885 if ( uActiveCharacter )//выбор следующего после пропускающего ход | |
886 { | |
887 if ( pCurrentScreen != SCREEN_REST ) | |
888 { | |
889 if ( pPlayers[uActiveCharacter]->pConditions[Condition_Sleep] | |
890 || pPlayers[uActiveCharacter]->pConditions[Condition_Paralyzed] | |
891 || pPlayers[uActiveCharacter]->pConditions[Condition_Unconcious] | |
892 || pPlayers[uActiveCharacter]->pConditions[Condition_Dead] | |
893 || pPlayers[uActiveCharacter]->pConditions[Condition_Pertified] | |
894 || pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] ) | |
895 { | |
896 viewparams->bRedrawGameUI = true; | |
0 | 897 uActiveCharacter = pParty->GetNextActiveCharacter(); |
898 } | |
899 } | |
900 } | |
901 } | |
902 | |
903 //----- (00494820) -------------------------------------------------------- | |
758 | 904 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 905 { |
906 signed int v1; // eax@1 | |
907 | |
908 v1 = 5; | |
758 | 909 if ( a1 % 24 >= 5 ) |
0 | 910 v1 = 29; |
758 | 911 return v1 - a1 % 24; |
0 | 912 } |
913 | |
914 //----- (00494836) -------------------------------------------------------- | |
2184 | 915 int stru339_spell_sound::AddPartySpellSound(int uSoundID, int a6) |
0 | 916 { |
917 int v3; // esi@1 | |
918 int result; // eax@1 | |
2103 | 919 //stru339_spell_sound *v5; // ebx@1 |
2117 | 920 //int *v6; // edi@2 |
0 | 921 unsigned int v7; // eax@3 |
922 int v8; // [sp+Ch] [bp-8h]@3 | |
923 int v9; // [sp+10h] [bp-4h]@2 | |
924 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2103 | 925 //return 0; |
0 | 926 v3 = 0; |
927 result = word_4EE088_sound_ids[uSoundID]; | |
2103 | 928 //v5 = this; |
0 | 929 a2a = word_4EE088_sound_ids[uSoundID]; |
2103 | 930 if ( word_4EE088_sound_ids[uSoundID] ) |
0 | 931 { |
2117 | 932 //v6 = this->pSoundsOffsets; |
2103 | 933 for ( v9 = 0; v9 < 2; ++v9 ) |
0 | 934 { |
935 v7 = a2a++; | |
2103 | 936 result = pSoundList->LoadSound(v7, (char *)this + v3, 44744 - v3, &v8, a6); |
0 | 937 if ( !result ) |
938 break; | |
939 a6 += 4; | |
940 result = v8 + 256; | |
2103 | 941 this->pSoundsOffsets[v9] = v3; |
0 | 942 v3 += result; |
2103 | 943 this->pSoundsSizes[v9] = v8 + 256; |
2117 | 944 //++v6; |
0 | 945 } |
946 } | |
947 return result; | |
948 } | |
949 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
950 | |
951 //----- (00494AED) -------------------------------------------------------- | |
130 | 952 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 953 { |
2103 | 954 for ( uint i = 0; i < this->uNumFrames; i++ ) |
0 | 955 { |
2103 | 956 if ( this->pFrames[i].expression == expression ) |
957 return i; | |
0 | 958 } |
2103 | 959 return 0; |
0 | 960 } |
961 | |
962 //----- (00494B10) -------------------------------------------------------- | |
963 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
964 { | |
965 unsigned int v3; // esi@1 | |
966 __int16 v6; // dx@2 | |
967 int v7; // edx@3 | |
968 char *i; // eax@3 | |
969 int v9; // ecx@5 | |
970 PlayerFrame *result; // eax@6 | |
971 | |
972 v3 = uFramesetID; | |
2117 | 973 if ( this->pFrames[uFramesetID].uFlags & 1 && (v6 = this->pFrames[uFramesetID].uAnimLength) != 0 ) |
0 | 974 { |
975 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2117 | 976 for ( i = (char *)&this->pFrames[uFramesetID].uAnimTime; ; i += 10 ) |
0 | 977 { |
978 v9 = *(short *)i; | |
979 if ( v7 <= v9 ) | |
980 break; | |
981 v7 -= v9; | |
982 ++v3; | |
983 } | |
2117 | 984 result = &this->pFrames[v3]; |
0 | 985 } |
986 else | |
2117 | 987 result = &this->pFrames[uFramesetID]; |
0 | 988 return result; |
989 } | |
990 | |
991 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
992 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 993 { |
994 int v5; // esi@1 | |
995 int v6; // eax@2 | |
996 | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
997 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
998 if ( v5 < 8 * this->pFrames[*pFramesetID].uAnimTime ) |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
999 *pAnimTime = v5; |
0 | 1000 else |
1001 { | |
1002 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1003 *pFramesetID = v6; |
2117 | 1004 *pAnimTime = 8 * v5 % this->pFrames[v6].uAnimTime; |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1005 } |
2117 | 1006 return &this->pFrames[*pFramesetID]; |
0 | 1007 } |
1008 | |
1009 //----- (00494BC3) -------------------------------------------------------- | |
1010 void PlayerFrameTable::ToFile() | |
1011 { | |
1012 PlayerFrameTable *v1; // esi@1 | |
1013 FILE *v2; // eax@1 | |
1014 FILE *v3; // edi@1 | |
1015 | |
1980 | 1016 PlayerFrameTable* Str = this; |
0 | 1017 |
1018 v1 = Str; | |
1019 v2 = fopen("data\\dpft.bin", "wb"); | |
1020 v3 = v2; | |
1021 if ( !v2 ) | |
1545 | 1022 Error("Unable to save dpft.bin"); |
2117 | 1023 fwrite(v1, 4, 1, v2); |
0 | 1024 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); |
1025 fclose(v3); | |
1026 } | |
1027 | |
1028 //----- (00494C0F) -------------------------------------------------------- | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1029 void PlayerFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
0 | 1030 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1031 uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1032 num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1033 num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1034 uNumFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1035 assert(uNumFrames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1036 assert(!num_mm8_frames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1037 |
1583 | 1038 pFrames = (PlayerFrame *)malloc(uNumFrames * sizeof(PlayerFrame)); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1039 memcpy(pFrames, (char *)data_mm7 + 4, num_mm7_frames * sizeof(PlayerFrame)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1040 memcpy(pFrames + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(PlayerFrame)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1041 memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame)); |
0 | 1042 } |
1043 | |
1044 //----- (00494C5A) -------------------------------------------------------- | |
1045 int PlayerFrameTable::FromFileTxt(const char *Args) | |
1046 { | |
2117 | 1047 //PlayerFrameTable *v2; // ebx@1 |
0 | 1048 FILE *v3; // eax@1 |
1049 int v4; // esi@3 | |
1050 void *v5; // eax@10 | |
1051 FILE *v6; // ST0C_4@12 | |
1052 char *i; // eax@12 | |
1053 __int16 v8; // ax@15 | |
1054 const char *v9; // ST10_4@15 | |
1055 unsigned __int16 v10; // ax@15 | |
1056 const char *v11; // ST0C_4@15 | |
1057 int j; // esi@15 | |
1058 int v13; // eax@17 | |
1059 int v14; // edx@22 | |
1060 int v15; // ecx@23 | |
1061 int v16; // eax@24 | |
1062 signed int k; // eax@27 | |
2117 | 1063 //PlayerFrame *v18; // edx@28 |
0 | 1064 int v19; // esi@28 |
1065 int l; // ecx@29 | |
1066 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
1067 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
1068 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
1069 int v25; // [sp+2F8h] [bp-Ch]@3 | |
1070 int v26; // [sp+2FCh] [bp-8h]@3 | |
1071 FILE *File; // [sp+300h] [bp-4h]@1 | |
1072 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
1073 | |
2117 | 1074 __debugbreak();//Ritor1; |
0 | 1075 //TileTable::dtor((TileTable *)this); |
1076 v3 = fopen(Args, "r"); | |
1077 File = v3; | |
1078 if ( !v3 ) | |
1545 | 1079 Error("PlayerFrameTable::load - Unable to open file: %s.", Args); |
0 | 1080 v4 = 0; |
1081 v25 = 0; | |
1082 v26 = 1; | |
1083 if ( fgets(&Buf, 490, v3) ) | |
1084 { | |
1085 do | |
1086 { | |
1087 *strchr(&Buf, 10) = 0; | |
703 | 1088 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1089 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
1090 { | |
1091 if ( v24.uPropCount < 3 ) | |
1545 | 1092 Error("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
0 | 1093 ++v25; |
1094 } | |
1095 ++v26; | |
1096 } | |
1097 while ( fgets(&Buf, 490, File) ); | |
1098 v4 = v25; | |
1099 } | |
2117 | 1100 this->uNumFrames = v4; |
1583 | 1101 v5 = malloc(10 * v4); |
2117 | 1102 this->pFrames = (PlayerFrame *)v5; |
0 | 1103 if ( !v5 ) |
1545 | 1104 Error("PlayerFrameTable::load - Out of Memory!"); |
0 | 1105 v6 = File; |
2117 | 1106 this->uNumFrames = 0; |
0 | 1107 fseek(v6, 0, 0); |
1108 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
1109 { | |
1110 *strchr(&Buf, 10) = 0; | |
703 | 1111 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1112 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 1113 { |
2117 | 1114 //v8 = atoi(v24.pProperties[0]); |
1115 //v9 = v24.pProperties[1]; | |
1116 this->pFrames[this->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)atoi(v24.pProperties[0]); | |
1117 //v10 = atoi(v9); | |
1118 //v11 = v24.pProperties[2]; | |
1119 this->pFrames[this->uNumFrames].uTextureID = atoi(v24.pProperties[1]); | |
1120 this->pFrames[this->uNumFrames].uAnimTime = atoi(v24.pProperties[2]); | |
1121 this->pFrames[this->uNumFrames].uAnimLength = 0; | |
1122 this->pFrames[this->uNumFrames].uFlags = 0; | |
701 | 1123 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 1124 { |
1104 | 1125 if ( !_stricmp(v24.pProperties[j], "New") ) |
2117 | 1126 this->pFrames[this->uNumFrames].uFlags |= 4; |
0 | 1127 } |
2117 | 1128 ++this->uNumFrames; |
0 | 1129 } |
1130 } | |
1131 fclose(File); | |
2117 | 1132 |
1133 if ( (signed int)(this->uNumFrames - 1) > 0 ) | |
0 | 1134 { |
1135 v15 = 0; | |
2117 | 1136 for ( v14 = 0; v14 < this->uNumFrames - 1; ++v14 ) |
0 | 1137 { |
2117 | 1138 v16 = (int)&this->pFrames[v15]; |
0 | 1139 if ( !(*(char *)(v16 + 18) & 4) ) |
2117 | 1140 this->pFrames[v14].uFlags |= 1; |
0 | 1141 ++v15; |
1142 } | |
1143 } | |
2117 | 1144 for ( k = 0; k < (signed int)this->uNumFrames; *(short *)(Argsa + 6) = v19 ) |
0 | 1145 { |
2117 | 1146 //v18 = this->pFrames; |
1147 Argsa = (int)&this->pFrames[k]; | |
0 | 1148 v19 = *(short *)(Argsa + 4); |
2117 | 1149 if ( this->pFrames[k].uFlags & 1 ) |
0 | 1150 { |
1151 ++k; | |
2117 | 1152 for ( l = (int)&this->pFrames[k]; this->pFrames[k].uFlags & 1; l += 10 ) |
0 | 1153 { |
1154 v19 += *(short *)(l + 4); | |
1155 ++k; | |
1156 } | |
2117 | 1157 LOWORD(v19) = this->pFrames[k].uAnimTime + v19; |
0 | 1158 } |
1159 ++k; | |
1160 } | |
1161 return 1; | |
1162 } | |
1163 | |
1459 | 1164 |
0 | 1165 |
1166 //----- (00495430) -------------------------------------------------------- | |
1838 | 1167 const char * GetReputationString( signed int a1 ) |
607 | 1168 { |
566 | 1169 if (a1 >= 25) |
1170 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
1171 else if (a1 >= 6) | |
1172 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
1173 else if (a1 >= -5) | |
1174 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
1175 else if (a1 >= -24) | |
1176 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 1177 else |
566 | 1178 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 1179 } |
1180 | |
1181 //----- (00495461) -------------------------------------------------------- | |
1838 | 1182 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 1183 { |
1184 Player *pPlayer; // ebx@3 | |
1838 | 1185 const char *pText; // esi@7 |
0 | 1186 int v17; // eax@10 |
1187 signed __int64 v18; // qax@18 | |
1188 unsigned __int8 *v20; // ebx@32 | |
1189 int v21; // ecx@34 | |
1453 | 1190 int pReputation; // eax@45 |
0 | 1191 int v29; // eax@68 |
1192 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 1193 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
0 | 1194 char a1[100]; // [sp+B8h] [bp-80h]@3 |
1195 int v63; // [sp+12Ch] [bp-Ch]@32 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1196 |
1453 | 1197 if ( IsBadStringPtrA(lpsz, 1) ) |
0 | 1198 return "Invalid String Passed"; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1199 |
0 | 1200 a1[0] = 0; |
1453 | 1201 pPlayer = &pParty->pPlayers[uPlayerID]; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1202 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1203 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1204 NPCData *npc = nullptr; |
0 | 1205 if ( dword_5C35D4 ) |
1211 | 1206 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1207 else |
602 | 1208 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1209 |
1453 | 1210 //pText = a4; |
1980 | 1211 uint len = strlen(lpsz); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1212 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1213 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1214 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1215 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1216 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1217 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1218 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1219 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0'; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1220 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1221 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1222 { |
1453 | 1223 case 1://Подробнее |
1224 strcat(pTmpBuf2.data(), npc->pName); | |
1225 dst = strlen(pTmpBuf2.data()); | |
1226 i += 2; | |
1227 break; | |
1228 case 2: | |
1229 strcat(pTmpBuf2.data(), pPlayer->pName); | |
1230 dst = strlen(pTmpBuf2.data()); | |
1231 i += 2; | |
1232 break; | |
1233 case 3: | |
1234 case 4: | |
1235 strcat(pTmpBuf2.data(), a1); | |
1236 dst = strlen(pTmpBuf2.data()); | |
1237 i += 2; | |
1238 break; | |
1239 case 5: | |
1240 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; | |
1241 pText = pGlobalTXT_LocalizationStrings[397];// "evening" | |
1242 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
1243 { | |
1244 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 ) | |
0 | 1245 { |
1453 | 1246 if ( v18 < 20 ) |
1247 pText = pGlobalTXT_LocalizationStrings[396];// "day" | |
0 | 1248 } |
1249 else | |
1250 { | |
1453 | 1251 pText = pGlobalTXT_LocalizationStrings[395];// "morning" |
1252 } | |
1253 } | |
1254 strcat(pTmpBuf2.data(), pText); | |
1255 dst = strlen(pTmpBuf2.data()); | |
1256 i += 2; | |
1257 break; | |
1258 case 6: | |
1259 if ( pPlayer->uSex ) | |
1260 pText = pGlobalTXT_LocalizationStrings[387];// "lady" | |
1261 else | |
1262 pText = pGlobalTXT_LocalizationStrings[385];// "sir" | |
1263 strcat(pTmpBuf2.data(), pText); | |
1264 dst = strlen(pTmpBuf2.data()); | |
1265 i += 2; | |
1266 break; | |
1267 case 7: | |
1268 if ( pPlayer->uSex ) | |
1269 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
1270 else | |
1271 pText = pGlobalTXT_LocalizationStrings[386];// "Sir" | |
1272 strcat(pTmpBuf2.data(), pText); | |
1273 dst = strlen(pTmpBuf2.data()); | |
1274 i += 2; | |
1275 break; | |
1276 case 8: | |
1277 v63 = 0; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1453
diff
changeset
|
1278 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1279 for ( uint _i = 0; _i < 28; ++_i ) |
1453 | 1280 { |
1281 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) | |
1282 { | |
1283 v21 = v63; | |
1284 ++v63; | |
1285 v55[v63] = word_4EE150[i]; | |
1286 } | |
1287 } | |
1288 if ( v63 ) | |
1289 { | |
1290 if ( dword_A74CDC == -1 ) | |
1291 dword_A74CDC = rand() % v63; | |
1292 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; | |
1293 } | |
1294 else | |
1295 pText = (char *)pNPCTopics[55].pText; | |
1296 strcat(pTmpBuf2.data(), pText); | |
1297 dst = strlen(pTmpBuf2.data()); | |
1298 i += 2; | |
1299 break; | |
1300 case 9: | |
1301 if ( npc->uSex ) | |
1302 pText = pGlobalTXT_LocalizationStrings[384];// "her" | |
1303 else | |
1304 pText = pGlobalTXT_LocalizationStrings[383];// "his" | |
1305 strcat(pTmpBuf2.data(), pText); | |
1306 dst = strlen(pTmpBuf2.data()); | |
1307 i += 2; | |
1308 break; | |
1309 case 10: | |
1310 if ( pPlayer->uSex ) | |
1311 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
1312 else | |
1313 pText = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
1314 strcat(pTmpBuf2.data(), pText); | |
1315 dst = strlen(pTmpBuf2.data()); | |
1316 i += 2; | |
1317 break; | |
1318 case 11: | |
1827
0c75c3e7e436
cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents:
1826
diff
changeset
|
1319 pReputation = pParty->GetPartyReputation(); |
1453 | 1320 if ( pReputation >= 25 ) |
1321 pText = pGlobalTXT_LocalizationStrings[379]; | |
1322 else//v25 < 25 | |
1323 { | |
1324 if ( pReputation < 6 ) | |
1325 { | |
1326 if ( pReputation >= -5 )//6 >= v25 >= -5 | |
1327 pText = pGlobalTXT_LocalizationStrings[399]; | |
1328 else// v25 < -5 | |
0 | 1329 { |
1453 | 1330 if ( pReputation < -24 )//-24 > v25 |
1331 pText = pGlobalTXT_LocalizationStrings[434]; | |
1332 else// -5 > v25 > -24 | |
1333 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 1334 } |
1453 | 1335 } |
1336 else//25 > v25 > 6 | |
1337 pText = pGlobalTXT_LocalizationStrings[392]; | |
1338 } | |
1339 strcat(pTmpBuf2.data(), pText); | |
1340 dst = strlen(pTmpBuf2.data()); | |
1341 i += 2; | |
1342 break; | |
1343 case 12: | |
1344 pReputation = npc->rep; | |
1345 if ( pReputation >= 25 ) | |
1346 pText = pGlobalTXT_LocalizationStrings[379]; | |
1347 else | |
1348 { | |
1349 if ( pReputation < 6 ) | |
1350 { | |
1351 if ( pReputation >= -5 ) | |
1352 pText = pGlobalTXT_LocalizationStrings[399]; | |
0 | 1353 else |
1354 { | |
1453 | 1355 if ( pReputation < -24 ) |
1356 pText = pGlobalTXT_LocalizationStrings[434]; | |
1357 else | |
1358 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 1359 } |
1360 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1361 else |
1453 | 1362 pText = pGlobalTXT_LocalizationStrings[392]; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1363 } |
1453 | 1364 strcat(pTmpBuf2.data(), pText); |
1365 dst = strlen(pTmpBuf2.data()); | |
1366 i += 2; | |
1367 break; | |
1368 case 13: | |
2229
10c909eb6766
dword_AE336C to NPCStats::dword_AE336C_LastMispronouncedNameFirstLetter,
Grumpy7
parents:
2215
diff
changeset
|
1369 strcat(pTmpBuf2.data(), pNPCStats->sub_495366_MispronounceName(pPlayer->pName[0], pPlayer->uSex)); |
1453 | 1370 dst = strlen(pTmpBuf2.data()); |
1371 i += 2; | |
1372 break; | |
1373 case 14: | |
1374 if ( npc->uSex ) | |
1375 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
1376 else | |
1377 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
1378 strcat(pTmpBuf2.data(), pText); | |
1379 dst = strlen(pTmpBuf2.data()); | |
1380 i += 2; | |
1381 break; | |
1382 case 15: | |
1383 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" | |
1384 dst = strlen(pTmpBuf2.data()); | |
1385 i += 2; | |
1386 break; | |
1387 case 16: | |
1388 if ( npc->uSex ) | |
1389 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
1390 else | |
1391 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
1392 strcat(pTmpBuf2.data(), pText); | |
1393 dst = strlen(pTmpBuf2.data()); | |
1394 i += 2; | |
1395 break; | |
1396 case 17://текст наёмного НПС | |
1397 { | |
2115 | 1398 uint pay_percentage = pNPCStats->pProfessions[npc->uProfession].uHirePrice / 100; |
1453 | 1399 if ( !pay_percentage ) |
1400 pay_percentage = 1; | |
1401 sprintf(a1, "%lu", pay_percentage); | |
1402 strcat(pTmpBuf2.data(), a1); | |
1403 dst = strlen(pTmpBuf2.data()); | |
1404 i += 2; | |
1405 break; | |
1406 } | |
1407 case 18: | |
1408 case 19: | |
1409 case 20: | |
1410 case 21: | |
1411 case 22: | |
1412 case 26: | |
1413 strncpy(a1, lpsz + i + 1, 2); | |
1414 sprintf(a1, "%lu", atoi(a1)); | |
1415 strcat(pTmpBuf2.data(), a1); | |
1416 dst = strlen(pTmpBuf2.data()); | |
1417 i += 2; | |
1418 break; | |
1419 case 23: | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1420 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1421 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName; |
1453 | 1422 else |
1423 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" | |
1424 strcat(pTmpBuf2.data(), pText); | |
1425 dst = strlen(pTmpBuf2.data()); | |
1426 i += 2; | |
1427 break; | |
1428 case 24://название товара в продаже | |
2069 | 1429 sprintfex(a1, format_4E2D80, Color16(255, 255, 155), a3->GetDisplayName()); |
1453 | 1430 strcat(pTmpBuf2.data(), a1); |
1431 dst = strlen(pTmpBuf2.data()); | |
1432 i += 2; | |
1433 break; | |
1434 case 25: | |
1435 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
0 | 1436 switch ( a5 ) |
1453 | 1437 { |
1438 case 3: | |
1439 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1440 break; | |
1441 case 4: | |
1442 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1443 break; | |
1444 case 5: | |
1445 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1446 break; | |
1447 case 6: | |
1448 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
1449 break; | |
1450 } | |
1451 sprintfex(a1, "%lu", v29); | |
1452 strcat(pTmpBuf2.data(), a1); | |
1453 dst = strlen(pTmpBuf2.data()); | |
1454 i += 2; | |
1455 break; | |
1456 case 27://текст продажи | |
1457 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1458 if ( a5 == 3 ) | |
1459 { | |
1460 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1546
diff
changeset
|
1461 if (a3->IsBroken()) |
1453 | 1462 v29 = 1; |
1463 sprintfex(a1, "%lu", v29); | |
1464 strcat(pTmpBuf2.data(), a1); | |
1465 dst = strlen(pTmpBuf2.data()); | |
1466 i += 2; | |
0 | 1467 break; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1468 } |
1453 | 1469 if ( a5 != 4 ) |
0 | 1470 { |
1453 | 1471 if ( a5 == 5 ) |
1472 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1473 else | |
1474 { | |
1475 if ( a5 == 6 ) | |
1476 { | |
1477 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1546
diff
changeset
|
1478 if (a3->IsBroken()) |
1453 | 1479 v29 = 1; |
1480 if (!v29) | |
1481 v29 = 1; | |
1482 sprintfex(a1, "%lu", v29); | |
1483 strcat(pTmpBuf2.data(), a1); | |
1484 dst = strlen(pTmpBuf2.data()); | |
1485 i += 2; | |
1486 break; | |
1487 } | |
1488 } | |
1489 sprintfex(a1, "%lu", v29); | |
1490 strcat(pTmpBuf2.data(), a1); | |
1491 dst = strlen(pTmpBuf2.data()); | |
1492 i += 2; | |
1493 break; | |
0 | 1494 } |
1453 | 1495 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
1496 strcat(pTmpBuf2.data(), a1); | |
1497 dst = strlen(pTmpBuf2.data()); | |
1498 i += 2; | |
1499 break; | |
1500 case 28://профессия | |
1501 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); | |
1502 dst = strlen(pTmpBuf2.data()); | |
1503 i += 2; | |
1504 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1505 case 29: |
1453 | 1506 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
1507 strcat(pTmpBuf2.data(), a1); | |
1508 dst = strlen(pTmpBuf2.data()); | |
1509 i += 2; | |
1510 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1511 case 30: |
1453 | 1512 if ( !a6 ) |
1513 { | |
1514 strcat(pTmpBuf2.data(), a4); | |
1515 dst = strlen(pTmpBuf2.data()); | |
1516 i += 2; | |
1517 break; | |
1518 } | |
1459 | 1519 init_summoned_item(&v56, *a6); |
1453 | 1520 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
1521 strcat(pTmpBuf2.data(), a1); | |
1522 dst = strlen(pTmpBuf2.data()); | |
1523 i += 2; | |
1524 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1525 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1526 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1527 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1528 case 34: |
1453 | 1529 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); |
1530 dst = strlen(pTmpBuf2.data()); | |
1531 i += 2; | |
1532 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1533 default: |
0 | 1534 if ( v17 <= 50 || v17 > 70 ) |
1453 | 1535 { |
1536 strncpy(a1, lpsz + i + 1, 2); | |
1537 sprintf(a1, "%lu", atoi(a1)); | |
1538 strcat(pTmpBuf2.data(), a1); | |
1539 dst = strlen(pTmpBuf2.data()); | |
1540 i += 2; | |
1541 break; | |
1542 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1543 if ( v17 - 51 >= 20 ) |
1453 | 1544 { |
1545 strcat(pTmpBuf2.data(), a4); | |
1546 dst = strlen(pTmpBuf2.data()); | |
1547 i += 2; | |
1548 break; | |
1549 } | |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1709
diff
changeset
|
1550 init_summoned_item(&v56, pParty->PartyTimes._s_times[v17-51]); |
1453 | 1551 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
1552 strcat(pTmpBuf2.data(), a1); | |
1553 dst = strlen(pTmpBuf2.data()); | |
1554 i += 2; | |
1555 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1556 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1557 } |
0 | 1558 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1559 return pTmpBuf2.data(); |
0 | 1560 } |
1561 | |
1562 //----- (0049B04D) -------------------------------------------------------- | |
734 | 1563 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 1564 { |
734 | 1565 //stru154 *v3; // edi@1 |
1566 //signed int v4; // eax@1 | |
1567 //signed int result; // eax@9 | |
1568 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 1569 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 1570 float v7; |
0 | 1571 |
1572 v.x = 0.0; | |
1573 v.y = 0.0; | |
1574 v.z = 0.0; | |
734 | 1575 GetFacePlane(a2, a3, &v, &v7); |
1576 | |
1577 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
1578 polygonType = POLYGON_VerticalWall; | |
1579 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
1580 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
1581 polygonType = POLYGON_Floor; | |
0 | 1582 else |
734 | 1583 polygonType = POLYGON_InBetweenFloorAndWall; |
1584 | |
1585 face_plane.vNormal.x = v.x; | |
1586 face_plane.vNormal.y = v.y; | |
1587 face_plane.vNormal.z = v.z; | |
1588 face_plane.dist = v7; | |
0 | 1589 } |
1590 | |
1591 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 1592 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 1593 { |
734 | 1594 if (fabsf(pNormal->z) < 1e-6f) |
1595 polygonType = POLYGON_VerticalWall; | |
1596 else if (fabsf(pNormal->x) < 1e-6f && | |
1597 fabsf(pNormal->y) < 1e-6f) | |
1598 polygonType = POLYGON_Floor; | |
0 | 1599 else |
734 | 1600 polygonType = POLYGON_InBetweenFloorAndWall; |
1601 | |
1602 face_plane.vNormal.x = pNormal->x; | |
1603 face_plane.dist = dist; | |
1604 face_plane.vNormal.y = pNormal->y; | |
1605 face_plane.vNormal.z = pNormal->z; | |
0 | 1606 } |
1607 | |
1608 //----- (0049B13D) -------------------------------------------------------- | |
734 | 1609 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 1610 { |
1611 Vec3_float_ *v19; // eax@3 | |
1612 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 | |
1613 float v26; // [sp+1Ch] [bp-4Ch]@3 | |
1614 float v27; // [sp+20h] [bp-48h]@3 | |
1615 float v28; // [sp+24h] [bp-44h]@3 | |
1616 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 | |
1617 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 | |
734 | 1618 |
0 | 1619 v1.x = 0.0; |
1620 v1.y = 0.0; | |
1621 v1.z = 0.0; | |
734 | 1622 |
1623 if (pFace->uNumVertices >= 2) | |
1624 { | |
2103 | 1625 for ( int i = 0; i < pFace->uNumVertices - 2; i++ ) |
734 | 1626 { |
2103 | 1627 v1.x = pVertices->pVertices[pFace->pVertexIDs[i + 1]].x - pVertices->pVertices[pFace->pVertexIDs[i]].x; |
1628 v1.y = pVertices->pVertices[pFace->pVertexIDs[i + 1]].y - pVertices->pVertices[pFace->pVertexIDs[i]].y; | |
1629 v1.z = pVertices->pVertices[pFace->pVertexIDs[i + 1]].z - pVertices->pVertices[pFace->pVertexIDs[i]].z; | |
1630 | |
1631 v26 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].x - pVertices->pVertices[pFace->pVertexIDs[i + 1]].x; | |
1632 v27 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].y - pVertices->pVertices[pFace->pVertexIDs[i + 1]].y; | |
1633 v28 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].z - pVertices->pVertices[pFace->pVertexIDs[i + 1]].z; | |
1634 | |
0 | 1635 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
1636 v38.x = v19->x; | |
1637 v38.y = v19->y; | |
1638 v38.z = v19->z; | |
734 | 1639 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
1640 { | |
1641 v38.Normalize(); | |
1642 | |
1643 pOutNormal->x = v38.x; | |
1644 pOutNormal->y = v38.y; | |
1645 pOutNormal->z = v38.z; | |
1646 | |
2103 | 1647 *pOutDist = -(pVertices->pVertices[pFace->pVertexIDs[i]].x * v38.x |
1648 + pVertices->pVertices[pFace->pVertexIDs[i]].y * v38.y | |
1649 + pVertices->pVertices[pFace->pVertexIDs[i]].z * v38.z); | |
734 | 1650 return; |
1651 } | |
1652 } | |
1653 } | |
1654 | |
2103 | 1655 pOutNormal->x = (double)(pFace->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.x >> 16); |
1656 pOutNormal->y = (double)(pFace->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.y >> 16); | |
1657 pOutNormal->z = (double)(pFace->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.z >> 16); | |
1658 *pOutDist = (double)(pFace->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.dist >> 16); | |
0 | 1659 } |
1660 | |
1661 //----- (0049D700) -------------------------------------------------------- | |
1662 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
1663 { | |
1664 int v2; // ecx@1 | |
1665 unsigned int v3; // eax@1 | |
1666 | |
1667 v2 = 0; | |
2103 | 1668 v3 = uDim - 1; |
0 | 1669 while ( v3 & 1 ) |
1670 { | |
1671 v3 >>= 1; | |
1672 ++v2; | |
1673 } | |
1674 return v3 == 0 ? v2 : 0; | |
1675 } | |
1676 | |
1677 //----- (004B1447) -------------------------------------------------------- | |
2246 | 1678 void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd) |
0 | 1679 { |
1680 signed int v3; // esi@1 | |
1681 DDM_DLV_Header *v7; // eax@14 | |
1682 | |
2246 | 1683 if ( stealingResult == 0 || stealingResult == 1) |
0 | 1684 { |
2246 | 1685 if ( pParty->uFine < 4000000 ) |
1686 { | |
1687 if ( fineToAdd + pParty->uFine < 0 ) | |
1688 pParty->uFine = 0; | |
1689 else if ( fineToAdd + pParty->uFine > 4000000 ) | |
1690 pParty->uFine = 4000000; | |
1691 else | |
1692 pParty->uFine += fineToAdd; | |
1693 } | |
1694 if ( pParty->uFine ) | |
1695 { | |
1696 for ( uint i = 1; i <= 4; ++i ) | |
1697 { | |
1698 if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) ) | |
1699 _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); | |
1700 } | |
1701 } | |
1702 if (stealingResult == 1) | |
1754 | 1703 v3 = 2; |
2246 | 1704 else |
1705 v3 = 1; | |
0 | 1706 } |
1707 else | |
2246 | 1708 v3 = 2; |
1709 pParty->PartyTimes._shop_ban_times[shopId] = pParty->uTimePlayed + 368640; | |
1710 pParty->InTheShopFlags[shopId] = 1; | |
1711 v7 = &pOutdoor->ddm; | |
1712 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
1713 v7 = &pIndoor->dlv; | |
1714 v7->uReputation += v3; | |
1715 if ( v7->uReputation > 10000 ) | |
1716 v7->uReputation = 10000; | |
0 | 1717 } |
1718 | |
1719 | |
1720 //----- (004B1ECE) -------------------------------------------------------- | |
1459 | 1721 void OracleDialogue() |
0 | 1722 { |
1723 __int16 *v0; // edi@1 | |
1724 int v1; // ebx@3 | |
1725 Player *v2; // esi@3 | |
1726 int v3; // eax@4 | |
1727 signed int v4; // eax@9 | |
1728 int v5; // ebx@11 | |
89 | 1729 Player *v6; // esi@13 |
1730 ItemGen *v7; // eax@14 | |
0 | 1731 signed int v8; // edi@14 |
89 | 1732 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 1733 signed int v10; // [sp+10h] [bp-8h]@13 |
1734 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 1735 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 1736 |
484 | 1737 contract_approved = 0; |
0 | 1738 v11 = 0; |
1739 uDialogueType = 84; | |
827 | 1740 current_npc_text = (char *)pNPCTopics[667].pText; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1741 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); |
2102 | 1742 //while ( 1 ) |
1743 for ( uint i = 0; i <= 53; i++ ) | |
0 | 1744 { |
484 | 1745 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 1746 { |
2102 | 1747 //v1 = 0; |
1748 //v2 = pParty->pPlayers.data(); | |
1749 for ( uint pl = 0; pl < 4; pl++ ) | |
0 | 1750 { |
2102 | 1751 //LOBYTE(v3) = pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
1752 if ( pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)) ) | |
0 | 1753 break; |
2102 | 1754 //++v2; |
1755 //++v1; | |
0 | 1756 } |
2102 | 1757 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); |
1758 //if ( v1 == 4 ) | |
1759 //break; | |
0 | 1760 } |
1761 ++v11; | |
2102 | 1762 //v0 += 2; |
1763 //if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
1764 //break; | |
89 | 1765 } |
1766 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
1767 { | |
827 | 1768 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 1769 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 1770 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 1771 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
1772 } | |
484 | 1773 if ( contract_approved == 601 ) |
0 | 1774 { |
1775 v5 = 0; | |
2102 | 1776 //v12 = pParty->pPlayers.data();//[0].uClass; |
0 | 1777 v9 = 0; |
2102 | 1778 //while ( 1 ) |
1779 for ( uint i = 0; i < 4; i++ ) | |
0 | 1780 { |
2102 | 1781 if ( pParty->pPlayers[i].classType == PLAYER_CLASS_LICH ) |
0 | 1782 { |
1783 v10 = 0; | |
2102 | 1784 //v6 = pParty->pPlayers.data();//[0].pInventoryItems[0].field_1A; |
1785 for ( uint pl = 0; pl < 4; pl++ ) | |
0 | 1786 { |
2102 | 1787 for ( v8 = 0; v8 < 126; v8++ )//138 |
0 | 1788 { |
2102 | 1789 if ( pParty->pPlayers[pl].pInventoryItemList[v8].uItemID == ITEM_LICH_JAR_FULL ) |
0 | 1790 { |
2102 | 1791 if ( !pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer ) |
1792 v9 = &pParty->pPlayers[pl].pInventoryItemList[v8]; | |
1793 if ( pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer == v5 ) | |
0 | 1794 v10 = 1; |
1795 } | |
1796 } | |
89 | 1797 } |
0 | 1798 if ( !v10 ) |
1799 break; | |
1800 } | |
2102 | 1801 // ++v12; |
0 | 1802 ++v5; |
2102 | 1803 // if ( v12 > &pParty->pPlayers[3] ) |
1804 // return; | |
0 | 1805 } |
1806 if ( v9 ) | |
377 | 1807 v9->uHolderPlayer = v5; |
0 | 1808 } |
1809 } | |
1810 | |
1811 //----- (004B254D) -------------------------------------------------------- | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1812 const char * _4B254D_SkillMasteryTeacher(int trainerInfo) |
0 | 1813 { |
2238 | 1814 int teacherLevel; // edx@1 |
1815 int skillBeingTaught; // ecx@1 | |
955 | 1816 int pClassType; // eax@7 |
2238 | 1817 int currClassMaxMastery; // eax@7 |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1818 int pointsInSkillWOutMastery; // ebx@7 |
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1819 int classBaseId; // eax@8 |
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1820 unsigned int skillMastery; // eax@29 |
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1821 unsigned __int16 pointsInSkill; // [sp+1Ch] [bp-10h]@7 |
2238 | 1822 int masteryLevelBeingTaught; // [sp+24h] [bp-8h]@7 |
0 | 1823 |
484 | 1824 contract_approved = 0; |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1825 teacherLevel = (trainerInfo - 200) % 3; |
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1826 skillBeingTaught = (trainerInfo - 200) / 3; |
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1827 Player* activePlayer = pPlayers[uActiveCharacter]; |
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1828 pClassType = activePlayer->classType; |
2238 | 1829 currClassMaxMastery = byte_4ED970_skill_learn_ability_by_class_table[pClassType][skillBeingTaught]; |
1830 masteryLevelBeingTaught = teacherLevel + 2; | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1831 dword_F8B1B0_MasteryBeingTaught = masteryLevelBeingTaught; |
2238 | 1832 if ( currClassMaxMastery < masteryLevelBeingTaught ) |
0 | 1833 { |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1834 classBaseId = pClassType - pClassType % 4; |
2238 | 1835 if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 1][skillBeingTaught] >= masteryLevelBeingTaught) |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1836 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 1]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level. |
2238 | 1837 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught |
1838 && byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught) | |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1839 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[classBaseId + 2], pClassNames[classBaseId + 3]);//Вы должны достичь звания %s или %s для обучения этому уровню навыка. You have to be promoted to %s or %s to learn this skill level. |
2238 | 1840 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught) |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1841 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 2]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level. |
2238 | 1842 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught) |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1843 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 3]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level. |
0 | 1844 else |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1845 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Этот уровень навыка не может быть постигнут классом %s. This skill level can not be learned by the %s class. |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1846 return pTmpBuf.data(); |
0 | 1847 } |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1848 if ( !activePlayer->CanAct() ) |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1849 return pNPCTopics[122].pText; //Not in your condition! |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1850 pointsInSkill = activePlayer->pActiveSkills[skillBeingTaught]; |
2237
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1851 pointsInSkillWOutMastery = pointsInSkill & 0x3F; |
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1852 if ( !pointsInSkillWOutMastery ) |
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1853 return pNPCTopics[131].pText; //You must know the skill before you can become an expert in it! |
d903816e972e
_4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents:
2236
diff
changeset
|
1854 skillMastery = SkillToMastery(pointsInSkill); |
2238 | 1855 if ( (signed int)skillMastery > teacherLevel + 1 ) |
1856 return pNPCTopics[teacherLevel + 128].pText; // You are already an SKILLLEVEL in this skill. | |
1857 dword_F8B1AC_award_bit_number = skillBeingTaught; | |
1858 if ( masteryLevelBeingTaught == 2 && pointsInSkillWOutMastery < 4 | |
1859 || masteryLevelBeingTaught == 3 && pointsInSkillWOutMastery < 7 | |
1860 || masteryLevelBeingTaught == 4 && pointsInSkillWOutMastery < 10 | |
1861 ) | |
1862 return pNPCTopics[127].pText; //"You don't meet the requirements, and cannot be taught until you do." | |
1863 switch (dword_F8B1AC_award_bit_number) | |
0 | 1864 { |
2238 | 1865 case PLAYER_SKILL_STAFF: |
1866 case PLAYER_SKILL_SWORD: | |
1867 case PLAYER_SKILL_DAGGER: | |
1868 case PLAYER_SKILL_AXE: | |
1869 case PLAYER_SKILL_SPEAR: | |
1870 case PLAYER_SKILL_BOW: | |
1871 case PLAYER_SKILL_MACE: | |
2240
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1872 case PLAYER_SKILL_ARMSMASTER: |
2238 | 1873 switch (masteryLevelBeingTaught) |
1874 { | |
1875 case 2: | |
1876 gold_transaction_amount = 2000; | |
1877 break; | |
1878 case 3: | |
1879 gold_transaction_amount = 5000; | |
1880 break; | |
1881 case 4: | |
1882 gold_transaction_amount = 8000; | |
1883 break; | |
1884 } | |
1885 break; | |
1886 case PLAYER_SKILL_BLASTER: | |
1887 switch (masteryLevelBeingTaught) | |
1888 { | |
1889 case 2: | |
1890 gold_transaction_amount = 0; | |
1891 break; | |
1892 case 3: | |
1893 gold_transaction_amount = 0; | |
1894 break; | |
1895 case 4: | |
1896 gold_transaction_amount = 0; | |
1897 break; | |
1898 } | |
1899 break; | |
1900 case PLAYER_SKILL_SHIELD: | |
1901 case PLAYER_SKILL_LEATHER: | |
1902 case PLAYER_SKILL_CHAIN: | |
1903 case PLAYER_SKILL_PLATE: | |
1904 switch (masteryLevelBeingTaught) | |
1905 { | |
1906 case 2: | |
1907 gold_transaction_amount = 1000; | |
1908 break; | |
1909 case 3: | |
1910 gold_transaction_amount = 3000; | |
1911 break; | |
1912 case 4: | |
1913 gold_transaction_amount = 7000; | |
1914 break; | |
1915 } | |
1916 break; | |
1917 case PLAYER_SKILL_FIRE: | |
1918 case PLAYER_SKILL_AIR: | |
1919 case PLAYER_SKILL_WATER: | |
1920 case PLAYER_SKILL_EARTH: | |
1921 case PLAYER_SKILL_SPIRIT: | |
1922 case PLAYER_SKILL_MIND: | |
1923 case PLAYER_SKILL_BODY: | |
1924 switch (masteryLevelBeingTaught) | |
0 | 1925 { |
2238 | 1926 case 2: |
1927 gold_transaction_amount = 1000; | |
1928 break; | |
1929 case 3: | |
1930 gold_transaction_amount = 4000; | |
1931 break; | |
1932 case 4: | |
1933 gold_transaction_amount = 8000; | |
1934 break; | |
1935 } | |
1936 break; | |
1937 case PLAYER_SKILL_LIGHT: | |
1938 switch (masteryLevelBeingTaught) | |
1939 { | |
1940 case 2: | |
1941 gold_transaction_amount = 2000; | |
1942 break; | |
1943 case 3: | |
1944 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 114) ) | |
1945 return pNPCTopics[127].pText; | |
1946 gold_transaction_amount = 5000; | |
1947 break; | |
1948 case 4: | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1949 if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x22u, 1) || |
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1950 !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Au, 1)) |
2238 | 1951 return pNPCTopics[127].pText; |
1952 gold_transaction_amount = 8000; | |
1953 break; | |
1954 } | |
1955 break; | |
1956 case PLAYER_SKILL_DARK: | |
1957 switch (masteryLevelBeingTaught) | |
1958 { | |
1959 case 2: | |
1960 gold_transaction_amount = 2000; | |
1961 break; | |
1962 case 3: | |
1963 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 110) ) | |
1964 return pNPCTopics[127].pText; | |
1965 gold_transaction_amount = 5000; | |
1966 break; | |
1967 case 4: | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1968 if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x23u, 1) |
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
1969 || !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Bu, 1)) |
2238 | 1970 return pNPCTopics[127].pText; |
1971 gold_transaction_amount = 8000; | |
1972 break; | |
1973 } | |
1974 break; | |
1975 case PLAYER_SKILL_ITEM_ID: | |
2240
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1976 case PLAYER_SKILL_REPAIR: |
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1977 case PLAYER_SKILL_MEDITATION: |
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1978 case PLAYER_SKILL_PERCEPTION: |
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1979 case PLAYER_SKILL_TRAP_DISARM: |
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1980 case PLAYER_SKILL_MONSTER_ID: |
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1981 case PLAYER_SKILL_STEALING: |
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
1982 case PLAYER_SKILL_ALCHEMY: |
2238 | 1983 switch (masteryLevelBeingTaught) |
1984 { | |
1985 case 2: | |
1986 gold_transaction_amount = 500; | |
1987 break; | |
1988 case 3: | |
1989 gold_transaction_amount = 2500; | |
1990 break; | |
1991 case 4: | |
1992 gold_transaction_amount = 6000; | |
1993 break; | |
1994 } | |
1995 break; | |
1996 case PLAYER_SKILL_MERCHANT: | |
1997 switch (masteryLevelBeingTaught) | |
1998 { | |
1999 case 2: | |
2000 gold_transaction_amount = 2000; | |
2001 break; | |
2002 case 3: | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
2003 if ( activePlayer->GetBaseWillpower() < 50 ) |
2238 | 2004 return pNPCTopics[127].pText; |
2005 gold_transaction_amount = 5000; | |
2006 break; | |
2007 case 4: | |
2008 gold_transaction_amount = 8000; | |
2009 break; | |
2010 } | |
2011 break; | |
2012 case PLAYER_SKILL_BODYBUILDING: | |
2013 switch (masteryLevelBeingTaught) | |
2014 { | |
2015 case 2: | |
2016 gold_transaction_amount = 500; | |
2017 break; | |
2018 case 3: | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
2019 if ( activePlayer->GetBaseEndurance() < 50 ) |
2238 | 2020 return pNPCTopics[127].pText; |
2021 gold_transaction_amount = 2500; | |
2022 break; | |
2023 case 4: | |
2024 gold_transaction_amount = 6000; | |
2025 break; | |
2026 } | |
2027 break; | |
2028 case PLAYER_SKILL_DIPLOMACY: | |
2029 Error("Diplomacy not used"); | |
2030 break; | |
2031 case PLAYER_SKILL_TIEVERY: | |
2032 Error("Thievery not used"); | |
2033 break; | |
2034 case PLAYER_SKILL_DODGE: | |
2035 switch (masteryLevelBeingTaught) | |
2036 { | |
2037 case 2: | |
2038 gold_transaction_amount = 2000; | |
2039 break; | |
2040 case 3: | |
2041 gold_transaction_amount = 5000; | |
2042 break; | |
2043 case 4: | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
2044 if ( (activePlayer->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA ) |
2238 | 2045 return pNPCTopics[127].pText; |
2046 gold_transaction_amount = 8000; | |
2047 break; | |
2048 } | |
2049 break; | |
2050 case PLAYER_SKILL_UNARMED: | |
2051 switch (masteryLevelBeingTaught) | |
2052 { | |
2053 case 2: | |
2054 gold_transaction_amount = 2000; | |
2055 break; | |
2056 case 3: | |
2057 gold_transaction_amount = 5000; | |
2058 break; | |
2059 case 4: | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
2060 if ( (activePlayer->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA ) |
2238 | 2061 return pNPCTopics[127].pText; |
2062 gold_transaction_amount = 8000; | |
2063 break; | |
2064 } | |
2065 break; | |
2066 case PLAYER_SKILL_LEARNING: | |
2067 switch (masteryLevelBeingTaught) | |
2068 { | |
2069 case 2: | |
2070 gold_transaction_amount = 2000; | |
2071 break; | |
2072 case 3: | |
2239
699bd6ee5ad0
dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents:
2238
diff
changeset
|
2073 if ( activePlayer->GetBaseIntelligence() < 50 ) |
2238 | 2074 return pNPCTopics[127].pText; |
2075 gold_transaction_amount = 5000; | |
2076 break; | |
2077 case 4: | |
2078 gold_transaction_amount = 8000; | |
2079 break; | |
2080 } | |
2081 break; | |
2082 default: | |
2083 Error("Unknown skill"); | |
955 | 2084 } |
267 | 2085 if ( gold_transaction_amount > pParty->uNumGold ) |
2238 | 2086 return pNPCTopics[124].pText; //You don't have enough gold! |
484 | 2087 contract_approved = 1; |
2238 | 2088 if ( masteryLevelBeingTaught == 2 ) |
0 | 2089 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2090 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Получить степень ^Pr[%s] в навыке ^Pr[%s] за ^I[%lu] золот^L[ой;ых;ых] |
955 | 2091 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Эксперт |
0 | 2092 } |
2249 | 2093 else if ( masteryLevelBeingTaught == 3 ) |
0 | 2094 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2095 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 2096 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Мастер |
0 | 2097 } |
2249 | 2098 else if ( masteryLevelBeingTaught == 4 ) |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2099 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 2100 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Великий Магистр |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2101 return pTmpBuf2.data(); |
0 | 2102 } |
2103 | |
2104 //----- (004B3E1E) -------------------------------------------------------- | |
1458 | 2105 void sub_4B3E1E() |
0 | 2106 { |
2107 NPCData *v0; // ST40_4@1 | |
2108 signed int v1; // edi@1 | |
165 | 2109 //GUIWindow *v2; // ecx@1 |
0 | 2110 |
167 | 2111 __debugbreak(); |
602 | 2112 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 2113 v1 = 0; |
2114 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
2115 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2197
diff
changeset
|
2116 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 1, 0); |
291 | 2117 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 2118 { |
832 | 2119 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 2120 v1 = 1; |
2121 } | |
832 | 2122 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять |
972 | 2123 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 2124 } |
2125 | |
2126 | |
2127 //----- (004B3FE5) -------------------------------------------------------- | |
2246 | 2128 //Originally called _4B254D_SkillMasteryTeacher to have contract_approved assigned, to be able to set some button name. |
2129 //But it the name gets immediately overwritten | |
2240
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
2130 void _4B3FE5_training_dialogue(int a4) |
0 | 2131 { |
1838 | 2132 const char *v2; // edi@1 |
2102 | 2133 |
2245 | 2134 //__debugbreak(); |
2240
1fc4223bddf6
dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents:
2239
diff
changeset
|
2135 uDialogueType = DIALOGUE_SKILL_TRAINER; |
827 | 2136 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
2241 | 2137 _4B254D_SkillMasteryTeacher(a4); //might be needed because of contract_approved ? |
0 | 2138 pDialogueWindow->Release(); |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2197
diff
changeset
|
2139 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, a4, 0); |
2102 | 2140 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, |
948 | 2141 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 2142 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
2102 | 2143 v2 = ""; |
484 | 2144 if ( contract_approved ) |
0 | 2145 v2 = pGlobalTXT_LocalizationStrings[535]; |
2245 | 2146 pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 2147 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 2148 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 2149 } |
2150 // F8B19C: using guessed type int dword_F8B19C; | |
2151 // F8B1A8: using guessed type int dword_F8B1A8; | |
2152 | |
2153 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 2154 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
1411 | 2155 { |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
2156 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
2102 | 2157 pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, Str) + 11, 357, a5, Str, 0, 0, 0); |
0 | 2158 } |
2159 | |
2160 //----- (004B46F8) -------------------------------------------------------- | |
1459 | 2161 __int64 GetExperienceRequiredForLevel(int level) |
0 | 2162 { |
1459 | 2163 __int64 v1; // eax@1 |
0 | 2164 int i; // edx@1 |
2165 | |
2166 v1 = 0; | |
1459 | 2167 for ( i = 0; i < level; ++i ) |
0 | 2168 v1 += i + 1; |
2169 return 1000 * v1; | |
2170 } | |
2171 | |
2172 //----- (004BC49B) -------------------------------------------------------- | |
651 | 2173 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 2174 { |
2102 | 2175 NPCData *speakingNPC; // ebp@1 |
2176 int npc_event_id; // ecx@10 | |
2177 char *v13; // [sp-8h] [bp-18h]@60 | |
656 | 2178 |
2102 | 2179 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
2180 uDialogueType = newDialogueType; | |
2181 if (!speakingNPC->uFlags) | |
2182 speakingNPC->uFlags = 1; | |
2183 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
2184 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
2185 else if(newDialogueType == DIALOGUE_76) | |
2186 { | |
2187 if (speakingNPC->Hired()) | |
2188 { | |
2189 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
2190 { | |
2191 for ( uint i = 0; i < (unsigned int)pNPCStats->uNumNewNPCs; ++i ) | |
2192 { | |
2193 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName) ) | |
2194 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu; | |
2195 } | |
2196 } | |
2197 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
2198 memset(&pParty->pHirelings[0], 0, sizeof(NPCData)); | |
2199 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
2200 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); | |
2201 pParty->hirelingScrollPosition = 0; | |
2202 pParty->CountHirelings(); | |
2203 dword_591084 = 0; | |
2204 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2205 dword_7241C8 = 0; | |
2206 return; | |
2207 } | |
2208 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
2209 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" | |
2210 else | |
2211 { | |
2115 | 2212 if ( speakingNPC->uProfession != 51 ) //burglars have no hiring price |
2102 | 2213 { |
2115 | 2214 if ( pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice ) |
2102 | 2215 { |
2216 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
2217 dialogue_show_profession_details = false; | |
2218 uDialogueType = 13; | |
2219 if ( uActiveCharacter ) | |
2220 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
2221 if ( !dword_7241C8 ) | |
2222 pGame->Draw(); | |
2223 dword_7241C8 = 0; | |
2224 return; | |
2225 } | |
2115 | 2226 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice); |
2102 | 2227 } |
2228 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
2229 if ( pParty->pHirelings[0].pName ) | |
2230 { | |
2231 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
2232 v13 = pParty->pHireling2Name; | |
2233 } | |
2234 else | |
2235 { | |
2236 memcpy(&pParty->pHirelings[0], speakingNPC, sizeof(pParty->pHirelings[0])); | |
2237 v13 = pParty->pHireling1Name; | |
2238 } | |
2239 strcpy(v13, speakingNPC->pName); | |
2240 pParty->hirelingScrollPosition = 0; | |
2241 pParty->CountHirelings(); | |
2242 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2243 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) | |
2244 pDialogue_SpeakingActor->uAIState = Removed; | |
2245 if ( uActiveCharacter ) | |
2246 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
2247 } | |
2248 } | |
2249 else if ( (signed int)newDialogueType > DIALOGUE_84 && (signed int)newDialogueType <= DIALOGUE_ARENA_SELECT_CHAMPION ) //выбор уровня сложности боя | |
2250 { | |
2251 ArenaFight(); | |
2252 return; | |
2253 } | |
2254 else if(newDialogueType == DIALOGUE_USE_NPC_ABILITY) | |
2255 { | |
2256 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0) | |
2257 { | |
2258 if ( speakingNPC->uProfession != GateMaster ) | |
2259 speakingNPC->bHasUsedTheAbility = 1; | |
2260 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2261 } | |
2262 else | |
2263 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!" | |
2264 } | |
2265 else if(newDialogueType == DIALOGUE_13) | |
2266 { | |
2267 if (!speakingNPC->Hired()) | |
2268 { | |
2269 sub_4B3E1E(); | |
2270 dialogue_show_profession_details = false; | |
2271 } | |
2272 else | |
2273 { | |
2274 for ( uint i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i ) | |
2275 { | |
2276 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName) ) | |
2277 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu; | |
2278 } | |
2279 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
2280 memset(&pParty->pHirelings[0], 0, sizeof(NPCData)); | |
2281 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
2282 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); | |
2283 pParty->hirelingScrollPosition = 0; | |
2284 pParty->CountHirelings(); | |
2285 dword_591084 = 0; | |
2286 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2287 dword_7241C8 = 0; | |
2288 return; | |
2289 } | |
2290 } | |
2291 else if(newDialogueType >= DIALOGUE_EVT_A && newDialogueType <= DIALOGUE_EVT_F) | |
2292 { | |
2293 switch(newDialogueType) | |
2294 { | |
2295 case DIALOGUE_EVT_A: npc_event_id = speakingNPC->evt_A; break; | |
2296 case DIALOGUE_EVT_B: npc_event_id = speakingNPC->evt_B; break; | |
2297 case DIALOGUE_EVT_C: npc_event_id = speakingNPC->evt_C; break; | |
2298 case DIALOGUE_EVT_D: npc_event_id = speakingNPC->evt_D; break; | |
2299 case DIALOGUE_EVT_E: npc_event_id = speakingNPC->evt_E; break; | |
2300 case DIALOGUE_EVT_F: npc_event_id = speakingNPC->evt_F; break; | |
2301 } | |
2302 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
2303 _4B3FE5_training_dialogue(npc_event_id); //200-310 | |
2304 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
2305 { //400-410 | |
2306 dword_F8B1D8 = newDialogueType; | |
2307 DrawJoinGuildWindow(npc_event_id - 400); | |
2308 } | |
2309 else | |
2310 { | |
2311 switch ( npc_event_id ) | |
2312 { | |
2313 case 139: | |
2314 OracleDialogue(); | |
2315 break; | |
2316 case 311: | |
2317 CheckBountyRespawnAndAward(); | |
2318 break; | |
2319 case 399: | |
2320 Arena_SelectionFightLevel(); | |
2321 break; | |
2322 default: | |
2323 activeLevelDecoration = (LevelDecoration*)1; | |
2324 current_npc_text = 0; | |
2325 EventProcessor(npc_event_id, 0, 1); | |
2326 activeLevelDecoration = NULL; | |
2327 break; | |
2328 } | |
2329 } | |
2330 } | |
2331 if ( !dword_7241C8 ) | |
2332 pGame->Draw(); | |
2333 dword_7241C8 = 0; | |
656 | 2334 } |
0 | 2335 |