comparison mm7_4.cpp @ 786:da80bd2922df

Слияние
author Ritor1
date Sun, 24 Mar 2013 09:19:36 +0600
parents a821bbace194 c47efaf23642
children f004c7ceb7bd
comparison
equal deleted inserted replaced
785:a821bbace194 786:da80bd2922df
1 #include <io.h> 1 #include <io.h>
2 #include <direct.h> 2 #include <direct.h>
3 #include <assert.h> 3 #include <assert.h>
4 4
5 #include "MM7.h" 5 #include "MM7.h"
6
7 #include "MapInfo.h" 6 #include "MapInfo.h"
8 #include "Game.h" 7 #include "Game.h"
9 #include "GUIWindow.h" 8 #include "GUIWindow.h"
10 #include "GUIButton.h" 9 #include "GUIButton.h"
11 #include "GUIFont.h" 10 #include "GUIFont.h"
52 #include "Events2D.h" 51 #include "Events2D.h"
53 #include "stru159.h" 52 #include "stru159.h"
54 #include "texts.h" 53 #include "texts.h"
55 #include "Log.h" 54 #include "Log.h"
56 #include "UIHouses.h" 55 #include "UIHouses.h"
57
58 #include "mm7_data.h" 56 #include "mm7_data.h"
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 57
74 //----- (0046CC4B) -------------------------------------------------------- 58 //----- (0046CC4B) --------------------------------------------------------
75 void __cdecl _46CC4B_check_event_triggers() 59 void __cdecl _46CC4B_check_event_triggers()
76 { 60 {
77 int v0; // eax@1 61 int v0; // eax@1
840 LABEL_54: 824 LABEL_54:
841 *(int *)a4 = 0; 825 *(int *)a4 = 0;
842 return dword_720F20[v22]; 826 return dword_720F20[v22];
843 } 827 }
844 828
845
846 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal 829 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal
847 // for a right-handed system, that would be an inverse normal 830 // for a right-handed system, that would be an inverse normal
848 //----- (0046DCC8) -------------------------------------------------------- 831 //----- (0046DCC8) --------------------------------------------------------
849 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) 832 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out)
850 { 833 {
913 out->x = invmag * nx * 65536.0; 896 out->x = invmag * nx * 65536.0;
914 out->y = invmag * ny * 65536.0; 897 out->y = invmag * ny * 65536.0;
915 out->z = invmag * nz * 65536.0; 898 out->z = invmag * nz * 65536.0;
916 } 899 }
917 } 900 }
918
919 901
920 //----- (0046DEF2) -------------------------------------------------------- 902 //----- (0046DEF2) --------------------------------------------------------
921 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) 903 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID)
922 { 904 {
923 unsigned int result; // eax@1 905 unsigned int result; // eax@1
1450 } 1432 }
1451 } 1433 }
1452 } 1434 }
1453 // 4EC3EC: using guessed type Edge defaultEdge; 1435 // 4EC3EC: using guessed type Edge defaultEdge;
1454 1436
1455
1456
1457 //----- (00487355) -------------------------------------------------------- 1437 //----- (00487355) --------------------------------------------------------
1458 bool OutdoorCamera::_487355() 1438 bool OutdoorCamera::_487355()
1459 { 1439 {
1460 int v0; // esi@1 1440 int v0; // esi@1
1461 stru148 *v1; // edi@2 1441 stru148 *v1; // edi@2
1474 while ( v0 < pOutdoorCamera->numStru148s ); 1454 while ( v0 < pOutdoorCamera->numStru148s );
1475 } 1455 }
1476 return result; 1456 return result;
1477 } 1457 }
1478 1458
1479
1480
1481 //----- (00487DA9) -------------------------------------------------------- 1459 //----- (00487DA9) --------------------------------------------------------
1482 void __cdecl sub_487DA9() 1460 void __cdecl sub_487DA9()
1483 { 1461 {
1484 char *v0; // eax@1 1462 char *v0; // eax@1
1485 1463
1516 --v2; 1494 --v2;
1517 } 1495 }
1518 while ( v2 ); 1496 while ( v2 );
1519 } 1497 }
1520 // 4EC3EC: using guessed type Edge defaultEdge; 1498 // 4EC3EC: using guessed type Edge defaultEdge;
1521
1522
1523
1524
1525 1499
1526 //----- (0048958E) -------------------------------------------------------- 1500 //----- (0048958E) --------------------------------------------------------
1527 stru12_MemoryBlock::stru12_MemoryBlock(int a2) 1501 stru12_MemoryBlock::stru12_MemoryBlock(int a2)
1528 { 1502 {
1529 stru12_MemoryBlock *v2; // esi@1 1503 stru12_MemoryBlock *v2; // esi@1
1793 while ( v22 < this->field_8C ); 1767 while ( v22 < this->field_8C );
1794 } 1768 }
1795 this->field_8C = 0; 1769 this->field_8C = 0;
1796 } 1770 }
1797 1771
1798
1799
1800
1801
1802 //----- (0048A959) -------------------------------------------------------- 1772 //----- (0048A959) --------------------------------------------------------
1803 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) 1773 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
1804 { 1774 {
1805 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, 1775 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f,
1806 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, 1776 g = ((uColor & 0x0000FF00) >> 8) / 255.0f,
1819 1789
1820 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | 1790 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) |
1821 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | 1791 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) |
1822 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); 1792 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF);
1823 } 1793 }
1824
1825 1794
1826 //----- (0048B561) -------------------------------------------------------- 1795 //----- (0048B561) --------------------------------------------------------
1827 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) 1796 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2)
1828 { 1797 {
1829 //v2 = a2 - 0.5; 1798 //v2 = a2 - 0.5;
1833 //v5 = v7 + 6.7553994e15; 1802 //v5 = v7 + 6.7553994e15;
1834 //return LODWORD(v5) | (v4 << 16); 1803 //return LODWORD(v5) | (v4 << 16);
1835 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); 1804 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f);
1836 return v5 | (v4 << 16); 1805 return v5 | (v4 << 16);
1837 } 1806 }
1838
1839
1840
1841
1842
1843 1807
1844 //----- (00491E3A) -------------------------------------------------------- 1808 //----- (00491E3A) --------------------------------------------------------
1845 void __cdecl sub_491E3A() 1809 void __cdecl sub_491E3A()
1846 { 1810 {
1847 Player *v0; // ebx@1 1811 Player *v0; // ebx@1
1939 v12 = pIcons_LOD->pFacesLock; 1903 v12 = pIcons_LOD->pFacesLock;
1940 pIcons_LOD->pFacesLock = 0; 1904 pIcons_LOD->pFacesLock = 0;
1941 pIcons_LOD->uNumLoadedFiles = v12; 1905 pIcons_LOD->uNumLoadedFiles = v12;
1942 } 1906 }
1943 // 4ED498: using guessed type char byte_4ED498; 1907 // 4ED498: using guessed type char byte_4ED498;
1944
1945
1946
1947 1908
1948 //----- (0049387A) -------------------------------------------------------- 1909 //----- (0049387A) --------------------------------------------------------
1949 int CycleCharacter(unsigned int _this) 1910 int CycleCharacter(unsigned int _this)
1950 { 1911 {
1951 signed int result; // eax@1 1912 signed int result; // eax@1
2378 } 2339 }
2379 } 2340 }
2380 return result; 2341 return result;
2381 } 2342 }
2382 2343
2383
2384
2385 //----- (00493F79) -------------------------------------------------------- 2344 //----- (00493F79) --------------------------------------------------------
2386 void sub_493F79(stru351_summoned_item *_this, __int64 a2) 2345 void sub_493F79(stru351_summoned_item *_this, __int64 a2)
2387 { 2346 {
2388 signed __int64 v2; // ST2C_8@1 2347 signed __int64 v2; // ST2C_8@1
2389 signed __int64 v3; // qax@1 2348 signed __int64 v3; // qax@1
2402 _this->field_10_expire_week = v5 / 7 & 3; 2361 _this->field_10_expire_week = v5 / 7 & 3;
2403 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; 2362 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
2404 _this->field_14_exprie_month = v6 % 0xC; 2363 _this->field_14_exprie_month = v6 % 0xC;
2405 _this->field_18_expire_year = v6 / 0xC + game_starting_year; 2364 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
2406 } 2365 }
2407
2408
2409
2410
2411 2366
2412 //----- (00494035) -------------------------------------------------------- 2367 //----- (00494035) --------------------------------------------------------
2413 void __cdecl _494035_timed_effects__water_walking_damage__etc() 2368 void __cdecl _494035_timed_effects__water_walking_damage__etc()
2414 { 2369 {
2415 signed __int64 v0; // qax@1 2370 signed __int64 v0; // qax@1
2906 } 2861 }
2907 return result; 2862 return result;
2908 } 2863 }
2909 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; 2864 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
2910 2865
2911
2912
2913 //----- (00494AED) -------------------------------------------------------- 2866 //----- (00494AED) --------------------------------------------------------
2914 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) 2867 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
2915 { 2868 {
2916 unsigned int _uNumFrames; // edx@1 2869 unsigned int _uNumFrames; // edx@1
2917 unsigned int result; // eax@1 2870 unsigned int result; // eax@1
3382 fclose(File); 3335 fclose(File);
3383 result = 0; 3336 result = 0;
3384 } 3337 }
3385 return result; 3338 return result;
3386 } 3339 }
3387
3388
3389 3340
3390 //----- (00495366) -------------------------------------------------------- 3341 //----- (00495366) --------------------------------------------------------
3391 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) 3342 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2)
3392 { 3343 {
3393 int v2; // edi@1 3344 int v2; // edi@1
3893 } 3844 }
3894 } 3845 }
3895 return pTmpBuf2; 3846 return pTmpBuf2;
3896 } 3847 }
3897 3848
3898
3899
3900
3901 //----- (0049B04D) -------------------------------------------------------- 3849 //----- (0049B04D) --------------------------------------------------------
3902 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) 3850 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3)
3903 { 3851 {
3904 //stru154 *v3; // edi@1 3852 //stru154 *v3; // edi@1
3905 //signed int v4; // eax@1 3853 //signed int v4; // eax@1
4027 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); 3975 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16);
4028 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); 3976 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16);
4029 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); 3977 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16);
4030 } 3978 }
4031 3979
4032
4033
4034
4035
4036 //----- (0049D700) -------------------------------------------------------- 3980 //----- (0049D700) --------------------------------------------------------
4037 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) 3981 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim)
4038 { 3982 {
4039 unsigned int v1; // eax@1 3983 unsigned int v1; // eax@1
4040 int v2; // ecx@1 3984 int v2; // ecx@1
4048 v3 >>= 1; 3992 v3 >>= 1;
4049 ++v2; 3993 ++v2;
4050 } 3994 }
4051 return v3 == 0 ? v2 : 0; 3995 return v3 == 0 ? v2 : 0;
4052 } 3996 }
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062 3997
4063 //----- (004A19D8) -------------------------------------------------------- 3998 //----- (004A19D8) --------------------------------------------------------
4064 unsigned int BlendColors(unsigned int a1, unsigned int a2) 3999 unsigned int BlendColors(unsigned int a1, unsigned int a2)
4065 { 4000 {
4066 /*signed __int64 v2; // ST10_8@1 4001 /*signed __int64 v2; // ST10_8@1
4100 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; 4035 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0;
4101 v13 = v12 + 6.7553994e15; 4036 v13 = v12 + 6.7553994e15;
4102 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ 4037 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/
4103 } 4038 }
4104 4039
4105
4106
4107 //----- (004A46E6) -------------------------------------------------------- 4040 //----- (004A46E6) --------------------------------------------------------
4108 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) 4041 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor)
4109 { 4042 {
4110 int v5; // eax@1 4043 int v5; // eax@1
4111 int z; // eax@1 4044 int z; // eax@1
4240 } 4173 }
4241 } 4174 }
4242 } 4175 }
4243 return z; 4176 return z;
4244 } 4177 }
4245
4246 4178
4247 //----- (004A57E9) -------------------------------------------------------- 4179 //----- (004A57E9) --------------------------------------------------------
4248 void __cdecl Present_ColorKey() 4180 void __cdecl Present_ColorKey()
4249 { 4181 {
4250 HRESULT v0; // eax@3 4182 HRESULT v0; // eax@3
4470 } 4402 }
4471 } 4403 }
4472 } 4404 }
4473 } 4405 }
4474 4406
4475
4476
4477 //----- (004A7063) -------------------------------------------------------- 4407 //----- (004A7063) --------------------------------------------------------
4478 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) 4408 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2)
4479 { 4409 {
4480 float v2; // ST1C_4@1 4410 float v2; // ST1C_4@1
4481 double v3; // ST14_8@1 4411 double v3; // ST14_8@1
4518 v10 = 255; 4448 v10 = 255;
4519 if ( v10 < 0 ) 4449 if ( v10 < 0 )
4520 v10 = 0; 4450 v10 = 0;
4521 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); 4451 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8);
4522 } 4452 }
4523
4524
4525
4526
4527
4528
4529
4530 4453
4531 //----- (004AD504) -------------------------------------------------------- 4454 //----- (004AD504) --------------------------------------------------------
4532 int __fastcall sub_4AD504(signed int sFaceID) 4455 int __fastcall sub_4AD504(signed int sFaceID)
4533 { 4456 {
4534 int result; // eax@1 4457 int result; // eax@1
5504 ++pBLVRenderParams->field_8C; 5427 ++pBLVRenderParams->field_8C;
5505 return v17; 5428 return v17;
5506 } 5429 }
5507 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); 5430 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int);
5508 5431
5509
5510
5511
5512 //----- (004AE5F1) -------------------------------------------------------- 5432 //----- (004AE5F1) --------------------------------------------------------
5513 void __fastcall sub_4AE5F1(unsigned int uFaceID) 5433 void __fastcall sub_4AE5F1(unsigned int uFaceID)
5514 { 5434 {
5515 BLVFace *v1; // esi@1 5435 BLVFace *v1; // esi@1
5516 BLVFaceExtra *v2; // ebx@1 5436 BLVFaceExtra *v2; // ebx@1
6160 stru_F8AD28.uNumLightsApplied = 0; 6080 stru_F8AD28.uNumLightsApplied = 0;
6161 stru_F8AD28.field_34 = 0; 6081 stru_F8AD28.field_34 = 0;
6162 return result; 6082 return result;
6163 } 6083 }
6164 6084
6165
6166
6167
6168
6169
6170 //----- (004B1447) -------------------------------------------------------- 6085 //----- (004B1447) --------------------------------------------------------
6171 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) 6086 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3)
6172 { 6087 {
6173 signed int v3; // esi@1 6088 signed int v3; // esi@1
6174 char v4; // sf@8 6089 char v4; // sf@8
6307 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); 6222 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
6308 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); 6223 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
6309 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); 6224 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3);
6310 } 6225 }
6311 6226
6312
6313 //----- (004B1784) -------------------------------------------------------- 6227 //----- (004B1784) --------------------------------------------------------
6314 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() 6228 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
6315 { 6229 {
6316 Player *pPlayer; // ebx@1 6230 Player *pPlayer; // ebx@1
6317 bool result; // eax@2 6231 bool result; // eax@2
6341 result = 0; 6255 result = 0;
6342 } 6256 }
6343 return result; 6257 return result;
6344 } 6258 }
6345 // F8B1E0: using guessed type int dword_F8B1E0; 6259 // F8B1E0: using guessed type int dword_F8B1E0;
6346
6347 6260
6348 //view item details in shop? 6261 //view item details in shop?
6349 //----- (004B1A2D) -------------------------------------------------------- 6262 //----- (004B1A2D) --------------------------------------------------------
6350 void __cdecl sub_4B1A2D() 6263 void __cdecl sub_4B1A2D()
6351 { 6264 {
6545 } 6458 }
6546 } 6459 }
6547 } 6460 }
6548 } 6461 }
6549 } 6462 }
6550
6551
6552 6463
6553 //----- (004B1ECE) -------------------------------------------------------- 6464 //----- (004B1ECE) --------------------------------------------------------
6554 void __cdecl sub_4B1ECE() 6465 void __cdecl sub_4B1ECE()
6555 { 6466 {
6556 __int16 *v0; // edi@1 6467 __int16 *v0; // edi@1
6643 } 6554 }
6644 if ( v9 ) 6555 if ( v9 )
6645 v9->uHolderPlayer = v5; 6556 v9->uHolderPlayer = v5;
6646 } 6557 }
6647 } 6558 }
6648
6649 // 4F08EC: using guessed type int dword_4F08EC[]; 6559 // 4F08EC: using guessed type int dword_4F08EC[];
6650 // 722B3C: using guessed type int dword_722B3C; 6560 // 722B3C: using guessed type int dword_722B3C;
6651 // 722B44: using guessed type int dword_722B44; 6561 // 722B44: using guessed type int dword_722B44;
6652 // F8B1A8: using guessed type int dword_F8B1A8; 6562 // F8B1A8: using guessed type int dword_F8B1A8;
6653 6563
6928 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); 6838 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0);
6929 _return: 6839 _return:
6930 pVideoPlayer->_4BF5B2();//HouseVideo 6840 pVideoPlayer->_4BF5B2();//HouseVideo
6931 } 6841 }
6932 6842
6933
6934 //----- (004B254D) -------------------------------------------------------- 6843 //----- (004B254D) --------------------------------------------------------
6935 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) 6844 char *__thiscall _4B254D_SkillMasteryTeacher(int _this)
6936 { 6845 {
6937 Player *v1; // esi@1 6846 Player *v1; // esi@1
6938 int v2; // edx@1 6847 int v2; // edx@1
7257 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); 7166 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27);
7258 } 7167 }
7259 return pTmpBuf2; 7168 return pTmpBuf2;
7260 } 7169 }
7261 7170
7262
7263
7264 //----- (004B29F2) -------------------------------------------------------- 7171 //----- (004B29F2) --------------------------------------------------------
7265 const char * ContractSelectText( int pEventCode ) 7172 const char * ContractSelectText( int pEventCode )
7266 { 7173 {
7267 static const int dialogue_base=110; 7174 static const int dialogue_base=110;
7268 contract_approved = 0; 7175 contract_approved = 0;
7290 else 7197 else
7291 { 7198 {
7292 return pNPCTopics[dialogue_base+12].pText; 7199 return pNPCTopics[dialogue_base+12].pText;
7293 } 7200 }
7294 } 7201 }
7295
7296 7202
7297 //----- (004B2A74) -------------------------------------------------------- 7203 //----- (004B2A74) --------------------------------------------------------
7298 void SimpleHouseAndBoatsDialog() 7204 void SimpleHouseAndBoatsDialog()
7299 { 7205 {
7300 char *v0; // esi@3 7206 char *v0; // esi@3
7618 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0); 7524 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0);
7619 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); 7525 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0);
7620 } 7526 }
7621 } 7527 }
7622 7528
7623
7624
7625
7626
7627 //----- (004B36CC) -------------------------------------------------------- 7529 //----- (004B36CC) --------------------------------------------------------
7628 void CreateButtonInColumn( int column_pos, unsigned int control_id ) 7530 void CreateButtonInColumn( int column_pos, unsigned int control_id )
7629 { 7531 {
7630 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0); 7532 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0);
7631 } 7533 }
7632
7633
7634 7534
7635 //----- (004B3A72) -------------------------------------------------------- 7535 //----- (004B3A72) --------------------------------------------------------
7636 void sub_4B3A72( int a1 ) 7536 void sub_4B3A72( int a1 )
7637 { 7537 {
7638 int num_buttons; // esi@1 7538 int num_buttons; // esi@1
7966 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" 7866 pGlobalTXT_LocalizationStrings[406], 0); //"Hire"
7967 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); 7867 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2);
7968 dialog_menu_id = HOUSE_DIALOGUE_OTHER; 7868 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
7969 } 7869 }
7970 7870
7971
7972 //----- (004B4224) -------------------------------------------------------- 7871 //----- (004B4224) --------------------------------------------------------
7973 void _4B4224_UpdateNPCTopics( int _this ) 7872 void _4B4224_UpdateNPCTopics( int _this )
7974 { 7873 {
7975 int num_menu_buttons; // ebx@1 7874 int num_menu_buttons; // ebx@1
7976 int i; // ebp@5 7875 int i; // ebp@5
8088 dialog_menu_id = HOUSE_DIALOGUE_MAIN; 7987 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
8089 } 7988 }
8090 7989
8091 } 7990 }
8092 7991
8093
8094
8095 //----- (004B46A5) -------------------------------------------------------- 7992 //----- (004B46A5) --------------------------------------------------------
8096 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) 7993 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color)
8097 { 7994 {
8098 int v4; // eax@1 7995 int v4; // eax@1
8099 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); 7996 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
8110 v1 = 0; 8007 v1 = 0;
8111 for ( i = 0; i < a1; ++i ) 8008 for ( i = 0; i < a1; ++i )
8112 v1 += i + 1; 8009 v1 += i + 1;
8113 return 1000 * v1; 8010 return 1000 * v1;
8114 } 8011 }
8115
8116 8012
8117 //----- (004BC49B) -------------------------------------------------------- 8013 //----- (004BC49B) --------------------------------------------------------
8118 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) 8014 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
8119 { 8015 {
8120 //unsigned int v1; // esi@1 8016 //unsigned int v1; // esi@1
8337 if ( !dword_7241C8 ) 8233 if ( !dword_7241C8 )
8338 pGame->Draw(); 8234 pGame->Draw();
8339 dword_7241C8 = 0; 8235 dword_7241C8 = 0;
8340 } 8236 }
8341 8237
8342
8343
8344 //----- (004BDAAF) -------------------------------------------------------- 8238 //----- (004BDAAF) --------------------------------------------------------
8345 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) 8239 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx)
8346 { 8240 {
8347 int v2; // edx@1 8241 int v2; // edx@1
8348 unsigned int v3; // esi@1 8242 unsigned int v3; // esi@1
8442 } 8336 }
8443 } 8337 }
8444 return 0; 8338 return 0;
8445 */ 8339 */
8446 } 8340 }
8447
8448
8449
8450 8341
8451 //----- (004B6478) -------------------------------------------------------- 8342 //----- (004B6478) --------------------------------------------------------
8452 void sub_4B6478() 8343 void sub_4B6478()
8453 { 8344 {
8454 GUIWindow *v0; // ebx@1 8345 GUIWindow *v0; // ebx@1
8653 } 8544 }
8654 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); 8545 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
8655 } 8546 }
8656 return; 8547 return;
8657 } 8548 }
8658
8659
8660
8661 //----- (004B6943) --------------------------------------------------------
8662 void __cdecl TravelByTransport()
8663 {
8664 GUIWindow *v0; // ebx@1
8665 Player *v1; // esi@1
8666 signed int v2; // edi@1
8667 unsigned int v3; // eax@1
8668 signed int v4; // ebx@1
8669 stru365_travel_info *v5; // esi@7
8670 int v6; // eax@9
8671 int v7; // eax@9
8672 int v8; // eax@12
8673 int v9; // edi@12
8674 int v10; // edx@12
8675 int v11; // ecx@12
8676 signed int v12; // esi@13
8677 signed int v13; // edi@14
8678 DWORD v14; // eax@26
8679 DWORD v15; // edi@26
8680 GUIWindow *v16; // ebx@36
8681 int v17; // esi@36
8682 int v18; // eax@36
8683 int v19; // ecx@36
8684 int v20; // esi@36
8685 int v21; // eax@36
8686 void *v22; // eax@39
8687 int v23; // esi@39
8688 GUIButton *v24; // ebx@39
8689 signed int v25; // eax@41
8690 //int v26; // esi@44
8691 const char *v27; // eax@46
8692 char *v28; // eax@62
8693 int v29; // eax@62
8694 unsigned int v30; // ecx@62
8695 char *v31; // eax@63
8696 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62
8697 /*int v33; // [sp-38h] [bp-2C8h]@62
8698 int v34; // [sp-34h] [bp-2C4h]@62
8699 int v35; // [sp-30h] [bp-2C0h]@62
8700 int v36; // [sp-2Ch] [bp-2BCh]@62
8701 int v37; // [sp-28h] [bp-2B8h]@62
8702 int v38; // [sp-24h] [bp-2B4h]@62
8703 int v39; // [sp-20h] [bp-2B0h]@62
8704 int v40; // [sp-1Ch] [bp-2ACh]@62
8705 int v41; // [sp-18h] [bp-2A8h]@62
8706 int v42; // [sp-14h] [bp-2A4h]@62
8707 char *v43; // [sp-10h] [bp-2A0h]@62
8708 char *v44; // [sp-Ch] [bp-29Ch]@62
8709 unsigned int v45; // [sp-8h] [bp-298h]@62
8710 char *v46; // [sp-4h] [bp-294h]@62
8711 const char *v47[5]; // [sp+0h] [bp-290h]@7*/
8712 char v48[100]; // [sp+14h] [bp-27Ch]@37
8713 char v49[100]; // [sp+78h] [bp-218h]@68
8714 char v50[100]; // [sp+DCh] [bp-1B4h]@68
8715 char v51[100]; // [sp+140h] [bp-150h]@68
8716 char Dest[100]; // [sp+1A4h] [bp-ECh]@36
8717 GUIWindow v53; // [sp+208h] [bp-88h]@1
8718 int v54; // [sp+25Ch] [bp-34h]@36
8719 int v55; // [sp+260h] [bp-30h]@36
8720 unsigned int v56; // [sp+264h] [bp-2Ch]@1
8721 int v57; // [sp+268h] [bp-28h]@1
8722 int v58; // [sp+26Ch] [bp-24h]@36
8723 GUIWindow *v59; // [sp+270h] [bp-20h]@1
8724 unsigned int v60; // [sp+274h] [bp-1Ch]@36
8725 //Player *v61; // [sp+278h] [bp-18h]@1
8726 int v62; // [sp+27Ch] [bp-14h]@36
8727 int v63; // [sp+280h] [bp-10h]@14
8728 char *a1; // [sp+284h] [bp-Ch]@37
8729 unsigned int s1; // [sp+288h] [bp-8h]@1
8730 int v66; // [sp+28Ch] [bp-4h]@48
8731
8732 v0 = window_SpeakInHouse;
8733 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
8734 v2 = 255;
8735 //v61 = pPlayers[uActiveCharacter];
8736 v1 = pPlayers[uActiveCharacter];
8737 v53.uFrameX = 483;
8738 v53.uFrameWidth = 148;
8739 v53.uFrameZ = 334;
8740 v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
8741 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
8742 v3 = 52 * (unsigned int)v0->ptr_1C;
8743 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
8744 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50);
8745 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]);
8746 v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
8747 s1 = v4 * (100 - v1->GetMerchant()) / 100;
8748 if ( (signed int)s1 < v4 / 3 )
8749 s1 = v4 / 3;
8750 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
8751 {
8752 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
8753 {
8754 v16 = pDialogueWindow;
8755 v58 = -1;
8756 v62 = 0;
8757 v17 = LOBYTE(pFontArrus->uFontHeight) - 3;
8758 v59 = pDialogueWindow;
8759 v54 = v17;
8760 strcpy(Dest, "");
8761 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
8762 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
8763 v19 = v16->pNumPresenceButton;
8764 v20 = v18 + v17 + 146;
8765 v21 = v16->pStartingPosActiveItem;
8766 v63 = v20;
8767 v55 = v20;
8768 v60 = v21;
8769 if ( v21 >= v21 + v19 )
8770 goto LABEL_71;
8771 s1 = 2;
8772 a1 = v48;
8773 while ( 1 )
8774 {
8775 int v47 = v60;
8776 v22 = window_SpeakInHouse->ptr_1C;
8777 v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62];
8778 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36
8779 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land
8780 v24 = v16->GetControl(v60);
8781 if ( v23 != v58
8782 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = travel_schedule[v23].pSchedule[pParty->uDaysPlayed % 7]),
8783 v25
8784 && (travel_schedule[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, travel_schedule[v23].uQuestBit))) )
8785 {
8786 v58 = v23;
8787 v27 = (const char *)v56;
8788 if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
8789 v27 = (const char *)v57;
8790 //v32.uRedbookTrackID = v27;
8791 sprintf(a1, "\f%05d", v27);
8792 v66 = travel_schedule[v23].uTravelTime;
8793 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
8794 {
8795 if ( CheckHiredNPCSpeciality(Sailor) )
8796 v66 -= 2;
8797 if ( CheckHiredNPCSpeciality(Navigator) )
8798 v66 -= 3;
8799 //v47 = Pirate;
8800 if ( CheckHiredNPCSpeciality(Pirate) )
8801 v66 -= 2;
8802 }
8803 else
8804 {
8805 //v47 = Horseman;
8806 if ( CheckHiredNPCSpeciality(Horseman) )
8807 v66 -= 2;
8808 }
8809 if ( CheckHiredNPCSpeciality(Explorer) )
8810 --v66;
8811 if ( v66 < 1 )
8812 v66 = 1;
8813 if ( v23 != v2 )
8814 {
8815 memcpy(&v32, &pMapStats->pInfos[travel_schedule[v23].uMapInfoID], 0x44u);
8816 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
8817 v66, v32.pName);
8818 strcat(a1, pTmpBuf);
8819 v28 = a1;
8820 a1 += 100;
8821 ++v62;
8822 ++s1;
8823 strcat(v28, "\n \n");
8824 v24->uY = v63;
8825 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0);
8826 v30 = v24->uY;
8827 v24->uHeight = v29;
8828 v2 = 255;
8829 v24->uW = v30 + v29 - 1;
8830 v63 += v54 + v29;
8831 }
8832 }
8833 else
8834 {
8835 v31 = a1;
8836 ++v62;
8837 ++s1;
8838 a1 += 100;
8839 strcpy(v31, "");
8840 if ( v24 )
8841 {
8842 v24->uW = 0;
8843 v24->uHeight = 0;
8844 v24->uY = 0;
8845 }
8846 }
8847 ++v60;
8848 if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem )
8849 break;
8850 v16 = v59;
8851 }
8852 if ( v63 != v55 )
8853 {
8854 /*v47[1] = &Dest;
8855 v47[0] = &v51;
8856 v46 = &v50;
8857 v45 = (unsigned int)&v49;
8858 v44 = &v48;
8859 v43 = pTmpBuf2;*/
8860 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest);
8861 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
8862 }
8863 else
8864 {
8865 LABEL_71:
8866 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138,
8867 v57, pGlobalTXT_LocalizationStrings[561], 3);
8868 pAudioPlayer->StopChannels(-1, -1);
8869 }
8870 }
8871 }
8872 else
8873 {
8874 if ( dialog_menu_id > HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT && dialog_menu_id <= HOUSE_DIALOGUE_108 )
8875 {
8876 if ( pParty->uNumGold < s1 )
8877 {
8878 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
8879 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
8880 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
8881 return;
8882 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
8883 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
8884 goto LABEL_33;*/
8885 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
8886 }
8887 Party::TakeGold(s1);
8888 //v47[1] = (const char *)7;
8889 v5 = &travel_schedule[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]];
8890 if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
8891 {
8892 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
8893 {
8894 SaveGame(1, 0);
8895 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
8896 v8 = v5->field_18;
8897 v9 = v5->field_14;
8898 v10 = v5->field_10;
8899 dword_6BE364_game_settings_1 |= 1u;
8900 _5B65B8_npcdata_hiword_house_or_other = 0;
8901 dword_5B65BC = 0;
8902 _5B65B4_npcdata_loword_house_or_other = v8;
8903 v11 = *((int *)v5 + 3);
8904 uGameState = 2;
8905 _5B65A8_npcdata_uflags_or_other = v11;
8906 _5B65AC_npcdata_fame_or_other = v10;
8907 _5B65B0_npcdata_rep_or_other = v9;
8908 dword_5B65C0 = v11 | v10 | v9 | v8;
8909 }
8910 else
8911 {
8912 v6 = v5->field_C;
8913 pParty->sRotationX = 0;
8914 pParty->vPosition.x = v6;
8915 v7 = v5->field_10;
8916 pIndoorCamera->sRotationY = 0;
8917 pParty->uFlags |= 2u;
8918 pParty->vPosition.y = v7;
8919 pParty->vPosition.z = v5->field_14;
8920 pParty->uFallStartY = pParty->vPosition.z;
8921 pParty->sRotationY = v5->field_18;
8922 }
8923 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
8924 v12 = v5->uTravelTime;
8925 int _v47;
8926 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
8927 {
8928 v63 = SPEECH_SetSail;
8929 v13 = 2500;
8930 if ( CheckHiredNPCSpeciality(Sailor) )
8931 v12 -= 2;
8932 if ( CheckHiredNPCSpeciality(Navigator) )
8933 v12 -= 3;
8934 //_v47 = 45;
8935 if ( CheckHiredNPCSpeciality(Pirate) )
8936 v12 -= 2;
8937 }
8938 else
8939 {
8940 v63 = SPEECH_CarriageReady;
8941 v13 = 1500;
8942 //_v47 = 35;
8943 if ( CheckHiredNPCSpeciality(Horseman) )
8944 v12 -= 2;
8945 }
8946 if ( CheckHiredNPCSpeciality(Explorer) )
8947 --v12;
8948 if ( v12 < 1 )
8949 v12 = 1;
8950 RestAndHeal(1440 * v12);
8951 v1->PlaySound((PlayerSpeech)v63, 0);
8952 v14 = GetTickCount();
8953 v15 = v14 + v13;
8954 if ( v15 < v14 )
8955 v15 = v14;
8956 while ( GetTickCount() < v15 )
8957 sqrt(3.1415926);
8958 while ( sub_4BD8B5() )
8959 ;
8960 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
8961 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
8962 {
8963 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
8964 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
8965 LABEL_33:
8966 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
8967 ++pMessageQueue_50CBD0->uNumMessages;
8968 return;
8969 }*/
8970 }
8971 else
8972 {
8973 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
8974 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
8975 }
8976 }
8977 }
8978 }
8979
8980
8981
8982
8983 8549
8984 //----- (00405CFF) -------------------------------------------------------- 8550 //----- (00405CFF) --------------------------------------------------------
8985 void stru262_TurnBased::End(bool bPlaySound) 8551 void stru262_TurnBased::End(bool bPlaySound)
8986 { 8552 {
8987 stru262_TurnBased *v2; // edi@1 8553 stru262_TurnBased *v2; // edi@1
9226 { 8792 {
9227 v1->_406FA8(); 8793 v1->_406FA8();
9228 } 8794 }
9229 } 8795 }
9230 } 8796 }
9231
9232
9233
9234 8797
9235 //----- (0043FDED) -------------------------------------------------------- 8798 //----- (0043FDED) --------------------------------------------------------
9236 void PrepareActorRenderList_BLV() 8799 void PrepareActorRenderList_BLV()
9237 { 8800 {
9238 RenderBillboard *v0; // esi@0 8801 RenderBillboard *v0; // esi@0
9444 _continue: 9007 _continue:
9445 ; 9008 ;
9446 } 9009 }
9447 } 9010 }
9448 9011
9449
9450
9451
9452 //----- (00444732) -------------------------------------------------------- 9012 //----- (00444732) --------------------------------------------------------
9453 char *GetEventHintString(unsigned int uEventID) 9013 char *GetEventHintString(unsigned int uEventID)
9454 { 9014 {
9455 signed int event_index; // edx@1 9015 signed int event_index; // edx@1
9456 int event_pos; // esi@4 9016 int event_pos; // esi@4
9501 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; 9061 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]];
9502 } 9062 }
9503 9063
9504 return result; 9064 return result;
9505 } 9065 }
9506
9507
9508
9509 9066
9510 //----- (00444839) -------------------------------------------------------- 9067 //----- (00444839) --------------------------------------------------------
9511 unsigned int __fastcall sub_444839_move_map(unsigned int a1, int a2, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) 9068 unsigned int __fastcall sub_444839_move_map(unsigned int a1, int a2, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName)
9512 { 9069 {
9513 unsigned int v9; // ebx@1 9070 unsigned int v9; // ebx@1
9608 result = v23; 9165 result = v23;
9609 if ( v23 ) 9166 if ( v23 )
9610 uCurrentHouse_Animation = v23; 9167 uCurrentHouse_Animation = v23;
9611 return result; 9168 return result;
9612 } 9169 }
9613