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