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