changeset 2277:b9adf4f414f6

submenu Other
author Ritor1
date Fri, 14 Mar 2014 13:58:51 +0600
parents e2433db49428
children 0cd17b0d36c2
files Game.cpp IndoorCameraD3D.cpp OSWindow.cpp Outdoor.cpp UI/UiGame.cpp Vis.cpp Weather.cpp mm7_2.cpp mm7_data.h stru10.cpp
diffstat 10 files changed, 152 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/Game.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -214,7 +214,6 @@
 
   ++frames_this_second;
 
-  extern bool debug_information;
   if ( debug_information )
   {
     if (render_framerate)
--- a/IndoorCameraD3D.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/IndoorCameraD3D.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -516,107 +516,77 @@
 //----- (00437AB5) --------------------------------------------------------
 void IndoorCameraD3D::do_draw_debug_line_sw(RenderVertexSoft *pLineBegin, signed int sStartDiffuse, RenderVertexSoft *pLineEnd, signed int sEndDiffuse, unsigned int uOutNumVertices, float z_stuff)
 {
-  char *v7; // eax@2
-  signed int v8; // edx@2
-  float v9; // ecx@5
-  float v10; // eax@5
-  char *v11; // eax@6
-  signed int v12; // edx@6
-  float v13; // edx@8
-  float v14; // eax@8
-  float v15; // eax@8
-  double v16; // st7@11
-  HRESULT v17; // eax@11
-  std::string v18; // [sp-18h] [bp-7E4h]@12
-  IDirect3DDevice3 *v19; // [sp-Ch] [bp-7D8h]@8
-  const char *v20; // [sp-8h] [bp-7D4h]@8
-  int v21; // [sp-4h] [bp-7D0h]@8
   RenderVertexSoft a1[20]; // [sp+8h] [bp-7C4h]@6
   RenderVertexSoft pVertices[20]; // [sp+3C8h] [bp-404h]@2
   RenderVertexD3D3 v24[2]; // [sp+788h] [bp-44h]@11
-  IndoorCameraD3D *v25; // [sp+7C8h] [bp-4h]@1
 
-  v25 = this;
   //if ( pRenderer->pRenderD3D )
-  {
-    v7 = (char *)&pVertices[0].flt_2C;
-    v8 = 20;
-    do
-    {
-      *(float *)v7 = 0.0;
-      v7 += 48;
-      --v8;
-    }
-    while ( v8 );
+  //{
+    for ( uint i = 0; i < 20; i++ )
+      pVertices[i].flt_2C = 0.0;
     if ( (char)uOutNumVertices )
     {
-      v9 = pLineBegin->vWorldViewProjX;
+      pVertices[0].vWorldViewProjX = pLineBegin->vWorldViewProjX;
       pVertices[0].vWorldViewProjY = pLineBegin->vWorldViewProjY;
-      pVertices[0].vWorldViewProjX = v9;
-      v10 = pLineEnd->vWorldViewProjY;
+
       pVertices[1].vWorldViewProjX = pLineEnd->vWorldViewProjX;
-      pVertices[1].vWorldViewProjY = v10;
-LABEL_11:
-      v16 = 0.001 - z_stuff;
+      pVertices[1].vWorldViewProjY = pLineEnd->vWorldViewProjY;
       v24[0].specular = 0;
       v24[0].pos.x = pVertices[0].vWorldViewProjX;
       v24[0].pos.y = pVertices[0].vWorldViewProjY;
-      v24[0].pos.z = v16;
+      v24[0].pos.z = 0.001 - z_stuff;
       v24[0].diffuse = sStartDiffuse;
       v24[0].rhw = 0.001;
+      v24[0].texcoord.x = 0.0;
+      v24[0].texcoord.y = 0.0;
+
       v24[1].pos.x = pVertices[1].vWorldViewProjX;
-      v24[0].texcoord.x = 0.0;
       v24[1].pos.y = pVertices[1].vWorldViewProjY;
-      v24[0].texcoord.y = 0.0;
       v24[1].diffuse = sEndDiffuse;
-      v24[1].pos.z = v16;
+      v24[1].pos.z = 0.001 - z_stuff;
       v24[1].specular = 0;
-      v21 = 0;
       v24[1].rhw = 0.001;
-      v20 = 0;
       v24[1].texcoord.x = 0.0;
       v24[1].texcoord.y = 0.0;
       //v19 = pRenderer->pRenderD3D->pDevice;
       pRenderer->DrawLines(v24, 2);
       return;
     }
-    v11 = (char *)&a1[0].flt_2C;
-    v12 = 20;
-    do
-    {
-      *(float *)v11 = 0.0;
-      v11 += 48;
-      --v12;
-    }
-    while ( v12 );
-    v21 = 0;
-    v20 = (const char *)1;
-    v19 = (IDirect3DDevice3 *)4;
-    v13 = pLineBegin->vWorldPosition.x;
+    for ( uint i = 0; i < 20; i++ )
+      a1[i].flt_2C = 0.0;
     uOutNumVertices = 2;
-    a1[0].vWorldPosition.x = v13;
-    v14 = pLineBegin->vWorldPosition.z;
+    a1[0].vWorldPosition.x = pLineBegin->vWorldPosition.x;
     a1[0].vWorldPosition.y = pLineBegin->vWorldPosition.y;
-    a1[0].vWorldPosition.z = v14;
+    a1[0].vWorldPosition.z = pLineBegin->vWorldPosition.z;
     a1[1].vWorldPosition.x = pLineEnd->vWorldPosition.x;
-    v15 = pLineEnd->vWorldPosition.z;
     a1[1].vWorldPosition.y = pLineEnd->vWorldPosition.y;
-    a1[1].vWorldPosition.z = v15;
-    if ( CalcPortalShape(
-           a1,
-           &uOutNumVertices,
-           pVertices,
-           this->std__vector_000034_prolly_frustrum,
-           4,
-           1,
-           0) != 1
-      || (signed int)uOutNumVertices >= 2 )
+    a1[1].vWorldPosition.z = pLineEnd->vWorldPosition.z;
+    if ( CalcPortalShape(a1, &uOutNumVertices, pVertices, this->std__vector_000034_prolly_frustrum, 4, 1, 0) != 1 || (signed int)uOutNumVertices >= 2 )
     {
-      ViewTransform(pVertices, 2u);
-      Project(pVertices, 2u, 0);
-      goto LABEL_11;
+      ViewTransform(pVertices, 2);
+      Project(pVertices, 2, 0);
+      v24[0].specular = 0;
+      v24[0].pos.x = pVertices[0].vWorldViewProjX;
+      v24[0].pos.y = pVertices[0].vWorldViewProjY;
+      v24[0].pos.z = 0.001 - z_stuff;
+      v24[0].diffuse = sStartDiffuse;
+      v24[0].rhw = 0.001;
+      v24[0].texcoord.x = 0.0;
+      v24[0].texcoord.y = 0.0;
+
+      v24[1].pos.x = pVertices[1].vWorldViewProjX;
+      v24[1].pos.y = pVertices[1].vWorldViewProjY;
+      v24[1].diffuse = sEndDiffuse;
+      v24[1].pos.z = 0.001 - z_stuff;
+      v24[1].specular = 0;
+      v24[1].rhw = 0.001;
+      v24[1].texcoord.x = 0.0;
+      v24[1].texcoord.y = 0.0;
+      //v19 = pRenderer->pRenderD3D->pDevice;
+      pRenderer->DrawLines(v24, 2);
+      return;
     }
-  }
+  //}
 }
 
 //----- (00437A55) --------------------------------------------------------
@@ -626,23 +596,18 @@
   const RenderVertexD3D3 *v6; // ecx@2
   unsigned int v7; // ebx@2
   const RenderVertexD3D3 *v8; // edi@3
-  IndoorCameraD3D *thisa; // [sp+10h] [bp-4h]@1
 
   v5 = 0;
-  thisa = this;
   if ( (signed int)(uNumLines - 1) > 0 )
   {
     v6 = pLineVertices;
-    v7 = uNumLines - 1;
     v5 = uNumLines - 1;
-    do
+    for ( v7 = uNumLines - 1; v7; --v7 )
     {
       v8 = v6 + 1;
       pRenderer->do_draw_debug_line_d3d(v6, uDiffuse, v6 + 1, uDiffuse, z_stuff);
-      --v7;
       v6 = v8;
     }
-    while ( v7 );
   }
   pRenderer->do_draw_debug_line_d3d(&pLineVertices[v5], uDiffuse, pLineVertices, uDiffuse, z_stuff);
 }
