Mercurial > mm7
annotate GUI/UI/UIMainMenu.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 |
---|---|
2501 | 1 #define _CRTDBG_MAP_ALLOC |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
2501 | 3 #include <stdlib.h> |
4 #include <crtdbg.h> | |
5 | |
2541 | 6 #include "Engine/Engine.h" |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
7 #include "Engine/AssetsManager.h" |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
8 #include "Engine/LOD.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
9 #include "Engine/MMT.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
10 #include "Engine/texts.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
11 #include "Engine/Graphics/IRender.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
12 #include "Engine/Graphics/Viewport.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
13 #include "Engine/Graphics/PaletteManager.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
14 #include "Engine/Tables/IconFrameTable.h" |
2501 | 15 |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
16 #include "IO/Mouse.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
17 #include "IO/Keyboard.h" |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
18 |
2574 | 19 #include "GUI/GUIFont.h" |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
20 #include "GUI/UI/UIMainMenu.h" |
2574 | 21 #include "GUI/UI/UIGame.h" |
22 #include "GUI/UI/UIPartyCreation.h" | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
23 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
24 #include "Media/Audio/AudioPlayer.h" |
2501 | 25 |
2541 | 26 #include "Game/Game.h" |
27 #include "Game/MainMenu.h" | |
2501 | 28 |
29 | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
30 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
31 GUIButton *pMainMenu_BtnExit = nullptr; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
32 GUIButton *pMainMenu_BtnCredits = nullptr; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
33 GUIButton *pMainMenu_BtnLoad = nullptr; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
34 GUIButton *pMainMenu_BtnNew = nullptr; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
35 |
2574 | 36 Image *ui_mainmenu_new = nullptr; |
37 Image *ui_mainmenu_load = nullptr; | |
38 Image *ui_mainmenu_credits = nullptr; | |
39 Image *ui_mainmenu_exit = nullptr; | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
40 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
41 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
42 GUIWindow_MainMenu::GUIWindow_MainMenu() : |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
43 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
44 { |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
45 // ----------------------------------- |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
46 // 004627B7 void MainMenu_Loop -- part |
2574 | 47 ui_mainmenu_new = assets->GetImage_16BitColorKey(L"title_new", 0x7FF); |
48 ui_mainmenu_load = assets->GetImage_16BitColorKey(L"title_load", 0x7FF); | |
49 ui_mainmenu_credits = assets->GetImage_16BitColorKey(L"title_cred", 0x7FF); | |
50 ui_mainmenu_exit = assets->GetImage_16BitColorKey(L"title_exit", 0x7FF); | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
51 |
2574 | 52 pMainMenu_BtnNew = CreateButton(495, 172, ui_mainmenu_new->GetWidth(), ui_mainmenu_new->GetHeight(), 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", ui_mainmenu_new, 0); |
53 pMainMenu_BtnLoad = CreateButton(495, 227, ui_mainmenu_load->GetWidth(), ui_mainmenu_load->GetHeight(), 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", ui_mainmenu_load, 0); | |
54 pMainMenu_BtnCredits = CreateButton(495, 282, ui_mainmenu_credits->GetWidth(), ui_mainmenu_credits->GetHeight(), 1, 0, UIMSG_ShowCredits, 2, 'C', "", ui_mainmenu_credits, 0); | |
55 pMainMenu_BtnExit = CreateButton(495, 337, ui_mainmenu_exit->GetWidth(), ui_mainmenu_exit->GetHeight(), 1, 0, UIMSG_ExitToWindows, 3, 0, "", ui_mainmenu_exit, 0); | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
56 } |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
57 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
58 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
59 void GUIWindow_MainMenu::Update() |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
60 { |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
61 // ----------------------------------- |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
62 // 004627B7 void MainMenu_Loop -- part |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
63 POINT pt; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
64 pMouse->GetCursorPos(&pt); |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
65 GUIWindow *pWindow = this;//pWindow_MainMenu; |
2552
ac16f4a3a91e
Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
2551
diff
changeset
|
66 //if (GetCurrentMenuID() == MENU_SAVELOAD) |
ac16f4a3a91e
Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
2551
diff
changeset
|
67 // pWindow = pGUIWindow_CurrentMenu; |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
68 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
69 |
2575 | 70 static bool b = false; |
71 if (!b) | |
72 { | |
73 pUIAnim_Food->icon = pIconsFrameTable->GetIcon("torchA"); | |
74 pIconsFrameTable->InitializeAnimation(pUIAnim_Food->icon->id); | |
75 b = true; | |
76 } | |
77 | |
78 auto icon = pIconsFrameTable->GetFrame(pUIAnim_Food->icon->id, GetTickCount()/2); | |
79 pRenderer->DrawTextureAlphaNew(64 / 640.0f, 48 / 480.0f, icon->texture); | |
80 | |
81 | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
82 if (GetCurrentMenuID() == MENU_MAIN) |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
83 { |
2575 | 84 Image *pTexture = nullptr; |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
85 if (!pModalWindow)// ??? |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
86 { |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
87 auto pButton = pWindow->pControlsHead; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
88 for (pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext) |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
89 { |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
90 if (pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
91 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
92 && pWindow == pWindow_MainMenu) |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
93 { |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
94 auto pControlParam = pButton->msg_param; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
95 int pY = 0; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
96 switch (pControlParam) // backlight for buttons |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
97 { |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
98 case 0: |
2575 | 99 pTexture = assets->GetImage_16BitColorKey("title_new", 0x7FF); |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
100 pY = 172; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
101 break; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
102 case 1: |
2575 | 103 pTexture = assets->GetImage_16BitColorKey("title_load", 0x7FF); |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
104 pY = 227; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
105 break; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
106 case 2: |
2575 | 107 pTexture = assets->GetImage_16BitColorKey("title_cred", 0x7FF); |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
108 pY = 282; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
109 break; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
110 case 3: |
2575 | 111 pTexture = assets->GetImage_16BitColorKey("title_exit", 0x7FF); |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
112 pY = 337; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
113 break; |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
114 } |
2575 | 115 pRenderer->DrawTextureAlphaNew(495/640.0f, pY/480.0f, pTexture); |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
116 } |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
117 } |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
118 } |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
119 } |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
120 } |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
121 |
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2548
diff
changeset
|
122 |
2501 | 123 //----- (0041B578) -------------------------------------------------------- |
124 void MainMenuUI_LoadFontsAndSomeStuff() | |
125 { | |
126 //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
127 pIcons_LOD->SetupPalettes(5, 6, 5); | |
128 //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
129 pPaletteManager->SetColorChannelInfo(5, 6, 5); | |
130 pPaletteManager->RecalculateAll(); | |
131 | |
132 for (uint i = 0; i < window->GetHeight(); ++i) | |
133 pSRZBufferLineOffsets[i] = window->GetWidth() * i; | |
134 | |
135 pFontArrus = LoadFont("arrus.fnt", "FONTPAL", nullptr); | |
136 pFontArrus->field_3 = 0; | |
137 | |
138 pFontLucida = LoadFont("lucida.fnt", "FONTPAL", nullptr); | |
139 pFontLucida->field_3 = 0; | |
140 | |
141 pFontCreate = LoadFont("create.fnt", "FONTPAL", nullptr); | |
142 pFontCreate->field_3 = 0; | |
143 | |
144 pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", nullptr); | |
145 pFontComic = LoadFont("comic.fnt", "FONTPAL", nullptr); | |
146 } | |
147 | |
148 //----- (004415C5) -------------------------------------------------------- | |
149 static void LoadPartyBuffIcons() | |
150 { | |
151 for (uint i = 0; i < 14; ++i) | |
152 { | |
153 char filename[200]; | |
154 sprintf(filename, "isn-%02d", i + 1); | |
155 pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); | |
156 } | |
157 | |
158 uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); | |
159 uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); | |
160 } | |
161 | |
162 //----- (0041B690) -------------------------------------------------------- | |
163 void MainMenuUI_Create() | |
164 { | |
165 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC")); | |
166 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB")); | |
167 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA")); | |
168 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC")); | |
169 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB")); | |
170 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA")); | |
171 | |
2574 | 172 game_ui_minimap_dirs[0] = assets->GetImage_16BitAlpha("MAPDIR1"); |
173 game_ui_minimap_dirs[1] = assets->GetImage_16BitAlpha("MAPDIR2"); | |
174 game_ui_minimap_dirs[2] = assets->GetImage_16BitAlpha("MAPDIR3"); | |
175 game_ui_minimap_dirs[3] = assets->GetImage_16BitAlpha("MAPDIR4"); | |
176 game_ui_minimap_dirs[4] = assets->GetImage_16BitAlpha("MAPDIR5"); | |
177 game_ui_minimap_dirs[5] = assets->GetImage_16BitAlpha("MAPDIR6"); | |
178 game_ui_minimap_dirs[6] = assets->GetImage_16BitAlpha("MAPDIR7"); | |
179 game_ui_minimap_dirs[7] = assets->GetImage_16BitAlpha("MAPDIR8"); | |
2501 | 180 |
2574 | 181 game_ui_bar_blue = assets->GetImage_16BitColorKey(L"ib-statB", 0x7FF); |
182 game_ui_bar_green = assets->GetImage_16BitColorKey(L"ib-statG", 0x7FF); | |
183 game_ui_bar_yellow = assets->GetImage_16BitColorKey(L"ib-statY", 0x7FF); | |
184 game_ui_bar_red = assets->GetImage_16BitColorKey(L"ib-statR", 0x7FF); | |
185 game_ui_monster_hp_background = assets->GetImage_16BitColorKey(L"mhp_bg", 0x7FF); | |
186 game_ui_monster_hp_border_left = assets->GetImage_16BitColorKey(L"mhp_capl", 0x7FF); | |
187 game_ui_monster_hp_border_right = assets->GetImage_16BitColorKey(L"mhp_capr", 0x7FF); | |
188 game_ui_monster_hp_green = assets->GetImage_16BitColorKey(L"mhp_grn", 0x7FF); | |
189 game_ui_monster_hp_red = assets->GetImage_16BitColorKey(L"mhp_red", 0x7FF); | |
190 game_ui_monster_hp_yellow = assets->GetImage_16BitColorKey(L"mhp_yel", 0x7FF); | |
191 ui_leather_mm7 = assets->GetImage_16Bit("LEATHER"); | |
192 ui_leather_mm6 = assets->GetImage_16Bit("ibground"); | |
193 dialogue_ui_x_x_u = assets->GetImage_16BitColorKey(L"x_x_u", 0x7FF); | |
194 ui_buttdesc2 = assets->GetImage_16BitAlpha(L"BUTTESC2"); | |
195 dialogue_ui_x_ok_u = assets->GetImage_16BitColorKey(L"x_ok_u", 0x7FF); | |
196 ui_buttyes2 = assets->GetImage_16BitAlpha(L"BUTTYES2"); | |
197 ui_partycreation_buttmake = assets->GetImage_16BitAlpha(L"BUTTMAKE"); | |
198 ui_partycreation_buttmake2 = assets->GetImage_16BitAlpha(L"BUTTMAKE2"); | |
2501 | 199 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
200 pPrimaryWindow = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); |
2501 | 201 pPrimaryWindow->CreateButton(7, 8, 460, 343, 1, 0, UIMSG_MouseLeftClickInGame, 0, 0, "", 0); |
202 | |
203 pPrimaryWindow->CreateButton(61, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);//buttons for portraits | |
204 pPrimaryWindow->CreateButton(177, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
205 pPrimaryWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
206 pPrimaryWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
207 | |
208 pPrimaryWindow->CreateButton(24, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for HP | |
209 pPrimaryWindow->CreateButton(139, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); | |
210 pPrimaryWindow->CreateButton(255, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); | |
211 pPrimaryWindow->CreateButton(370, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); | |
212 | |
213 pPrimaryWindow->CreateButton(97, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for SP | |
214 pPrimaryWindow->CreateButton(212, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0); | |
215 pPrimaryWindow->CreateButton(328, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0); | |
216 pPrimaryWindow->CreateButton(443, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0); | |
217 | |
2574 | 218 game_ui_tome_quests = assets->GetImage_16BitAlpha(L"ib-td1-A"); |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
219 pBtn_Quests = pPrimaryWindow->CreateButton( |
2574 | 220 491, 353, |
221 game_ui_tome_quests->GetWidth(), | |
222 game_ui_tome_quests->GetHeight(), | |
223 1, 0, UIMSG_OpenQuestBook, 0, pKeyActionMap->GetActionVKey(INPUT_Quest), | |
224 pGlobalTXT_LocalizationStrings[174], game_ui_tome_quests, 0 | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
225 ); //Quests |
2501 | 226 |
2574 | 227 game_ui_tome_autonotes = assets->GetImage_16BitAlpha(L"ib-td2-A"); |
228 pBtn_Autonotes = pPrimaryWindow->CreateButton( | |
229 527, 353, | |
230 game_ui_tome_autonotes->GetWidth(), | |
231 game_ui_tome_autonotes->GetHeight(), | |
232 1, 0, UIMSG_OpenAutonotes, 0, pKeyActionMap->GetActionVKey(INPUT_Autonotes), | |
233 pGlobalTXT_LocalizationStrings[154], game_ui_tome_autonotes, 0 | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
234 );//Autonotes |
2501 | 235 |
2574 | 236 game_ui_tome_maps = assets->GetImage_16BitAlpha("ib-td3-A"); |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
237 pBtn_Maps = pPrimaryWindow->CreateButton( |
2574 | 238 546, 353, |
239 game_ui_tome_maps->GetWidth(), | |
240 game_ui_tome_maps->GetHeight(), | |
241 1, 0, UIMSG_OpenMapBook, 0, pKeyActionMap->GetActionVKey(INPUT_Mapbook), | |
242 pGlobalTXT_LocalizationStrings[139], game_ui_tome_maps, 0 | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
243 ); //Maps |
2501 | 244 |
2574 | 245 game_ui_tome_calendar = assets->GetImage_16BitAlpha("ib-td4-A"); |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
246 pBtn_Calendar = pPrimaryWindow->CreateButton( |
2574 | 247 570, 353, |
248 game_ui_tome_calendar->GetWidth(), | |
249 game_ui_tome_calendar->GetHeight(), | |
250 1, 0, UIMSG_OpenCalendar, 0, pKeyActionMap->GetActionVKey(INPUT_TimeCal), | |
251 pGlobalTXT_LocalizationStrings[78], game_ui_tome_calendar, 0 | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
252 );//Calendar |
2501 | 253 |
2574 | 254 game_ui_tome_storyline = assets->GetImage_16BitAlpha("ib-td5-A"); |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
255 pBtn_History = pPrimaryWindow->CreateButton( |
2574 | 256 600, 361, |
257 game_ui_tome_storyline->GetWidth(), | |
258 game_ui_tome_storyline->GetHeight(), | |
259 1, 0, UIMSG_OpenHistoryBook, 0, 72,//ascii | |
260 pGlobalTXT_LocalizationStrings[602], game_ui_tome_storyline, 0 | |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2544
diff
changeset
|
261 );//History |
2501 | 262 |
263 bFlashAutonotesBook = 0; | |
264 bFlashQuestBook = 0; | |
265 bFlashHistoryBook = 0; | |
266 | |
2574 | 267 pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, game_ui_btn_zoomin->GetWidth(), |
268 game_ui_btn_zoomin->GetHeight(), 2, 0, UIMSG_ClickZoomInBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomIn), | |
269 pGlobalTXT_LocalizationStrings[252], game_ui_btn_zoomin, 0); // Zoom In | |
2501 | 270 |
2574 | 271 pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, game_ui_btn_zoomout->GetWidth(), |
272 game_ui_btn_zoomout->GetHeight(), 2, 0, UIMSG_ClickZoomOutBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomOut), | |
273 pGlobalTXT_LocalizationStrings[251], game_ui_btn_zoomout, 0); // Zoom Out | |
2501 | 274 |
275 pPrimaryWindow->CreateButton(481, 0, 153, 67, 1, 92, UIMSG_0, 0, 0, "", 0); | |
276 pPrimaryWindow->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_StartHireling1Dialogue, 0, '5', "", 0); | |
277 pPrimaryWindow->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_StartHireling2Dialogue, 0, '6', "", 0); | |
278 pPrimaryWindow->CreateButton(476, 322, 77, 17, 1, 100, UIMSG_0, 0, 0, "", 0); | |
279 pPrimaryWindow->CreateButton(555, 322, 77, 17, 1, 101, UIMSG_0, 0, 0, "", 0); | |
280 | |
281 pBtn_CastSpell = pPrimaryWindow->CreateButton(476, 450, | |
2574 | 282 game_ui_btn_cast->GetWidth(), |
283 game_ui_btn_cast->GetHeight(), | |
284 1, 0, UIMSG_SpellBookWindow, 0, 67, pGlobalTXT_LocalizationStrings[38], game_ui_btn_cast, 0); | |
2501 | 285 pBtn_Rest = pPrimaryWindow->CreateButton(518, 450, |
2574 | 286 game_ui_btn_rest->GetWidth(), |
287 game_ui_btn_rest->GetHeight(), | |
288 1, 0, UIMSG_RestWindow, 0, 82, pGlobalTXT_LocalizationStrings[182], game_ui_btn_rest, 0); | |
2501 | 289 pBtn_QuickReference = pPrimaryWindow->CreateButton(560, 450, |
2574 | 290 game_ui_btn_quickref->GetWidth(), |
291 game_ui_btn_quickref->GetHeight(), | |
292 1, 0, UIMSG_QuickReference, 0, 90, pGlobalTXT_LocalizationStrings[173], game_ui_btn_quickref, 0); | |
2501 | 293 pBtn_GameSettings = pPrimaryWindow->CreateButton(602, 450, |
2574 | 294 game_ui_btn_settings->GetWidth(), |
295 game_ui_btn_settings->GetHeight(), | |
296 1, 0, UIMSG_GameMenuButton, 0, 0, pGlobalTXT_LocalizationStrings[93], game_ui_btn_settings, 0); | |
2501 | 297 |
298 pBtn_NPCLeft = pPrimaryWindow->CreateButton(469, 178, | |
2574 | 299 ui_btn_npc_left->GetWidth(), |
300 ui_btn_npc_left->GetHeight(), | |
301 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", ui_btn_npc_left, 0); | |
2501 | 302 pBtn_NPCRight = pPrimaryWindow->CreateButton(626, 178, |
2574 | 303 ui_btn_npc_right->GetWidth(), |
304 ui_btn_npc_right->GetHeight(), | |
305 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", ui_btn_npc_right, 0); | |
2501 | 306 LoadPartyBuffIcons(); |
307 } | |
308 | |
309 | |
310 | |
311 | |
312 //----- (00452AF3) -------------------------------------------------------- | |
313 void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels) | |
314 { | |
315 void *v3; // edi@1 | |
316 unsigned int v4; // eax@1 | |
317 unsigned __int16 *v5; // edi@3 | |
318 unsigned int i; // ecx@3 | |
319 | |
320 if (for_refactoring) | |
321 { | |
322 MessageBoxA(nullptr, "Nomad: sub operates on 16 bit pixels, we have 32 bits.", "", 0); | |
323 __debugbreak(); | |
324 } | |
325 | |
326 v3 = pPixels; | |
327 v4 = a1 | (a1 << 16); | |
328 if ( (unsigned __int8)pPixels & 2 ) // first 2 pixels | |
329 { | |
330 *pPixels = v4; | |
331 v3 = pPixels + 1; | |
332 --uNumPixels; | |
333 } | |
334 memset32(v3, v4, uNumPixels >> 1); // 4 pixels at once | |
335 v5 = (unsigned __int16 *)((char *)v3 + 4 * (uNumPixels >> 1)); | |
336 for ( i = uNumPixels & 1; i; --i ) // leftover pixels | |
337 { | |
338 *v5 = v4; | |
339 ++v5; | |
340 } | |
341 } | |
342 | |
343 //----- (004979D2) -------------------------------------------------------- | |
344 MENU_STATE MainMenuUI_Credits_Loop() | |
345 { | |
346 char *cred_texturet; // edi@5 | |
347 FILE *pFile; // eax@5 | |
348 unsigned int pSize; // esi@7 | |
349 MSG Msg; // [sp+84h] [bp-B8h]@10 | |
350 GUIWindow credit_window; | |
351 int move_Y; // [sp+128h] [bp-14h]@1 | |
352 char *pString; // [sp+12Ch] [bp-10h]@9 | |
353 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 | |
354 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 | |
355 RGBTexture cred_texture; // [sp+100h] [bp-3Ch]@1 | |
2574 | 356 Texture_MM7 pTemporaryTexture; // [sp+Ch] [bp-130h]@5 |
2501 | 357 |
358 pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); | |
359 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); | |
360 | |
361 if ( pMessageQueue_50CBD0->uNumMessages ) | |
362 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
363 ++pIcons_LOD->uTexturePacksCount; | |
364 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
365 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
366 //dword_A74C88 = 0;//??? часть дальнейшего кода отсутствует, там использовалась данная переменная | |
367 | |
368 | |
2508 | 369 if ( use_music_folder ) |
370 PlayAudio(L"Music\\15.mp3"); | |
371 else | |
372 pAudioPlayer->PlayMusicTrack(MUSIC_Credits); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
373 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
374 Image *mm6title = assets->GetImage_PCXFromIconsLOD(L"mm6title.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
375 |
2501 | 376 cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); |
377 pFile = pEvents_LOD->FindContainer("credits.txt", 0); | |
378 if ( !pFile ) | |
379 Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. | |
380 | |
381 // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." | |
382 | |
383 //для получения размера----------------------- | |
384 fread(&pTemporaryTexture, 1, 0x30, pFile); | |
385 pSize = pTemporaryTexture.uDecompressedSize; | |
386 if ( !pSize ) | |
387 pSize = pTemporaryTexture.uTextureSize; | |
388 memset(&pTemporaryTexture, 0, 0x48);//обнуление | |
389 cred_texturet[pSize] = 0;//конец текста | |
390 | |
391 credit_window.uFrameWidth = 250; | |
392 credit_window.uFrameHeight = 440; | |
393 credit_window.uFrameX = 389; | |
394 credit_window.uFrameY = 19; | |
395 | |
396 cred_texture.uWidth = 250; | |
397 cred_texture.uHeight = pFontQuick->GetStringHeight2(pFontCChar, cred_texturet, &credit_window, 0, 1) + 2 * credit_window.uFrameHeight; | |
398 cred_texture.uNumPixels = cred_texture.uWidth * cred_texture.uHeight; | |
399 cred_texture.pPixels = (unsigned __int16 *)malloc(2 * cred_texture.uNumPixels); | |
400 fill_pixels_fast(Color16(0, 0xFFu, 0xFFu), cred_texture.pPixels, cred_texture.uNumPixels); | |
401 cred_texture._allocation_flags = 0; | |
402 | |
403 //дать шрифт и цвета тексту | |
404 pString = (char *)malloc(2 * pSize); | |
405 strncpy(pString, cred_texturet, pSize); | |
406 pString[pSize] = 0; | |
407 pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, cred_texture.uWidth, | |
408 cred_texture.uHeight, Color16(0x70u, 0x8Fu, 0xFEu), Color16(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth); | |
409 free(pString); | |
410 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
411 pWindow_MainMenu = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, cred_texturet); |
2501 | 412 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); |
2541 | 413 current_screen_type = SCREEN_CREATORS; |
2501 | 414 SetCurrentMenuID(MENU_CREDITSPROC); |
415 | |
416 move_Y = 0; | |
417 do | |
418 { | |
419 while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) | |
420 { | |
421 if ( Msg.message == 18 ) | |
2541 | 422 Engine_DeinitializeAndTerminate(0); |
2501 | 423 TranslateMessage(&Msg); |
424 DispatchMessageA(&Msg); | |
425 } | |
426 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | |
427 { | |
428 WaitMessage(); | |
429 } | |
430 else | |
431 { | |
432 pRenderer->BeginScene(); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
433 pRenderer->DrawTextureNew(0, 0, mm6title); |
2524 | 434 pRenderer->SetUIClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth, |
2501 | 435 credit_window.uFrameY + credit_window.uFrameHeight); |
436 pRenderer->CreditsTextureScroll(credit_window.uFrameX, credit_window.uFrameY, 0, move_Y, &cred_texture); | |
2524 | 437 pRenderer->ResetUIClipRect(); |
2501 | 438 pRenderer->EndScene(); |
439 ++move_Y; | |
440 if ( move_Y >= cred_texture.uHeight ) | |
441 SetCurrentMenuID(MENU_MAIN); | |
442 pRenderer->Present(); | |
2541 | 443 current_screen_type = SCREEN_GAME;//Ritor1: temporarily, must be corrected MainMenu_EventLoop() |
444 MainMenu_EventLoop(); | |
2501 | 445 } |
446 } | |
447 while ( GetCurrentMenuID() == MENU_CREDITSPROC ); | |
2508 | 448 if ( use_music_folder ) |
449 alSourceStop(mSourceID); | |
2501 | 450 pAudioPlayer->_4AA258(1); |
451 free(cred_texturet); | |
452 free(pFontQuick); | |
453 free(pFontCChar); | |
454 pWindow_MainMenu->Release(); | |
455 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
456 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
457 if (mm6title) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
458 { |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
459 mm6title->Release(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
460 mm6title = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
461 } |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2564
diff
changeset
|
462 |
2501 | 463 cred_texture.Release(); |
464 return MENU_MAIN; // return MENU_Main | |
465 } |