changeset 648:35ce4761382c

Fixed numbers in tavern dialogue ui
author Nomad
date Mon, 11 Mar 2013 23:32:27 +0200
parents c5a3a9cf00cd
children 0e368c04acfb
files UIHouses.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp mm7_data.h mm7text_ru.cpp
diffstat 7 files changed, 45 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/UIHouses.cpp	Tue Mar 12 01:24:07 2013 +0600
+++ b/UIHouses.cpp	Mon Mar 11 23:32:27 2013 +0200
@@ -1038,29 +1038,23 @@
     {
       if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
           return;
-      pColorText = pColorYellow;
-      if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
-        pColorText = pColorWhite;
-      sprintf(Dest, format_4E2DC8, pColorText);
-      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString);
+
+      sprintf(Dest, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
+      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
       strcat(Dest, pTmpBuf2);
       pTextHeight = pFontArrus->CalcTextHeight(Dest, &dialog_window, 0, 0);
       strcat(Dest, "\n \n");
-      pColorText = pColorYellow;
-      if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
-        pColorText = pColorWhite;
-      sprintf(a1, format_4E2DC8, pColorText);
-      sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[86],
-        (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
+
+      sprintf(a1, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
+      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
+        (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
          v83);
       strcat(a1, pTmpBuf2);
       v88 = pFontArrus->CalcTextHeight(a1, &dialog_window, 0, 0);
       strcat(a1, "\n \n");
-      pColorText = pColorYellow;
-      if ( pDialogueWindow->pCurrentPosActiveItem != 4 )
-        pColorText = pColorWhite;
-      sprintf(v77, format_4E2DC8, pColorText);
-      strcat(v77, pGlobalTXT_LocalizationStrings[160]);
+
+      sprintf(v77, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? pColorYellow : pColorWhite);
+      strcat(v77, pGlobalTXT_LocalizationStrings[160]); // Learn Skills
       v82 = pFontArrus->CalcTextHeight(v77, &dialog_window, 0, 0);
       strcat(v77, "\n \n");
       v75[0] = 0;
@@ -1068,11 +1062,8 @@
       v31 = (signed int)window_SpeakInHouse->ptr_1C;
       if ( v31 >= 108 && v31 <= 120 )
       {
-        pColorText = pColorYellow;
-        if ( pDialogueWindow->pCurrentPosActiveItem != 5 )
-          pColorText = pColorWhite;
-        sprintf(v75, format_4E2DC8, pColorText);
-        strcat(v75, pGlobalTXT_LocalizationStrings[611]);
+        sprintf(v75, "\xC" "%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? pColorYellow : pColorWhite);
+        strcat(v75, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage
         pTextHeight = pFontArrus->CalcTextHeight(v75, &dialog_window, 0, 0);
       }
       v34 = pDialogueWindow->pStartingPosActiveItem;
@@ -1082,7 +1073,7 @@
       pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
       if ( !(v37 ^ v34 < v35) )
       {
-        sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
+        sprintf(pTmpBuf, "%s%s%s%s", Dest, a1, v77, v75);
         dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
         return;
       }
--- a/mm7_2.cpp	Tue Mar 12 01:24:07 2013 +0600
+++ b/mm7_2.cpp	Mon Mar 11 23:32:27 2013 +0200
@@ -10446,7 +10446,7 @@
 }
 
 bool new_sky = false;
-bool change_seasons = false;
+bool change_seasons = true;
 
 //----- (00462C94) --------------------------------------------------------
 bool MM_Main(const wchar_t *pCmdLine)
--- a/mm7_4.cpp	Tue Mar 12 01:24:07 2013 +0600
+++ b/mm7_4.cpp	Mon Mar 11 23:32:27 2013 +0200
@@ -11446,7 +11446,7 @@
           if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
             v27 = *(const char **)v57;
           v47[1] = v27;
-          sprintf(a1, format_4E2DC8, v27);
+          sprintf(a1, "\xC" "%05d", v27);
           v66 = (unsigned __int8)byte_4F09B8[v26 * 4];
           if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
           {
--- a/mm7_5.cpp	Tue Mar 12 01:24:07 2013 +0600
+++ b/mm7_5.cpp	Mon Mar 11 23:32:27 2013 +0200
@@ -16641,21 +16641,21 @@
   {
     strcpy(a2, "%s\n\n");
     v24 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
-    sprintf(Source, format_4E2DC8, v24);
+    sprintf(Source, "\xC" "%05d", v24);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v25 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
-    sprintf(Source, format_4E2DC8, v25);
+    sprintf(Source, "\xC" "%05d", v25);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v26 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
-    sprintf(Source, format_4E2DC8, v26);
+    sprintf(Source, "\xC" "%05d", v26);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v27 = pPlayer->classType;
     v28 = uPlayerSkillType;
     v29 = GetSkillColor(v27, uPlayerSkillType, 4);
-    sprintf(Source, format_4E2DC8, v29);
+    sprintf(Source, "\xC" "%05d", v29);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
 
@@ -16670,24 +16670,24 @@
   {
     strcpy(a2, "%s\n\n");
     v9 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
-    sprintf(Source, format_4E2DC8, v9);
+    sprintf(Source, "\xC" "%05d", v9);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v10 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
-    sprintf(Source, format_4E2DC8, v10);
+    sprintf(Source, "\xC" "%05d", v10);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v11 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
-    sprintf(Source, format_4E2DC8, v11);
+    sprintf(Source, "\xC" "%05d", v11);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v12 = uPlayerSkillType;
     v13 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 4);
-    sprintf(Source, format_4E2DC8, v13);
+    sprintf(Source, "\xC" "%05d", v13);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n\n");
     v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-    sprintf(Source, format_4E2DC8, v14);
+    sprintf(Source, "\xC" "%05d", v14);
     strcat(a2, Source);
     strcat(a2, "%s: +%d");
     v15 = v12;
@@ -17139,7 +17139,7 @@
   v2 = pIcons_LOD->LoadTexture("fr_stats", TEXTURE_16BIT_PALETTE);
   pRenderer->DrawTextureIndexed(8, 8, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
   v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, format_4E2DC8, v3);
+  sprintf(pTmpBuf, "\xC" "%05d", v3);
   sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s
   strcat(pTmpBuf, pTmpBuf2);
   if ( pPlayer->uSkillPoints )
--- a/mm7_data.cpp	Tue Mar 12 01:24:07 2013 +0600
+++ b/mm7_data.cpp	Mon Mar 11 23:32:27 2013 +0200
@@ -524,7 +524,7 @@
 char format_4E2D90[8];
 char aS03d03dS000_0[777]; // idb
 char aS03d03dS000[777]; // idb
-const char *format_4E2DC8 = "\f%05d";
+//const char *format_4E2DC8 = "\f%05d";
 char aS[777]; // idb
 char aLuSLuS[777]; // idb
 char byte_4E2DE8; // idb
--- a/mm7_data.h	Tue Mar 12 01:24:07 2013 +0600
+++ b/mm7_data.h	Mon Mar 11 23:32:27 2013 +0200
@@ -510,7 +510,7 @@
 extern char format_4E2D90[8];
 extern char aS03d03dS000_0[]; // idb
 extern char aS03d03dS000[]; // idb
-extern const char *format_4E2DC8;
+//extern const char *format_4E2DC8;
 extern char aS[]; // idb
 extern char aLuSLuS[]; // idb
 extern char byte_4E2DE8; // idb
--- a/mm7text_ru.cpp	Tue Mar 12 01:24:07 2013 +0600
+++ b/mm7text_ru.cpp	Mon Mar 11 23:32:27 2013 +0200
@@ -1165,8 +1165,9 @@
   char buf[8192];
   assert(strlen(str) < sizeof(buf));
 
-  bool integer_token_defined = false;
-  int integer_token = 0;
+  int next_integer_token = 0;
+  bool integer_tokens_defined[2] = {false, false};
+  int integer_tokens[2] = {0, 0};
 
   bool gender_token_defined = false;
   int gender_token = 0;
@@ -1184,8 +1185,8 @@
           goto _invalid_token;
         src += 3;  // ^I[
 
-        if (sscanf(src, "%d", &integer_token))
-          integer_token_defined = true;
+        if (sscanf(src, "%d", &integer_tokens[next_integer_token]))
+          integer_tokens_defined[next_integer_token++] = true;
 
         auto int_begin = src;
         while (*src++ != ']');
@@ -1198,9 +1199,19 @@
 
       case 'L':
       {
-        if (src[2] != '[')
+        int integer_token_idx = 0;
+        if (src[2] >= '1' && src[2] <= '9')
+        {
+          if (src[3] != '[')
+            goto _invalid_token;
+          integer_token_idx = src[2] - '1';
+
+          src += 1;
+        }
+        else if (src[2] != '[')
           goto _invalid_token;
-        assert(integer_token_defined);
+
+        assert(integer_tokens_defined[integer_token_idx]);
         src += 3; // ^L[
 
         auto ending1 = src;
@@ -1213,7 +1224,7 @@
         char *actual_ending = nullptr;
         int   actual_ending_len = 0;
 
-        int modulo = abs(integer_token) % 10;
+        int modulo = abs(integer_tokens[integer_token_idx]) % 10;
         if (modulo == 1)
         {
           actual_ending = ending1;