World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Класс GUIWindow_Chest

#include <UIChest.h>

+ Граф наследования:GUIWindow_Chest:
+ Граф связей класса GUIWindow_Chest:

Открытые члены

 GUIWindow_Chest (unsigned int chest_id)
 
virtual ~GUIWindow_Chest ()
 
virtual void Update ()
 
- Открытые члены унаследованные от GUIWindow
 GUIWindow ()
 
 GUIWindow (WindowType windowType, unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int pButton, const String &hint=String())
 
virtual ~GUIWindow ()
 
GUIButtonCreateButton (int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
 
bool Contains (unsigned int x, unsigned int y)
 
void DrawFlashingInputCursor (int uX, int uY, GUIFont *a2)
 
int DrawTextInRect (GUIFont *font, unsigned int x, unsigned int y, unsigned int color, const char *text, int rect_width, int reverse_text)
 
int DrawTextInRect (GUIFont *font, unsigned int x, unsigned int y, unsigned int color, String &str, int rect_width, int reverse_text)
 
void DrawText (GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
 
void DrawText (GUIFont *font, int x, int y, unsigned short uFontColor, const String &str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
 
void DrawTitleText (GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const char *pInString, int line_spacing)
 
void DrawTitleText (GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const String &str, int line_spacing)
 
void DrawShops_next_generation_time_string (GameTime time)
 
void HouseDialogManager ()
 
void DrawMessageBox (bool inside_game_viewport)
 
GUIButtonGetControl (unsigned int uID)
 
void _41D08F_set_keyboard_control_group (int num_buttons, int a3, int a4, int a5)
 
void _41D73D_draw_buff_tooltip ()
 
virtual void Release ()
 
void DeleteButtons ()
 

Дополнительные унаследованные члены

- Открытые статические члены унаследованные от GUIWindow
static void InitializeGUI ()
 
- Открытые атрибуты унаследованные от GUIWindow
unsigned int uFrameX
 
unsigned int uFrameY
 
unsigned int uFrameWidth
 
unsigned int uFrameHeight
 
unsigned int uFrameZ
 
unsigned int uFrameW
 
WindowType eWindowType
 
union {
   void *   ptr_1C
 
   unsigned int   par1C
 
}; 
 
int field_24
 
int pNumPresenceButton
 
int pCurrentPosActiveItem
 
int field_30
 
int field_34
 
int pStartingPosActiveItem
 
int receives_keyboard_input_2
 
bool receives_keyboard_input
 
String sHint
 
std::vector< GUIButton * > vButtons
 
Mousemouse = nullptr
 
Loglog = nullptr
 

Подробное описание

См. определение в файле UIChest.h строка 10

Конструктор(ы)

◆ GUIWindow_Chest()

GUIWindow_Chest::GUIWindow_Chest ( unsigned int  chest_id)
explicit

См. определение в файле UIChest.cpp строка 20

21  : GUIWindow(WINDOW_Chest, 0, 0, window->GetWidth(), window->GetHeight(), chest_id) {
22  CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "");
23  CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "");
24  CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "");
25  CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "");
26  CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "");
27 
29  CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
31  {{ui_exit_cancel_button_background}}); // Exit
32  CreateButton(7, 8, 460, 343, 1, 0, UIMSG_CHEST_ClickItem, 0, 0, "");
34  pEventTimer->Pause();
35 }

Перекрестные ссылки GUIWindow::CreateButton(), Localization::GetString(), localization, pBtn_ExitCancel, UIMSG_CycleCharacters, UIMSG_Escape и UIMSG_SelectCharacter.

+ Граф вызовов:

◆ ~GUIWindow_Chest()

virtual GUIWindow_Chest::~GUIWindow_Chest ( )
inlinevirtual

См. определение в файле UIChest.h строка 13

13 {}

Методы

◆ Update()

void GUIWindow_Chest::Update ( )
virtual

Переопределяет метод предка GUIWindow.

См. определение в файле UIChest.cpp строка 37

