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