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