37  {
39  render->ClearZBuffer(0, 479);
40  draw_leather();
42  render->DrawTextureAlphaNew(pBtn_ExitCancel->uX / 640.0f,
43  pBtn_ExitCancel->uY / 480.0f,
46  auto uChestID = (unsigned int)ptr_1C;
47 
48  int *v16 = render->pActiveZBuffer;
49  render->ClearZBuffer(0, 479);
50  int chestBitmapId = vChests[uChestID].uChestBitmapID;
51  int chest_offs_x = pChestPixelOffsetX[chestBitmapId];
52  int chest_offs_y = pChestPixelOffsetY[chestBitmapId];
53  int chestWidthCells = pChestWidthsByType[chestBitmapId];
54  int chestHeghtCells = pChestHeightsByType[chestBitmapId];
55 
56  Image *chest_background = assets->GetImage_ColorKey(
57  StringPrintf("chest%02d", pChestList->vChests[chestBitmapId].uTextureID), 0x7FF);
58  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, chest_background);
59 
60  for (int item_counter = 0;
61  item_counter < chestWidthCells * chestHeghtCells; ++item_counter) {
62  int chest_item_index = vChests[uChestID].pInventoryIndices[item_counter];
63  if (chest_item_index > 0) {
64  auto item_texture = assets->GetImage_ColorKey(
65  vChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(),
66  0x7FF);
67 
68  int itemPixelWidth = item_texture->GetWidth();
69  int itemPixelHeght = item_texture->GetHeight();
70  if (itemPixelWidth < 14) itemPixelWidth = 14;
71  if (itemPixelHeght < 14) itemPixelHeght = 14;
72  signed int X_offset = (((signed int)((itemPixelWidth - 14) & 0xFFFFFFE0) + 32) - itemPixelWidth) / 2;
73  signed int Y_offset = (((signed int)((itemPixelHeght - 14) & 0xFFFFFFE0) + 32) - itemPixelHeght) / 2;
74  int itemPixelPosX = chest_offs_x + 32 * (item_counter % chestWidthCells) + X_offset;
75  int itemPixelPosY = chest_offs_y + 32 * (item_counter / chestHeghtCells) + Y_offset;
76  render->DrawTextureAlphaNew(itemPixelPosX / 640.0f,
77  itemPixelPosY / 480.0f,
78  item_texture);
79  // ZBuffer_DoFill2(&v16[itemPixelPosX +
80  // pSRZBufferLineOffsets[itemPixelPosY]], item_texture,
81  // item_counter + 1);
82  }
83  }
84  render->DrawTextureAlphaNew(pBtn_ExitCancel->uX / 640.0f,
85  pBtn_ExitCancel->uY / 480.0f,
87  }
88 }

Перекрестные ссылки assets, CharacterUI_InventoryTab_Draw(), current_screen_type, draw_leather(), AssetsManager::GetImage_ColorKey(), Image::GetWidth(), pBtn_ExitCancel, pChestHeightsByType, pChestList, pChestPixelOffsetX, pChestPixelOffsetY, pChestWidthsByType, pPlayers, GUIWindow::ptr_1C, render, SCREEN_CHEST, SCREEN_CHEST_INVENTORY, StringPrintf(), uActiveCharacter, ui_exit_cancel_button_background, GUIButton::uX, GUIButton::uY, ChestList::vChests и vChests.

+ Граф вызовов:

Объявления и описания членов классов находятся в файлах:
pChestList
ChestList * pChestList
Definition: Chest.cpp:38
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
pChestPixelOffsetY
int pChestPixelOffsetY[8]
Definition: UIChest.cpp:16
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
UIMSG_CycleCharacters
@ UIMSG_CycleCharacters
Definition: GUIWindow.h:143
ui_exit_cancel_button_background
Image * ui_exit_cancel_button_background
Definition: GUIWindow.cpp:89
GUIWindow::CreateButton
GUIButton * CreateButton(int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
Definition: GUIWindow.cpp:717
CURRENT_SCREEN::SCREEN_CHEST
@ SCREEN_CHEST
pChestPixelOffsetX
int pChestPixelOffsetX[8]
Definition: UIChest.cpp:15
GUIWindow::GUIWindow
GUIWindow()
Definition: GUIWindow.cpp:765
localization
Localization * localization
Definition: Localization.cpp:11
UIMSG_SelectCharacter
@ UIMSG_SelectCharacter
Definition: GUIWindow.h:93
pChestWidthsByType
int pChestWidthsByType[8]
Definition: UIChest.cpp:17
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
CharacterUI_InventoryTab_Draw
void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
Definition: UICharacter.cpp:1829
Image::GetWidth
unsigned int GetWidth()
Definition: Image.cpp:217
pBtn_ExitCancel
GUIButton * pBtn_ExitCancel
Definition: GUIButton.cpp:28
Image
Definition: Image.h:19
WINDOW_Chest
@ WINDOW_Chest
Definition: GUIWindow.h:305
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
UIMSG_CHEST_ClickItem
@ UIMSG_CHEST_ClickItem
Definition: GUIWindow.h:20
Timer::Pause
void Pause()
Definition: Time.cpp:19
GUIButton::uX
unsigned int uX
Definition: GUIButton.h:21
vChests
std::vector< Chest > vChests
Definition: Chest.cpp:39
draw_leather
void draw_leather()
Definition: UICharacter.cpp:925
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
pChestHeightsByType
int pChestHeightsByType[8]
Definition: UIChest.cpp:18
GUIButton::uY
unsigned int uY
Definition: GUIButton.h:22
GUIWindow::ptr_1C
void * ptr_1C
Definition: GUIWindow.h:476
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
CURRENT_SCREEN::SCREEN_CHEST_INVENTORY
@ SCREEN_CHEST_INVENTORY
ChestList::vChests
std::vector< ChestDesc > vChests
Definition: Chest.h:30
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52