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