@@ -732,8 +697,7 @@
       static_sub_437906_array_50CDD0[i].v = (double)pFace->pVertexVIDs[i];
     }
   }
-  extern bool draw_debug_line;
-  if ( draw_debug_line )
+  if ( draw_portals_loops )
     debug_outline_sw(static_sub_437906_array_50CDD0, pFace->uNumVertices, uDiffuse, 0.0);
 }
 // 50D9D0: using guessed type char static_sub_437906_byte_50D9D0_init_flag;
--- a/OSWindow.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/OSWindow.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -20,8 +20,18 @@
 #include "ErrorHandling.h"
 #include "Log.h"
 #include "LOD.h"
+#include "Outdoor_stuff.h"
 
 
+bool wizard_eye = false;         //включить на постоянно око чародея
+bool change_seasons = false;     //смена времён года
+bool all_magic = false;           //включить всю магию
+bool debug_information = false;  //информация fps, положение группы, уровень пола и т.п.
+bool show_picked_face = false;   //выделить активный фейс
+bool draw_portals_loops = false;    //видны рамки порталов
+bool new_speed = false;
+bool bSnow = false;
+
 bool OSWindow::OnMouseLeftClick(int x, int y)
 {
   if (UIControl::OnMouseLeftClick(x, y))
@@ -684,6 +694,65 @@
         AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40100, L"PSICHOTIC");
       }
     }
