comparison 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
comparison
equal deleted inserted replaced
1309:995d2f8ad71b 1310:0665a061132b
5 #include <assert.h> 5 #include <assert.h>
6 6
7 #include "..\MM7.h" 7 #include "..\MM7.h"
8 8
9 #include "..\Mouse.h" 9 #include "..\Mouse.h"
10 10 #include "UIBooks.h"
11 #include "..\MapInfo.h" 11 #include "..\MapInfo.h"
12 #include "..\GUIWindow.h" 12 #include "..\GUIWindow.h"
13 #include "..\GUIFont.h" 13 #include "..\GUIFont.h"
14 #include "..\Party.h" 14 #include "..\Party.h"
15 #include "..\AudioPlayer.h" 15 #include "..\AudioPlayer.h"
25 25
26 #include "..\mm7_data.h" 26 #include "..\mm7_data.h"
27 27
28 28
29 29
30 30 std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak
31 //__int16 word_4E1D3A[777]; // weak
32 std::array<__int16, 6> pTownPortalBook_xs = {{260, 324, 147, 385, 390, 19}};
33 std::array<__int16, 6> pTownPortalBook_ys = {{206, 84, 182, 239, 17, 283}};
34 std::array<__int16, 6> pTownPortalBook_ws = {{ 80, 66, 68, 72, 67, 74}};
35 std::array<__int16, 6> pTownPortalBook_hs = {{ 55, 56, 65, 67, 67, 59}};
36
37
38 std::array<unsigned int, 5> pLloydsBeaconsPreviewXs = {{61, 281, 61, 281, 171}}; // 004E249C
39 std::array<unsigned int, 5> pLloydsBeaconsPreviewYs = {{84, 84, 228, 228, 155}};
40 std::array<unsigned int, 5> pLloydsBeacons_SomeXs = {{59, 279, 59, 279, 169}};
41 std::array<unsigned int, 5> pLloydsBeacons_SomeYs = {{82, 82, 226, 226, 153}};
31 42
32 43
33 44
34 //----- (00411150) -------------------------------------------------------- 45 //----- (00411150) --------------------------------------------------------
35 void BookUI_DrawTownPortalMap() 46 void BookUI_DrawTownPortalMap()
662 num_achieved_awards = 0; 673 num_achieved_awards = 0;
663 while ( v3 < num_achieved_awards_2 ) 674 while ( v3 < num_achieved_awards_2 )
664 { 675 {
665 v4 = achieved_awards[v3]; 676 v4 = achieved_awards[v3];
666 ++num_achieved_awards; 677 ++num_achieved_awards;
667 v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4]; 678 v5 = pQuestTable[v4];//(&dword_722F10)[4 * v4];
668 a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); 679 a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0);
669 v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0); 680 v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0);
670 v7 = a1.uFrameY + v6; 681 v7 = a1.uFrameY + v6;
671 if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight ) 682 if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight )
672 break; 683 break;
673 pRenderer->DrawTextureTransparent(100, v7 + 12, pSpellBookPagesTextr_10); 684 pRenderer->DrawTextureTransparent(100, v7 + 12, pSpellBookPagesTextr_10);
911 num_achieved_awards = 0; 922 num_achieved_awards = 0;
912 v8 = 0; 923 v8 = 0;
913 do 924 do
914 { 925 {
915 //if ( dword_72371C[2 * v8] == dword_506568 ) 926 //if ( dword_72371C[2 * v8] == dword_506568 )
916 if ( pAutonoteTxt[v8-1].eType == _506568_autonote_type ) 927 if ( pAutonoteTxt[v8].eType == _506568_autonote_type )
917 { 928 {
918 //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8]; 929 //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8];
919 v32 = (char *)pAutonoteTxt[v8-1].pText; 930 v32 = (char *)pAutonoteTxt[v8].pText;
920 if ( (short)v8 ) 931 if ( (short)v8 )
921 { 932 {
922 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 ) 933 if ( (unsigned __int16)_449B57_test_bit(pParty->_autonote_bits, v8) && v32 )
923 { 934 {
924 v9 = num_achieved_awards++; 935 v9 = num_achieved_awards++;
969 while ( v12 < num_achieved_awards_2 ) 980 while ( v12 < num_achieved_awards_2 )
970 { 981 {
971 v13 = achieved_awards[v12]; 982 v13 = achieved_awards[v12];
972 ++num_achieved_awards; 983 ++num_achieved_awards;
973 //v14 = (&dword_723718_autonote_related)[8 * v13]; 984 //v14 = (&dword_723718_autonote_related)[8 * v13];
974 v14 = pAutonoteTxt[v13-1].pText; 985 v14 = pAutonoteTxt[v13].pText;
975 //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); 986 //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0);
976 a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13-1].pText, 0, 0, 0); 987 a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13].pText, 0, 0, 0);
977 v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0); 988 v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0);
978 v16 = a1.uFrameY + v15; 989 v16 = a1.uFrameY + v15;
979 if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight ) 990 if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight )
980 break; 991 break;
981 pRenderer->DrawTextureTransparent(0x64u, v16 + 12, pSpellBookPagesTextr_10); 992 pRenderer->DrawTextureTransparent(0x64u, v16 + 12, pSpellBookPagesTextr_10);
1257 1268
1258 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); 1269 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
1259 1270
1260 1271
1261 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; 1272 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16;
1262 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); 1273 // v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
1263 1274
1264 v32 = map_texture_16; 1275 // v32 = map_texture_16;
1265 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; 1276 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
1266 stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16; 1277 stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16;
1267 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); 1278 // v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
1268 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); 1279 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
1269 1280
1270 v76 = textr_width; 1281 // v76 = textr_width;
1271 scaled_posY = stepY_r >> 16; 1282 scaled_posY = stepY_r >> 16;
1272 //nearest neiborhood scaling 1283 //nearest neiborhood scaling
1273 if ( texture8_data) 1284 if ( texture8_data)
1274 { 1285 {
1275 for(uint i=0; i<screenHeight;++i) 1286 for(uint i=0; i<screenHeight;++i)