diff UI/UIBooks.cpp @ 1310:0665a061132b

autonotes and quest tables overflow fixed
author Gloval
date Mon, 24 Jun 2013 23:55:02 +0400
parents 8c2f689b5f0b
children ae435824ac4d
line wrap: on
line diff
--- a/UI/UIBooks.cpp	Mon Jun 24 21:05:10 2013 +0600
+++ b/UI/UIBooks.cpp	Mon Jun 24 23:55:02 2013 +0400
@@ -7,7 +7,7 @@
 #include "..\MM7.h"
 
 #include "..\Mouse.h"
-
+#include "UIBooks.h"
 #include "..\MapInfo.h"
 #include "..\GUIWindow.h"
 #include "..\GUIFont.h"
@@ -27,8 +27,19 @@
 
 
 
+std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak
+//__int16 word_4E1D3A[777]; // weak
+std::array<__int16, 6> pTownPortalBook_xs = {{260, 324, 147, 385, 390,  19}};
+std::array<__int16, 6> pTownPortalBook_ys = {{206,  84, 182, 239,  17, 283}};
+std::array<__int16, 6> pTownPortalBook_ws = {{ 80,  66,  68,  72,  67,  74}};
+std::array<__int16, 6> pTownPortalBook_hs = {{ 55,  56,  65,  67,  67,  59}};
 
 
+std::array<unsigned int, 5> pLloydsBeaconsPreviewXs = {{61, 281,  61, 281, 171}}; // 004E249C
+std::array<unsigned int, 5> pLloydsBeaconsPreviewYs = {{84,  84, 228, 228, 155}};
+std::array<unsigned int, 5> pLloydsBeacons_SomeXs = {{59, 279, 59, 279, 169}};
+std::array<unsigned int, 5> pLloydsBeacons_SomeYs = {{82, 82, 226, 226, 153}};
+
 
 
 //----- (00411150) --------------------------------------------------------
@@ -664,8 +675,8 @@
   {
     v4 = achieved_awards[v3];
     ++num_achieved_awards;
-    v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4];
-    a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0);
+    v5 = pQuestTable[v4];//(&dword_722F10)[4 * v4];
+    a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0);
     v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0);
     v7 = a1.uFrameY + v6;
     if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight )
@@ -913,10 +924,10 @@
     do
     {
       //if ( dword_72371C[2 * v8] == dword_506568 )
-	  if ( pAutonoteTxt[v8-1].eType == _506568_autonote_type )
+	  if ( pAutonoteTxt[v8].eType == _506568_autonote_type )
       {
         //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8];
-		v32 = (char *)pAutonoteTxt[v8-1].pText;
+		v32 = (char *)pAutonoteTxt[v8].pText;
         if ( (short)v8 )
         {
           if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 )
@@ -971,9 +982,9 @@
     v13 = achieved_awards[v12];
     ++num_achieved_awards;
     //v14 = (&dword_723718_autonote_related)[8 * v13];
-	v14 = pAutonoteTxt[v13-1].pText;
+	v14 = pAutonoteTxt[v13].pText;
     //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0);
-	a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13-1].pText, 0, 0, 0);
+	a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13].pText, 0, 0, 0);
     v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0);
     v16 = a1.uFrameY + v15;
     if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight )
@@ -1259,15 +1270,15 @@
 
 
         teal =               (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16;
-        v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
+      //  v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
 
-        v32 = map_texture_16;
+     //   v32 = map_texture_16;
         textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
         stepY_r =            (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16;
-        v81 =   (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
+     //   v81 =   (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
         black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
 
-        v76 = textr_width;
+      //  v76 = textr_width;
         scaled_posY = stepY_r >> 16;
         //nearest neiborhood scaling
         if ( texture8_data)