diff GUIWindow.cpp @ 189:038a4d09406f

new texts file, fix text rendender error
author Gloval
date Sat, 16 Feb 2013 00:33:21 +0400
parents c5bd7a825ef2
children e6e348d66a75
line wrap: on
line diff
--- a/GUIWindow.cpp	Fri Feb 15 19:46:25 2013 +0600
+++ b/GUIWindow.cpp	Sat Feb 16 00:33:21 2013 +0400
@@ -20,6 +20,7 @@
 #include "FactionTable.h"
 #include "StorylineTextTable.h"
 #include "Events2D.h"
+#include "texts.h"
 #include "Autonotes.h"
 
 
@@ -240,8 +241,8 @@
     v29 = pSpellStats->pInfos[v28].pShortName;
   else
     v29 = pGlobalTXT_LocalizationStrings[153];
-  sprintf(pTmpBuf2, "%s: %s", pGlobalTXT_LocalizationStrings[172], v29);
-  strcat(pTmpBuf, pTmpBuf2);
+  sprintf((char*)pTmpBuf2, "%s: %s", (char*)pGlobalTXT_LocalizationStrings[172], v29);
+  strcat((char*)pTmpBuf, (char*)pTmpBuf2);
   DrawText(pFontArrus, 120, 22, 0, pTmpBuf, 0, 0, 0);
 
   uFramesetIDa = 0;
@@ -1321,7 +1322,8 @@
 
 
 //----- (0044D406) --------------------------------------------------------
-char *GUIWindow::DrawTitleText(GUIFont *a2, unsigned int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing)
+char *GUIWindow::DrawTitleText(GUIFont *a2, unsigned int uHorizontalMargin, unsigned int uVerticalMargin, 
+	        unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing)
 {
   GUIWindow *pWindow; // esi@1
   unsigned int v8; // ebx@1
@@ -1698,18 +1700,20 @@
 }
 
 //----- (0041D12F) --------------------------------------------------------
-GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int a6, int a7, unsigned int uControlID, unsigned int uControlParam, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...)
+GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, 
+	int a6, int a7, unsigned int uControlID, unsigned int uControlParam, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...)
 {
   GUIButton *pButton; // esi@1
   unsigned int v13; // eax@1
   unsigned int v14; // ebx@4
   unsigned int v15; // eax@4
-  unsigned int pTextureNum; // ebx@4
+  unsigned int TextureNum=0; // ebx@4
   unsigned int v17; // eax@4
   Texture *v18; // eax@4
   Texture **v19; // ecx@5
   Texture **v20; // edx@5
   GUIButton *v21; // eax@7
+  va_list texturs_ptr;
 
   pButton = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON");
   pButton->pParent = this;
@@ -1723,7 +1727,6 @@
   v14 = pButton->uX;
   pButton->uButtonType = a6;
   v15 = v14 + uWidth - 1;
-  pTextureNum = 0;
   pButton->uZ = v15;
   v17 = pButton->uY;
   pButton->field_2C = 0;
@@ -1734,25 +1737,16 @@
   pButton->uHotkey = uHotkey;
   strlen(pName);
   strcpy(pButton->pButtonName, pName);
-  v18 = pTextures;
-  if ( pTextures )
+  va_start(texturs_ptr, pName);
+  while  (NULL!=(pTextures=va_arg(texturs_ptr, Texture *)))
   {
-    v19 = &pTextures;
-    v20 = pButton->pTextures;
-    do
-    {
-      ++v19;
-      *v20 = v18;
-      ++pTextureNum;
-      ++v20;
-      v18 = *v19;
-    }
-    while ( *v19 );
+	pButton->pTextures[TextureNum]=pTextures;
+	++TextureNum;	
   }
-  pButton->uNumTextures = pTextureNum;
-  v21 = this->pControlsTail;
-  if ( v21 )
-    v21->pNext = pButton;
+  va_end(texturs_ptr);
+  pButton->uNumTextures = TextureNum;
+  if ( this->pControlsTail )
+    this->pControlsTail->pNext = pButton;
   else
     this->pControlsHead = pButton;
   pButton->pPrev = this->pControlsTail;
@@ -1979,7 +1973,7 @@
         if ( v26 + 1 == v25 && uHouse_ExitPic )
         {
           v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
-          v29 = pGlobalTXT_LocalizationStrings[411];//Войти в ^Pv[%s]
+          v29 = (char*)pGlobalTXT_LocalizationStrings[411];//Войти в ^Pv[%s]
         }
         else
         {
@@ -1989,7 +1983,7 @@
             //v27 = (char *)p2DEvents_minus1_::08[13 * a4];
             v27 = (char *)p2DEvents[pButton - 1].pProprieterName;
           v30 = v27;
-          v29 = pGlobalTXT_LocalizationStrings[435];//Побеседовать с ^Pt[%s]
+          v29 = (char*)pGlobalTXT_LocalizationStrings[435];//Побеседовать с ^Pt[%s]
         }
         sprintf(&byte_591180[100 * v26], v29, v30);
         array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(*(&pNPCPortraits_x + v26 + 6 * uNumDialogueNPCPortraits - 6),