+    HMENU other = CreatePopupMenu();
+    AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other, L"&Other");
+    {
+      HMENU other_wizard_eye = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_wizard_eye, L"Wizard eye");
+      {
+        AppendMenuW(other_wizard_eye, MF_ENABLED | MF_STRING, 40101, L"Wizard eye on");
+        AppendMenuW(other_wizard_eye, MF_ENABLED | MF_STRING, 40102, L"Wizard eye off");
+      }
+      HMENU other_new_draw_object_dist = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_new_draw_object_dist, L"New draw object distance");
+      {
+        AppendMenuW(other_new_draw_object_dist, MF_ENABLED | MF_STRING, 40103, L"New draw object dist on");
+        AppendMenuW(other_new_draw_object_dist, MF_ENABLED | MF_STRING, 40104, L"New draw object dist off");
+      }
+      HMENU other_change_seasons = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_change_seasons, L"Change seasons");
+      {
+        AppendMenuW(other_change_seasons, MF_ENABLED | MF_STRING, 40105, L"Change seasons on");
+        AppendMenuW(other_change_seasons, MF_ENABLED | MF_STRING, 40106, L"Change seasons off");
+      }
+      HMENU other_all_magic = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_all_magic, L"All magic");
+      {
+        AppendMenuW(other_all_magic, MF_ENABLED | MF_STRING, 40107, L"All magic on");
+        AppendMenuW(other_all_magic, MF_ENABLED | MF_STRING, 40108, L"All magic off");
+      }
+      HMENU other_debug_information = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_debug_information, L"Debug information");
+      {
+        AppendMenuW(other_debug_information, MF_ENABLED | MF_STRING, 40109, L"Debug information on");
+        AppendMenuW(other_debug_information, MF_ENABLED | MF_STRING, 40110, L"Debug information off");
+      }
+      HMENU other_show_picked_face = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_show_picked_face, L"Show picked face");
+      {
+        AppendMenuW(other_show_picked_face, MF_ENABLED | MF_STRING, 40111, L"Show picked face on");
+        AppendMenuW(other_show_picked_face, MF_ENABLED | MF_STRING, 40112, L"Show picked face off");
+      }
+      HMENU other_draw_portals_loops = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_draw_portals_loops, L"Draw portals loops");
+      {
+        AppendMenuW(other_draw_portals_loops, MF_ENABLED | MF_STRING, 40113, L"Draw portals loops on");
+        AppendMenuW(other_draw_portals_loops, MF_ENABLED | MF_STRING, 40114, L"Draw portals loops off");
+      }
+      HMENU other_new_speed = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_new_speed, L"New_speed");
+      {
+        AppendMenuW(other_new_speed, MF_ENABLED | MF_STRING, 40115, L"New_speed on");
+        AppendMenuW(other_new_speed, MF_ENABLED | MF_STRING, 40116, L"New_speed off");
+      }
+      HMENU other_snow = CreatePopupMenu();
+      AppendMenuW(other, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)other_snow, L"Snow");
+      {
+        AppendMenuW(other_snow, MF_ENABLED | MF_STRING, 40117, L"Snowfall on");
+        AppendMenuW(other_snow, MF_ENABLED | MF_STRING, 40118, L"Snowfall off");
+      }
+
+    }
   }
   return menu;
 }
