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