Mercurial > mm7
annotate UI/Books/UISpellBook.cpp @ 1910:8d3723ca71e6
Actor::GetDirectionInfo changed the signature to a less confusing one
author | Grumpy7 |
---|---|
date | Tue, 22 Oct 2013 00:39:04 -0700 |
parents | 75fafd8ced59 |
children | d28d3c006077 |
rev | line source |
---|---|
1312 | 1 #ifdef _MSC_VER |
2 #define _CRT_SECURE_NO_WARNINGS | |
3 #endif | |
4 | |
5 #include "..\..\MM7.h" | |
6 #include "..\..\Render.h" | |
7 #include "..\..\Mouse.h" | |
8 #include "..\UIBooks.h" | |
9 #include "..\..\GUIWindow.h" | |
10 #include "..\..\GUIFont.h" | |
11 #include "..\..\Party.h" | |
12 #include "..\..\AudioPlayer.h" | |
13 #include "..\..\LOD.h" | |
14 #include "..\..\Viewport.h" | |
15 #include "..\..\texts.h" | |
16 #include "..\..\mm7_data.h" | |
17 | |
18 std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak | |
19 | |
20 //----- (00411300) -------------------------------------------------------- | |
21 void LoadSpellbook(unsigned int spell_school) | |
1402 | 22 { |
23 char pContainer[20]; // [sp+Ch] [bp-1Ch]@7 | |
24 | |
25 byte_506550 = 0; | |
26 if ( pPlayers[uActiveCharacter]->uQuickSpell && (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 == spell_school ) | |
27 quick_spell_at_page = (unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell - 11 * spell_school; | |
28 else | |
29 quick_spell_at_page = 0; | |
1312 | 30 |
1402 | 31 for (uint i = 1; i <= 11; ++i) |
32 { | |
33 if (pPlayers[uActiveCharacter]->spellbook.pChapters[spell_school].bIsSpellAvailable[i - 1]) | |
34 { | |
35 sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); | |
36 SBPageSSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | |
1312 | 37 |
1402 | 38 sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[spell_school], pSpellbookSpellIndices[spell_school][i]); |
39 SBPageCSpellsTextureList[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | |
1312 | 40 } |
1402 | 41 } |
42 } | |
1312 | 43 |
44 //----- (00411597) -------------------------------------------------------- | |
1402 | 45 void OnCloseBook() |
1451 | 46 { |
1583 | 47 free(pSpellFont); |
1451 | 48 pSpellFont = nullptr; |
1583 | 49 free(pBookFont); |
1451 | 50 pBookFont = nullptr; |
1583 | 51 free(pBook2Font); |
1451 | 52 pBook2Font = nullptr; |
1583 | 53 free(pAutonoteFont); |
1451 | 54 pAutonoteFont = nullptr; |
55 pTexture_mapbordr->Release(); | |
56 pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0); | |
57 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
58 dword_506364 = 0; | |
59 } | |
1312 | 60 |
61 //----- (00412AF9) -------------------------------------------------------- | |
62 static void BookUI_Spellbook_DrawCurrentSchoolBackground() | |
63 { | |
1455 | 64 int pTexID = 0; |
1312 | 65 if ( uActiveCharacter ) |
1455 | 66 pTexID = pParty->pPlayers[uActiveCharacter - 1].lastOpenedSpellbookPage; |
67 pRenderer->DrawTextureIndexed(8, 8, pSpellBookPagesTextr[pTexID]); | |
1402 | 68 pRenderer->DrawTextureIndexed(476, 450, pSBQuickSpellBtnTextr); |
69 pRenderer->DrawTextureIndexed(561, 450, pSpellBookCloseBtnTextr); | |
1312 | 70 } |
71 | |
72 //----- (00412B58) -------------------------------------------------------- | |
73 void DrawSpellBookContent(Player *player) | |
74 { | |
1402 | 75 Texture *PendingTexture; // edi@1 |
76 Texture *pTexture; // edx@5 | |
1312 | 77 int v10; // eax@13 |
1402 | 78 unsigned int pX_coord; // esi@18 |
79 unsigned int pY_coord; // edi@18 | |
1312 | 80 Texture *pPageTexture; // eax@21 |
81 signed int v22; // [sp-4h] [bp-24h]@22 | |
82 POINT a2; // [sp+18h] [bp-8h]@13 | |
83 | |
84 static unsigned int texture_tab_coord1[9][2]= | |
85 {{406, 9}, {406, 46}, {406, 84}, {406,121}, {407,158}, {405, 196}, {405, 234}, {405, 272}, {405,309} }; | |
86 | |
87 static unsigned int texture_tab_coord0[9][2]= | |
88 {{415, 10}, {415, 46}, {415, 83}, {415,121}, {415,158}, {416, 196}, {416, 234}, {416, 271}, {416,307} }; | |
89 | |
90 BookUI_Spellbook_DrawCurrentSchoolBackground(); | |
91 | |
1402 | 92 PendingTexture = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending")); |
1312 | 93 pRenderer->ClearZBuffer(0, 479); |
1402 | 94 if ( (11 * player->lastOpenedSpellbookPage) || ((11 * player->lastOpenedSpellbookPage) + 11) )//??? maybe structure need fix |
1312 | 95 { |
1402 | 96 for ( uint i = 1; i <= 11; ++i ) |
1312 | 97 { |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
98 if (player->_achieved_awards_bits[(11 * player->lastOpenedSpellbookPage) + i + 63] ) |
1312 | 99 { |
1402 | 100 if ( SBPageSSpellsTextureList[i] != PendingTexture ) |
1312 | 101 { |
1402 | 102 if ( quick_spell_at_page == i ) |
103 pTexture = SBPageCSpellsTextureList[i]; | |
104 else | |
105 pTexture = SBPageSSpellsTextureList[i]; | |
106 if ( pTexture->pLevelOfDetail0_prolly_alpha_mask ) | |
1312 | 107 { |
1402 | 108 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos; |
109 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos; | |
110 if ( BYTE1(pTexture->pBits) & 2 ) | |
111 pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pTexture); | |
1312 | 112 else |
1402 | 113 pRenderer->DrawTextureIndexed(pX_coord, pY_coord, pTexture); |
114 pRenderer->DrawMaskToZBuffer(pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Xpos, | |
115 pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][i]].Ypos, pTexture, i); | |
1312 | 116 } |
117 } | |
118 } | |
119 } | |
120 } | |
121 | |
1402 | 122 pMouse->GetCursorPos(&a2); |
1397 | 123 v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; |
1312 | 124 if ( v10 ) |
125 { | |
1402 | 126 if ( SBPageCSpellsTextureList[v10]->pLevelOfDetail0_prolly_alpha_mask ) |
1312 | 127 { |
1402 | 128 pX_coord = pViewport->uViewportTL_X + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Xpos; |
129 pY_coord = pViewport->uViewportTL_Y + pIconPos[player->lastOpenedSpellbookPage][pSpellbookSpellIndices[player->lastOpenedSpellbookPage][v10]].Ypos; | |
130 if ( BYTE1(SBPageCSpellsTextureList[v10]->pBits) & 2 ) | |
131 pRenderer->DrawTextureTransparent(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); | |
1312 | 132 else |
1402 | 133 pRenderer->DrawTextureIndexed(pX_coord, pY_coord, SBPageCSpellsTextureList[v10]); |
1312 | 134 } |
135 } | |
1402 | 136 pX_coord = (unsigned int)&player->pActiveSkills[12]; |
137 pY_coord = (unsigned int)&player->pActiveSkills[12]; | |
138 for ( uint i = 0; i < 9; i++ ) | |
1312 | 139 { |
1402 | 140 if ( player->pActiveSkills[12 + i] ) |
1312 | 141 { |
1402 | 142 if ( player->lastOpenedSpellbookPage == i ) |
1312 | 143 { |
1402 | 144 pPageTexture = pTextures_tabs[i][1]; |
145 pX_coord = texture_tab_coord1[i][0]; | |
146 pY_coord = texture_tab_coord1[i][1]; | |
1312 | 147 } |
148 else | |
149 { | |
1402 | 150 pPageTexture = pTextures_tabs[i][0]; |
151 pX_coord = texture_tab_coord0[i][0]; | |
152 pY_coord = texture_tab_coord0[i][1]; | |
1312 | 153 } |
1402 | 154 pRenderer->DrawTextureTransparent(pX_coord, pY_coord, pPageTexture); |
1312 | 155 } |
156 } | |
157 } |