@@ -799,7 +868,28 @@
       }
     }
     break;
+        //SubMenu "Other"
+    case 40101:  wizard_eye = true;  break;                           //включить око чародея
+    case 40102:  wizard_eye = false;  break;                          //выключить око чародея
+    case 40103:  pODMRenderParams->shading_dist_mist = 0x6000;  break;//новая дальность отрисовки объектов
+    case 40104:  pODMRenderParams->shading_dist_mist = 0x2000;  break;////обычная дальность отрисовки объектов
+    case 40105:  change_seasons = true;  break;                           //включить смену времён года
+    case 40106:  change_seasons = false;  break;                          //выключить смену времён года
+    case 40107:  all_magic = true;  break;                           //включить все заклы(нажимать в окне создания группы)
+    case 40108:  all_magic = false;  break;                          //выключить все заклы
+    case 40109:  debug_information = true;  break;                           //включить информацию fps, положение группы, уровень пола и т.п.
+    case 40110:  debug_information = false;  break;                          //выключить информацию fps, положение группы, уровень пола и т.п.
+    case 40111:  show_picked_face = true;  break;                           //включить выделение активного фейса
+    case 40112:  show_picked_face = false;  break;                          //выключить выделение активного фейса
+    case 40113:  draw_portals_loops = true;  break;                           //включить отрисовку рамок порталов
+    case 40114:  draw_portals_loops = false;  break;                          //включить отрисовку рамок порталов
+    case 40115:  new_speed = true;  break;                           //включить двойную скорость
+    case 40116:  new_speed = false;  break;                          //включить двойную скорость
+    case 40117:  bSnow = true;  break;                           //включить снег
+    case 40118:  bSnow = false;  break;                          //включить снег
+
   }
 
   return true;
 }
+
--- a/Outdoor.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/Outdoor.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -2266,7 +2266,7 @@
    v3 = v3 + this->pTileTypes[3].uTileID - 198;
 
   #pragma region "New: seasons change"
