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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
3 #include <stdlib.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
4 #include <crtdbg.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
5
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
23
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
24 #include "Game/Game.h"
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
25 #include "Game/MainMenu.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
26
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
105 //----- (0041B578) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
106 void MainMenuUI_LoadFontsAndSomeStuff()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
107 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
108 //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
109 pIcons_LOD->SetupPalettes(5, 6, 5);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
110 //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
111 pPaletteManager->SetColorChannelInfo(5, 6, 5);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
112 pPaletteManager->RecalculateAll();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
113
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
114 for (uint i = 0; i < window->GetHeight(); ++i)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
115 pSRZBufferLineOffsets[i] = window->GetWidth() * i;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
116
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
117 uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
118
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
119 pFontArrus = LoadFont("arrus.fnt", "FONTPAL", nullptr);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
120 pFontArrus->field_3 = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
121
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
122 pFontLucida = LoadFont("lucida.fnt", "FONTPAL", nullptr);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
123 pFontLucida->field_3 = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
124
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
125 pFontCreate = LoadFont("create.fnt", "FONTPAL", nullptr);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
126 pFontCreate->field_3 = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
127
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
128 pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", nullptr);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
129 pFontComic = LoadFont("comic.fnt", "FONTPAL", nullptr);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
130 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
131
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
132 //----- (004415C5) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
133 static void LoadPartyBuffIcons()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
134 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
135 for (uint i = 0; i < 14; ++i)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
136 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
137 char filename[200];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
138 sprintf(filename, "isn-%02d", i + 1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
139 pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
140 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
141
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
142 uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
143 uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
144 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
145
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
146 //----- (0041B690) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
147 void MainMenuUI_Create()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
148 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
149 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC"));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
150 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB"));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
151 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA"));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
152 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC"));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
153 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB"));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
154 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA"));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
155
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
156 pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
157 pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
158 pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
159 pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
160 pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
161 pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
162 pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
163 pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
164
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
165 uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
166 uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
167 uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
168 uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
169 uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
170 uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
171 uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
172 uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
173 uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
174 uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
175 uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
176 pTexture_Leather = pIcons_LOD->LoadTexturePtr("ibground", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
177 uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
178 uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
179 uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
180 uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
181 uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
182 uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
185 pPrimaryWindow->CreateButton(7, 8, 460, 343, 1, 0, UIMSG_MouseLeftClickInGame, 0, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
186
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
187 pPrimaryWindow->CreateButton(61, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);//buttons for portraits
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
188 pPrimaryWindow->CreateButton(177, 424, 31, 80, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
189 pPrimaryWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
190 pPrimaryWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
191
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
192 pPrimaryWindow->CreateButton(24, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for HP
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
193 pPrimaryWindow->CreateButton(139, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
194 pPrimaryWindow->CreateButton(255, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
195 pPrimaryWindow->CreateButton(370, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
196
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
197 pPrimaryWindow->CreateButton(97, 404, 5, 49, 1, 93, UIMSG_0, 1, 0, "", 0);//buttons for SP
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
198 pPrimaryWindow->CreateButton(212, 404, 5, 49, 1, 93, UIMSG_0, 2, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
199 pPrimaryWindow->CreateButton(328, 404, 5, 49, 1, 93, UIMSG_0, 3, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
200 pPrimaryWindow->CreateButton(443, 404, 5, 49, 1, 93, UIMSG_0, 4, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
201
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
208
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
215
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
222
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
229
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
236
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
237 bFlashAutonotesBook = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
238 bFlashQuestBook = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
239 bFlashHistoryBook = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
240
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
241 pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
242 pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn].uTextureHeight, 2, 0, UIMSG_ClickZoomInBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomIn),
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
243 pGlobalTXT_LocalizationStrings[252], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], 0); // Zoom In
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
244
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
245 pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
246 pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut].uTextureHeight, 2, 0, UIMSG_ClickZoomOutBtn, 0, pKeyActionMap->GetActionVKey(INPUT_ZoomOut),
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
247 pGlobalTXT_LocalizationStrings[251], &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], 0); // Zoom Out
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
248
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
249 pPrimaryWindow->CreateButton(481, 0, 153, 67, 1, 92, UIMSG_0, 0, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
250 pPrimaryWindow->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_StartHireling1Dialogue, 0, '5', "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
251 pPrimaryWindow->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_StartHireling2Dialogue, 0, '6', "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
252 pPrimaryWindow->CreateButton(476, 322, 77, 17, 1, 100, UIMSG_0, 0, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
253 pPrimaryWindow->CreateButton(555, 322, 77, 17, 1, 101, UIMSG_0, 0, 0, "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
254
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
255 pBtn_CastSpell = pPrimaryWindow->CreateButton(476, 450,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
256 pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
257 pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell)->uTextureHeight,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
258 1, 0, UIMSG_SpellBookWindow, 0, 67, pGlobalTXT_LocalizationStrings[38], pIcons_LOD->GetTexture(uTextureID_Btn_CastSpell), 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
259 pBtn_Rest = pPrimaryWindow->CreateButton(518, 450,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
260 pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
261 pIcons_LOD->GetTexture(uTextureID_Btn_Rest)->uTextureHeight,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
262 1, 0, UIMSG_RestWindow, 0, 82, pGlobalTXT_LocalizationStrings[182], pIcons_LOD->GetTexture(uTextureID_Btn_Rest), 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
263 pBtn_QuickReference = pPrimaryWindow->CreateButton(560, 450,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
264 pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
265 pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference)->uTextureHeight,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
266 1, 0, UIMSG_QuickReference, 0, 90, pGlobalTXT_LocalizationStrings[173], pIcons_LOD->GetTexture(uTextureID_Btn_QuickReference), 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
267 pBtn_GameSettings = pPrimaryWindow->CreateButton(602, 450,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
268 pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
269 pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings)->uTextureHeight,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
270 1, 0, UIMSG_GameMenuButton, 0, 0, pGlobalTXT_LocalizationStrings[93], pIcons_LOD->GetTexture(uTextureID_Btn_GameSettings), 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
271
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
272 pBtn_NPCLeft = pPrimaryWindow->CreateButton(469, 178,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
273 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
274 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
275 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
276 pBtn_NPCRight = pPrimaryWindow->CreateButton(626, 178,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
277 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
278 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
279 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
280 LoadPartyBuffIcons();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
281 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
282
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
283
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
284
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
285
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
286 //----- (00452AF3) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
287 void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
288 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
289 void *v3; // edi@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
290 unsigned int v4; // eax@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
291 unsigned __int16 *v5; // edi@3
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
292 unsigned int i; // ecx@3
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
293
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
294 if (for_refactoring)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
295 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
296 MessageBoxA(nullptr, "Nomad: sub operates on 16 bit pixels, we have 32 bits.", "", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
297 __debugbreak();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
298 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
299
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
300 v3 = pPixels;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
301 v4 = a1 | (a1 << 16);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
302 if ( (unsigned __int8)pPixels & 2 ) // first 2 pixels
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
303 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
304 *pPixels = v4;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
305 v3 = pPixels + 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
306 --uNumPixels;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
307 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
308 memset32(v3, v4, uNumPixels >> 1); // 4 pixels at once
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
309 v5 = (unsigned __int16 *)((char *)v3 + 4 * (uNumPixels >> 1));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
310 for ( i = uNumPixels & 1; i; --i ) // leftover pixels
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
311 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
312 *v5 = v4;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
313 ++v5;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
314 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
315 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
316
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
317 //----- (004979D2) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
318 MENU_STATE MainMenuUI_Credits_Loop()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
319 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
320 char *cred_texturet; // edi@5
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
321 FILE *pFile; // eax@5
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
322 unsigned int pSize; // esi@7
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
323 MSG Msg; // [sp+84h] [bp-B8h]@10
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
324 GUIWindow credit_window;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
325 int move_Y; // [sp+128h] [bp-14h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
326 char *pString; // [sp+12Ch] [bp-10h]@9
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
327 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
328 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
329 RGBTexture cred_texture; // [sp+100h] [bp-3Ch]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
330 Texture pTemporaryTexture; // [sp+Ch] [bp-130h]@5
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
331
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
332 pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
333 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
334
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
335 if ( pMessageQueue_50CBD0->uNumMessages )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
336 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
337 ++pIcons_LOD->uTexturePacksCount;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
338 if ( !pIcons_LOD->uNumPrevLoadedFiles )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
339 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
340 //dword_A74C88 = 0;//??? часть дальнейшего кода отсутствует, там использовалась данная переменная
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
341
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
342
2508
491f0babd563 use_music_folder
Ritor1
parents: 2502
diff changeset
343 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2502
diff changeset
344 PlayAudio(L"Music\\15.mp3");
491f0babd563 use_music_folder
Ritor1
parents: 2502
diff changeset
345 else
491f0babd563 use_music_folder
Ritor1
parents: 2502
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
350 cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
351 pFile = pEvents_LOD->FindContainer("credits.txt", 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
352 if ( !pFile )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
353 Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files.
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
354
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
355 // Please re-install to fix this problem. Note: Re-installing will not destroy your save games."
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
356
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
357 //для получения размера-----------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
358 fread(&pTemporaryTexture, 1, 0x30, pFile);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
359 pSize = pTemporaryTexture.uDecompressedSize;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
360 if ( !pSize )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
361 pSize = pTemporaryTexture.uTextureSize;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
362 memset(&pTemporaryTexture, 0, 0x48);//обнуление
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
363 cred_texturet[pSize] = 0;//конец текста
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
364
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
365 credit_window.uFrameWidth = 250;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
366 credit_window.uFrameHeight = 440;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
367 credit_window.uFrameX = 389;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
368 credit_window.uFrameY = 19;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
369
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
370 cred_texture.uWidth = 250;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
371 cred_texture.uHeight = pFontQuick->GetStringHeight2(pFontCChar, cred_texturet, &credit_window, 0, 1) + 2 * credit_window.uFrameHeight;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
372 cred_texture.uNumPixels = cred_texture.uWidth * cred_texture.uHeight;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
373 cred_texture.pPixels = (unsigned __int16 *)malloc(2 * cred_texture.uNumPixels);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
374 fill_pixels_fast(Color16(0, 0xFFu, 0xFFu), cred_texture.pPixels, cred_texture.uNumPixels);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
375 cred_texture._allocation_flags = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
376
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
377 //дать шрифт и цвета тексту
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
378 pString = (char *)malloc(2 * pSize);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
379 strncpy(pString, cred_texturet, pSize);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
380 pString[pSize] = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
381 pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, cred_texture.uWidth,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
382 cred_texture.uHeight, Color16(0x70u, 0x8Fu, 0xFEu), Color16(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
383 free(pString);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
386 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
387 current_screen_type = SCREEN_CREATORS;
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
388 SetCurrentMenuID(MENU_CREDITSPROC);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
389
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
390 move_Y = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
391 do
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
392 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
393 while ( PeekMessageA(&Msg, 0, 0, 0, 1) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
394 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
395 if ( Msg.message == 18 )
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
396 Engine_DeinitializeAndTerminate(0);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
397 TranslateMessage(&Msg);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
398 DispatchMessageA(&Msg);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
399 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
400 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
401 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
402 WaitMessage();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
403 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
404 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
405 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
c7264ab7132f Main menu rendered using d3d11
a.parshin
parents: 2508
diff changeset
408 pRenderer->SetUIClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth,
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
409 credit_window.uFrameY + credit_window.uFrameHeight);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
410 pRenderer->CreditsTextureScroll(credit_window.uFrameX, credit_window.uFrameY, 0, move_Y, &cred_texture);
2524
c7264ab7132f Main menu rendered using d3d11
a.parshin
parents: 2508
diff changeset
411 pRenderer->ResetUIClipRect();
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
412 pRenderer->EndScene();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
413 ++move_Y;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
414 if ( move_Y >= cred_texture.uHeight )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
415 SetCurrentMenuID(MENU_MAIN);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
416 pRenderer->Present();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
417 current_screen_type = SCREEN_GAME;//Ritor1: temporarily, must be corrected MainMenu_EventLoop()
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
418 MainMenu_EventLoop();
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
419 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
420 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
421 while ( GetCurrentMenuID() == MENU_CREDITSPROC );
2508
491f0babd563 use_music_folder
Ritor1
parents: 2502
diff changeset
422 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2502
diff changeset
423 alSourceStop(mSourceID);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
424 pAudioPlayer->_4AA258(1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
425 free(cred_texturet);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
426 free(pFontQuick);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
427 free(pFontCChar);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
428 pWindow_MainMenu->Release();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
437 cred_texture.Release();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
438 return MENU_MAIN; // return MENU_Main
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
439 }