Mercurial > mm7
annotate mm7_4.cpp @ 2132:49de109bbab5
SavePCXScreenshot() continue
author | Ritor1 |
---|---|
date | Sun, 29 Dec 2013 01:26:15 +0600 |
parents | ba3de1337989 |
children | d44b7775fc06 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
4 |
1262 | 5 #include "Texture.h" |
6 #include "mm7_data.h" | |
1016 | 7 #include "VideoPlayer.h" |
8 #include "Sprites.h" | |
9 #include "BSPModel.h" | |
10 #include "Mouse.h" | |
11 #include "stru6.h" | |
12 | |
13 #include "LightmapBuilder.h" | |
341 | 14 #include "MM7.h" |
0 | 15 #include "MapInfo.h" |
16 #include "Game.h" | |
17 #include "GUIWindow.h" | |
18 #include "GUIFont.h" | |
19 #include "Party.h" | |
20 #include "AudioPlayer.h" | |
21 #include "Outdoor.h" | |
1277 | 22 #include "Outdoor_stuff.h" |
0 | 23 #include "LOD.h" |
24 #include "Actor.h" | |
25 #include "Events.h" | |
26 #include "Viewport.h" | |
27 #include "FrameTableInc.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2030
diff
changeset
|
28 #include "OurMath.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
29 #include "SpriteObject.h" |
0 | 30 #include "ObjectList.h" |
31 #include "DecorationList.h" | |
2044 | 32 #include "Timer.h" |
0 | 33 #include "IconFrameTable.h" |
34 #include "PlayerFrameTable.h" | |
35 #include "Awards.h" | |
36 #include "TurnEngine.h" | |
37 #include "Events2D.h" | |
38 #include "stru159.h" | |
189 | 39 #include "texts.h" |
0 | 40 #include "Log.h" |
1299 | 41 #include "UI\UIHouses.h" |
1262 | 42 #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
|
43 #include "Level/Decoration.h" |
0 | 44 |
45 //----- (0046CC4B) -------------------------------------------------------- | |
1459 | 46 void check_event_triggers() |
0 | 47 { |
1513 | 48 for (size_t i = 0; i < num_event_triggers; i++) |
0 | 49 { |
2117 | 50 if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH |
51 && pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pParty->vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange) | |
0 | 52 { |
2117 | 53 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, PID(OBJECT_Decoration,i), 1); |
0 | 54 } |
2117 | 55 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER) |
0 | 56 { |
1513 | 57 for (size_t j = 0; j < uNumActors; j++) |
0 | 58 { |
2117 | 59 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pActors[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange) |
60 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1); | |
0 | 61 } |
62 } | |
2117 | 63 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT) |
0 | 64 { |
1513 | 65 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
|
66 { |
2117 | 67 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pSpriteObjects[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange) |
68 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1); | |
0 | 69 } |
70 } | |
71 } | |
72 } | |
73 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
74 | |
75 //----- (0046DEF2) -------------------------------------------------------- | |
76 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
77 { | |
78 unsigned int result; // eax@1 | |
79 | |
80 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
81 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 82 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
83 return result; | |
84 } | |
85 | |
86 //----- (0046E0B2) -------------------------------------------------------- | |
1458 | 87 void _46E0B2_collide_against_decorations() |
0 | 88 { |
2117 | 89 BLVSector *sector; // ebp@1 |
90 LevelDecoration *decor; // edi@2 | |
91 DecorationDesc *decor_desc; // esi@3 | |
0 | 92 int v8; // ebx@10 |
93 int v9; // esi@11 | |
94 int v11; // eax@12 | |
95 int v12; // esi@14 | |
96 unsigned int v13; // eax@17 | |
97 signed int i; // [sp+4h] [bp-14h]@1 | |
98 int v15; // [sp+8h] [bp-10h]@10 | |
99 int v16; // [sp+Ch] [bp-Ch]@10 | |
100 int v17; // [sp+10h] [bp-8h]@10 | |
101 | |
2117 | 102 sector = &pIndoor->pSectors[stru_721530.uSectorID]; |
103 for ( i = 0; i < sector->uNumDecorations; ++i ) | |
0 | 104 { |
2117 | 105 decor = &pLevelDecorations[sector->pDecorationIDs[i]]; |
106 if (!(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) | |
0 | 107 { |
2117 | 108 decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID]; |
109 if (!decor_desc->CanMoveThrough()) | |
0 | 110 { |
2117 | 111 if ( stru_721530.sMaxX <= decor->vPosition.x + decor_desc->uRadius && stru_721530.sMinX >= decor->vPosition.x - decor_desc->uRadius |
112 && stru_721530.sMaxY <= decor->vPosition.y + decor_desc->uRadius && stru_721530.sMinY >= decor->vPosition.y - decor_desc->uRadius | |
113 && stru_721530.sMaxZ <= decor->vPosition.z + decor_desc->uDecorationHeight && stru_721530.sMinZ >= decor->vPosition.z ) | |
0 | 114 { |
2117 | 115 v16 = decor->vPosition.x - stru_721530.normal.x; |
116 v15 = decor->vPosition.y - stru_721530.normal.y; | |
117 v8 = stru_721530.prolly_normal_d + decor_desc->uRadius; | |
118 v17 = ((decor->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y | |
119 - (decor->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16; | |
120 if ( abs(v17) <= stru_721530.prolly_normal_d + decor_desc->uRadius ) | |
0 | 121 { |
2117 | 122 v9 = (v16 * stru_721530.direction.x + v15 * stru_721530.direction.y) >> 16; |
123 if ( v9 > 0 ) | |
0 | 124 { |
2117 | 125 v11 = stru_721530.normal.z + fixpoint_mul(stru_721530.direction.z, v9); |
126 if ( v11 >= decor->vPosition.z ) | |
0 | 127 { |
2117 | 128 if ( v11 <= decor_desc->uDecorationHeight + decor->vPosition.z ) |
0 | 129 { |
2117 | 130 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
131 if ( v12 < 0 ) | |
132 v12 = 0; | |
133 if ( v12 < stru_721530.field_7C ) | |
0 | 134 { |
2117 | 135 stru_721530.field_7C = v12; |
136 v13 = 8 * sector->pDecorationIDs[i]; | |
137 LOBYTE(v13) = v13 | 5; | |
138 stru_721530.uFaceID = v13; | |
0 | 139 } |
140 } | |
141 } | |
142 } | |
143 } | |
144 } | |
145 } | |
146 } | |
147 } | |
148 } | |
149 | |
150 //----- (00487DA9) -------------------------------------------------------- | |
1583 | 151 void sub_487DA9() |
0 | 152 { |
1413 | 153 for (int i = 0; i < 20000; ++i) |
154 array_77EC08[i].field_108 = 0; | |
0 | 155 } |
156 | |
157 //----- (0048A959) -------------------------------------------------------- | |
2006 | 158 signed int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) |
0 | 159 { |
160 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
161 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
162 b = (uColor & 0x000000FF) / 255.0f; | |
163 | |
164 float h, s, v; | |
165 RGB2HSV(&h, &s, r, g, b, &v); | |
166 | |
167 if ( h_replace != -1.0 ) | |
168 h = h_replace; | |
169 if ( s_replace != -1.0 ) | |
170 s = s_replace; | |
171 if ( v_replace != -1.0 ) | |
172 v = v_replace; | |
173 HSV2RGB(&r, &g, &b, h, s, v); | |
174 | |
2125 | 175 return (((uint)round_to_int(r * 255.0f) & 0xFF) << 16) | |
176 (((uint)round_to_int(g * 255.0f) & 0xFF) << 8) | | |
177 (((uint)round_to_int(b * 255.0f) & 0xFF)); | |
0 | 178 } |
179 | |
180 //----- (0048B561) -------------------------------------------------------- | |
1029 | 181 int fixpoint_from_float(float val) |
0 | 182 { |
1029 | 183 // float X.Yf -> int XXXX YYYY |
184 int left = floorf((val - 0.5f) + 0.5f); | |
185 int right = floorf((val - left) * 65536.0f); | |
186 return (left << 16) | right; | |
0 | 187 } |
188 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
189 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
|
190 { |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
191 return (lhv << 16) | rhv; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
192 } |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
193 |
0 | 194 //----- (00491E3A) -------------------------------------------------------- |
1459 | 195 void sub_491E3A() |
0 | 196 { |
197 signed int v1; // esi@3 | |
198 unsigned int v3; // eax@7 | |
199 unsigned int v4; // edx@8 | |
200 int v6; // edi@17 | |
201 int v12; // eax@26 | |
202 | |
2117 | 203 __debugbreak();//Ritor1 |
204 for ( uint pl = 0; pl < 4; pl++ ) | |
0 | 205 { |
203 | 206 if (SoundSetAction[24][0]) |
0 | 207 { |
2117 | 208 v3 = 0; |
209 for ( v1 = 0; v1 < (signed int)pSoundList->sNumSounds; ++v1 ) | |
0 | 210 { |
2117 | 211 if ( pSoundList->pSL_Sounds[v1].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998 ) |
212 v3 = v1; | |
0 | 213 } |
764 | 214 pSoundList->UnloadSound(v3, 1); |
2117 | 215 for ( v4 = 0; (signed int)v4 < (signed int)pSoundList->sNumSounds; ++v4 ) |
0 | 216 { |
2117 | 217 if ( pSoundList->pSL_Sounds[v4].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4999 ) |
218 pSoundList->UnloadSound(v4, 1); | |
0 | 219 } |
220 } | |
221 } | |
222 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 223 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 224 { |
225 do | |
226 { | |
2117 | 227 pIcons_LOD->pTextures[v6].Release(); |
228 if ( pIcons_LOD->pHardwareTextures ) | |
0 | 229 { |
2117 | 230 if ( pIcons_LOD->pHardwareTextures[v6] ) |
0 | 231 { |
2117 | 232 pIcons_LOD->pHardwareTextures[v6]->Release(); |
0 | 233 pIcons_LOD->pHardwareTextures[v6] = 0; |
234 } | |
235 } | |
2117 | 236 if ( pIcons_LOD->pHardwareSurfaces ) |
0 | 237 { |
2117 | 238 if ( pIcons_LOD->pHardwareSurfaces[v6] ) |
0 | 239 { |
2117 | 240 pIcons_LOD->pHardwareSurfaces[v6]->Release(); |
0 | 241 pIcons_LOD->pHardwareSurfaces[v6] = 0; |
242 } | |
243 } | |
244 --v6; | |
245 } | |
33 | 246 while ( v6 >= pIcons_LOD->pFacesLock ); |
247 } | |
248 v12 = pIcons_LOD->pFacesLock; | |
249 pIcons_LOD->pFacesLock = 0; | |
0 | 250 pIcons_LOD->uNumLoadedFiles = v12; |
251 } | |
252 // 4ED498: using guessed type char byte_4ED498; | |
253 | |
254 //----- (00493938) -------------------------------------------------------- | |
2060 | 255 void _493938_regenerate() |
0 | 256 { |
2060 | 257 int current_time; // edi@1 |
258 int last_reg_time; // qax@1 | |
0 | 259 int v4; // eax@2 |
260 int v5; // edi@5 | |
2030 | 261 bool cursed_flag; // ecx@5 |
0 | 262 char v7; // sf@5 |
112 | 263 int *v8; // ecx@10 |
0 | 264 int v9; // edi@15 |
265 signed int v10; // eax@15 | |
266 __int16 *v11; // edx@16 | |
267 int v12; // eax@20 | |
268 int v13; // ebx@20 | |
269 unsigned int *v14; // esi@21 | |
270 unsigned int v15; // ecx@21 | |
271 unsigned int v16; // eax@21 | |
272 int v18; // eax@21 | |
273 signed int v19; // eax@21 | |
2060 | 274 bool recovery_HP; // ebx@25 |
0 | 275 ITEM_EQUIP_TYPE v22; // edi@30 |
276 signed int v25; // eax@33 | |
277 int v26; // eax@35 | |
278 int v27; // eax@36 | |
279 int v28; // eax@37 | |
280 signed int v31; // ecx@53 | |
281 char v41[400]; // [sp+4h] [bp-22Ch]@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
282 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 283 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2060 | 284 bool has_dragon_flag; // [sp+210h] [bp-20h]@22 |
285 bool lich_jar_flag; // [sp+214h] [bp-1Ch]@25 | |
286 bool zombie_flag; // [sp+218h] [bp-18h]@25 | |
287 bool decrease_HP; // [sp+21Ch] [bp-14h]@25 | |
288 bool lich_flag; // [sp+220h] [bp-10h]@25 | |
0 | 289 int v49; // [sp+224h] [bp-Ch]@24 |
2060 | 290 bool recovery_SP; // [sp+228h] [bp-8h]@25 |
291 bool redraw_flag; // [sp+22Ch] [bp-4h]@2 | |
0 | 292 |
2060 | 293 current_time = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; |
294 last_reg_time = (signed int)(signed __int64)((double)pParty->uLastRegenerationTime * 0.234375) / 60; | |
295 if ( current_time >= (signed int)last_reg_time + 5 ) | |
0 | 296 { |
2060 | 297 redraw_flag = false; |
298 v4 = (current_time - last_reg_time) / 5; | |
0 | 299 if (pParty->FlyActive()) |
300 { | |
301 if ( pParty->bFlying ) | |
302 { | |
569 | 303 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2030 | 304 { |
569 | 305 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; |
2060 | 306 cursed_flag = pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[Condition_Cursed];//cursed |
2030 | 307 v7 = cursed_flag < v5; |
308 //cursed_flag -= v5; | |
309 if ( !v7 ) | |
0 | 310 { |
311 pParty->uFlags &= 0xFFFFFFBFu; | |
2030 | 312 pParty->bFlying = false; |
2060 | 313 redraw_flag = true; |
0 | 314 } |
315 } | |
316 } | |
317 } | |
569 | 318 |
0 | 319 if (pParty->WaterWalkActive()) |
320 { | |
569 | 321 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
322 { | |
323 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
324 { // taking on water | |
2060 | 325 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[Condition_Cursed];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; |
112 | 326 v7 = *v8 < v4; |
327 *v8 -= v4; | |
0 | 328 if ( v7 ) |
329 { | |
112 | 330 *v8 = 0; |
569 | 331 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
2060 | 332 redraw_flag = true; |
0 | 333 } |
334 } | |
335 } | |
336 } | |
569 | 337 |
2060 | 338 if (pParty->ImmolationActive())//Æåðòâà |
0 | 339 { |
340 a3.z = 0; | |
341 a3.y = 0; | |
342 a3.x = 0; | |
343 a1.stru_24.Reset(); | |
822 | 344 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
345 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 346 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
347 a1.uType = 1070; |
822 | 348 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 349 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
350 { | |
351 LABEL_19: | |
352 LOWORD(v10) = 0; | |
353 } | |
354 else | |
355 { | |
356 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 357 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 358 { |
359 ++v10; | |
360 v11 += 28; | |
361 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
362 goto LABEL_19; | |
363 } | |
364 } | |
365 a1.uObjectDescID = v10; | |
366 a1.field_60_distance_related_prolly_lod = 0; | |
1167 | 367 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; |
303 | 368 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 369 a1.uAttributes = 0; |
370 a1.uSectorID = 0; | |
371 a1.uSpriteFrameID = 0; | |
822 | 372 a1.spell_caster_pid = v12; |
0 | 373 a1.uFacing = 0; |
374 a1.uSoundID = 0; | |
1459 | 375 v13 = _46A89E_immolation_effect((int)v41, 100, 307); |
2060 | 376 for ( v9 = 0; v9 < v13; ++v9 ) |
0 | 377 { |
2060 | 378 v14 = (unsigned int *)&v41[4 * v9]; |
379 v15 = *v14; | |
380 v16 = *v14; | |
381 a1.vPosition.x = pActors[v16].vPosition.x; | |
382 a1.vPosition.y = pActors[v16].vPosition.y; | |
383 a1.vPosition.z = pActors[v16].vPosition.z; | |
384 v18 = 8 * v15; | |
385 LOBYTE(v18) = PID(OBJECT_Actor,v15); | |
386 a1.spell_target_pid = v18; | |
387 v19 = a1.Create(0, 0, 0, 0); | |
388 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); | |
0 | 389 } |
390 } | |
2060 | 391 |
392 has_dragon_flag = false; | |
248 | 393 if (PartyHasDragon()) |
2060 | 394 has_dragon_flag = true; |
395 | |
396 for ( v49 = 0; v49 < 4; v49++ ) | |
0 | 397 { |
2060 | 398 recovery_HP = false; |
399 recovery_SP = false; | |
400 decrease_HP = false; | |
401 lich_flag = false; | |
402 lich_jar_flag = false; | |
403 zombie_flag = false; | |
404 | |
405 for ( int v22 = 0; (signed int)v22 < 16; v22++ ) | |
0 | 406 { |
2060 | 407 if ( pParty->pPlayers[v49].HasItemEquipped((ITEM_EQUIP_TYPE)v22) ) |
0 | 408 { |
2060 | 409 uint _idx = pParty->pPlayers[v49].pEquipment.pIndices[v22]; |
410 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID > 134 ) | |
2030 | 411 { |
2060 | 412 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_RELIC_ETHRICS_STAFF ) |
413 decrease_HP = true; | |
414 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HERMES_SANDALS ) | |
415 { | |
416 recovery_HP = true; | |
417 recovery_SP = true; | |
418 } | |
419 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_MINDS_EYE ) | |
420 recovery_SP = true; | |
421 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HEROS_BELT ) | |
422 recovery_HP = true; | |
0 | 423 } |
424 else | |
425 { | |
2060 | 426 v25 = pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uSpecEnchantmentType; |
427 if ( v25 == 37 //of Regeneration("Regenerate 1hp/x while walking, etc") | |
428 && v25 == 44 //of Life("HP (+10), Regen hpts") | |
429 && v25 == 50 //of The Phoenix("Fire Res (+30), Regen hpts") && | |
430 && v25 == 54 )// of The Troll("End (+15), Regen hpts") | |
431 recovery_HP = true; | |
432 if ( v25 == 38 //of Mana("Regenerate 1sp/x while walking, etc") | |
433 && v25 == 47 //of The Eclipse("SP (+10), Regen spts") | |
434 && v25 == 55 )//of The Unicorn("Luck (+15), Regen spts") | |
435 recovery_SP = true; | |
436 if ( v25 == 66 )// of Plenty("Regenerate 1 hp/x and 1 sp/x while walking, etc.") | |
2030 | 437 { |
2060 | 438 recovery_HP = true; |
439 recovery_SP = true; | |
2030 | 440 } |
0 | 441 } |
2060 | 442 |
443 if ( recovery_HP && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
444 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
445 { | |
446 ++pParty->pPlayers[v49].sHealth; | |
447 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() ) | |
448 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].GetMaxHealth(); | |
449 if ( pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0 ) | |
450 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0; | |
451 redraw_flag = true; | |
452 } | |
453 | |
454 if ( recovery_SP ) | |
0 | 455 { |
2060 | 456 ++pParty->pPlayers[v49].sMana; |
457 if ( pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() ) | |
458 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].GetMaxMana(); | |
459 redraw_flag = true; | |
460 } | |
461 | |
462 if ( decrease_HP && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
463 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
464 { | |
465 --pParty->pPlayers[v49].sHealth; | |
466 if ( !(pParty->pPlayers[v49].pConditions[Condition_Unconcious]) && pParty->pPlayers[v49].sHealth < 0 ) | |
467 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed; | |
468 if ( pParty->pPlayers[v49].sHealth < 1 ) | |
0 | 469 { |
2060 | 470 if ( pParty->pPlayers[v49].sHealth + pParty->pPlayers[v49].uEndurance + pParty->pPlayers[v49].GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1 |
471 || (signed __int64)pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) | |
472 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed; | |
473 else | |
0 | 474 { |
2060 | 475 if ( !pParty->pPlayers[v49].pConditions[Condition_Dead] ) |
476 pParty->pPlayers[v49].pConditions[Condition_Dead] = pParty->uTimePlayed; | |
0 | 477 } |
478 } | |
2060 | 479 redraw_flag = true; |
0 | 480 } |
481 } | |
482 } | |
2060 | 483 |
484 //regeneration | |
485 if ( pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uExpireTime > 0 | |
486 && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
487 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
0 | 488 { |
2060 | 489 pParty->pPlayers[v49].sHealth += 5 * pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uPower; |
490 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() ) | |
491 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].GetMaxHealth(); | |
492 if ( pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0 ) | |
493 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0; | |
494 redraw_flag = true; | |
495 } | |
496 | |
497 //for warlock | |
498 if ( has_dragon_flag && pParty->pPlayers[v49].classType == PLAYER_CLASS_WARLOCK ) | |
499 { | |
500 ++pParty->pPlayers[v49].sMana; | |
501 if ( pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() ) | |
502 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].GetMaxMana(); | |
503 redraw_flag = true; | |
504 } | |
505 | |
506 //for lich | |
507 if ( pParty->pPlayers[v49].classType == PLAYER_CLASS_LICH ) | |
508 { | |
2085 | 509 for ( v31 = 0; v31 < 126; ++v31 ) |
0 | 510 { |
2060 | 511 if ( pParty->pPlayers[v49].pInventoryItemList[v31].uItemID == ITEM_LICH_JAR_FULL ) |
512 lich_jar_flag = true; | |
0 | 513 } |
2060 | 514 lich_flag = true; |
515 } | |
516 if ( lich_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
517 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
518 { | |
519 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2 ) | |
520 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 2; | |
521 if ( pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() / 2 ) | |
522 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 2; | |
523 } | |
524 if ( lich_jar_flag ) | |
525 { | |
526 ++pParty->pPlayers[v49].sMana; | |
527 if ( pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() ) | |
528 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].GetMaxMana(); | |
529 } | |
530 | |
531 //for zombie | |
532 if ( pParty->pPlayers[v49].pConditions[Condition_Zombie] ) | |
533 zombie_flag = true; | |
534 if ( zombie_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead] | |
535 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] ) | |
536 { | |
537 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2 ) | |
538 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 1; | |
539 if ( pParty->pPlayers[v49].sMana > 0 ) | |
540 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 1; | |
0 | 541 } |
542 } | |
2060 | 543 pParty->uLastRegenerationTime = pParty->uTimePlayed; |
544 if ( !viewparams->bRedrawGameUI ) | |
545 viewparams->bRedrawGameUI = redraw_flag; | |
0 | 546 } |
547 } | |
548 | |
549 //----- (00493F79) -------------------------------------------------------- | |
1459 | 550 void init_summoned_item(stru351_summoned_item *_this, __int64 duration) |
0 | 551 { |
552 signed __int64 v2; // ST2C_8@1 | |
553 signed __int64 v3; // qax@1 | |
351 | 554 //signed __int64 v4; // ST1C_8@1 |
0 | 555 unsigned __int64 v5; // qax@1 |
556 unsigned int v6; // ebx@1 | |
557 | |
1459 | 558 v2 = (signed __int64)((double)duration * 0.234375); |
0 | 559 v3 = v2 / 60 / 60; |
351 | 560 //v4 = v3; |
0 | 561 v5 = (unsigned int)v3 / 0x18; |
562 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 563 _this->field_0_expire_second = v2 % 60; |
564 _this->field_4_expire_minute = v2 / 60 % 60; | |
565 _this->field_8_expire_hour = v3 % 24; | |
566 _this->field_10_expire_week = v5 / 7 & 3; | |
567 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
568 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 569 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 570 } |
571 | |
572 //----- (00494035) -------------------------------------------------------- | |
1031 | 573 void _494035_timed_effects__water_walking_damage__etc() |
0 | 574 { |
575 signed __int64 v0; // qax@1 | |
576 unsigned int v4; // edi@1 | |
577 signed int v12; // edi@29 | |
578 int v24; // ecx@60 | |
579 int v26; // ecx@64 | |
580 int v28; // ecx@68 | |
581 int v30; // ecx@72 | |
582 int v32; // ecx@76 | |
583 int v34; // ecx@80 | |
584 int v36; // ecx@84 | |
585 int v38; // ecx@88 | |
586 int v40; // ecx@92 | |
587 int v42; // ecx@96 | |
588 bool v43; // ebx@102 | |
589 bool v46; // edi@111 | |
590 unsigned int v56; // [sp-8h] [bp-38h]@55 | |
591 int v59; // [sp-4h] [bp-34h]@55 | |
592 unsigned int v61; // [sp+14h] [bp-1Ch]@1 | |
593 signed int a2a; // [sp+18h] [bp-18h]@47 | |
2062 | 594 signed int old_day; // [sp+1Ch] [bp-14h]@47 |
595 signed int old_hour; | |
0 | 596 |
2062 | 597 old_day = pParty->uDaysPlayed; |
598 old_hour = pParty->uCurrentHour; | |
816 | 599 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 600 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2062 | 601 v0 = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60)/60i64; |
602 v4 = (unsigned int)(((unsigned int)v0 / 24) / 7) >> 2; | |
0 | 603 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; |
2062 | 604 pParty->uCurrentMinute = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) % 60; |
605 pParty->uCurrentHour = v0 % 24; | |
606 pParty->uCurrentMonthWeek = ((unsigned int)v0 / 24) / 7 & 3; | |
607 pParty->uDaysPlayed = (unsigned int)((unsigned int)v0 / 24) % 28; | |
0 | 608 pParty->uCurrentMonth = v4 % 12; |
352 | 609 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
2062 | 610 if ( pParty->uCurrentHour >= 3 && (old_hour < 3 || pParty->uDaysPlayed > old_day) ) // new day dawns |
0 | 611 { |
612 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
613 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
614 | |
615 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
616 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
617 | |
766 | 618 ++pParty->days_played_without_rest; |
619 if (pParty->days_played_without_rest > 1) | |
0 | 620 { |
621 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
|
622 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0); |
766 | 623 |
624 if (pParty->uNumFoodRations) | |
625 Party::TakeFood(1); | |
0 | 626 else |
627 for (uint i = 0; i < 4; ++i) | |
766 | 628 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
629 | |
630 if (pParty->days_played_without_rest > 3) | |
2062 | 631 for ( uint i = 0; i < 4; ++i ) |
632 { | |
633 pParty->pPlayers[i].Zero(); | |
634 if (!pParty->pPlayers[i].IsPertified() && !pParty->pPlayers[i].IsEradicated() | |
635 && !pParty->pPlayers[i].IsDead()) | |
0 | 636 { |
2062 | 637 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
638 pParty->pPlayers[i].SetCondDeadWithBlockCheck(0); | |
639 if (rand() % 100 < 10 * pParty->days_played_without_rest) | |
640 pParty->pPlayers[i].SetCondInsaneWithBlockCheck(0); | |
0 | 641 } |
2062 | 642 } |
766 | 643 } |
644 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 645 pOutdoor->SetFog(); |
646 | |
647 for (uint i = 0; i < 4; ++i) | |
648 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
649 } | |
766 | 650 |
2062 | 651 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage |
0 | 652 { |
2062 | 653 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128; |
654 viewparams->bRedrawGameUI = true; | |
655 for ( uint pl = 1; pl <= 4; ++pl ) | |
0 | 656 { |
2062 | 657 if ( pPlayers[pl]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
658 || pPlayers[pl]->HasEnchantedItemEquipped(71) | |
659 || pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].uExpireTime > 0 ) | |
660 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); | |
0 | 661 else |
662 { | |
2062 | 663 if ( !pPlayers[pl]->HasUnderwaterSuitEquipped() ) |
0 | 664 { |
2062 | 665 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE); |
0 | 666 if ( pParty->uFlags & 4 ) |
667 { | |
2062 | 668 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);// Âû òîíåòå! |
783 | 669 GameUI_Footer_TimeLeft = 128; |
0 | 670 } |
671 } | |
2062 | 672 else |
673 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); | |
0 | 674 } |
2062 | 675 } |
0 | 676 } |
2062 | 677 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) //lava damage |
0 | 678 { |
2062 | 679 viewparams->bRedrawGameUI = true; |
680 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128; | |
681 | |
682 for ( uint pl = 1; pl <= 4; pl++ ) | |
0 | 683 { |
2062 | 684 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE); |
0 | 685 if ( pParty->uFlags & 0x200 ) |
686 { | |
2062 | 687 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); //Âû ãîðèòå! |
783 | 688 GameUI_Footer_TimeLeft = 128; |
0 | 689 } |
690 } | |
691 } | |
692 _493938_regenerate(); | |
2062 | 693 uint party_condition_flag = 4; |
816 | 694 a2a = pEventTimer->uTimeElapsed; |
2063 | 695 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING )//çàìåäëåíèå âîññòàíîâëåíèÿ ïðè áåãå |
816 | 696 { |
697 a2a *= 0.5f; | |
698 if (a2a < 1) | |
0 | 699 a2a = 1; |
700 } | |
2062 | 701 |
702 for ( uint pl = 1; pl <= 4; pl++ ) | |
0 | 703 { |
2062 | 704 if ( pPlayers[pl]->uTimeToRecovery ) |
2063 | 705 pPlayers[pl]->Recover(a2a);//âîññòàíîâëåíèå àêòèâíîñòè |
2062 | 706 if ( pPlayers[pl]->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + pPlayers[pl]->sHealth + pPlayers[pl]->uEndurance >= 1 |
707 || (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) | |
0 | 708 { |
2062 | 709 if ( pPlayers[pl]->sHealth < 1 ) |
710 pPlayers[pl]->SetCondition(Condition_Unconcious, 0); | |
0 | 711 } |
712 else | |
2062 | 713 pPlayers[pl]->SetCondition(Condition_Dead, 0); |
714 if ( pPlayers[pl]->field_E0 ) | |
0 | 715 { |
2062 | 716 v24 = pPlayers[pl]->field_E0 - pEventTimer->uTimeElapsed; |
0 | 717 if ( v24 > 0 ) |
2062 | 718 pPlayers[pl]->field_E0 = v24; |
0 | 719 else |
720 { | |
2062 | 721 pPlayers[pl]->field_E0 = 0; |
722 viewparams->bRedrawGameUI = true; | |
0 | 723 } |
724 } | |
2062 | 725 if ( pPlayers[pl]->field_E4 ) |
0 | 726 { |
2062 | 727 v26 = pPlayers[pl]->field_E4 - pEventTimer->uTimeElapsed; |
0 | 728 if ( v26 > 0 ) |
2062 | 729 pPlayers[pl]->field_E4 = v26; |
0 | 730 else |
731 { | |
2062 | 732 pPlayers[pl]->field_E4 = 0; |
733 viewparams->bRedrawGameUI = true; | |
0 | 734 } |
735 } | |
2062 | 736 if ( pPlayers[pl]->field_E8 ) |
0 | 737 { |
2062 | 738 v28 = pPlayers[pl]->field_E8 - pEventTimer->uTimeElapsed; |
0 | 739 if ( v28 > 0 ) |
2062 | 740 pPlayers[pl]->field_E8 = v28; |
0 | 741 else |
742 { | |
2062 | 743 pPlayers[pl]->field_E8 = 0; |
744 viewparams->bRedrawGameUI = true; | |
0 | 745 } |
746 } | |
2062 | 747 if ( pPlayers[pl]->field_EC ) |
0 | 748 { |
2062 | 749 v30 = pPlayers[pl]->field_EC - pEventTimer->uTimeElapsed; |
0 | 750 if ( v30 > 0 ) |
2062 | 751 pPlayers[pl]->field_EC = v30; |
0 | 752 else |
753 { | |
2062 | 754 pPlayers[pl]->field_EC = 0; |
755 viewparams->bRedrawGameUI = true; | |
756 } | |
757 } | |
758 if ( pPlayers[pl]->field_F0 ) | |
759 { | |
760 v32 = pPlayers[pl]->field_F0 - pEventTimer->uTimeElapsed; | |
761 if ( v32 > 0 ) | |
762 pPlayers[pl]->field_F0 = v32; | |
763 else | |
764 { | |
765 pPlayers[pl]->field_F0 = 0; | |
766 viewparams->bRedrawGameUI = true; | |
0 | 767 } |
768 } | |
2062 | 769 if ( pPlayers[pl]->field_F4 ) |
0 | 770 { |
2062 | 771 v34 = pPlayers[pl]->field_F4 - pEventTimer->uTimeElapsed; |
772 if ( v34 > 0 ) | |
773 pPlayers[pl]->field_F4 = v34; | |
0 | 774 else |
775 { | |
2062 | 776 pPlayers[pl]->field_F4 = 0; |
777 viewparams->bRedrawGameUI = true; | |
0 | 778 } |
779 } | |
2062 | 780 if ( pPlayers[pl]->field_F8 ) |
0 | 781 { |
2062 | 782 v36 = pPlayers[pl]->field_F8 - pEventTimer->uTimeElapsed; |
783 if ( v36 > 0 ) | |
784 pPlayers[pl]->field_F8 = v36; | |
0 | 785 else |
786 { | |
2062 | 787 pPlayers[pl]->field_F8 = 0; |
788 viewparams->bRedrawGameUI = true; | |
0 | 789 } |
790 } | |
2062 | 791 if ( pPlayers[pl]->field_FC ) |
0 | 792 { |
2062 | 793 v38 = pPlayers[pl]->field_FC - pEventTimer->uTimeElapsed; |
794 if ( v38 > 0 ) | |
795 pPlayers[pl]->field_FC = v38; | |
0 | 796 else |
797 { | |
2062 | 798 pPlayers[pl]->field_FC = 0; |
799 viewparams->bRedrawGameUI = true; | |
0 | 800 } |
801 } | |
2062 | 802 if ( pPlayers[pl]->field_100 ) |
0 | 803 { |
2062 | 804 v40 = pPlayers[pl]->field_100 - pEventTimer->uTimeElapsed; |
805 if ( v40 > 0 ) | |
806 pPlayers[pl]->field_100 = v40; | |
0 | 807 else |
808 { | |
2062 | 809 pPlayers[pl]->field_100 = 0; |
810 viewparams->bRedrawGameUI = true; | |
0 | 811 } |
812 } | |
2062 | 813 if ( pPlayers[pl]->field_104 ) |
0 | 814 { |
2062 | 815 v42 = pPlayers[pl]->field_104 - pEventTimer->uTimeElapsed; |
816 if ( v42 > 0 ) | |
817 pPlayers[pl]->field_104 = v42; | |
0 | 818 else |
819 { | |
2062 | 820 pPlayers[pl]->field_104 = 0; |
821 viewparams->bRedrawGameUI = true; | |
0 | 822 } |
823 } | |
2062 | 824 if ( pPlayers[pl]->pConditions[Condition_Sleep] | pPlayers[pl]->pConditions[Condition_Paralyzed] |
825 | pPlayers[pl]->pConditions[Condition_Unconcious] | pPlayers[pl]->pConditions[Condition_Dead] | |
826 | pPlayers[pl]->pConditions[Condition_Pertified] | pPlayers[pl]->pConditions[Condition_Eradicated] ) | |
827 --party_condition_flag; | |
828 v43 = (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0; //ñïåøêà | |
0 | 829 |
2062 | 830 for ( uint k = 0; k < 24; ++k ) |
831 pPlayers[pl]->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed); | |
0 | 832 |
2062 | 833 if ( v43 && (signed __int64)pPlayers[pl]->pPlayerBuffs[7].uExpireTime <= 0 ) |
834 pPlayers[pl]->SetCondition(Condition_Weak, 0); | |
0 | 835 } |
2062 | 836 |
1167 | 837 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; |
0 | 838 |
839 for (uint i = 0; i < 20; ++i) | |
840 { | |
1340 | 841 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1) |
2062 | 842 viewparams->bRedrawGameUI = true; |
0 | 843 } |
844 | |
1167 | 845 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) |
0 | 846 { |
847 for (uint i = 0; i < 4; ++i) | |
848 pParty->pPlayers[i].SetCondition(1, 0); | |
849 } | |
850 | |
851 for (uint i = 0; i < 2; ++i) | |
852 { | |
1980 | 853 SpellBuff* pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; |
0 | 854 if (pBuf->uExpireTime == 0) |
855 continue; | |
856 | |
857 if ( !(pBuf->uFlags & 1) ) | |
858 { | |
859 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
860 { | |
861 pBuf->Reset(); | |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2063
diff
changeset
|
862 if (dword_4EE07C[i] == PARTY_BUFF_FLY ) |
0 | 863 pParty->bFlying = false; |
864 } | |
865 } | |
866 } | |
867 | |
2062 | 868 if ( !party_condition_flag ) |
0 | 869 { |
151 | 870 if ( pCurrentScreen != SCREEN_REST ) |
0 | 871 { |
2062 | 872 for ( uint pl = 1; pl <= 4; pl++ ) |
0 | 873 { |
2062 | 874 if ( pPlayers[pl]->pConditions[Condition_Sleep] ) |
875 { | |
876 pPlayers[pl]->pConditions[Condition_Sleep] = 0; | |
877 party_condition_flag = 1; | |
878 break; | |
879 } | |
880 } | |
881 if ( !party_condition_flag || dword_5C35C0 ) | |
882 uGameState = GAME_STATE_PARTY_DIED; | |
883 } | |
884 } | |
885 | |
886 if ( uActiveCharacter )//âûáîð ñëåäóþùåãî ïîñëå ïðîïóñêàþùåãî õîä | |
887 { | |
888 if ( pCurrentScreen != SCREEN_REST ) | |
889 { | |
890 if ( pPlayers[uActiveCharacter]->pConditions[Condition_Sleep] | |
891 || pPlayers[uActiveCharacter]->pConditions[Condition_Paralyzed] | |
892 || pPlayers[uActiveCharacter]->pConditions[Condition_Unconcious] | |
893 || pPlayers[uActiveCharacter]->pConditions[Condition_Dead] | |
894 || pPlayers[uActiveCharacter]->pConditions[Condition_Pertified] | |
895 || pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] ) | |
896 { | |
897 viewparams->bRedrawGameUI = true; | |
0 | 898 uActiveCharacter = pParty->GetNextActiveCharacter(); |
899 } | |
900 } | |
901 } | |
902 } | |
903 | |
904 //----- (00494820) -------------------------------------------------------- | |
758 | 905 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 906 { |
907 signed int v1; // eax@1 | |
908 | |
909 v1 = 5; | |
758 | 910 if ( a1 % 24 >= 5 ) |
0 | 911 v1 = 29; |
758 | 912 return v1 - a1 % 24; |
0 | 913 } |
914 | |
915 //----- (00494836) -------------------------------------------------------- | |
916 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
917 { | |
918 int v3; // esi@1 | |
919 int result; // eax@1 | |
2103 | 920 //stru339_spell_sound *v5; // ebx@1 |
2117 | 921 //int *v6; // edi@2 |
0 | 922 unsigned int v7; // eax@3 |
923 int v8; // [sp+Ch] [bp-8h]@3 | |
924 int v9; // [sp+10h] [bp-4h]@2 | |
925 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2103 | 926 //return 0; |
0 | 927 v3 = 0; |
928 result = word_4EE088_sound_ids[uSoundID]; | |
2103 | 929 //v5 = this; |
0 | 930 a2a = word_4EE088_sound_ids[uSoundID]; |
2103 | 931 if ( word_4EE088_sound_ids[uSoundID] ) |
0 | 932 { |
2117 | 933 //v6 = this->pSoundsOffsets; |
2103 | 934 for ( v9 = 0; v9 < 2; ++v9 ) |
0 | 935 { |
936 v7 = a2a++; | |
2103 | 937 result = pSoundList->LoadSound(v7, (char *)this + v3, 44744 - v3, &v8, a6); |
0 | 938 if ( !result ) |
939 break; | |
940 a6 += 4; | |
941 result = v8 + 256; | |
2103 | 942 this->pSoundsOffsets[v9] = v3; |
0 | 943 v3 += result; |
2103 | 944 this->pSoundsSizes[v9] = v8 + 256; |
2117 | 945 //++v6; |
0 | 946 } |
947 } | |
948 return result; | |
949 } | |
950 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
951 | |
952 //----- (00494AED) -------------------------------------------------------- | |
130 | 953 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 954 { |
2103 | 955 for ( uint i = 0; i < this->uNumFrames; i++ ) |
0 | 956 { |
2103 | 957 if ( this->pFrames[i].expression == expression ) |
958 return i; | |
0 | 959 } |
2103 | 960 return 0; |
0 | 961 } |
962 | |
963 //----- (00494B10) -------------------------------------------------------- | |
964 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
965 { | |
966 unsigned int v3; // esi@1 | |
967 __int16 v6; // dx@2 | |
968 int v7; // edx@3 | |
969 char *i; // eax@3 | |
970 int v9; // ecx@5 | |
971 PlayerFrame *result; // eax@6 | |
972 | |
973 v3 = uFramesetID; | |
2117 | 974 if ( this->pFrames[uFramesetID].uFlags & 1 && (v6 = this->pFrames[uFramesetID].uAnimLength) != 0 ) |
0 | 975 { |
976 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2117 | 977 for ( i = (char *)&this->pFrames[uFramesetID].uAnimTime; ; i += 10 ) |
0 | 978 { |
979 v9 = *(short *)i; | |
980 if ( v7 <= v9 ) | |
981 break; | |
982 v7 -= v9; | |
983 ++v3; | |
984 } | |
2117 | 985 result = &this->pFrames[v3]; |
0 | 986 } |
987 else | |
2117 | 988 result = &this->pFrames[uFramesetID]; |
0 | 989 return result; |
990 } | |
991 | |
992 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
993 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 994 { |
995 int v5; // esi@1 | |
996 int v6; // eax@2 | |
997 | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
998 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
999 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
|
1000 *pAnimTime = v5; |
0 | 1001 else |
1002 { | |
1003 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1004 *pFramesetID = v6; |
2117 | 1005 *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
|
1006 } |
2117 | 1007 return &this->pFrames[*pFramesetID]; |
0 | 1008 } |
1009 | |
1010 //----- (00494BC3) -------------------------------------------------------- | |
1011 void PlayerFrameTable::ToFile() | |
1012 { | |
1013 PlayerFrameTable *v1; // esi@1 | |
1014 FILE *v2; // eax@1 | |
1015 FILE *v3; // edi@1 | |
1016 | |
1980 | 1017 PlayerFrameTable* Str = this; |
0 | 1018 |
1019 v1 = Str; | |
1020 v2 = fopen("data\\dpft.bin", "wb"); | |
1021 v3 = v2; | |
1022 if ( !v2 ) | |
1545 | 1023 Error("Unable to save dpft.bin"); |
2117 | 1024 fwrite(v1, 4, 1, v2); |
0 | 1025 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); |
1026 fclose(v3); | |
1027 } | |
1028 | |
1029 //----- (00494C0F) -------------------------------------------------------- | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1030 void PlayerFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
0 | 1031 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1032 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
|
1033 num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1034 num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1035 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
|
1036 assert(uNumFrames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1037 assert(!num_mm8_frames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1038 |
1583 | 1039 pFrames = (PlayerFrame *)malloc(uNumFrames * sizeof(PlayerFrame)); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1040 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
|
1041 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
|
1042 memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame)); |
0 | 1043 } |
1044 | |
1045 //----- (00494C5A) -------------------------------------------------------- | |
1046 int PlayerFrameTable::FromFileTxt(const char *Args) | |
1047 { | |
2117 | 1048 //PlayerFrameTable *v2; // ebx@1 |
0 | 1049 FILE *v3; // eax@1 |
1050 int v4; // esi@3 | |
1051 void *v5; // eax@10 | |
1052 FILE *v6; // ST0C_4@12 | |
1053 char *i; // eax@12 | |
1054 __int16 v8; // ax@15 | |
1055 const char *v9; // ST10_4@15 | |
1056 unsigned __int16 v10; // ax@15 | |
1057 const char *v11; // ST0C_4@15 | |
1058 int j; // esi@15 | |
1059 int v13; // eax@17 | |
1060 int v14; // edx@22 | |
1061 int v15; // ecx@23 | |
1062 int v16; // eax@24 | |
1063 signed int k; // eax@27 | |
2117 | 1064 //PlayerFrame *v18; // edx@28 |
0 | 1065 int v19; // esi@28 |
1066 int l; // ecx@29 | |
1067 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
1068 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
1069 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
1070 int v25; // [sp+2F8h] [bp-Ch]@3 | |
1071 int v26; // [sp+2FCh] [bp-8h]@3 | |
1072 FILE *File; // [sp+300h] [bp-4h]@1 | |
1073 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
1074 | |
2117 | 1075 __debugbreak();//Ritor1; |
0 | 1076 //TileTable::dtor((TileTable *)this); |
1077 v3 = fopen(Args, "r"); | |
1078 File = v3; | |
1079 if ( !v3 ) | |
1545 | 1080 Error("PlayerFrameTable::load - Unable to open file: %s.", Args); |
0 | 1081 v4 = 0; |
1082 v25 = 0; | |
1083 v26 = 1; | |
1084 if ( fgets(&Buf, 490, v3) ) | |
1085 { | |
1086 do | |
1087 { | |
1088 *strchr(&Buf, 10) = 0; | |
703 | 1089 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1090 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
1091 { | |
1092 if ( v24.uPropCount < 3 ) | |
1545 | 1093 Error("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
0 | 1094 ++v25; |
1095 } | |
1096 ++v26; | |
1097 } | |
1098 while ( fgets(&Buf, 490, File) ); | |
1099 v4 = v25; | |
1100 } | |
2117 | 1101 this->uNumFrames = v4; |
1583 | 1102 v5 = malloc(10 * v4); |
2117 | 1103 this->pFrames = (PlayerFrame *)v5; |
0 | 1104 if ( !v5 ) |
1545 | 1105 Error("PlayerFrameTable::load - Out of Memory!"); |
0 | 1106 v6 = File; |
2117 | 1107 this->uNumFrames = 0; |
0 | 1108 fseek(v6, 0, 0); |
1109 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
1110 { | |
1111 *strchr(&Buf, 10) = 0; | |
703 | 1112 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1113 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 1114 { |
2117 | 1115 //v8 = atoi(v24.pProperties[0]); |
1116 //v9 = v24.pProperties[1]; | |
1117 this->pFrames[this->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)atoi(v24.pProperties[0]); | |
1118 //v10 = atoi(v9); | |
1119 //v11 = v24.pProperties[2]; | |
1120 this->pFrames[this->uNumFrames].uTextureID = atoi(v24.pProperties[1]); | |
1121 this->pFrames[this->uNumFrames].uAnimTime = atoi(v24.pProperties[2]); | |
1122 this->pFrames[this->uNumFrames].uAnimLength = 0; | |
1123 this->pFrames[this->uNumFrames].uFlags = 0; | |
701 | 1124 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 1125 { |
1104 | 1126 if ( !_stricmp(v24.pProperties[j], "New") ) |
2117 | 1127 this->pFrames[this->uNumFrames].uFlags |= 4; |
0 | 1128 } |
2117 | 1129 ++this->uNumFrames; |
0 | 1130 } |
1131 } | |
1132 fclose(File); | |
2117 | 1133 |
1134 if ( (signed int)(this->uNumFrames - 1) > 0 ) | |
0 | 1135 { |
1136 v15 = 0; | |
2117 | 1137 for ( v14 = 0; v14 < this->uNumFrames - 1; ++v14 ) |
0 | 1138 { |
2117 | 1139 v16 = (int)&this->pFrames[v15]; |
0 | 1140 if ( !(*(char *)(v16 + 18) & 4) ) |
2117 | 1141 this->pFrames[v14].uFlags |= 1; |
0 | 1142 ++v15; |
1143 } | |
1144 } | |
2117 | 1145 for ( k = 0; k < (signed int)this->uNumFrames; *(short *)(Argsa + 6) = v19 ) |
0 | 1146 { |
2117 | 1147 //v18 = this->pFrames; |
1148 Argsa = (int)&this->pFrames[k]; | |
0 | 1149 v19 = *(short *)(Argsa + 4); |
2117 | 1150 if ( this->pFrames[k].uFlags & 1 ) |
0 | 1151 { |
1152 ++k; | |
2117 | 1153 for ( l = (int)&this->pFrames[k]; this->pFrames[k].uFlags & 1; l += 10 ) |
0 | 1154 { |
1155 v19 += *(short *)(l + 4); | |
1156 ++k; | |
1157 } | |
2117 | 1158 LOWORD(v19) = this->pFrames[k].uAnimTime + v19; |
0 | 1159 } |
1160 ++k; | |
1161 } | |
1162 return 1; | |
1163 } | |
1164 | |
1165 //----- (00495366) -------------------------------------------------------- | |
1166 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
1167 { | |
1168 int v2; // edi@1 | |
1169 int v3; // edx@2 | |
2117 | 1170 //int v4; // esi@3 |
0 | 1171 int v5; // ebx@5 |
1172 signed int v7; // [sp+Ch] [bp-14h]@1 | |
1173 signed int v8; // [sp+10h] [bp-10h]@1 | |
1174 int **v9; // [sp+14h] [bp-Ch]@4 | |
1175 signed int v10; // [sp+18h] [bp-8h]@3 | |
1176 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
1177 | |
1178 v2 = a1; | |
1179 v11 = a2; | |
1180 v8 = 0; | |
1181 v7 = 0; | |
1182 if ( dword_AE336C == a1 ) | |
1183 v3 = dword_AE3370; | |
1184 else | |
1185 { | |
2117 | 1186 //v4 = a2; |
0 | 1187 dword_AE336C = a1; |
2117 | 1188 if ( (signed int)pNPCStats->uNumNPCNames[a2] <= 0 ) |
1189 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[a2]; | |
1190 else | |
0 | 1191 { |
2117 | 1192 v9 = (int **)((char *)pNPCStats->pNPCNames + a2 * 4); |
1193 for ( v10 = 0; v10 < (signed int)pNPCStats->uNumNPCNames[a2]; ++v10 ) | |
0 | 1194 { |
2117 | 1195 v5 = tolower(*(char *)*v9); |
1196 if ( v5 == tolower(v2) ) | |
1197 { | |
1198 if ( v8 ) | |
1199 v7 = v10; | |
1200 else | |
1201 v8 = v10; | |
1202 } | |
1203 v9 += 2; | |
0 | 1204 } |
2117 | 1205 if ( v8 && v8 != v7 ) |
1206 v3 = v8 + rand() % (v7 - v8); | |
1207 else | |
1208 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[a2]; | |
0 | 1209 } |
1210 } | |
1211 dword_AE3370 = v3; | |
1212 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
1213 } | |
1459 | 1214 |
0 | 1215 |
1216 //----- (00495430) -------------------------------------------------------- | |
1838 | 1217 const char * GetReputationString( signed int a1 ) |
607 | 1218 { |
566 | 1219 if (a1 >= 25) |
1220 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
1221 else if (a1 >= 6) | |
1222 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
1223 else if (a1 >= -5) | |
1224 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
1225 else if (a1 >= -24) | |
1226 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 1227 else |
566 | 1228 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 1229 } |
1230 | |
1231 //----- (00495461) -------------------------------------------------------- | |
1838 | 1232 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 1233 { |
1234 Player *pPlayer; // ebx@3 | |
1838 | 1235 const char *pText; // esi@7 |
0 | 1236 int v17; // eax@10 |
1237 signed __int64 v18; // qax@18 | |
1238 unsigned __int8 *v20; // ebx@32 | |
1239 int v21; // ecx@34 | |
1453 | 1240 int pReputation; // eax@45 |
0 | 1241 int v29; // eax@68 |
1242 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 1243 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
0 | 1244 char a1[100]; // [sp+B8h] [bp-80h]@3 |
1245 int v63; // [sp+12Ch] [bp-Ch]@32 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1246 |
1453 | 1247 if ( IsBadStringPtrA(lpsz, 1) ) |
0 | 1248 return "Invalid String Passed"; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1249 |
0 | 1250 a1[0] = 0; |
1453 | 1251 pPlayer = &pParty->pPlayers[uPlayerID]; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1252 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1253 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1254 NPCData *npc = nullptr; |
0 | 1255 if ( dword_5C35D4 ) |
1211 | 1256 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
|
1257 else |
602 | 1258 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1259 |
1453 | 1260 //pText = a4; |
1980 | 1261 uint len = strlen(lpsz); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1262 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1263 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1264 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1265 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1266 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1267 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1268 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1269 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
|
1270 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1271 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1272 { |
1453 | 1273 case 1://Ïîäðîáíåå |
1274 strcat(pTmpBuf2.data(), npc->pName); | |
1275 dst = strlen(pTmpBuf2.data()); | |
1276 i += 2; | |
1277 break; | |
1278 case 2: | |
1279 strcat(pTmpBuf2.data(), pPlayer->pName); | |
1280 dst = strlen(pTmpBuf2.data()); | |
1281 i += 2; | |
1282 break; | |
1283 case 3: | |
1284 case 4: | |
1285 strcat(pTmpBuf2.data(), a1); | |
1286 dst = strlen(pTmpBuf2.data()); | |
1287 i += 2; | |
1288 break; | |
1289 case 5: | |
1290 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; | |
1291 pText = pGlobalTXT_LocalizationStrings[397];// "evening" | |
1292 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
1293 { | |
1294 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 ) | |
0 | 1295 { |
1453 | 1296 if ( v18 < 20 ) |
1297 pText = pGlobalTXT_LocalizationStrings[396];// "day" | |
0 | 1298 } |
1299 else | |
1300 { | |
1453 | 1301 pText = pGlobalTXT_LocalizationStrings[395];// "morning" |
1302 } | |
1303 } | |
1304 strcat(pTmpBuf2.data(), pText); | |
1305 dst = strlen(pTmpBuf2.data()); | |
1306 i += 2; | |
1307 break; | |
1308 case 6: | |
1309 if ( pPlayer->uSex ) | |
1310 pText = pGlobalTXT_LocalizationStrings[387];// "lady" | |
1311 else | |
1312 pText = pGlobalTXT_LocalizationStrings[385];// "sir" | |
1313 strcat(pTmpBuf2.data(), pText); | |
1314 dst = strlen(pTmpBuf2.data()); | |
1315 i += 2; | |
1316 break; | |
1317 case 7: | |
1318 if ( pPlayer->uSex ) | |
1319 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
1320 else | |
1321 pText = pGlobalTXT_LocalizationStrings[386];// "Sir" | |
1322 strcat(pTmpBuf2.data(), pText); | |
1323 dst = strlen(pTmpBuf2.data()); | |
1324 i += 2; | |
1325 break; | |
1326 case 8: | |
1327 v63 = 0; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1453
diff
changeset
|
1328 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1329 for ( uint _i = 0; _i < 28; ++_i ) |
1453 | 1330 { |
1331 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) | |
1332 { | |
1333 v21 = v63; | |
1334 ++v63; | |
1335 v55[v63] = word_4EE150[i]; | |
1336 } | |
1337 } | |
1338 if ( v63 ) | |
1339 { | |
1340 if ( dword_A74CDC == -1 ) | |
1341 dword_A74CDC = rand() % v63; | |
1342 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; | |
1343 } | |
1344 else | |
1345 pText = (char *)pNPCTopics[55].pText; | |
1346 strcat(pTmpBuf2.data(), pText); | |
1347 dst = strlen(pTmpBuf2.data()); | |
1348 i += 2; | |
1349 break; | |
1350 case 9: | |
1351 if ( npc->uSex ) | |
1352 pText = pGlobalTXT_LocalizationStrings[384];// "her" | |
1353 else | |
1354 pText = pGlobalTXT_LocalizationStrings[383];// "his" | |
1355 strcat(pTmpBuf2.data(), pText); | |
1356 dst = strlen(pTmpBuf2.data()); | |
1357 i += 2; | |
1358 break; | |
1359 case 10: | |
1360 if ( pPlayer->uSex ) | |
1361 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
1362 else | |
1363 pText = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
1364 strcat(pTmpBuf2.data(), pText); | |
1365 dst = strlen(pTmpBuf2.data()); | |
1366 i += 2; | |
1367 break; | |
1368 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
|
1369 pReputation = pParty->GetPartyReputation(); |
1453 | 1370 if ( pReputation >= 25 ) |
1371 pText = pGlobalTXT_LocalizationStrings[379]; | |
1372 else//v25 < 25 | |
1373 { | |
1374 if ( pReputation < 6 ) | |
1375 { | |
1376 if ( pReputation >= -5 )//6 >= v25 >= -5 | |
1377 pText = pGlobalTXT_LocalizationStrings[399]; | |
1378 else// v25 < -5 | |
0 | 1379 { |
1453 | 1380 if ( pReputation < -24 )//-24 > v25 |
1381 pText = pGlobalTXT_LocalizationStrings[434]; | |
1382 else// -5 > v25 > -24 | |
1383 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 1384 } |
1453 | 1385 } |
1386 else//25 > v25 > 6 | |
1387 pText = pGlobalTXT_LocalizationStrings[392]; | |
1388 } | |
1389 strcat(pTmpBuf2.data(), pText); | |
1390 dst = strlen(pTmpBuf2.data()); | |
1391 i += 2; | |
1392 break; | |
1393 case 12: | |
1394 pReputation = npc->rep; | |
1395 if ( pReputation >= 25 ) | |
1396 pText = pGlobalTXT_LocalizationStrings[379]; | |
1397 else | |
1398 { | |
1399 if ( pReputation < 6 ) | |
1400 { | |
1401 if ( pReputation >= -5 ) | |
1402 pText = pGlobalTXT_LocalizationStrings[399]; | |
0 | 1403 else |
1404 { | |
1453 | 1405 if ( pReputation < -24 ) |
1406 pText = pGlobalTXT_LocalizationStrings[434]; | |
1407 else | |
1408 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 1409 } |
1410 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1411 else |
1453 | 1412 pText = pGlobalTXT_LocalizationStrings[392]; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1413 } |
1453 | 1414 strcat(pTmpBuf2.data(), pText); |
1415 dst = strlen(pTmpBuf2.data()); | |
1416 i += 2; | |
1417 break; | |
1418 case 13: | |
1419 strcat(pTmpBuf2.data(), sub_495366(pPlayer->pName[0], pPlayer->uSex)); | |
1420 dst = strlen(pTmpBuf2.data()); | |
1421 i += 2; | |
1422 break; | |
1423 case 14: | |
1424 if ( npc->uSex ) | |
1425 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
1426 else | |
1427 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
1428 strcat(pTmpBuf2.data(), pText); | |
1429 dst = strlen(pTmpBuf2.data()); | |
1430 i += 2; | |
1431 break; | |
1432 case 15: | |
1433 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" | |
1434 dst = strlen(pTmpBuf2.data()); | |
1435 i += 2; | |
1436 break; | |
1437 case 16: | |
1438 if ( npc->uSex ) | |
1439 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
1440 else | |
1441 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
1442 strcat(pTmpBuf2.data(), pText); | |
1443 dst = strlen(pTmpBuf2.data()); | |
1444 i += 2; | |
1445 break; | |
1446 case 17://òåêñò íà¸ìíîãî ÍÏÑ | |
1447 { | |
2115 | 1448 uint pay_percentage = pNPCStats->pProfessions[npc->uProfession].uHirePrice / 100; |
1453 | 1449 if ( !pay_percentage ) |
1450 pay_percentage = 1; | |
1451 sprintf(a1, "%lu", pay_percentage); | |
1452 strcat(pTmpBuf2.data(), a1); | |
1453 dst = strlen(pTmpBuf2.data()); | |
1454 i += 2; | |
1455 break; | |
1456 } | |
1457 case 18: | |
1458 case 19: | |
1459 case 20: | |
1460 case 21: | |
1461 case 22: | |
1462 case 26: | |
1463 strncpy(a1, lpsz + i + 1, 2); | |
1464 sprintf(a1, "%lu", atoi(a1)); | |
1465 strcat(pTmpBuf2.data(), a1); | |
1466 dst = strlen(pTmpBuf2.data()); | |
1467 i += 2; | |
1468 break; | |
1469 case 23: | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1470 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1471 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName; |
1453 | 1472 else |
1473 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" | |
1474 strcat(pTmpBuf2.data(), pText); | |
1475 dst = strlen(pTmpBuf2.data()); | |
1476 i += 2; | |
1477 break; | |
1478 case 24://íàçâàíèå òîâàðà â ïðîäàæå | |
2069 | 1479 sprintfex(a1, format_4E2D80, Color16(255, 255, 155), a3->GetDisplayName()); |
1453 | 1480 strcat(pTmpBuf2.data(), a1); |
1481 dst = strlen(pTmpBuf2.data()); | |
1482 i += 2; | |
1483 break; | |
1484 case 25: | |
1485 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
0 | 1486 switch ( a5 ) |
1453 | 1487 { |
1488 case 3: | |
1489 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1490 break; | |
1491 case 4: | |
1492 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1493 break; | |
1494 case 5: | |
1495 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1496 break; | |
1497 case 6: | |
1498 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
1499 break; | |
1500 } | |
1501 sprintfex(a1, "%lu", v29); | |
1502 strcat(pTmpBuf2.data(), a1); | |
1503 dst = strlen(pTmpBuf2.data()); | |
1504 i += 2; | |
1505 break; | |
1506 case 27://òåêñò ïðîäàæè | |
1507 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1508 if ( a5 == 3 ) | |
1509 { | |
1510 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
|
1511 if (a3->IsBroken()) |
1453 | 1512 v29 = 1; |
1513 sprintfex(a1, "%lu", v29); | |
1514 strcat(pTmpBuf2.data(), a1); | |
1515 dst = strlen(pTmpBuf2.data()); | |
1516 i += 2; | |
0 | 1517 break; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1518 } |
1453 | 1519 if ( a5 != 4 ) |
0 | 1520 { |
1453 | 1521 if ( a5 == 5 ) |
1522 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1523 else | |
1524 { | |
1525 if ( a5 == 6 ) | |
1526 { | |
1527 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
|
1528 if (a3->IsBroken()) |
1453 | 1529 v29 = 1; |
1530 if (!v29) | |
1531 v29 = 1; | |
1532 sprintfex(a1, "%lu", v29); | |
1533 strcat(pTmpBuf2.data(), a1); | |
1534 dst = strlen(pTmpBuf2.data()); | |
1535 i += 2; | |
1536 break; | |
1537 } | |
1538 } | |
1539 sprintfex(a1, "%lu", v29); | |
1540 strcat(pTmpBuf2.data(), a1); | |
1541 dst = strlen(pTmpBuf2.data()); | |
1542 i += 2; | |
1543 break; | |
0 | 1544 } |
1453 | 1545 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
1546 strcat(pTmpBuf2.data(), a1); | |
1547 dst = strlen(pTmpBuf2.data()); | |
1548 i += 2; | |
1549 break; | |
1550 case 28://ïðîôåññèÿ | |
1551 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); | |
1552 dst = strlen(pTmpBuf2.data()); | |
1553 i += 2; | |
1554 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1555 case 29: |
1453 | 1556 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
1557 strcat(pTmpBuf2.data(), a1); | |
1558 dst = strlen(pTmpBuf2.data()); | |
1559 i += 2; | |
1560 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1561 case 30: |
1453 | 1562 if ( !a6 ) |
1563 { | |
1564 strcat(pTmpBuf2.data(), a4); | |
1565 dst = strlen(pTmpBuf2.data()); | |
1566 i += 2; | |
1567 break; | |
1568 } | |
1459 | 1569 init_summoned_item(&v56, *a6); |
1453 | 1570 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
1571 strcat(pTmpBuf2.data(), a1); | |
1572 dst = strlen(pTmpBuf2.data()); | |
1573 i += 2; | |
1574 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1575 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1576 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1577 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1578 case 34: |
1453 | 1579 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); |
1580 dst = strlen(pTmpBuf2.data()); | |
1581 i += 2; | |
1582 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1583 default: |
0 | 1584 if ( v17 <= 50 || v17 > 70 ) |
1453 | 1585 { |
1586 strncpy(a1, lpsz + i + 1, 2); | |
1587 sprintf(a1, "%lu", atoi(a1)); | |
1588 strcat(pTmpBuf2.data(), a1); | |
1589 dst = strlen(pTmpBuf2.data()); | |
1590 i += 2; | |
1591 break; | |
1592 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1593 if ( v17 - 51 >= 20 ) |
1453 | 1594 { |
1595 strcat(pTmpBuf2.data(), a4); | |
1596 dst = strlen(pTmpBuf2.data()); | |
1597 i += 2; | |
1598 break; | |
1599 } | |
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
|
1600 init_summoned_item(&v56, pParty->PartyTimes._s_times[v17-51]); |
1453 | 1601 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
1602 strcat(pTmpBuf2.data(), a1); | |
1603 dst = strlen(pTmpBuf2.data()); | |
1604 i += 2; | |
1605 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1606 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1607 } |
0 | 1608 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1609 return pTmpBuf2.data(); |
0 | 1610 } |
1611 | |
1612 //----- (0049B04D) -------------------------------------------------------- | |
734 | 1613 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 1614 { |
734 | 1615 //stru154 *v3; // edi@1 |
1616 //signed int v4; // eax@1 | |
1617 //signed int result; // eax@9 | |
1618 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 1619 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 1620 float v7; |
0 | 1621 |
1622 v.x = 0.0; | |
1623 v.y = 0.0; | |
1624 v.z = 0.0; | |
734 | 1625 GetFacePlane(a2, a3, &v, &v7); |
1626 | |
1627 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
1628 polygonType = POLYGON_VerticalWall; | |
1629 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
1630 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
1631 polygonType = POLYGON_Floor; | |
0 | 1632 else |
734 | 1633 polygonType = POLYGON_InBetweenFloorAndWall; |
1634 | |
1635 face_plane.vNormal.x = v.x; | |
1636 face_plane.vNormal.y = v.y; | |
1637 face_plane.vNormal.z = v.z; | |
1638 face_plane.dist = v7; | |
0 | 1639 } |
1640 | |
1641 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 1642 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 1643 { |
734 | 1644 if (fabsf(pNormal->z) < 1e-6f) |
1645 polygonType = POLYGON_VerticalWall; | |
1646 else if (fabsf(pNormal->x) < 1e-6f && | |
1647 fabsf(pNormal->y) < 1e-6f) | |
1648 polygonType = POLYGON_Floor; | |
0 | 1649 else |
734 | 1650 polygonType = POLYGON_InBetweenFloorAndWall; |
1651 | |
1652 face_plane.vNormal.x = pNormal->x; | |
1653 face_plane.dist = dist; | |
1654 face_plane.vNormal.y = pNormal->y; | |
1655 face_plane.vNormal.z = pNormal->z; | |
0 | 1656 } |
1657 | |
1658 //----- (0049B13D) -------------------------------------------------------- | |
734 | 1659 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 1660 { |
1661 Vec3_float_ *v19; // eax@3 | |
1662 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 | |
1663 float v26; // [sp+1Ch] [bp-4Ch]@3 | |
1664 float v27; // [sp+20h] [bp-48h]@3 | |
1665 float v28; // [sp+24h] [bp-44h]@3 | |
1666 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 | |
1667 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 | |
734 | 1668 |
0 | 1669 v1.x = 0.0; |
1670 v1.y = 0.0; | |
1671 v1.z = 0.0; | |
734 | 1672 |
1673 if (pFace->uNumVertices >= 2) | |
1674 { | |
2103 | 1675 for ( int i = 0; i < pFace->uNumVertices - 2; i++ ) |
734 | 1676 { |
2103 | 1677 v1.x = pVertices->pVertices[pFace->pVertexIDs[i + 1]].x - pVertices->pVertices[pFace->pVertexIDs[i]].x; |
1678 v1.y = pVertices->pVertices[pFace->pVertexIDs[i + 1]].y - pVertices->pVertices[pFace->pVertexIDs[i]].y; | |
1679 v1.z = pVertices->pVertices[pFace->pVertexIDs[i + 1]].z - pVertices->pVertices[pFace->pVertexIDs[i]].z; | |
1680 | |
1681 v26 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].x - pVertices->pVertices[pFace->pVertexIDs[i + 1]].x; | |
1682 v27 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].y - pVertices->pVertices[pFace->pVertexIDs[i + 1]].y; | |
1683 v28 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].z - pVertices->pVertices[pFace->pVertexIDs[i + 1]].z; | |
1684 | |
0 | 1685 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
1686 v38.x = v19->x; | |
1687 v38.y = v19->y; | |
1688 v38.z = v19->z; | |
734 | 1689 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
1690 { | |
1691 v38.Normalize(); | |
1692 | |
1693 pOutNormal->x = v38.x; | |
1694 pOutNormal->y = v38.y; | |
1695 pOutNormal->z = v38.z; | |
1696 | |
2103 | 1697 *pOutDist = -(pVertices->pVertices[pFace->pVertexIDs[i]].x * v38.x |
1698 + pVertices->pVertices[pFace->pVertexIDs[i]].y * v38.y | |
1699 + pVertices->pVertices[pFace->pVertexIDs[i]].z * v38.z); | |
734 | 1700 return; |
1701 } | |
1702 } | |
1703 } | |
1704 | |
2103 | 1705 pOutNormal->x = (double)(pFace->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.x >> 16); |
1706 pOutNormal->y = (double)(pFace->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.y >> 16); | |
1707 pOutNormal->z = (double)(pFace->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.z >> 16); | |
1708 *pOutDist = (double)(pFace->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.dist >> 16); | |
0 | 1709 } |
1710 | |
1711 //----- (0049D700) -------------------------------------------------------- | |
1712 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
1713 { | |
1714 int v2; // ecx@1 | |
1715 unsigned int v3; // eax@1 | |
1716 | |
1717 v2 = 0; | |
2103 | 1718 v3 = uDim - 1; |
0 | 1719 while ( v3 & 1 ) |
1720 { | |
1721 v3 >>= 1; | |
1722 ++v2; | |
1723 } | |
1724 return v3 == 0 ? v2 : 0; | |
1725 } | |
1726 | |
1727 //----- (004A19D8) -------------------------------------------------------- | |
737 | 1728 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 1729 { |
737 | 1730 /*signed __int64 v2; // ST10_8@1 |
0 | 1731 double v3; // st7@1 |
1732 float v4; // ST24_4@1 | |
1733 double v5; // ST10_8@1 | |
1734 int v6; // ST1C_4@1 | |
1735 float v7; // ST24_4@1 | |
1736 double v8; // ST10_8@1 | |
1737 unsigned __int8 v9; // ST20_1@1 | |
1738 float v10; // ST24_4@1 | |
1739 double v11; // ST10_8@1 | |
1740 float v12; // ST24_4@1 | |
737 | 1741 double v13; // ST08_8@1*/ |
1742 | |
1743 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
1744 (a2 >> 24) / 255.0f * 255.0f), | |
1745 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
1746 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
1747 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
1748 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
1749 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
1750 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
1751 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
1752 /*v2 = a1 >> 24; | |
1753 v3 = (double)v2 / 255.0f; | |
1754 HIDWORD(v2) = 0; | |
0 | 1755 LODWORD(v2) = a2 >> 24; |
737 | 1756 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 1757 v5 = v4 + 6.7553994e15; |
1758 v6 = LODWORD(v5); | |
737 | 1759 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 1760 v8 = v7 + 6.7553994e15; |
1761 v9 = LOBYTE(v8); | |
737 | 1762 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 1763 v11 = v10 + 6.7553994e15; |
737 | 1764 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 1765 v13 = v12 + 6.7553994e15; |
737 | 1766 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 1767 } |
1768 | |
2069 | 1769 void Present32(unsigned __int32 *src, unsigned int src_pitch, |
1770 unsigned __int32 *dst, unsigned int dst_pitch) | |
0 | 1771 { |
2069 | 1772 for (uint y = 0; y < 8; ++y) |
1773 memcpy(dst + y * dst_pitch, | |
1774 src + y * src_pitch, src_pitch * sizeof(__int32)); | |
0 | 1775 |
2069 | 1776 for (uint y = 8; y < 352; ++y) |
0 | 1777 { |
2069 | 1778 memcpy(dst + y * dst_pitch, |
1779 src + y * src_pitch, 8 * sizeof(__int32)); | |
1780 memcpy(dst + 8 + game_viewport_width + y * dst_pitch, | |
1781 src + 8 + game_viewport_width + y * src_pitch, 174/*172*/ * sizeof(__int32)); | |
0 | 1782 } |
1783 | |
2069 | 1784 for (uint y = 352; y < 480; ++y) |
1785 memcpy(dst + y * dst_pitch, | |
1786 src + y * src_pitch, src_pitch * sizeof(__int32)); | |
0 | 1787 |
2069 | 1788 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
1789 { | |
1790 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) | |
1791 { | |
1792 //if (src[x + y * src_pitch] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
1793 if (src[x + y * src_pitch] != 0xFFF8FCF8) // FFF8FCF8 = Color32(Color16(g_mask | b_mask)) | |
1794 dst[x + y * dst_pitch] = src[x + y * src_pitch]; | |
1795 } | |
1796 } | |
0 | 1797 } |
1798 | |
1799 //----- (004A597D) -------------------------------------------------------- | |
1800 void Present_NoColorKey() | |
1801 { | |
1802 //unsigned __int16 *v0; // eax@4 | |
1803 unsigned __int16 *v1; // esi@4 | |
1804 void *v2; // edi@4 | |
1805 //signed int v4; // ebx@4 | |
1806 //signed int v5; // ebx@6 | |
1807 //void *v6; // edi@7 | |
1808 //const void *v7; // esi@7 | |
1809 signed int v8; // ebx@8 | |
1810 int v9; // eax@10 | |
1811 unsigned int v10; // esi@10 | |
1812 unsigned __int32 v11; // edi@10 | |
1813 //int v12; // ecx@10 | |
1814 unsigned int v13; // ebx@10 | |
1815 int v14; // eax@11 | |
1816 int v15; // eax@13 | |
1817 int v16; // eax@14 | |
1818 int v17; // eax@16 | |
1819 HRESULT v18; // eax@22 | |
1820 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
2069 | 1821 //int v20; // [sp+88h] [bp-1Ch]@10 |
0 | 1822 int v21; // [sp+8Ch] [bp-18h]@10 |
1823 __int32 v22; // [sp+90h] [bp-14h]@10 | |
1824 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
1825 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
1826 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
1827 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
1828 | |
2132 | 1829 int r_mask = 0xF800; |
1830 int g_mask = 0x7E0; | |
1831 int b_mask = 0x1F; | |
1832 | |
0 | 1833 if ( !pRenderer->uNumSceneBegins ) |
1834 { | |
2069 | 1835 if ( pRenderer->using_software_screen_buffer ) |
0 | 1836 { |
1837 memset(&Dst, 0, 0x7Cu); | |
1838 Dst.dwSize = 124; | |
168 | 1839 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 1840 { |
1841 //v26 = Dst.lpSurface; | |
2069 | 1842 //pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; |
2132 | 1843 v24 = g_mask | b_mask | ((g_mask | b_mask) << 16); |
2069 | 1844 //pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; |
1845 //pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
1846 //v1 = pRenderer->pTargetSurface; | |
0 | 1847 v2 = Dst.lpSurface; |
1848 | |
1849 | |
1850 /*for (uint y = 0; y < 480; ++y) | |
1851 { | |
1852 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
1853 for (uint x = 0; x < 640; ++x) | |
1854 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
1855 }*/ | |
2069 | 1856 |
1857 if (!FORCE_16_BITS) | |
1858 Present32((unsigned __int32 *)pRenderer->pTargetSurface, pRenderer->uTargetSurfacePitch, (unsigned __int32 *)Dst.lpSurface, Dst.lPitch / 4); | |
1859 else | |
1860 { | |
1861 ushort* pSrc = (unsigned short *)pRenderer->pTargetSurface; | |
1980 | 1862 short* pDst = (__int16 *)Dst.lpSurface; |
0 | 1863 |
1864 for (uint y = 0; y < 8; ++y) | |
1865 memcpy(pDst + y * Dst.lPitch / 2, | |
1866 | |
1867 pSrc + y * 640, 640 * sizeof(__int16)); | |
1868 | |
1869 for (uint y = 8; y < 352; ++y) | |
1870 { | |
1871 memcpy(pDst + y * Dst.lPitch / 2, | |
1872 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 1873 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
1874 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 1875 } |
1876 | |
121 | 1877 for (uint y = 352; y < 480; ++y) |
0 | 1878 memcpy(pDst + y * Dst.lPitch / 2, |
1879 pSrc + y * 640, 640 * sizeof(__int16)); | |
1880 | |
1881 | |
1980 | 1882 ushort* pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 1883 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
1980 | 1884 short* pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 1885 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 1886 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 1887 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
1888 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
1889 v21 = 4 * v9 + 1280; | |
1890 | |
121 | 1891 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 1892 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
1893 v10 = (int)pSrc_x1y1; | |
1894 v11 = (int)pDst_x1y1; | |
2069 | 1895 int uHalfWidth = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 1896 v13 = v24; |
1897 | |
693 | 1898 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 1899 { |
1900 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
1901 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 1902 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 1903 { |
2132 | 1904 if (pSrc[y * 640 + x] != (g_mask | b_mask)) |
0 | 1905 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; |
1906 } | |
1907 } | |
2069 | 1908 } |
0 | 1909 |
1910 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
1911 | |
1912 /* while ( 1 ) | |
1913 { | |
1914 while ( 1 ) | |
1915 { | |
1916 v14 = *(int *)v10; | |
1917 v10 += 4; | |
1918 if ( v14 == v13 ) | |
1919 break; | |
1920 if ( (short)v14 == (short)v13 ) | |
1921 { | |
1922 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
1923 v11 += 4; | |
1924 --uHalfWidth; | |
1925 if ( !uHalfWidth ) | |
1926 goto LABEL_21; | |
1927 } | |
1928 else | |
1929 { | |
1930 v15 = __ROL__(v14, 16); | |
1931 if ( (short)v15 == (short)v13 ) | |
1932 { | |
1933 v17 = __ROR__(v15, 16); | |
1934 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
1935 v11 += 4; | |
1936 --uHalfWidth; | |
1937 if ( !uHalfWidth ) | |
1938 goto LABEL_21; | |
1939 } | |
1940 else | |
1941 { | |
1942 v16 = __ROR__(v15, 16); | |
1943 *(int *)v11 = v16; | |
1944 v11 += 4; | |
1945 --uHalfWidth; | |
1946 if ( !uHalfWidth ) | |
1947 goto LABEL_21; | |
1948 } | |
1949 } | |
1950 } | |
1951 v11 += 4; | |
1952 --uHalfWidth; | |
1953 if ( !uHalfWidth ) | |
1954 { | |
1955 LABEL_21: | |
1956 v10 += v21; | |
1957 v11 += v22; | |
1958 uHalfWidth = v20; | |
1959 if ( !--uNumLines ) | |
1960 { | |
1961 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
1962 return; | |
1963 } | |
1964 } | |
1965 }*/ | |
1966 } | |
1967 } | |
1968 } | |
1969 } | |
1970 | |
1971 //----- (004A7063) -------------------------------------------------------- | |
1390 | 1972 unsigned int ModulateColor(unsigned int diffuse, float multiplier) |
0 | 1973 { |
1390 | 1974 float alpha = multiplier * ((diffuse >> 24) & 0xFF); |
1975 int a = (int)floorf(alpha + 0.5f); | |
1976 a = max(0, min(255, a)); | |
1977 | |
1978 float red = multiplier * ((diffuse >> 16) & 0xFF); | |
1979 int r = (int)floorf(red + 0.5f); | |
1980 r = max(0, min(255, r)); | |
1981 | |
1982 float green = multiplier * ((diffuse >> 8) & 0xFF); | |
1983 int g = (int)floorf(green + 0.5f); | |
1984 g = max(0, min(255, g)); | |
1985 | |
1986 float blue = multiplier * ((diffuse >> 0) & 0xFF); | |
1987 int b = (int)floorf(blue + 0.5f); | |
1988 b = max(0, min(255, b)); | |
1989 | |
1990 return (a << 24) | (r << 16) | (g << 8) | b; | |
0 | 1991 } |
1992 | |
1993 //----- (004B1447) -------------------------------------------------------- | |
1754 | 1994 void sub_4B1447_party_fine(int a1, int a2, int a3) |
0 | 1995 { |
1996 signed int v3; // esi@1 | |
1997 char v4; // sf@8 | |
1998 int v5; // eax@8 | |
1999 unsigned __int64 v6; // qax@12 | |
2000 DDM_DLV_Header *v7; // eax@14 | |
2001 | |
2002 v3 = 0; | |
2003 if ( a2 ) | |
2004 { | |
1754 | 2005 if ( a2 == 1 ) |
2006 v3 = 2; | |
2007 if ( a2 == 2 ) | |
2008 v3 = 2; | |
2117 | 2009 goto LABEL_13; |
0 | 2010 } |
2011 else | |
2012 v3 = 1; | |
2013 if ( pParty->uFine < 4000000 ) | |
2014 { | |
2015 v4 = a3 + pParty->uFine < 0; | |
2016 v5 = a3 + pParty->uFine; | |
2017 pParty->uFine += a3; | |
2018 if ( v4 ) | |
2019 { | |
2020 v5 = 0; | |
2021 pParty->uFine = 0; | |
2022 } | |
2023 if ( v5 > 4000000 ) | |
2024 pParty->uFine = 4000000; | |
2025 } | |
487 | 2026 |
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
|
2027 pParty->PartyTimes._shop_ban_times[a1] = pParty->uTimePlayed + 368640; |
487 | 2028 |
0 | 2029 LABEL_13: |
463 | 2030 pParty->InTheShopFlags[a1] = 1; |
0 | 2031 if ( v3 ) |
2032 { | |
2033 v7 = &pOutdoor->ddm; | |
2034 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
2035 v7 = &pIndoor->dlv; | |
2036 v7->uReputation += v3; | |
2037 if ( v7->uReputation > 10000 ) | |
2038 v7->uReputation = 10000; | |
2039 } | |
1754 | 2040 for ( uint i = 1; i <= 4; ++i ) |
0 | 2041 { |
2042 if ( pParty->uFine ) | |
2043 { | |
1754 | 2044 if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) ) |
2045 _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); | |
0 | 2046 } |
2047 } | |
2048 } | |
2049 | |
2050 //----- (004B1523) -------------------------------------------------------- | |
1458 | 2051 void sub_4B1523(int *_this) |
0 | 2052 { |
2053 int v1; // esi@1 | |
2054 int v2; // edx@1 | |
2055 unsigned int v3; // eax@2 | |
2056 int v4; // eax@4 | |
2057 LONG v5; // ecx@4 | |
2058 int v6; // eax@10 | |
2059 char *v7; // ST44_4@12 | |
2060 unsigned __int16 v8; // ax@12 | |
2061 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
2062 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
2063 POINT a2; // [sp+64h] [bp-10h]@1 | |
2064 int v13; // [sp+6Ch] [bp-8h]@4 | |
2065 int v14; // [sp+70h] [bp-4h]@4 | |
2066 | |
2067 v1 = *_this - 399; | |
2068 v2 = (*_this - 400) % 11 + 1; | |
2069 v11 = 4 * (*_this - 400) / 11; | |
1312 | 2070 // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used |
0 | 2071 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) |
2072 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
2073 else | |
2074 v3 = 30; | |
2075 a1.Hint = 0; | |
2076 a1.uFrameY = v3; | |
2077 a1.uFrameWidth = 328; | |
2078 a1.uFrameHeight = 68; | |
2079 a1.uFrameX = 90; | |
2080 a1.uFrameZ = 417; | |
2081 a1.uFrameW = v3 + 67; | |
2082 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
2083 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
2084 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
2085 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
2086 v5 = a2.y; | |
2087 if ( v14 > a2.y ) | |
2088 v5 = v14; | |
2089 if ( v13 > v5 ) | |
2090 v5 = v13; | |
2091 if ( v4 > v5 ) | |
2092 v5 = v4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2093 sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", |
262 | 2094 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" |
2095 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
2096 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
2097 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
2098 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2099 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); |
0 | 2100 a1.uFrameHeight += v6; |
2101 if ( (signed int)a1.uFrameHeight < 150 ) | |
2102 a1.uFrameHeight = 150; | |
819 | 2103 a1.uFrameWidth = game_viewport_width; |
0 | 2104 a1.DrawMessageBox(0); |
2105 a1.uFrameWidth -= 12; | |
2106 a1.uFrameHeight -= 12; | |
2107 v7 = pSpellStats->pInfos[v1].pName; | |
2108 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
2109 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
2069 | 2110 v8 = Color16(0xFFu, 0xFFu, 0x9Bu); |
0 | 2111 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2112 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); |
0 | 2113 a1.uFrameZ = a1.uFrameX + 107; |
2114 a1.uFrameWidth = 108; | |
2115 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
1393 | 2116 sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2117 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); |
0 | 2118 } |
2119 | |
2120 //----- (004B1ECE) -------------------------------------------------------- | |
1459 | 2121 void OracleDialogue() |
0 | 2122 { |
2123 __int16 *v0; // edi@1 | |
2124 int v1; // ebx@3 | |
2125 Player *v2; // esi@3 | |
2126 int v3; // eax@4 | |
2127 signed int v4; // eax@9 | |
2128 int v5; // ebx@11 | |
89 | 2129 Player *v6; // esi@13 |
2130 ItemGen *v7; // eax@14 | |
0 | 2131 signed int v8; // edi@14 |
89 | 2132 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 2133 signed int v10; // [sp+10h] [bp-8h]@13 |
2134 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 2135 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 2136 |
484 | 2137 contract_approved = 0; |
0 | 2138 v11 = 0; |
2139 uDialogueType = 84; | |
827 | 2140 current_npc_text = (char *)pNPCTopics[667].pText; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2141 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); |
2102 | 2142 //while ( 1 ) |
2143 for ( uint i = 0; i <= 53; i++ ) | |
0 | 2144 { |
484 | 2145 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 2146 { |
2102 | 2147 //v1 = 0; |
2148 //v2 = pParty->pPlayers.data(); | |
2149 for ( uint pl = 0; pl < 4; pl++ ) | |
0 | 2150 { |
2102 | 2151 //LOBYTE(v3) = pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
2152 if ( pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)) ) | |
0 | 2153 break; |
2102 | 2154 //++v2; |
2155 //++v1; | |
0 | 2156 } |
2102 | 2157 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); |
2158 //if ( v1 == 4 ) | |
2159 //break; | |
0 | 2160 } |
2161 ++v11; | |
2102 | 2162 //v0 += 2; |
2163 //if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
2164 //break; | |
89 | 2165 } |
2166 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
2167 { | |
827 | 2168 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 2169 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 2170 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 2171 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
2172 } | |
484 | 2173 if ( contract_approved == 601 ) |
0 | 2174 { |
2175 v5 = 0; | |
2102 | 2176 //v12 = pParty->pPlayers.data();//[0].uClass; |
0 | 2177 v9 = 0; |
2102 | 2178 //while ( 1 ) |
2179 for ( uint i = 0; i < 4; i++ ) | |
0 | 2180 { |
2102 | 2181 if ( pParty->pPlayers[i].classType == PLAYER_CLASS_LICH ) |
0 | 2182 { |
2183 v10 = 0; | |
2102 | 2184 //v6 = pParty->pPlayers.data();//[0].pInventoryItems[0].field_1A; |
2185 for ( uint pl = 0; pl < 4; pl++ ) | |
0 | 2186 { |
2102 | 2187 for ( v8 = 0; v8 < 126; v8++ )//138 |
0 | 2188 { |
2102 | 2189 if ( pParty->pPlayers[pl].pInventoryItemList[v8].uItemID == ITEM_LICH_JAR_FULL ) |
0 | 2190 { |
2102 | 2191 if ( !pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer ) |
2192 v9 = &pParty->pPlayers[pl].pInventoryItemList[v8]; | |
2193 if ( pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer == v5 ) | |
0 | 2194 v10 = 1; |
2195 } | |
2196 } | |
89 | 2197 } |
0 | 2198 if ( !v10 ) |
2199 break; | |
2200 } | |
2102 | 2201 // ++v12; |
0 | 2202 ++v5; |
2102 | 2203 // if ( v12 > &pParty->pPlayers[3] ) |
2204 // return; | |
0 | 2205 } |
2206 if ( v9 ) | |
377 | 2207 v9->uHolderPlayer = v5; |
0 | 2208 } |
2209 } | |
2210 | |
2211 //----- (004B254D) -------------------------------------------------------- | |
1458 | 2212 char * _4B254D_SkillMasteryTeacher(int _this) |
0 | 2213 { |
955 | 2214 //Player *v1; // esi@1 |
0 | 2215 int v2; // edx@1 |
2216 int v3; // ecx@1 | |
2217 int v4; // edi@1 | |
955 | 2218 int pClassType; // eax@7 |
0 | 2219 int v6; // eax@7 |
2220 int v7; // ebx@7 | |
955 | 2221 //int v8; // ebx@8 |
0 | 2222 signed int v9; // esi@8 |
2223 int v10; // eax@8 | |
2224 char *v11; // ecx@8 | |
2102 | 2225 //int v12; // edi@9 |
2226 //char *v13; // edx@9 | |
0 | 2227 signed int v14; // edi@10 |
2228 unsigned int v16; // eax@29 | |
955 | 2229 //int v17; // eax@36 |
0 | 2230 char v18; // cl@46 |
2231 __int16 v19; // dx@56 | |
2232 int v20; // eax@60 | |
955 | 2233 //char *v21; // [sp-Ch] [bp-38h]@82 |
2234 //const char *v22; // [sp-8h] [bp-34h]@21 | |
2235 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
2236 //char *v24; // [sp-8h] [bp-34h]@82 | |
1838 | 2237 const char *v25; // [sp-4h] [bp-30h]@14 |
955 | 2238 //int v26; // [sp-4h] [bp-30h]@38 |
2239 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 2240 char v28[4]; // [sp+Ch] [bp-20h]@9 |
2241 int v29; // [sp+10h] [bp-1Ch]@13 | |
2242 int v30; // [sp+14h] [bp-18h]@15 | |
2243 int v31; // [sp+18h] [bp-14h]@16 | |
2244 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 2245 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 2246 int v34; // [sp+24h] [bp-8h]@7 |
2247 char *v35; // [sp+28h] [bp-4h]@1 | |
2248 | |
484 | 2249 contract_approved = 0; |
0 | 2250 v2 = (_this - 200) % 3; |
2251 v3 = (_this - 200) / 3; | |
2252 v4 = v2; | |
2253 v35 = (char *)pNPCTopics[127].pText; | |
492 | 2254 dword_F8B1AC_award_bit_number = v3; |
0 | 2255 if ( v2 ) |
2256 { | |
2257 if ( v2 == 1 ) | |
2258 { | |
267 | 2259 gold_transaction_amount = 5000; |
0 | 2260 dword_F8B1B0 = 3; |
2261 } | |
2262 else | |
2263 { | |
2264 if ( v2 == 2 ) | |
2265 { | |
267 | 2266 gold_transaction_amount = 8000; |
0 | 2267 dword_F8B1B0 = 4; |
2268 } | |
2269 } | |
2270 } | |
2271 else | |
2272 { | |
267 | 2273 gold_transaction_amount = 2000; |
0 | 2274 dword_F8B1B0 = 2; |
2275 } | |
955 | 2276 pClassType = pPlayers[uActiveCharacter]->classType; |
2277 //v33 = pClassType; | |
2278 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
2279 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 2280 v7 = a1[0] & 0x3F; |
2281 v34 = v2 + 2; | |
2282 if ( v6 < v2 + 2 ) | |
2283 { | |
955 | 2284 //v8 = v33; |
2102 | 2285 |
955 | 2286 v10 = pClassType - pClassType % 4; |
2287 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
2102 | 2288 for ( v9 = 0; v9 < 4; ++v9 ) |
0 | 2289 { |
2102 | 2290 v28[4 * v9] = 0; |
2291 if ( (unsigned __int8)*v11 < v34 ) | |
0 | 2292 { |
2293 v14 = 1; | |
2294 } | |
2295 else | |
2296 { | |
2297 v14 = 1; | |
2102 | 2298 v28[4 * v9] = 1; |
0 | 2299 } |
2300 v11 += 37; | |
2301 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
2302 __debugbreak(); // warning C4700: uninitialized local variable 'v29' used |
0 | 2303 if ( v29 == v14 ) |
2304 { | |
2305 v25 = pClassNames[v10 + 1]; | |
2306 } | |
2307 else | |
2308 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
2309 __debugbreak(); // warning C4700: uninitialized local variable 'v30' used |
955 | 2310 if ( v30 == v14 )//crash |
0 | 2311 { |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
2312 __debugbreak(); // warning C4700: uninitialized local variable 'v31' used |
0 | 2313 if ( v31 == v14 ) |
2314 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2315 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2316 return pTmpBuf.data(); |
0 | 2317 } |
2318 v25 = pClassNames[v10 + 2]; | |
2319 } | |
2320 else | |
2321 { | |
2322 if ( v31 != v14 ) | |
2323 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2324 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2325 return pTmpBuf.data(); |
0 | 2326 } |
2327 v25 = pClassNames[v10 + 3]; | |
2328 } | |
2329 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2330 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2331 return pTmpBuf.data(); |
0 | 2332 } |
955 | 2333 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 2334 return (char *)pNPCTopics[122].pText; |
2335 if ( !v7 ) | |
2336 return (char *)pNPCTopics[131].pText; | |
2337 v16 = SkillToMastery(a1[0]); | |
2338 if ( (signed int)v16 > v4 + 1 ) | |
2339 return (char *)pNPCTopics[v4 + 128].pText; | |
2340 if ( v34 != 2 ) | |
2341 { | |
2342 if ( v34 == 3 ) | |
2343 { | |
2344 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
2345 { | |
492 | 2346 switch ( dword_F8B1AC_award_bit_number ) |
0 | 2347 { |
2348 case 12: | |
2349 case 13: | |
2350 case 14: | |
2351 case 15: | |
2352 case 16: | |
2353 case 17: | |
2354 case 18: | |
267 | 2355 gold_transaction_amount = 4000; |
0 | 2356 goto LABEL_42; |
2357 case 19: | |
2358 v19 = 114; | |
955 | 2359 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
2360 return v35; | |
2361 if ( !gold_transaction_amount ) | |
2362 goto LABEL_79; | |
2363 goto LABEL_42; | |
0 | 2364 case 20: |
2365 v19 = 110; | |
484 | 2366 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 2367 return v35; |
955 | 2368 if ( !gold_transaction_amount ) |
2369 goto LABEL_79; | |
2370 goto LABEL_42; | |
0 | 2371 case 22: |
955 | 2372 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
2373 if ( v20 < 50 ) | |
2374 return v35; | |
2375 if ( !gold_transaction_amount ) | |
2376 goto LABEL_79; | |
2377 goto LABEL_42; | |
0 | 2378 case 24: |
267 | 2379 gold_transaction_amount = 2500; |
955 | 2380 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 2381 if ( v20 < 50 ) |
2382 return v35; | |
955 | 2383 if ( !gold_transaction_amount ) |
2384 goto LABEL_79; | |
2385 goto LABEL_42; | |
2386 case 36: | |
2387 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
2388 if ( v20 < 50 ) | |
2389 return v35; | |
2390 if ( !gold_transaction_amount ) | |
2391 goto LABEL_79; | |
2392 goto LABEL_42; | |
0 | 2393 case 21: |
2394 case 23: | |
2395 case 25: | |
2396 case 26: | |
2397 case 29: | |
2398 case 32: | |
2399 case 34: | |
2400 case 35: | |
267 | 2401 gold_transaction_amount = 2500; |
0 | 2402 goto LABEL_42; |
2403 case 8: | |
2404 case 9: | |
2405 case 10: | |
2406 case 11: | |
267 | 2407 gold_transaction_amount = 3000; |
0 | 2408 goto LABEL_42; |
2409 case 7: | |
955 | 2410 gold_transaction_amount = 0; |
2411 if ( !gold_transaction_amount ) | |
2412 goto LABEL_79; | |
2413 goto LABEL_42; | |
2414 default: | |
2415 if ( !gold_transaction_amount ) | |
2416 goto LABEL_79; | |
2417 goto LABEL_42; | |
0 | 2418 } |
955 | 2419 gold_transaction_amount = 0; |
2420 if ( !gold_transaction_amount ) | |
2421 goto LABEL_79; | |
2422 goto LABEL_42; | |
0 | 2423 } |
2424 } | |
2425 else | |
2426 { | |
2427 if ( v34 != 4 ) | |
2428 { | |
955 | 2429 if ( !gold_transaction_amount ) |
2430 goto LABEL_79; | |
2431 goto LABEL_42; | |
0 | 2432 } |
2433 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
2434 { | |
492 | 2435 switch ( dword_F8B1AC_award_bit_number ) |
0 | 2436 { |
2437 case 19: | |
1355 | 2438 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) == 1 ) |
955 | 2439 { |
2440 if ( !gold_transaction_amount ) | |
2441 goto LABEL_79; | |
2442 goto LABEL_42; | |
2443 } | |
1355 | 2444 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1) == 1 ) |
955 | 2445 { |
2446 if ( !gold_transaction_amount ) | |
2447 goto LABEL_79; | |
2448 goto LABEL_42; | |
2449 } | |
2450 return v35; | |
0 | 2451 case 20: |
1355 | 2452 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) == 1 ) |
955 | 2453 { |
2454 if ( !gold_transaction_amount ) | |
2455 goto LABEL_79; | |
2456 goto LABEL_42; | |
2457 } | |
1355 | 2458 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1) == 1 ) |
955 | 2459 { |
2460 if ( !gold_transaction_amount ) | |
2461 goto LABEL_79; | |
2462 goto LABEL_42; | |
2463 } | |
0 | 2464 return v35; |
2465 case 30: | |
955 | 2466 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 2467 if ( (v18 & 0x3Fu) < 0xA ) |
2468 return v35; | |
955 | 2469 if ( !gold_transaction_amount ) |
2470 goto LABEL_79; | |
2471 goto LABEL_42; | |
2472 case 31: | |
2473 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
2474 if ( (v18 & 0x3Fu) < 0xA ) | |
2475 return v35; | |
2476 if ( !gold_transaction_amount ) | |
2477 goto LABEL_79; | |
2478 goto LABEL_42; | |
0 | 2479 case 21: |
2480 case 23: | |
2481 case 24: | |
2482 case 25: | |
2483 case 26: | |
2484 case 29: | |
2485 case 32: | |
2486 case 34: | |
2487 case 35: | |
267 | 2488 gold_transaction_amount = 6000; |
0 | 2489 goto LABEL_42; |
2490 case 8: | |
2491 case 9: | |
2492 case 10: | |
2493 case 11: | |
267 | 2494 gold_transaction_amount = 7000; |
0 | 2495 goto LABEL_42; |
2496 case 7: | |
2497 break; | |
955 | 2498 default: |
2499 if ( !gold_transaction_amount ) | |
2500 goto LABEL_79; | |
2501 goto LABEL_42; | |
0 | 2502 } |
267 | 2503 gold_transaction_amount = 0; |
955 | 2504 if ( !gold_transaction_amount ) |
2505 goto LABEL_79; | |
2506 goto LABEL_42; | |
0 | 2507 } |
2508 } | |
2509 return v35; | |
2510 } | |
2511 if ( v7 < 4 ) | |
2512 return v35; | |
492 | 2513 if ( dword_F8B1AC_award_bit_number > 27 ) |
2514 { | |
2515 if ( dword_F8B1AC_award_bit_number != 29 | |
2516 && dword_F8B1AC_award_bit_number != 32 | |
2517 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 2518 { |
267 | 2519 if ( !gold_transaction_amount ) |
0 | 2520 goto LABEL_79; |
2521 goto LABEL_42; | |
2522 } | |
267 | 2523 gold_transaction_amount = 500; |
955 | 2524 if ( !gold_transaction_amount ) |
2525 goto LABEL_79; | |
2526 goto LABEL_42; | |
0 | 2527 } |
492 | 2528 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 2529 { |
2530 gold_transaction_amount = 500; | |
2531 if ( !gold_transaction_amount ) | |
2532 goto LABEL_79; | |
2533 goto LABEL_42; | |
2534 } | |
492 | 2535 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 2536 { |
267 | 2537 gold_transaction_amount = 0; |
0 | 2538 goto LABEL_79; |
2539 } | |
492 | 2540 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 2541 { |
2542 if ( !gold_transaction_amount ) | |
2543 goto LABEL_79; | |
2544 goto LABEL_42; | |
2545 } | |
492 | 2546 if ( dword_F8B1AC_award_bit_number > 18 ) |
2547 { | |
2548 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 2549 { |
2550 if ( !gold_transaction_amount ) | |
2551 goto LABEL_79; | |
2552 goto LABEL_42; | |
2553 } | |
2554 gold_transaction_amount = 500; | |
2555 if ( !gold_transaction_amount ) | |
2556 goto LABEL_79; | |
2557 goto LABEL_42; | |
0 | 2558 } |
267 | 2559 gold_transaction_amount = 1000; |
0 | 2560 LABEL_42: |
267 | 2561 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 2562 return (char *)pNPCTopics[124].pText; |
2563 LABEL_79: | |
484 | 2564 contract_approved = 1; |
0 | 2565 if ( v34 == 2 ) |
2566 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2567 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
955 | 2568 pGlobalTXT_LocalizationStrings[433], 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
|
2569 return pTmpBuf2.data(); |
0 | 2570 } |
2571 if ( v34 == 3 ) | |
2572 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2573 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 2574 pGlobalTXT_LocalizationStrings[432], 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
|
2575 return pTmpBuf2.data(); |
0 | 2576 } |
2577 if ( v34 == 4 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2578 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 2579 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
|
2580 return pTmpBuf2.data(); |
0 | 2581 } |
2582 | |
2583 //----- (004B3E1E) -------------------------------------------------------- | |
1458 | 2584 void sub_4B3E1E() |
0 | 2585 { |
2586 NPCData *v0; // ST40_4@1 | |
2587 signed int v1; // edi@1 | |
165 | 2588 //GUIWindow *v2; // ecx@1 |
0 | 2589 |
167 | 2590 __debugbreak(); |
602 | 2591 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 2592 v1 = 0; |
2593 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
2594 pDialogueWindow->Release(); | |
165 | 2595 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 2596 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 2597 { |
832 | 2598 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 2599 v1 = 1; |
2600 } | |
832 | 2601 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 2602 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 2603 } |
2604 | |
2605 | |
2606 //----- (004B3FE5) -------------------------------------------------------- | |
1582 | 2607 void __fastcall _4B3FE5_training_dialogue(int a4) |
0 | 2608 { |
1838 | 2609 const char *v2; // edi@1 |
2102 | 2610 |
1411 | 2611 __debugbreak(); |
0 | 2612 uDialogueType = 78; |
827 | 2613 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 2614 _4B254D_SkillMasteryTeacher(a4); |
2615 pDialogueWindow->Release(); | |
2102 | 2616 pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, a4, 0); |
2617 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, | |
948 | 2618 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 2619 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
2102 | 2620 v2 = ""; |
484 | 2621 if ( contract_approved ) |
0 | 2622 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 2623 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 2624 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 2625 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 2626 } |
2627 // F8B19C: using guessed type int dword_F8B19C; | |
2628 // F8B1A8: using guessed type int dword_F8B1A8; | |
2629 | |
2630 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 2631 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
1411 | 2632 { |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
2633 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
2102 | 2634 pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, Str) + 11, 357, a5, Str, 0, 0, 0); |
0 | 2635 } |
2636 | |
2637 //----- (004B46F8) -------------------------------------------------------- | |
1459 | 2638 __int64 GetExperienceRequiredForLevel(int level) |
0 | 2639 { |
1459 | 2640 __int64 v1; // eax@1 |
0 | 2641 int i; // edx@1 |
2642 | |
2643 v1 = 0; | |
1459 | 2644 for ( i = 0; i < level; ++i ) |
0 | 2645 v1 += i + 1; |
2646 return 1000 * v1; | |
2647 } | |
2648 | |
2649 //----- (004BC49B) -------------------------------------------------------- | |
651 | 2650 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 2651 { |
2102 | 2652 NPCData *speakingNPC; // ebp@1 |
2653 int npc_event_id; // ecx@10 | |
2654 char *v13; // [sp-8h] [bp-18h]@60 | |
656 | 2655 |
2102 | 2656 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
2657 uDialogueType = newDialogueType; | |
2658 if (!speakingNPC->uFlags) | |
2659 speakingNPC->uFlags = 1; | |
2660 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
2661 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
2662 else if(newDialogueType == DIALOGUE_76) | |
2663 { | |
2664 if (speakingNPC->Hired()) | |
2665 { | |
2666 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
2667 { | |
2668 for ( uint i = 0; i < (unsigned int)pNPCStats->uNumNewNPCs; ++i ) | |
2669 { | |
2670 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName) ) | |
2671 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu; | |
2672 } | |
2673 } | |
2674 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
2675 memset(&pParty->pHirelings[0], 0, sizeof(NPCData)); | |
2676 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
2677 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); | |
2678 pParty->hirelingScrollPosition = 0; | |
2679 pParty->CountHirelings(); | |
2680 dword_591084 = 0; | |
2681 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2682 dword_7241C8 = 0; | |
2683 return; | |
2684 } | |
2685 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
2686 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" | |
2687 else | |
2688 { | |
2115 | 2689 if ( speakingNPC->uProfession != 51 ) //burglars have no hiring price |
2102 | 2690 { |
2115 | 2691 if ( pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice ) |
2102 | 2692 { |
2693 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
2694 dialogue_show_profession_details = false; | |
2695 uDialogueType = 13; | |
2696 if ( uActiveCharacter ) | |
2697 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
2698 if ( !dword_7241C8 ) | |
2699 pGame->Draw(); | |
2700 dword_7241C8 = 0; | |
2701 return; | |
2702 } | |
2115 | 2703 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice); |
2102 | 2704 } |
2705 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
2706 if ( pParty->pHirelings[0].pName ) | |
2707 { | |
2708 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
2709 v13 = pParty->pHireling2Name; | |
2710 } | |
2711 else | |
2712 { | |
2713 memcpy(&pParty->pHirelings[0], speakingNPC, sizeof(pParty->pHirelings[0])); | |
2714 v13 = pParty->pHireling1Name; | |
2715 } | |
2716 strcpy(v13, speakingNPC->pName); | |
2717 pParty->hirelingScrollPosition = 0; | |
2718 pParty->CountHirelings(); | |
2719 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2720 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) | |
2721 pDialogue_SpeakingActor->uAIState = Removed; | |
2722 if ( uActiveCharacter ) | |
2723 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
2724 } | |
2725 } | |
2726 else if ( (signed int)newDialogueType > DIALOGUE_84 && (signed int)newDialogueType <= DIALOGUE_ARENA_SELECT_CHAMPION ) //âûáîð óðîâíÿ ñëîæíîñòè áîÿ | |
2727 { | |
2728 ArenaFight(); | |
2729 return; | |
2730 } | |
2731 else if(newDialogueType == DIALOGUE_USE_NPC_ABILITY) | |
2732 { | |
2733 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0) | |
2734 { | |
2735 if ( speakingNPC->uProfession != GateMaster ) | |
2736 speakingNPC->bHasUsedTheAbility = 1; | |
2737 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2738 } | |
2739 else | |
2740 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!" | |
2741 } | |
2742 else if(newDialogueType == DIALOGUE_13) | |
2743 { | |
2744 if (!speakingNPC->Hired()) | |
2745 { | |
2746 sub_4B3E1E(); | |
2747 dialogue_show_profession_details = false; | |
2748 } | |
2749 else | |
2750 { | |
2751 for ( uint i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i ) | |
2752 { | |
2753 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName) ) | |
2754 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu; | |
2755 } | |
2756 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
2757 memset(&pParty->pHirelings[0], 0, sizeof(NPCData)); | |
2758 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
2759 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); | |
2760 pParty->hirelingScrollPosition = 0; | |
2761 pParty->CountHirelings(); | |
2762 dword_591084 = 0; | |
2763 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2764 dword_7241C8 = 0; | |
2765 return; | |
2766 } | |
2767 } | |
2768 else if(newDialogueType >= DIALOGUE_EVT_A && newDialogueType <= DIALOGUE_EVT_F) | |
2769 { | |
2770 switch(newDialogueType) | |
2771 { | |
2772 case DIALOGUE_EVT_A: npc_event_id = speakingNPC->evt_A; break; | |
2773 case DIALOGUE_EVT_B: npc_event_id = speakingNPC->evt_B; break; | |
2774 case DIALOGUE_EVT_C: npc_event_id = speakingNPC->evt_C; break; | |
2775 case DIALOGUE_EVT_D: npc_event_id = speakingNPC->evt_D; break; | |
2776 case DIALOGUE_EVT_E: npc_event_id = speakingNPC->evt_E; break; | |
2777 case DIALOGUE_EVT_F: npc_event_id = speakingNPC->evt_F; break; | |
2778 } | |
2779 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
2780 _4B3FE5_training_dialogue(npc_event_id); //200-310 | |
2781 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
2782 { //400-410 | |
2783 dword_F8B1D8 = newDialogueType; | |
2784 DrawJoinGuildWindow(npc_event_id - 400); | |
2785 } | |
2786 else | |
2787 { | |
2788 switch ( npc_event_id ) | |
2789 { | |
2790 case 139: | |
2791 OracleDialogue(); | |
2792 break; | |
2793 case 311: | |
2794 CheckBountyRespawnAndAward(); | |
2795 break; | |
2796 case 399: | |
2797 Arena_SelectionFightLevel(); | |
2798 break; | |
2799 default: | |
2800 activeLevelDecoration = (LevelDecoration*)1; | |
2801 current_npc_text = 0; | |
2802 EventProcessor(npc_event_id, 0, 1); | |
2803 activeLevelDecoration = NULL; | |
2804 break; | |
2805 } | |
2806 } | |
2807 } | |
2808 if ( !dword_7241C8 ) | |
2809 pGame->Draw(); | |
2810 dword_7241C8 = 0; | |
656 | 2811 } |
0 | 2812 |
2813 //----- (004BDAAF) -------------------------------------------------------- | |
2059 | 2814 bool MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 2815 { |
702 | 2816 bool test; |
0 | 2817 |
907 | 2818 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1546
diff
changeset
|
2819 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->IsStolen()) |
2059 | 2820 return false; |
907 | 2821 switch( p2DEvents[_2da_idx - 1].uType ) |
2822 { | |
1411 | 2823 case BuildingType_WeaponShop: |
907 | 2824 { |
2059 | 2825 test = item->GetItemEquipType() <= EQUIP_BOW; |
907 | 2826 break; |
2827 } | |
1411 | 2828 case BuildingType_ArmorShop: |
907 | 2829 { |
2059 | 2830 test = item->GetItemEquipType() >= EQUIP_ARMOUR && item->GetItemEquipType() <= EQUIP_BOOTS; |
907 | 2831 break; |
2832 } | |
1411 | 2833 case BuildingType_MagicShop: |
907 | 2834 { |
2059 | 2835 test = item->GetPlayerSkillType() == PLAYER_SKILL_MISC || item->GetItemEquipType() == EQIUP_ANY; |
907 | 2836 break; |
2837 } | |
1411 | 2838 case BuildingType_AlchemistShop: |
907 | 2839 { |
2059 | 2840 test = item->GetItemEquipType() == EQUIP_REAGENT || item->GetItemEquipType() == EQUIP_POTION |
2841 || (item->GetItemEquipType() > EQUIP_POTION && !(item->GetItemEquipType() != EQUIP_MESSAGE_SCROLL | |
907 | 2842 || (signed int)item->uItemID < 740) && item->uItemID != 771); |
2843 break; | |
2844 } | |
2845 default: | |
2846 { | |
2847 test = false; | |
2848 break; | |
2849 } | |
2850 } | |
702 | 2851 return test; |
2059 | 2852 } |