comparison mm7_3.cpp @ 784:b3e08a496778

Merge
author Nomad
date Sun, 24 Mar 2013 21:15:01 +0200
parents b27dd658ea77 d170f23f70d1
children f004c7ceb7bd 83a58d185d3c
comparison
equal deleted inserted replaced
783:b27dd658ea77 784:b3e08a496778
41 #include "stru176.h" 41 #include "stru176.h"
42 #include "stru159.h" 42 #include "stru159.h"
43 #include "stru298.h" 43 #include "stru298.h"
44 #include "texts.h" 44 #include "texts.h"
45 #include "Log.h" 45 #include "Log.h"
46
47 #include "mm7_data.h" 46 #include "mm7_data.h"
48
49
50
51
52
53
54
55 47
56 //----- (0046E44E) -------------------------------------------------------- 48 //----- (0046E44E) --------------------------------------------------------
57 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1) 49 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1)
58 { 50 {
59 BLVSector *pSector; // edi@1 51 BLVSector *pSector; // edi@1
490 goto LABEL_37; 482 goto LABEL_37;
491 } 483 }
492 return result; 484 return result;
493 } 485 }
494 486
495
496 //----- (0046ED1B) -------------------------------------------------------- 487 //----- (0046ED1B) --------------------------------------------------------
497 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) 488 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
498 { 489 {
499 uint uFaceID = -1; 490 uint uFaceID = -1;
500 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID); 491 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID);
757 { 748 {
758 result = 1; 749 result = 1;
759 } 750 }
760 return result; 751 return result;
761 } 752 }
762
763 753
764 //----- (0047050A) -------------------------------------------------------- 754 //----- (0047050A) --------------------------------------------------------
765 int stru141::_47050A(int a2) 755 int stru141::_47050A(int a2)
766 { 756 {
767 stru141 *v2; // esi@1 757 stru141 *v2; // esi@1
1355 LABEL_121: 1345 LABEL_121:
1356 ++v75; 1346 ++v75;
1357 } 1347 }
1358 while ( (signed int)v75 < (signed int)uNumActors ); 1348 while ( (signed int)v75 < (signed int)uNumActors );
1359 } 1349 }
1360
1361
1362
1363 1350
1364 //----- (0047253E) -------------------------------------------------------- 1351 //----- (0047253E) --------------------------------------------------------
1365 void UpdateObjects() 1352 void UpdateObjects()
1366 { 1353 {
1367 unsigned int v0; // ebx@0 1354 unsigned int v0; // ebx@0
2164 pParty->uFlags |= 0x200; 2151 pParty->uFlags |= 0x200;
2165 if (uFaceEvent) 2152 if (uFaceEvent)
2166 EventProcessor(uFaceEvent, 0, 1); 2153 EventProcessor(uFaceEvent, 0, 1);
2167 } 2154 }
2168 2155
2169
2170 //----- (00473893) -------------------------------------------------------- 2156 //----- (00473893) --------------------------------------------------------
2171 void __cdecl ODM_ProcessPartyActions() 2157 void __cdecl ODM_ProcessPartyActions()
2172 { 2158 {
2173 //int _zero; // esi@1 2159 //int _zero; // esi@1
2174 int v1; // edi@1 2160 int v1; // edi@1
3429 if ( a11a >> 16 < 0 ) 3415 if ( a11a >> 16 < 0 )
3430 *v19 = 0; 3416 *v19 = 0;
3431 return 1; 3417 return 1;
3432 } 3418 }
3433 3419
3434
3435
3436 //----- (00475665) -------------------------------------------------------- 3420 //----- (00475665) --------------------------------------------------------
3437 signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3) 3421 signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3)
3438 { 3422 {
3439 unsigned int v3; // eax@1 3423 unsigned int v3; // eax@1
3440 Vec3_short_ *v4; // edx@3 3424 Vec3_short_ *v4; // edx@3
3834 return 0; 3818 return 0;
3835 *v21 = v24 >> 16; 3819 *v21 = v24 >> 16;
3836 return 1; 3820 return 1;
3837 } 3821 }
3838 3822
3839
3840
3841
3842
3843 //----- (004760D5) -------------------------------------------------------- 3823 //----- (004760D5) --------------------------------------------------------
3844 PartyAction ActionQueue::Next() 3824 PartyAction ActionQueue::Next()
3845 { 3825 {
3846 if (!uNumActions) 3826 if (!uNumActions)
3847 return PARTY_INVALID; 3827 return PARTY_INVALID;
3851 pActions[i] = pActions[i + 1]; 3831 pActions[i] = pActions[i + 1];
3852 --uNumActions; 3832 --uNumActions;
3853 3833
3854 return result; 3834 return result;
3855 } 3835 }
3856
3857
3858
3859
3860 // 47730C: using guessed type int __stdcall const_1(int); 3836 // 47730C: using guessed type int __stdcall const_1(int);
3861 3837
3862 //----- (0047752B) -------------------------------------------------------- 3838 //----- (0047752B) --------------------------------------------------------
3863 int __cdecl GetPartyReputation() 3839 int __cdecl GetPartyReputation()
3864 { 3840 {
3879 v1 += 5; 3855 v1 += 5;
3880 if ( CheckHiredNPCSpeciality(FallenWizard) ) 3856 if ( CheckHiredNPCSpeciality(FallenWizard) )
3881 v1 += 5; 3857 v1 += 5;
3882 return v1 + v0->uReputation; 3858 return v1 + v0->uReputation;
3883 } 3859 }
3884
3885
3886
3887
3888 3860
3889 //----- (004775ED) -------------------------------------------------------- 3861 //----- (004775ED) --------------------------------------------------------
3890 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) 3862 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2)
3891 { 3863 {
3892 char *v2; // edi@1 3864 char *v2; // edi@1
4489 } 4461 }
4490 } 4462 }
4491 return v16; 4463 return v16;
4492 } 4464 }
4493 4465
4494
4495
4496 //----- (004783FA) -------------------------------------------------------- 4466 //----- (004783FA) --------------------------------------------------------
4497 void __cdecl sub_4783FA_construct_global_73D150() 4467 void __cdecl sub_4783FA_construct_global_73D150()
4498 { 4468 {
4499 char *v0; // eax@1 4469 char *v0; // eax@1
4500 signed int v1; // ecx@1 4470 signed int v1; // ecx@1
4507 v0 += 48; 4477 v0 += 48;
4508 --v1; 4478 --v1;
4509 } 4479 }
4510 while ( v1 ); 4480 while ( v1 );
4511 } 4481 }
4512
4513
4514 4482
4515 //----- (0047840D) -------------------------------------------------------- 4483 //----- (0047840D) --------------------------------------------------------
4516 char Render::DrawBuildingsD3D() 4484 char Render::DrawBuildingsD3D()
4517 { 4485 {
4518 IndoorCameraD3D *v0; // eax@3 4486 IndoorCameraD3D *v0; // eax@3
5405 return true; 5373 return true;
5406 } 5374 }
5407 return false; 5375 return false;
5408 } 5376 }
5409 5377
5410
5411
5412
5413 //----- (00479295) -------------------------------------------------------- 5378 //----- (00479295) --------------------------------------------------------
5414 int stru148::_479295() 5379 int stru148::_479295()
5415 { 5380 {
5416 stru148 *v1; // edi@1 5381 stru148 *v1; // edi@1
5417 ODMFace *v2; // esi@1 5382 ODMFace *v2; // esi@1
5549 goto LABEL_24; 5514 goto LABEL_24;
5550 } 5515 }
5551 return result; 5516 return result;
5552 } 5517 }
5553 5518
5554
5555
5556 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) 5519 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr)
5557 { 5520 {
5558 #pragma pack(push, 1) 5521 #pragma pack(push, 1)
5559 struct TGAHeader 5522 struct TGAHeader
5560 { 5523 {
5630 5593
5631 unsigned short *skybox_xn, *skybox_xp, 5594 unsigned short *skybox_xn, *skybox_xp,
5632 *skybox_yn, *skybox_yp, 5595 *skybox_yn, *skybox_yp,
5633 *skybox_zn, *skybox_zp; 5596 *skybox_zn, *skybox_zp;
5634 int skybox_width, skybox_height; 5597 int skybox_width, skybox_height;
5598
5635 IDirect3DTexture2 *skybox_texture; 5599 IDirect3DTexture2 *skybox_texture;
5636 IDirectDrawSurface4 *skybox_surface; 5600 IDirectDrawSurface4 *skybox_surface;
5601
5637 bool Skybox_Initialize(const wchar_t *skybox_name) 5602 bool Skybox_Initialize(const wchar_t *skybox_name)
5638 { 5603 {
5639 wchar_t xn_filename[1024], xp_filename[1024], 5604 wchar_t xn_filename[1024], xp_filename[1024],
5640 yn_filename[1024], yp_filename[1024], 5605 yn_filename[1024], yp_filename[1024],
5641 zn_filename[1024], zp_filename[1024]; 5606 zn_filename[1024], zp_filename[1024];
5712 return false; 5677 return false;
5713 5678
5714 return true; 5679 return true;
5715 } 5680 }
5716 5681
5717
5718 struct vector 5682 struct vector
5719 { 5683 {
5720 float x, y, z; 5684 float x, y, z;
5721 }; 5685 };
5686
5722 struct matrix 5687 struct matrix
5723 { 5688 {
5724 float m[4][4]; 5689 float m[4][4];
5725 }; 5690 };
5691
5726 void VectorNormalize(vector *v) 5692 void VectorNormalize(vector *v)
5727 { 5693 {
5728 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); 5694 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z);
5729 v->x *= invmag; 5695 v->x *= invmag;
5730 v->y *= invmag; 5696 v->y *= invmag;
5731 v->z *= invmag; 5697 v->z *= invmag;
5732 } 5698 }
5699
5733 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle) 5700 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle)
5734 { 5701 {
5735 memset(pout, 0, sizeof(matrix)); 5702 memset(pout, 0, sizeof(matrix));
5736 pout->m[3][0] = 0; 5703 pout->m[3][0] = 0;
5737 pout->m[3][1] = 0; 5704 pout->m[3][1] = 0;
5750 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x; 5717 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x;
5751 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y; 5718 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y;
5752 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x; 5719 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x;
5753 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle); 5720 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle);
5754 } 5721 }
5722
5755 void VectorTransform(const matrix *m, const vector *v, vector *out) 5723 void VectorTransform(const matrix *m, const vector *v, vector *out)
5756 { 5724 {
5757 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0]; 5725 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0];
5758 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1]; 5726 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1];
5759 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2]; 5727 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2];
5760 } 5728 }
5761
5762 5729
5763 bool DrawSkyD3D_Skybox() 5730 bool DrawSkyD3D_Skybox()
5764 { 5731 {
5765 static bool initialized = false, 5732 static bool initialized = false,
5766 initialization_failed = false; 5733 initialization_failed = false;
6743 } 6710 }
6744 while ( (signed int)v9 < (signed int)&unk_801A0C ); 6711 while ( (signed int)v9 < (signed int)&unk_801A0C );
6745 MM7Initialization(); 6712 MM7Initialization();
6746 } 6713 }
6747 6714
6748
6749
6750 //----- (0047A825) -------------------------------------------------------- 6715 //----- (0047A825) --------------------------------------------------------
6751 bool LevelDecoration::_47A825() 6716 bool LevelDecoration::_47A825()
6752 { 6717 {
6753 bool v1; // ebx@1 6718 bool v1; // ebx@1
6754 LevelDecoration *v2; // edi@1 6719 LevelDecoration *v2; // edi@1
6782 } 6747 }
6783 } 6748 }
6784 LOBYTE(v2->field_2) |= 0x20u; 6749 LOBYTE(v2->field_2) |= 0x20u;
6785 return v1; 6750 return v1;
6786 } 6751 }
6787
6788
6789 6752
6790 //----- (0047BC6F) -------------------------------------------------------- 6753 //----- (0047BC6F) --------------------------------------------------------
6791 unsigned __int16 *__fastcall GetBillboardPalette(RenderBillboard *a1, int a2, signed int a3, int a4) 6754 unsigned __int16 *__fastcall GetBillboardPalette(RenderBillboard *a1, int a2, signed int a3, int a4)
6792 { 6755 {
6793 int v4; // ebx@1 6756 int v4; // ebx@1
6886 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1); 6849 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1);
6887 } 6850 }
6888 // 6BE030: using guessed type int day_attrib; 6851 // 6BE030: using guessed type int day_attrib;
6889 // 6BE040: using guessed type int day_fogrange_1; 6852 // 6BE040: using guessed type int day_fogrange_1;
6890 // 6BE044: using guessed type int day_fogrange_2; 6853 // 6BE044: using guessed type int day_fogrange_2;
6891
6892
6893
6894
6895
6896
6897
6898 6854
6899 //----- (0047BEB1) -------------------------------------------------------- 6855 //----- (0047BEB1) --------------------------------------------------------
6900 int __fastcall sr_sub_47BEB1(signed int a1, stru148 *a2, int terrain_gamma, int a4, int *a5, int *a6, int a7, int a8) 6856 int __fastcall sr_sub_47BEB1(signed int a1, stru148 *a2, int terrain_gamma, int a4, int *a5, int *a6, int a7, int a8)
6901 { 6857 {
6902 stru148 *v8; // ebx@1 6858 stru148 *v8; // ebx@1
7205 result = (char *)PaletteManager::_47C33F_get_palette(v4->pTexture->palette_id2, a2a); 7161 result = (char *)PaletteManager::_47C33F_get_palette(v4->pTexture->palette_id2, a2a);
7206 } 7162 }
7207 } 7163 }
7208 return result; 7164 return result;
7209 } 7165 }
7210
7211 // 4D864C: using guessed type char byte_4D864C; 7166 // 4D864C: using guessed type char byte_4D864C;
7212
7213 7167
7214 //----- (0047C370) -------------------------------------------------------- 7168 //----- (0047C370) --------------------------------------------------------
7215 unsigned int __cdecl GetLevelFogColor() 7169 unsigned int __cdecl GetLevelFogColor()
7216 { 7170 {
7217 unsigned int result; // eax@2 7171 unsigned int result; // eax@2
7308 LABEL_21: 7262 LABEL_21:
7309 if ( a2 ) 7263 if ( a2 )
7310 v7 = 248; 7264 v7 = 248;
7311 return (-1 - v7) << 24; 7265 return (-1 - v7) << 24;
7312 } 7266 }
7313
7314 7267
7315 //----- (0047C4FC) -------------------------------------------------------- 7268 //----- (0047C4FC) --------------------------------------------------------
7316 signed int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) 7269 signed int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5)
7317 { 7270 {
7318 //int v5; // esi@1 7271 //int v5; // esi@1
7450 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); 7403 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8);
7451 } 7404 }
7452 } 7405 }
7453 // 6BE3C4: using guessed type char bUnderwater; 7406 // 6BE3C4: using guessed type char bUnderwater;
7454 7407
7455
7456
7457
7458 //----- (0047F44B) -------------------------------------------------------- 7408 //----- (0047F44B) --------------------------------------------------------
7459 unsigned int __stdcall WorldPosToGridCellX(signed int sWorldPosX) 7409 unsigned int __stdcall WorldPosToGridCellX(signed int sWorldPosX)
7460 { 7410 {
7461 return (sWorldPosX / 512) + 64; 7411 return (sWorldPosX / 512) + 64;
7462 } 7412 }
7529 //while ( band3a < 65792 ); 7479 //while ( band3a < 65792 );
7530 } 7480 }
7531 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); 7481 //while ( (signed int)v4 < (signed int)arary_77E5C8 );
7532 } 7482 }
7533 7483
7534
7535
7536
7537 //----- (004811A3) -------------------------------------------------------- 7484 //----- (004811A3) --------------------------------------------------------
7538 void stru148::_4811A3() 7485 void stru148::_4811A3()
7539 { 7486 {
7540 __debugbreak(); 7487 __debugbreak();
7541 7488
7545 0, 0); 7492 0, 0);
7546 7493
7547 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1)); 7494 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1));
7548 pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], 1, 1); 7495 pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], 1, 1);
7549 } 7496 }
7550
7551
7552 7497
7553 //----- (00481DB2) -------------------------------------------------------- 7498 //----- (00481DB2) --------------------------------------------------------
7554 char __fastcall sr_sub_481DB2(RenderVertexSoft *a1, signed int a2, stru148 *a3) 7499 char __fastcall sr_sub_481DB2(RenderVertexSoft *a1, signed int a2, stru148 *a3)
7555 { 7500 {
7556 int v3; // eax@2 7501 int v3; // eax@2
7585 } 7530 }
7586 return result; 7531 return result;
7587 } 7532 }
7588 // 50B570: using guessed type int dword_50B570[]; 7533 // 50B570: using guessed type int dword_50B570[];
7589 // 50B638: using guessed type int dword_50B638[]; 7534 // 50B638: using guessed type int dword_50B638[];
7590
7591
7592 7535
7593 //----- (00481E55) -------------------------------------------------------- 7536 //----- (00481E55) --------------------------------------------------------
7594 void OutdoorCamera::Project(unsigned int uNumVertices) 7537 void OutdoorCamera::Project(unsigned int uNumVertices)
7595 { 7538 {
7596 double v1; // st7@2 7539 double v1; // st7@2
7717 return true; 7660 return true;
7718 } 7661 }
7719 else 7662 else
7720 return false; 7663 return false;
7721 } 7664 }
7722
7723
7724 7665
7725 //----- (004823F4) -------------------------------------------------------- 7666 //----- (004823F4) --------------------------------------------------------
7726 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) 7667 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
7727 { 7668 {
7728 //unsigned int v2; // ebx@1 7669 //unsigned int v2; // ebx@1
7811 if ( y1 > y3 ) 7752 if ( y1 > y3 )
7812 y3 = y1; 7753 y3 = y1;
7813 } 7754 }
7814 return y3 - v10 > 512;*/ 7755 return y3 - v10 > 512;*/
7815 } 7756 }
7816
7817 7757
7818 //----- (0048257A) -------------------------------------------------------- 7758 //----- (0048257A) --------------------------------------------------------
7819 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4) 7759 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4)
7820 { 7760 {
7821 unsigned int v4; // ebx@1 7761 unsigned int v4; // ebx@1
7883 { 7823 {
7884 result = v14 + dword_76D518_terrain_cell_world_pos_around_party_y; 7824 result = v14 + dword_76D518_terrain_cell_world_pos_around_party_y;
7885 } 7825 }
7886 return result; 7826 return result;
7887 } 7827 }
7888
7889 7828
7890 //----- (0048276F) -------------------------------------------------------- 7829 //----- (0048276F) --------------------------------------------------------
7891 void stru148::_48276F_sr() 7830 void stru148::_48276F_sr()
7892 { 7831 {
7893 unsigned int v1; // ebx@1 7832 unsigned int v1; // ebx@1
8067 //----- (00482A90) -------------------------------------------------------- 8006 //----- (00482A90) --------------------------------------------------------
8068 signed int __cdecl const_1_0() 8007 signed int __cdecl const_1_0()
8069 { 8008 {
8070 return 1; 8009 return 1;
8071 } 8010 }
8072
8073 8011
8074 //----- (00482A94) -------------------------------------------------------- 8012 //----- (00482A94) --------------------------------------------------------
8075 int sr_sub_482A94(Span *_this) 8013 int sr_sub_482A94(Span *_this)
8076 { 8014 {
8077 stru315 *v1; // ebp@0 8015 stru315 *v1; // ebp@0
8701 } 8639 }
8702 } 8640 }
8703 return 0; 8641 return 0;
8704 } 8642 }
8705 8643
8706
8707 //----- (004839BD) -------------------------------------------------------- 8644 //----- (004839BD) --------------------------------------------------------
8708 signed int __fastcall sr_sub_4839BD(Span *ecx0, unsigned __int16 *pTargetSurface) 8645 signed int __fastcall sr_sub_4839BD(Span *ecx0, unsigned __int16 *pTargetSurface)
8709 { 8646 {
8710 stru315 *v2; // ebp@0 8647 stru315 *v2; // ebp@0
8711 int v3; // eax@1 8648 int v3; // eax@1
9016 // 4D864C: using guessed type char byte_4D864C; 8953 // 4D864C: using guessed type char byte_4D864C;
9017 // 6BE0E4: using guessed type int mipmapping_building_mm1; 8954 // 6BE0E4: using guessed type int mipmapping_building_mm1;
9018 // 6BE0E8: using guessed type int mipmapping_building_mm2; 8955 // 6BE0E8: using guessed type int mipmapping_building_mm2;
9019 // 6BE0EC: using guessed type int mipmapping_building_mm3; 8956 // 6BE0EC: using guessed type int mipmapping_building_mm3;
9020 8957
9021
9022
9023 //----- (0048408A) -------------------------------------------------------- 8958 //----- (0048408A) --------------------------------------------------------
9024 signed int sr_sub_48408A_prolly_odm_water_no_waves(Span *_this) 8959 signed int sr_sub_48408A_prolly_odm_water_no_waves(Span *_this)
9025 { 8960 {
9026 stru315 *v1; // ebp@0 8961 stru315 *v1; // ebp@0
9027 Span *v2; // edi@1 8962 Span *v2; // edi@1
9197 sr_sub_4D6FB0(v1); 9132 sr_sub_4D6FB0(v1);
9198 } 9133 }
9199 return 1; 9134 return 1;
9200 } 9135 }
9201 9136
9202
9203
9204 //----- (00484442) -------------------------------------------------------- 9137 //----- (00484442) --------------------------------------------------------
9205 signed int sr_sub_484442(Span *_this) 9138 signed int sr_sub_484442(Span *_this)
9206 { 9139 {
9207 int v1; // ebp@0 9140 int v1; // ebp@0
9208 Span *v2; // edi@1 9141 Span *v2; // edi@1
9362 else 9295 else
9363 sr_sub_4D73DF(v1); 9296 sr_sub_4D73DF(v1);
9364 } 9297 }
9365 return 1; 9298 return 1;
9366 } 9299 }
9367
9368 9300
9369 //----- (004847EB) -------------------------------------------------------- 9301 //----- (004847EB) --------------------------------------------------------
9370 int sr_sub_4847EB(Span *_this) 9302 int sr_sub_4847EB(Span *_this)
9371 { 9303 {
9372 stru315 *v1; // ebp@0 9304 stru315 *v1; // ebp@0
9738 // 80AA14: using guessed type int dword_80AA14; 9670 // 80AA14: using guessed type int dword_80AA14;
9739 // 80AA18: using guessed type int dword_80AA18; 9671 // 80AA18: using guessed type int dword_80AA18;
9740 // 80AA1C: using guessed type int dword_80AA1C; 9672 // 80AA1C: using guessed type int dword_80AA1C;
9741 // 80AA20: using guessed type int dword_80AA20; 9673 // 80AA20: using guessed type int dword_80AA20;
9742 9674
9743
9744
9745 //----- (00485407) -------------------------------------------------------- 9675 //----- (00485407) --------------------------------------------------------
9746 signed int __fastcall sr_sub_485407_prolly_odm_water_wavy(Span *a1) 9676 signed int __fastcall sr_sub_485407_prolly_odm_water_wavy(Span *a1)
9747 { 9677 {
9748 stru315 *v1; // ebp@0 9678 stru315 *v1; // ebp@0
9749 int v2; // eax@1 9679 int v2; // eax@1
9945 sr_sub_4D6FB0(v1); 9875 sr_sub_4D6FB0(v1);
9946 } 9876 }
9947 return 1; 9877 return 1;
9948 } 9878 }
9949 9879
9950
9951 //----- (0048585C) -------------------------------------------------------- 9880 //----- (0048585C) --------------------------------------------------------
9952 signed int __fastcall sr_sub_48585C_mb_DrawSpan(Span *a1, unsigned __int16 *pRenderTarget, int a4) 9881 signed int __fastcall sr_sub_48585C_mb_DrawSpan(Span *a1, unsigned __int16 *pRenderTarget, int a4)
9953 { 9882 {
9954 Span *v3; // esi@1 9883 Span *v3; // esi@1
9955 stru148 *v4; // edi@1 9884 stru148 *v4; // edi@1
10497 ++v->y; 10426 ++v->y;
10498 if ( v->y > 1000 ) 10427 if ( v->y > 1000 )
10499 v->y = 0; 10428 v->y = 0;
10500 } 10429 }
10501 10430
10502
10503
10504 //----- (00485F64) -------------------------------------------------------- 10431 //----- (00485F64) --------------------------------------------------------
10505 void OutdoorCamera::_485F64() 10432 void OutdoorCamera::_485F64()
10506 { 10433 {
10507 int v1; // eax@1 10434 int v1; // eax@1
10508 int v2; // eax@2 10435 int v2; // eax@2
10532 camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY); 10459 camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY);
10533 camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY); 10460 camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY);
10534 camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX); 10461 camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX);
10535 camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX); 10462 camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX);
10536 } 10463 }
10537
10538 10464
10539 //----- (0048607B) -------------------------------------------------------- 10465 //----- (0048607B) --------------------------------------------------------
10540 void stru148::_48607B(stru149 *a2) 10466 void stru148::_48607B(stru149 *a2)
10541 { 10467 {
10542 this->pTexture = 0; 10468 this->pTexture = 0;
10833 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16; 10759 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16;
10834 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; 10760 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16;
10835 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); 10761 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16);
10836 return result; 10762 return result;
10837 } 10763 }
10838
10839 10764
10840 //----- (00486A28) -------------------------------------------------------- 10765 //----- (00486A28) --------------------------------------------------------
10841 void OutdoorCamera::AllocSoftwareDrawBuffers() 10766 void OutdoorCamera::AllocSoftwareDrawBuffers()
10842 { 10767 {
10843 if ( !this || !pSpans ) 10768 if ( !this || !pSpans )
11083 } 11008 }
11084 } 11009 }
11085 return v7; 11010 return v7;
11086 } 11011 }
11087 11012
11088
11089
11090 //----- (0043F953) -------------------------------------------------------- 11013 //----- (0043F953) --------------------------------------------------------
11091 void PrepareBspRenderList_BLV() 11014 void PrepareBspRenderList_BLV()
11092 { 11015 {
11093 pBspRenderer->num_faces = 0; 11016 pBspRenderer->num_faces = 0;
11094 11017
11298 v15->uTintColor = 0; 11221 v15->uTintColor = 0;
11299 v15->pSpriteFrame = v12; 11222 v15->pSpriteFrame = v12;
11300 } 11223 }
11301 } 11224 }
11302 } 11225 }
11303
11304 11226
11305 //----- (0044028F) -------------------------------------------------------- 11227 //----- (0044028F) --------------------------------------------------------
11306 void PrepareItemsRenderList_BLV() 11228 void PrepareItemsRenderList_BLV()
11307 { 11229 {
11308 ObjectDesc *v1; // ebx@4 11230 ObjectDesc *v1; // ebx@4
11463 } 11385 }
11464 } 11386 }
11465 } 11387 }
11466 } 11388 }
11467 11389
11468
11469
11470 //----- (00440639) -------------------------------------------------------- 11390 //----- (00440639) --------------------------------------------------------
11471 void AddBspNodeToRenderList(unsigned int node_id) 11391 void AddBspNodeToRenderList(unsigned int node_id)
11472 { 11392 {
11473 //int v1; // ebx@1 11393 //int v1; // ebx@1
11474 signed int v2; // edi@1 11394 signed int v2; // edi@1
11612 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || 11532 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
11613 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E || 11533 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E ||
11614 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING; 11534 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
11615 } 11535 }
11616 // 4E28F8: using guessed type int pCurrentScreen; 11536 // 4E28F8: using guessed type int pCurrentScreen;
11617
11618
11619 11537
11620 //----- (00441A4E) -------------------------------------------------------- 11538 //----- (00441A4E) --------------------------------------------------------
11621 __int16 __fastcall sub_441A4E(int a1) 11539 __int16 __fastcall sub_441A4E(int a1)
11622 { 11540 {
11623 __int16 result; // ax@1 11541 __int16 result; // ax@1
11689 v3 += 20; 11607 v3 += 20;
11690 } 11608 }
11691 while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); 11609 while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays );
11692 return result; 11610 return result;
11693 } 11611 }
11694
11695
11696
11697
11698
11699 11612
11700 //----- (00443801) -------------------------------------------------------- 11613 //----- (00443801) --------------------------------------------------------
11701 void Initialize2DA() 11614 void Initialize2DA()
11702 { 11615 {
11703 11616
11923 } while ((decode_step<24)&&!break_loop); 11836 } while ((decode_step<24)&&!break_loop);
11924 } 11837 }
11925 11838
11926 } 11839 }
11927 11840
11928
11929 //----- (00443E31) -------------------------------------------------------- 11841 //----- (00443E31) --------------------------------------------------------
11930 void LoadLevel_InitializeLevelStr() 11842 void LoadLevel_InitializeLevelStr()
11931 { 11843 {
11932 11844
11933 char Args[100]; 11845 char Args[100];
11971 ++pLevelStrOffsets[i]; 11883 ++pLevelStrOffsets[i];
11972 } 11884 }
11973 } 11885 }
11974 } 11886 }
11975 11887
11976
11977 //----- (00443F95) -------------------------------------------------------- 11888 //----- (00443F95) --------------------------------------------------------
11978 void __cdecl OnMapLeave() 11889 void __cdecl OnMapLeave()
11979 { 11890 {
11980 _evt_raw *test_event; 11891 _evt_raw *test_event;
11981 if ( uLevelEVT_NumEvents > 0 ) 11892 if ( uLevelEVT_NumEvents > 0 )
11991 } 11902 }
11992 } 11903 }
11993 } 11904 }
11994 } 11905 }
11995 11906
11996
11997 //----- (00443FDC) -------------------------------------------------------- 11907 //----- (00443FDC) --------------------------------------------------------
11998 void OnMapLoad() 11908 void OnMapLoad()
11999 { 11909 {
12000 stru176 *v3; // esi@7 11910 stru176 *v3; // esi@7
12001 __int16 v4; // cx@9 11911 __int16 v4; // cx@9
12002 __int16 v5; // di@9 11912 __int16 v5; // di@9
12003 int v6; // eax@9 11913 int v6; // eax@9
12004 signed __int64 v8; // qax@26 11914 signed __int64 v8; // qax@26
12025 __int16 v31; // [sp+4Ah] [bp-6h]@9 11935 __int16 v31; // [sp+4Ah] [bp-6h]@9
12026 __int16 v32; // [sp+4Ch] [bp-4h]@9 11936 __int16 v32; // [sp+4Ch] [bp-4h]@9
12027 __int16 v33; // [sp+4Eh] [bp-2h]@9 11937 __int16 v33; // [sp+4Eh] [bp-2h]@9
12028 11938
12029 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) 11939 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
11940 {
11941 auto pEvent = pLevelEVT_Index[i];
11942
11943 auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
11944
11945 if (_evt->_e_type == EVENT_PlaySound)
12030 { 11946 {
12031 auto pEvent = pLevelEVT_Index[i];
12032
12033 auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
12034
12035 if (_evt->_e_type == EVENT_PlaySound)
12036 {
12037 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); 11947 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
12038 } 11948 }
12039 else if (_evt->_e_type == EVENT_OnMapReload) 11949 else if (_evt->_e_type == EVENT_OnMapReload)
12040 { 11950 {
12041 start_event_seq_number = pEvent.event_sequence_num; 11951 start_event_seq_number = pEvent.event_sequence_num;
12042 EventProcessor(pEvent.uEventID, 0, 0); 11952 EventProcessor(pEvent.uEventID, 0, 0);
12043 start_event_seq_number = 0; 11953 start_event_seq_number = 0;
12044 } 11954 }
12045 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) 11955 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
12046 { 11956 {
12047 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; 11957 v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
12048 v20 = pOutdoor->uLastVisitDay; 11958 v20 = pOutdoor->uLastVisitDay;
12049 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) 11959 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
12050 v20 = pIndoor->stru1.uLastVisitDay; 11960 v20 = pIndoor->stru1.uLastVisitDay;
12051 11961
12064 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; 11974 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
12065 11975
12066 v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11; 11976 v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11;
12067 v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11; 11977 v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11;
12068 if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) 11978 if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 )
12069 { 11979 {
12070 if ( v20 ) 11980 if ( v20 )
12071 v18 = pParty->uTimePlayed - v20; 11981 v18 = pParty->uTimePlayed - v20;
12072 else 11982 else
12073 v18 = 0i64; 11983 v18 = 0i64;
12074 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; 11984 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
12075 11985
12076 if ( v26 / 7 / 4 / 12 ) 11986 if ( v26 / 7 / 4 / 12 )
11987 {
11988 if ( v3->field_10 )
12077 { 11989 {
12078 if ( v3->field_10 )
12079 {
12080 ++dword_5B65C8_timers_count; 11990 ++dword_5B65C8_timers_count;
12081 v3->field_0_time = 0; 11991 v3->field_0_time = 0;
12082 continue; 11992 continue;
12083 }
12084 } 11993 }
11994 }
12085 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 || 11995 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 ||
12086 v26 / 7 != 0 && v3->field_14 != 0 || 11996 v26 / 7 != 0 && v3->field_14 != 0 ||
12087 v26 != 0 || !v20) 11997 v26 != 0 || !v20)
12088 { 11998 {
12089 ++dword_5B65C8_timers_count; 11999 ++dword_5B65C8_timers_count;
12090 v3->field_0_time = 0; 12000 v3->field_0_time = 0;
12091 continue; 12001 continue;
12092 }
12093 } 12002 }
12003 }
12094 else 12004 else
12095 { 12005 {
12096 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); 12006 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
12097 v9 = v8; 12007 v9 = v8;
12098 v10 = (signed int)v8 / 60; 12008 v10 = (signed int)v8 / 60;
12099 minutes = v10 % 60; 12009 minutes = v10 % 60;
12100 v11 = (signed int)(v10 / 60); 12010 v11 = (signed int)(v10 / 60);
12116 12026
12117 hours = v12; 12027 hours = v12;
12118 weeks = v15; 12028 weeks = v15;
12119 months = v16 % 12; 12029 months = v16 % 12;
12120 if ( v3->field_10 ) 12030 if ( v3->field_10 )
12031 {
12032 ++years;
12033 }
12034 else
12035 {
12036 if ( v3->field_12 )
12121 { 12037 {
12122 ++years; 12038 ++months;
12123 } 12039 }
12124 else 12040 else
12125 { 12041 {
12126 if ( v3->field_12 ) 12042 if ( v3->field_14 )
12127 { 12043 {
12128 ++months; 12044 ++weeks;
12129 } 12045 }
12130 else 12046 else
12131 { 12047 {
12132 if ( v3->field_14 )
12133 {
12134 ++weeks;
12135 }
12136 else
12137 {
12138 ++days; 12048 ++days;
12139 minutes = v3->field_18; 12049 minutes = v3->field_18;
12140 hours = v3->field_16; 12050 hours = v3->field_16;
12141 seconds = v3->field_1A; 12051 seconds = v3->field_1A;
12142 }
12143 } 12052 }
12144 } 12053 }
12054 }
12145 v3->field_0_time = (signed __int64)((double)((seconds 12055 v3->field_0_time = (signed __int64)((double)((seconds
12146 + 60 * minutes 12056 + 60 * minutes
12147 + 3600 * hours 12057 + 3600 * hours
12148 + 0x93A80 * weeks 12058 + 0x93A80 * weeks
12149 + 0x15180 * days 12059 + 0x15180 * days
12150 + 0x24EA00 * (months + 12i64 * years)) << 7) 12060 + 0x24EA00 * (months + 12i64 * years)) << 7)
12151 * 0.033333335); 12061 * 0.033333335);
12152 12062
12153 ++dword_5B65C8_timers_count; 12063 ++dword_5B65C8_timers_count;
12154 }
12155 } 12064 }
12156 } 12065 }
12157 } 12066 }
12067 }
12158 12068
12159 //----- (00444360) -------------------------------------------------------- 12069 //----- (00444360) --------------------------------------------------------
12160 void __thiscall Level_LoadEvtAndStr(const char *pLevelName) 12070 void __thiscall Level_LoadEvtAndStr(const char *pLevelName)
12161 { 12071 {
12162 char pContainerName[120]; // [sp+8h] [bp-98h]@1 12072 char pContainerName[120]; // [sp+8h] [bp-98h]@1
12359 } 12269 }
12360 } 12270 }
12361 return result; 12271 return result;
12362 } 12272 }
12363 12273
12364
12365
12366
12367 //----- (00444A51) -------------------------------------------------------- 12274 //----- (00444A51) --------------------------------------------------------
12368 void TransitionUI_Draw() 12275 void TransitionUI_Draw()
12369 { 12276 {
12370 MapInfo *pMapInfo; // esi@5 12277 MapInfo *pMapInfo; // esi@5
12371 char *v1; // eax@6 12278 char *v1; // eax@6
12416 else assert(false); 12323 else assert(false);
12417 12324
12418 _unused_5B5924_is_travel_ui_drawn = true; 12325 _unused_5B5924_is_travel_ui_drawn = true;
12419 } 12326 }
12420 12327
12421
12422 //----- (00444C8F) -------------------------------------------------------- 12328 //----- (00444C8F) --------------------------------------------------------
12423 void UI_CreateTravelDialogue() 12329 void UI_CreateTravelDialogue()
12424 { 12330 {
12425 //signed int v0; // eax@1 12331 //signed int v0; // eax@1
12426 unsigned int v1; // eax@6 12332 unsigned int v1; // eax@6
12532 v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3u); 12438 v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3u);
12533 _unused_5B5924_is_travel_ui_drawn = 1; 12439 _unused_5B5924_is_travel_ui_drawn = 1;
12534 } 12440 }
12535 } 12441 }
12536 12442
12537
12538 //----- (00444FBE) -------------------------------------------------------- 12443 //----- (00444FBE) --------------------------------------------------------
12539 void __cdecl DrawBranchlessDialogueUI() 12444 void __cdecl DrawBranchlessDialogueUI()
12540 { 12445 {
12541 GUIFont *v0; // esi@1 12446 GUIFont *v0; // esi@1
12542 int v1; // esi@4 12447 int v1; // esi@4
12636 EventProcessor(dword_5C3418, 0, 1); 12541 EventProcessor(dword_5C3418, 0, 1);
12637 start_event_seq_number = 0; 12542 start_event_seq_number = 0;
12638 activeLevelDecoration = NULL; 12543 activeLevelDecoration = NULL;
12639 pEventTimer->Resume(); 12544 pEventTimer->Resume();
12640 } 12545 }
12641
12642 12546
12643 //----- (00445308) -------------------------------------------------------- 12547 //----- (00445308) --------------------------------------------------------
12644 const char *GetProfessionActionText(int a1) 12548 const char *GetProfessionActionText(int a1)
12645 { 12549 {
12646 if ( a1 == 10 12550 if ( a1 == 10
13011 } 12915 }
13012 } 12916 }
13013 pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0)); 12917 pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0));
13014 } 12918 }
13015 12919
13016 //----- (004459F9) --------------------------------------------------------
13017 NPCData *__fastcall GetNPCData(signed int npcid)
13018 {
13019 unsigned int v1; // esi@1
13020 NPCData *result; // eax@5
13021 int v3; // esi@9
13022 int v4; // ecx@9
13023 //int v5; // edx@9
13024 //NPCData *v6; // eax@9
13025 char *v7; // ebx@14
13026 NPCData *v8; // edi@14
13027 char v9; // al@22
13028 char v10;
13029 //std::string v10; // [sp-18h] [bp-2Ch]@4
13030 int v11;
13031 //const char *v11; // [sp-8h] [bp-1Ch]@4
13032 int v12; // [sp-4h] [bp-18h]@4
13033 int v13;
13034 char *v14;
13035 //std::string *v13; // [sp+Ch] [bp-8h]@4
13036 int a3; // [sp+13h] [bp-1h]@4
13037 int i;
13038
13039 /*v1 = npcid;
13040 if ( (npcid & 0x80000000u) == 0 )
13041 {
13042 if ( (signed int)npcid < 5000 )
13043 {
13044 if ( (signed int)npcid >= 501 )
13045 {
13046 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
13047 }
13048 return &pNPCStats->pNewNPCData[v1];
13049 }
13050 return &pNPCStats->array_13EF4[npcid - 5000];
13051 }
13052 if ( (signed int)npcid >= 5000 )
13053 return &pNPCStats->array_13EF4[npcid - 5000];
13054 if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 )
13055 {
13056 result = 0;
13057 }
13058 else
13059 {
13060 v3 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1;
13061 v4 = 0;
13062 v5 = 0;
13063 v6 = pParty->pHirelings;
13064 do
13065 {
13066 if ( v6->pName )
13067 pTmpBuf[v4++] = v5;
13068 ++v6;
13069 ++v5;
13070 }
13071 while ( (signed int)v6 < (signed int)&pParty->pPickedItem );
13072 v13 = 0;
13073 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
13074 {
13075 v7 = &pTmpBuf[v4];
13076 v8 = pNPCStats->pNewNPCData;
13077 do
13078 {
13079 if ( v8->uFlags & 0x80
13080 && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName))
13081 && (!pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName)) )
13082 *v7++ = (char)v13 + 2;
13083 v13 = (std::string *)((char *)v13 + 1);
13084 ++v8;
13085 }
13086 while ( (signed int)v13 < (signed int)pNPCStats->uNumNewNPCs );
13087 }
13088 v9 = pTmpBuf[v3];
13089 if ( (unsigned __int8)v9 >= 2u )
13090 result = &pNPCStats->pNPCData[(unsigned __int8)v9 + 499];
13091 else
13092 result = &pParty->pHirelings[(unsigned __int8)v9];
13093 }
13094 return result;*/
13095 v1 = npcid;
13096 if ( npcid >= 0 )
13097 {
13098 if ( npcid < 5000 )
13099 {
13100 if ( npcid >= 501 )
13101 {
13102 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
13103 }
13104 return &pNPCStats->pNewNPCData[v1];// - 1];
13105 }
13106 return &pNPCStats->pAdditionalNPC[npcid - 5000];
13107 }
13108
13109
13110 if ( npcid >= 5000 )
13111 return &pNPCStats->pAdditionalNPC[npcid - 5000];
13112 if (sDialogue_SpeakingActorNPC_ID >= 0)
13113 {
13114 result = 0;
13115 }
13116 else
13117 {
13118 v3 = abs(sDialogue_SpeakingActorNPC_ID) - 1;
13119 v4 = 0;
13120
13121 for (i = 0; i < 2; ++i)
13122 {
13123 if (pParty->pHirelings[i].pName)
13124 pTmpBuf[v4++] = i;
13125 }
13126
13127 if (pNPCStats->uNumNewNPCs > 0)
13128 {
13129 for (i = 0; i < pNPCStats->uNumNewNPCs; ++i)
13130 {
13131 if (pNPCStats->pNewNPCData[i].Hired())
13132 {
13133 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
13134 {
13135 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
13136 pTmpBuf[v4++] = i + 2;
13137 }
13138 }
13139 }
13140 }
13141
13142 v9 = pTmpBuf[v3];
13143 if ( v9 >= 2 )
13144 result = &pNPCStats->pNPCData[499 + v9];
13145 else
13146 result = &pParty->pHirelings[v9];
13147 }
13148 }
13149
13150 //----- (00445B2C) --------------------------------------------------------
13151 NPCData *__fastcall GetNewNPCData(signed int npcid, int a2)
13152 {
13153 signed int v2; // esi@1
13154 int v3; // edi@1
13155 NPCData *result; // eax@5
13156 int v5; // esi@9
13157 int v6; // ecx@9
13158 int v7; // edx@9
13159 NPCData *v8; // eax@9
13160 NPCData *v9; // edi@14
13161 int v10; // ecx@20
13162 char v11; // al@23
13163 std::string v12; // [sp-18h] [bp-34h]@4
13164 const char *v13; // [sp-8h] [bp-24h]@4
13165 int v14; // [sp-4h] [bp-20h]@4
13166 std::string *v15; // [sp+Ch] [bp-10h]@1
13167 char *v16; // [sp+10h] [bp-Ch]@14
13168 int v17; // [sp+14h] [bp-8h]@13
13169 int a3; // [sp+1Bh] [bp-1h]@4
13170
13171 v2 = npcid;
13172 v3 = a2;
13173 v15 = (std::string *)a2;
13174 if ( npcid >= 0 )
13175 {
13176 if ( npcid < 5000 )
13177 {
13178 if ( npcid >= 501 )
13179 {
13180 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:2040", 0);
13181 }
13182 *(int *)v3 = v2;
13183 return &pNPCStats->pNewNPCData[v2];
13184 }
13185 LABEL_7:
13186 *(int *)a2 = npcid - 5000;
13187 return &pNPCStats->pAdditionalNPC[npcid - 5000];
13188 }
13189 if ( npcid >= 5000 )
13190 goto LABEL_7;
13191 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
13192 {
13193 *(int *)a2 = 0;
13194 result = 0;
13195 }
13196 else
13197 {
13198 v5 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1;
13199 v6 = 0;
13200 v7 = 0;
13201 v8 = pParty->pHirelings;
13202 do
13203 {
13204 if ( v8->pName )
13205 pTmpBuf[v6++] = v7;
13206 ++v8;
13207 ++v7;
13208 }
13209 while ( (signed int)v8 < (signed int)&pParty->pPickedItem );
13210 v17 = 0;
13211 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
13212 {
13213 v9 = pNPCStats->pNewNPCData;
13214 v16 = &pTmpBuf[v6];
13215 do
13216 {
13217 if ( v9->Hired()
13218 && (!pParty->pHirelings[0].pName || strcmp(v9->pName, pParty->pHirelings[0].pName))
13219 && (!pParty->pHirelings[1].pName || strcmp(v9->pName, pParty->pHirelings[1].pName)) )
13220 {
13221 v10 = (int)v16++;
13222 *(char *)v10 = v17 + 2;
13223 }
13224 ++v17;
13225 ++v9;
13226 }
13227 while ( v17 < (signed int)pNPCStats->uNumNewNPCs );
13228 v3 = (int)v15;
13229 }
13230 v11 = pTmpBuf[v5];
13231 if ( (unsigned __int8)v11 >= 2u )
13232 {
13233 *(int *)v3 = (unsigned __int8)v11 - 2;
13234 result = &pNPCStats->pNPCData[(unsigned __int8)pTmpBuf[v5] + 499];
13235 }
13236 else
13237 {
13238 *(int *)v3 = (unsigned __int8)v11;
13239 result = &pParty->pHirelings[(unsigned __int8)pTmpBuf[v5]];
13240 }
13241 }
13242 return result;
13243 }
13244
13245 //----- (00445C8B) -------------------------------------------------------- 12920 //----- (00445C8B) --------------------------------------------------------
13246 int __fastcall sub_445C8B(signed int a1) 12921 int __fastcall sub_445C8B(signed int a1)
13247 { 12922 {
13248 signed int v1; // ebx@1 12923 signed int v1; // ebx@1
13249 int v3; // edi@6 12924 int v3; // edi@6
13291 while ( v1 < (signed int)pNPCStats->uNumNewNPCs ); 12966 while ( v1 < (signed int)pNPCStats->uNumNewNPCs );
13292 } 12967 }
13293 return ((unsigned __int8)pTmpBuf[v3] < 2u) + 1; 12968 return ((unsigned __int8)pTmpBuf[v3] < 2u) + 1;
13294 } 12969 }
13295 12970
13296
13297 //----- (0044603D) -------------------------------------------------------- 12971 //----- (0044603D) --------------------------------------------------------
13298 void __cdecl sub_44603D() 12972 void __cdecl sub_44603D()
13299 { 12973 {
13300 sDialogue_SpeakingActorNPC_ID = 0; 12974 sDialogue_SpeakingActorNPC_ID = 0;
13301 pDialogueWindow->Release(); 12975 pDialogueWindow->Release();
13302 pDialogueWindow = 0; 12976 pDialogueWindow = 0;
13303 pMiscTimer->Resume(); 12977 pMiscTimer->Resume();
13304 pEventTimer->Resume(); 12978 pEventTimer->Resume();
13305 } 12979 }
13306
13307 12980
13308 //----- (004465DF) -------------------------------------------------------- 12981 //----- (004465DF) --------------------------------------------------------
13309 int sub_4465DF_check_season(int a1) 12982 int sub_4465DF_check_season(int a1)
13310 { 12983 {
13311 unsigned int v1; // eax@1 12984 unsigned int v1; // eax@1
13501 else 13174 else
13502 result = 2; 13175 result = 2;
13503 return result; 13176 return result;
13504 } 13177 }
13505 13178
13506
13507
13508 //----- (0044861E) -------------------------------------------------------- 13179 //----- (0044861E) --------------------------------------------------------
13509 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) 13180 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
13510 { 13181 {
13511 unsigned int v2; // eax@2 13182 unsigned int v2; // eax@2
13512 unsigned __int16 v3; // di@2 13183 unsigned __int16 v3; // di@2
13628 pParty->uFlags |= 2u; 13299 pParty->uFlags |= 2u;
13629 } 13300 }
13630 } 13301 }
13631 } 13302 }
13632 13303
13633
13634
13635
13636 //----- (0044882F) -------------------------------------------------------- 13304 //----- (0044882F) --------------------------------------------------------
13637 void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName) 13305 void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName)
13638 { 13306 {
13639 signed int v3; // ebp@1 13307 signed int v3; // ebp@1
13640 char *v4; // esi@2 13308 char *v4; // esi@2
13669 } 13337 }
13670 while ( v3 < (signed int)uNumLevelDecorations ); 13338 while ( v3 < (signed int)uNumLevelDecorations );
13671 } 13339 }
13672 } 13340 }
13673 13341
13674
13675 //----- (004488B6) -------------------------------------------------------- 13342 //----- (004488B6) --------------------------------------------------------
13676 unsigned __int16 DecorationList::GetDecorIdByName(const char *pName) 13343 unsigned __int16 DecorationList::GetDecorIdByName(const char *pName)
13677 { 13344 {
13678 DecorationList *v2; // esi@1 13345 DecorationList *v2; // esi@1
13679 signed int uID; // edi@2 13346 signed int uID; // edi@2
13698 LABEL_6: 13365 LABEL_6:
13699 result = 0; 13366 result = 0;
13700 } 13367 }
13701 return result; 13368 return result;
13702 } 13369 }
13703
13704 13370
13705 //----- (0044892E) -------------------------------------------------------- 13371 //----- (0044892E) --------------------------------------------------------
13706 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on) 13372 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on)
13707 { 13373 {
13708 signed int v3; // esi@2 13374 signed int v3; // esi@2
13778 } 13444 }
13779 pParty->uFlags |= 2u; 13445 pParty->uFlags |= 2u;
13780 } 13446 }
13781 } 13447 }
13782 13448
13783
13784
13785
13786 //----- (00448A40) --------------------------------------------------------
13787 void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle)
13788 {
13789 if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) )
13790 {
13791 if ( bToggle )
13792 {
13793 pActors[uActorID].uAttributes |= uFlag;
13794 }
13795 else
13796 {
13797 if ( uFlag == 0x10000 )
13798 {
13799 if (pActors[uActorID].uAIState == Disabled )
13800 pActors[uActorID].uAIState = Standing;
13801 }
13802 pActors[uActorID].uAttributes &= ~uFlag;
13803 }
13804 }
13805 }
13806
13807 //----- (00448A98) -------------------------------------------------------- 13449 //----- (00448A98) --------------------------------------------------------
13808 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) 13450 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle)
13809 { 13451 {
13810 unsigned int v3; // ebx@1 13452 unsigned int v3; // ebx@1
13811 unsigned int v4; // ebp@1 13453 unsigned int v4; // ebp@1
13869 while ( v7 ); 13511 while ( v7 );
13870 } 13512 }
13871 } 13513 }
13872 } 13514 }
13873 } 13515 }
13874
13875 13516
13876 //----- (00448B45) -------------------------------------------------------- 13517 //----- (00448B45) --------------------------------------------------------
13877 void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) 13518 void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
13878 { 13519 {
13879 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft ) 13520 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft )
13986 v2 = v1 * (double)pOutdoorCamera->int_fov_rad; 13627 v2 = v1 * (double)pOutdoorCamera->int_fov_rad;
13987 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; 13628 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y;
13988 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; 13629 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z;
13989 } 13630 }
13990 13631
13991
13992 //----- (00448CF4) -------------------------------------------------------- 13632 //----- (00448CF4) --------------------------------------------------------
13993 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName) 13633 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName)
13994 { 13634 {
13995 __int16 v8; // di@1 13635 __int16 v8; // di@1
13996 __int16 v9; // si@1 13636 __int16 v9; // si@1
14032 pActor->dword_000334_unique_name = uUniqueName; 13672 pActor->dword_000334_unique_name = uUniqueName;
14033 } 13673 }
14034 } 13674 }
14035 } 13675 }
14036 } 13676 }
14037
14038 13677
14039 //----- (00448DF8) -------------------------------------------------------- 13678 //----- (00448DF8) --------------------------------------------------------
14040 void __fastcall sub_448DF8_cast_spell(int spellnum, int rank, int level, int fromx, int fromy, int fromz, int tox, int toy, int toz) 13679 void __fastcall sub_448DF8_cast_spell(int spellnum, int rank, int level, int fromx, int fromy, int fromz, int tox, int toy, int toz)
14041 { 13680 {
14042 int v9; // esi@1 13681 int v9; // esi@1
14811 pArray[v3 / 8] |= set_bit; 14450 pArray[v3 / 8] |= set_bit;
14812 else 14451 else
14813 pArray[v3 / 8] &= ~set_bit; 14452 pArray[v3 / 8] &= ~set_bit;
14814 } 14453 }
14815 14454
14816
14817 //----- (0044A56A) -------------------------------------------------------- 14455 //----- (0044A56A) --------------------------------------------------------
14818 void __cdecl Party__CountHirelings() 14456 void __cdecl Party__CountHirelings()
14819 { 14457 {
14820 pParty->field_70A = 0; 14458 pParty->field_70A = 0;
14821 14459
14828 if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) 14466 if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName))
14829 ++pParty->field_70A; 14467 ++pParty->field_70A;
14830 } 14468 }
14831 } 14469 }
14832 } 14470 }
14833
14834 14471
14835 //----- (0044C175) -------------------------------------------------------- 14472 //----- (0044C175) --------------------------------------------------------
14836 void __fastcall ShowStatusBarString(const char *pString, unsigned int uNumSeconds) 14473 void __fastcall ShowStatusBarString(const char *pString, unsigned int uNumSeconds)
14837 { 14474 {
14838 unsigned int v2; // esi@1 14475 unsigned int v2; // esi@1
14851 void __cdecl ShowNothingHereStatus() 14488 void __cdecl ShowNothingHereStatus()
14852 { 14489 {
14853 if ( !GameUI_Footer_TimeLeft ) 14490 if ( !GameUI_Footer_TimeLeft )
14854 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here 14491 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
14855 } 14492 }
14856
14857 14493
14858 //----- (0044C28B) -------------------------------------------------------- 14494 //----- (0044C28B) --------------------------------------------------------
14859 signed int __cdecl const_2() 14495 signed int __cdecl const_2()
14860 { 14496 {
14861 return 2; 14497 return 2;
14881 pCurrentScreen = SCREEN_GAME; 14517 pCurrentScreen = SCREEN_GAME;
14882 result = 1; 14518 result = 1;
14883 } 14519 }
14884 return result; 14520 return result;
14885 } 14521 }
14886
14887 14522
14888 //----- (0044C2F4) -------------------------------------------------------- 14523 //----- (0044C2F4) --------------------------------------------------------
14889 int LevelDecoration::IsInteractive() 14524 int LevelDecoration::IsInteractive()
14890 { 14525 {
14891 signed int v1; // eax@1 14526 signed int v1; // eax@1
14939 v13 = v8 * v7 * 65536.0; 14574 v13 = v8 * v7 * 65536.0;
14940 v14 = v13 + 6.7553994e15; 14575 v14 = v13 + 6.7553994e15;
14941 v1->z = LODWORD(v14); 14576 v1->z = LODWORD(v14);
14942 } 14577 }
14943 14578
14944
14945
14946
14947
14948
14949 //----- (00401000) -------------------------------------------------------- 14579 //----- (00401000) --------------------------------------------------------
14950 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int)) 14580 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int))
14951 { 14581 {
14952 void *v4; // esi@2 14582 void *v4; // esi@2
14953 int v5; // edi@2 14583 int v5; // edi@2
14963 --v5; 14593 --v5;
14964 } 14594 }
14965 while ( v5 ); 14595 while ( v5 );
14966 } 14596 }
14967 } 14597 }
14968
14969 14598
14970 //----- (004014E6) -------------------------------------------------------- 14599 //----- (004014E6) --------------------------------------------------------
14971 void MakeActorAIList_ODM() 14600 void MakeActorAIList_ODM()
14972 { 14601 {
14973 int v1; // eax@4 14602 int v1; // eax@4
16063 v33 = v21->pMonsterInfo.uSpell1ID; 15692 v33 = v21->pMonsterInfo.uSpell1ID;
16064 goto LABEL_146; 15693 goto LABEL_146;
16065 } 15694 }
16066 } 15695 }
16067 15696
16068
16069
16070
16071 //----- (0040261D) -------------------------------------------------------- 15697 //----- (0040261D) --------------------------------------------------------
16072 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) 15698 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8)
16073 { 15699 {
16074 int result; // eax@1 15700 int result; // eax@1
16075 15701
16085 result = this->count; 15711 result = this->count;
16086 this->field_450[this->count++] = a7; 15712 this->field_450[this->count++] = a7;
16087 } 15713 }
16088 return result; 15714 return result;
16089 } 15715 }
16090
16091
16092
16093
16094 15716
16095 //----- (00402CAE) -------------------------------------------------------- 15717 //----- (00402CAE) --------------------------------------------------------
16096 int stru193_math::Cos(int angle) 15718 int stru193_math::Cos(int angle)
16097 { 15719 {
16098 int v2; // eax@1 15720 int v2; // eax@1
16107 if ( v2 >= uIntegerHalfPi ) 15729 if ( v2 >= uIntegerHalfPi )
16108 return -pCosTable[uIntegerPi - v2]; 15730 return -pCosTable[uIntegerPi - v2];
16109 else 15731 else
16110 return pCosTable[v2]; 15732 return pCosTable[v2];
16111 } 15733 }
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125 15734
16126 //----- (00404544) -------------------------------------------------------- 15735 //----- (00404544) --------------------------------------------------------
16127 signed int stru262_TurnBased::_404544() 15736 signed int stru262_TurnBased::_404544()
16128 { 15737 {
16129 stru262_TurnBased *v1; // ebx@1 15738 stru262_TurnBased *v1; // ebx@1
16269 { 15878 {
16270 if ( pTurnEngine->field_4 == 2 ) 15879 if ( pTurnEngine->field_4 == 2 )
16271 _406457(0); 15880 _406457(0);
16272 } 15881 }
16273 } 15882 }
16274
16275
16276 //----- (00404828) --------------------------------------------------------
16277 SpriteObject::SpriteObject()
16278 {
16279 field_22_glow_radius_multiplier = 1;
16280 uSoundID = 0;
16281 uFacing = 0;
16282 vVelocity.z = 0;
16283 vVelocity.y = 0;
16284 vVelocity.x = 0;
16285 uType = 0;
16286 uObjectDescID = 0;
16287 field_61 = 0;
16288 field_60_distance_related_prolly_lod = 0;
16289 field_20 = 0;
16290 uSpriteFrameID = 0;
16291 field_50 = 0;
16292 field_4C = 0;
16293 field_48 = 0;
16294 field_54 = 0;
16295 }
16296
16297
16298 15883
16299 //----- (004059DB) -------------------------------------------------------- 15884 //----- (004059DB) --------------------------------------------------------
16300 signed int stru262_TurnBased::Start() 15885 signed int stru262_TurnBased::Start()
16301 { 15886 {
16302 stru262_TurnBased *v1; // ebx@1 15887 stru262_TurnBased *v1; // ebx@1
16510 } 16095 }
16511 } 16096 }
16512 } 16097 }
16513 return v1->_404544(); 16098 return v1->_404544();
16514 } 16099 }
16515