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