-  extern bool change_seasons;
+
   if (change_seasons)
     switch (pParty->uCurrentMonth)
     {
@@ -3693,7 +3693,6 @@
         int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
 
-        extern bool new_speed;
         if ( new_speed )
         {
           v2 += dx * 12;
--- a/UI/UiGame.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/UI/UiGame.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -1851,7 +1851,7 @@
     bWizardEyeActive = true;
     uWizardEyeSkillLevel = 2;
   }
-  extern bool wizard_eye;
+
   if ( wizard_eye )
   {
     bWizardEyeActive = true;
--- a/Vis.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/Vis.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -646,7 +646,6 @@
   if ( v16 != 1 )
     return false;
 
-  extern bool show_picked_face;
   if ( show_picked_face )
     pFace->uAttributes |= FACE_PICKED;
   return true;
--- a/Weather.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/Weather.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -145,7 +145,7 @@
 //----- (004C2EFA) --------------------------------------------------------
 int Weather::Draw()
 {
-  if (bRenderSnow)
+  if ( bRenderSnow || bSnow )
     DrawSnow();
   return 0;
 }
--- a/mm7_2.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/mm7_2.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -3600,16 +3600,8 @@
   static_assert(sizeof(LODSprite) == 0x28, "Wrong type size");
 }
 
-bool new_sky = false;
-bool new_draw_object_dist = true;
-bool change_seasons = false;
-bool all_magic = true;
-bool wizard_eye = false;
-bool debug_information = false;
-bool show_picked_face = false;
-bool draw_debug_line = false;
-bool new_speed = true;
-int max_flight_height = 4000;
+bool new_sky = false;            //новое небо(требуются текстурки)
+int max_flight_height = 4000;    //максимальная высота полёта
 
 
 
@@ -3878,11 +3870,11 @@
   pODMRenderParams->shading_dist_shade     = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename);
   pODMRenderParams->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename);
 
-  int dist = 0x2000;
-  extern bool new_draw_object_dist;
-  if ( new_draw_object_dist )
-      dist = 0x6000;
-  pODMRenderParams->shading_dist_mist      = GetPrivateProfileIntW(L"shading", L"dist_mist", dist, pIniFilename);
+  //int dist = 0x2000;
+
+  //if ( new_draw_object_dist )
+      //dist = 0x6000;
+  pODMRenderParams->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", 0x2000, pIniFilename);//дальность отрисовки 0x2000
 
   wchar_t pDefaultSkyTextureW[1024];
   GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename);
--- a/mm7_data.h	Fri Mar 14 10:47:22 2014 +0600
+++ b/mm7_data.h	Fri Mar 14 13:58:51 2014 +0600
@@ -778,4 +778,11 @@
 extern int bGameoverLoop; // weak
 extern std::array<__int16, 104> intersect_face_vertex_coords_list_a; // word_F8BC48
 extern std::array<__int16, 104> intersect_face_vertex_coords_list_b; // word_F8BD18
-
+extern bool wizard_eye;
+extern bool change_seasons;
+extern bool all_magic;
+extern bool debug_information;
+extern bool show_picked_face;
+extern bool draw_portals_loops;
+extern bool new_speed;
+extern bool bSnow;
--- a/stru10.cpp	Fri Mar 14 10:47:22 2014 +0600
+++ b/stru10.cpp	Fri Mar 14 13:58:51 2014 +0600
@@ -682,8 +682,7 @@
     //if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
     //{
       RenderVertexSoft v26; // [sp+40h] [bp-60h]@20
-      extern bool draw_debug_line;
-      if ( draw_debug_line )
+      if ( draw_portals_loops )
       {
         if (!bDoNotDrawPortalFrustum)
         {
@@ -729,8 +728,7 @@
         v26.vWorldPosition.y = face_center_y + a1.y * 400.0f;
         v26.vWorldPosition.z = face_center_z + a1.z * 400.0f;
 
-        extern bool draw_debug_line;
-        if ( draw_debug_line )
+        if ( draw_portals_loops )
           pGame->pIndoorCameraD3D->do_draw_debug_line_sw(&v25, -1, &v26, 0xFFFF00u, 0, 0);
       }
   //}