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