diff mm7_3.cpp @ 189:038a4d09406f

new texts file, fix text rendender error
author Gloval
date Sat, 16 Feb 2013 00:33:21 +0400
parents 16d257ffc802
children 9b77686e2239
line wrap: on
line diff
--- a/mm7_3.cpp	Fri Feb 15 19:46:25 2013 +0600
+++ b/mm7_3.cpp	Sat Feb 16 00:33:21 2013 +0400
@@ -41,6 +41,7 @@
 #include "stru176.h"
 #include "stru159.h"
 #include "stru298.h"
+#include "texts.h"
 #include "Log.h"
 
 #include "mm7_data.h"
@@ -16508,42 +16509,39 @@
     {
       sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold."
       pInString = v4;
-      v8 = 0;
       pWindow.uFrameWidth = 460;
       pWindow.uFrameZ = 452;
       pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       if ( 352 - v12 < 8 )
       {
         pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       }
       pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
         (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
       pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
       goto LABEL_42;
     }
     if ( uDialogueType == DIALOGUE_ARENA_ALREADY_WON )
     {
-      v7 = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:"
-      v8 = 0;
-      pInString = v7;
+      pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:"
       pWindow.uFrameWidth = 460;
       pWindow.uFrameZ = 452;
       pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       if ( 352 - v12 < 8 )
       {
         pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       }
       pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
         (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
       pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
       goto LABEL_42;
     }
   }
@@ -16552,45 +16550,43 @@
     if ( uDialogueType == DIALOGUE_ARENA_WELCOME )
     {
       v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death.  Remember, you are only allowed one arena combat per visit.  To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
-      v8 = 0;
       pInString = v7;
       pWindow.uFrameWidth = 460;
       pWindow.uFrameZ = 452;
       pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       if ( 352 - v12 < 8 )
       {
         pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       }
       pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
         (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
       pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
       goto LABEL_42;
     }
     if ( uDialogueType == DIALOGUE_13 )
     {
       v5 = 5 * pNPC->uProfession;
       v6 = (char *)*(&pNPCStats->field_13A64 + v5);
-      v8 = 0;
       v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
       pInString = v7;
       pWindow.uFrameWidth = 460;
       pWindow.uFrameZ = 452;
       pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       if ( 352 - v12 < 8 )
       {
         pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       }
       pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
         (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
       pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
       goto LABEL_42;
     }
     if ( (signed int)uDialogueType > DIALOGUE_18 )
@@ -16603,65 +16599,62 @@
           if ( byte_F8B1EC )
           {
             v6 = (char *)*(&pNPCStats->field_13A5C + 5 * pNPC->uProfession);
-            v8 = 0;
             v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
             pInString = v7;
             pWindow.uFrameWidth = 460;
             pWindow.uFrameZ = 452;
             pOutString = pFontArrus;
-            v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+            v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
             if ( 352 - v12 < 8 )
             {
               pOutString = pFontCreate;
-              v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+              v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
             }
             pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
                               (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
             pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-            v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-            pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+            v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+            pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
             goto LABEL_42;
           }
           if ( pNPC->uFlags & 0x80 )
           {
             v6 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession);
-            v8 = 0;
             v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
             pInString = v7;
             pWindow.uFrameWidth = 460;
             pWindow.uFrameZ = 452;
             pOutString = pFontArrus;
-            v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+            v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
             if ( 352 - v12 < 8 )
             {
               pOutString = pFontCreate;
-              v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+              v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
             }
             pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
                                (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
             pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-            v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-            pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+            v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+            pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
             goto LABEL_42;
           }
           v6 = (char *)*(&pNPCStats->field_13A64 + v5);
-          v8 = 0;
           v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0);
           pInString = v7;
           pWindow.uFrameWidth = 460;
           pWindow.uFrameZ = 452;
           pOutString = pFontArrus;
-          v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+          v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
           if ( 352 - v12 < 8 )
           {
             pOutString = pFontCreate;
-            v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+            v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
           }
           pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
                                      (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
           pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-          v13 = FitTextInAWindow(pInString, pOutString,  &pWindow, 0xDu, v8);
-          pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+          v13 = FitTextInAWindow(pInString, pOutString,  &pWindow, 0xDu, 0);
+          pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
           goto LABEL_42;
         }
         goto LABEL_24;
@@ -16669,22 +16662,21 @@
       if ( byte_5B0938[0] )
         goto LABEL_24;
       v7 = (char *)ptr_F8B1E8;
-      v8 = 0;
       pInString = v7;
       pWindow.uFrameWidth = 460;
       pWindow.uFrameZ = 452;
       pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       if ( 352 - v12 < 8 )
       {
         pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       }
       pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
         (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
       pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
       goto LABEL_42;
     }
   }
@@ -16703,30 +16695,29 @@
   {
     if ( *(int *)v54 == 2 )
     {
-      v8 = 0;
       if ( pNPC->uFlags & 0x80 )
         v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pDismissText;
       else
         v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; //"Invalid String Passed"
-      v10 = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0);
+       pInString = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0);
 LABEL_32:
-      pInString = v10;
-      if ( v10 == (char *)v8 )
+
+      if (  pInString == NULL )
         goto LABEL_42;
       pWindow.uFrameWidth = 460;
       pWindow.uFrameZ = 452;
       pOutString = pFontArrus;
-      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+      v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       if ( 352 - v12 < 8 )
       {
         pOutString = pFontCreate;
-        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7;
+        v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
       }
       pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0),
         (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12);
       pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
-      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8);
-      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8);
+      v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0);
+      pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0);
       goto LABEL_42;
     }
   }
@@ -16792,7 +16783,7 @@
       {
         if ( pNPC->uFlags & 0x80 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName);
+          sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName);
           v24 = pTmpBuf;
           goto LABEL_79;
         }