Mercurial > mm7
annotate GUI/UI/Chest.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
rev | line source |
---|---|
2550 | 1 #include "Engine/Engine.h" |
2 #include "Engine/Timer.h" | |
3 #include "Engine/LOD.h" | |
4 #include "Engine/texts.h" | |
5 #include "Engine/Graphics/IRender.h" | |
6 #include "Engine/Objects/Chest.h" | |
7 | |
8 #include "GUI/UI/Chest.h" | |
9 | |
10 | |
11 | |
12 int pChestPixelOffsetX[8] = { 42, 18, 18, 42, 42, 42, 18, 42 }; | |
13 int pChestPixelOffsetY[8] = { 34, 30, 30, 34, 34, 34, 30, 34 }; | |
14 int pChestWidthsByType[8] = { 9, 9, 9, 9, 9, 9, 9, 9 }; | |
15 int pChestHeightsByType[8] = { 9, 9, 9, 9, 9, 9, 9, 9 }; | |
16 | |
17 | |
18 | |
19 GUIWindow_Chest::GUIWindow_Chest(unsigned int chest_id) : | |
20 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), chest_id, nullptr) | |
21 { | |
22 // -------------------------------------- | |
23 // 0041C432 GUIWindow::GUIWindow --- part | |
24 CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
25 CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
26 CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
27 CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
28 CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "", 0); | |
29 | |
30 // -------------------------------------------------------- | |
31 // 0042041E bool Chest::Open( signed int uChestID ) -- part | |
2574 | 32 pBtn_ExitCancel = CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], ui_exit_cancel_button_background, 0);// Exit |
2550 | 33 CreateButton(7, 8, 460, 343, 1, 0, UIMSG_CHEST_ClickItem, 0, 0, "", 0); |
34 current_screen_type = SCREEN_CHEST; | |
35 pEventTimer->Pause(); | |
36 } | |
37 | |
38 | |
39 | |
40 void GUIWindow_Chest::Update() | |
41 { | |
42 // ----------------------------------- | |
43 // 004156F0 GUI_UpdateWindows --- part | |
44 if (current_screen_type == SCREEN_CHEST_INVENTORY) | |
45 { | |
46 pRenderer->ClearZBuffer(0, 479); | |
47 draw_leather(); | |
48 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2550
diff
changeset
|
49 pRenderer->DrawTextureAlphaNew(pBtn_ExitCancel->uX/640.0f, pBtn_ExitCancel->uY/480.0f, ui_exit_cancel_button_background); |
2550 | 50 } |
51 else if (current_screen_type == SCREEN_CHEST) | |
52 { | |
53 //Chest::DrawChestUI(par1C); | |
54 | |
55 // ----------------------------------------------------- | |
56 // 0042092D void Chest::DrawChestUI(signed int uChestID) | |
57 auto uChestID = (unsigned int)ptr_1C; | |
58 | |
59 int chestBitmapId; // eax@1 | |
2575 | 60 //Image *v5; // eax@1 |
2550 | 61 int chest_item_index; // ecx@3 |
2575 | 62 //unsigned int item_texture_id; // eax@4 |
63 //Texture_MM7 *item_texture; // esi@4 | |
2550 | 64 signed int itemPixelWidth; // ecx@4 |
65 signed int itemPixelHeght; // edx@4 | |
66 // signed int v11; // eax@4 | |
67 int v12; // eax@6 | |
68 int v13; // eax@6 | |
69 unsigned int itemPixelPosX; // ST34_4@8 | |
70 int itemPixelPosY; // edi@8 | |
71 int *v16; // [sp+Ch] [bp-28h]@1 | |
72 // int v17; // [sp+10h] [bp-24h]@4 | |
73 int chest_offs_y; // [sp+14h] [bp-20h]@1 | |
74 signed int chestHeghtCells; // [sp+18h] [bp-1Ch]@1 | |
75 int chest_offs_x; // [sp+1Ch] [bp-18h]@1 | |
76 signed int chestWidthCells; // [sp+20h] [bp-14h]@1 | |
77 signed int item_counter; // [sp+30h] [bp-4h]@1 | |
78 | |
79 v16 = pRenderer->pActiveZBuffer; | |
80 pRenderer->ClearZBuffer(0, 479); | |
81 chestBitmapId = pChests[uChestID].uChestBitmapID; | |
82 chest_offs_x = pChestPixelOffsetX[chestBitmapId]; | |
83 chest_offs_y = pChestPixelOffsetY[chestBitmapId]; | |
84 chestWidthCells = pChestWidthsByType[chestBitmapId]; | |
85 chestHeghtCells = pChestHeightsByType[chestBitmapId]; | |
86 sprintfex(pTmpBuf.data(), "chest%02d", pChestList->pChests[chestBitmapId].uTextureID); | |
2575 | 87 |
88 //v5 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); | |
89 auto chest_background = assets->GetImage_16BitColorKey(pTmpBuf.data(), 0x7FF); | |
90 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, chest_background); | |
2550 | 91 |
92 for (item_counter = 0; item_counter < chestWidthCells * chestHeghtCells; ++item_counter) | |
93 { | |
94 chest_item_index = pChests[uChestID].pInventoryIndices[item_counter]; | |
95 if (chest_item_index > 0) | |
96 { | |
2575 | 97 //item_texture_id = pIcons_LOD->LoadTexture( |
98 // //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, | |
99 // pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), TEXTURE_16BIT_PALETTE); | |
100 //item_texture = pIcons_LOD->GetTexture(item_texture_id); | |
101 //itemPixelWidth = item_texture->uTextureWidth; | |
102 //itemPixelHeght = item_texture->uTextureHeight; | |
103 auto item_texture = assets->GetImage_16BitColorKey(pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), 0x7FF); | |
104 itemPixelWidth = item_texture->GetWidth(); | |
105 itemPixelHeght = item_texture->GetHeight(); | |
106 | |
2550 | 107 if (itemPixelWidth < 14) |
108 itemPixelWidth = 14; | |
109 v12 = itemPixelWidth - 14; | |
110 v12 = v12 & 0xFFFFFFE0; | |
111 v13 = v12 + 32; | |
112 if (itemPixelHeght < 14) | |
113 itemPixelHeght = 14; | |
114 itemPixelPosX = chest_offs_x + 32 * (item_counter % chestWidthCells) + ((signed int)(v13 - itemPixelWidth) / 2); | |
115 itemPixelPosY = chest_offs_y + 32 * (item_counter / chestHeghtCells) + | |
2575 | 116 ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32 - item_texture->GetHeight()) / 2); |
117 pRenderer->DrawTextureAlphaNew(itemPixelPosX/640.0f, itemPixelPosY/480.0f, item_texture); | |
118 //ZBuffer_DoFill2(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1); | |
2550 | 119 } |
120 } | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2550
diff
changeset
|
121 pRenderer->DrawTextureAlphaNew(pBtn_ExitCancel->uX/640.0f, pBtn_ExitCancel->uY/480.0f, ui_exit_cancel_button_background); |
2550 | 122 } |
123 } |