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