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