changeset 1835:a5637690ffbb

m
author Ritor1
date Fri, 11 Oct 2013 18:55:07 +0600
parents 0b44f4d67c18
children f017f8e79aa1
files NewUI/MainMenu.cpp NewUI/MainMenu.h Texture.cpp mm7_2.cpp
diffstat 4 files changed, 53 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/NewUI/MainMenu.cpp	Tue Oct 08 15:27:57 2013 +0600
+++ b/NewUI/MainMenu.cpp	Fri Oct 11 18:55:07 2013 +0600
@@ -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	Tue Oct 08 15:27:57 2013 +0600
+++ b/NewUI/MainMenu.h	Fri Oct 11 18:55:07 2013 +0600
@@ -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/Texture.cpp	Tue Oct 08 15:27:57 2013 +0600
+++ b/Texture.cpp	Fri Oct 11 18:55:07 2013 +0600
@@ -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/mm7_2.cpp	Tue Oct 08 15:27:57 2013 +0600
+++ b/mm7_2.cpp	Fri Oct 11 18:55:07 2013 +0600
@@ -4264,8 +4264,8 @@
 bool change_seasons = false;
 bool all_magic = true;
 bool wizard_eye = false;
-bool debug_information = false;
-bool show_picked_face = false;
+bool debug_information = true;
+bool show_picked_face = true;
 bool draw_debug_line = false;
 
 //----- (00462C94) --------------------------------------------------------