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