Mercurial > mm7
annotate mm7_4.cpp @ 2044:28cb79ae2f6f
Time.h rename
author | Ritor1 |
---|---|
date | Thu, 28 Nov 2013 17:12:50 +0600 |
parents | 2ccf638342d6 |
children | f9698295c0bd |
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) -------------------------------------------------------- | |
1458 | 327 int _493938_regenerate() |
0 | 328 { |
329 int v0; // edi@1 | |
330 signed __int64 v1; // qax@1 | |
331 int v2; // ecx@1 | |
332 int result; // eax@1 | |
333 int v4; // eax@2 | |
334 int v5; // edi@5 | |
2030 | 335 bool cursed_flag; // ecx@5 |
0 | 336 char v7; // sf@5 |
112 | 337 int *v8; // ecx@10 |
0 | 338 int v9; // edi@15 |
339 signed int v10; // eax@15 | |
340 __int16 *v11; // edx@16 | |
341 int v12; // eax@20 | |
342 int v13; // ebx@20 | |
343 unsigned int *v14; // esi@21 | |
344 unsigned int v15; // ecx@21 | |
345 unsigned int v16; // eax@21 | |
346 int v17; // edx@21 | |
347 int v18; // eax@21 | |
348 signed int v19; // eax@21 | |
349 signed int v20; // ebx@25 | |
350 Player *v21; // esi@25 | |
351 ITEM_EQUIP_TYPE v22; // edi@30 | |
352 //int v23; // edx@31 | |
353 signed int v24; // ecx@32 | |
354 signed int v25; // eax@33 | |
355 int v26; // eax@35 | |
356 int v27; // eax@36 | |
357 int v28; // eax@37 | |
358 int v29; // eax@40 | |
359 int v30; // eax@41 | |
360 signed int v31; // ecx@53 | |
361 char *v32; // eax@53 | |
362 char *v33; // edi@82 | |
363 int v34; // ecx@88 | |
364 int v35; // eax@88 | |
365 char *v36; // edi@99 | |
366 int v37; // edi@104 | |
367 int v38; // edi@106 | |
368 int v39; // edi@111 | |
369 int v40; // ecx@113 | |
370 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
|
371 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 372 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
373 int v44; // [sp+210h] [bp-20h]@22 | |
374 int v45; // [sp+214h] [bp-1Ch]@25 | |
375 int v46; // [sp+218h] [bp-18h]@25 | |
376 int v47; // [sp+21Ch] [bp-14h]@25 | |
377 int v48; // [sp+220h] [bp-10h]@25 | |
378 int v49; // [sp+224h] [bp-Ch]@24 | |
379 int v50; // [sp+228h] [bp-8h]@25 | |
380 int v51; // [sp+22Ch] [bp-4h]@2 | |
381 | |
382 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
383 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
384 v2 = (signed int)v1 / 60; | |
385 result = (signed int)v1 / 60 + 5; | |
386 if ( v0 >= result ) | |
387 { | |
388 v51 = 0; | |
389 v4 = (v0 - v2) / 5; | |
390 if (pParty->FlyActive()) | |
391 { | |
392 if ( pParty->bFlying ) | |
393 { | |
569 | 394 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2030 | 395 { |
569 | 396 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; |
2030 | 397 cursed_flag = pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[0];//cursed |
398 v7 = cursed_flag < v5; | |
399 //cursed_flag -= v5; | |
400 if ( !v7 ) | |
0 | 401 { |
402 pParty->uFlags &= 0xFFFFFFBFu; | |
2030 | 403 pParty->bFlying = false; |
0 | 404 v51 = 1; |
405 } | |
406 } | |
407 } | |
408 } | |
569 | 409 |
0 | 410 if (pParty->WaterWalkActive()) |
411 { | |
569 | 412 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
413 { | |
414 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
415 { // taking on water | |
416 //__debugbreak(); | |
2023 | 417 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; |
112 | 418 v7 = *v8 < v4; |
419 *v8 -= v4; | |
0 | 420 if ( v7 ) |
421 { | |
112 | 422 *v8 = 0; |
569 | 423 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 424 v51 = 1; |
425 } | |
426 } | |
427 } | |
428 } | |
569 | 429 |
0 | 430 if (pParty->ImmolationActive()) |
431 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
432 //SpriteObject::SpriteObject(&a1); |
0 | 433 v9 = 0; |
434 a3.z = 0; | |
435 a3.y = 0; | |
436 a3.x = 0; | |
437 a1.stru_24.Reset(); | |
822 | 438 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
439 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 440 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
441 a1.uType = 1070; |
822 | 442 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 443 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
444 { | |
445 LABEL_19: | |
446 LOWORD(v10) = 0; | |
447 } | |
448 else | |
449 { | |
450 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 451 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 452 { |
453 ++v10; | |
454 v11 += 28; | |
455 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
456 goto LABEL_19; | |
457 } | |
458 } | |
459 a1.uObjectDescID = v10; | |
460 a1.field_60_distance_related_prolly_lod = 0; | |
1167 | 461 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; |
303 | 462 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 463 a1.uAttributes = 0; |
464 a1.uSectorID = 0; | |
465 a1.uSpriteFrameID = 0; | |
822 | 466 a1.spell_caster_pid = v12; |
0 | 467 a1.uFacing = 0; |
468 a1.uSoundID = 0; | |
1459 | 469 v13 = _46A89E_immolation_effect((int)v41, 100, 307); |
0 | 470 if ( v13 > 0 ) |
471 { | |
472 do | |
473 { | |
474 v14 = (unsigned int *)&v41[4 * v9]; | |
475 v15 = *v14; | |
476 v16 = *v14; | |
477 a1.vPosition.x = pActors[v16].vPosition.x; | |
478 v17 = pActors[v16].vPosition.y; | |
479 a1.vPosition.z = pActors[v16].vPosition.z; | |
480 v18 = 8 * v15; | |
862 | 481 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 482 a1.vPosition.y = v17; |
823 | 483 a1.spell_target_pid = v18; |
0 | 484 v19 = a1.Create(0, 0, 0, 0); |
862 | 485 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 486 ++v9; |
487 } | |
488 while ( v9 < v13 ); | |
489 } | |
490 } | |
491 v44 = 0; | |
248 | 492 if (PartyHasDragon()) |
0 | 493 v44 = 1; |
494 v49 = 0; | |
495 LABEL_25: | |
496 v20 = 0; | |
497 v21 = &pParty->pPlayers[v49]; | |
498 v50 = 0; | |
499 v47 = 0; | |
500 v45 = 0; | |
501 v48 = 0; | |
502 v46 = 0; | |
255 | 503 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 504 v50 = 1; |
135 | 505 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 506 v48 = 1; |
507 v22 = (ITEM_EQUIP_TYPE)0; | |
508 while ( 1 ) | |
509 { | |
510 if ( v21->HasItemEquipped(v22) ) | |
511 { | |
512 //v23 = v21->pEquipment.pIndices; | |
1980 | 513 uint _idx = v21->pEquipment.pIndices[v22]; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1372
diff
changeset
|
514 v24 = v21->pInventoryItemList[_idx].uItemID; |
0 | 515 if ( v24 > 134 ) |
516 { | |
517 if ( v24 == 529 ) | |
2030 | 518 { |
519 v20 = 1; | |
520 v50 = 1; | |
521 goto LABEL_51; | |
522 } | |
0 | 523 if ( v24 == 535 ) |
2030 | 524 { |
525 v20 = 1; | |
526 goto LABEL_51; | |
527 } | |
0 | 528 if ( v24 == 515 ) |
529 { | |
530 v47 = 1; | |
531 } | |
532 else | |
533 { | |
534 if ( v24 == 532 ) | |
2030 | 535 { |
536 v50 = 1; | |
537 goto LABEL_51; | |
538 } | |
0 | 539 } |
540 } | |
541 else | |
542 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1372
diff
changeset
|
543 v25 = v21->pInventoryItemList[_idx].uSpecEnchantmentType; |
0 | 544 if ( v25 <= 50 ) |
545 { | |
546 if ( v25 != 50 ) | |
547 { | |
548 v26 = v25 - 37; | |
549 if ( v26 ) | |
550 { | |
551 v27 = v26 - 1; | |
552 if ( !v27 ) | |
2030 | 553 { |
554 v50 = 1; | |
555 goto LABEL_51; | |
556 } | |
0 | 557 v28 = v27 - 6; |
558 if ( v28 ) | |
559 { | |
560 if ( v28 != 3 ) | |
561 goto LABEL_51; | |
2030 | 562 //LABEL_50: |
0 | 563 v50 = 1; |
564 goto LABEL_51; | |
565 } | |
566 } | |
567 } | |
2030 | 568 //LABEL_44: |
0 | 569 v20 = 1; |
570 goto LABEL_51; | |
571 } | |
572 v29 = v25 - 54; | |
573 if ( !v29 ) | |
2030 | 574 { |
575 v20 = 1; | |
576 goto LABEL_51; | |
577 } | |
0 | 578 v30 = v29 - 1; |
579 if ( !v30 ) | |
2030 | 580 { |
581 v50 = 1; | |
582 goto LABEL_51; | |
583 } | |
0 | 584 if ( v30 == 11 ) |
585 { | |
2030 | 586 //LABEL_43: |
0 | 587 v20 = 1; |
588 v50 = 1; | |
589 goto LABEL_51; | |
590 } | |
591 } | |
592 } | |
593 LABEL_51: | |
594 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
595 if ( (signed int)v22 >= 16 ) | |
596 { | |
597 if ( v48 ) | |
598 { | |
599 v31 = 0; | |
1826 | 600 v32 = (char *)v21->pInventoryItemList.data(); |
0 | 601 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) |
602 { | |
603 ++v31; | |
604 v32 += 36; | |
605 if ( v31 >= 138 ) | |
606 goto LABEL_59; | |
607 } | |
608 v48 = 0; | |
609 v45 = 1; | |
610 } | |
611 LABEL_59: | |
612 if ( v21->pConditions[17] ) | |
613 v46 = 1; | |
614 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
615 { | |
616 ++v21->sHealth; | |
617 if ( v21->sHealth > v21->GetMaxHealth() ) | |
618 v21->sHealth = v21->GetMaxHealth(); | |
619 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
620 { | |
621 LODWORD(v21->pConditions[13]) = 0; | |
622 HIDWORD(v21->pConditions[13]) = 0; | |
623 } | |
624 v51 = 1; | |
625 } | |
626 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
627 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
628 && !v21->pConditions[14] | |
629 && !v21->pConditions[16] ) | |
630 { | |
631 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
632 if ( v21->sHealth > v21->GetMaxHealth() ) | |
633 v21->sHealth = v21->GetMaxHealth(); | |
634 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
635 { | |
636 LODWORD(v21->pConditions[13]) = 0; | |
637 HIDWORD(v21->pConditions[13]) = 0; | |
638 } | |
639 v51 = 1; | |
640 } | |
641 if ( v50 ) | |
642 { | |
643 v33 = (char *)&v21->sMana; | |
644 ++*(int *)v33; | |
645 if ( v21->sMana > v21->GetMaxMana() ) | |
646 *(int *)v33 = v21->GetMaxMana(); | |
647 v51 = 1; | |
648 } | |
649 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
650 { | |
651 v34 = LODWORD(v21->pConditions[13]); | |
652 --v21->sHealth; | |
653 v35 = v21->sHealth; | |
654 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
655 v21->pConditions[13] = pParty->uTimePlayed; | |
656 if ( v35 < 1 ) | |
657 { | |
1595
a52a01aaf439
Player::GetBaseResistance cleanup, setting default parameter to Player::GetItemsBonus
Grumpy7
parents:
1567
diff
changeset
|
658 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1 |
0 | 659 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) |
660 { | |
661 v21->pConditions[13] = pParty->uTimePlayed; | |
662 } | |
663 else | |
664 { | |
665 if ( !v21->pConditions[14] ) | |
666 v21->pConditions[14] = pParty->uTimePlayed; | |
667 } | |
668 } | |
669 v51 = 1; | |
670 } | |
671 if ( v45 ) | |
672 { | |
673 v36 = (char *)&v21->sMana; | |
674 ++*(int *)v36; | |
675 if ( v21->sMana > v21->GetMaxMana() ) | |
676 *(int *)v36 = v21->GetMaxMana(); | |
677 } | |
678 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
679 { | |
680 v37 = v21->sHealth; | |
681 if ( v37 > v21->GetMaxHealth() / 2 ) | |
682 v21->sHealth = v37 - 2; | |
683 v38 = v21->sMana; | |
684 if ( v38 > v21->GetMaxMana() / 2 ) | |
685 v21->sMana = v38 - 2; | |
686 } | |
687 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
688 { | |
689 v39 = v21->sHealth; | |
690 if ( v39 > v21->GetMaxHealth() / 2 ) | |
691 v21->sHealth = v39 - 1; | |
692 v40 = v21->sMana; | |
693 if ( v40 > 0 ) | |
694 v21->sMana = v40 - 1; | |
695 } | |
696 ++v49; | |
697 if ( v49 >= 4 ) | |
698 { | |
699 result = HIDWORD(pParty->uTimePlayed); | |
700 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
701 if ( !viewparams->bRedrawGameUI ) | |
702 { | |
703 result = v51; | |
704 viewparams->bRedrawGameUI = v51; | |
705 } | |
706 return result; | |
707 } | |
708 goto LABEL_25; | |
709 } | |
710 } | |
711 } | |
712 return result; | |
713 } | |
714 | |
715 //----- (00493F79) -------------------------------------------------------- | |
1459 | 716 void init_summoned_item(stru351_summoned_item *_this, __int64 duration) |
0 | 717 { |
718 signed __int64 v2; // ST2C_8@1 | |
719 signed __int64 v3; // qax@1 | |
351 | 720 //signed __int64 v4; // ST1C_8@1 |
0 | 721 unsigned __int64 v5; // qax@1 |
722 unsigned int v6; // ebx@1 | |
723 | |
1459 | 724 v2 = (signed __int64)((double)duration * 0.234375); |
0 | 725 v3 = v2 / 60 / 60; |
351 | 726 //v4 = v3; |
0 | 727 v5 = (unsigned int)v3 / 0x18; |
728 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 729 _this->field_0_expire_second = v2 % 60; |
730 _this->field_4_expire_minute = v2 / 60 % 60; | |
731 _this->field_8_expire_hour = v3 % 24; | |
732 _this->field_10_expire_week = v5 / 7 & 3; | |
733 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
734 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 735 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 736 } |
737 | |
738 //----- (00494035) -------------------------------------------------------- | |
1031 | 739 void _494035_timed_effects__water_walking_damage__etc() |
0 | 740 { |
741 signed __int64 v0; // qax@1 | |
742 signed __int64 v1; // ST30_8@1 | |
743 signed __int64 v2; // ST38_8@1 | |
744 unsigned __int64 v3; // qax@1 | |
745 unsigned int v4; // edi@1 | |
746 //signed int v5; // eax@4 | |
747 //char *v6; // ecx@5 | |
748 //Player *v7; // esi@8 | |
749 //char *v8; // ecx@12 | |
766 | 750 //Player *pPlayer; // esi@15 |
0 | 751 //void *v10; // esi@25 |
752 unsigned int v11; // ecx@27 | |
753 signed int v12; // edi@29 | |
1424 | 754 //Player *v13; // ecx@30 |
755 //Player *v14; // esi@35 | |
756 //double v15; // st7@35 | |
0 | 757 Player **v16; // esi@43 |
758 Player *v17; // edi@44 | |
759 double v18; // st7@44 | |
816 | 760 //float v19; // ST28_4@48 |
761 //double v20; // ST38_8@48 | |
0 | 762 Player *v21; // esi@51 |
763 signed int v22; // edi@53 | |
764 int v23; // eax@59 | |
765 int v24; // ecx@60 | |
766 int v25; // eax@63 | |
767 int v26; // ecx@64 | |
768 int v27; // eax@67 | |
769 int v28; // ecx@68 | |
770 int v29; // eax@71 | |
771 int v30; // ecx@72 | |
772 int v31; // eax@75 | |
773 int v32; // ecx@76 | |
774 int v33; // eax@79 | |
775 int v34; // ecx@80 | |
776 int v35; // eax@83 | |
777 int v36; // ecx@84 | |
778 int v37; // eax@87 | |
779 int v38; // ecx@88 | |
780 int v39; // eax@91 | |
781 int v40; // ecx@92 | |
782 int v41; // eax@95 | |
783 int v42; // ecx@96 | |
784 bool v43; // ebx@102 | |
785 //SpellBuff *v44; // edi@104 | |
786 //signed int v45; // ebp@104 | |
787 bool v46; // edi@111 | |
788 //SpellBuff *v47; // esi@113 | |
789 //Player **v48; // esi@119 | |
790 //signed int v49; // edi@121 | |
791 //char *v50; // esi@122 | |
792 signed int v51; // edx@128 | |
793 signed int v52; // ecx@130 | |
794 int v53; // eax@131 | |
795 Player *v54; // eax@141 | |
766 | 796 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 797 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 798 //int v57; // [sp-4h] [bp-34h]@18 |
1424 | 799 //int v58; // [sp-4h] [bp-34h]@33 |
0 | 800 int v59; // [sp-4h] [bp-34h]@55 |
816 | 801 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 802 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
803 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 804 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 805 signed int a2a; // [sp+18h] [bp-18h]@47 |
806 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
807 | |
766 | 808 //a2 = pParty->uCurrentHour; |
0 | 809 v61 = pParty->uDaysPlayed; |
816 | 810 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 811 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
812 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 813 v1 = v0; |
814 v0 /= 60i64; | |
815 v2 = v0; | |
816 v3 = (unsigned int)v0 / 24; | |
817 v4 = (unsigned int)(v3 / 7) >> 2; | |
818 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
819 pParty->uCurrentMinute = v1 % 60; | |
820 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
821 pParty->uCurrentHour = v2 % 24; | |
822 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
823 pParty->uCurrentMonth = v4 % 12; | |
352 | 824 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 825 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 826 { |
827 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
828 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
829 | |
830 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
831 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
832 | |
766 | 833 ++pParty->days_played_without_rest; |
834 if (pParty->days_played_without_rest > 1) | |
0 | 835 { |
836 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
|
837 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0); |
766 | 838 |
839 if (pParty->uNumFoodRations) | |
840 Party::TakeFood(1); | |
0 | 841 else |
842 for (uint i = 0; i < 4; ++i) | |
766 | 843 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
844 | |
845 if (pParty->days_played_without_rest > 3) | |
846 for (uint i = 0; i < 4; ++i) | |
0 | 847 { |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
848 Player* player = &pParty->pPlayers[i]; |
766 | 849 |
850 player->Zero(); | |
851 | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
852 if (!player->IsPertified() && !player->IsEradicated() && !player->IsDead()) |
0 | 853 { |
767 | 854 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
855 player->SetCondDeadWithBlockCheck(0); |
767 | 856 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
857 player->SetCondInsaneWithBlockCheck(0); |
0 | 858 } |
859 } | |
766 | 860 } |
861 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 862 pOutdoor->SetFog(); |
863 | |
864 for (uint i = 0; i < 4; ++i) | |
865 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
866 } | |
766 | 867 |
0 | 868 v11 = LODWORD(pParty->uTimePlayed); |
1424 | 869 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage error |
0 | 870 { |
1424 | 871 //v12 = 1; |
0 | 872 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; |
873 viewparams->bRedrawGameUI = 1; | |
1424 | 874 //while ( 1 ) |
875 for ( v12 = 1; v12 <= 4; ++v12 ) | |
0 | 876 { |
1080 | 877 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
99 | 878 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
879 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 880 { |
1424 | 881 //v58 = 0; |
882 pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); | |
0 | 883 } |
884 else | |
885 { | |
1424 | 886 //v58 = 0; |
1620
61ea994a1812
sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped to Player::HasUnderwaterSuitEquipped, sub_43EDB9_get_some_race_sex_relation_2 to ShouldLoadTexturesForRaceAndGender, Player_has_item to Player::HasItem
Grumpy7
parents:
1603
diff
changeset
|
887 if ( !pPlayers[v12]->HasUnderwaterSuitEquipped() ) |
0 | 888 { |
1424 | 889 //v14 = pPlayers[v12]; |
890 //v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
891 pPlayers[v12]->ReceiveDamage((signed __int64)pPlayers[v12]->GetMaxHealth() * 0.1, DMGT_FIRE); | |
0 | 892 if ( pParty->uFlags & 4 ) |
893 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
894 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]); |
783 | 895 GameUI_Footer_TimeLeft = 128; |
0 | 896 } |
897 } | |
1419 | 898 else |
1424 | 899 pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); |
0 | 900 } |
1424 | 901 //++v12; |
902 //if ( v12 > 4 ) | |
903 //{ | |
904 //v11 = LODWORD(pParty->uTimePlayed); | |
905 //break; | |
0 | 906 } |
1424 | 907 v11 = LODWORD(pParty->uTimePlayed); |
908 //} | |
0 | 909 } |
910 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
911 { | |
912 viewparams->bRedrawGameUI = 1; | |
913 pParty->field_6FC = v11 + 128; | |
914 v16 = &pPlayers[1]; | |
915 do | |
916 { | |
917 v17 = *v16; | |
918 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
1036 | 919 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); |
0 | 920 if ( pParty->uFlags & 0x200 ) |
921 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
922 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); |
783 | 923 GameUI_Footer_TimeLeft = 128; |
0 | 924 } |
925 ++v16; | |
926 } | |
927 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
928 } | |
929 _493938_regenerate(); | |
930 v65 = 4; | |
816 | 931 a2a = pEventTimer->uTimeElapsed; |
932 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
933 { | |
934 //v19 = (double)(signed int)prev_time * 0.5; | |
935 //v20 = v19 + 6.7553994e15; | |
936 a2a *= 0.5f; | |
937 if (a2a < 1) | |
0 | 938 a2a = 1; |
939 } | |
940 v62 = &pPlayers[1]; | |
941 do | |
942 { | |
943 v21 = *v62; | |
944 if ( (*v62)->uTimeToRecovery ) | |
945 v21->Recover(a2a); | |
946 v22 = v21->sHealth; | |
1595
a52a01aaf439
Player::GetBaseResistance cleanup, setting default parameter to Player::GetItemsBonus
Grumpy7
parents:
1567
diff
changeset
|
947 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + v22 + v21->uEndurance >= 1 |
0 | 948 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) |
949 { | |
1419 | 950 if ( v22 < 1 ) |
951 { | |
952 v59 = 0; | |
953 v56 = 13; | |
954 v21->SetCondition(v56, v59); | |
955 } | |
0 | 956 } |
957 else | |
958 { | |
959 v59 = 0; | |
960 v56 = 14; | |
1419 | 961 v21->SetCondition(v56, v59); |
0 | 962 } |
963 v23 = (int)&v21->field_E0; | |
964 if ( v21->field_E0 ) | |
965 { | |
816 | 966 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 967 if ( v24 > 0 ) |
968 { | |
969 *(int *)v23 = v24; | |
970 } | |
971 else | |
972 { | |
973 *(int *)v23 = 0; | |
974 viewparams->bRedrawGameUI = 1; | |
975 } | |
976 } | |
977 v25 = (int)&v21->field_E4; | |
978 if ( v21->field_E4 ) | |
979 { | |
816 | 980 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 981 if ( v26 > 0 ) |
982 { | |
983 *(int *)v25 = v26; | |
984 } | |
985 else | |
986 { | |
987 *(int *)v25 = 0; | |
988 viewparams->bRedrawGameUI = 1; | |
989 } | |
990 } | |
991 v27 = (int)&v21->field_E8; | |
992 if ( v21->field_E8 ) | |
993 { | |
816 | 994 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 995 if ( v28 > 0 ) |
996 { | |
997 *(int *)v27 = v28; | |
998 } | |
999 else | |
1000 { | |
1001 *(int *)v27 = 0; | |
1002 viewparams->bRedrawGameUI = 1; | |
1003 } | |
1004 } | |
1005 v29 = (int)&v21->field_EC; | |
1006 if ( v21->field_EC ) | |
1007 { | |
816 | 1008 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 1009 if ( v30 > 0 ) |
1010 { | |
1011 *(int *)v29 = v30; | |
1012 } | |
1013 else | |
1014 { | |
1015 *(int *)v29 = 0; | |
1016 viewparams->bRedrawGameUI = 1; | |
1017 } | |
1018 } | |
1019 v31 = (int)&v21->field_F0; | |
1020 if ( v21->field_F0 ) | |
1021 { | |
816 | 1022 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 1023 if ( v32 > 0 ) |
1024 { | |
1025 *(int *)v31 = v32; | |
1026 } | |
1027 else | |
1028 { | |
1029 *(int *)v31 = 0; | |
1030 viewparams->bRedrawGameUI = 1; | |
1031 } | |
1032 } | |
1033 v33 = (int)&v21->field_F4; | |
1034 if ( v21->field_F4 ) | |
1035 { | |
816 | 1036 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 1037 if ( v34 > 0 ) |
1038 { | |
1039 *(int *)v33 = v34; | |
1040 } | |
1041 else | |
1042 { | |
1043 *(int *)v33 = 0; | |
1044 viewparams->bRedrawGameUI = 1; | |
1045 } | |
1046 } | |
1047 v35 = (int)&v21->field_F8; | |
1048 if ( v21->field_F8 ) | |
1049 { | |
816 | 1050 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 1051 if ( v36 > 0 ) |
1052 { | |
1053 *(int *)v35 = v36; | |
1054 } | |
1055 else | |
1056 { | |
1057 *(int *)v35 = 0; | |
1058 viewparams->bRedrawGameUI = 1; | |
1059 } | |
1060 } | |
1061 v37 = (int)&v21->field_FC; | |
1062 if ( v21->field_FC ) | |
1063 { | |
816 | 1064 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 1065 if ( v38 > 0 ) |
1066 { | |
1067 *(int *)v37 = v38; | |
1068 } | |
1069 else | |
1070 { | |
1071 *(int *)v37 = 0; | |
1072 viewparams->bRedrawGameUI = 1; | |
1073 } | |
1074 } | |
1075 v39 = (int)&v21->field_100; | |
1076 if ( v21->field_100 ) | |
1077 { | |
816 | 1078 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 1079 if ( v40 > 0 ) |
1080 { | |
1081 *(int *)v39 = v40; | |
1082 } | |
1083 else | |
1084 { | |
1085 *(int *)v39 = 0; | |
1086 viewparams->bRedrawGameUI = 1; | |
1087 } | |
1088 } | |
1089 v41 = (int)&v21->field_104; | |
1090 if ( v21->field_104 ) | |
1091 { | |
816 | 1092 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 1093 if ( v42 > 0 ) |
1094 { | |
1095 *(int *)v41 = v42; | |
1096 } | |
1097 else | |
1098 { | |
1099 *(int *)v41 = 0; | |
1100 viewparams->bRedrawGameUI = 1; | |
1101 } | |
1102 } | |
1103 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
1104 --v65; | |
1105 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
1106 | |
1107 for (uint k = 0; k < 24; ++k) | |
1340 | 1108 v21->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed); |
0 | 1109 |
1110 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
1111 v21->SetCondition(1u, 0); | |
1112 ++v62; | |
1113 } | |
1114 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
1167 | 1115 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; |
0 | 1116 |
1117 for (uint i = 0; i < 20; ++i) | |
1118 { | |
1340 | 1119 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1) |
0 | 1120 viewparams->bRedrawGameUI = 1; |
1121 } | |
1122 | |
1167 | 1123 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) |
0 | 1124 { |
1125 for (uint i = 0; i < 4; ++i) | |
1126 pParty->pPlayers[i].SetCondition(1, 0); | |
1127 } | |
1128 | |
1129 for (uint i = 0; i < 2; ++i) | |
1130 { | |
1980 | 1131 SpellBuff* pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; |
0 | 1132 if (pBuf->uExpireTime == 0) |
1133 continue; | |
1134 | |
1135 if ( !(pBuf->uFlags & 1) ) | |
1136 { | |
1137 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
1138 { | |
1139 pBuf->Reset(); | |
1140 if (dword_4EE07C[i] == 7 ) | |
1141 pParty->bFlying = false; | |
1142 } | |
1143 } | |
1144 } | |
1145 | |
1146 v51 = v65; | |
1147 if ( v65 ) | |
1148 goto LABEL_135; | |
151 | 1149 if ( pCurrentScreen != SCREEN_REST ) |
0 | 1150 { |
1151 v52 = (signed int)&pPlayers[1]; | |
1152 while ( 1 ) | |
1153 { | |
1154 v53 = *(int *)v52; | |
1155 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
1156 break; | |
1157 v52 += 4; | |
1158 if ( v52 > (signed int)&pPlayers[4] ) | |
1159 goto LABEL_135; | |
1160 } | |
1161 *(int *)(v53 + 16) = 0; | |
1162 *(int *)(v53 + 20) = 0; | |
1163 v51 = 1; | |
1164 LABEL_135: | |
151 | 1165 if ( pCurrentScreen != SCREEN_REST |
0 | 1166 && (!v51 || dword_5C35C0) ) |
981 | 1167 uGameState = GAME_STATE_PARTY_DIED; |
0 | 1168 } |
1169 if ( uActiveCharacter ) | |
1170 { | |
151 | 1171 if ( pCurrentScreen != SCREEN_REST ) |
0 | 1172 { |
1173 v54 = pPlayers[uActiveCharacter]; | |
1174 if ( v54->pConditions[2] | |
1175 || v54->pConditions[12] | |
1176 || v54->pConditions[13] | |
1177 || v54->pConditions[14] | |
1178 || v54->pConditions[15] | |
1179 || v54->pConditions[16] ) | |
1180 { | |
1181 viewparams->bRedrawGameUI = 1; | |
1182 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1183 } | |
1184 } | |
1185 } | |
1186 } | |
1187 | |
1188 //----- (00494820) -------------------------------------------------------- | |
758 | 1189 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 1190 { |
1191 signed int v1; // eax@1 | |
1192 | |
1193 v1 = 5; | |
758 | 1194 if ( a1 % 24 >= 5 ) |
0 | 1195 v1 = 29; |
758 | 1196 return v1 - a1 % 24; |
0 | 1197 } |
1198 | |
1199 //----- (00494836) -------------------------------------------------------- | |
1200 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
1201 { | |
1202 int v3; // esi@1 | |
1203 int result; // eax@1 | |
1204 stru339_spell_sound *v5; // ebx@1 | |
1205 int *v6; // edi@2 | |
1206 unsigned int v7; // eax@3 | |
1207 int v8; // [sp+Ch] [bp-8h]@3 | |
1208 int v9; // [sp+10h] [bp-4h]@2 | |
1209 int a2a; // [sp+1Ch] [bp+8h]@1 | |
1793
4dee76d79c78
dword_5B65CC to npcIdToDismissAfterDialogue, Party::field_709 to Party::hirelingScrollPosition
Grumpy7
parents:
1754
diff
changeset
|
1210 return 0; |
0 | 1211 v3 = 0; |
1212 result = word_4EE088_sound_ids[uSoundID]; | |
1213 v5 = this; | |
1214 a2a = word_4EE088_sound_ids[uSoundID]; | |
1215 if ( result ) | |
1216 { | |
1217 v9 = 0; | |
1218 v6 = this->pSoundsOffsets; | |
1219 do | |
1220 { | |
1221 v7 = a2a++; | |
1222 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
1223 if ( !result ) | |
1224 break; | |
1225 a6 += 4; | |
1226 result = v8 + 256; | |
1227 *v6 = v3; | |
1228 v3 += result; | |
1229 ++v9; | |
1230 *(v6 - 2) = result; | |
1231 ++v6; | |
1232 } | |
1233 while ( v9 < 2 ); | |
1234 } | |
1235 return result; | |
1236 } | |
1237 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
1238 | |
1239 //----- (00494AED) -------------------------------------------------------- | |
130 | 1240 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 1241 { |
1242 unsigned int _uNumFrames; // edx@1 | |
1243 unsigned int result; // eax@1 | |
1244 PlayerFrame *v4; // ecx@2 | |
1245 | |
1246 _uNumFrames = this->uNumFrames; | |
1247 result = 0; | |
1248 if ( (signed int)this->uNumFrames <= 0 ) | |
1249 { | |
1250 result = 0; | |
1251 } | |
1252 else | |
1253 { | |
1254 v4 = this->pFrames; | |
130 | 1255 while ( v4->expression != expression ) |
0 | 1256 { |
1257 ++result; | |
1258 ++v4; | |
1259 if ( (signed int)result >= (signed int)_uNumFrames ) | |
1419 | 1260 return 0; |
0 | 1261 } |
1262 } | |
1263 return result; | |
1264 } | |
1265 | |
1266 //----- (00494B10) -------------------------------------------------------- | |
1267 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
1268 { | |
1269 unsigned int v3; // esi@1 | |
1270 PlayerFrame *v4; // edi@1 | |
1271 PlayerFrame *v5; // ecx@1 | |
1272 __int16 v6; // dx@2 | |
1273 int v7; // edx@3 | |
1274 char *i; // eax@3 | |
1275 int v9; // ecx@5 | |
1276 PlayerFrame *result; // eax@6 | |
1277 | |
1278 v3 = uFramesetID; | |
1279 v4 = this->pFrames; | |
1280 v5 = &v4[uFramesetID]; | |
1281 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
1282 { | |
1283 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
1284 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
1285 { | |
1286 v9 = *(short *)i; | |
1287 if ( v7 <= v9 ) | |
1288 break; | |
1289 v7 -= v9; | |
1290 ++v3; | |
1291 } | |
1292 result = &v4[v3]; | |
1293 } | |
1294 else | |
1295 { | |
1296 result = &v4[uFramesetID]; | |
1297 } | |
1298 return result; | |
1299 } | |
1300 | |
1301 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1302 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 1303 { |
1304 PlayerFrameTable *v4; // edi@1 | |
1305 int v5; // esi@1 | |
1306 int v6; // eax@2 | |
1307 | |
1308 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1309 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1310 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
|
1311 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1312 *pAnimTime = v5; |
0 | 1313 } |
1314 else | |
1315 { | |
1316 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1317 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1318 *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
|
1319 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1320 return &v4->pFrames[*pFramesetID]; |
0 | 1321 } |
1322 | |
1323 //----- (00494BC3) -------------------------------------------------------- | |
1324 void PlayerFrameTable::ToFile() | |
1325 { | |
1326 PlayerFrameTable *v1; // esi@1 | |
1327 FILE *v2; // eax@1 | |
1328 FILE *v3; // edi@1 | |
1329 | |
1980 | 1330 PlayerFrameTable* Str = this; |
0 | 1331 |
1332 v1 = Str; | |
1333 v2 = fopen("data\\dpft.bin", "wb"); | |
1334 v3 = v2; | |
1335 if ( !v2 ) | |
1545 | 1336 Error("Unable to save dpft.bin"); |
0 | 1337 fwrite(v1, 4u, 1u, v2); |
1338 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
1339 fclose(v3); | |
1340 } | |
1341 | |
1342 //----- (00494C0F) -------------------------------------------------------- | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1343 void PlayerFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
0 | 1344 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1345 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
|
1346 num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1347 num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1348 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
|
1349 assert(uNumFrames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1350 assert(!num_mm8_frames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1351 |
1583 | 1352 pFrames = (PlayerFrame *)malloc(uNumFrames * sizeof(PlayerFrame)); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1353 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
|
1354 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
|
1355 memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame)); |
0 | 1356 } |
1357 | |
1358 //----- (00494C5A) -------------------------------------------------------- | |
1359 int PlayerFrameTable::FromFileTxt(const char *Args) | |
1360 { | |
1361 PlayerFrameTable *v2; // ebx@1 | |
1362 FILE *v3; // eax@1 | |
1363 int v4; // esi@3 | |
1364 void *v5; // eax@10 | |
1365 FILE *v6; // ST0C_4@12 | |
1366 char *i; // eax@12 | |
1367 __int16 v8; // ax@15 | |
1368 const char *v9; // ST10_4@15 | |
1369 unsigned __int16 v10; // ax@15 | |
1370 const char *v11; // ST0C_4@15 | |
1371 int j; // esi@15 | |
1372 int v13; // eax@17 | |
1373 int v14; // edx@22 | |
1374 int v15; // ecx@23 | |
1375 int v16; // eax@24 | |
1376 signed int k; // eax@27 | |
1377 PlayerFrame *v18; // edx@28 | |
1378 int v19; // esi@28 | |
1379 int l; // ecx@29 | |
1380 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
1381 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
1382 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
1383 int v25; // [sp+2F8h] [bp-Ch]@3 | |
1384 int v26; // [sp+2FCh] [bp-8h]@3 | |
1385 FILE *File; // [sp+300h] [bp-4h]@1 | |
1386 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
1387 | |
1388 v2 = this; | |
1389 //TileTable::dtor((TileTable *)this); | |
1390 v3 = fopen(Args, "r"); | |
1391 File = v3; | |
1392 if ( !v3 ) | |
1545 | 1393 Error("PlayerFrameTable::load - Unable to open file: %s.", Args); |
0 | 1394 v4 = 0; |
1395 v25 = 0; | |
1396 v26 = 1; | |
1397 if ( fgets(&Buf, 490, v3) ) | |
1398 { | |
1399 do | |
1400 { | |
1401 *strchr(&Buf, 10) = 0; | |
703 | 1402 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1403 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
1404 { | |
1405 if ( v24.uPropCount < 3 ) | |
1545 | 1406 Error("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
0 | 1407 ++v25; |
1408 } | |
1409 ++v26; | |
1410 } | |
1411 while ( fgets(&Buf, 490, File) ); | |
1412 v4 = v25; | |
1413 } | |
1414 v2->uNumFrames = v4; | |
1583 | 1415 v5 = malloc(10 * v4); |
0 | 1416 v2->pFrames = (PlayerFrame *)v5; |
1417 if ( !v5 ) | |
1545 | 1418 Error("PlayerFrameTable::load - Out of Memory!"); |
0 | 1419 v6 = File; |
1420 v2->uNumFrames = 0; | |
1421 fseek(v6, 0, 0); | |
1422 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
1423 { | |
1424 *strchr(&Buf, 10) = 0; | |
703 | 1425 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1426 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 1427 { |
1428 v8 = atoi(v24.pProperties[0]); | |
1429 v9 = v24.pProperties[1]; | |
130 | 1430 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 1431 v10 = atoi(v9); |
1432 v11 = v24.pProperties[2]; | |
1433 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
1434 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
1435 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
1436 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 1437 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 1438 { |
1104 | 1439 if ( !_stricmp(v24.pProperties[j], "New") ) |
0 | 1440 { |
1441 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
1442 *(char *)v13 |= 4u; | |
1443 } | |
1444 } | |
1445 ++v2->uNumFrames; | |
1446 } | |
1447 } | |
1448 fclose(File); | |
1449 v14 = 0; | |
1450 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
1451 { | |
1452 v15 = 0; | |
1453 do | |
1454 { | |
1455 v16 = (int)&v2->pFrames[v15]; | |
1456 if ( !(*(char *)(v16 + 18) & 4) ) | |
1457 *(char *)(v16 + 8) |= 1u; | |
1458 ++v14; | |
1459 ++v15; | |
1460 } | |
1461 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
1462 } | |
1463 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
1464 { | |
1465 v18 = v2->pFrames; | |
1466 Argsa = (int)&v18[k]; | |
1467 v19 = *(short *)(Argsa + 4); | |
1468 if ( *(char *)(Argsa + 8) & 1 ) | |
1469 { | |
1470 ++k; | |
1471 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
1472 { | |
1473 v19 += *(short *)(l + 4); | |
1474 ++k; | |
1475 } | |
1476 LOWORD(v19) = v18[k].uAnimTime + v19; | |
1477 } | |
1478 ++k; | |
1479 } | |
1480 return 1; | |
1481 } | |
1482 | |
1483 //----- (00495366) -------------------------------------------------------- | |
1484 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
1485 { | |
1486 int v2; // edi@1 | |
1487 int v3; // edx@2 | |
1488 int v4; // esi@3 | |
1489 int v5; // ebx@5 | |
1490 signed int v7; // [sp+Ch] [bp-14h]@1 | |
1491 signed int v8; // [sp+10h] [bp-10h]@1 | |
1492 int **v9; // [sp+14h] [bp-Ch]@4 | |
1493 signed int v10; // [sp+18h] [bp-8h]@3 | |
1494 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
1495 | |
1496 v2 = a1; | |
1497 v11 = a2; | |
1498 v8 = 0; | |
1499 v7 = 0; | |
1500 if ( dword_AE336C == a1 ) | |
1501 { | |
1502 v3 = dword_AE3370; | |
1503 } | |
1504 else | |
1505 { | |
1506 v4 = a2; | |
1507 dword_AE336C = a1; | |
1508 v10 = 0; | |
1509 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
1419 | 1510 { |
1511 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
1512 } | |
1513 else | |
1514 { | |
0 | 1515 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); |
1516 do | |
1517 { | |
1518 v5 = tolower(*(char *)*v9); | |
1519 if ( v5 == tolower(v2) ) | |
1520 { | |
1521 if ( v8 ) | |
1522 v7 = v10; | |
1523 else | |
1524 v8 = v10; | |
1525 } | |
1526 ++v10; | |
1527 v9 += 2; | |
1528 } | |
1529 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
1530 if ( v8 && v8 != v7 ) | |
1531 v3 = v8 + rand() % (v7 - v8); | |
1532 else | |
1533 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
1419 | 1534 } |
0 | 1535 } |
1536 dword_AE3370 = v3; | |
1537 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
1538 } | |
1459 | 1539 |
0 | 1540 |
1541 //----- (00495430) -------------------------------------------------------- | |
1838 | 1542 const char * GetReputationString( signed int a1 ) |
607 | 1543 { |
566 | 1544 if (a1 >= 25) |
1545 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
1546 else if (a1 >= 6) | |
1547 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
1548 else if (a1 >= -5) | |
1549 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
1550 else if (a1 >= -24) | |
1551 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 1552 else |
566 | 1553 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 1554 } |
1555 | |
1556 //----- (00495461) -------------------------------------------------------- | |
1838 | 1557 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 1558 { |
1559 Player *pPlayer; // ebx@3 | |
1838 | 1560 const char *pText; // esi@7 |
0 | 1561 int v17; // eax@10 |
1562 signed __int64 v18; // qax@18 | |
1563 unsigned __int8 *v20; // ebx@32 | |
1564 int v21; // ecx@34 | |
1453 | 1565 int pReputation; // eax@45 |
0 | 1566 int v29; // eax@68 |
1567 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 1568 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
0 | 1569 char a1[100]; // [sp+B8h] [bp-80h]@3 |
1570 int v63; // [sp+12Ch] [bp-Ch]@32 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1571 |
1453 | 1572 if ( IsBadStringPtrA(lpsz, 1) ) |
0 | 1573 return "Invalid String Passed"; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1574 |
0 | 1575 a1[0] = 0; |
1453 | 1576 pPlayer = &pParty->pPlayers[uPlayerID]; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1577 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1578 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1579 NPCData *npc = nullptr; |
0 | 1580 if ( dword_5C35D4 ) |
1211 | 1581 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
|
1582 else |
602 | 1583 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1584 |
1453 | 1585 //pText = a4; |
1980 | 1586 uint len = strlen(lpsz); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1587 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1588 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1589 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1590 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1591 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1592 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1593 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1594 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
|
1595 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1596 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1597 { |
1453 | 1598 case 1://Ïîäðîáíåå |
1599 strcat(pTmpBuf2.data(), npc->pName); | |
1600 dst = strlen(pTmpBuf2.data()); | |
1601 i += 2; | |
1602 break; | |
1603 case 2: | |
1604 strcat(pTmpBuf2.data(), pPlayer->pName); | |
1605 dst = strlen(pTmpBuf2.data()); | |
1606 i += 2; | |
1607 break; | |
1608 case 3: | |
1609 case 4: | |
1610 strcat(pTmpBuf2.data(), a1); | |
1611 dst = strlen(pTmpBuf2.data()); | |
1612 i += 2; | |
1613 break; | |
1614 case 5: | |
1615 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; | |
1616 pText = pGlobalTXT_LocalizationStrings[397];// "evening" | |
1617 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
1618 { | |
1619 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 ) | |
0 | 1620 { |
1453 | 1621 if ( v18 < 20 ) |
1622 pText = pGlobalTXT_LocalizationStrings[396];// "day" | |
0 | 1623 } |
1624 else | |
1625 { | |
1453 | 1626 pText = pGlobalTXT_LocalizationStrings[395];// "morning" |
1627 } | |
1628 } | |
1629 strcat(pTmpBuf2.data(), pText); | |
1630 dst = strlen(pTmpBuf2.data()); | |
1631 i += 2; | |
1632 break; | |
1633 case 6: | |
1634 if ( pPlayer->uSex ) | |
1635 pText = pGlobalTXT_LocalizationStrings[387];// "lady" | |
1636 else | |
1637 pText = pGlobalTXT_LocalizationStrings[385];// "sir" | |
1638 strcat(pTmpBuf2.data(), pText); | |
1639 dst = strlen(pTmpBuf2.data()); | |
1640 i += 2; | |
1641 break; | |
1642 case 7: | |
1643 if ( pPlayer->uSex ) | |
1644 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
1645 else | |
1646 pText = pGlobalTXT_LocalizationStrings[386];// "Sir" | |
1647 strcat(pTmpBuf2.data(), pText); | |
1648 dst = strlen(pTmpBuf2.data()); | |
1649 i += 2; | |
1650 break; | |
1651 case 8: | |
1652 v63 = 0; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1453
diff
changeset
|
1653 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1654 for ( uint _i = 0; _i < 28; ++_i ) |
1453 | 1655 { |
1656 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) | |
1657 { | |
1658 v21 = v63; | |
1659 ++v63; | |
1660 v55[v63] = word_4EE150[i]; | |
1661 } | |
1662 } | |
1663 if ( v63 ) | |
1664 { | |
1665 if ( dword_A74CDC == -1 ) | |
1666 dword_A74CDC = rand() % v63; | |
1667 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; | |
1668 } | |
1669 else | |
1670 pText = (char *)pNPCTopics[55].pText; | |
1671 strcat(pTmpBuf2.data(), pText); | |
1672 dst = strlen(pTmpBuf2.data()); | |
1673 i += 2; | |
1674 break; | |
1675 case 9: | |
1676 if ( npc->uSex ) | |
1677 pText = pGlobalTXT_LocalizationStrings[384];// "her" | |
1678 else | |
1679 pText = pGlobalTXT_LocalizationStrings[383];// "his" | |
1680 strcat(pTmpBuf2.data(), pText); | |
1681 dst = strlen(pTmpBuf2.data()); | |
1682 i += 2; | |
1683 break; | |
1684 case 10: | |
1685 if ( pPlayer->uSex ) | |
1686 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
1687 else | |
1688 pText = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
1689 strcat(pTmpBuf2.data(), pText); | |
1690 dst = strlen(pTmpBuf2.data()); | |
1691 i += 2; | |
1692 break; | |
1693 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
|
1694 pReputation = pParty->GetPartyReputation(); |
1453 | 1695 if ( pReputation >= 25 ) |
1696 pText = pGlobalTXT_LocalizationStrings[379]; | |
1697 else//v25 < 25 | |
1698 { | |
1699 if ( pReputation < 6 ) | |
1700 { | |
1701 if ( pReputation >= -5 )//6 >= v25 >= -5 | |
1702 pText = pGlobalTXT_LocalizationStrings[399]; | |
1703 else// v25 < -5 | |
0 | 1704 { |
1453 | 1705 if ( pReputation < -24 )//-24 > v25 |
1706 pText = pGlobalTXT_LocalizationStrings[434]; | |
1707 else// -5 > v25 > -24 | |
1708 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 1709 } |
1453 | 1710 } |
1711 else//25 > v25 > 6 | |
1712 pText = pGlobalTXT_LocalizationStrings[392]; | |
1713 } | |
1714 strcat(pTmpBuf2.data(), pText); | |
1715 dst = strlen(pTmpBuf2.data()); | |
1716 i += 2; | |
1717 break; | |
1718 case 12: | |
1719 pReputation = npc->rep; | |
1720 if ( pReputation >= 25 ) | |
1721 pText = pGlobalTXT_LocalizationStrings[379]; | |
1722 else | |
1723 { | |
1724 if ( pReputation < 6 ) | |
1725 { | |
1726 if ( pReputation >= -5 ) | |
1727 pText = pGlobalTXT_LocalizationStrings[399]; | |
0 | 1728 else |
1729 { | |
1453 | 1730 if ( pReputation < -24 ) |
1731 pText = pGlobalTXT_LocalizationStrings[434]; | |
1732 else | |
1733 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 1734 } |
1735 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1736 else |
1453 | 1737 pText = pGlobalTXT_LocalizationStrings[392]; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1738 } |
1453 | 1739 strcat(pTmpBuf2.data(), pText); |
1740 dst = strlen(pTmpBuf2.data()); | |
1741 i += 2; | |
1742 break; | |
1743 case 13: | |
1744 strcat(pTmpBuf2.data(), sub_495366(pPlayer->pName[0], pPlayer->uSex)); | |
1745 dst = strlen(pTmpBuf2.data()); | |
1746 i += 2; | |
1747 break; | |
1748 case 14: | |
1749 if ( npc->uSex ) | |
1750 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
1751 else | |
1752 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
1753 strcat(pTmpBuf2.data(), pText); | |
1754 dst = strlen(pTmpBuf2.data()); | |
1755 i += 2; | |
1756 break; | |
1757 case 15: | |
1758 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" | |
1759 dst = strlen(pTmpBuf2.data()); | |
1760 i += 2; | |
1761 break; | |
1762 case 16: | |
1763 if ( npc->uSex ) | |
1764 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
1765 else | |
1766 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
1767 strcat(pTmpBuf2.data(), pText); | |
1768 dst = strlen(pTmpBuf2.data()); | |
1769 i += 2; | |
1770 break; | |
1771 case 17://òåêñò íà¸ìíîãî ÍÏÑ | |
1772 { | |
1980 | 1773 uint pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; |
1453 | 1774 if ( !pay_percentage ) |
1775 pay_percentage = 1; | |
1776 sprintf(a1, "%lu", pay_percentage); | |
1777 strcat(pTmpBuf2.data(), a1); | |
1778 dst = strlen(pTmpBuf2.data()); | |
1779 i += 2; | |
1780 break; | |
1781 } | |
1782 case 18: | |
1783 case 19: | |
1784 case 20: | |
1785 case 21: | |
1786 case 22: | |
1787 case 26: | |
1788 strncpy(a1, lpsz + i + 1, 2); | |
1789 sprintf(a1, "%lu", atoi(a1)); | |
1790 strcat(pTmpBuf2.data(), a1); | |
1791 dst = strlen(pTmpBuf2.data()); | |
1792 i += 2; | |
1793 break; | |
1794 case 23: | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1795 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1796 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName; |
1453 | 1797 else |
1798 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" | |
1799 strcat(pTmpBuf2.data(), pText); | |
1800 dst = strlen(pTmpBuf2.data()); | |
1801 i += 2; | |
1802 break; | |
1803 case 24://íàçâàíèå òîâàðà â ïðîäàæå | |
1804 sprintfex(a1, format_4E2D80, TargetColor(255, 255, 155), a3->GetDisplayName()); | |
1805 strcat(pTmpBuf2.data(), a1); | |
1806 dst = strlen(pTmpBuf2.data()); | |
1807 i += 2; | |
1808 break; | |
1809 case 25: | |
1810 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
0 | 1811 switch ( a5 ) |
1453 | 1812 { |
1813 case 3: | |
1814 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1815 break; | |
1816 case 4: | |
1817 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1818 break; | |
1819 case 5: | |
1820 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1821 break; | |
1822 case 6: | |
1823 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
1824 break; | |
1825 } | |
1826 sprintfex(a1, "%lu", v29); | |
1827 strcat(pTmpBuf2.data(), a1); | |
1828 dst = strlen(pTmpBuf2.data()); | |
1829 i += 2; | |
1830 break; | |
1831 case 27://òåêñò ïðîäàæè | |
1832 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1833 if ( a5 == 3 ) | |
1834 { | |
1835 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
|
1836 if (a3->IsBroken()) |
1453 | 1837 v29 = 1; |
1838 sprintfex(a1, "%lu", v29); | |
1839 strcat(pTmpBuf2.data(), a1); | |
1840 dst = strlen(pTmpBuf2.data()); | |
1841 i += 2; | |
0 | 1842 break; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1843 } |
1453 | 1844 if ( a5 != 4 ) |
0 | 1845 { |
1453 | 1846 if ( a5 == 5 ) |
1847 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
1848 else | |
1849 { | |
1850 if ( a5 == 6 ) | |
1851 { | |
1852 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
|
1853 if (a3->IsBroken()) |
1453 | 1854 v29 = 1; |
1855 if (!v29) | |
1856 v29 = 1; | |
1857 sprintfex(a1, "%lu", v29); | |
1858 strcat(pTmpBuf2.data(), a1); | |
1859 dst = strlen(pTmpBuf2.data()); | |
1860 i += 2; | |
1861 break; | |
1862 } | |
1863 } | |
1864 sprintfex(a1, "%lu", v29); | |
1865 strcat(pTmpBuf2.data(), a1); | |
1866 dst = strlen(pTmpBuf2.data()); | |
1867 i += 2; | |
1868 break; | |
0 | 1869 } |
1453 | 1870 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
1871 strcat(pTmpBuf2.data(), a1); | |
1872 dst = strlen(pTmpBuf2.data()); | |
1873 i += 2; | |
1874 break; | |
1875 case 28://ïðîôåññèÿ | |
1876 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); | |
1877 dst = strlen(pTmpBuf2.data()); | |
1878 i += 2; | |
1879 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1880 case 29: |
1453 | 1881 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
1882 strcat(pTmpBuf2.data(), a1); | |
1883 dst = strlen(pTmpBuf2.data()); | |
1884 i += 2; | |
1885 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1886 case 30: |
1453 | 1887 if ( !a6 ) |
1888 { | |
1889 strcat(pTmpBuf2.data(), a4); | |
1890 dst = strlen(pTmpBuf2.data()); | |
1891 i += 2; | |
1892 break; | |
1893 } | |
1459 | 1894 init_summoned_item(&v56, *a6); |
1453 | 1895 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
1896 strcat(pTmpBuf2.data(), a1); | |
1897 dst = strlen(pTmpBuf2.data()); | |
1898 i += 2; | |
1899 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1900 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1901 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1902 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1903 case 34: |
1453 | 1904 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); |
1905 dst = strlen(pTmpBuf2.data()); | |
1906 i += 2; | |
1907 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1908 default: |
0 | 1909 if ( v17 <= 50 || v17 > 70 ) |
1453 | 1910 { |
1911 strncpy(a1, lpsz + i + 1, 2); | |
1912 sprintf(a1, "%lu", atoi(a1)); | |
1913 strcat(pTmpBuf2.data(), a1); | |
1914 dst = strlen(pTmpBuf2.data()); | |
1915 i += 2; | |
1916 break; | |
1917 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1918 if ( v17 - 51 >= 20 ) |
1453 | 1919 { |
1920 strcat(pTmpBuf2.data(), a4); | |
1921 dst = strlen(pTmpBuf2.data()); | |
1922 i += 2; | |
1923 break; | |
1924 } | |
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
|
1925 init_summoned_item(&v56, pParty->PartyTimes._s_times[v17-51]); |
1453 | 1926 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
1927 strcat(pTmpBuf2.data(), a1); | |
1928 dst = strlen(pTmpBuf2.data()); | |
1929 i += 2; | |
1930 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1931 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1932 } |
0 | 1933 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1934 return pTmpBuf2.data(); |
0 | 1935 } |
1936 | |
1937 //----- (0049B04D) -------------------------------------------------------- | |
734 | 1938 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 1939 { |
734 | 1940 //stru154 *v3; // edi@1 |
1941 //signed int v4; // eax@1 | |
1942 //signed int result; // eax@9 | |
1943 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 1944 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 1945 float v7; |
0 | 1946 |
1947 v.x = 0.0; | |
1948 v.y = 0.0; | |
1949 v.z = 0.0; | |
734 | 1950 GetFacePlane(a2, a3, &v, &v7); |
1951 | |
1952 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
1953 polygonType = POLYGON_VerticalWall; | |
1954 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
1955 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
1956 polygonType = POLYGON_Floor; | |
0 | 1957 else |
734 | 1958 polygonType = POLYGON_InBetweenFloorAndWall; |
1959 | |
1960 face_plane.vNormal.x = v.x; | |
1961 face_plane.vNormal.y = v.y; | |
1962 face_plane.vNormal.z = v.z; | |
1963 face_plane.dist = v7; | |
0 | 1964 } |
1965 | |
1966 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 1967 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 1968 { |
734 | 1969 if (fabsf(pNormal->z) < 1e-6f) |
1970 polygonType = POLYGON_VerticalWall; | |
1971 else if (fabsf(pNormal->x) < 1e-6f && | |
1972 fabsf(pNormal->y) < 1e-6f) | |
1973 polygonType = POLYGON_Floor; | |
0 | 1974 else |
734 | 1975 polygonType = POLYGON_InBetweenFloorAndWall; |
1976 | |
1977 face_plane.vNormal.x = pNormal->x; | |
1978 face_plane.dist = dist; | |
1979 face_plane.vNormal.y = pNormal->y; | |
1980 face_plane.vNormal.z = pNormal->z; | |
0 | 1981 } |
1982 | |
1983 //----- (0049B13D) -------------------------------------------------------- | |
734 | 1984 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 1985 { |
1986 ODMFace *v5; // ebx@1 | |
734 | 1987 //int v6; // eax@1 |
1988 //unsigned __int16 *v7; // ebx@2 | |
1989 //Vec3_int_ *v8; // eax@3 | |
0 | 1990 Vec3_int_ *v9; // ecx@3 |
734 | 1991 //double v10; // st7@3 |
1992 //int v11; // ecx@3 | |
0 | 1993 Vec3_int_ *v12; // ecx@3 |
734 | 1994 //double v13; // st7@3 |
1995 //double v14; // st6@3 | |
1996 //double v15; // st5@3 | |
1997 //int v16; // ecx@3 | |
0 | 1998 Vec3_int_ *v17; // eax@3 |
734 | 1999 //double v18; // st5@3 |
0 | 2000 Vec3_float_ *v19; // eax@3 |
734 | 2001 //int result; // eax@8 |
2002 //float v21; // ecx@10 | |
2003 //double v22; // st7@10 | |
2004 //double v23; // st6@10 | |
0 | 2005 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 2006 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 2007 float v26; // [sp+1Ch] [bp-4Ch]@3 |
2008 float v27; // [sp+20h] [bp-48h]@3 | |
2009 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 2010 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
2011 //float v30; // [sp+30h] [bp-38h]@3 | |
2012 //float v31; // [sp+34h] [bp-34h]@3 | |
2013 //float v32; // [sp+38h] [bp-30h]@3 | |
2014 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 2015 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 2016 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
2017 //float v36; // [sp+50h] [bp-18h]@3 | |
2018 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 2019 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 2020 //int v39; // [sp+64h] [bp-4h]@1 |
2021 | |
2022 //v39 = 0; | |
0 | 2023 v1.x = 0.0; |
2024 v5 = pFace; | |
734 | 2025 //v6 = pFace->uNumVertices; |
0 | 2026 v1.y = 0.0; |
2027 v1.z = 0.0; | |
734 | 2028 |
2029 if (pFace->uNumVertices >= 2) | |
2030 { | |
2031 int i = 0; | |
2032 while ( i < pFace->uNumVertices - 2 ) | |
2033 { | |
2034 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
2035 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
2036 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
1093 | 2037 i++; |
734 | 2038 v1.x = v12->x - v9->x; |
2039 v26 = v17->x - v12->x; | |
2040 v1.y = v12->y - v9->y; | |
2041 v27 = v17->y - v12->y; | |
2042 v1.z = v12->z - v9->z; | |
2043 v28 = v17->z - v12->z; | |
0 | 2044 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
2045 v38.x = v19->x; | |
2046 v38.y = v19->y; | |
2047 v38.z = v19->z; | |
734 | 2048 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
2049 { | |
2050 v38.Normalize(); | |
2051 | |
2052 pOutNormal->x = v38.x; | |
2053 pOutNormal->y = v38.y; | |
2054 pOutNormal->z = v38.z; | |
2055 | |
2056 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
2057 return; | |
2058 } | |
2059 } | |
2060 } | |
2061 | |
2062 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
2063 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
2064 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
2065 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 2066 } |
2067 | |
2068 //----- (0049D700) -------------------------------------------------------- | |
2069 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
2070 { | |
2071 unsigned int v1; // eax@1 | |
2072 int v2; // ecx@1 | |
2073 unsigned int v3; // eax@1 | |
2074 | |
2075 v1 = uDim; | |
2076 v2 = 0; | |
2077 v3 = v1 - 1; | |
2078 while ( v3 & 1 ) | |
2079 { | |
2080 v3 >>= 1; | |
2081 ++v2; | |
2082 } | |
2083 return v3 == 0 ? v2 : 0; | |
2084 } | |
2085 | |
2086 //----- (004A19D8) -------------------------------------------------------- | |
737 | 2087 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 2088 { |
737 | 2089 /*signed __int64 v2; // ST10_8@1 |
0 | 2090 double v3; // st7@1 |
2091 float v4; // ST24_4@1 | |
2092 double v5; // ST10_8@1 | |
2093 int v6; // ST1C_4@1 | |
2094 float v7; // ST24_4@1 | |
2095 double v8; // ST10_8@1 | |
2096 unsigned __int8 v9; // ST20_1@1 | |
2097 float v10; // ST24_4@1 | |
2098 double v11; // ST10_8@1 | |
2099 float v12; // ST24_4@1 | |
737 | 2100 double v13; // ST08_8@1*/ |
2101 | |
2102 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
2103 (a2 >> 24) / 255.0f * 255.0f), | |
2104 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
2105 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
2106 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
2107 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
2108 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
2109 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
2110 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
2111 /*v2 = a1 >> 24; | |
2112 v3 = (double)v2 / 255.0f; | |
2113 HIDWORD(v2) = 0; | |
0 | 2114 LODWORD(v2) = a2 >> 24; |
737 | 2115 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 2116 v5 = v4 + 6.7553994e15; |
2117 v6 = LODWORD(v5); | |
737 | 2118 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 2119 v8 = v7 + 6.7553994e15; |
2120 v9 = LOBYTE(v8); | |
737 | 2121 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 2122 v11 = v10 + 6.7553994e15; |
737 | 2123 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 2124 v13 = v12 + 6.7553994e15; |
737 | 2125 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 2126 } |
2127 | |
2128 //----- (004A46E6) -------------------------------------------------------- | |
2129 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
2130 { | |
2131 int v5; // eax@1 | |
2132 int z; // eax@1 | |
2133 unsigned int v7; // eax@9 | |
2134 unsigned int v8; // ecx@9 | |
2135 int v9; // eax@9 | |
2136 unsigned int v10; // eax@10 | |
2137 int *v11; // esi@10 | |
2138 int *v12; // edi@10 | |
2139 int v13; // ecx@10 | |
2140 int v14; // edx@10 | |
2141 unsigned int v15; // eax@22 | |
2142 int *v16; // esi@22 | |
2143 int *v17; // edi@22 | |
2144 int v18; // ecx@22 | |
2145 int v19; // edx@22 | |
2146 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
2147 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
2148 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
2149 signed int v23; // [sp+20h] [bp+Ch]@1 | |
2150 | |
2151 v5 = a4; | |
2152 v23 = _z >> 16; | |
2153 z = x + v5; | |
693 | 2154 if ( z >= (signed int)pViewport->uViewportTL_X |
2155 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
2156 && y >= (signed int)pViewport->uViewportTL_Y | |
2157 && y <= (signed int)pViewport->uViewportBR_Y ) | |
2158 { | |
2159 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
2160 x = pViewport->uViewportTL_X; | |
2161 if ( z > (signed int)pViewport->uViewportBR_X ) | |
2162 z = pViewport->uViewportBR_X; | |
0 | 2163 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
2164 v22 = z - x; | |
2165 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
2166 v7 = lightColor >> 3; | |
2167 v8 = lightColor & 0xF0; | |
2168 v9 = v7 & 0x1E0000; | |
2169 if ( pRenderer->uTargetGBits == 5 ) | |
2170 { | |
2171 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
2172 v11 = (int *)pTarget; | |
2173 v12 = pTargetZ; | |
2174 v13 = v22; | |
2175 v14 = (v10 << 16) | v10; | |
2176 z = (unsigned __int8)pTarget & 2; | |
2177 if ( (unsigned __int8)pTarget & 2 ) | |
2178 { | |
2179 z = (unsigned int)*pTargetZ >> 16; | |
2180 if ( z > v23 ) | |
2181 { | |
2182 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
2183 *pTarget = z; | |
2184 } | |
2185 v13 = v22 - 1; | |
2186 v11 = (int *)(pTarget + 1); | |
2187 v12 = pTargetZ + 1; | |
2188 } | |
2189 while ( v13 != 1 ) | |
2190 { | |
2191 if ( v13 < 1 ) | |
2192 return z; | |
2193 z = (unsigned int)*v12 >> 16; | |
2194 if ( z <= v23 ) | |
2195 { | |
2196 v13 -= 2; | |
2197 ++v11; | |
2198 v12 += 2; | |
2199 } | |
2200 else | |
2201 { | |
2202 v12 += 2; | |
2203 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
2204 v13 -= 2; | |
2205 *v11 = z; | |
2206 ++v11; | |
2207 } | |
2208 } | |
2209 z = (unsigned int)*v12 >> 16; | |
2210 if ( z > v23 ) | |
2211 { | |
2212 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
2213 *(short *)v11 = z; | |
2214 } | |
2215 } | |
2216 else | |
2217 { | |
2218 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
2219 v16 = (int *)pTarget; | |
2220 v17 = pTargetZ; | |
2221 v18 = v22; | |
2222 v19 = (v15 << 16) | v15; | |
2223 z = (unsigned __int8)pTarget & 2; | |
2224 if ( (unsigned __int8)pTarget & 2 ) | |
2225 { | |
2226 z = (unsigned int)*pTargetZ >> 16; | |
2227 if ( z > v23 ) | |
2228 { | |
2229 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
2230 *pTarget = z; | |
2231 } | |
2232 v18 = v22 - 1; | |
2233 v16 = (int *)(pTarget + 1); | |
2234 v17 = pTargetZ + 1; | |
2235 } | |
2236 while ( v18 != 1 ) | |
2237 { | |
2238 if ( v18 < 1 ) | |
2239 return z; | |
2240 z = (unsigned int)*v17 >> 16; | |
2241 if ( z <= v23 ) | |
2242 { | |
2243 v18 -= 2; | |
2244 ++v16; | |
2245 v17 += 2; | |
2246 } | |
2247 else | |
2248 { | |
2249 v17 += 2; | |
2250 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
2251 v18 -= 2; | |
2252 *v16 = z; | |
2253 ++v16; | |
2254 } | |
2255 } | |
2256 z = (unsigned int)*v17 >> 16; | |
2257 if ( z > v23 ) | |
2258 { | |
2259 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
2260 *(short *)v16 = z; | |
2261 } | |
2262 } | |
2263 } | |
2264 return z; | |
2265 } | |
2266 | |
2267 //----- (004A57E9) -------------------------------------------------------- | |
1458 | 2268 void Present_ColorKey() |
0 | 2269 { |
2270 HRESULT v0; // eax@3 | |
2271 HRESULT v1; // eax@3 | |
2272 HRESULT v2; // eax@3 | |
2273 HRESULT v3; // eax@3 | |
2274 HRESULT v4; // eax@3 | |
2275 RECT a2; // [sp+4h] [bp-14h]@3 | |
2276 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
2277 | |
2278 if ( !pRenderer->uNumSceneBegins ) | |
2279 { | |
2280 if ( pRenderer->field_40110 ) | |
2281 { | |
693 | 2282 a2.bottom = pViewport->uViewportTL_Y; |
0 | 2283 a2.left = 0; |
2284 a2.top = 0; | |
2285 a2.right = 640; | |
2286 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
2287 a2.right = 640; | |
2288 a2.left = 0; | |
693 | 2289 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 2290 a2.bottom = 480; |
2291 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
2292 0, | |
693 | 2293 pViewport->uViewportBR_Y + 1, |
0 | 2294 pRenderer->pColorKeySurface4, |
2295 &a2, | |
2296 16u)); | |
693 | 2297 a2.right = pViewport->uViewportTL_X; |
2298 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 2299 a2.left = 0; |
693 | 2300 a2.top = pViewport->uViewportTL_Y; |
0 | 2301 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
2302 0, | |
693 | 2303 pViewport->uViewportTL_Y, |
0 | 2304 pRenderer->pColorKeySurface4, |
2305 &a2, | |
2306 16u)); | |
693 | 2307 a2.left = pViewport->uViewportBR_X; |
2308 a2.top = pViewport->uViewportTL_Y; | |
0 | 2309 a2.right = 640; |
693 | 2310 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 2311 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 2312 pViewport->uViewportBR_X, |
2313 pViewport->uViewportTL_Y, | |
0 | 2314 pRenderer->pColorKeySurface4, |
2315 &a2, | |
2316 16u)); | |
693 | 2317 a2.right = pViewport->uViewportBR_X; |
2318 a2.bottom = pViewport->uViewportBR_Y + 1; | |
2319 a2.left = pViewport->uViewportTL_X; | |
2320 a2.top = pViewport->uViewportTL_Y; | |
0 | 2321 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 2322 pViewport->uViewportTL_X, |
2323 pViewport->uViewportTL_Y, | |
0 | 2324 pRenderer->pColorKeySurface4, |
2325 &a2, | |
2326 17u)); | |
2327 } | |
2328 } | |
2329 } | |
2330 | |
2331 //----- (004A597D) -------------------------------------------------------- | |
2332 void Present_NoColorKey() | |
2333 { | |
2334 //unsigned __int16 *v0; // eax@4 | |
2335 unsigned __int16 *v1; // esi@4 | |
2336 void *v2; // edi@4 | |
2337 //signed int v4; // ebx@4 | |
2338 //signed int v5; // ebx@6 | |
2339 //void *v6; // edi@7 | |
2340 //const void *v7; // esi@7 | |
2341 signed int v8; // ebx@8 | |
2342 int v9; // eax@10 | |
2343 unsigned int v10; // esi@10 | |
2344 unsigned __int32 v11; // edi@10 | |
2345 //int v12; // ecx@10 | |
2346 unsigned int v13; // ebx@10 | |
2347 int v14; // eax@11 | |
2348 int v15; // eax@13 | |
2349 int v16; // eax@14 | |
2350 int v17; // eax@16 | |
2351 HRESULT v18; // eax@22 | |
2352 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
2353 int v20; // [sp+88h] [bp-1Ch]@10 | |
2354 int v21; // [sp+8Ch] [bp-18h]@10 | |
2355 __int32 v22; // [sp+90h] [bp-14h]@10 | |
2356 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
2357 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
2358 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
2359 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
2360 | |
2361 if ( !pRenderer->uNumSceneBegins ) | |
2362 { | |
2363 if ( pRenderer->field_40110 ) | |
2364 { | |
2365 memset(&Dst, 0, 0x7Cu); | |
2366 Dst.dwSize = 124; | |
168 | 2367 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 2368 { |
2369 //v26 = Dst.lpSurface; | |
2370 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
2371 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
2372 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
2373 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
2374 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
2375 v1 = pRenderer->pTargetSurface; | |
2376 v2 = Dst.lpSurface; | |
2377 | |
2378 | |
2379 /*for (uint y = 0; y < 480; ++y) | |
2380 { | |
2381 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
2382 for (uint x = 0; x < 640; ++x) | |
2383 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
2384 }*/ | |
2385 | |
1980 | 2386 ushort* pSrc = pRenderer->pTargetSurface; |
2387 short* pDst = (__int16 *)Dst.lpSurface; | |
0 | 2388 |
2389 for (uint y = 0; y < 8; ++y) | |
2390 memcpy(pDst + y * Dst.lPitch / 2, | |
2391 | |
2392 pSrc + y * 640, 640 * sizeof(__int16)); | |
2393 | |
2394 for (uint y = 8; y < 352; ++y) | |
2395 { | |
2396 memcpy(pDst + y * Dst.lPitch / 2, | |
2397 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 2398 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
2399 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 2400 } |
2401 | |
121 | 2402 for (uint y = 352; y < 480; ++y) |
0 | 2403 memcpy(pDst + y * Dst.lPitch / 2, |
2404 pSrc + y * 640, 640 * sizeof(__int16)); | |
2405 | |
2406 | |
1980 | 2407 ushort* pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 2408 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
1980 | 2409 short* pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 2410 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 2411 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 2412 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
2413 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
2414 v21 = 4 * v9 + 1280; | |
2415 | |
121 | 2416 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 2417 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
2418 v10 = (int)pSrc_x1y1; | |
2419 v11 = (int)pDst_x1y1; | |
1980 | 2420 int uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 2421 v13 = v24; |
2422 | |
693 | 2423 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 2424 { |
2425 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
2426 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 2427 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 2428 { |
2429 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
2430 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
2431 } | |
2432 } | |
2433 | |
2434 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2435 | |
2436 /* while ( 1 ) | |
2437 { | |
2438 while ( 1 ) | |
2439 { | |
2440 v14 = *(int *)v10; | |
2441 v10 += 4; | |
2442 if ( v14 == v13 ) | |
2443 break; | |
2444 if ( (short)v14 == (short)v13 ) | |
2445 { | |
2446 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
2447 v11 += 4; | |
2448 --uHalfWidth; | |
2449 if ( !uHalfWidth ) | |
2450 goto LABEL_21; | |
2451 } | |
2452 else | |
2453 { | |
2454 v15 = __ROL__(v14, 16); | |
2455 if ( (short)v15 == (short)v13 ) | |
2456 { | |
2457 v17 = __ROR__(v15, 16); | |
2458 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
2459 v11 += 4; | |
2460 --uHalfWidth; | |
2461 if ( !uHalfWidth ) | |
2462 goto LABEL_21; | |
2463 } | |
2464 else | |
2465 { | |
2466 v16 = __ROR__(v15, 16); | |
2467 *(int *)v11 = v16; | |
2468 v11 += 4; | |
2469 --uHalfWidth; | |
2470 if ( !uHalfWidth ) | |
2471 goto LABEL_21; | |
2472 } | |
2473 } | |
2474 } | |
2475 v11 += 4; | |
2476 --uHalfWidth; | |
2477 if ( !uHalfWidth ) | |
2478 { | |
2479 LABEL_21: | |
2480 v10 += v21; | |
2481 v11 += v22; | |
2482 uHalfWidth = v20; | |
2483 if ( !--uNumLines ) | |
2484 { | |
2485 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2486 return; | |
2487 } | |
2488 } | |
2489 }*/ | |
2490 } | |
2491 } | |
2492 } | |
2493 } | |
2494 | |
2495 //----- (004A7063) -------------------------------------------------------- | |
1390 | 2496 unsigned int ModulateColor(unsigned int diffuse, float multiplier) |
0 | 2497 { |
1390 | 2498 float alpha = multiplier * ((diffuse >> 24) & 0xFF); |
2499 int a = (int)floorf(alpha + 0.5f); | |
2500 a = max(0, min(255, a)); | |
2501 | |
2502 float red = multiplier * ((diffuse >> 16) & 0xFF); | |
2503 int r = (int)floorf(red + 0.5f); | |
2504 r = max(0, min(255, r)); | |
2505 | |
2506 float green = multiplier * ((diffuse >> 8) & 0xFF); | |
2507 int g = (int)floorf(green + 0.5f); | |
2508 g = max(0, min(255, g)); | |
2509 | |
2510 float blue = multiplier * ((diffuse >> 0) & 0xFF); | |
2511 int b = (int)floorf(blue + 0.5f); | |
2512 b = max(0, min(255, b)); | |
2513 | |
2514 return (a << 24) | (r << 16) | (g << 8) | b; | |
0 | 2515 } |
2516 | |
2517 | |
2518 | |
2519 //----- (004B1447) -------------------------------------------------------- | |
1754 | 2520 void sub_4B1447_party_fine(int a1, int a2, int a3) |
0 | 2521 { |
2522 signed int v3; // esi@1 | |
2523 char v4; // sf@8 | |
2524 int v5; // eax@8 | |
2525 unsigned __int64 v6; // qax@12 | |
2526 DDM_DLV_Header *v7; // eax@14 | |
2527 | |
2528 v3 = 0; | |
2529 if ( a2 ) | |
2530 { | |
1754 | 2531 if ( a2 == 1 ) |
2532 v3 = 2; | |
2533 if ( a2 == 2 ) | |
2534 v3 = 2; | |
0 | 2535 goto LABEL_13; |
2536 } | |
2537 else | |
2538 { | |
2539 v3 = 1; | |
2540 } | |
2541 if ( pParty->uFine < 4000000 ) | |
2542 { | |
2543 v4 = a3 + pParty->uFine < 0; | |
2544 v5 = a3 + pParty->uFine; | |
2545 pParty->uFine += a3; | |
2546 if ( v4 ) | |
2547 { | |
2548 v5 = 0; | |
2549 pParty->uFine = 0; | |
2550 } | |
2551 if ( v5 > 4000000 ) | |
2552 pParty->uFine = 4000000; | |
2553 } | |
487 | 2554 |
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
|
2555 pParty->PartyTimes._shop_ban_times[a1] = pParty->uTimePlayed + 368640; |
487 | 2556 |
0 | 2557 LABEL_13: |
463 | 2558 pParty->InTheShopFlags[a1] = 1; |
0 | 2559 if ( v3 ) |
2560 { | |
2561 v7 = &pOutdoor->ddm; | |
2562 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
2563 v7 = &pIndoor->dlv; | |
2564 v7->uReputation += v3; | |
2565 if ( v7->uReputation > 10000 ) | |
2566 v7->uReputation = 10000; | |
2567 } | |
1754 | 2568 for ( uint i = 1; i <= 4; ++i ) |
0 | 2569 { |
2570 if ( pParty->uFine ) | |
2571 { | |
1754 | 2572 if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) ) |
2573 _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1); | |
0 | 2574 } |
2575 } | |
2576 } | |
2577 | |
2578 //----- (004B1523) -------------------------------------------------------- | |
1458 | 2579 void sub_4B1523(int *_this) |
0 | 2580 { |
2581 int v1; // esi@1 | |
2582 int v2; // edx@1 | |
2583 unsigned int v3; // eax@2 | |
2584 int v4; // eax@4 | |
2585 LONG v5; // ecx@4 | |
2586 int v6; // eax@10 | |
2587 char *v7; // ST44_4@12 | |
2588 unsigned __int16 v8; // ax@12 | |
2589 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
2590 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
2591 POINT a2; // [sp+64h] [bp-10h]@1 | |
2592 int v13; // [sp+6Ch] [bp-8h]@4 | |
2593 int v14; // [sp+70h] [bp-4h]@4 | |
2594 | |
2595 v1 = *_this - 399; | |
2596 v2 = (*_this - 400) % 11 + 1; | |
2597 v11 = 4 * (*_this - 400) / 11; | |
1312 | 2598 // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used |
0 | 2599 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) |
2600 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
2601 else | |
2602 v3 = 30; | |
2603 a1.Hint = 0; | |
2604 a1.uFrameY = v3; | |
2605 a1.uFrameWidth = 328; | |
2606 a1.uFrameHeight = 68; | |
2607 a1.uFrameX = 90; | |
2608 a1.uFrameZ = 417; | |
2609 a1.uFrameW = v3 + 67; | |
2610 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
2611 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
2612 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
2613 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
2614 v5 = a2.y; | |
2615 if ( v14 > a2.y ) | |
2616 v5 = v14; | |
2617 if ( v13 > v5 ) | |
2618 v5 = v13; | |
2619 if ( v4 > v5 ) | |
2620 v5 = v4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2621 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 | 2622 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" |
2623 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
2624 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
2625 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
2626 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
|
2627 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); |
0 | 2628 a1.uFrameHeight += v6; |
2629 if ( (signed int)a1.uFrameHeight < 150 ) | |
2630 a1.uFrameHeight = 150; | |
819 | 2631 a1.uFrameWidth = game_viewport_width; |
0 | 2632 a1.DrawMessageBox(0); |
2633 a1.uFrameWidth -= 12; | |
2634 a1.uFrameHeight -= 12; | |
2635 v7 = pSpellStats->pInfos[v1].pName; | |
2636 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
2637 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 2638 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 2639 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
|
2640 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); |
0 | 2641 a1.uFrameZ = a1.uFrameX + 107; |
2642 a1.uFrameWidth = 108; | |
2643 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
1393 | 2644 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
|
2645 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); |
0 | 2646 } |
2647 | |
2648 //----- (004B1ECE) -------------------------------------------------------- | |
1459 | 2649 void OracleDialogue() |
0 | 2650 { |
2651 __int16 *v0; // edi@1 | |
2652 int v1; // ebx@3 | |
2653 Player *v2; // esi@3 | |
2654 int v3; // eax@4 | |
2655 signed int v4; // eax@9 | |
2656 int v5; // ebx@11 | |
89 | 2657 Player *v6; // esi@13 |
2658 ItemGen *v7; // eax@14 | |
0 | 2659 signed int v8; // edi@14 |
89 | 2660 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 2661 signed int v10; // [sp+10h] [bp-8h]@13 |
2662 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 2663 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 2664 |
484 | 2665 contract_approved = 0; |
0 | 2666 v11 = 0; |
2667 uDialogueType = 84; | |
827 | 2668 current_npc_text = (char *)pNPCTopics[667].pText; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2669 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); |
0 | 2670 while ( 1 ) |
2671 { | |
484 | 2672 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 2673 { |
2674 v1 = 0; | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
2675 v2 = pParty->pPlayers.data(); |
0 | 2676 do |
2677 { | |
89 | 2678 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 2679 if ( v3 ) |
2680 break; | |
2681 ++v2; | |
2682 ++v1; | |
2683 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
2684 while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); |
0 | 2685 if ( v1 == 4 ) |
2686 break; | |
2687 } | |
2688 ++v11; | |
2689 v0 += 2; | |
89 | 2690 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
2691 break; | |
2692 } | |
2693 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
2694 { | |
827 | 2695 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 2696 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 2697 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 2698 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
2699 } | |
484 | 2700 if ( contract_approved == 601 ) |
0 | 2701 { |
2702 v5 = 0; | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
2703 v12 = pParty->pPlayers.data();//[0].uClass; |
0 | 2704 v9 = 0; |
2705 while ( 1 ) | |
2706 { | |
135 | 2707 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 2708 { |
2709 v10 = 0; | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
2710 v6 = pParty->pPlayers.data();//[0].pInventoryItems[0].field_1A; |
0 | 2711 do |
2712 { | |
1826 | 2713 v7 = v6->pInventoryItemList.data(); |
0 | 2714 v8 = 138; |
2715 do | |
2716 { | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1355
diff
changeset
|
2717 if ( v7->uItemID == ITEM_LICH_JAR_FULL ) |
0 | 2718 { |
377 | 2719 if ( !v7->uHolderPlayer ) |
89 | 2720 v9 = v7; |
377 | 2721 if ( v7->uHolderPlayer == v5 ) |
0 | 2722 v10 = 1; |
2723 } | |
89 | 2724 ++v7; |
0 | 2725 --v8; |
2726 } | |
2727 while ( v8 ); | |
89 | 2728 ++v6; |
2729 } | |
2730 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 2731 if ( !v10 ) |
2732 break; | |
2733 } | |
89 | 2734 ++v12; |
0 | 2735 ++v5; |
89 | 2736 if ( v12 > &pParty->pPlayers[3] ) |
0 | 2737 return; |
2738 } | |
2739 if ( v9 ) | |
377 | 2740 v9->uHolderPlayer = v5; |
0 | 2741 } |
2742 } | |
2743 | |
2744 //----- (004B254D) -------------------------------------------------------- | |
1458 | 2745 char * _4B254D_SkillMasteryTeacher(int _this) |
0 | 2746 { |
955 | 2747 //Player *v1; // esi@1 |
0 | 2748 int v2; // edx@1 |
2749 int v3; // ecx@1 | |
2750 int v4; // edi@1 | |
955 | 2751 int pClassType; // eax@7 |
0 | 2752 int v6; // eax@7 |
2753 int v7; // ebx@7 | |
955 | 2754 //int v8; // ebx@8 |
0 | 2755 signed int v9; // esi@8 |
2756 int v10; // eax@8 | |
2757 char *v11; // ecx@8 | |
2758 int v12; // edi@9 | |
2759 char *v13; // edx@9 | |
2760 signed int v14; // edi@10 | |
2761 unsigned int v16; // eax@29 | |
955 | 2762 //int v17; // eax@36 |
0 | 2763 char v18; // cl@46 |
2764 __int16 v19; // dx@56 | |
2765 int v20; // eax@60 | |
955 | 2766 //char *v21; // [sp-Ch] [bp-38h]@82 |
2767 //const char *v22; // [sp-8h] [bp-34h]@21 | |
2768 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
2769 //char *v24; // [sp-8h] [bp-34h]@82 | |
1838 | 2770 const char *v25; // [sp-4h] [bp-30h]@14 |
955 | 2771 //int v26; // [sp-4h] [bp-30h]@38 |
2772 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 2773 char v28[4]; // [sp+Ch] [bp-20h]@9 |
2774 int v29; // [sp+10h] [bp-1Ch]@13 | |
2775 int v30; // [sp+14h] [bp-18h]@15 | |
2776 int v31; // [sp+18h] [bp-14h]@16 | |
2777 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 2778 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 2779 int v34; // [sp+24h] [bp-8h]@7 |
2780 char *v35; // [sp+28h] [bp-4h]@1 | |
2781 | |
484 | 2782 contract_approved = 0; |
0 | 2783 v2 = (_this - 200) % 3; |
2784 v3 = (_this - 200) / 3; | |
2785 v4 = v2; | |
2786 v35 = (char *)pNPCTopics[127].pText; | |
492 | 2787 dword_F8B1AC_award_bit_number = v3; |
0 | 2788 if ( v2 ) |
2789 { | |
2790 if ( v2 == 1 ) | |
2791 { | |
267 | 2792 gold_transaction_amount = 5000; |
0 | 2793 dword_F8B1B0 = 3; |
2794 } | |
2795 else | |
2796 { | |
2797 if ( v2 == 2 ) | |
2798 { | |
267 | 2799 gold_transaction_amount = 8000; |
0 | 2800 dword_F8B1B0 = 4; |
2801 } | |
2802 } | |
2803 } | |
2804 else | |
2805 { | |
267 | 2806 gold_transaction_amount = 2000; |
0 | 2807 dword_F8B1B0 = 2; |
2808 } | |
955 | 2809 pClassType = pPlayers[uActiveCharacter]->classType; |
2810 //v33 = pClassType; | |
2811 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
2812 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 2813 v7 = a1[0] & 0x3F; |
2814 v34 = v2 + 2; | |
2815 if ( v6 < v2 + 2 ) | |
2816 { | |
955 | 2817 //v8 = v33; |
0 | 2818 v9 = 0; |
955 | 2819 v10 = pClassType - pClassType % 4; |
2820 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 2821 do |
2822 { | |
2823 v12 = (unsigned __int8)*v11; | |
2824 v13 = &v28[4 * v9]; | |
2825 *(int *)v13 = 0; | |
2826 if ( v12 < v34 ) | |
2827 { | |
2828 v14 = 1; | |
2829 } | |
2830 else | |
2831 { | |
2832 v14 = 1; | |
2833 *(int *)v13 = 1; | |
2834 } | |
2835 ++v9; | |
2836 v11 += 37; | |
2837 } | |
2838 while ( v9 < 4 ); | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
2839 __debugbreak(); // warning C4700: uninitialized local variable 'v29' used |
0 | 2840 if ( v29 == v14 ) |
2841 { | |
2842 v25 = pClassNames[v10 + 1]; | |
2843 } | |
2844 else | |
2845 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
2846 __debugbreak(); // warning C4700: uninitialized local variable 'v30' used |
955 | 2847 if ( v30 == v14 )//crash |
0 | 2848 { |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
2849 __debugbreak(); // warning C4700: uninitialized local variable 'v31' used |
0 | 2850 if ( v31 == v14 ) |
2851 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2852 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
|
2853 return pTmpBuf.data(); |
0 | 2854 } |
2855 v25 = pClassNames[v10 + 2]; | |
2856 } | |
2857 else | |
2858 { | |
2859 if ( v31 != v14 ) | |
2860 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2861 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
|
2862 return pTmpBuf.data(); |
0 | 2863 } |
2864 v25 = pClassNames[v10 + 3]; | |
2865 } | |
2866 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2867 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2868 return pTmpBuf.data(); |
0 | 2869 } |
955 | 2870 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 2871 return (char *)pNPCTopics[122].pText; |
2872 if ( !v7 ) | |
2873 return (char *)pNPCTopics[131].pText; | |
2874 v16 = SkillToMastery(a1[0]); | |
2875 if ( (signed int)v16 > v4 + 1 ) | |
2876 return (char *)pNPCTopics[v4 + 128].pText; | |
2877 if ( v34 != 2 ) | |
2878 { | |
2879 if ( v34 == 3 ) | |
2880 { | |
2881 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
2882 { | |
492 | 2883 switch ( dword_F8B1AC_award_bit_number ) |
0 | 2884 { |
2885 case 12: | |
2886 case 13: | |
2887 case 14: | |
2888 case 15: | |
2889 case 16: | |
2890 case 17: | |
2891 case 18: | |
267 | 2892 gold_transaction_amount = 4000; |
0 | 2893 goto LABEL_42; |
2894 case 19: | |
2895 v19 = 114; | |
955 | 2896 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
2897 return v35; | |
2898 if ( !gold_transaction_amount ) | |
2899 goto LABEL_79; | |
2900 goto LABEL_42; | |
0 | 2901 case 20: |
2902 v19 = 110; | |
484 | 2903 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 2904 return v35; |
955 | 2905 if ( !gold_transaction_amount ) |
2906 goto LABEL_79; | |
2907 goto LABEL_42; | |
0 | 2908 case 22: |
955 | 2909 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
2910 if ( v20 < 50 ) | |
2911 return v35; | |
2912 if ( !gold_transaction_amount ) | |
2913 goto LABEL_79; | |
2914 goto LABEL_42; | |
0 | 2915 case 24: |
267 | 2916 gold_transaction_amount = 2500; |
955 | 2917 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 2918 if ( v20 < 50 ) |
2919 return v35; | |
955 | 2920 if ( !gold_transaction_amount ) |
2921 goto LABEL_79; | |
2922 goto LABEL_42; | |
2923 case 36: | |
2924 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
2925 if ( v20 < 50 ) | |
2926 return v35; | |
2927 if ( !gold_transaction_amount ) | |
2928 goto LABEL_79; | |
2929 goto LABEL_42; | |
0 | 2930 case 21: |
2931 case 23: | |
2932 case 25: | |
2933 case 26: | |
2934 case 29: | |
2935 case 32: | |
2936 case 34: | |
2937 case 35: | |
267 | 2938 gold_transaction_amount = 2500; |
0 | 2939 goto LABEL_42; |
2940 case 8: | |
2941 case 9: | |
2942 case 10: | |
2943 case 11: | |
267 | 2944 gold_transaction_amount = 3000; |
0 | 2945 goto LABEL_42; |
2946 case 7: | |
955 | 2947 gold_transaction_amount = 0; |
2948 if ( !gold_transaction_amount ) | |
2949 goto LABEL_79; | |
2950 goto LABEL_42; | |
2951 default: | |
2952 if ( !gold_transaction_amount ) | |
2953 goto LABEL_79; | |
2954 goto LABEL_42; | |
0 | 2955 } |
955 | 2956 gold_transaction_amount = 0; |
2957 if ( !gold_transaction_amount ) | |
2958 goto LABEL_79; | |
2959 goto LABEL_42; | |
0 | 2960 } |
2961 } | |
2962 else | |
2963 { | |
2964 if ( v34 != 4 ) | |
2965 { | |
955 | 2966 if ( !gold_transaction_amount ) |
2967 goto LABEL_79; | |
2968 goto LABEL_42; | |
0 | 2969 } |
2970 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
2971 { | |
492 | 2972 switch ( dword_F8B1AC_award_bit_number ) |
0 | 2973 { |
2974 case 19: | |
1355 | 2975 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) == 1 ) |
955 | 2976 { |
2977 if ( !gold_transaction_amount ) | |
2978 goto LABEL_79; | |
2979 goto LABEL_42; | |
2980 } | |
1355 | 2981 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1) == 1 ) |
955 | 2982 { |
2983 if ( !gold_transaction_amount ) | |
2984 goto LABEL_79; | |
2985 goto LABEL_42; | |
2986 } | |
2987 return v35; | |
0 | 2988 case 20: |
1355 | 2989 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) == 1 ) |
955 | 2990 { |
2991 if ( !gold_transaction_amount ) | |
2992 goto LABEL_79; | |
2993 goto LABEL_42; | |
2994 } | |
1355 | 2995 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1) == 1 ) |
955 | 2996 { |
2997 if ( !gold_transaction_amount ) | |
2998 goto LABEL_79; | |
2999 goto LABEL_42; | |
3000 } | |
0 | 3001 return v35; |
3002 case 30: | |
955 | 3003 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 3004 if ( (v18 & 0x3Fu) < 0xA ) |
3005 return v35; | |
955 | 3006 if ( !gold_transaction_amount ) |
3007 goto LABEL_79; | |
3008 goto LABEL_42; | |
3009 case 31: | |
3010 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
3011 if ( (v18 & 0x3Fu) < 0xA ) | |
3012 return v35; | |
3013 if ( !gold_transaction_amount ) | |
3014 goto LABEL_79; | |
3015 goto LABEL_42; | |
0 | 3016 case 21: |
3017 case 23: | |
3018 case 24: | |
3019 case 25: | |
3020 case 26: | |
3021 case 29: | |
3022 case 32: | |
3023 case 34: | |
3024 case 35: | |
267 | 3025 gold_transaction_amount = 6000; |
0 | 3026 goto LABEL_42; |
3027 case 8: | |
3028 case 9: | |
3029 case 10: | |
3030 case 11: | |
267 | 3031 gold_transaction_amount = 7000; |
0 | 3032 goto LABEL_42; |
3033 case 7: | |
3034 break; | |
955 | 3035 default: |
3036 if ( !gold_transaction_amount ) | |
3037 goto LABEL_79; | |
3038 goto LABEL_42; | |
0 | 3039 } |
267 | 3040 gold_transaction_amount = 0; |
955 | 3041 if ( !gold_transaction_amount ) |
3042 goto LABEL_79; | |
3043 goto LABEL_42; | |
0 | 3044 } |
3045 } | |
3046 return v35; | |
3047 } | |
3048 if ( v7 < 4 ) | |
3049 return v35; | |
492 | 3050 if ( dword_F8B1AC_award_bit_number > 27 ) |
3051 { | |
3052 if ( dword_F8B1AC_award_bit_number != 29 | |
3053 && dword_F8B1AC_award_bit_number != 32 | |
3054 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 3055 { |
267 | 3056 if ( !gold_transaction_amount ) |
0 | 3057 goto LABEL_79; |
3058 goto LABEL_42; | |
3059 } | |
267 | 3060 gold_transaction_amount = 500; |
955 | 3061 if ( !gold_transaction_amount ) |
3062 goto LABEL_79; | |
3063 goto LABEL_42; | |
0 | 3064 } |
492 | 3065 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 3066 { |
3067 gold_transaction_amount = 500; | |
3068 if ( !gold_transaction_amount ) | |
3069 goto LABEL_79; | |
3070 goto LABEL_42; | |
3071 } | |
492 | 3072 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 3073 { |
267 | 3074 gold_transaction_amount = 0; |
0 | 3075 goto LABEL_79; |
3076 } | |
492 | 3077 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 3078 { |
3079 if ( !gold_transaction_amount ) | |
3080 goto LABEL_79; | |
3081 goto LABEL_42; | |
3082 } | |
492 | 3083 if ( dword_F8B1AC_award_bit_number > 18 ) |
3084 { | |
3085 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 3086 { |
3087 if ( !gold_transaction_amount ) | |
3088 goto LABEL_79; | |
3089 goto LABEL_42; | |
3090 } | |
3091 gold_transaction_amount = 500; | |
3092 if ( !gold_transaction_amount ) | |
3093 goto LABEL_79; | |
3094 goto LABEL_42; | |
0 | 3095 } |
267 | 3096 gold_transaction_amount = 1000; |
0 | 3097 LABEL_42: |
267 | 3098 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 3099 return (char *)pNPCTopics[124].pText; |
3100 LABEL_79: | |
484 | 3101 contract_approved = 1; |
0 | 3102 if ( v34 == 2 ) |
3103 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3104 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
955 | 3105 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
|
3106 return pTmpBuf2.data(); |
0 | 3107 } |
3108 if ( v34 == 3 ) | |
3109 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3110 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 3111 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
|
3112 return pTmpBuf2.data(); |
0 | 3113 } |
3114 if ( v34 == 4 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3115 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 3116 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
|
3117 return pTmpBuf2.data(); |
0 | 3118 } |
3119 | |
3120 //----- (004B3E1E) -------------------------------------------------------- | |
1458 | 3121 void sub_4B3E1E() |
0 | 3122 { |
3123 NPCData *v0; // ST40_4@1 | |
3124 signed int v1; // edi@1 | |
165 | 3125 //GUIWindow *v2; // ecx@1 |
0 | 3126 |
167 | 3127 __debugbreak(); |
602 | 3128 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 3129 v1 = 0; |
3130 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
3131 pDialogueWindow->Release(); | |
165 | 3132 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 3133 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 3134 { |
832 | 3135 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 3136 v1 = 1; |
3137 } | |
832 | 3138 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 3139 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 3140 } |
3141 | |
3142 | |
3143 //----- (004B3FE5) -------------------------------------------------------- | |
1582 | 3144 void __fastcall _4B3FE5_training_dialogue(int a4) |
0 | 3145 { |
3146 int v1; // edi@1 | |
1838 | 3147 const char *v2; // edi@1 |
1411 | 3148 |
3149 __debugbreak(); | |
0 | 3150 v1 = a4; |
3151 uDialogueType = 78; | |
827 | 3152 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 3153 _4B254D_SkillMasteryTeacher(a4); |
3154 pDialogueWindow->Release(); | |
3155 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
3156 v2 = ""; | |
832 | 3157 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 3158 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 3159 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 3160 if ( contract_approved ) |
0 | 3161 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 3162 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 3163 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 3164 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 3165 } |
3166 // F8B19C: using guessed type int dword_F8B19C; | |
3167 // F8B1A8: using guessed type int dword_F8B1A8; | |
3168 | |
3169 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 3170 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
1411 | 3171 { |
0 | 3172 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
3173 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 3174 v4 = pFontLucida->AlignText_Center(450, Str); |
3175 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 3176 } |
3177 | |
3178 //----- (004B46F8) -------------------------------------------------------- | |
1459 | 3179 __int64 GetExperienceRequiredForLevel(int level) |
0 | 3180 { |
1459 | 3181 __int64 v1; // eax@1 |
0 | 3182 int i; // edx@1 |
3183 | |
3184 v1 = 0; | |
1459 | 3185 for ( i = 0; i < level; ++i ) |
0 | 3186 v1 += i + 1; |
3187 return 1000 * v1; | |
3188 } | |
3189 | |
3190 //----- (004BC49B) -------------------------------------------------------- | |
651 | 3191 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 3192 { |
656 | 3193 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3194 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3195 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3196 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3197 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3198 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3199 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3200 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3201 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3202 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3203 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3204 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3205 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3206 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3207 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3208 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3209 //v1 = _this; |
656 | 3210 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3211 //v3 = v1; |
656 | 3212 uDialogueType = newDialogueType; |
3213 if (!speakingNPC->uFlags) | |
3214 { | |
3215 speakingNPC->uFlags = 1; | |
3216 //v3 = uDialogueType; | |
3217 } | |
3218 | |
3219 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
3220 { | |
3221 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
3222 } | |
3223 else if(newDialogueType == DIALOGUE_76) | |
3224 { | |
3225 if (speakingNPC->Hired()) | |
3226 { | |
3227 v8 = 0; | |
3228 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
3229 { | |
3230 v6 = (char *)pNPCStats->pNewNPCData; | |
3231 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
3232 { | |
3233 ++v8; | |
3234 v6 += 76; | |
3235 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
3236 break; | |
3237 } | |
3238 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
3239 v6[8] &= 0x7Fu; | |
3240 } | |
1104 | 3241 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 3242 { |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
3243 v11 = pParty->pHirelings.data(); |
656 | 3244 memset(v11, 0, sizeof(NPCData)); |
3245 } | |
1104 | 3246 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 3247 { |
3248 v11 = &pParty->pHirelings[1]; | |
3249 memset(v11, 0, sizeof(NPCData)); | |
3250 } | |
1793
4dee76d79c78
dword_5B65CC to npcIdToDismissAfterDialogue, Party::field_709 to Party::hirelingScrollPosition
Grumpy7
parents:
1754
diff
changeset
|
3251 pParty->hirelingScrollPosition = 0; |
1035 | 3252 pParty->CountHirelings(); |
656 | 3253 dword_591084 = 0; |
3254 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3255 dword_7241C8 = 0; | |
3256 return; | |
3257 } | |
3258 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
3259 { | |
3260 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
3261 ShowStatusBarString(v7, 2u); | |
3262 } | |
3263 else | |
3264 { | |
3265 //v9 = v2->uProfession; | |
3266 if ( speakingNPC->uProfession != 51 ) | |
3267 { | |
3268 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
3269 if ( pParty->uNumGold < v10 ) | |
3270 { | |
3271 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
3272 dialogue_show_profession_details = false; | |
3273 uDialogueType = 13; | |
3274 if ( uActiveCharacter ) | |
3275 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
3276 v7 = pGlobalTXT_LocalizationStrings[155]; | |
3277 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
3278 if ( !dword_7241C8 ) | |
3279 pGame->Draw(); | |
3280 dword_7241C8 = 0; | |
3281 return; | |
3282 } | |
3283 Party::TakeGold(v10); | |
3284 } | |
3285 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
3286 if ( pParty->pHirelings[0].pName ) | |
3287 { | |
3288 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
3289 v15 = speakingNPC->pName; | |
3290 v13 = pParty->pHireling2Name; | |
3291 } | |
3292 else | |
3293 { | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
3294 memcpy(pParty->pHirelings.data(), speakingNPC, 0x4Cu); |
656 | 3295 v15 = speakingNPC->pName; |
3296 v13 = pParty->pHireling1Name; | |
3297 } | |
3298 strcpy(v13, v15); | |
1793
4dee76d79c78
dword_5B65CC to npcIdToDismissAfterDialogue, Party::field_709 to Party::hirelingScrollPosition
Grumpy7
parents:
1754
diff
changeset
|
3299 pParty->hirelingScrollPosition = 0; |
1035 | 3300 pParty->CountHirelings(); |
656 | 3301 |
3302 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3303 | |
711 | 3304 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 3305 pDialogue_SpeakingActor->uAIState = Removed; |
3306 if ( uActiveCharacter ) | |
3307 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
3308 } | |
3309 } | |
3310 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
3311 { | |
3312 ArenaFight(); | |
3313 return; | |
3314 } | |
1413 | 3315 else if(newDialogueType == DIALOGUE_USE_NPC_ABILITY) |
656 | 3316 { |
1413 | 3317 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0) |
656 | 3318 { |
1413 | 3319 if ( speakingNPC->uProfession != GateMaster ) |
656 | 3320 speakingNPC->bHasUsedTheAbility = 1; |
3321 | |
3322 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3323 } | |
3324 else | |
1413 | 3325 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!" |
656 | 3326 } |
3327 else if(newDialogueType == DIALOGUE_13) | |
3328 { | |
3329 if (!speakingNPC->Hired()) | |
3330 { | |
3331 sub_4B3E1E(); | |
3332 dialogue_show_profession_details = false; | |
3333 } | |
3334 else | |
3335 { | |
3336 v5 = 0; | |
3337 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
3338 { | |
3339 v6 = (char *)pNPCStats->pNewNPCData; | |
3340 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
3341 { | |
3342 ++v5; | |
3343 v6 += 76; | |
3344 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
3345 break; | |
3346 } | |
3347 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
3348 v6[8] &= 0x7Fu; | |
3349 } | |
1104 | 3350 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 3351 { |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1838
diff
changeset
|
3352 v11 = pParty->pHirelings.data(); |
656 | 3353 memset(v11, 0, sizeof(NPCData)); |
3354 } | |
1104 | 3355 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 3356 { |
3357 v11 = &pParty->pHirelings[1]; | |
3358 memset(v11, 0, sizeof(NPCData)); | |
3359 } | |
1793
4dee76d79c78
dword_5B65CC to npcIdToDismissAfterDialogue, Party::field_709 to Party::hirelingScrollPosition
Grumpy7
parents:
1754
diff
changeset
|
3360 pParty->hirelingScrollPosition = 0; |
1035 | 3361 pParty->CountHirelings(); |
656 | 3362 dword_591084 = 0; |
3363 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3364 dword_7241C8 = 0; | |
3365 return; | |
3366 } | |
3367 } | |
3368 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
3369 { | |
3370 switch(newDialogueType) | |
3371 { | |
3372 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
3373 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
3374 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
3375 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
3376 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
3377 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
3378 } | |
3379 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
1582 | 3380 _4B3FE5_training_dialogue(npc_event_id); //200-310 |
656 | 3381 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) |
3382 { //400-410 | |
3383 dword_F8B1D8 = newDialogueType; | |
3384 DrawJoinGuildWindow(npc_event_id - 400); | |
3385 } | |
3386 else | |
3387 { | |
3388 switch ( npc_event_id ) | |
3389 { | |
3390 case 139: | |
1459 | 3391 OracleDialogue(); |
656 | 3392 break; |
3393 case 311: | |
1529 | 3394 CheckBountyRespawnAndAward(); |
656 | 3395 break; |
3396 case 399: | |
1914 | 3397 Arena_SelectionFightLevel(); |
656 | 3398 break; |
3399 default: | |
3400 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 3401 current_npc_text = 0; |
656 | 3402 EventProcessor(npc_event_id, 0, 1); |
3403 activeLevelDecoration = NULL; | |
3404 break; | |
3405 } | |
3406 } | |
3407 } | |
3408 if ( !dword_7241C8 ) | |
3409 pGame->Draw(); | |
3410 dword_7241C8 = 0; | |
3411 } | |
0 | 3412 |
3413 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 3414 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 3415 { |
3416 int v6; // edx@8 | |
3417 int v7; // edx@9 | |
3418 int v8; // edx@10 | |
3419 unsigned __int8 v9; // zf@16 | |
3420 char v10; // sf@16 | |
3421 unsigned __int8 v11; // of@16 | |
702 | 3422 bool test; |
0 | 3423 |
907 | 3424 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
|
3425 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->IsStolen()) |
0 | 3426 return 0; |
907 | 3427 switch( p2DEvents[_2da_idx - 1].uType ) |
3428 { | |
1411 | 3429 case BuildingType_WeaponShop: |
907 | 3430 { |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1643
diff
changeset
|
3431 test = item->GetItemEquipType() <= 2; |
907 | 3432 break; |
3433 } | |
1411 | 3434 case BuildingType_ArmorShop: |
907 | 3435 { |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1643
diff
changeset
|
3436 test = item->GetItemEquipType() >= 3; |
907 | 3437 break; |
3438 } | |
1411 | 3439 case BuildingType_MagicShop: |
907 | 3440 { |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1643
diff
changeset
|
3441 test = item->GetPlayerSkillType() == 38 || item->GetItemEquipType() == 16; |
907 | 3442 break; |
3443 } | |
1411 | 3444 case BuildingType_AlchemistShop: |
907 | 3445 { |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1643
diff
changeset
|
3446 test = item->GetItemEquipType() == 13 || item->GetItemEquipType() == 14 |
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1643
diff
changeset
|
3447 || (item->GetItemEquipType() > 14 && !(item->GetItemEquipType() != 17 |
907 | 3448 || (signed int)item->uItemID < 740) && item->uItemID != 771); |
3449 break; | |
3450 } | |
3451 default: | |
3452 { | |
3453 test = false; | |
3454 break; | |
3455 } | |
3456 } | |
702 | 3457 return test; |
3458 /* | |
3459 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 3460 { |
3461 v11 = __OFSUB__(v5, 2); | |
3462 v9 = v5 == 2; | |
3463 v10 = v5 - 2 < 0; | |
3464 goto LABEL_23; | |
3465 } | |
702 | 3466 if ( p2DEvents[a2 - 1].uType > 2 ) |
3467 { | |
3468 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 3469 { |
3470 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
3471 return v5 == 16; | |
3472 return 1; | |
3473 } | |
702 | 3474 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 3475 return 0; |
702 | 3476 if ( p2DEvents[a2 - 1].uType == 4) |
3477 { | |
3478 if ( v5 < 13 ) | |
3479 return 0; | |
3480 if ( v5 <= 14 ) | |
3481 return 1; | |
3482 if ( v5 != 17 || (signed int)v3 < 740 ) | |
3483 return 0; | |
3484 v11 = __OFSUB__(v3, 771); | |
3485 v9 = v3 == 771; | |
3486 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 3487 LABEL_23: |
702 | 3488 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
3489 return 0; | |
3490 return 1; | |
3491 } | |
3492 } | |
3493 if ( p2DEvents[a2 - 1].uType == 2 ) | |
3494 { | |
3495 if ( v5 >= 3 ) | |
3496 { | |
3497 v11 = __OFSUB__(v5, 9); | |
3498 v9 = v5 == 9; | |
3499 v10 = v5 - 9 < 0; | |
3500 goto LABEL_23; | |
3501 } | |
0 | 3502 } |
3503 return 0; | |
702 | 3504 */ |
0 | 3505 } |
3506 | |
1209 | 3507 |
0 | 3508 |