changeset 1842:175bf8da83d9

Merge
author Grumpy7
date Sun, 13 Oct 2013 06:32:06 +0200
parents f094bfb4ba31 (current diff) 303a56458f7b (diff)
children 2e6d3cd052e0
files UI/UIPopup.cpp mm7_2.cpp
diffstat 10 files changed, 79 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/Indoor.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -5197,25 +5197,25 @@
 
     this->angle_from_east = fixpoint_mul(v21, v28) + fixpoint_mul(a7, v9);
     this->angle_from_south = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29);
-    this->field_20 = fixpoint_mul(a7, v28) - fixpoint_mul(v21, v9);
+    this->viewing_angle = fixpoint_mul(a7, v28) - fixpoint_mul(v21, v9);
   }
   else
   {
     this->angle_from_east = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29);
     this->angle_from_south = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29);
-    this->field_20 = a7;
+    this->viewing_angle = a7;
   }
 
   this->angle_from_east = -this->angle_from_east;
   this->angle_from_south = -this->angle_from_south;
-  this->field_20 = -this->field_20;
+  this->viewing_angle = -this->viewing_angle;
 
   this->field_24 = fixpoint_dot(this->angle_from_north,  this->field_0_party_dir_x,
                                 this->angle_from_west, this->field_4_party_dir_y,
                                 this->field_14, this->field_8_party_dir_z);
   this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x,
                                 this->angle_from_south, this->field_4_party_dir_y,
-                                this->field_20, this->field_8_party_dir_z);
+                                this->viewing_angle, this->field_8_party_dir_z);
 }
 //----- (00407A1C) --------------------------------------------------------
 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v)
--- a/NewUI/MainMenu.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/NewUI/MainMenu.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -1,5 +1,5 @@
-#include "MainMenu.h"
-
+#include "MainMenu.h"и
+#include "..\LOD.h"
 
 bool MainMenuWindow::OnMouseLeftClick(int x, int y)
 {
@@ -28,6 +28,8 @@
 
 bool MainMenuWindow::Initialize()
 {
+  auto background_texture = new RGBTexture;
+  background_texture->Load("newtitle.pcx", 0);
   return true;
 }
 
--- a/NewUI/MainMenu.h	Fri Oct 11 10:12:29 2013 +0200
+++ b/NewUI/MainMenu.h	Sun Oct 13 06:32:06 2013 +0200
@@ -1,5 +1,6 @@
 #pragma once
 #include "Core/UIControl.h"
+#include "..\Render.h"
 
 
 class MainMenuWindow: public UIControl
@@ -25,4 +26,7 @@
     //virtual bool OnMouseEnter() override;
     // UIControl
     //virtual bool OnMouseLeave() override;
+
+  private:
+	RGBTexture *background_texture;
 };
\ No newline at end of file
--- a/Outdoor_stuff.h	Fri Oct 11 10:12:29 2013 +0200
+++ b/Outdoor_stuff.h	Sun Oct 13 06:32:06 2013 +0200
@@ -80,7 +80,7 @@
   int field_14;
   int angle_from_east;//field_18
   int angle_from_south;//field_1C
-  int field_20;
+  int viewing_angle;//field_20
   int field_24;
   int field_28;
 };
--- a/Render.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/Render.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -5164,7 +5164,7 @@
     v77 = (unsigned __int64)(v62.ptr_38->field_14 * (signed __int64)(signed int)v15) >> 16;
     v74 = v77 + v62.ptr_38->angle_from_north;
     v77 = (int)v15;
-    v77 = (unsigned __int64)(v62.ptr_38->field_20 * (signed __int64)(signed int)v15) >> 16;
+    v77 = (unsigned __int64)(v62.ptr_38->viewing_angle * (signed __int64)(signed int)v15) >> 16;
     v79 = v15;
     v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->angle_from_east);
     v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16);
@@ -5281,7 +5281,7 @@
     v36 = (int)((char *)v81 + v62.ptr_38->angle_from_north);
     v81 = v35;
     v74 = v36;
-    v78 = v62.ptr_38->field_20;
+    v78 = v62.ptr_38->viewing_angle;
     v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
     v78 = (int)v35;
     v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->angle_from_east);
@@ -6438,7 +6438,7 @@
 
         if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
         {
-          /*Dst.sub_451007_scale_image_bicubic(
+          Dst.sub_451007_scale_image_bicubic(
             pHWLTexture->pPixels,
             pHWLTexture->uWidth,
             pHWLTexture->uHeight,
@@ -6448,7 +6448,7 @@
             desc.dwHeight,
             desc.lPitch >> 1,
             0,
-            0);*/
+            0);
           ErrD3D(pNextSurf->Unlock(0));
           //bMipMaps = 0x4D86ACu;
         }
