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