Mercurial > mm7
comparison UI/Books/UISpellBook.cpp @ 1402:a519a6a412d0
CloseSpellBook and close SpellBookPage
author | Ritor1 |
---|---|
date | Fri, 19 Jul 2013 17:21:40 +0600 |
parents | 3161094869e0 |
children | 7cc3b01a92ac |
comparison
equal
deleted
inserted
replaced
1401:3161094869e0 | 1402:a519a6a412d0 |
---|---|
22 | 22 |
23 std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak | 23 std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak |
24 | 24 |
25 //----- (00411300) -------------------------------------------------------- | 25 //----- (00411300) -------------------------------------------------------- |
26 void LoadSpellbook(unsigned int spell_school) | 26 void LoadSpellbook(unsigned int spell_school) |
27 { | |
28 char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 | |
29 | |
30 byte_506550 = 0; | |
31 if ( pPlayers[uActiveCharacter]->uQuickSpell && (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 == spell_school ) | |
32 quick_spell_at_page = (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell - 11 * spell_school; | |
33 else | |
34 quick_spell_at_page = 0; | |
35 | |
36 for (uint i = 1; i <= 11; ++i) | |
37 { | |
38 if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) | |
27 { | 39 { |
28 //unsigned int v1; // esi@1 | 40 sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); |
29 Player *pPlayer; // ecx@1 | 41 SBPageSSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); |
30 char v3; // al@1 | |
31 //int v4; // edi@5 | |
32 //Texture *result; // eax@6 | |
33 //unsigned char *v6; // edi@7 | |
34 //unsigned int v7; // eax@7 | |
35 //unsigned __int8 v8; // sf@8 | |
36 //unsigned __int8 v9; // of@8 | |
37 char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 | |
38 //Texture *v11; // [sp+20h] [bp-8h]@5 | |
39 //int v12; // [sp+24h] [bp-4h]@5 | |
40 | 42 |
41 byte_506550 = 0; | 43 sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); |
42 //v1 = uID; | 44 SBPageCSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); |
43 pPlayer = pPlayers[uActiveCharacter]; | |
44 v3 = pPlayer->uQuickSpell; | |
45 if ( v3 && (unsigned __int8)v3 / 11 == spell_school ) | |
46 quick_spell_at_page = (unsigned __int8)v3 - 11 * spell_school; | |
47 else | |
48 quick_spell_at_page = 0; | |
49 | |
50 for (uint i = 1; i < 12; ++i) | |
51 { | |
52 if (pPlayer->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) | |
53 { | |
54 sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); | |
55 dword_506408[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | |
56 | |
57 sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); | |
58 dword_5063D8[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | |
59 } | |
60 } | |
61 } | 45 } |
46 } | |
47 } | |
62 | 48 |
63 | 49 |
64 | 50 |
65 //----- (00411597) -------------------------------------------------------- | 51 //----- (00411597) -------------------------------------------------------- |
66 void OnCloseSpellBook() | 52 void OnCloseBook() |
67 { | 53 { |
68 pAllocator->FreeChunk(pSpellFont); | 54 pAllocator->FreeChunk(pSpellFont); |
69 pSpellFont = nullptr; | 55 pSpellFont = nullptr; |
70 pAllocator->FreeChunk(pBookFont); | 56 pAllocator->FreeChunk(pBookFont); |
71 pBookFont = nullptr; | 57 pBookFont = nullptr; |
88 | 74 |
89 v0 = 0; | 75 v0 = 0; |
90 if ( uActiveCharacter ) | 76 if ( uActiveCharacter ) |
91 v0 = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2); | 77 v0 = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2); |
92 pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[v0]); | 78 pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[v0]); |
93 pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C); | 79 pRenderer->DrawTextureIndexed(476, 450, pSBQuickSpellBtnTextr); |
94 pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448); | 80 pRenderer->DrawTextureIndexed(561, 450, pSpellBookCloseBtnTextr); |
95 } | 81 } |
96 | |
97 | |
98 | |
99 | |
100 | 82 |
101 //----- (00412B58) -------------------------------------------------------- | 83 //----- (00412B58) -------------------------------------------------------- |
102 void DrawSpellBookContent(Player *player) | 84 void DrawSpellBookContent(Player *player) |
103 { | 85 { |
104 //Player *v0; // ebx@1 | 86 Texture *PendingTexture; // edi@1 |
105 int v1; // ebp@1 | 87 Texture *pTexture; // edx@5 |
106 //unsigned int v2; // eax@1 | |
107 Texture *v3; // edi@1 | |
108 int v4; // esi@1 | |
109 Texture *v5; // eax@3 | |
110 Texture *v6; // edx@5 | |
111 int v7; // eax@8 | |
112 int v8; // eax@11 | |
113 //POINT *v9; // esi@13 | |
114 int v10; // eax@13 | 88 int v10; // eax@13 |
115 Texture *v11; // edx@14 | 89 unsigned int pX_coord; // esi@18 |
116 int v12; // eax@15 | 90 unsigned int pY_coord; // edi@18 |
117 signed int v13; // ecx@18 | |
118 unsigned int v14; // esi@18 | |
119 unsigned int v15; // edi@18 | |
120 Texture *pPageTexture; // eax@21 | 91 Texture *pPageTexture; // eax@21 |
121 unsigned int v17; // [sp-Ch] [bp-2Ch]@8 | |
122 unsigned int v18; // [sp-Ch] [bp-2Ch]@15 | |
123 unsigned int v19; // [sp-8h] [bp-28h]@8 | |
124 unsigned int v20; // [sp-8h] [bp-28h]@15 | |
125 Texture *v21; // [sp-4h] [bp-24h]@15 | |
126 signed int v22; // [sp-4h] [bp-24h]@22 | 92 signed int v22; // [sp-4h] [bp-24h]@22 |
127 Texture *v23; // [sp+10h] [bp-10h]@5 | |
128 POINT a2; // [sp+18h] [bp-8h]@13 | 93 POINT a2; // [sp+18h] [bp-8h]@13 |
129 //POINT v24; | |
130 int v25; | |
131 | 94 |
132 static unsigned int texture_tab_coord1[9][2]= | 95 static unsigned int texture_tab_coord1[9][2]= |
133 {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} }; | 96 {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} }; |
134 | 97 |
135 static unsigned int texture_tab_coord0[9][2]= | 98 static unsigned int texture_tab_coord0[9][2]= |
136 {{415, 10}, {415, 46}, {415, 83}, {415,121}, {415,158}, {416, 196}, {416, 234}, {416, 271}, {416,307} }; | 99 {{415, 10}, {415, 46}, {415, 83}, {415,121}, {415,158}, {416, 196}, {416, 234}, {416, 271}, {416,307} }; |
137 | 100 |
138 BookUI_Spellbook_DrawCurrentSchoolBackground(); | 101 BookUI_Spellbook_DrawCurrentSchoolBackground(); |
139 | 102 |
140 //v0 = pPlayers[uActiveCharacter]; | 103 PendingTexture = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); |
141 v1 = 11 * player->lastOpenedSpellbookPage; | |
142 //v2 = pIcons_LOD->FindTextureByName("Pending"); | |
143 v3 = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); | |
144 pRenderer->ClearZBuffer(0, 479); | 104 pRenderer->ClearZBuffer(0, 479); |
145 v4 = 1; | 105 if ( (11 * player->lastOpenedSpellbookPage) || ((11 * player->lastOpenedSpellbookPage) + 11) )//??? maybe structure need fix |
146 //if ( __OFSUB__(v1, v1 + 11) ^ 1 ) | |
147 { | 106 { |
148 do | 107 for ( uint i = 1; i <= 11; ++i ) |
149 { | 108 { |
150 if (player->_guilds_member_bits[v1 + v4 + 63] ) | 109 if (player->_guilds_member_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] ) |
151 { | 110 { |
152 v5 = (Texture *)dword_506408[v4]; | 111 if ( SBPageSSpellsTextureList[i] != PendingTexture ) |
153 if ( v5 != v3 ) | |
154 { | 112 { |
155 if ( quick_spell_at_page == v4 ) | 113 if ( quick_spell_at_page == i ) |
114 pTexture = SBPageCSpellsTextureList[i]; | |
115 else | |
116 pTexture = SBPageSSpellsTextureList[i]; | |
117 if ( pTexture->pLevelOfDetail0_prolly_alpha_mask ) | |
156 { | 118 { |
157 v6 = dword_5063D8[v4]; | 119 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos; |
158 v23 = dword_5063D8[v4]; | 120 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos; |
159 } | 121 if ( BYTE1(pTexture->pBits) & 2 ) |
160 else | 122 pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pTexture); |
161 { | |
162 v23 = dword_506408[v4]; | |
163 v6 = v5; | |
164 } | |
165 if ( v6->pLevelOfDetail0_prolly_alpha_mask ) | |
166 { | |
167 v7 = player->lastOpenedSpellbookPage; | |
168 // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); | |
169 v19 = pViewport->uViewportTL_Y + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos; | |
170 v17 = pViewport->uViewportTL_X + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos; | |
171 if ( BYTE1(v6->pBits) & 2 ) | |
172 pRenderer->DrawTextureTransparent(v17, v19, v6); | |
173 else | 123 else |
174 pRenderer->DrawTextureIndexed(v17, v19, v6); | 124 pRenderer->DrawTextureIndexed(pX_coord, pY_coord, pTexture); |
175 pRenderer->DrawMaskToZBuffer(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos, | 125 pRenderer->DrawMaskToZBuffer(pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos, |
176 pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4); | 126 pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos, pTexture, i); |
177 } | 127 } |
178 } | 128 } |
179 } | 129 } |
180 ++v4; | |
181 } | 130 } |
182 while ( v4 - 1 < 11 ); | |
183 } | 131 } |
184 | 132 |
185 /*v9 = */pMouse->GetCursorPos(&a2); | 133 pMouse->GetCursorPos(&a2); |
186 v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; | 134 v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; |
187 if ( v10 ) | 135 if ( v10 ) |
188 { | 136 { |
189 v11 = dword_5063D8[v10]; | 137 if ( SBPageCSpellsTextureList[v10]->pLevelOfDetail0_prolly_alpha_mask ) |
190 if ( v11->pLevelOfDetail0_prolly_alpha_mask ) | |
191 { | 138 { |
192 v21 = dword_5063D8[v10]; | 139 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Xpos; |
193 v12 = player->lastOpenedSpellbookPage; | 140 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Ypos; |
194 // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); | 141 if ( BYTE1(SBPageCSpellsTextureList[v10]->pBits) & 2 ) |
195 v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos; | 142 pRenderer->DrawTextureTransparent(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); |
196 v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos; | |
197 if ( BYTE1(v11->pBits) & 2 ) | |
198 pRenderer->DrawTextureTransparent(v18, v20, v21); | |
199 else | 143 else |
200 pRenderer->DrawTextureIndexed(v18, v20, v21); | 144 pRenderer->DrawTextureIndexed(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); |
201 } | 145 } |
202 } | 146 } |
203 v13 = 0; | 147 pX_coord = (unsigned int)&player->pActiveSkills[12]; |
204 a2.x = (LONG)&player->pActiveSkills[12]; | 148 pY_coord = (unsigned int)&player->pActiveSkills[12]; |
205 v14 = (unsigned int)&player->pActiveSkills[12]; | 149 for ( uint i = 0; i < 9; i++ ) |
206 v15 = (unsigned int)&player->pActiveSkills[12]; | |
207 v25 = 0; | |
208 do | |
209 { | 150 { |
210 if ( *(short *)a2.x ) | 151 if ( player->pActiveSkills[12 + i] ) |
211 { | 152 { |
212 if ( player->lastOpenedSpellbookPage == v13 ) | 153 if ( player->lastOpenedSpellbookPage == i ) |
213 { | 154 { |
214 pPageTexture = pTextures_tabs[v13][1]; | 155 pPageTexture = pTextures_tabs[i][1]; |
215 v14=texture_tab_coord1[v13][0]; | 156 pX_coord = texture_tab_coord1[i][0]; |
216 v15=texture_tab_coord1[v13][1]; | 157 pY_coord = texture_tab_coord1[i][1]; |
217 } | 158 } |
218 else | 159 else |
219 { | 160 { |
220 pPageTexture = pTextures_tabs[v13][0]; | 161 pPageTexture = pTextures_tabs[i][0]; |
221 v14=texture_tab_coord0[v13][0]; | 162 pX_coord = texture_tab_coord0[i][0]; |
222 v15=texture_tab_coord0[v13][1]; | 163 pY_coord = texture_tab_coord0[i][1]; |
223 } | 164 } |
224 pRenderer->DrawTextureTransparent(v14, v15, pPageTexture); | 165 pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pPageTexture); |
225 v13 = v25; | |
226 } | 166 } |
227 a2.x += 2; | |
228 ++v13; | |
229 v25 = v13; | |
230 } | 167 } |
231 while ( v13 < 9 ); | |
232 } | 168 } |