--- a/Texture.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/Texture.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -519,28 +519,17 @@
 //----- (0040F414) --------------------------------------------------------
 int RGBTexture::Load(const char *pContainer, int mode)
 {
-  RGBTexture *v3; // esi@1
   FILE *v4; // eax@1
-  FILE *v5; // ebx@1
   void *v6; // ebx@5
-  unsigned __int16 v7; // ax@9
-  unsigned __int16 v8; // cx@9
-  int v9; // ecx@9
-  void *v10; // eax@9
-  void *v11; // eax@13
-  unsigned __int16 *v12; // eax@17
   char color_map[48]; // [sp+Ch] [bp-98h]@7
   Texture DstBuf; // [sp+3Ch] [bp-68h]@1
   PCXHeader1 header1; // [sp+84h] [bp-20h]@7
   PCXHeader2 header2; // [sp+94h] [bp-10h]@7
-  FILE *File; // [sp+9Ch] [bp-8h]@1
   size_t Count; // [sp+A0h] [bp-4h]@4
   char *Str1a; // [sp+ACh] [bp+8h]@5
 
-  v3 = this;
+
   v4 = pIcons_LOD->FindContainer(pContainer, 0);
-  v5 = v4;
-  File = v4;
   if ( !v4 )
     Error("Unable to load %s", pContainer);
 
@@ -550,7 +539,7 @@
   {
     Str1a = (char *)malloc(DstBuf.uDecompressedSize);
     v6 = malloc(DstBuf.uTextureSize);
-    fread(v6, 1u, Count, File);
+    fread(v6, 1, Count, v4);
     zlib::MemUnzip(Str1a, &DstBuf.uDecompressedSize, v6, DstBuf.uTextureSize);
     DstBuf.uTextureSize = DstBuf.uDecompressedSize;
     free(v6);
@@ -558,48 +547,64 @@
   else
   {
     Str1a = (char *)malloc(DstBuf.uTextureSize);
-    fread(Str1a, 1u, Count, v5);
+    fread(Str1a, 1, Count, v4);
   }
   memcpy(&header1, Str1a, 0x10u);
   memcpy(color_map, Str1a + 16, 0x30u);
-  memcpy(&header2, Str1a + 64, 6u);
+  memcpy(&header2, Str1a + 64, 6);
   if ( header1.bpp != 8 )
     return 3;
-  v7 = header1.right - header1.left + 1;
-  v8 = header1.bottom - header1.up + 1;
-  v3->uWidth = v7;
-  v3->uHeight = v8;
-  v9 = (signed __int16)v7 * (signed __int16)v8;
-  v10 = v3->pPixels;
-  v3->uNumPixels = v9;
-  if ( v10 )
+  this->uWidth = header1.right - header1.left + 1;
+  this->uHeight = header1.bottom - header1.up + 1;
+  this->uNumPixels = (signed __int16)this->uWidth * (signed __int16)this->uHeight;
+  if ( this->pPixels )
   {
     if ( mode )
-      goto LABEL_14;
-    free(v10);
+	{
+      if ( mode != 2 )
+      {
+        if ( !this->pPixels )
+          return 2;
+        this->DecodePCX(Str1a, this->pPixels, this->uWidth);
+        free(Str1a);
+        return 0;
+      }
+      this->_allocation_flags |= 1;
+      this->pPixels = (unsigned __int16 *)malloc(2 * this->uNumPixels + 4);
+      if ( !this->pPixels )
+        return 2;
+      this->DecodePCX(Str1a, this->pPixels, this->uWidth);
+      free(Str1a);
+      return 0;	
+	}
+    free(this->pPixels);
   }
   if ( !mode )
   {
-    v11 = malloc(2 * v3->uNumPixels + 4);
-    goto LABEL_16;
+    this->pPixels = (unsigned __int16 *)malloc(2 * this->uNumPixels + 4);
+    if ( !this->pPixels )
+      return 2;
+    this->DecodePCX(Str1a, this->pPixels, this->uWidth);
+    free(Str1a);
+    return 0;	
   }
-LABEL_14:
   if ( mode != 2 )
-    goto LABEL_17;
-  v11 = malloc(2 * v3->uNumPixels + 4);
-  v3->_allocation_flags |= 1u;
-LABEL_16:
-  v3->pPixels = (unsigned __int16 *)v11;
-LABEL_17:
-  v12 = v3->pPixels;
-  if ( !v12 )
+  {
+    if ( !this->pPixels )
+      return 2;
+    this->DecodePCX(Str1a, this->pPixels, this->uWidth);
+    free(Str1a);
+    return 0;
+  }
+  this->_allocation_flags |= 1;
+  this->pPixels = (unsigned __int16 *)malloc(2 * this->uNumPixels + 4);
+  if ( !this->pPixels )
     return 2;
-  v3->DecodePCX(Str1a, v12, v3->uWidth);
+  this->DecodePCX(Str1a, this->pPixels, this->uWidth);
   free(Str1a);
   return 0;
 }
 
-
 //----- (0040F037) --------------------------------------------------------
 signed int RGBTexture::DecodePCX(char *pPcx, unsigned __int16 *pOutPixels, unsigned int uNumPixels)
 {
--- a/UI/UIPopup.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/UI/UIPopup.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -1594,17 +1594,17 @@
   double v31; // st7@112
   Vec3_int_ v39; // [sp-18h] [bp-A8h]@83
   GUIWindow message_window; // [sp+Ch] [bp-84h]@137
-  POINT a2; // [sp+78h] [bp-18h]@2
+  POINT cursor; // [sp+78h] [bp-18h]@2
   unsigned int damage_level; // [sp+8Ch] [bp-4h]@23
 
   if (no_rightlick_in_inventory)
     return;
 
-  pMouse->GetCursorPos(&a2);
-  int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1;
+  pMouse->GetCursorPos(&cursor);
+  int item_pid = (pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF) - 1;
   auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid];
 
-  if (a2.x <= 13 || a2.x >= 462)//items out of inventory(вещи вне инвентаря)
+  if (cursor.x <= 13 || cursor.x >= 462)//items out of inventory(вещи вне инвентаря)
   {
     GameUI_DrawItemInfo(item);
     return;
@@ -1612,8 +1612,8 @@
 
   if (!item_pid)
   {
-    int inventory_mouse_x = a2.x - 14;
-    int inventory_mouse_y = a2.y - 17;
+    int inventory_mouse_x = cursor.x - 14;
+    int inventory_mouse_y = cursor.y - 17;
 
     int mouse_cell_x = inventory_mouse_x / 32;
     int mouse_cell_y = inventory_mouse_y / 32;
@@ -1637,10 +1637,10 @@
     message_window.Hint = pTmpBuf.data();
     message_window.uFrameWidth = 384;
     message_window.uFrameHeight = 180;
-    if (a2.x <= 320 )
-      message_window.uFrameX = a2.x + 30;
+    if (cursor.x <= 320 )
+      message_window.uFrameX = cursor.x + 30;
     else
-      message_window.uFrameX = a2.x - 414;
+      message_window.uFrameX = cursor.x - 414;
     message_window.uFrameY = 40;
     message_window.DrawMessageBox(0);
     return;
--- a/Viewport.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/Viewport.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -551,6 +551,8 @@
       return;
     }
     pEventID = pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].uEventID;
+    EventProcessor(pEventID, (unsigned __int16)v0, 1);
+    return;
   }
   if ( PID_TYPE(v0) == OBJECT_BModel && HIWORD(v0) < clickable_distance)
   {
@@ -667,7 +669,7 @@
   {
     if ( !pParty->pPickedItem.uItemID )
       return;
-		__debugbreak();//no checker
+	__debugbreak();//no checker
     v6 = 0;
     a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
     if ( (signed int)pObjectList->uNumObjects <= 0 )
--- a/mm7_2.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/mm7_2.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -851,7 +851,6 @@
 
 
 
-
 //----- (00451007) --------------------------------------------------------
 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch,          //changing this to some library function might be a good idea
                                             unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch,
--- a/mm7_3.cpp	Fri Oct 11 10:12:29 2013 +0200
+++ b/mm7_3.cpp	Sun Oct 13 06:32:06 2013 +0200
@@ -4961,7 +4961,7 @@
       v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_14 * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
       v35 = v39 + pSkyPolygon.ptr_38->angle_from_north;
 
-      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_20 * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
+      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
       v36 = v39 + pSkyPolygon.ptr_38->angle_from_east;
 
       v38 = pSkyPolygon.v_18.z;
@@ -5740,25 +5740,25 @@
 
     this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27);
     this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
-    this->field_20 = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27);
+    this->viewing_angle = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27);
   }
   else
   {
     this->angle_from_east = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
     this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
-    this->field_20 = a7;
+    this->viewing_angle = a7;
   }
 
   this->angle_from_east = -this->angle_from_east;
   this->angle_from_south = -this->angle_from_south;
-  this->field_20 = -this->field_20;
+  this->viewing_angle = -this->viewing_angle;
 
   this->field_24 = fixpoint_dot(this->angle_from_north,  this->field_0_party_dir_x,
                                 this->angle_from_west, this->field_4_party_dir_y,
                                 this->field_14, this->field_8_party_dir_z);
   this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x,
                                 this->angle_from_south, this->field_4_party_dir_y,
-                                this->field_20, this->field_8_party_dir_z);
+                                this->viewing_angle, this->field_8_party_dir_z);
 }
 
 //----- (0048694B) --------------------------------------------------------
@@ -5766,14 +5766,14 @@
 {
   this->angle_from_east = -this->angle_from_east;
   this->angle_from_south = -this->angle_from_south;
-  this->field_20 = -this->field_20;
+  this->viewing_angle = -this->viewing_angle;
 
   this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x,
                                 this->angle_from_west, this->field_4_party_dir_y,
                                 this->field_14, this->field_8_party_dir_z);
   this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x,
                                 this->angle_from_south, this->field_4_party_dir_y,
-                                this->field_20, this->field_8_party_dir_z);
+                                this->viewing_angle, this->field_8_party_dir_z);
 }
 
 //----- (0044100D) --------------------------------------------------------