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