Mercurial > mm7
comparison mm7_3.cpp @ 1410:38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
stru167 -> TrailParticle
stru167warp -> TrailParticleGenerator
author | Nomad |
---|---|
date | Fri, 26 Jul 2013 22:19:29 +0200 |
parents | 3161094869e0 |
children | 2423bc2af692 |
comparison
equal
deleted
inserted
replaced
1409:c9e3b93ec570 | 1410:38df78aba732 |
---|---|
40 #include "DecorationList.h" | 40 #include "DecorationList.h" |
41 #include "stru123.h" | 41 #include "stru123.h" |
42 #include "Time.h" | 42 #include "Time.h" |
43 #include "IconFrameTable.h" | 43 #include "IconFrameTable.h" |
44 #include "TurnEngine.h" | 44 #include "TurnEngine.h" |
45 #include "stru220.h" | |
46 #include "Events2D.h" | 45 #include "Events2D.h" |
47 #include "stru176.h" | 46 #include "stru176.h" |
48 #include "stru298.h" | 47 #include "stru298.h" |
49 #include "texts.h" | 48 #include "texts.h" |
50 #include "Log.h" | 49 #include "Log.h" |
5609 unsigned int v3; // eax@3 | 5608 unsigned int v3; // eax@3 |
5610 MapInfo *v4; // edi@4 | 5609 MapInfo *v4; // edi@4 |
5611 //int v5; // eax@8 | 5610 //int v5; // eax@8 |
5612 //SpawnPointMM7 *v6; // edx@14 | 5611 //SpawnPointMM7 *v6; // edx@14 |
5613 size_t v7; // eax@19 | 5612 size_t v7; // eax@19 |
5614 char *v8; // eax@19 | 5613 //char *v8; // eax@19 |
5615 char *v9; // eax@21 | 5614 //char *v9; // eax@21 |
5616 char Source[120]; // [sp+Ch] [bp-84h]@19 | 5615 char Source[120]; // [sp+Ch] [bp-84h]@19 |
5617 const char *pFilename; // [sp+84h] [bp-Ch]@1 | 5616 const char *pFilename; // [sp+84h] [bp-Ch]@1 |
5618 //unsigned int v12; // [sp+88h] [bp-8h]@12 | 5617 //unsigned int v12; // [sp+88h] [bp-8h]@12 |
5619 //int v13; // [sp+8Ch] [bp-4h]@11 | 5618 //int v13; // [sp+8Ch] [bp-4h]@11 |
5620 | 5619 |
5621 pFilename = pLevelFilename; | 5620 pFilename = pLevelFilename; |
5622 thisa->AllocSoftwareDrawBuffers(); | 5621 thisa->AllocSoftwareDrawBuffers(); |
5623 pOutdoorCamera->_485F64(); | 5622 pOutdoorCamera->_485F64(); |
5624 pWeather->bRenderSnow = 0; | 5623 pWeather->bRenderSnow = false; |
5625 pRenderer->ClearZBuffer(0, 479); | 5624 pRenderer->ClearZBuffer(0, 479); |
5626 thisa = (OutdoorCamera *)1; | 5625 thisa = (OutdoorCamera *)1; |
5627 GetAlertStatus(); | 5626 GetAlertStatus(); |
5628 if ( qword_A750D8 ) | 5627 if ( qword_A750D8 ) |
5629 qword_A750D8 = 0i64; | 5628 qword_A750D8 = 0i64; |
5689 pIndoorCamera->sRotationX = pParty->sRotationX; | 5688 pIndoorCamera->sRotationX = pParty->sRotationX; |
5690 pOutdoorCamera->RotationToInts(); | 5689 pOutdoorCamera->RotationToInts(); |
5691 pOutdoor->UpdateSunlightVectors(); | 5690 pOutdoor->UpdateSunlightVectors(); |
5692 pOutdoorCamera->int_fov_rad = (signed __int64)pIndoorCamera->flt_1C_fov; | 5691 pOutdoorCamera->int_fov_rad = (signed __int64)pIndoorCamera->flt_1C_fov; |
5693 pOutdoorCamera->int_fov_rad_inv = (signed __int64)pIndoorCamera->flt_20_inv_1C; | 5692 pOutdoorCamera->int_fov_rad_inv = (signed __int64)pIndoorCamera->flt_20_inv_1C; |
5694 v8 = (char *)&array_77EC08[0].ptr_38; | 5693 |
5695 do | 5694 for (int i = 0; i < 20000; ++i) |
5696 { | 5695 { |
5697 *(int *)v8 = (int)&stru_8019C8; | 5696 array_77EC08[i].ptr_38 = &stru_8019C8; |
5698 v8 += 268; | 5697 |
5699 } | 5698 array_77EC08[i].prolly_head = nullptr; |
5700 while ( (signed int)v8 < (signed int)&unk_801A00 ); | 5699 array_77EC08[i].prolly_tail = nullptr; |
5701 v9 = (char *)&array_77EC08[0].prolly_tail; | 5700 array_77EC08[i].ptr_48 = nullptr; |
5702 do | 5701 } |
5703 { | 5702 |
5704 *((int *)v9 - 1) = 0; | |
5705 *(int *)v9 = 0; | |
5706 *((int *)v9 - 5) = 0; | |
5707 v9 += 268; | |
5708 } | |
5709 while ( (signed int)v9 < (signed int)&unk_801A0C ); | |
5710 MM7Initialization(); | 5703 MM7Initialization(); |
5711 } | 5704 } |
5712 | 5705 |
5713 //----- (0047A825) -------------------------------------------------------- | 5706 //----- (0047A825) -------------------------------------------------------- |
5714 bool LevelDecoration::_47A825() | 5707 bool LevelDecoration::_47A825() |
5746 } | 5739 } |
5747 LOBYTE(v2->field_2) |= 0x20u; | 5740 LOBYTE(v2->field_2) |= 0x20u; |
5748 return v1; | 5741 return v1; |
5749 } | 5742 } |
5750 | 5743 |
5751 //----- (0047BC6F) -------------------------------------------------------- | |
5752 unsigned __int16 *__fastcall GetBillboardPalette(RenderBillboard *a1, int a2, signed int a3, int a4) | |
5753 { | |
5754 int v4; // ebx@1 | |
5755 int v6; // edx@4 | |
5756 int v7; // ecx@5 | |
5757 signed int v8; // eax@6 | |
5758 signed __int64 v9; // qtt@11 | |
5759 signed int v10; // eax@12 | |
5760 int v11; // esi@17 | |
5761 signed __int64 v12; // qtt@19 | |
5762 double v13; // ST10_8@19 | |
5763 int v14; // edi@25 | |
5764 signed int v15; // edx@26 | |
5765 signed __int64 v16; // qtt@29 | |
5766 signed int v17; // eax@30 | |
5767 int v18; // [sp+10h] [bp-8h]@1 | |
5768 float a3a; // [sp+20h] [bp+8h]@19 | |
5769 | |
5770 v4 = a2; | |
5771 v18 = a2; | |
5772 if ( pParty->armageddon_timer ) | |
5773 return PaletteManager::Get(a2); | |
5774 if ( !pWeather->bNight ) | |
5775 { | |
5776 if (day_attrib & DAY_ATTRIB_FOG) | |
5777 { | |
5778 v14 = day_fogrange_1 << 16; | |
5779 if ( a3 >= day_fogrange_1 << 16 ) | |
5780 { | |
5781 if ( a3 <= day_fogrange_2 << 16 ) | |
5782 { | |
5783 LODWORD(v16) = (a3 - v14) << 16; | |
5784 HIDWORD(v16) = (a3 - v14) >> 16; | |
5785 v15 = (unsigned __int64)(27 * v16 / ((day_fogrange_2 - day_fogrange_1) << 16)) >> 16; | |
5786 } | |
5787 else | |
5788 { | |
5789 v15 = 27; | |
5790 } | |
5791 } | |
5792 else | |
5793 { | |
5794 v15 = 0; | |
5795 } | |
5796 v17 = _43F55F_get_billboard_light_level(a1, v15); | |
5797 if ( v17 > 27 ) | |
5798 v17 = 27; | |
5799 if ( !a3 ) | |
5800 v17 = 27; | |
5801 v7 = v18; | |
5802 v6 = v17; | |
5803 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1); | |
5804 } | |
5805 v11 = a4; | |
5806 if ( a4 < 0 ) | |
5807 v11 = 0; | |
5808 LODWORD(v12) = a3 << 16; | |
5809 HIDWORD(v12) = a3 >> 16; | |
5810 a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pOutdoorCamera->shading_dist_shade << 16)) >> 16) + 20) | |
5811 * pOutdoor->fFogDensity; | |
5812 v13 = a3a + 6.7553994e15; | |
5813 v10 = _43F55F_get_billboard_light_level(a1, LODWORD(v13) + v11); | |
5814 if ( v10 > 27 ) | |
5815 v10 = 27; | |
5816 if ( v10 < a4 ) | |
5817 v10 = a4; | |
5818 if ( v10 > pOutdoor->max_terrain_dimming_level ) | |
5819 v10 = pOutdoor->max_terrain_dimming_level; | |
5820 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1); | |
5821 } | |
5822 v6 = 0; | |
5823 if (pWeather->bNight) | |
5824 { | |
5825 v8 = 67108864; | |
5826 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) | |
5827 v8 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower << 26; | |
5828 if ( a3 <= v8 ) | |
5829 { | |
5830 if ( a3 > 0 ) | |
5831 { | |
5832 LODWORD(v9) = a3 << 16; | |
5833 HIDWORD(v9) = a3 >> 16; | |
5834 v6 = (unsigned __int64)(27 * v9 / v8) >> 16; | |
5835 } | |
5836 } | |
5837 else | |
5838 { | |
5839 v6 = 27; | |
5840 } | |
5841 v10 = _43F55F_get_billboard_light_level(a1, v6); | |
5842 if ( v10 > 27 || !a3 ) | |
5843 v10 = 27; | |
5844 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1); | |
5845 } | |
5846 v7 = 0; | |
5847 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1); | |
5848 } | |
5849 | 5744 |
5850 //----- (0047C370) -------------------------------------------------------- | 5745 //----- (0047C370) -------------------------------------------------------- |
5851 unsigned int __cdecl GetLevelFogColor() | 5746 unsigned int GetLevelFogColor() |
5852 { | 5747 { |
5853 unsigned int result; // eax@2 | |
5854 signed __int64 v1; // qax@5 | 5748 signed __int64 v1; // qax@5 |
5855 int v2; // eax@6 | 5749 int v2; // eax@6 |
5856 | 5750 |
5857 if ( bUnderwater ) | 5751 if (bUnderwater) |
5858 { | 5752 return 0xFF258F5C; |
5859 result = 0xFF258F5C; | 5753 |
5860 } | 5754 if (day_attrib & DAY_ATTRIB_FOG) |
5861 else | 5755 { |
5862 { | |
5863 if (day_attrib & DAY_ATTRIB_FOG) | |
5864 { | |
5865 if ( pWeather->bNight ) // night-time fog | 5756 if ( pWeather->bNight ) // night-time fog |
5866 { | 5757 { |
5867 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad | 5758 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad |
5868 v2 = -(pWeather->bNight != 1); | 5759 v2 = -(pWeather->bNight != 1); |
5869 result = (v2 & 0xE0E0E1) - 0xE0E0E1; | 5760 return (v2 & 0xE0E0E1) - 0xE0E0E1; |
5870 } | 5761 } |
5871 else | 5762 else |
5872 { | 5763 { |
5873 v1 = (signed __int64)((1.0 - pOutdoor->fFogDensity) * 200.0 + pOutdoor->fFogDensity * 31.0); | 5764 v1 = (signed __int64)((1.0 - pOutdoor->fFogDensity) * 200.0 + pOutdoor->fFogDensity * 31.0); |
5874 result = v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8); | 5765 return v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8); |
5875 } | 5766 } |
5876 } | 5767 } |
5877 else | 5768 |
5878 return 0; | 5769 return 0; |
5879 } | 5770 } |
5880 return result; | |
5881 } | |
5882 // 6BE030: using guessed type int day_attrib; | |
5883 // 6BE3C4: using guessed type char bUnderwater; | |
5884 | 5771 |
5885 //----- (0047C3D7) -------------------------------------------------------- | 5772 //----- (0047C3D7) -------------------------------------------------------- |
5886 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3) | 5773 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3) |
5887 { | 5774 { |
5888 int v3; // ecx@1 | 5775 int v3; // ecx@1 |
6110 int __stdcall GridCellToWorldPosZ(int a1) | 5997 int __stdcall GridCellToWorldPosZ(int a1) |
6111 { | 5998 { |
6112 return (64 - a1) << 9; | 5999 return (64 - a1) << 9; |
6113 } | 6000 } |
6114 | 6001 |
6115 //----- (0047F4D3) -------------------------------------------------------- | |
6116 void __fastcall sub_47F4D3(int band1, int band2, int band3) | |
6117 { | |
6118 int v3; // edi@1 | |
6119 //stru220 *v4; // esi@1 | |
6120 double v5; // ST2C_8@3 | |
6121 double v6; // st7@3 | |
6122 //double v7; // [sp+18h] [bp-28h]@3 | |
6123 //double v8; // [sp+20h] [bp-20h]@2 | |
6124 int v9; // [sp+34h] [bp-Ch]@1 | |
6125 int v10; // [sp+38h] [bp-8h]@1 | |
6126 //signed int band3a; // [sp+48h] [bp+8h]@2 | |
6127 | |
6128 v9 = band2 * 512; | |
6129 pOutdoorCamera->outdoor_grid_band_3 = band3; | |
6130 v10 = band1 * 512; | |
6131 v3 = band3 * 512; | |
6132 pOutdoorCamera->uPickDepth = band3 * 512; | |
6133 //v4 = stru_76E5C8; // v4: 0 -> 65536 | |
6134 for (uint i = 0; i < 16384; ++i) | |
6135 //do | |
6136 { | |
6137 auto v4 = stru_76E5C8[i]; | |
6138 //band3a = 256; | |
6139 //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8); | |
6140 for (uint j = 0; j < 128; ++j) // band3a: 0 -> 128 | |
6141 { | |
6142 v5 = pow(j * 512 + 256, 2.0); | |
6143 v6 = pow(i * 4 + 256, 2.0); | |
6144 //*((float *)&v5 + 1) = sqrt(v6 + v5); | |
6145 int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15; | |
6146 if (v7 >= v10) | |
6147 { | |
6148 if (v7 >= v9) | |
6149 v4.field_0 = ((v7 >= v3) - 1) & 2; | |
6150 else | |
6151 v4.field_0 = 2; | |
6152 } | |
6153 else | |
6154 { | |
6155 v4.field_0 = 1; | |
6156 } | |
6157 //band3a += 512; | |
6158 v4.distance = v7; | |
6159 //++v4; | |
6160 } | |
6161 //while ( band3a < 65792 ); | |
6162 } | |
6163 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); | |
6164 } | |
6165 | 6002 |
6166 //----- (004811A3) -------------------------------------------------------- | 6003 //----- (004811A3) -------------------------------------------------------- |
6167 void Polygon::DrawBorderTiles() | 6004 void Polygon::DrawBorderTiles() |
6168 { | 6005 { |
6169 //__debugbreak(); | 6006 //__debugbreak(); |
6176 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); | 6013 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); |
6177 } | 6014 } |
6178 | 6015 |
6179 | 6016 |
6180 //----- (00481EB7) -------------------------------------------------------- | 6017 //----- (00481EB7) -------------------------------------------------------- |
6181 void __cdecl ResetPolygons() | 6018 void ResetPolygons() |
6182 { | 6019 { |
6183 int v0; // ecx@1 | 6020 for (auto i = 0; i < pOutdoorCamera->uNumPolygons; ++i) |
6184 char *v1; // eax@2 | 6021 { |
6185 | 6022 array_77EC08[i].prolly_head = nullptr; |
6186 v0 = pOutdoorCamera->uNumPolygons; | 6023 array_77EC08[i].prolly_tail = nullptr; |
6187 if ( pOutdoorCamera->uNumPolygons > 0 ) | 6024 |
6188 { | 6025 array_77EC08[i].flags = 0; |
6189 v1 = (char *)&array_77EC08[0].prolly_tail; | 6026 array_77EC08[i].field_32 = 0; |
6190 do | |
6191 { | |
6192 *((int *)v1 - 1) = 0; | |
6193 *(int *)v1 = 0; | |
6194 *((int *)v1 - 5) = 0; | |
6195 v1 += 268; | |
6196 --v0; | |
6197 } | |
6198 while ( v0 ); | |
6199 } | 6027 } |
6200 } | 6028 } |
6201 | 6029 |
6202 //----- (00481ED9) -------------------------------------------------------- | 6030 //----- (00481ED9) -------------------------------------------------------- |
6203 void __cdecl sub_481ED9_MessWithOutdoorCamera() | 6031 void __cdecl sub_481ED9_MessWithOutdoorCamera() |
6207 pOutdoorCamera->uNumEdges = 0; | 6035 pOutdoorCamera->uNumEdges = 0; |
6208 pOutdoorCamera->uNumSpans = 0; | 6036 pOutdoorCamera->uNumSpans = 0; |
6209 pOutdoorCamera->uNumSurfs = 0; | 6037 pOutdoorCamera->uNumSurfs = 0; |
6210 pOutdoorCamera->uNumBillboards = 0; | 6038 pOutdoorCamera->uNumBillboards = 0; |
6211 pOutdoorCamera->field_44 = 0; | 6039 pOutdoorCamera->field_44 = 0; |
6212 } | |
6213 | |
6214 //----- (00481EFA) -------------------------------------------------------- | |
6215 bool __fastcall sub_481EFA(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, RenderVertexSoft *a4, int a5) | |
6216 { | |
6217 RenderVertexSoft *v5; // esi@1 | |
6218 RenderVertexSoft *v6; // edx@1 | |
6219 bool v7; // edi@2 | |
6220 bool v8; // ecx@5 | |
6221 bool v9; // esi@8 | |
6222 bool v10; // eax@11 | |
6223 double v11; // st7@14 | |
6224 signed int v12; // esi@15 | |
6225 signed int v13; // edx@18 | |
6226 signed int v14; // ecx@21 | |
6227 signed int v15; // eax@24 | |
6228 RenderVertexSoft *v17; // [sp+Ch] [bp-8h]@1 | |
6229 | |
6230 v5 = a2; | |
6231 v6 = a1; | |
6232 v17 = v5; | |
6233 v7 = a1->vWorldViewPosition.x < 8.0; | |
6234 v8 = v5->vWorldViewPosition.x < 8.0; | |
6235 v9 = a3->vWorldViewPosition.x < 8.0; | |
6236 v10 = a4->vWorldViewPosition.x < 8.0; | |
6237 return !(v8 & v9 & v10 & v7) | |
6238 && ((v11 = (double)pOutdoorCamera->shading_dist_mist, v11 > v6->vWorldViewPosition.x) ? (v12 = 0) : (v12 = 1), | |
6239 v11 > v17->vWorldViewPosition.x ? (v13 = 0) : (v13 = 1), | |
6240 v11 > a3->vWorldViewPosition.x ? (v14 = 0) : (v14 = 1), | |
6241 v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1), | |
6242 !(v13 & v14 & v15 & v12)); | |
6243 } | |
6244 | |
6245 //----- (00481FC9) -------------------------------------------------------- | |
6246 int __fastcall sub_481FC9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, struct Polygon *a4)//Rotate camera | |
6247 { | |
6248 float arg_0, arg_4, var_4, var_8, var_c, var_10, var_14; | |
6249 | |
6250 if (a1->vWorldPosition.y == a2->vWorldPosition.y && a2->vWorldPosition.y == a3->vWorldPosition.y) | |
6251 a4->flags |= 0x10; | |
6252 var_c = a1->vWorldViewPosition.x - a2->vWorldViewPosition.x; | |
6253 var_14 = a1->vWorldViewPosition.y - a2->vWorldViewPosition.y; | |
6254 arg_0 = a1->vWorldViewPosition.z - a2->vWorldViewPosition.z; | |
6255 var_10 = a3->vWorldViewPosition.x - a2->vWorldViewPosition.x; | |
6256 var_8 = a3->vWorldViewPosition.y - a2->vWorldViewPosition.y; | |
6257 var_4 = a3->vWorldViewPosition.z - a2->vWorldViewPosition.z; | |
6258 arg_4 = a3->vWorldPosition.y - a2->vWorldPosition.y; | |
6259 if (((a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.x - a2->vWorldPosition.x) - (a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.y - a2->vWorldPosition.y)) * (pIndoorCamera->pos.y - a2->vWorldPosition.z) + | |
6260 ((a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.y - a2->vWorldPosition.y) - (a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.z - a2->vWorldPosition.z)) * (pIndoorCamera->pos.x - a2->vWorldPosition.x) + | |
6261 ((a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.z - a2->vWorldPosition.z) - (a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.x - a2->vWorldPosition.x)) * (pIndoorCamera->pos.z - a2->vWorldPosition.y) < 0) | |
6262 { | |
6263 arg_4 = var_4 * var_14 - var_8 * arg_0; | |
6264 a4->v_18.x = floorf(arg_4 + 0.5f); | |
6265 arg_4 = var_10 * arg_0 - var_4 * var_c; | |
6266 a4->v_18.y = floorf(arg_4 + 0.5f); | |
6267 arg_4 = var_8 * var_c - var_10 * var_14; | |
6268 a4->v_18.z = floorf(arg_4 + 0.5f); | |
6269 a4->_486089_normalize_v_18(); | |
6270 arg_4 = -(a4->v_18.x * a2->vWorldViewPosition.x) - a4->v_18.y * a2->vWorldViewPosition.y - a4->v_18.z * a2->vWorldViewPosition.z; | |
6271 a4->field_24 = floorf(arg_4 + 0.5f); | |
6272 return true; | |
6273 } | |
6274 else | |
6275 return false; | |
6276 } | 6040 } |
6277 | 6041 |
6278 //----- (004823F4) -------------------------------------------------------- | 6042 //----- (004823F4) -------------------------------------------------------- |
6279 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) | 6043 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) |
6280 { | 6044 { |
6467 this->pTexture = 0; | 6231 this->pTexture = 0; |
6468 this->ptr_38 = a2; | 6232 this->ptr_38 = a2; |
6469 } | 6233 } |
6470 | 6234 |
6471 //----- (00486089) -------------------------------------------------------- | 6235 //----- (00486089) -------------------------------------------------------- |
6472 void Polygon::_486089_normalize_v_18() | 6236 void Polygon::_normalize_v_18() |
6473 { | 6237 { |
6474 //Polygon *v1; // esi@1 | |
6475 double v2; // st7@1 | 6238 double v2; // st7@1 |
6476 double v3; // st6@1 | 6239 double v3; // st6@1 |
6477 float v4; // ST18_4@2 | |
6478 double v5; // st5@1 | 6240 double v5; // st5@1 |
6479 float v6; // ST14_4@2 | |
6480 double v7; // st7@1 | |
6481 float v8; // ST24_4@2 | |
6482 float v9; // ST20_4@2 | |
6483 double v10; // ST0C_8@2 | |
6484 float v11; // ST18_4@2 | |
6485 double v12; // ST0C_8@2 | |
6486 float v13; // ST14_4@2 | |
6487 double v14; // ST0C_8@2 | |
6488 float v15; // [sp+20h] [bp-8h]@1 | |
6489 | 6241 |
6490 //v1 = this; | 6242 //v1 = this; |
6491 v2 = (double)this->v_18.x; | 6243 v2 = (double)this->v_18.x; |
6492 v15 = v2; | |
6493 v3 = (double)this->v_18.y; | 6244 v3 = (double)this->v_18.y; |
6494 v5 = (double)this->v_18.z; | 6245 v5 = (double)this->v_18.z; |
6495 v7 = sqrt(v5 * v5 + v3 * v3 + v2 * v2); | 6246 float len = sqrt(v5 * v5 + v3 * v3 + v2 * v2); |
6496 if ( v7 == 0.0 ) | 6247 if (fabsf(len) < 1e-6f) |
6497 { | 6248 { |
6498 this->v_18.x = 0; | 6249 v_18.x = 0; |
6499 this->v_18.y = 0; | 6250 v_18.y = 0; |
6500 this->v_18.z = 65536; | 6251 v_18.z = 65536; |
6501 } | 6252 } |
6502 else | 6253 else |
6503 { | 6254 { |
6504 v8 = 1.0 / v7; | 6255 v_18.x = round(v2 / len * 65536.0); |
6505 v9 = v8 * v15 * 65536.0; | 6256 v_18.y = round(v3 / len * 65536.0); |
6506 v10 = v9 + 6.7553994e15; | 6257 v_18.y = round(v5 / len * 65536.0); |
6507 this->v_18.x = LODWORD(v10); | |
6508 v4 = v3; | |
6509 v11 = v8 * v4 * 65536.0; | |
6510 v12 = v11 + 6.7553994e15; | |
6511 this->v_18.y = LODWORD(v12); | |
6512 v6 = v5; | |
6513 v13 = v8 * v6 * 65536.0; | |
6514 v14 = v13 + 6.7553994e15; | |
6515 this->v_18.z = LODWORD(v14); | |
6516 } | 6258 } |
6517 } | 6259 } |
6518 | 6260 |
6519 //----- (0048616B) -------------------------------------------------------- | 6261 //----- (0048616B) -------------------------------------------------------- |
6520 int stru149::_48616B(int a2, int a3, int a4, int a5, int a6, int a7) | 6262 int stru149::_48616B(int a2, int a3, int a4, int a5, int a6, int a7) |
6647 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); | 6389 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); |
6648 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16; | 6390 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16; |
6649 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; | 6391 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; |
6650 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); | 6392 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); |
6651 return result; | 6393 return result; |
6652 } | |
6653 | |
6654 | |
6655 //----- (00440DF5) -------------------------------------------------------- | |
6656 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr) | |
6657 { | |
6658 int result; // eax@1 | |
6659 | |
6660 pElements[uNumElements].field_6_rnd_value = a2; | |
6661 pElements[uNumElements].field_8_rnd_value = a3; | |
6662 pElements[uNumElements].field_A_rnd_value = a4; | |
6663 pElements[uNumElements].field_C_time_left = rand() % 64 + 256; | |
6664 pElements[uNumElements].field_E_time_to_live = pElements[uNumElements].field_C_time_left; | |
6665 result = 3 * uNumElements; | |
6666 pElements[uNumElements++].bgr16 = bgr; | |
6667 if (uNumElements >= 100 ) | |
6668 uNumElements = 0; | |
6669 return result; | |
6670 } | |
6671 | |
6672 //----- (00440E91) -------------------------------------------------------- | |
6673 void stru167_wrap::_440E91(__int16 x, int y, int z, int a5, __int16 bgr) | |
6674 { | |
6675 stru167_wrap *v6; // edi@1 | |
6676 int i; // esi@1 | |
6677 int v8; // ST08_4@2 | |
6678 int v9; // ST04_4@2 | |
6679 int v10; // eax@2 | |
6680 | |
6681 v6 = this; | |
6682 for ( i = 0; i < rand() % 6 + 5; ++i ) | |
6683 { | |
6684 v8 = z + rand() % 33; | |
6685 v9 = rand() % 33 + y - 16; | |
6686 v10 = rand(); | |
6687 Push(v10 % 33 + x - 16, v9, v8, a5, bgr); | |
6688 } | |
6689 } | |
6690 | |
6691 //----- (00440F07) -------------------------------------------------------- | |
6692 void stru167_wrap::_440F07() | |
6693 { | |
6694 for (uint i = 0; i < 100; ++i) | |
6695 { | |
6696 if (pElements[i].field_C_time_left > 0) | |
6697 { | |
6698 pElements[i].field_A_rnd_value += rand() % 5 + 4; | |
6699 pElements[i].field_6_rnd_value += rand() % 5 - 2; | |
6700 pElements[i].field_8_rnd_value += rand() % 5 - 2; | |
6701 pElements[i].field_C_time_left -= (short)pEventTimer->uTimeElapsed; | |
6702 } | |
6703 } | |
6704 } | 6394 } |
6705 | 6395 |
6706 //----- (0044100D) -------------------------------------------------------- | 6396 //----- (0044100D) -------------------------------------------------------- |
6707 bool sub_44100D() | 6397 bool sub_44100D() |
6708 { | 6398 { |