comparison mm7_3.cpp @ 692:066e2b29b30f

viewport.cpp added
author Gloval
date Sat, 16 Mar 2013 21:57:32 +0400
parents c0bfb386b15f
children e0a1fccc89b1
comparison
equal deleted inserted replaced
691:c93f29773f84 692:066e2b29b30f
5862 last_camera_rot_x == pParty->sRotationX) 5862 last_camera_rot_x == pParty->sRotationX)
5863 { 5863 {
5864 draw: 5864 draw:
5865 struct RenderVertexD3D3 v[6]; 5865 struct RenderVertexD3D3 v[6];
5866 5866
5867 v[0].pos.x = pViewport->uScreenX; 5867 v[0].pos.x = pViewport->uScreen_TL_X;
5868 v[0].pos.y = pViewport->uScreenY; 5868 v[0].pos.y = pViewport->uScreen_TL_Y;
5869 v[0].pos.z = 0.99989998; 5869 v[0].pos.z = 0.99989998;
5870 v[0].rhw = 1; 5870 v[0].rhw = 1;
5871 v[0].diffuse = 0xFFFFFFFF; 5871 v[0].diffuse = 0xFFFFFFFF;
5872 v[0].specular = 0; 5872 v[0].specular = 0;
5873 v[0].texcoord.x = 0; 5873 v[0].texcoord.x = 0;
5874 v[0].texcoord.y = 0; 5874 v[0].texcoord.y = 0;
5875 5875
5876 v[1].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; 5876 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
5877 v[1].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; 5877 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
5878 v[1].pos.z = 0.99989998; 5878 v[1].pos.z = 0.99989998;
5879 v[1].rhw = 1; 5879 v[1].rhw = 1;
5880 v[1].diffuse = 0xFFFFFFFF; 5880 v[1].diffuse = 0xFFFFFFFF;
5881 v[1].specular = 0; 5881 v[1].specular = 0;
5882 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; 5882 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
5883 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; 5883 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
5884 5884
5885 v[2].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; 5885 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
5886 v[2].pos.y = pViewport->uScreenY; 5886 v[2].pos.y = pViewport->uScreen_TL_Y;
5887 v[2].pos.z = 0.99989998; 5887 v[2].pos.z = 0.99989998;
5888 v[2].rhw = 1; 5888 v[2].rhw = 1;
5889 v[2].diffuse = 0xFFFFFFFF; 5889 v[2].diffuse = 0xFFFFFFFF;
5890 v[2].specular = 0; 5890 v[2].specular = 0;
5891 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; 5891 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
5892 v[2].texcoord.y = 0; 5892 v[2].texcoord.y = 0;
5893 5893
5894 memcpy(&v[3], &v[0], sizeof(*v)); 5894 memcpy(&v[3], &v[0], sizeof(*v));
5895 5895
5896 v[4].pos.x = pViewport->uScreenX; 5896 v[4].pos.x = pViewport->uScreen_TL_X;
5897 v[4].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; 5897 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
5898 v[4].pos.z = 0.99989998; 5898 v[4].pos.z = 0.99989998;
5899 v[4].rhw = 1; 5899 v[4].rhw = 1;
5900 v[4].diffuse = 0xFFFFFFFF; 5900 v[4].diffuse = 0xFFFFFFFF;
5901 v[4].specular = 0; 5901 v[4].specular = 0;
5902 v[4].texcoord.x = 0; 5902 v[4].texcoord.x = 0;
12820 while ( v65 ); 12820 while ( v65 );
12821 } 12821 }
12822 } 12822 }
12823 } 12823 }
12824 12824
12825 //----- (00443219) -------------------------------------------------------- 12825
12826 void ViewingParams::_443219()
12827 {
12828 this->sPartyPosZ += 512;
12829 _4432E7();
12830 }
12831
12832 //----- (00443225) --------------------------------------------------------
12833 void ViewingParams::_443225()
12834 {
12835 this->sPartyPosX -= 512;
12836 _4432E7();
12837 }
12838
12839 //----- (00443231) --------------------------------------------------------
12840 void ViewingParams::_443231()
12841 {
12842 this->sPartyPosZ -= 512;
12843 _4432E7();
12844 }
12845
12846 //----- (0044323D) --------------------------------------------------------
12847 void ViewingParams::_44323D()
12848 {
12849 this->sPartyPosX += 512;
12850 _4432E7();
12851 }
12852
12853 //----- (00443249) --------------------------------------------------------
12854 void ViewingParams::_443249()
12855 {
12856 int v1; // edx@1
12857
12858 v1 = (unsigned __int64)((signed __int64)this->field_2C << 15) >> 16;
12859 this->field_2C = v1;
12860 if ( v1 < 384 )
12861 this->field_2C = 384;
12862 this->sPartyPosX = pParty->vPosition.x;
12863 this->sPartyPosZ = pParty->vPosition.y;
12864 _4432E7();
12865 }
12866
12867 //----- (00443291) --------------------------------------------------------
12868 void ViewingParams::_443291()
12869 {
12870 int v1; // edx@1
12871 int v2; // eax@1
12872
12873 v1 = 2 * this->field_2C;
12874 v2 = 1536;
12875 this->field_2C = v1;
12876 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
12877 v2 = 3072;
12878 if ( v1 > v2 )
12879 this->field_2C = v2;
12880 this->sPartyPosX = pParty->vPosition.x;
12881 this->sPartyPosZ = pParty->vPosition.y;
12882 _4432E7();
12883 }
12884
12885 //----- (004432E7) --------------------------------------------------------
12886 void ViewingParams::_4432E7()
12887 {
12888 ViewingParams *v1; // esi@1
12889 int v2; // ebx@1
12890 signed int v3; // edx@1
12891 int v4; // ecx@1
12892 int v5; // edi@3
12893 int v6; // eax@3
12894 int v7; // eax@5
12895 int result; // eax@7
12896
12897 v1 = this;
12898 v2 = this->field_3A;
12899 v3 = 88 >> this->field_2C / 384;
12900 v4 = (44 - v3) << 9;
12901 if ( v1->sPartyPosZ > v2 + v4 )
12902 v1->sPartyPosZ = v2 + v4;
12903
12904 v5 = v1->field_38;
12905 v6 = (v3 - 44) << 9;
12906 if ( v1->sPartyPosX < v5 + v6 )
12907 v1->sPartyPosX = v5 + v6;
12908
12909 v7 = v2 + v6;
12910 if ( v1->sPartyPosZ < v7 )
12911 v1->sPartyPosZ = v7;
12912
12913 result = v5 + v4;
12914 if ( v1->sPartyPosX > v5 + v4 )
12915 v1->sPartyPosX = result;
12916 }
12917
12918 //----- (00443343) --------------------------------------------------------
12919 void ViewingParams::InitGrayPalette()
12920 {
12921 for (unsigned short i=0; i<256; ++i)
12922 pPalette[i]=GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(i, i, i);
12923 }
12924
12925 //----- (00443365) --------------------------------------------------------
12926 int ViewingParams::_443365()
12927 {
12928 ViewingParams *v1; // esi@1
12929 __int16 *v2; // edi@3
12930 Vec3_short_ *v3; // eax@4
12931 unsigned int v4; // edx@4
12932 signed int v5; // eax@8
12933 Vec3_short_ *v6; // eax@12
12934 signed int v7; // edi@12
12935 signed int v8; // eax@16
12936 char v9; // zf@20
12937 int result; // eax@21
12938 unsigned int v11; // [sp+4h] [bp-1Ch]@3
12939 unsigned int *v12; // [sp+8h] [bp-18h]@3
12940 unsigned int v13; // [sp+Ch] [bp-14h]@8
12941 unsigned int v14; // [sp+10h] [bp-10h]@2
12942 unsigned int v15; // [sp+14h] [bp-Ch]@2
12943 unsigned int v16; // [sp+18h] [bp-8h]@2
12944 unsigned int v17; // [sp+1Ch] [bp-4h]@2
12945
12946 v1 = this;
12947 InitGrayPalette();
12948 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
12949 {
12950 v16 = 0x40000000u;
12951 v14 = 0x40000000u;
12952 v17 = 0xC0000000u;
12953 v15 = 0xC0000000u;
12954 if ( (signed int)pIndoor->pMapOutlines->uNumOutlines > 0 )
12955 {
12956 v2 = (__int16 *)(pIndoor->pMapOutlines->pOutlines);
12957 v11 = pIndoor->pMapOutlines->uNumOutlines;
12958 v12 = (uint *)pIndoor->pMapOutlines->pOutlines;
12959 do
12960 {
12961 v3 = &pIndoor->pVertices[*v2];
12962 v4 = v3->x;
12963 if ( (signed int)v4 < (signed int)v16 )
12964 v16 = v3->x;
12965 if ( (signed int)v4 > (signed int)v17 )
12966 v17 = v3->x;
12967 v5 = v3->y;
12968 v13 = v5;
12969 if ( v5 < (signed int)v14 )
12970 v14 = v4;
12971 if ( v5 > (signed int)v15 )
12972 v15 = v4;
12973 v6 = &pIndoor->pVertices[v2[1]];
12974 v7 = v6->x;
12975 if ( v7 < (signed int)v16 )
12976 v16 = v4;
12977 if ( v7 > (signed int)v17 )
12978 v17 = v4;
12979 v8 = v6->y;
12980 if ( v8 < (signed int)v14 )
12981 v14 = v13;
12982 if ( v8 > (signed int)v15 )
12983 v15 = v13;
12984 v2 = (__int16 *)(v12 + 3);
12985 v9 = v11-- == 1;
12986 v12 += 3;
12987 }
12988 while ( !v9 );
12989 }
12990 v1->uMinimapZoom = 1024;
12991 v1->field_38 = (signed int)(v16 + v17) / 2;
12992 v1->field_28 = 10;
12993 result = (signed int)(v14 + v15) / 2;
12994 v1->field_3A = result;
12995 }
12996 else
12997 {
12998 v1->field_38 = 0;
12999 v1->field_3A = 0;
13000 v1->uMinimapZoom = dword_576E2C;
13001 result = dword_576E28;
13002 v1->field_28 = dword_576E28;
13003 }
13004 v1->field_2C = 384;
13005 return result;
13006 }
13007 12826
13008 12827
13009 //----- (00443801) -------------------------------------------------------- 12828 //----- (00443801) --------------------------------------------------------
13010 void Initialize2DA() 12829 void Initialize2DA()
13011 { 12830 {