# HG changeset patch # User Gloval # Date 1361442360 -14400 # Node ID b07cf89108d51865bdb527a272a0abbbe3f562cb # Parent b9aff98467e3a0905f07ad11aadf1478af2434d6 Spell positions in book diff -r b9aff98467e3 -r b07cf89108d5 GUIWindow.cpp --- a/GUIWindow.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/GUIWindow.cpp Thu Feb 21 14:26:00 2013 +0400 @@ -986,9 +986,9 @@ if (!chapter->bIsSpellAvailable[i]) continue; - v4 = 2 * (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); - CreateButton(pViewport->uViewportX + dword_4E20D0[v4], - pViewport->uViewportY + dword_4E20D0[v4 + 1], + v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); + CreateButton(pViewport->uViewportX + pIconPos[v4].Xpos, + pViewport->uViewportY + pIconPos[v4].Ypos, //dword_4E20D0 dword_506408[i + 1]->uTextureWidth, dword_506408[i + 1]->uTextureHeight, 1, 79, 0x56u, i, 0, "", 0); diff -r b9aff98467e3 -r b07cf89108d5 Spells.cpp --- a/Spells.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/Spells.cpp Thu Feb 21 14:26:00 2013 +0400 @@ -121,8 +121,136 @@ {60, 60, 60, 60, 300, 300, 300, 300, 2073, 0} }; + unsigned char pSpellbookSpellIndices[9][12] = // 4E2430 + { + {0, 3, 1, 8, 11, 7, 4, 10, 6, 2, 5, 9}, + {0, 11, 2, 9, 6, 8, 5, 10, 3, 7, 1, 4}, + {0, 4, 8, 9, 1, 10, 3, 11, 7, 6, 2, 5}, + {0, 7, 10, 8, 2, 11, 1, 5, 3, 6, 4, 9}, + {0, 5, 10, 11, 7, 2, 8, 1, 4, 9, 3, 6}, + {0, 5, 9, 8, 3, 7, 6, 4, 1, 11, 2, 10}, + {0, 1, 6, 9, 3, 5, 8, 11, 7, 10, 4, 2}, + {0, 1, 10, 11, 9, 4, 3, 6, 5, 7, 8, 2}, + {0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4} + }; + struct SpellBookIconPos pIconPos[108]={ + {0, 0}, + {17, 13}, + {115, 2}, + {217, 15}, + {299, 6}, + {28, 125}, + {130, 133}, + {294, 114}, + {11, 232}, + {134, 233}, + {237, 171}, + {296, 231}, + {0, 0}, + {19, 9}, + {117, 3}, + {206, 13}, + {285, 7}, + {16, 123}, + {113, 101}, + {201, 118}, + {317, 110}, + {11, 230}, + {149, 236}, + {296, 234}, + + {0, 0}, + {17, 9}, + {140, 0}, + {210, 34}, + {293, 5}, + {15, 98}, + {78, 121}, + {175, 136}, + {301, 115}, + {15, 226}, + {154, 225}, + {272, 220}, + + {0, 0}, + {7, 9}, + {156, 2}, + {277, 9}, + {11, 117}, + {111, 82}, + {180, 102}, + {303, 108}, + {10, 229}, + {120, 221}, + {201, 217}, + {296, 225}, + + {0, 0}, + {18, 8}, + {89, 15}, + {192, 14}, + {292, 7}, + {22, 129}, + {125, 146}, + {217, 136}, + {305, 115}, + {22, 226}, + {174, 237}, + {290, 231}, + + {0, 0}, + {18, 12}, + {148, 9}, + {292, 7}, + {17, 122}, + {121, 99}, + {220, 87}, + {293, 112}, + {13, 236}, + {128, 213}, + {220, 223}, + {315, 223}, + + {0, 0}, + {23, 14}, + {127, 8}, + {204, 0}, + {306, 8}, + {14, 115}, + {122, 132}, + {200, 116}, + {293, 122}, + {20, 228}, + {154, 228}, + {294, 239}, + + {0, 0}, + {19, 14}, + {124, 10}, + {283, 12}, + {8, 105}, + {113, 89}, + {190, 82}, + {298, 108}, + {18, 181}, + {101, 204}, + {204, 203}, + {285, 218}, + + {0, 0}, + {18, 17}, + {110, 16}, + {201, 15}, + {307, 15}, + {18, 148}, + {125, 166}, + {201, 123}, + {275, 120}, + {28, 235}, + {217, 222}, + {324, 216} }; //----- (0042EB31) -------------------------------------------------------- diff -r b9aff98467e3 -r b07cf89108d5 Spells.h --- a/Spells.h Thu Feb 21 10:07:51 2013 +0600 +++ b/Spells.h Thu Feb 21 14:26:00 2013 +0400 @@ -142,11 +142,19 @@ }; #pragma pack(pop) +#pragma pack(push, 1) +struct SpellBookIconPos +{ + unsigned int Xpos; + unsigned int Ypos; +}; +#pragma pack(pop) extern struct SpellStats *pSpellStats; +extern struct SpellBookIconPos pIconPos[108]; extern stru324_spell stru_4E3ACC[]; extern SpellData pSpellDatas[100]; \ No newline at end of file diff -r b9aff98467e3 -r b07cf89108d5 mm7_5.cpp --- a/mm7_5.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/mm7_5.cpp Thu Feb 21 14:26:00 2013 +0400 @@ -13668,15 +13668,15 @@ } if ( v6->pLevelOfDetail0 ) { - v7 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - v19 = pViewport->uViewportY + dword_4E20D0[v7 + 1]; - v17 = pViewport->uViewportX + dword_4E20D0[v7]; + v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); + v19 = pViewport->uViewportY + pIconPos[v7].Ypos; + v17 = pViewport->uViewportX + pIconPos[v7].Xpos; if ( BYTE1(v6->pBits) & 2 ) pRenderer->DrawTextureTransparent(v17, v19, v6); else pRenderer->DrawTextureIndexed(v17, v19, v6); - v8 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], v23, v4); + v8 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); + pRenderer->_4A612A(pIconPos[v8].Xpos,pIconPos[v8].Ypos, v23, v4); } } } @@ -13692,9 +13692,9 @@ if ( v11->pLevelOfDetail0 ) { v21 = dword_5063D8[v10]; - v12 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); - v20 = pViewport->uViewportY + dword_4E20D0[v12 + 1]; - v18 = pViewport->uViewportX + dword_4E20D0[v12]; + v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); + v20 = pViewport->uViewportY + pIconPos[v12].Ypos; + v18 = pViewport->uViewportX + pIconPos[v12].Xpos; if ( BYTE1(v11->pBits) & 2 ) pRenderer->DrawTextureTransparent(v18, v20, v21); else diff -r b9aff98467e3 -r b07cf89108d5 mm7_data.cpp --- a/mm7_data.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/mm7_data.cpp Thu Feb 21 14:26:00 2013 +0400 @@ -572,19 +572,8 @@ __int16 pTownPortalBook_ys[6]; __int16 pTownPortalBook_ws[6]; __int16 pTownPortalBook_hs[6]; -int dword_4E20D0[777]; // idb -unsigned char pSpellbookSpellIndices[9][12] = // 4E2430 -{ - {0, 3, 1, 8, 11, 7, 4, 10, 6, 2, 5, 9}, - {0, 11, 2, 9, 6, 8, 5, 10, 3, 7, 1, 4}, - {0, 4, 8, 9, 1, 10, 3, 11, 7, 6, 2, 5}, - {0, 7, 10, 8, 2, 11, 1, 5, 3, 6, 4, 9}, - {0, 5, 10, 11, 7, 2, 8, 1, 4, 9, 3, 6}, - {0, 5, 9, 8, 3, 7, 6, 4, 1, 11, 2, 10}, - {0, 1, 6, 9, 3, 5, 8, 11, 7, 10, 4, 2}, - {0, 1, 10, 11, 9, 4, 3, 6, 5, 7, 8, 2}, - {0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4} -}; + + unsigned int pLloydsBeaconsPreviewXs[5] = {61, 281, 61, 281, 171}; // 004E249C unsigned int pLloydsBeaconsPreviewYs[5] = {84, 84, 228, 228, 155}; unsigned int pLloydsBeacons_SomeXs[5] = {59, 279, 59, 279, 169}; diff -r b9aff98467e3 -r b07cf89108d5 mm7_data.h --- a/mm7_data.h Thu Feb 21 10:07:51 2013 +0600 +++ b/mm7_data.h Thu Feb 21 14:26:00 2013 +0400 @@ -374,7 +374,6 @@ extern __int16 pTownPortalBook_ys[6]; extern __int16 pTownPortalBook_ws[6]; extern __int16 pTownPortalBook_hs[6]; -extern int dword_4E20D0[]; // idb extern unsigned char pSpellbookSpellIndices[9][12]; // 4E2430 extern unsigned int pLloydsBeaconsPreviewXs[5]; // 004E249C extern unsigned int pLloydsBeaconsPreviewYs[5];