Mercurial > mm7
annotate GUI/GUIWindow.cpp @ 2574:dd36326a9994
More texture refactoring
GetLeather -> DrawTextureCustomHeight
author | a.parshin |
---|---|
date | Mon, 07 Mar 2016 03:48:40 +0200 |
parents | 0c67be4ec900 |
children | a76d408c5132 |
rev | line source |
---|---|
2502 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
5 #define _CRT_SECURE_NO_WARNINGS | |
2541 | 6 #include "Engine/Engine.h" |
2502 | 7 |
8 #include "GUIWindow.h" | |
9 #include "GUIFont.h" | |
10 #include "Engine/Party.h" | |
11 #include "Engine/LOD.h" | |
12 #include "IO/Keyboard.h" | |
13 #include "Engine/OurMath.h" | |
14 #include "Engine/Timer.h" | |
15 #include "Media/Audio/AudioPlayer.h" | |
16 #include "IO/Mouse.h" | |
17 #include "Engine/Graphics/Viewport.h" | |
18 #include "Engine/Tables/StorylineTextTable.h" | |
19 #include "GUI\UI\UIHouses.h" | |
20 #include "GUI\UI\UIBooks.h" | |
21 #include "Engine/texts.h" | |
22 #include "Engine/Autonotes.h" | |
23 #include "Engine/Awards.h" | |
24 #include "Engine/Objects/Chest.h" | |
25 #include "Engine/Graphics/Outdoor.h" | |
26 #include "Engine/Tables/IconFrameTable.h" | |
27 #include "Engine/Objects/Actor.h" | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
28 #include "Engine/AssetsManager.h" |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
29 #include "Engine/Events.h" |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
30 #include "Engine/Graphics/Level\Decoration.h" |
2502 | 31 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
32 #include "GUI/UI/UIArena.h" |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
33 #include "GUI/UI/UIPopup.h" |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
34 #include "GUI/UI/UIGame.h" |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
35 #include "GUI/UI/UICharacter.h" |
2502 | 36 |
37 typedef struct _RGBColor | |
38 { | |
39 unsigned char R; | |
40 unsigned char B; | |
41 unsigned char G; | |
42 }RGBColor; | |
43 | |
44 | |
45 std::array<RGBColor, 20> spell_tooltip_colors={{ | |
46 {0x96, 0xD4, 0xFF}, | |
47 {0xFF, 0x80, 0x00}, | |
48 {0xFF, 0xFF, 0x9B}, | |
49 {0xE1, 0xE1, 0xE1}, | |
50 {0x80, 0x80, 0x80}, | |
51 {0x96, 0xD4, 0xFF}, | |
52 {0xFF, 0x55, 0x00}, | |
53 {0x96, 0xD4, 0xFF}, | |
54 {0xFF, 0x55, 0x00}, | |
55 {0xE1, 0xE1, 0xE1}, | |
56 {0xFF, 0x55, 0x00}, | |
57 {0x96, 0xD4, 0xFF}, | |
58 {0xEB, 0x0F, 0xFF}, | |
59 {0xFF, 0x80, 0x00}, | |
60 {0x96, 0xD4, 0xFF}, | |
61 {0x80, 0x80, 0x80}, | |
62 {0xFF, 0x55, 0x00}, | |
63 {0x00, 0x80, 0xFF}, | |
64 {0x00, 0x80, 0xFF}, | |
65 {0x96, 0xD4, 0xFF}}}; | |
66 | |
67 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
68 enum WindowType current_character_screen_window; |
2502 | 69 struct GUIWindow *pWindow_MMT_MainMenu; |
70 struct GUIWindow *pWindow_MainMenu; | |
2552
ac16f4a3a91e
Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
2551
diff
changeset
|
71 std::array<struct GUIWindow *, 50> pWindowList; |
2502 | 72 |
73 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; | |
74 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; | |
75 | |
76 | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
77 Image *ui_exit_cancel_button_background = nullptr; |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
78 Image *game_ui_right_panel_frame = nullptr; |
2574 | 79 Image *dialogue_ui_x_ok_u = nullptr; |
80 Image *dialogue_ui_x_x_u = nullptr; | |
81 | |
82 Image *ui_buttdesc2 = nullptr; | |
83 Image *ui_buttyes2 = nullptr; | |
84 | |
85 Image *ui_btn_npc_right = nullptr; | |
86 Image *ui_btn_npc_left = nullptr; | |
87 | |
88 Image *ui_ar_dn_dn = nullptr; | |
89 Image *ui_ar_dn_up = nullptr; | |
90 Image *ui_ar_up_dn = nullptr; | |
91 Image *ui_ar_up_up = nullptr; | |
2502 | 92 |
93 | |
94 | |
2574 | 95 Image *ui_leather_mm6 = nullptr; |
96 Image *ui_leather_mm7 = nullptr; | |
97 | |
2502 | 98 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
99 GUIWindow_Inventory_CastSpell::GUIWindow_Inventory_CastSpell(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
100 GUIWindow(x, y, width, height, button, hint) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
101 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
102 pMouse->SetCursorBitmap("MICON2"); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
103 pBtn_ExitCancel = CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена |
2574 | 104 ui_buttdesc2, nullptr); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
105 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2); // Choose target / Выбрать цель |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
106 ++pIcons_LOD->uTexturePacksCount; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
107 current_character_screen_window = WINDOW_CharacterWindow_Inventory; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
108 current_screen_type = SCREEN_CASTING; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
109 if (!pIcons_LOD->uNumPrevLoadedFiles) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
110 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
111 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
112 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
113 GUIWindow_House::GUIWindow_House(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
114 GUIWindow(x, y, width, height, button, hint) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
115 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
116 current_screen_type = SCREEN_HOUSE; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
117 pBtn_ExitCancel = CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80], // Quit building / Выйти из здания |
2574 | 118 ui_exit_cancel_button_background, 0); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
119 for (int v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
120 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
121 char *v29, *v30; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
122 if (v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
123 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
124 v30 = pMapStats->pInfos[uHouse_ExitPic].pName; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
125 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S]; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
126 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
127 else |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
128 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
129 if (v26 || !dword_591080) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
130 v30 = HouseNPCData[v26 + 1 - ((dword_591080 != 0) ? 1 : 0)]->pName; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
131 else |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
132 v30 = (char*)p2DEvents[button - 1].pProprieterName; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
133 v29 = (char*)pGlobalTXT_LocalizationStrings[435]; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
134 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
135 sprintfex(byte_591180[v26].data(), v29, v30); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
136 HouseNPCPortraitsButtonsList[v26] = CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
137 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26], |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
138 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
139 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
140 if (uNumDialogueNPCPortraits == 1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
141 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
142 window_SpeakInHouse = this; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
143 _4B4224_UpdateNPCTopics(0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
144 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
145 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
146 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
147 GUIWindow_Dialogue::GUIWindow_Dialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
148 GUIWindow(x, y, width, height, button, hint) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
149 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
150 prev_screen_type = current_screen_type; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
151 current_screen_type = SCREEN_NPC_DIALOGUE; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
152 pBtn_ExitCancel = CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" |
2574 | 153 ui_exit_cancel_button_background, 0); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
154 if (par1C != 1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
155 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
156 int num_menu_buttons = 0; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
157 int v11 = LOBYTE(pFontArrus->uFontHeight) - 3; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
158 NPCData *speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
159 if (GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1)//QuestsNPC_greet |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
160 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
161 if (speakingNPC->joins) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
162 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
163 CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
164 num_menu_buttons = 1; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
165 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
166 if (speakingNPC->evt_A) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
167 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
168 if (num_menu_buttons < 4) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
169 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
170 int v14 = NPC_EventProcessor(speakingNPC->evt_A); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
171 if (v14 == 1 || v14 == 2) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
172 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
173 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
174 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
175 if (speakingNPC->evt_B) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
176 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
177 if (num_menu_buttons < 4) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
178 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
179 int v16 = NPC_EventProcessor(speakingNPC->evt_B); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
180 if (v16 == 1 || v16 == 2) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
181 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
182 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
183 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
184 if (speakingNPC->evt_C) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
185 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
186 if (num_menu_buttons < 4) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
187 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
188 int v18 = NPC_EventProcessor(speakingNPC->evt_C); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
189 if (v18 == 1 || v18 == 2) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
190 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
191 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
192 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
193 if (speakingNPC->evt_D) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
194 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
195 if (num_menu_buttons < 4) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
196 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
197 int v20 = NPC_EventProcessor(speakingNPC->evt_D); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
198 if (v20 == 1 || v20 == 2) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
199 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
200 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
201 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
202 if (speakingNPC->evt_E) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
203 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
204 if (num_menu_buttons < 4) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
205 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
206 int v22 = NPC_EventProcessor(speakingNPC->evt_E); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
207 if (v22 == 1 || v22 == 2) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
208 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
209 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
210 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
211 if (speakingNPC->evt_F) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
212 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
213 if (num_menu_buttons < 4) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
214 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
215 int v24 = NPC_EventProcessor(speakingNPC->evt_F); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
216 if (v24 == 1 || v24 == 2) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
217 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
218 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
219 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
220 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
221 else |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
222 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
223 if (speakingNPC->joins) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
224 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
225 CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
226 if (speakingNPC->Hired()) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
227 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
228 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
229 CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
230 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
231 else |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
232 CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
233 num_menu_buttons = 2; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
234 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
235 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
236 _41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
237 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
238 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
239 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
240 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
241 GUIWindow_GenericDialogue::GUIWindow_GenericDialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
242 GUIWindow(x, y, width, height, button, hint) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
243 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
244 prev_screen_type = current_screen_type; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
245 pKeyActionMap->EnterText(0, 15, this); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
246 current_screen_type = SCREEN_BRANCHLESS_NPC_DIALOG; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
247 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
248 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
249 OnCastTargetedSpell::OnCastTargetedSpell(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
250 GUIWindow(x, y, width, height, button, hint) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
251 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
252 pEventTimer->Pause(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
253 pAudioPlayer->StopChannels(-1, -1); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
254 pMouse->SetCursorBitmap("MICON2"); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
255 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u); // ChooseTarget / Выберите цель |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
256 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
257 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
258 |
2502 | 259 // inlined |
260 //----- (mm6c::00420520) -------------------------------------------------- | |
261 void GUIMessageQueue::Flush() | |
262 { | |
263 if (uNumMessages) | |
264 uNumMessages = pMessages[0].field_8 != 0; | |
265 } | |
266 | |
267 //----- (004356B9) -------------------------------------------------------- | |
268 void GUIMessageQueue::PopMessage(enum UIMessageType *pType, int *pParam, int *a4) | |
269 { | |
270 if ( this->uNumMessages ) | |
271 { | |
272 *pType = this->pMessages[0].eType; | |
273 *pParam = this->pMessages[0].param; | |
274 *a4 = this->pMessages[0].field_8; | |
275 if ( (signed int)(this->uNumMessages - 1) > 0 ) | |
276 { | |
277 for ( uint i = 0; i < (signed int)(this->uNumMessages - 1); ++i ) | |
278 { | |
279 this->pMessages[i].eType = this->pMessages[i + 1].eType; | |
280 this->pMessages[i].param = this->pMessages[i + 1].param; | |
281 this->pMessages[i].field_8 = this->pMessages[i + 1].field_8; | |
282 } | |
283 } | |
284 --this->uNumMessages; | |
285 } | |
286 } | |
287 | |
288 //----- (0041B4E1) -------------------------------------------------------- | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
289 void GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) |
2502 | 290 { |
291 int i; // edx@2 | |
292 GUIButton *j; // ecx@3 | |
293 int k; // edx@7 | |
294 GUIButton *l; // ecx@8 | |
295 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 | |
296 char old_hot_key; // [sp+8h] [bp-4h]@1 | |
297 | |
298 //v3 = uNewHotkey; | |
299 old_hot_key = toupper(uOldHotkey); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
300 v9 = toupper(uNewHotkey); |
2502 | 301 if ( bFirstCall ) |
302 { | |
303 for ( i = uNumVisibleWindows; i >= 0; --i ) | |
304 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
305 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1]->pControlsHead; j; j = j->pNext ) |
2502 | 306 j->field_28 = 0; |
307 } | |
308 } | |
309 for ( k = uNumVisibleWindows; k >= 0; --k ) | |
310 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
311 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1]->pControlsHead; l; l = l->pNext ) |
2502 | 312 { |
313 if ( l->uHotkey == old_hot_key ) | |
314 { | |
315 if ( !l->field_28 ) | |
316 { | |
317 l->field_28 = 1; | |
318 l->uHotkey = v9; | |
319 } | |
320 } | |
321 } | |
322 } | |
323 } | |
324 | |
325 //----- (0041B438) -------------------------------------------------------- | |
326 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) | |
327 { | |
328 char Hot_key_num; // al@1 | |
329 GUIWindow *current_window; // ecx@2 | |
330 GUIButton *result; // eax@2 | |
331 | |
332 Hot_key_num = toupper(uHotkey); | |
333 for( int i = uNumVisibleWindows; i >= 0 && pVisibleWindowsIdxs[i] > 0; i-- ) | |
334 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
335 current_window = pWindowList[pVisibleWindowsIdxs[i] - 1]; |
2502 | 336 for ( result = current_window->pControlsHead; result; result = result->pNext ) |
337 { | |
338 if ( result->uHotkey == Hot_key_num ) | |
339 { | |
340 pMessageQueue_50CBD0->AddGUIMessage(result->msg, result->msg_param, 0); | |
341 return result; | |
342 } | |
343 } | |
344 if ( !current_window->uFrameX && !current_window->uFrameY | |
345 && (current_window->uFrameWidth == window->GetWidth() && current_window->uFrameHeight == window->GetWidth()) ) | |
346 break; | |
347 } | |
348 return 0; | |
349 } | |
350 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | |
351 | |
352 //----- (0041D73D) -------------------------------------------------------- | |
353 void GUIWindow::_41D73D_draw_buff_tooltip() | |
354 { | |
355 __int64 remaing_time; // ST28_8@11 | |
356 unsigned short text_color; | |
357 int Y_pos; // esi@11 | |
358 int string_count; // [sp+20h] [bp-4h]@7 | |
359 | |
360 string_count = 0; | |
361 for (int i=0; i<20; ++i) | |
362 if ( pParty->pPartyBuffs[i].uExpireTime > 0i64 ) | |
363 ++string_count; | |
364 | |
365 uFrameHeight = pFontArrus->uFontHeight + 72; | |
366 uFrameHeight += (string_count - 1) * pFontArrus->uFontHeight; | |
367 uFrameZ = uFrameWidth + uFrameX - 1; | |
368 uFrameW = uFrameY + uFrameHeight - 1; | |
369 DrawMessageBox(0); | |
370 DrawTitleText(pFontArrus, 0, 12, 0, pGlobalTXT_LocalizationStrings[451], 3); | |
371 if ( !string_count ) | |
372 DrawTitleText(pFontComic, 0, 40, 0, pGlobalTXT_LocalizationStrings[153], 3); | |
373 | |
374 GetTickCount(); | |
375 string_count = 0; | |
376 for (int i=0; i<20; ++i) | |
377 { | |
378 if ( pParty->pPartyBuffs[i].uExpireTime>0i64 )//!!! | |
379 { | |
380 remaing_time = pParty->pPartyBuffs[i].uExpireTime- pParty->uTimePlayed;//!!! | |
381 Y_pos = string_count * pFontComic->uFontHeight + 40; | |
382 text_color = Color16(spell_tooltip_colors[i].R, spell_tooltip_colors[i].G, spell_tooltip_colors[i].B); | |
383 DrawText(pFontComic, 52, Y_pos, text_color, aSpellNames[i], 0, 0, 0); | |
384 DrawBuff_remaining_time_string(Y_pos, this, remaing_time, pFontComic); | |
385 ++string_count; | |
386 } | |
387 } | |
388 } | |
389 | |
390 | |
391 //----- (0041D08F) -------------------------------------------------------- | |
392 void GUIWindow::_41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5) | |
393 { | |
394 if (num_buttons) | |
395 { | |
396 this->pNumPresenceButton = num_buttons; | |
397 this->field_30 = a3; | |
398 this->field_34 = a4; | |
399 this->pCurrentPosActiveItem = a5; | |
400 this->pStartingPosActiveItem = a5; | |
401 this->receives_keyboard_input = true; | |
402 } | |
403 else | |
404 { | |
405 this->pNumPresenceButton = 0; | |
406 this->field_30 = a3; | |
407 this->field_34 = a4; | |
408 this->pCurrentPosActiveItem = 0; | |
409 this->pStartingPosActiveItem = 0; | |
410 this->receives_keyboard_input = false; | |
411 } | |
412 } | |
413 | |
414 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
415 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
416 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
417 void GUIWindow_Dialogue::Release() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
418 { |
2549 | 419 // ----------------------------------------- |
420 // 0041C26A void GUIWindow::Release --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
421 if (!dword_591084) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
422 pDialogueNPCPortraits[0]->Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
423 uNumDialogueNPCPortraits = 0; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
424 |
2574 | 425 if (game_ui_dialogue_background) |
426 { | |
427 game_ui_dialogue_background->Release(); | |
428 game_ui_dialogue_background = nullptr; | |
429 } | |
430 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
431 current_screen_type = prev_screen_type; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
432 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
433 GUIWindow::Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
434 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
435 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
436 void GUIWindow_GenericDialogue::Release() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
437 { |
2549 | 438 // ----------------------------------------- |
439 // 0041C26A void GUIWindow::Release --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
440 pIcons_LOD->SyncLoadedFilesCount(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
441 current_screen_type = prev_screen_type; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
442 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
443 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
444 GUIWindow::Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
445 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
446 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
447 void GUIWindow_House::Release() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
448 { |
2549 | 449 // ----------------------------------------- |
450 // 0041C26A void GUIWindow::Release --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
451 for (int i = 0; i < uNumDialogueNPCPortraits; ++i) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
452 pDialogueNPCPortraits[i]->Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
453 uNumDialogueNPCPortraits = 0; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
454 |
2574 | 455 if (game_ui_dialogue_background) |
456 { | |
457 game_ui_dialogue_background->Release(); | |
458 game_ui_dialogue_background = nullptr; | |
459 } | |
460 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
461 dword_5C35D4 = 0; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
462 if (bFlipOnExit) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
463 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
464 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
465 pIndoorCameraD3D->sRotationY = pParty->sRotationY; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
466 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
467 pParty->uFlags |= 2u; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
468 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
469 GUIWindow::Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
470 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
471 |
2502 | 472 //----- (0041C26A) -------------------------------------------------------- |
473 void GUIWindow::Release() | |
474 { | |
475 //GUIWindow *v1; // esi@1 | |
476 int i; // edi@20 | |
477 //GUIButton *v8; // eax@26 | |
478 GUIButton *pNextBtn; // edi@27 | |
479 //int v10; // esi@28 | |
480 //int v11; // ecx@28 | |
481 int v12; // edx@29 | |
482 | |
483 //v1 = this; | |
484 if ( !this ) | |
485 return; | |
486 | |
487 //v8 = this->pControlsHead; | |
488 if ( this->pControlsHead ) | |
489 { | |
490 do | |
491 { | |
492 pNextBtn = this->pControlsHead->pNext; | |
493 free(this->pControlsHead); | |
494 this->pControlsHead = pNextBtn; | |
495 } | |
496 while ( pNextBtn ); | |
497 } | |
498 this->pControlsHead = 0; | |
499 this->pControlsTail = 0; | |
500 this->uNumControls = 0; | |
501 this->eWindowType = WINDOW_null; | |
502 while ( this->numVisibleWindows < uNumVisibleWindows ) | |
503 { | |
504 v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1]; | |
505 pVisibleWindowsIdxs[this->numVisibleWindows] = v12; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
506 --pWindowList[v12 - 1]->numVisibleWindows; |
2502 | 507 ++this->numVisibleWindows; |
508 } | |
509 pVisibleWindowsIdxs[uNumVisibleWindows] = 0; | |
510 uNumVisibleWindows = uNumVisibleWindows - 1; | |
511 } | |
512 | |
513 //----- (0041CD3B) -------------------------------------------------------- | |
514 GUIButton *GUIWindow::GetControl(unsigned int uID) | |
515 { | |
516 GUIButton *result; // eax@1 | |
517 | |
518 result = this->pControlsHead; | |
519 for ( uID; uID; --uID ) | |
520 result = result->pNext; | |
521 return result; | |
522 } | |
523 | |
524 | |
525 //----- (00415551) -------------------------------------------------------- | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
526 void GUIWindow::DrawMessageBox(bool inside_game_viewport) |
2502 | 527 { |
528 unsigned int v16; // esi@19 | |
529 GUIWindow current_window; // [sp+Ch] [bp-60h]@18 | |
530 POINT cursor; // [sp+60h] [bp-Ch]@8 | |
531 unsigned int v22; // [sp+74h] [bp+8h]@2 | |
532 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
533 int x = 0; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
534 int y = 0; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
535 int z, w; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
536 if (inside_game_viewport) |
2502 | 537 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
538 x = pViewport->uViewportTL_X; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
539 z = pViewport->uViewportBR_X; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
540 y = pViewport->uViewportTL_Y; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
541 w = pViewport->uViewportBR_Y; |
2502 | 542 } |
543 else | |
544 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
545 z = window->GetWidth(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
546 w = window->GetHeight(); |
2502 | 547 } |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
548 |
2502 | 549 pMouse->GetCursorPos(&cursor); |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
550 if ( (signed int)this->uFrameX >= x ) |
2502 | 551 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
552 if ( (signed int)(this->uFrameWidth + this->uFrameX) > z ) |
2502 | 553 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
554 this->uFrameX = z - this->uFrameWidth; |
2502 | 555 this->uFrameY = cursor.y + 30; |
556 } | |
557 } | |
558 else | |
559 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
560 this->uFrameX = x; |
2502 | 561 this->uFrameY = cursor.y + 30; |
562 } | |
563 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
564 if ( (signed int)this->uFrameY >= y ) |
2502 | 565 { |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
566 if ( (signed int)(this->uFrameY + this->uFrameHeight) > w) |
2502 | 567 this->uFrameY = cursor.y - this->uFrameHeight - 30; |
568 } | |
569 else | |
570 this->uFrameY = cursor.y + 30; | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
571 if ( (signed int)this->uFrameY < y ) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
572 this->uFrameY = y; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
573 if ( (signed int)this->uFrameX < x ) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
574 this->uFrameX = x; |
2502 | 575 this->uFrameZ = this->uFrameWidth + this->uFrameX - 1; |
576 this->uFrameW = this->uFrameHeight + this->uFrameY - 1; | |
577 memcpy(¤t_window, this, sizeof(current_window)); | |
578 current_window.uFrameX += 12; | |
579 current_window.uFrameWidth -= 24; | |
580 current_window.uFrameY += 12; | |
581 current_window.uFrameHeight -= 12; | |
582 current_window.uFrameZ = current_window.uFrameWidth + current_window.uFrameX - 1; | |
583 current_window.uFrameW = current_window.uFrameHeight + current_window.uFrameY - 1; | |
584 if ( this->Hint ) | |
585 v16 = pFontLucida->CalcTextHeight(this->Hint, ¤t_window, 0, 0) + 24; | |
586 else | |
587 v16 = this->uFrameHeight; | |
588 if ( (signed int)v16 < 64 ) | |
589 v16 = 64; | |
590 if ( (signed int)(v16 + this->uFrameY) > 479 ) | |
591 v16 = 479 - this->uFrameY; | |
592 DrawPopupWindow(this->uFrameX, this->uFrameY, this->uFrameWidth, v16); | |
593 if ( this->Hint ) | |
594 current_window.DrawTitleText(pFontLucida, 0, (signed int)(v16 - pFontLucida->CalcTextHeight(this->Hint, ¤t_window, 0, 0)) / 2 - 14, 0, this->Hint, 3); | |
595 } | |
596 | |
597 | |
598 | |
599 | |
600 //----- (004B3157) -------------------------------------------------------- | |
601 void GUIWindow::HouseDialogManager() | |
602 { | |
603 unsigned __int16 pWhiteColor; // di@2 | |
604 const char *pHouseName; // edx@4 | |
605 signed int v3; // edx@5 | |
606 char *v4; // edi@9 | |
607 int pTextHeight; // eax@45 | |
608 int v6; // edi@45 | |
609 char *v7; // eax@45 | |
610 int v8; // edi@46 | |
611 int v9; // eax@50 | |
612 unsigned int v10; // [sp-10h] [bp-C8h]@53 | |
613 char *pTitleText; // [sp-8h] [bp-C0h]@50 | |
614 GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4 | |
615 GUIWindow pWindow; // [sp+60h] [bp-58h]@2 | |
616 int pColor2; // [sp+B4h] [bp-4h]@2 | |
617 | |
618 if ( !window_SpeakInHouse ) | |
619 return; | |
620 memcpy(&pWindow, this, sizeof(pWindow)); | |
621 pWindow.uFrameWidth -= 18; | |
622 pWindow.uFrameZ -= 18; | |
623 pWhiteColor = Color16(0xFFu, 0xFFu, 0xFFu); | |
624 pColor2 = Color16(0x15u, 0x99u, 0xE9u); | |
2574 | 625 pRenderer->DrawTextureNew(477/640.0f, 0, game_ui_dialogue_background); |
626 pRenderer->DrawTextureAlphaNew(468/640.0f, 0, game_ui_right_panel_frame); | |
2502 | 627 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic ) |
628 { | |
629 pDialogWindow.uFrameWidth = 130; | |
630 pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight); | |
631 pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName; | |
632 if ( pHouseName ) | |
633 { | |
634 v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0); | |
635 if ( v3 < 0 ) | |
636 v3 = 0; | |
637 pWindow.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, pWhiteColor, | |
638 //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], | |
639 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3); | |
640 } | |
641 } | |
642 pWindow.uFrameWidth += 8; | |
643 pWindow.uFrameZ += 8; | |
644 if ( !pDialogueNPCCount ) | |
645 { | |
646 if ( in_current_building_type == BuildingType_Jail ) | |
647 { | |
648 JailDialog(); | |
649 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
650 { | |
2574 | 651 pRenderer->DrawTextureAlphaNew(556/640.0f, 451/480.0f, dialogue_ui_x_x_u); |
652 pRenderer->DrawTextureAlphaNew(476/640.0f, 451/480.0f, dialogue_ui_x_ok_u); | |
2502 | 653 } |
654 else | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
655 pRenderer->DrawTextureAlphaNew(471/640.0f, 445/480.0f, ui_exit_cancel_button_background); |
2502 | 656 return; |
657 } | |
658 if ( current_npc_text ) | |
659 { | |
660 pDialogWindow.uFrameWidth = 458; | |
661 pDialogWindow.uFrameZ = 457; | |
662 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0); | |
663 v6 = pTextHeight + 7; | |
2574 | 664 pRenderer->DrawTextureCustomHeight( |
665 8/640.0f, | |
666 (352 - (pTextHeight + 7))/480.0f, | |
667 ui_leather_mm7, | |
668 pTextHeight + 7); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
669 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - v6)/480.0f, _591428_endcap); |
2502 | 670 v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0); |
671 window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); | |
672 } | |
673 if ( uNumDialogueNPCPortraits <= 0 ) | |
674 { | |
675 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
676 { | |
2574 | 677 pRenderer->DrawTextureAlphaNew(556/640.0f, 451/480.0f, dialogue_ui_x_x_u); |
678 pRenderer->DrawTextureAlphaNew(476/640.0f, 451/480.0f, dialogue_ui_x_ok_u); | |
2502 | 679 } |
680 else | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
681 pRenderer->DrawTextureAlphaNew(471 / 640.0f, 445 / 480.0f, ui_exit_cancel_button_background); |
2502 | 682 return; |
683 } | |
684 for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 ) | |
685 { | |
2574 | 686 pRenderer->DrawTextureAlphaNew((pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4)/640.0f, |
687 (pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4)/480.0f, game_ui_evtnpc); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
688 pRenderer->DrawTextureTransparentColorKey(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8], |
2502 | 689 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]); |
690 if ( uNumDialogueNPCPortraits < 4 ) | |
691 { | |
692 if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
693 { | |
694 pTitleText = pMapStats->pInfos[uHouse_ExitPic].pName; | |
695 v9 = 94 * v8 + 113; | |
696 } | |
697 else | |
698 { | |
699 if ( !v8 && dword_591080 ) | |
700 { | |
701 pTitleText = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle; | |
702 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3); | |
703 continue; | |
704 } | |
705 pTitleText = HouseNPCData[v8 +1 - (dword_591080 != 0)]->pName; | |
706 v9 = pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2; | |
707 } | |
708 v10 = v9; | |
709 pWindow.DrawTitleText(pFontCreate, 483, v10, pColor2, pTitleText, 3); | |
710 } | |
711 } | |
712 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
713 { | |
2574 | 714 pRenderer->DrawTextureAlphaNew(556/640.0f, 451/480.0f, dialogue_ui_x_x_u); |
715 pRenderer->DrawTextureAlphaNew(476/640.0f, 451/480.0f, dialogue_ui_x_ok_u); | |
2502 | 716 } |
717 else | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
718 pRenderer->DrawTextureAlphaNew(471 / 640.0f, 445 / 480.0f, ui_exit_cancel_button_background); |
2502 | 719 return; |
720 } | |
721 v4 = (char *)pDialogueNPCCount - 1; | |
2574 | 722 pRenderer->DrawTextureAlphaNew((pNPCPortraits_x[0][0] - 4)/640.0f, (pNPCPortraits_y[0][0] - 4)/480.0f, game_ui_evtnpc); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
723 pRenderer->DrawTextureTransparentColorKey(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); |
2541 | 724 if ( current_screen_type == SCREEN_E ) |
2502 | 725 { |
726 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
727 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
728 { | |
2574 | 729 pRenderer->DrawTextureAlphaNew(556/640.0f, 451/480.0f, dialogue_ui_x_x_u); |
730 pRenderer->DrawTextureAlphaNew(476/640.0f, 451/480.0f, dialogue_ui_x_ok_u); | |
2502 | 731 } |
732 else | |
2574 | 733 pRenderer->DrawTextureAlphaNew(471/640.0f, 445/480.0f, ui_exit_cancel_button_background); |
2502 | 734 return; |
735 } | |
736 if ( v4 || !dword_591080 )//на изумрудном острове заходит на корабле пока не выполнены квесты | |
737 SimpleHouseDialog(); | |
738 else | |
739 { | |
740 sprintfex( pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], | |
741 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName, | |
742 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle); | |
743 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf.data(), 3); | |
744 switch ( in_current_building_type ) | |
745 { | |
746 case BuildingType_WeaponShop: | |
747 WeaponShopDialog(); | |
748 break; | |
749 case BuildingType_ArmorShop: | |
750 ArmorShopDialog(); | |
751 break; | |
752 case BuildingType_MagicShop: | |
753 MagicShopDialog(); | |
754 break; | |
755 case BuildingType_AlchemistShop: | |
756 AlchemistDialog(); | |
757 break; | |
758 case BuildingType_FireGuild: | |
759 case BuildingType_AirGuild: | |
760 case BuildingType_WaterGuild: | |
761 case BuildingType_EarthGuild: | |
762 case BuildingType_SpiritGuild: | |
763 case BuildingType_MindGuild: | |
764 case BuildingType_BodyGuild: | |
765 case BuildingType_LightGuild: | |
766 case BuildingType_DarkGuild: | |
767 GuildDialog(); | |
768 break; | |
769 case BuildingType_18: | |
770 __debugbreak(); //What over the dialog? | |
771 sub_4B6478(); | |
772 break; | |
773 case BuildingType_TownHall: | |
774 TownHallDialog(); | |
775 break; | |
776 case BuildingType_Tavern: | |
777 TavernDialog(); | |
778 break; | |
779 case BuildingType_Bank: | |
780 BankDialog(); | |
781 break; | |
782 case BuildingType_Temple: | |
783 TempleDialog(); | |
784 break; | |
785 case BuildingType_Stables: | |
786 case BuildingType_Boats: | |
787 TravelByTransport(); | |
788 break; | |
789 case BuildingType_Training: | |
790 TrainingDialog(); | |
791 break; | |
792 case BuildingType_Jail: | |
793 JailDialog(); | |
794 break; | |
795 default: | |
796 //__debugbreak();//New BuildingType (if enter Boat) | |
797 break; | |
798 } | |
799 } | |
800 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
801 { | |
2574 | 802 pRenderer->DrawTextureAlphaNew(556/640.0f, 451/480.0f, dialogue_ui_x_x_u); |
803 pRenderer->DrawTextureAlphaNew(476/640.0f, 451/480.0f, dialogue_ui_x_ok_u); | |
2502 | 804 } |
805 else | |
2574 | 806 pRenderer->DrawTextureAlphaNew(471/640.0f, 445/480.0f, ui_exit_cancel_button_background); |
2502 | 807 } |
808 | |
809 //----- (004B1854) -------------------------------------------------------- | |
810 void GUIWindow::DrawShops_next_generation_time_string( __int64 next_generation_time ) | |
811 { | |
812 unsigned int full_time; // esi@1 | |
813 signed __int64 hours; // kr00_8@1 | |
814 const char *text; // eax@2 | |
815 signed __int64 minutes; // [sp+Ch] [bp-10h]@1 | |
816 signed __int64 seconds; // [sp+14h] [bp-8h]@1 | |
817 unsigned int days; // [sp+20h] [bp+4h]@1 | |
818 | |
819 full_time = (signed __int64)((double)next_generation_time * 0.234375); | |
820 seconds = (signed __int64)full_time % 60; | |
821 minutes = (signed __int64)(full_time / 60) % 60; | |
822 hours = ((full_time / 60) / 60) % 24; | |
823 days = (unsigned int)((full_time / 60) / 60) / 24; | |
824 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[532]); | |
825 if ( days ) | |
826 { | |
827 text = pGlobalTXT_LocalizationStrings[57];//Days | |
828 if ( days <= 1 ) | |
829 text = pGlobalTXT_LocalizationStrings[56];//Day | |
830 sprintfex(pTmpBuf2.data(), "%d %s ", days, text); | |
831 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
832 } | |
833 if ( hours ) | |
834 { | |
835 if ( hours <= 1 ) | |
836 text = pGlobalTXT_LocalizationStrings[109];//Hour | |
837 else | |
838 text = pGlobalTXT_LocalizationStrings[110];//Hours | |
839 sprintfex(pTmpBuf2.data(), "%d %s ", (int)hours, text); | |
840 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
841 } | |
842 if ( minutes && !days ) | |
843 { | |
844 if ( minutes <= 1 ) | |
845 text = pGlobalTXT_LocalizationStrings[437];//"Minute" | |
846 else | |
847 text = pGlobalTXT_LocalizationStrings[436]; //"Minutes" | |
848 sprintfex(pTmpBuf2.data(), "%d %s ", (int)minutes, text); | |
849 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
850 } | |
851 if ( seconds && !hours ) | |
852 { | |
853 if ( seconds <= 1 ) | |
854 text = pGlobalTXT_LocalizationStrings[439]; //"Second" | |
855 else | |
856 text = pGlobalTXT_LocalizationStrings[438]; //"Seconds" | |
857 sprintfex(pTmpBuf2.data(), "%d %s ", (int)seconds, text); | |
858 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
859 } | |
860 this->DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), this, 0, 0)) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | |
861 } | |
862 | |
863 //----- (0044D406) -------------------------------------------------------- | |
864 void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, | |
865 const char *pInString, unsigned int uLineSpacing ) | |
866 { | |
867 //GUIWindow *pWindow; // esi@1 | |
868 unsigned int v8; // ebx@1 | |
869 char *v9; // eax@1 | |
870 unsigned int v11; // edi@1 | |
871 signed int v12; // esi@1 | |
872 int v13; // eax@2 | |
873 GUIFont *pFont; // [sp+Ch] [bp-4h]@1 | |
874 const char *Stra; // [sp+24h] [bp+14h]@5 | |
875 | |
876 //pWindow = this; | |
877 pFont = a2; | |
878 v8 = this->uFrameWidth - uHorizontalMargin; | |
879 ui_current_text_color = uDefaultColor; | |
880 v9 = FitTextInAWindow(pInString, a2, this, uHorizontalMargin, 0); | |
881 Stra = strtok(v9, "\n"); | |
882 v11 = uHorizontalMargin + this->uFrameX; | |
883 v12 = uVerticalMargin + this->uFrameY; | |
884 while ( 1 ) | |
885 { | |
886 if ( !Stra ) | |
887 break; | |
888 v13 = (signed int)(v8 - pFont->GetLineWidth(Stra)) >> 1; | |
889 if ( v13 < 0 ) | |
890 v13 = 0; | |
891 pFont->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, window->GetWidth()); | |
892 v12 += pFont->uFontHeight - uLineSpacing; | |
893 Stra = strtok(0, "\n"); | |
894 } | |
895 } | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
896 |
2502 | 897 |
898 //----- (0044CE08) -------------------------------------------------------- | |
2529 | 899 void GUIWindow::DrawText(GUIFont *font, signed int uX, int uY, unsigned short uFontColor, const char *Str, bool present_time_transparency, int max_text_height, signed int uFontShadowColor ) |
2532 | 900 { |
2502 | 901 int v14; // edx@9 |
902 char Dest[6]; // [sp+Ch] [bp-2Ch]@32 | |
903 size_t v30; // [sp+2Ch] [bp-Ch]@4 | |
2528 | 904 |
2529 | 905 int left_margin = 0; |
2502 | 906 if ( !Str ) |
907 { | |
908 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0); | |
909 return; | |
910 } | |
2528 | 911 if (!strcmp(Str, "null")) |
912 return; | |
913 | |
2532 | 914 v30 = strlen(Str); |
915 if ( !uX ) | |
916 uX = 12; | |
2528 | 917 |
2532 | 918 const char *string_begin = Str; |
919 if ( max_text_height == 0 ) | |
920 string_begin = FitTextInAWindow(Str, font, this, uX, 0); | |
921 auto string_end = string_begin; | |
922 auto string_base = string_begin; | |
2528 | 923 |
2532 | 924 int out_x = uX + uFrameX; |
925 int out_y = uY + uFrameY; | |
926 v14 = 0; | |
927 | |
928 if (max_text_height != 0 && out_y + LOBYTE(font->uFontHeight) > max_text_height) | |
929 return; | |
2528 | 930 |
2532 | 931 if ( (signed int)v30 > 0 ) |
932 { | |
933 do | |
934 { | |
935 unsigned char c = string_base[v14]; | |
936 if ( c >= font->cFirstChar && c <= font->cLastChar | |
937 || c == '\f' | |
938 || c == '\r' | |
939 || c == '\t' | |
940 || c == '\n' ) | |
2502 | 941 { |
2532 | 942 switch ( c ) |
2502 | 943 { |
2532 | 944 case '\t': |
945 strncpy(Dest, &string_base[v14 + 1], 3); | |
946 Dest[3] = 0; | |
947 v14 += 3; | |
948 left_margin = atoi(Dest); | |
949 out_x = uX + uFrameX + left_margin; | |
950 break; | |
951 case '\n': | |
952 uY = uY + LOBYTE(font->uFontHeight) - 3; | |
953 out_y = uY + uFrameY; | |
954 out_x = uX + uFrameX + left_margin; | |
955 if ( max_text_height != 0 ) | |
2502 | 956 { |
2532 | 957 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height ) |
958 return; | |
959 } | |
960 break; | |
961 case '\f': | |
962 strncpy(Dest, &string_base[v14 + 1], 5); | |
963 Dest[5] = 0; | |
964 uFontColor = atoi(Dest); | |
965 v14 += 5; | |
966 break; | |
967 case '\r': | |
968 strncpy(Dest, &string_base[v14 + 1], 3); | |
969 Dest[3] = 0; | |
970 v14 += 3; | |
971 left_margin = atoi(Dest); | |
972 out_x = uFrameZ - font->GetLineWidth(&string_base[v14]) - left_margin; | |
973 out_y = uY + uFrameY; | |
974 if ( max_text_height != 0 ) | |
975 { | |
976 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height ) | |
977 return; | |
978 break; | |
979 } | |
980 break; | |
2529 | 981 |
2532 | 982 default: |
983 if (c == '\"' && string_base[v14 + 1] == '\"') | |
984 ++v14; | |
2529 | 985 |
2532 | 986 c = (unsigned __int8)string_base[v14]; |
987 if ( v14 > 0 ) | |
988 out_x += font->pMetrics[c].uLeftSpacing; | |
2529 | 989 |
2532 | 990 unsigned char *letter_pixels = &font->pFontData[font->font_pixels_offset[c]]; |
991 if ( uFontColor ) | |
992 pRenderer->DrawText(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight), | |
993 font->pFontPalettes[0], uFontColor, uFontShadowColor); | |
994 else | |
995 pRenderer->DrawTextAlpha(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight), | |
996 font->pFontPalettes[0], present_time_transparency); | |
2529 | 997 |
2532 | 998 out_x += font->pMetrics[c].uWidth; |
999 if ( (signed int)v14 < (signed int)v30 ) | |
1000 out_x += font->pMetrics[c].uRightSpacing; | |
1001 break; | |
2502 | 1002 } |
1003 } | |
1004 } | |
2532 | 1005 while ( (signed int)++v14 < (signed int)v30 ); |
1006 } | |
2502 | 1007 } |
1008 | |
1009 //----- (0044CB4F) -------------------------------------------------------- | |
1010 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text ) | |
1011 { | |
1012 int pLineWidth; // ebx@1 | |
1013 int text_width; // esi@3 | |
1014 unsigned __int8 v12; // cl@7 | |
1015 signed int v13; // esi@19 | |
1016 signed int v14; // ebx@19 | |
1017 unsigned __int8 v15; // cl@21 | |
1018 // int v16; // eax@22 | |
1019 // int v17; // ecx@22 | |
1020 // int v18; // ecx@23 | |
1021 // int v19; // ecx@24 | |
1022 unsigned int v20; // ecx@26 | |
1023 unsigned char* v21; // eax@28 | |
1024 // int v22; // ebx@34 | |
1025 int v23; // eax@34 | |
1026 int v24; // ebx@36 | |
1027 char Str[6]; // [sp+Ch] [bp-20h]@34 | |
1028 // char v26; // [sp+Fh] [bp-1Dh]@34 | |
1029 // char v27; // [sp+11h] [bp-1Bh]@35 | |
1030 int v28; // [sp+20h] [bp-Ch]@17 | |
1031 GUIWindow *pWindow; // [sp+24h] [bp-8h]@1 | |
1032 size_t pNumLen; // [sp+28h] [bp-4h]@1 | |
1033 size_t Str1a; // [sp+40h] [bp+14h]@5 | |
1034 // size_t Str1b; // [sp+40h] [bp+14h]@19 | |
1035 // const char *Sourcea; // [sp+44h] [bp+18h]@20 | |
1036 // int v34; // [sp+48h] [bp+1Ch]@26 | |
1037 int i; | |
1038 | |
1039 | |
1040 pWindow = this; | |
1041 pNumLen = strlen(text); | |
1042 pLineWidth = pFont->GetLineWidth(text); | |
1043 if ( pLineWidth < rect_width ) | |
1044 { | |
1045 pWindow->DrawText(pFont, uX, uY, uColor, text, 0, 0, 0); | |
1046 return pLineWidth; | |
1047 } | |
1048 strcpy(pTmpBuf2.data(), text); | |
1049 text_width = 0; | |
1050 if ( reverse_text ) | |
1051 _strrev(pTmpBuf2.data()); | |
1052 Str1a = 0; | |
1053 for ( i = 0; i < pNumLen; ++i ) | |
1054 { | |
1055 if ( text_width >= rect_width ) | |
1056 break; | |
1057 v12 = pTmpBuf2[i]; | |
1058 if ( pFont->IsCharValid(v12) ) | |
1059 { | |
1060 switch (v12) | |
1061 { | |
1062 case '\t':// Horizontal tab 09 | |
1063 case '\n': //Line Feed 0A 10 | |
1064 case '\r': //Form Feed, page eject 0C 12 | |
1065 break; | |
1066 case '\f': //Carriage Return 0D 13 | |
1067 i += 5; | |
1068 break; | |
1069 default: | |
1070 if ( i > 0 ) | |
1071 text_width += pFont->pMetrics[v12].uLeftSpacing; | |
1072 text_width += pFont->pMetrics[v12].uWidth; | |
1073 if ( i < pNumLen ) | |
1074 text_width += pFont->pMetrics[v12].uRightSpacing; | |
1075 } | |
1076 } | |
1077 } | |
1078 pTmpBuf2[i - 1] = 0; | |
1079 | |
1080 | |
1081 pNumLen = strlen(pTmpBuf2.data()); | |
1082 v28 = pFont->GetLineWidth(pTmpBuf2.data()); | |
1083 if ( reverse_text ) | |
1084 _strrev(pTmpBuf2.data()); | |
1085 | |
1086 v13 = uX + pWindow->uFrameX; | |
1087 v14 = uY + pWindow->uFrameY; | |
1088 for (i=0; i<pNumLen; ++i) | |
1089 { | |
1090 v15 = pTmpBuf2[i]; | |
1091 if ( pFont->IsCharValid(v15) ) | |
1092 { | |
1093 switch (v12) | |
1094 { | |
1095 case '\t':// Horizontal tab 09 | |
1096 { | |
1097 strncpy(Str, &pTmpBuf2[i+1], 3); | |
1098 Str[3] = 0; | |
1099 // atoi(Str); | |
1100 i += 3; | |
1101 break; | |
1102 } | |
1103 case '\n': //Line Feed 0A 10 | |
1104 { | |
1105 v24 = pFont->uFontHeight; | |
1106 v13 = uX; | |
1107 uY = uY + pFont->uFontHeight - 3; | |
1108 v14 = uY+pFont->uFontHeight - 3; | |
1109 break; | |
1110 } | |
1111 case '\r': //Form Feed, page eject 0C 12 | |
1112 { | |
1113 strncpy(Str, &pTmpBuf2[i+1], 5); | |
1114 Str[5] = 0; | |
1115 i += 5; | |
1116 uColor = atoi(Str); | |
1117 break; | |
1118 } | |
1119 case '\f': //Carriage Return 0D 13 | |
1120 { | |
1121 strncpy(Str, &pTmpBuf2[i+1], 3); | |
1122 Str[3] = 0; | |
1123 i += 3; | |
1124 v23 = pFont->GetLineWidth(&pTmpBuf2[i]); | |
1125 v13 = pWindow->uFrameZ - v23 - atoi(Str); | |
1126 v14 = uY; | |
1127 break; | |
1128 } | |
1129 default: | |
1130 v20 = pFont->pMetrics[v15].uWidth; | |
1131 if ( i > 0 ) | |
1132 v13 += pFont->pMetrics[v15].uLeftSpacing; | |
1133 v21 = &pFont->pFontData[pFont->font_pixels_offset[v15]]; | |
1134 if ( uColor ) | |
1135 pRenderer->DrawText(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], uColor, 0); | |
1136 else | |
2525 | 1137 pRenderer->DrawTextAlpha(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], false); |
2502 | 1138 v13 += v20; |
1139 if ( i < (signed int)pNumLen ) | |
1140 v13 += pFont->pMetrics[v15].uRightSpacing; | |
1141 } | |
1142 } | |
1143 } | |
1144 return v28; | |
1145 } | |
1146 | |
1147 //----- (0041D12F) -------------------------------------------------------- | |
1148 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, | |
2574 | 1149 int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Image *pTextures, ...) |
2502 | 1150 { |
1151 GUIButton *pButton; // esi@1 | |
1152 // unsigned int v13; // eax@1 | |
1153 // unsigned int v14; // ebx@4 | |
1154 // unsigned int v15; // eax@4 | |
1155 unsigned int TextureNum=0; // ebx@4 | |
1156 // unsigned int v17; // eax@4 | |
2574 | 1157 // Texture_MM7 *v18; // eax@4 |
1158 // Texture_MM7 **v19; // ecx@5 | |
1159 // Texture_MM7 **v20; // edx@5 | |
2502 | 1160 // GUIButton *v21; // eax@7 |
1161 va_list texturs_ptr; | |
1162 | |
1163 pButton = (GUIButton *)malloc(0xBC); | |
2574 | 1164 |
1165 for (unsigned int i = 0; i < 5; ++i) | |
1166 pButton->pTextures[i] = nullptr; | |
1167 | |
2502 | 1168 pButton->pParent = this; |
1169 pButton->uWidth = uWidth; | |
1170 pButton->uHeight = uHeight; | |
1171 | |
1172 if ( a6 == 2 && !uHeight ) | |
1173 pButton->uHeight = uWidth; | |
1174 | |
1175 pButton->uButtonType = a6; | |
1176 pButton->uX = uX + this->uFrameX; | |
1177 pButton->uY = uY + this->uFrameY; | |
1178 pButton->uZ = pButton->uX + uWidth - 1; | |
1179 pButton->uW = pButton->uY + uHeight - 1; | |
1180 pButton->field_2C_is_pushed = 0; | |
1181 pButton->field_1C = a7; | |
1182 pButton->msg = msg; | |
1183 pButton->msg_param = msg_param; | |
1184 pButton->uHotkey = uHotkey; | |
1185 //strlen(pName); | |
1186 strcpy(pButton->pButtonName, pName); | |
2574 | 1187 |
1188 | |
1189 | |
2502 | 1190 va_start(texturs_ptr, pName); |
2574 | 1191 do |
2502 | 1192 { |
2574 | 1193 pTextures = va_arg(texturs_ptr, Image *); |
1194 pButton->pTextures[TextureNum] = pTextures; | |
1195 ++TextureNum; | |
1196 } while (pTextures); | |
2502 | 1197 va_end(texturs_ptr); |
2574 | 1198 |
1199 | |
1200 | |
2502 | 1201 pButton->uNumTextures = TextureNum; |
1202 if ( this->pControlsTail ) | |
1203 this->pControlsTail->pNext = pButton; | |
1204 else | |
1205 this->pControlsHead = pButton; | |
1206 pButton->pPrev = this->pControlsTail; | |
1207 this->pControlsTail = pButton; | |
1208 pButton->pNext = 0; | |
1209 ++this->uNumControls; | |
1210 return pButton; | |
1211 } | |
1212 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1213 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1214 void GUIWindow::InitializeGUI() |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1215 { |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1216 SetUserInterface(PartyAlignment_Neutral, false); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1217 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1218 for (uint i = 0; i < 20; ++i) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1219 pWindowList[i] = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1220 uNumVisibleWindows = -1; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1221 memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs)); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1222 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1223 MainMenuUI_LoadFontsAndSomeStuff(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1224 } |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1225 |
2502 | 1226 //----- (00459C2B) -------------------------------------------------------- |
1227 void GUIWindow::DrawFlashingInputCursor( signed int uX, int uY, struct GUIFont *a2 ) | |
1228 { | |
1229 if ( GetTickCount() % 1000 > 500 ) | |
1230 DrawText(a2, uX, uY, 0, "_", 0, 0, 0); | |
1231 } | |
1232 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1233 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1234 GUIWindow::GUIWindow() : |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1235 uNumControls(0), |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1236 pControlsHead(nullptr), |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1237 pControlsTail(nullptr), |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1238 eWindowType(WINDOW_null) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1239 {} |
2502 | 1240 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1241 //----- (0041C432) -------------------------------------------------------- |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1242 GUIWindow::GUIWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int pButton, const char* hint) : |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1243 uNumControls(0), |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1244 pControlsHead(nullptr), |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1245 pControlsTail(nullptr), |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1246 eWindowType(WINDOW_MainMenu) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1247 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1248 unsigned int uNextFreeWindowID; // ebp@1 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1249 //int *v8; // eax@1 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1250 //GUIWindow *pWindow; // esi@4 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1251 //int v10; // eax@4 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1252 unsigned int v11; // ebx@15 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1253 NPCData *speakingNPC; // ebp@15 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1254 int v14; // eax@20 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1255 int v16; // eax@25 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1256 int v18; // eax@30 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1257 int v20; // eax@35 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1258 int v22; // eax@40 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1259 int v24; // eax@45 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1260 // int v25; // eax@65 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1261 unsigned int v26; // ebx@65 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1262 char *v27; // eax@71 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1263 const char *v29; // [sp-8h] [bp-18h]@68 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1264 char *v30; // [sp-4h] [bp-14h]@68 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1265 // int uWidtha; // [sp+14h] [bp+4h]@66 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1266 int num_menu_buttons; // [sp+20h] [bp+10h]@15 |
2502 | 1267 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1268 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) |
2502 | 1269 { |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1270 if (pWindowList[uNextFreeWindowID] == nullptr) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1271 break; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1272 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1273 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1274 //GUIWindow* pWindow = &pWindowList[uNextFreeWindowID]; |
2557 | 1275 pWindowList[uNextFreeWindowID] = this;//sometimes uNextFreeWindowID == 20. it's result crash |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1276 this->uFrameWidth = uWidth; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1277 this->uFrameHeight = uHeight; |
2502 | 1278 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1279 this->uFrameX = uX; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1280 this->uFrameY = uY; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1281 this->uFrameZ = uX + uWidth - 1; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1282 this->uFrameW = uY + uHeight - 1; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1283 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1284 this->ptr_1C = (void *)pButton; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1285 this->Hint = hint; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1286 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1287 //this->eWindowType = eWindowType; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1288 this->receives_keyboard_input = false; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1289 ++uNumVisibleWindows; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1290 this->numVisibleWindows = uNumVisibleWindows; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1291 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1; |
2502 | 1292 } |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1293 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1294 |
2502 | 1295 //----- (004B3EF0) -------------------------------------------------------- |
1296 void DrawJoinGuildWindow( int pEventCode ) | |
1297 { | |
1298 uDialogueType = 81;//enum JoinGuildDialog | |
1299 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; | |
1300 ContractSelectText(pEventCode); | |
1301 pDialogueWindow->Release(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1302 pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 350, pEventCode, 0); |
2574 | 1303 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], ui_exit_cancel_button_background, 0); // Cancel |
2502 | 1304 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1305 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 82, 0, pGlobalTXT_LocalizationStrings[122], 0); |
2502 | 1306 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
1307 dialog_menu_id = HOUSE_DIALOGUE_OTHER; | |
1308 } | |
1309 //----- (0044603D) -------------------------------------------------------- | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1310 void DialogueEnding() |
2502 | 1311 { |
1312 sDialogue_SpeakingActorNPC_ID = 0; | |
1313 pDialogueWindow->Release(); | |
1314 pDialogueWindow = 0; | |
1315 pMiscTimer->Resume(); | |
1316 pEventTimer->Resume(); | |
1317 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1318 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1319 |
2548
87e5590d034b
All Books windows are refactored into respective classes
a.parshin
parents:
2547
diff
changeset
|
1320 void GUIWindow_BooksButtonOverlay::Update() |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1321 { |
2546 | 1322 // ----------------------------------- |
1323 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1324 auto pButton = (GUIButton *)ptr_1C; |
2574 | 1325 pRenderer->DrawTextureAlphaNew(uFrameY/640.0f, uFrameX/480.0f, pButton->pTextures[0]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1326 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1327 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1328 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1329 void GUIWindow_Dialogue::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1330 { |
2546 | 1331 // ----------------------------------- |
1332 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1333 GameUI_DrawDialogue(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1334 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1335 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1336 void GUIWindow_GenericDialogue::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1337 { |
2546 | 1338 // ----------------------------------- |
1339 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1340 GameUI_DrawBranchlessDialogue(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1341 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1342 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1343 void GUIWindow_House::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1344 { |
2546 | 1345 // ----------------------------------- |
1346 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1347 HouseDialogManager(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1348 if (!window_SpeakInHouse) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1349 return; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1350 if (window_SpeakInHouse->par1C >= 53) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1351 return; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1352 if (pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] <= pParty->uTimePlayed) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1353 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1354 if (window_SpeakInHouse->par1C < 53) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1355 pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] = 0; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1356 return; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1357 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1358 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1359 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1360 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1361 void GUIWindow_Scroll::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1362 { |
2546 | 1363 // ----------------------------------- |
1364 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1365 CreateScrollWindow(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1366 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1367 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1368 void GUIWindow_Inventory::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1369 { |
2546 | 1370 // ----------------------------------- |
1371 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1372 DrawMessageBox(0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1373 DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1374 DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1375 if (!pKeyActionMap->field_204) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1376 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1377 ItemGen ItemGen2; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1378 ItemGen2.Reset(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1379 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1380 pEventTimer->Resume(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1381 current_screen_type = SCREEN_GAME; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1382 viewparams->bRedrawGameUI = 1; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1383 int v39 = atoi(pKeyActionMap->pPressedKeysBuffer); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1384 if (v39 > 0 && v39 < 800) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1385 SpawnActor(v39); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1386 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1387 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1388 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1389 void GUIWindow_Inventory_CastSpell::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1390 { |
2546 | 1391 // ----------------------------------- |
1392 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1393 pRenderer->ClearZBuffer(0, 479); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1394 draw_leather(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1395 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1396 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); |
2574 | 1397 pRenderer->DrawTextureAlphaNew(pBtn_ExitCancel->uX/640.0f, pBtn_ExitCancel->uY/480.0f, dialogue_ui_x_x_u); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1398 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1399 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1400 void OnButtonClick::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1401 { |
2546 | 1402 // ----------------------------------- |
1403 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1404 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1405 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1406 GUIButton *pButton = (GUIButton *)ptr_1C; |
2574 | 1407 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pButton->pTextures[0]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1408 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1409 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1410 pButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1411 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1412 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1413 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1414 void OnButtonClick2::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1415 { |
2546 | 1416 // ----------------------------------- |
1417 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1418 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1419 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1420 GUIButton *pButton = (GUIButton *)ptr_1C; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1421 if (pButton->uX >= 0 && pButton->uX <= window->GetWidth()) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1422 { |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1423 if (pButton->uY >= 0 && pButton->uY <= window->GetHeight()) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1424 { |
2574 | 1425 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pButton->pTextures[0]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1426 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1427 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1428 pButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1429 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1430 return; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1431 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1432 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1433 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1434 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1435 pButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1436 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1437 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1438 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1439 void OnButtonClick3::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1440 { |
2546 | 1441 // ----------------------------------- |
1442 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1443 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1444 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1445 auto pButton = (GUIButton *)ptr_1C; |
2574 | 1446 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pButton->pTextures[1]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1447 viewparams->bRedrawGameUI = 1; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1448 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1449 pButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1450 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1451 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1452 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1453 void OnButtonClick4::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1454 { |
2546 | 1455 // ----------------------------------- |
1456 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1457 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1458 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1459 auto pButton = (GUIButton *)ptr_1C; |
2574 | 1460 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pButton->pTextures[1]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1461 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1462 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1463 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1464 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1465 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1466 void OnSaveLoad::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1467 { |
2546 | 1468 // ----------------------------------- |
1469 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1470 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1471 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1472 auto pButton = (GUIButton *)ptr_1C; |
2574 | 1473 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pButton->pTextures[0]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1474 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1475 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1476 pButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1477 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1478 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1479 if (current_screen_type == SCREEN_SAVEGAME) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1480 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1481 else |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1482 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1483 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1484 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1485 void OnCancel::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1486 { |
2546 | 1487 // ----------------------------------- |
1488 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1489 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1490 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1491 auto pGUIButton = (GUIButton *)ptr_1C; |
2574 | 1492 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pGUIButton->pTextures[0]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1493 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1494 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1495 pGUIButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1496 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1497 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1498 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1499 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1500 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1501 void OnCancel2::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1502 { |
2546 | 1503 // ----------------------------------- |
1504 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1505 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1506 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1507 auto pButton = (GUIButton *)ptr_1C; |
2574 | 1508 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pButton->pTextures[1]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1509 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1510 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1511 pButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1512 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1513 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1514 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1515 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1516 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1517 void OnCancel3::Update() |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1518 { |
2546 | 1519 // ----------------------------------- |
1520 // 004156F0 GUI_UpdateWindows --- part | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1521 if (Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1522 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1523 auto pButton = (GUIButton *)ptr_1C; |
2574 | 1524 pRenderer->DrawTextureAlphaNew(uFrameX/640.0f, uFrameY/480.0f, pButton->pTextures[0]); |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1525 viewparams->bRedrawGameUI = true; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1526 if (Hint && Hint != (char *)1) |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1527 pButton->DrawLabel(Hint, pFontCreate, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1528 Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1529 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1530 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1531 } |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1532 |
2502 | 1533 //----- (004156F0) -------------------------------------------------------- |
1534 void GUI_UpdateWindows() | |
1535 { | |
1536 GUIWindow *pWindow; // esi@4 | |
1537 //unsigned int pWindowType; // eax@4 | |
1538 const char *pHint; // edx@66 | |
1539 // GUIButton *pButtonPtr_1C; // ebp@79 | |
1540 // char *pHint1; // edx@80 | |
1541 int v26; // eax@98 | |
1542 unsigned int v27; // ebp@106 | |
1543 GUIWindow *pGUIWindow2; // ecx@109 | |
1544 // GUIFont *pGUIFont; // ST1C_4@115 | |
1545 int v31; // eax@115 | |
1546 GUIButton *pButton; // ebp@118 | |
1547 int v39; // eax@129 | |
1548 GUIButton *pGUIButton; // ebp@146 | |
1549 //unsigned int pX; // [sp-1Ch] [bp-124h]@17 | |
1550 //unsigned int pY; // [sp-18h] [bp-120h]@17 | |
2574 | 1551 //Texture_MM7 *pTexture; // [sp-14h] [bp-11Ch]@17 |
1552 //Texture_MM7 *pTexture2; // [sp-14h] [bp-11Ch]@86 | |
2502 | 1553 int i; // [sp+0h] [bp-108h]@3 |
1554 // ItemGen pItemGen; // [sp+4h] [bp-104h]@98 | |
1555 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133 | |
1556 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129 | |
1557 | |
1558 if (GetCurrentMenuID() != MENU_CREATEPARTY) | |
1559 Mouse::UI_OnKeyDown(VK_NEXT); | |
1560 | |
1561 for ( i = 1; i <= uNumVisibleWindows; ++i ) | |
1562 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1563 pWindow = pWindowList[pVisibleWindowsIdxs[i] - 1]; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1564 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1565 pWindow->Update(); |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1566 /*switch (pWindow->eWindowType) |
2502 | 1567 { |
1568 case WINDOW_50: | |
1569 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1570 __debugbreak(); // looks like debugging tools |
2502 | 1571 v27 = Color16(255, 255, 255); |
1572 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
1573 { | |
1574 ptr_507BD0->DrawMessageBox(0); | |
1575 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
1576 v31 = pFontCreate->GetLineWidth(pKeyActionMap->pPressedKeysBuffer); | |
1577 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); | |
1578 continue; | |
1579 } | |
1580 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
1581 { | |
1582 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1583 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); | |
1584 pEventTimer->Resume(); | |
1585 ptr_507BD0->Release(); | |
2541 | 1586 current_screen_type = SCREEN_GAME; |
2502 | 1587 viewparams->bRedrawGameUI = true; |
1588 continue; | |
1589 } | |
1590 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
1591 { | |
1592 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
1593 pEventTimer->Resume(); | |
1594 ptr_507BD0->Release(); | |
1595 continue; | |
1596 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1597 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1598 __debugbreak(); // switch pass-through |
2502 | 1599 } |
1600 case WINDOW_59: | |
1601 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1602 __debugbreak(); // looks like debugging tools |
2502 | 1603 pWindow->DrawMessageBox(0); |
1604 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
1605 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
1606 if ( !pKeyActionMap->field_204 ) | |
1607 { | |
1608 ItemGen2.Reset(); | |
1609 pWindow->Release(); | |
1610 pEventTimer->Resume(); | |
2541 | 1611 current_screen_type = SCREEN_GAME; |
2502 | 1612 viewparams->bRedrawGameUI = true; |
1613 v26 = atoi(pKeyActionMap->pPressedKeysBuffer); | |
1614 if ( v26 > 0 ) | |
1615 { | |
1616 if ( v26 < 800 ) | |
1617 { | |
1618 ItemGen2.uAttributes |= 1; | |
1619 ItemGen2.uItemID = v26; | |
1620 if ( pItemsTable->pItems[v26].uEquipType == 12 ) | |
1621 { | |
1622 ItemGen2.uNumCharges = rand() % 6 + ItemGen2.GetDamageMod() + 1; | |
1623 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges); | |
1624 } | |
1625 else | |
1626 { | |
1627 if ( v26 >= 221 && v26 < 271 ) | |
1628 ItemGen2.uEnchantmentType = rand() % 10 + 1; | |
1629 } | |
1630 pItemsTable->SetSpecialBonus(&ItemGen2); | |
1631 pParty->SetHoldingItem(&ItemGen2); | |
1632 } | |
1633 } | |
1634 } | |
1635 continue; | |
1636 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1637 case WINDOW_MainMenu: |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1638 case WINDOW_null: |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1639 continue; |
2502 | 1640 default: |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1641 __debugbreak(); |
2502 | 1642 continue; |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1643 }*/ |
2502 | 1644 } |
1645 if ( GetCurrentMenuID() == -1 ) | |
1646 GameUI_DrawFoodAndGold(); | |
1647 if ( sub_4637E0_is_there_popup_onscreen() ) | |
1648 UI_OnMouseRightClick(0); | |
1649 } | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1650 |
2502 | 1651 |
1652 //----- (00467FB6) -------------------------------------------------------- | |
1653 void CreateScrollWindow() | |
1654 { | |
1655 unsigned int v0; // eax@1 | |
1656 char *v1; // ST18_4@3 | |
1657 GUIWindow a1; // [sp+Ch] [bp-54h]@1 | |
1658 | |
1659 memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1)); | |
1660 a1.Hint = 0; | |
1661 a1.uFrameX = 1; | |
1662 a1.uFrameY = 1; | |
1663 a1.uFrameWidth = 468; | |
1664 v0 = pFontSmallnum->CalcTextHeight(pScrolls[pGUIWindow_ScrollWindow->par1C], &a1, 0, 0) | |
1665 + 2 * LOBYTE(pFontCreate->uFontHeight) + 24; | |
1666 a1.uFrameHeight = v0; | |
1667 if ( (signed int)(v0 + a1.uFrameY) > 479 ) | |
1668 { | |
1669 v0 = 479 - a1.uFrameY; | |
1670 a1.uFrameHeight = 479 - a1.uFrameY; | |
1671 } | |
1672 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; | |
1673 a1.uFrameW = v0 + a1.uFrameY - 1; | |
1674 a1.DrawMessageBox(0); | |
1675 a1.uFrameX += 12; | |
1676 a1.uFrameWidth -= 24; | |
1677 a1.uFrameY += 12; | |
1678 a1.uFrameHeight -= 12; | |
1679 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; | |
1680 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
1681 v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName; | |
1682 sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xFFu, 0xFFu, 0x9Bu), v1); | |
1683 a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); | |
1684 a1.DrawText(pFontSmallnum, 1, LOBYTE(pFontCreate->uFontHeight) - 3, 0, | |
1685 pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], 0, 0, 0); | |
1686 } | |
1687 //----- (00467F48) -------------------------------------------------------- | |
1688 void CreateMsgScrollWindow( signed int mscroll_id ) | |
1689 { | |
1690 if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 ) | |
1691 { | |
1692 if ( mscroll_id <= 782 ) | |
1693 { | |
1694 uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
1695 pGUIWindow_ScrollWindow = new GUIWindow_Scroll(0, 0, window->GetWidth(), window->GetHeight(), mscroll_id - 700, 0); |
2502 | 1696 } |
1697 } | |
1698 } | |
1699 //----- (00467F9F) -------------------------------------------------------- | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2550
diff
changeset
|
1700 void free_book_subwindow() |
2502 | 1701 { |
1702 if ( pGUIWindow_ScrollWindow ) | |
1703 { | |
1704 pGUIWindow_ScrollWindow->Release(); | |
1705 pGUIWindow_ScrollWindow = 0; | |
1706 } | |
1707 } | |
1708 //----- (004226EF) -------------------------------------------------------- | |
1709 void SetUserInterface(PartyAlignment align, bool bReplace) | |
1710 { | |
1711 extern void set_default_ui_skin(); | |
1712 set_default_ui_skin(); | |
1713 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1714 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1715 if (!parchment) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1716 parchment = assets->GetImage_16BitColorKey(L"parchment", 0x7FF); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1717 |
2502 | 1718 if (align == PartyAlignment_Evil) |
1719 { | |
1720 if ( bReplace ) | |
1721 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1722 game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-C.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1723 game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-C.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1724 game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-C.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1725 game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-C.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1726 game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-c.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1727 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1728 game_ui_right_panel_frame = assets->GetImage_16BitAlpha(L"ib-mb-C"); |
2574 | 1729 |
1730 game_ui_minimap_frame = assets->GetImage_16BitAlpha(L"ib-autmask-c"); | |
1731 game_ui_minimap_compass = assets->GetImage_16BitColorKey(L"IB-COMP-C", 0x7FF); | |
1732 | |
1733 game_ui_player_alert_green = assets->GetImage_16BitAlpha(L"IB-InitG-c"); | |
1734 game_ui_player_alert_yellow = assets->GetImage_16BitAlpha(L"IB-InitY-c"); | |
1735 game_ui_player_alert_red = assets->GetImage_16BitAlpha(L"IB-InitR-c"); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1736 |
2574 | 1737 ui_btn_npc_left = assets->GetImage_16BitAlpha(L"IB-NPCLD-C"); |
1738 ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-C"); | |
1739 game_ui_btn_zoomin = assets->GetImage_16BitAlpha("ib-autout-C"); | |
1740 game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-C"); | |
2502 | 1741 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2); |
2574 | 1742 game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-c"); |
1743 game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-c"); | |
1744 game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-c"); | |
1745 game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-c"); | |
2502 | 1746 |
1747 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2); | |
1748 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2); | |
1749 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2); | |
1750 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2); | |
1751 | |
1752 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); | |
1753 pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID); | |
1754 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); | |
1755 pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID); | |
1756 | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1757 ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-c", 0x7FF); |
2574 | 1758 |
1759 game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc-c", 0x7FF); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1760 ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven-c", 0x7FF); |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1761 messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll-c"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1762 messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr-c"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1763 messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul-c"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1764 messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur-c"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1765 messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm-c"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1766 messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf-c"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1767 messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt-c"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1768 messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top-c"); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1769 _591428_endcap = assets->GetImage_16BitColorKey(L"endcap-c", 0x7FF); |
2502 | 1770 } |
1771 else | |
1772 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1773 game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-C.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1774 game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-c.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1775 game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-C.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1776 game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-C.pcx"); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1777 game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-c.pcx"); |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1778 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1779 game_ui_right_panel_frame = assets->GetImage_16BitAlpha(L"ib-mb-C"); |
2574 | 1780 game_ui_minimap_frame = assets->GetImage_16BitAlpha(L"ib-autmask-c"); |
1781 game_ui_minimap_compass = assets->GetImage_16BitColorKey(L"IB-COMP-C", 0x7FF); | |
1782 game_ui_player_alert_green = assets->GetImage_16BitAlpha(L"IB-InitG-c"); | |
1783 game_ui_player_alert_yellow = assets->GetImage_16BitAlpha(L"IB-InitY-c"); | |
1784 game_ui_player_alert_red = assets->GetImage_16BitAlpha(L"IB-InitR-c"); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1785 |
2574 | 1786 ui_btn_npc_left = assets->GetImage_16BitAlpha(L"IB-NPCLD-C"); |
1787 ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-C"); | |
1788 game_ui_btn_zoomin = assets->GetImage_16BitAlpha(L"ib-autout-C"); | |
1789 game_ui_btn_zoomout = assets->GetImage_16BitAlpha(L"ib-autin-C"); | |
2502 | 1790 uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); |
2574 | 1791 game_ui_btn_cast = assets->GetImage_16BitAlpha(L"ib-m1d-c"); |
1792 game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-c"); | |
1793 game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-c"); | |
1794 game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-c"); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1795 ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-c", 0x7FF); |
2574 | 1796 |
2502 | 1797 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); |
1798 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); | |
1799 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); | |
1800 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); | |
2574 | 1801 game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc-c", 0x7FF); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1802 ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven", 0x7FF); |
2502 | 1803 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); |
1804 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1805 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); | |
1806 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
1807 } | |
1808 uGameUIFontMain = Color16(0xC8u, 0, 0); | |
1809 uGameUIFontShadow = Color16(10, 0, 0); | |
1810 } | |
1811 else if (align == PartyAlignment_Neutral) | |
1812 { | |
1813 if ( bReplace ) | |
1814 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1815 game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-a.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1816 game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-a.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1817 game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-a.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1818 game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-a.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1819 game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-a.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1820 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1821 game_ui_right_panel_frame = assets->GetImage_16BitAlpha(L"ib-mb-a"); |
2574 | 1822 game_ui_minimap_frame = assets->GetImage_16BitAlpha(L"ib-autmask-a"); |
1823 game_ui_minimap_compass = assets->GetImage_16BitColorKey(L"IB-COMP-a", 0x7FF); | |
1824 game_ui_player_alert_green = assets->GetImage_16BitAlpha(L"IB-InitG-a"); | |
1825 game_ui_player_alert_yellow = assets->GetImage_16BitAlpha(L"IB-InitY-a"); | |
1826 game_ui_player_alert_red = assets->GetImage_16BitAlpha(L"IB-InitR-a"); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1827 |
2574 | 1828 ui_btn_npc_left = assets->GetImage_16BitAlpha(L"IB-NPCLD-a"); |
1829 ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-a"); | |
1830 game_ui_btn_zoomin = assets->GetImage_16BitAlpha("ib-autout-a"); | |
1831 game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-a"); | |
2502 | 1832 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2); |
2574 | 1833 game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-a"); |
1834 game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-a"); | |
1835 game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-a"); | |
1836 game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-a"); | |
2502 | 1837 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2); |
1838 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2); | |
1839 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2); | |
1840 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2); | |
1841 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); | |
1842 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1843 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); | |
1844 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
2574 | 1845 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1846 ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-a", 0x7FF); |
2574 | 1847 |
1848 game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc", 0x7FF); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1849 ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven", 0x7FF); |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1850 messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1851 messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1852 messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1853 messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1854 messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1855 messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1856 messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1857 messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top"); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1858 _591428_endcap = assets->GetImage_16BitColorKey(L"endcap", 0x7FF); |
2502 | 1859 } |
1860 else | |
1861 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1862 game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-A.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1863 game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-A.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1864 game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-A.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1865 game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-A.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1866 game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-a.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1867 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1868 game_ui_right_panel_frame = assets->GetImage_16BitAlpha(L"ib-mb-A"); |
2574 | 1869 game_ui_minimap_frame = assets->GetImage_16BitAlpha(L"ib-autmask-a"); |
1870 game_ui_minimap_compass = assets->GetImage_16BitColorKey(L"IB-COMP-A", 0x7FF); | |
1871 game_ui_player_alert_green = assets->GetImage_16BitAlpha(L"IB-InitG-a"); | |
1872 game_ui_player_alert_yellow = assets->GetImage_16BitAlpha(L"IB-InitY-a"); | |
1873 game_ui_player_alert_red = assets->GetImage_16BitAlpha(L"IB-InitR-a"); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1874 |
2574 | 1875 ui_btn_npc_left = assets->GetImage_16BitAlpha(L"IB-NPCLD-A"); |
1876 ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-A"); | |
2502 | 1877 uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); |
2574 | 1878 game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-a"); |
1879 game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-a"); | |
1880 game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-a"); | |
1881 game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-a"); | |
1882 game_ui_btn_zoomin = assets->GetImage_16BitAlpha("ib-autout-a"); | |
1883 game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-a"); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1884 ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-a", 0x7FF); |
2574 | 1885 |
2502 | 1886 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); |
1887 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); | |
1888 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); | |
1889 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); | |
2574 | 1890 game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc", 0x7FF); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1891 ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven", 0x7FF); |
2502 | 1892 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); |
1893 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1894 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); | |
1895 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1896 messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1897 messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1898 messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1899 messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1900 messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1901 messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1902 messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1903 messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top"); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1904 _591428_endcap = assets->GetImage_16BitColorKey(L"endcap", 0x7FF); |
2502 | 1905 } |
1906 uGameUIFontMain = Color16(0xAu, 0, 0); | |
1907 uGameUIFontShadow = Color16(230, 214, 193); | |
1908 } | |
1909 else if (align == PartyAlignment_Good) | |
1910 { | |
1911 if ( bReplace ) | |
1912 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1913 game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-B.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1914 game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-B.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1915 game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-B.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1916 game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-B.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1917 game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-b.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1918 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1919 game_ui_right_panel_frame = assets->GetImage_16BitAlpha(L"ib-mb-B"); |
2574 | 1920 game_ui_minimap_frame = assets->GetImage_16BitAlpha(L"ib-autmask-b"); |
1921 game_ui_minimap_compass = assets->GetImage_16BitColorKey(L"IB-COMP-B", 0x7FF); | |
1922 game_ui_player_alert_green = assets->GetImage_16BitAlpha(L"IB-InitG-b"); | |
1923 game_ui_player_alert_yellow = assets->GetImage_16BitAlpha(L"IB-InitY-b"); | |
1924 game_ui_player_alert_red = assets->GetImage_16BitAlpha(L"IB-InitR-b"); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1925 |
2574 | 1926 ui_btn_npc_left = assets->GetImage_16BitAlpha(L"IB-NPCLD-B"); |
1927 ui_btn_npc_right = assets->GetImage_16BitAlpha(L"IB-NPCRD-B"); | |
1928 game_ui_btn_zoomin = assets->GetImage_16BitAlpha("ib-autout-B"); | |
1929 game_ui_btn_zoomout = assets->GetImage_16BitAlpha("ib-autin-B"); | |
2502 | 1930 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-B", 2); |
2574 | 1931 game_ui_btn_cast = assets->GetImage_16BitAlpha("ib-m1d-b"); |
1932 game_ui_btn_rest = assets->GetImage_16BitAlpha("ib-m2d-b"); | |
1933 game_ui_btn_quickref = assets->GetImage_16BitAlpha("ib-m3d-b"); | |
1934 game_ui_btn_settings = assets->GetImage_16BitAlpha("ib-m4d-b"); | |
2502 | 1935 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-b", 2); |
1936 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-b", 2); | |
1937 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-b", 2); | |
1938 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-b", 2); | |
1939 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); | |
1940 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1941 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); | |
1942 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1943 ui_exit_cancel_button_background = assets->GetImage_16BitColorKey(L"ib-bcu-b", 0x7FF); |
2574 | 1944 |
1945 game_ui_evtnpc = assets->GetImage_16BitColorKey(L"evtnpc-b", 0x7FF); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1946 ui_character_inventory_background = assets->GetImage_16BitColorKey(L"fr_inven-b", 0x7FF); |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1947 messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll-b"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1948 messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr-b"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1949 messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul-b"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1950 messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur-b"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1951 messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm-b"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1952 messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf-b"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1953 messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt-b"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
1954 messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top-b"); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
1955 _591428_endcap = assets->GetImage_16BitColorKey(L"endcap-b", 0x7FF); |
2502 | 1956 } |
1957 uGameUIFontMain = Color16(0, 0, 0xC8u); | |
1958 uGameUIFontShadow = Color16(255, 255, 255); | |
1959 } | |
1960 else Error("Invalid alignment type: %u", align); | |
1961 } | |
1962 //----- (0041D20D) -------------------------------------------------------- | |
1963 void DrawBuff_remaining_time_string( int uY, struct GUIWindow *window, __int64 remaining_time, struct GUIFont *Font ) | |
1964 { | |
1965 unsigned int full_time; // esi@1 | |
1966 signed __int64 hours; // kr00_8@1 | |
1967 const char *text; // eax@2 | |
1968 signed __int64 minutes; // [sp+10h] [bp-10h]@1 | |
1969 signed __int64 seconds; // [sp+18h] [bp-8h]@1 | |
1970 unsigned int day; // [sp+24h] [bp+4h]@1 | |
1971 | |
1972 full_time = (signed __int64)((double)remaining_time * 0.234375); | |
1973 day = (unsigned int)((full_time / 60) / 60) / 24; | |
1974 hours = ((full_time / 60) / 60) % 24; | |
1975 minutes = (signed __int64)(full_time / 60) % 60; | |
1976 seconds = (signed __int64)full_time % 60; | |
1977 strcpy(pTmpBuf.data(), "\r020"); | |
1978 if ( day ) | |
1979 { | |
1980 text = pGlobalTXT_LocalizationStrings[57]; // Days | |
1981 if ( day <= 1 ) | |
1982 text = pGlobalTXT_LocalizationStrings[56]; // Day | |
1983 sprintfex(pTmpBuf2.data(), "%d %s ", (int)day, text); | |
1984 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1985 } | |
1986 if ( hours ) | |
1987 { | |
1988 if ( hours <= 1 ) | |
1989 text = pGlobalTXT_LocalizationStrings[109];// Hour | |
1990 else | |
1991 text = pGlobalTXT_LocalizationStrings[110];// Hours | |
1992 sprintfex(pTmpBuf2.data(), "%d %s ", (int)hours, text); | |
1993 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
1994 } | |
1995 if ( minutes && !day ) | |
1996 { | |
1997 if ( minutes <= 1 ) | |
1998 text = pGlobalTXT_LocalizationStrings[437];// Minute | |
1999 else | |
2000 text = pGlobalTXT_LocalizationStrings[436];// Minutes | |
2001 sprintfex(pTmpBuf2.data(), "%d %s ", (int)minutes, text); | |
2002 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
2003 } | |
2004 if ( seconds && !hours ) | |
2005 { | |
2006 if ( seconds <= 1 ) | |
2007 text = pGlobalTXT_LocalizationStrings[439];// Second | |
2008 else | |
2009 text = pGlobalTXT_LocalizationStrings[438];// Seconds | |
2010 sprintfex(pTmpBuf2.data(), "%d %s ", (int)seconds, text); | |
2011 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
2012 } | |
2013 window->DrawText(Font, 32, uY, 0, pTmpBuf.data(), 0, 0, 0); | |
2014 } | |
2015 | |
2016 | |
2017 //----- (0042EB8D) -------------------------------------------------------- | |
2018 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) | |
2019 { | |
2020 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); | |
2021 if (uNumMessages < 40) | |
2022 { | |
2023 files[uNumMessages] = file; | |
2024 lines[uNumMessages] = line; | |
2025 | |
2026 pMessages[uNumMessages].eType = msg; | |
2027 pMessages[uNumMessages].param = param; | |
2028 pMessages[uNumMessages++].field_8 = a4; | |
2029 } | |
2030 } | |
2031 | |
2032 //----- (004637E0) -------------------------------------------------------- | |
2033 char sub_4637E0_is_there_popup_onscreen() | |
2034 { | |
2035 return dword_507BF0_is_there_popup_onscreen == 1; | |
2036 } | |
2037 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen; | |
2038 | |
2039 //----- (00417AD4) -------------------------------------------------------- | |
2040 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) | |
2041 { | |
2042 switch (uPlayerClass % 4) | |
2043 { | |
2044 case 0: | |
2045 { | |
2046 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) | |
2047 return ui_character_skillinfo_can_learn; | |
2048 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level && | |
2049 byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) | |
2050 { | |
2051 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level) | |
2052 return ui_character_skillinfo_cant_learn; | |
2053 } | |
2054 return ui_character_skillinfo_can_learn_gm; | |
2055 } | |
2056 break; | |
2057 | |
2058 case 1: | |
2059 { | |
2060 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) | |
2061 return ui_character_skillinfo_can_learn; | |
2062 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level) | |
2063 { | |
2064 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) | |
2065 return ui_character_skillinfo_cant_learn; | |
2066 } | |
2067 return ui_character_skillinfo_can_learn_gm; | |
2068 } | |
2069 break; | |
2070 | |
2071 case 2: | |
2072 case 3: | |
2073 { | |
2074 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level) | |
2075 return ui_character_skillinfo_cant_learn; | |
2076 return ui_character_skillinfo_can_learn; | |
2077 } | |
2078 break; | |
2079 } | |
2080 Error("Invalid player class: %u", uPlayerClass); | |
2081 } | |
2082 | |
2083 //----- (0040F92A) -------------------------------------------------------- | |
2574 | 2084 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture_MM7 *a2, int a3) |
2502 | 2085 {//срабатывает в покупке в магазине |
2086 void *v4; // eax@3 | |
2087 //int *v5; // edi@5 | |
2088 // int v6; // ecx@6 | |
2089 // int v9; // [sp+18h] [bp-4h]@1 | |
2090 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
2091 if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed && a2->uDecompressedSize) |
2502 | 2092 v4 = a2->UnzipPalette(); |
2093 else | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
2094 v4 = a2->paletted_pixels; |
2502 | 2095 //v5 = pZBuffer; |
2096 for (uint i = 0; i < a2->uTextureHeight; i++) | |
2097 { | |
2098 for (uint j = 0; j < a2->uTextureWidth; j++) | |
2099 { | |
2100 *pZBuffer = a3; | |
2101 ++pZBuffer; | |
2102 } | |
2103 pZBuffer += window->GetWidth() - a2->uTextureWidth; | |
2104 } | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
2105 if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed) |
2502 | 2106 { |
2107 if (a2->uDecompressedSize) | |
2108 free(v4); | |
2109 } | |
2110 } | |
2111 | |
2112 | |
2541 | 2113 // 4E28F8: using guessed type int current_screen_type; |
2502 | 2114 |
2115 //----- (0040F82D) -------------------------------------------------------- | |
2116 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | |
2117 { | |
2118 assert(uTextureId != -1); | |
2119 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); | |
2120 } | |
2121 | |
2122 //----- (0040F89C) -------------------------------------------------------- | |
2574 | 2123 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture_MM7 *pTex, int uZValue) |
2502 | 2124 {//срабатывает при продаже в магазине |
2125 void *v3; // eax@3 | |
2126 //void *v4; // esi@5 | |
2127 //int *v5; // edi@5 | |
2128 //int v6; // eax@5 | |
2129 // int v7; // ecx@6 | |
2130 // int v11; // [sp+18h] [bp-8h]@1 | |
2131 //void *v12; // [sp+1Ch] [bp-4h]@5 | |
2132 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
2133 if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed && pTex->uDecompressedSize) |
2502 | 2134 v3 = pTex->UnzipPalette(); |
2135 else | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
2136 v3 = pTex->paletted_pixels; |
2502 | 2137 //v12 = v3; |
2138 //v4 = v3; | |
2139 //v5 = pZBuffer; | |
2140 //v6 = 0; | |
2141 for (uint i = 0; i < pTex->uTextureHeight; i++) | |
2142 { | |
2143 for (uint j = 0; j < pTex->uTextureWidth; j++) | |
2144 { | |
2145 //LOBYTE(v6) = *(char *)v4; | |
2146 //v4 = (char *)v4 + 1; | |
2147 //if ( v6 ) | |
2148 *pZBuffer = uZValue; | |
2149 ++pZBuffer; | |
2150 } | |
2151 pZBuffer += window->GetWidth() - pTex->uTextureWidth; | |
2152 } | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
2153 if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed) |
2502 | 2154 { |
2155 if (pTex->uDecompressedSize) | |
2156 free(v3); | |
2157 } | |
2158 } | |
2159 | |
2160 //----- (004BC49B) -------------------------------------------------------- | |
2161 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) | |
2162 { | |
2163 NPCData *speakingNPC; // ebp@1 | |
2164 int npc_event_id; // ecx@10 | |
2165 char *v13; // [sp-8h] [bp-18h]@60 | |
2166 | |
2167 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
2168 uDialogueType = newDialogueType; | |
2169 if (!speakingNPC->uFlags) | |
2170 speakingNPC->uFlags = 1; | |
2171 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
2172 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
2173 else if (newDialogueType == DIALOGUE_76) | |
2174 { | |
2175 if (speakingNPC->Hired()) | |
2176 { | |
2177 if ((signed int)pNPCStats->uNumNewNPCs > 0) | |
2178 { | |
2179 for (uint i = 0; i < (unsigned int)pNPCStats->uNumNewNPCs; ++i) | |
2180 { | |
2181 if (pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName)) | |
2182 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu; | |
2183 } | |
2184 } | |
2185 if (pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName)) | |
2186 memset(&pParty->pHirelings[0], 0, sizeof(NPCData)); | |
2187 else if (pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName)) | |
2188 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); | |
2189 pParty->hirelingScrollPosition = 0; | |
2190 pParty->CountHirelings(); | |
2191 dword_591084 = 0; | |
2192 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2193 dword_7241C8 = 0; | |
2194 return; | |
2195 } | |
2196 if (pParty->pHirelings[0].pName && pParty->pHirelings[1].pName) | |
2197 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" | |
2198 else | |
2199 { | |
2200 if (speakingNPC->uProfession != 51) //burglars have no hiring price | |
2201 { | |
2202 if (pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice) | |
2203 { | |
2204 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" | |
2205 dialogue_show_profession_details = false; | |
2206 uDialogueType = 13; | |
2207 if (uActiveCharacter) | |
2208 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
2209 if (!dword_7241C8) | |
2541 | 2210 pEngine->Draw(); |
2502 | 2211 dword_7241C8 = 0; |
2212 return; | |
2213 } | |
2214 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice); | |
2215 } | |
2216 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
2217 if (pParty->pHirelings[0].pName) | |
2218 { | |
2219 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
2220 v13 = pParty->pHireling2Name; | |
2221 } | |
2222 else | |
2223 { | |
2224 memcpy(&pParty->pHirelings[0], speakingNPC, sizeof(pParty->pHirelings[0])); | |
2225 v13 = pParty->pHireling1Name; | |
2226 } | |
2227 strcpy(v13, speakingNPC->pName); | |
2228 pParty->hirelingScrollPosition = 0; | |
2229 pParty->CountHirelings(); | |
2230 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2231 if (sDialogue_SpeakingActorNPC_ID >= 0) | |
2232 pDialogue_SpeakingActor->uAIState = Removed; | |
2233 if (uActiveCharacter) | |
2234 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
2235 } | |
2236 } | |
2237 else if ((signed int)newDialogueType > DIALOGUE_84 && (signed int)newDialogueType <= DIALOGUE_ARENA_SELECT_CHAMPION) //выбор уровня сложности боя | |
2238 { | |
2239 ArenaFight(); | |
2240 return; | |
2241 } | |
2242 else if (newDialogueType == DIALOGUE_USE_NPC_ABILITY) | |
2243 { | |
2244 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0) | |
2245 { | |
2246 if (speakingNPC->uProfession != GateMaster) | |
2247 speakingNPC->bHasUsedTheAbility = 1; | |
2248 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2249 } | |
2250 else | |
2251 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!" | |
2252 } | |
2253 else if (newDialogueType == DIALOGUE_13) | |
2254 { | |
2255 if (!speakingNPC->Hired()) | |
2256 { | |
2257 sub_4B3E1E(); | |
2258 dialogue_show_profession_details = false; | |
2259 } | |
2260 else | |
2261 { | |
2262 for (uint i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i) | |
2263 { | |
2264 if (pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName)) | |
2265 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu; | |
2266 } | |
2267 if (pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName)) | |
2268 memset(&pParty->pHirelings[0], 0, sizeof(NPCData)); | |
2269 else if (pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName)) | |
2270 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); | |
2271 pParty->hirelingScrollPosition = 0; | |
2272 pParty->CountHirelings(); | |
2273 dword_591084 = 0; | |
2274 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2275 dword_7241C8 = 0; | |
2276 return; | |
2277 } | |
2278 } | |
2279 else if (newDialogueType >= DIALOGUE_EVT_A && newDialogueType <= DIALOGUE_EVT_F) | |
2280 { | |
2281 switch (newDialogueType) | |
2282 { | |
2283 case DIALOGUE_EVT_A: npc_event_id = speakingNPC->evt_A; break; | |
2284 case DIALOGUE_EVT_B: npc_event_id = speakingNPC->evt_B; break; | |
2285 case DIALOGUE_EVT_C: npc_event_id = speakingNPC->evt_C; break; | |
2286 case DIALOGUE_EVT_D: npc_event_id = speakingNPC->evt_D; break; | |
2287 case DIALOGUE_EVT_E: npc_event_id = speakingNPC->evt_E; break; | |
2288 case DIALOGUE_EVT_F: npc_event_id = speakingNPC->evt_F; break; | |
2289 } | |
2290 if ((npc_event_id >= 200) && (npc_event_id <= 310)) | |
2291 _4B3FE5_training_dialogue(npc_event_id); //200-310 | |
2292 else if ((npc_event_id >= 400) && (npc_event_id <= 410)) | |
2293 { //400-410 | |
2294 dword_F8B1D8 = newDialogueType; | |
2295 DrawJoinGuildWindow(npc_event_id - 400); | |
2296 } | |
2297 else | |
2298 { | |
2299 switch (npc_event_id) | |
2300 { | |
2301 case 139: | |
2302 OracleDialogue(); | |
2303 break; | |
2304 case 311: | |
2305 CheckBountyRespawnAndAward(); | |
2306 break; | |
2307 case 399: | |
2308 Arena_SelectionFightLevel(); | |
2309 break; | |
2310 default: | |
2311 activeLevelDecoration = (LevelDecoration*)1; | |
2312 current_npc_text = 0; | |
2313 EventProcessor(npc_event_id, 0, 1); | |
2314 activeLevelDecoration = nullptr; | |
2315 break; | |
2316 } | |
2317 } | |
2318 } | |
2319 if (!dword_7241C8) | |
2541 | 2320 pEngine->Draw(); |
2502 | 2321 dword_7241C8 = 0; |
2322 } | |
2323 | |
2324 //----- (004B3E1E) -------------------------------------------------------- | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2325 void sub_4B3E1E() |
2502 | 2326 { |
2327 NPCData *v0; // ST40_4@1 | |
2328 signed int v1; // edi@1 | |
2329 //GUIWindow *v2; // ecx@1 | |
2330 | |
2331 __debugbreak(); | |
2332 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
2333 v1 = 0; | |
2334 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
2335 pDialogueWindow->Release(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2336 pDialogueWindow = new GUIWindow_Dialogue(0, 0, window->GetWidth(), window->GetHeight(), 1, 0); |
2502 | 2337 if (pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
2338 { | |
2339 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее | |
2340 v1 = 1; | |
2341 } | |
2342 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять | |
2343 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); | |
2344 } | |
2345 | |
2346 //----- (004B2001) -------------------------------------------------------- | |
2347 void __fastcall ClickNPCTopic(signed int uMessageParam) | |
2348 { | |
2349 //signed int v1; // eax@1 | |
2350 NPCData *pCurrentNPCInfo; // ebp@1 | |
2351 int pEventNumber; // ecx@8 | |
2352 Player *v4; // esi@20 | |
2353 //int v5; // eax@28 | |
2354 //int v6; // eax@31 | |
2355 //int v7; // eax@34 | |
2356 //int v8; // eax@37 | |
2357 //int v9; // eax@40 | |
2358 //unsigned int v10; // eax@43 | |
2359 char *v12; // eax@53 | |
2360 char *v13; // eax@56 | |
2361 char *v14; // eax@57 | |
2362 char *v15; // eax@58 | |
2363 //unsigned int v16; // ebp@62 | |
2364 char *v17; // ecx@63 | |
2365 char *v18; // eax@65 | |
2366 // const char *v19; // ecx@68 | |
2367 //unsigned int v20; // eax@69 | |
2368 signed int pPrice; // ecx@70 | |
2369 char *v22; // [sp-Ch] [bp-18h]@73 | |
2370 //int v23; // [sp-8h] [bp-14h]@49 | |
2371 char *v24; // [sp-8h] [bp-14h]@73 | |
2372 //int v25; // [sp-4h] [bp-10h]@49 | |
2373 | |
2374 uDialogueType = uMessageParam + 1; | |
2375 pCurrentNPCInfo = HouseNPCData[pDialogueNPCCount - ((dword_591080 != 0) ? 1 : 0)];//- 1 | |
2376 if (uMessageParam <= 24) | |
2377 { | |
2378 switch (uMessageParam) | |
2379 { | |
2380 case 13: | |
2381 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); | |
2382 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
2383 NPCHireableDialogPrepare(); | |
2384 dialogue_show_profession_details = false; | |
2385 BackToHouseMenu(); | |
2386 return; | |
2387 case 19: | |
2388 pEventNumber = pCurrentNPCInfo->evt_A; | |
2389 break; | |
2390 case 20: | |
2391 pEventNumber = pCurrentNPCInfo->evt_B; | |
2392 break; | |
2393 case 21: | |
2394 pEventNumber = pCurrentNPCInfo->evt_C; | |
2395 break; | |
2396 case 22: | |
2397 pEventNumber = pCurrentNPCInfo->evt_D; | |
2398 break; | |
2399 case 23: | |
2400 pEventNumber = pCurrentNPCInfo->evt_E; | |
2401 break; | |
2402 case 24: | |
2403 pEventNumber = pCurrentNPCInfo->evt_F; | |
2404 break; | |
2405 default: | |
2406 BackToHouseMenu(); | |
2407 return; | |
2408 } | |
2409 /*switch ( pEventNumber ) | |
2410 { | |
2411 case 139: | |
2412 OracleDialogue(); | |
2413 goto _return; | |
2414 case 311: | |
2415 CheckBountyRespawnAndAward(); | |
2416 goto _return; | |
2417 }*/ | |
2418 if (pEventNumber < 200 || pEventNumber > 310) | |
2419 { | |
2420 if (pEventNumber < 400 || pEventNumber > 410) | |
2421 { | |
2422 if (pEventNumber == 139) | |
2423 { | |
2424 OracleDialogue(); | |
2425 } | |
2426 else | |
2427 { | |
2428 if (pEventNumber == 311) | |
2429 { | |
2430 CheckBountyRespawnAndAward(); | |
2431 } | |
2432 else | |
2433 { | |
2434 current_npc_text = 0; | |
2435 activeLevelDecoration = (LevelDecoration*)1; | |
2436 EventProcessor(pEventNumber, 0, 1); | |
2437 activeLevelDecoration = nullptr; | |
2438 } | |
2439 } | |
2440 } | |
2441 else | |
2442 { | |
2443 dword_F8B1D8 = uMessageParam; | |
2444 DrawJoinGuildWindow(pEventNumber - 400); | |
2445 } | |
2446 } | |
2447 else | |
2448 { | |
2449 _4B3FE5_training_dialogue(pEventNumber); | |
2450 } | |
2451 BackToHouseMenu(); | |
2452 return; | |
2453 } | |
2454 if (uMessageParam != 76) | |
2455 { | |
2456 if (uMessageParam == 77) | |
2457 { | |
2458 //v16 = pCurrentNPCInfo->uProfession; | |
2459 __debugbreak(); // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok | |
2460 if (dialogue_show_profession_details) | |
2461 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText; | |
2462 else | |
2463 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pBenefits; | |
2464 current_npc_text = v17; | |
2465 v18 = BuildDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); | |
2466 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
2467 current_npc_text = v18; | |
2468 } | |
2469 else | |
2470 { | |
2471 if (uMessageParam == 79) | |
2472 { | |
2473 if (contract_approved) | |
2474 { | |
2475 Party::TakeGold(gold_transaction_amount); | |
2476 if (uActiveCharacter) | |
2477 { | |
2478 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; | |
2479 *(short *)v12 &= 0x3Fu; | |
2480 switch (dword_F8B1B0_MasteryBeingTaught) | |
2481 { | |
2482 case 2: | |
2483 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; | |
2484 *v15 |= 0x40u; | |
2485 break; | |
2486 case 3: | |
2487 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; | |
2488 *v14 |= 0x80u; | |
2489 break; | |
2490 case 4: | |
2491 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; | |
2492 v13[1] |= 1u; | |
2493 break; | |
2494 } | |
2495 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); | |
2496 } | |
2497 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2498 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
2499 { | |
2500 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
2501 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
2502 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2503 ++pMessageQueue_50CBD0->uNumMessages; | |
2504 }*/ | |
2505 } | |
2506 } | |
2507 else | |
2508 { | |
2509 if (uMessageParam == 82 && contract_approved) //join guild | |
2510 { | |
2511 Party::TakeGold(gold_transaction_amount); | |
2512 v4 = pParty->pPlayers.data(); | |
2513 do | |
2514 { | |
2515 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); | |
2516 ++v4; | |
2517 } while ((signed int)v4 < (signed int)pParty->pHirelings.data()); | |
2518 switch (dword_F8B1D8) | |
2519 { | |
2520 case 19: | |
2521 pEventNumber = pCurrentNPCInfo->evt_A; | |
2522 if (pEventNumber >= 400 && pEventNumber <= 416) | |
2523 pCurrentNPCInfo->evt_A = 0; | |
2524 break; | |
2525 case 20: | |
2526 pEventNumber = pCurrentNPCInfo->evt_B; | |
2527 if (pEventNumber >= 400 && pEventNumber <= 416) | |
2528 pCurrentNPCInfo->evt_B = 0; | |
2529 break; | |
2530 case 21: | |
2531 pEventNumber = pCurrentNPCInfo->evt_C; | |
2532 if (pEventNumber >= 400 && pEventNumber <= 416) | |
2533 pCurrentNPCInfo->evt_C = 0; | |
2534 break; | |
2535 case 22: | |
2536 pEventNumber = pCurrentNPCInfo->evt_D; | |
2537 if (pEventNumber >= 400 && pEventNumber <= 416) | |
2538 pCurrentNPCInfo->evt_D = 0; | |
2539 break; | |
2540 case 23: | |
2541 pEventNumber = pCurrentNPCInfo->evt_E; | |
2542 if (pEventNumber >= 400 && pEventNumber <= 416) | |
2543 pCurrentNPCInfo->evt_E = 0; | |
2544 break; | |
2545 case 24: | |
2546 pEventNumber = pCurrentNPCInfo->evt_F; | |
2547 if (pEventNumber >= 400 && pEventNumber <= 416) | |
2548 pCurrentNPCInfo->evt_F = 0; | |
2549 break; | |
2550 } | |
2551 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2552 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
2553 { | |
2554 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
2555 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
2556 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2557 ++pMessageQueue_50CBD0->uNumMessages; | |
2558 }*/ | |
2559 //v11 = uActiveCharacter; | |
2560 if (uActiveCharacter) | |
2561 { | |
2562 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); | |
2563 BackToHouseMenu(); | |
2564 return; | |
2565 } | |
2566 } | |
2567 } | |
2568 } | |
2569 BackToHouseMenu(); | |
2570 return; | |
2571 } | |
2572 if (pParty->pHirelings[0].pName && pParty->pHirelings[1].pName) | |
2573 { | |
2574 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" | |
2575 BackToHouseMenu(); | |
2576 return; | |
2577 } | |
2578 | |
2579 | |
2580 if (pCurrentNPCInfo->uProfession != 51) //burglars have no hiring price | |
2581 { | |
2582 __debugbreak(); // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok | |
2583 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].uHirePrice; | |
2584 if (pParty->uNumGold < (unsigned int)pPrice) | |
2585 { | |
2586 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
2587 dialogue_show_profession_details = false; | |
2588 uDialogueType = 13; | |
2589 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText; | |
2590 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
2591 if (uActiveCharacter) | |
2592 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
2593 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
2594 BackToHouseMenu(); | |
2595 return; | |
2596 } | |
2597 else | |
2598 Party::TakeGold(pPrice); | |
2599 } | |
2600 //LOBYTE(v2->uFlags) |= 0x80u; | |
2601 pCurrentNPCInfo->uFlags |= 128; | |
2602 pParty->hirelingScrollPosition = 0; | |
2603 pParty->CountHirelings(); | |
2604 if (pParty->pHirelings[0].pName) | |
2605 { | |
2606 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); | |
2607 v24 = pCurrentNPCInfo->pName; | |
2608 v22 = pParty->pHireling2Name; | |
2609 } | |
2610 else | |
2611 { | |
2612 memcpy(pParty->pHirelings.data(), pCurrentNPCInfo, 0x4Cu); | |
2613 v24 = pCurrentNPCInfo->pName; | |
2614 v22 = pParty->pHireling1Name; | |
2615 } | |
2616 strcpy(v22, v24); | |
2617 pParty->hirelingScrollPosition = 0; | |
2618 pParty->CountHirelings(); | |
2619 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); | |
2620 dialog_menu_id = HOUSE_DIALOGUE_MAIN; | |
2621 | |
2622 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
2623 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
2624 { | |
2625 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
2626 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
2627 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2628 ++pMessageQueue_50CBD0->uNumMessages; | |
2629 }*/ | |
2630 if (uActiveCharacter) | |
2631 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); | |
2632 | |
2633 _return: | |
2634 BackToHouseMenu(); | |
2635 } | |
2636 | |
2637 //----- (004B3FE5) -------------------------------------------------------- | |
2638 //Originally called _4B254D_SkillMasteryTeacher to have contract_approved assigned, to be able to set some button name. | |
2639 //But it the name gets immediately overwritten | |
2640 void _4B3FE5_training_dialogue(int a4) | |
2641 { | |
2642 const char *v2; // edi@1 | |
2643 | |
2644 //__debugbreak(); | |
2645 uDialogueType = DIALOGUE_SKILL_TRAINER; | |
2646 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; | |
2647 _4B254D_SkillMasteryTeacher(a4); //might be needed because of contract_approved ? | |
2648 pDialogueWindow->Release(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2649 pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 350, a4, 0); |
2502 | 2650 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, |
2574 | 2651 pGlobalTXT_LocalizationStrings[34], ui_exit_cancel_button_background, 0); |
2502 | 2652 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
2653 v2 = ""; | |
2654 if (contract_approved) | |
2655 v2 = pGlobalTXT_LocalizationStrings[535]; | |
2656 pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); | |
2657 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); | |
2658 dialog_menu_id = HOUSE_DIALOGUE_OTHER; | |
2659 } | |
2528 | 2660 |
2502 | 2661 //----- (004B1ECE) -------------------------------------------------------- |
2662 void OracleDialogue() | |
2663 { | |
2664 __int16 *v0; // edi@1 | |
2665 signed int v4; // eax@9 | |
2666 int v5; // ebx@11 | |
2667 signed int v8; // edi@14 | |
2668 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 | |
2669 signed int v10; // [sp+10h] [bp-8h]@13 | |
2670 int v11; // [sp+14h] [bp-4h]@1 | |
2671 | |
2672 contract_approved = 0; | |
2673 v11 = 0; | |
2674 uDialogueType = 84; | |
2675 current_npc_text = (char *)pNPCTopics[667].pText; | |
2676 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); | |
2677 //while ( 1 ) | |
2678 for (uint i = 0; i <= 53; i++) | |
2679 { | |
2680 if ((unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0)) | |
2681 { | |
2682 //v1 = 0; | |
2683 //v2 = pParty->pPlayers.data(); | |
2684 for (uint pl = 0; pl < 4; pl++) | |
2685 { | |
2686 //LOBYTE(v3) = pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)); | |
2687 if (pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0 + 1))) | |
2688 break; | |
2689 //++v2; | |
2690 //++v1; | |
2691 } | |
2692 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); | |
2693 //if ( v1 == 4 ) | |
2694 //break; | |
2695 } | |
2696 ++v11; | |
2697 //v0 += 2; | |
2698 //if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
2699 //break; | |
2700 } | |
2701 if (v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53]) | |
2702 { | |
2703 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful | |
2704 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; | |
2705 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; | |
2706 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); | |
2707 } | |
2708 if (contract_approved == 601) | |
2709 { | |
2710 v5 = 0; | |
2711 //v12 = pParty->pPlayers.data();//[0].uClass; | |
2712 v9 = 0; | |
2713 //while ( 1 ) | |
2714 for (uint i = 0; i < 4; i++) | |
2715 { | |
2716 if (pParty->pPlayers[i].classType == PLAYER_CLASS_LICH) | |
2717 { | |
2718 v10 = 0; | |
2719 //v6 = pParty->pPlayers.data();//[0].pInventoryItems[0].field_1A; | |
2720 for (uint pl = 0; pl < 4; pl++) | |
2721 { | |
2722 for (v8 = 0; v8 < 126; v8++)//138 | |
2723 { | |
2724 if (pParty->pPlayers[pl].pInventoryItemList[v8].uItemID == ITEM_LICH_JAR_FULL) | |
2725 { | |
2726 if (!pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer) | |
2727 v9 = &pParty->pPlayers[pl].pInventoryItemList[v8]; | |
2728 if (pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer == v5) | |
2729 v10 = 1; | |
2730 } | |
2731 } | |
2732 } | |
2733 if (!v10) | |
2734 break; | |
2735 } | |
2736 // ++v12; | |
2737 ++v5; | |
2738 // if ( v12 > &pParty->pPlayers[3] ) | |
2739 // return; | |
2740 } | |
2741 if (v9) | |
2742 v9->uHolderPlayer = v5; | |
2743 } | |
2744 } | |
2745 | |
2746 //----- (004B46A5) -------------------------------------------------------- | |
2747 void __fastcall DrawTextAtStatusBar(const char *Str, int a5) | |
2748 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2558
diff
changeset
|
2749 pRenderer->DrawTextureNew(0, 352/480.0f, game_ui_statusbar); |
2502 | 2750 pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, Str) + 11, 357, a5, Str, 0, 0, 0); |
2751 } | |
2752 | |
2753 //----- (004BBA85) -------------------------------------------------------- | |
2754 void CheckBountyRespawnAndAward() | |
2755 { | |
2756 int i; // eax@2 | |
2757 int rand_monster_id; // edx@3 | |
2758 | |
2759 uDialogueType = 83; | |
2760 pDialogueWindow->Release(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
2761 pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 350, 0, 0); |
2502 | 2762 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" |
2574 | 2763 ui_exit_cancel_button_background, 0); |
2502 | 2764 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
2765 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0); | |
2766 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); | |
2767 dialog_menu_id = HOUSE_DIALOGUE_OTHER; | |
2768 //get new monster for hunting | |
2769 if (pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed) | |
2770 { | |
2771 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; | |
2772 pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); | |
2773 for (i = rand();; i = rand()) | |
2774 { | |
2775 rand_monster_id = i % 258 + 1; | |
2776 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand_monster_id; | |
2777 if ((unsigned __int16)rand_monster_id < 0x73u || (unsigned __int16)rand_monster_id > 0x84u) | |
2778 { | |
2779 if (((unsigned __int16)rand_monster_id < 0xEBu || (unsigned __int16)rand_monster_id > 0xFCu) | |
2780 && ((unsigned __int16)rand_monster_id < 0x85u || (unsigned __int16)rand_monster_id > 0x96u) | |
2781 && ((unsigned __int16)rand_monster_id < 0x97u || (unsigned __int16)rand_monster_id > 0xBAu) | |
2782 && ((unsigned __int16)rand_monster_id < 0xC4u || (unsigned __int16)rand_monster_id > 0xC6u)) | |
2783 break; | |
2784 } | |
2785 } | |
2786 } | |
2787 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; | |
2788 if (!pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]) | |
2789 { | |
2790 bountyHunting_text = pNPCTopics[351].pText; | |
2791 if (!pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]) | |
2792 bountyHunting_text = pNPCTopics[353].pText; | |
2793 } | |
2794 else//get prize | |
2795 { | |
2796 if (pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]) | |
2797 { | |
2798 pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); | |
2799 for (uint i = 0; i < 4; ++i) | |
2800 pParty->pPlayers[i].SetVariable(VAR_Award, 86); | |
2801 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; | |
2802 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; | |
2803 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; | |
2804 } | |
2805 bountyHunting_text = pNPCTopics[352].pText; | |
2806 } | |
2807 } | |
2808 | |
2809 //----- (004B254D) -------------------------------------------------------- | |
2810 const char * _4B254D_SkillMasteryTeacher(int trainerInfo) | |
2811 { | |
2812 int teacherLevel; // edx@1 | |
2813 int skillBeingTaught; // ecx@1 | |
2814 int pClassType; // eax@7 | |
2815 int currClassMaxMastery; // eax@7 | |
2816 int pointsInSkillWOutMastery; // ebx@7 | |
2817 int classBaseId; // eax@8 | |
2818 unsigned int skillMastery; // eax@29 | |
2819 unsigned __int16 pointsInSkill; // [sp+1Ch] [bp-10h]@7 | |
2820 int masteryLevelBeingTaught; // [sp+24h] [bp-8h]@7 | |
2821 | |
2822 contract_approved = 0; | |
2823 teacherLevel = (trainerInfo - 200) % 3; | |
2824 skillBeingTaught = (trainerInfo - 200) / 3; | |
2825 Player* activePlayer = pPlayers[uActiveCharacter]; | |
2826 pClassType = activePlayer->classType; | |
2827 currClassMaxMastery = byte_4ED970_skill_learn_ability_by_class_table[pClassType][skillBeingTaught]; | |
2828 masteryLevelBeingTaught = teacherLevel + 2; | |
2829 dword_F8B1B0_MasteryBeingTaught = masteryLevelBeingTaught; | |
2830 if (currClassMaxMastery < masteryLevelBeingTaught) | |
2831 { | |
2832 classBaseId = pClassType - pClassType % 4; | |
2833 if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 1][skillBeingTaught] >= masteryLevelBeingTaught) | |
2834 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 1]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level. | |
2835 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught | |
2836 && byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught) | |
2837 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[classBaseId + 2], pClassNames[classBaseId + 3]);//Вы должны достичь звания %s или %s для обучения этому уровню навыка. You have to be promoted to %s or %s to learn this skill level. | |
2838 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught) | |
2839 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 2]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level. | |
2840 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught) | |
2841 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 3]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level. | |
2842 else | |
2843 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Этот уровень навыка не может быть постигнут классом %s. This skill level can not be learned by the %s class. | |
2844 return pTmpBuf.data(); | |
2845 } | |
2846 if (!activePlayer->CanAct()) | |
2847 return pNPCTopics[122].pText; //Not in your condition! | |
2848 pointsInSkill = activePlayer->pActiveSkills[skillBeingTaught]; | |
2849 pointsInSkillWOutMastery = pointsInSkill & 0x3F; | |
2850 if (!pointsInSkillWOutMastery) | |
2851 return pNPCTopics[131].pText; //You must know the skill before you can become an expert in it! | |
2852 skillMastery = SkillToMastery(pointsInSkill); | |
2853 if ((signed int)skillMastery > teacherLevel + 1) | |
2854 return pNPCTopics[teacherLevel + 128].pText; // You are already an SKILLLEVEL in this skill. | |
2855 dword_F8B1AC_award_bit_number = skillBeingTaught; | |
2856 if (masteryLevelBeingTaught == 2 && pointsInSkillWOutMastery < 4 | |
2857 || masteryLevelBeingTaught == 3 && pointsInSkillWOutMastery < 7 | |
2858 || masteryLevelBeingTaught == 4 && pointsInSkillWOutMastery < 10 | |
2859 ) | |
2860 return pNPCTopics[127].pText; //"You don't meet the requirements, and cannot be taught until you do." | |
2861 switch (dword_F8B1AC_award_bit_number) | |
2862 { | |
2863 case PLAYER_SKILL_STAFF: | |
2864 case PLAYER_SKILL_SWORD: | |
2865 case PLAYER_SKILL_DAGGER: | |
2866 case PLAYER_SKILL_AXE: | |
2867 case PLAYER_SKILL_SPEAR: | |
2868 case PLAYER_SKILL_BOW: | |
2869 case PLAYER_SKILL_MACE: | |
2870 case PLAYER_SKILL_ARMSMASTER: | |
2871 switch (masteryLevelBeingTaught) | |
2872 { | |
2873 case 2: | |
2874 gold_transaction_amount = 2000; | |
2875 break; | |
2876 case 3: | |
2877 gold_transaction_amount = 5000; | |
2878 break; | |
2879 case 4: | |
2880 gold_transaction_amount = 8000; | |
2881 break; | |
2882 } | |
2883 break; | |
2884 case PLAYER_SKILL_BLASTER: | |
2885 switch (masteryLevelBeingTaught) | |
2886 { | |
2887 case 2: | |
2888 gold_transaction_amount = 0; | |
2889 break; | |
2890 case 3: | |
2891 gold_transaction_amount = 0; | |
2892 break; | |
2893 case 4: | |
2894 gold_transaction_amount = 0; | |
2895 break; | |
2896 } | |
2897 break; | |
2898 case PLAYER_SKILL_SHIELD: | |
2899 case PLAYER_SKILL_LEATHER: | |
2900 case PLAYER_SKILL_CHAIN: | |
2901 case PLAYER_SKILL_PLATE: | |
2902 switch (masteryLevelBeingTaught) | |
2903 { | |
2904 case 2: | |
2905 gold_transaction_amount = 1000; | |
2906 break; | |
2907 case 3: | |
2908 gold_transaction_amount = 3000; | |
2909 break; | |
2910 case 4: | |
2911 gold_transaction_amount = 7000; | |
2912 break; | |
2913 } | |
2914 break; | |
2915 case PLAYER_SKILL_FIRE: | |
2916 case PLAYER_SKILL_AIR: | |
2917 case PLAYER_SKILL_WATER: | |
2918 case PLAYER_SKILL_EARTH: | |
2919 case PLAYER_SKILL_SPIRIT: | |
2920 case PLAYER_SKILL_MIND: | |
2921 case PLAYER_SKILL_BODY: | |
2922 switch (masteryLevelBeingTaught) | |
2923 { | |
2924 case 2: | |
2925 gold_transaction_amount = 1000; | |
2926 break; | |
2927 case 3: | |
2928 gold_transaction_amount = 4000; | |
2929 break; | |
2930 case 4: | |
2931 gold_transaction_amount = 8000; | |
2932 break; | |
2933 } | |
2934 break; | |
2935 case PLAYER_SKILL_LIGHT: | |
2936 switch (masteryLevelBeingTaught) | |
2937 { | |
2938 case 2: | |
2939 gold_transaction_amount = 2000; | |
2940 break; | |
2941 case 3: | |
2942 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 114)) | |
2943 return pNPCTopics[127].pText; | |
2944 gold_transaction_amount = 5000; | |
2945 break; | |
2946 case 4: | |
2947 if (!activePlayer->ProfessionOrGuildFlagsCorrect(0x22u, 1) || | |
2948 !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Au, 1)) | |
2949 return pNPCTopics[127].pText; | |
2950 gold_transaction_amount = 8000; | |
2951 break; | |
2952 } | |
2953 break; | |
2954 case PLAYER_SKILL_DARK: | |
2955 switch (masteryLevelBeingTaught) | |
2956 { | |
2957 case 2: | |
2958 gold_transaction_amount = 2000; | |
2959 break; | |
2960 case 3: | |
2961 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 110)) | |
2962 return pNPCTopics[127].pText; | |
2963 gold_transaction_amount = 5000; | |
2964 break; | |
2965 case 4: | |
2966 if (!activePlayer->ProfessionOrGuildFlagsCorrect(0x23u, 1) | |
2967 || !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Bu, 1)) | |
2968 return pNPCTopics[127].pText; | |
2969 gold_transaction_amount = 8000; | |
2970 break; | |
2971 } | |
2972 break; | |
2973 case PLAYER_SKILL_ITEM_ID: | |
2974 case PLAYER_SKILL_REPAIR: | |
2975 case PLAYER_SKILL_MEDITATION: | |
2976 case PLAYER_SKILL_PERCEPTION: | |
2977 case PLAYER_SKILL_TRAP_DISARM: | |
2978 case PLAYER_SKILL_MONSTER_ID: | |
2979 case PLAYER_SKILL_STEALING: | |
2980 case PLAYER_SKILL_ALCHEMY: | |
2981 switch (masteryLevelBeingTaught) | |
2982 { | |
2983 case 2: | |
2984 gold_transaction_amount = 500; | |
2985 break; | |
2986 case 3: | |
2987 gold_transaction_amount = 2500; | |
2988 break; | |
2989 case 4: | |
2990 gold_transaction_amount = 6000; | |
2991 break; | |
2992 } | |
2993 break; | |
2994 case PLAYER_SKILL_MERCHANT: | |
2995 switch (masteryLevelBeingTaught) | |
2996 { | |
2997 case 2: | |
2998 gold_transaction_amount = 2000; | |
2999 break; | |
3000 case 3: | |
3001 if (activePlayer->GetBaseWillpower() < 50) | |
3002 return pNPCTopics[127].pText; | |
3003 gold_transaction_amount = 5000; | |
3004 break; | |
3005 case 4: | |
3006 gold_transaction_amount = 8000; | |
3007 break; | |
3008 } | |
3009 break; | |
3010 case PLAYER_SKILL_BODYBUILDING: | |
3011 switch (masteryLevelBeingTaught) | |
3012 { | |
3013 case 2: | |
3014 gold_transaction_amount = 500; | |
3015 break; | |
3016 case 3: | |
3017 if (activePlayer->GetBaseEndurance() < 50) | |
3018 return pNPCTopics[127].pText; | |
3019 gold_transaction_amount = 2500; | |
3020 break; | |
3021 case 4: | |
3022 gold_transaction_amount = 6000; | |
3023 break; | |
3024 } | |
3025 break; | |
3026 case PLAYER_SKILL_DIPLOMACY: | |
3027 Error("Diplomacy not used"); | |
3028 break; | |
3029 case PLAYER_SKILL_TIEVERY: | |
3030 Error("Thievery not used"); | |
3031 break; | |
3032 case PLAYER_SKILL_DODGE: | |
3033 switch (masteryLevelBeingTaught) | |
3034 { | |
3035 case 2: | |
3036 gold_transaction_amount = 2000; | |
3037 break; | |
3038 case 3: | |
3039 gold_transaction_amount = 5000; | |
3040 break; | |
3041 case 4: | |
3042 if ((activePlayer->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA) | |
3043 return pNPCTopics[127].pText; | |
3044 gold_transaction_amount = 8000; | |
3045 break; | |
3046 } | |
3047 break; | |
3048 case PLAYER_SKILL_UNARMED: | |
3049 switch (masteryLevelBeingTaught) | |
3050 { | |
3051 case 2: | |
3052 gold_transaction_amount = 2000; | |
3053 break; | |
3054 case 3: | |
3055 gold_transaction_amount = 5000; | |
3056 break; | |
3057 case 4: | |
3058 if ((activePlayer->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA) | |
3059 return pNPCTopics[127].pText; | |
3060 gold_transaction_amount = 8000; | |
3061 break; | |
3062 } | |
3063 break; | |
3064 case PLAYER_SKILL_LEARNING: | |
3065 switch (masteryLevelBeingTaught) | |
3066 { | |
3067 case 2: | |
3068 gold_transaction_amount = 2000; | |
3069 break; | |
3070 case 3: | |
3071 if (activePlayer->GetBaseIntelligence() < 50) | |
3072 return pNPCTopics[127].pText; | |
3073 gold_transaction_amount = 5000; | |
3074 break; | |
3075 case 4: | |
3076 gold_transaction_amount = 8000; | |
3077 break; | |
3078 } | |
3079 break; | |
3080 default: | |
3081 Error("Unknown skill"); | |
3082 } | |
3083 if (gold_transaction_amount > pParty->uNumGold) | |
3084 return pNPCTopics[124].pText; //You don't have enough gold! | |
3085 contract_approved = 1; | |
3086 if (masteryLevelBeingTaught == 2) | |
3087 { | |
3088 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Получить степень ^Pr[%s] в навыке ^Pr[%s] за ^I[%lu] золот^L[ой;ых;ых] | |
3089 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Эксперт | |
3090 } | |
3091 else if (masteryLevelBeingTaught == 3) | |
3092 { | |
3093 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], | |
3094 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Мастер | |
3095 } | |
3096 else if (masteryLevelBeingTaught == 4) | |
3097 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], | |
3098 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Великий Магистр | |
3099 return pTmpBuf2.data(); | |
3100 } | |
3101 | |
3102 //----- (00495461) -------------------------------------------------------- | |
3103 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) | |
3104 { | |
3105 Player *pPlayer; // ebx@3 | |
3106 const char *pText; // esi@7 | |
3107 int v17; // eax@10 | |
3108 signed __int64 v18; // qax@18 | |
3109 unsigned __int8 *v20; // ebx@32 | |
3110 int v21; // ecx@34 | |
3111 int pReputation; // eax@45 | |
3112 int v29; // eax@68 | |
3113 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
3114 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 | |
3115 char a1[100]; // [sp+B8h] [bp-80h]@3 | |
3116 int v63; // [sp+12Ch] [bp-Ch]@32 | |
3117 | |
3118 if (IsBadStringPtrA(lpsz, 1)) | |
3119 return "Invalid String Passed"; | |
3120 | |
3121 a1[0] = 0; | |
3122 pPlayer = &pParty->pPlayers[uPlayerID]; | |
3123 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); | |
3124 | |
3125 NPCData *npc = nullptr; | |
3126 if (dword_5C35D4) | |
3127 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1 | |
3128 else | |
3129 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
3130 | |
3131 //pText = a4; | |
3132 uint len = strlen(lpsz); | |
3133 for (int i = 0, dst = 0; i < len; ++i) | |
3134 { | |
3135 char c = lpsz[i]; | |
3136 if (c != '%') | |
3137 pTmpBuf2[dst++] = c; | |
3138 else | |
3139 { | |
3140 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0'; | |
3141 | |
3142 switch (v17) | |
3143 { | |
3144 case 1://Подробнее | |
3145 strcat(pTmpBuf2.data(), npc->pName); | |
3146 dst = strlen(pTmpBuf2.data()); | |
3147 i += 2; | |
3148 break; | |
3149 case 2: | |
3150 strcat(pTmpBuf2.data(), pPlayer->pName); | |
3151 dst = strlen(pTmpBuf2.data()); | |
3152 i += 2; | |
3153 break; | |
3154 case 3: | |
3155 case 4: | |
3156 strcat(pTmpBuf2.data(), a1); | |
3157 dst = strlen(pTmpBuf2.data()); | |
3158 i += 2; | |
3159 break; | |
3160 case 5: | |
3161 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; | |
3162 pText = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3163 if (SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0) | |
3164 { | |
3165 if (SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11) | |
3166 { | |
3167 if (v18 < 20) | |
3168 pText = pGlobalTXT_LocalizationStrings[396];// "day" | |
3169 } | |
3170 else | |
3171 { | |
3172 pText = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3173 } | |
3174 } | |
3175 strcat(pTmpBuf2.data(), pText); | |
3176 dst = strlen(pTmpBuf2.data()); | |
3177 i += 2; | |
3178 break; | |
3179 case 6: | |
3180 if (pPlayer->uSex) | |
3181 pText = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3182 else | |
3183 pText = pGlobalTXT_LocalizationStrings[385];// "sir" | |
3184 strcat(pTmpBuf2.data(), pText); | |
3185 dst = strlen(pTmpBuf2.data()); | |
3186 i += 2; | |
3187 break; | |
3188 case 7: | |
3189 if (pPlayer->uSex) | |
3190 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3191 else | |
3192 pText = pGlobalTXT_LocalizationStrings[386];// "Sir" | |
3193 strcat(pTmpBuf2.data(), pText); | |
3194 dst = strlen(pTmpBuf2.data()); | |
3195 i += 2; | |
3196 break; | |
3197 case 8: | |
3198 v63 = 0; | |
3199 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; | |
3200 for (uint _i = 0; _i < 28; ++_i) | |
3201 { | |
3202 if ((unsigned __int16)_449B57_test_bit(v20, word_4EE150[i])) | |
3203 { | |
3204 v21 = v63; | |
3205 ++v63; | |
3206 v55[v63] = word_4EE150[i]; | |
3207 } | |
3208 } | |
3209 if (v63) | |
3210 { | |
3211 if (dword_A74CDC == -1) | |
3212 dword_A74CDC = rand() % v63; | |
3213 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; | |
3214 } | |
3215 else | |
3216 pText = (char *)pNPCTopics[55].pText; | |
3217 strcat(pTmpBuf2.data(), pText); | |
3218 dst = strlen(pTmpBuf2.data()); | |
3219 i += 2; | |
3220 break; | |
3221 case 9: | |
3222 if (npc->uSex) | |
3223 pText = pGlobalTXT_LocalizationStrings[384];// "her" | |
3224 else | |
3225 pText = pGlobalTXT_LocalizationStrings[383];// "his" | |
3226 strcat(pTmpBuf2.data(), pText); | |
3227 dst = strlen(pTmpBuf2.data()); | |
3228 i += 2; | |
3229 break; | |
3230 case 10: | |
3231 if (pPlayer->uSex) | |
3232 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3233 else | |
3234 pText = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
3235 strcat(pTmpBuf2.data(), pText); | |
3236 dst = strlen(pTmpBuf2.data()); | |
3237 i += 2; | |
3238 break; | |
3239 case 11: | |
3240 pReputation = pParty->GetPartyReputation(); | |
3241 if (pReputation >= 25) | |
3242 pText = pGlobalTXT_LocalizationStrings[379]; | |
3243 else//v25 < 25 | |
3244 { | |
3245 if (pReputation < 6) | |
3246 { | |
3247 if (pReputation >= -5)//6 >= v25 >= -5 | |
3248 pText = pGlobalTXT_LocalizationStrings[399]; | |
3249 else// v25 < -5 | |
3250 { | |
3251 if (pReputation < -24)//-24 > v25 | |
3252 pText = pGlobalTXT_LocalizationStrings[434]; | |
3253 else// -5 > v25 > -24 | |
3254 pText = pGlobalTXT_LocalizationStrings[402]; | |
3255 } | |
3256 } | |
3257 else//25 > v25 > 6 | |
3258 pText = pGlobalTXT_LocalizationStrings[392]; | |
3259 } | |
3260 strcat(pTmpBuf2.data(), pText); | |
3261 dst = strlen(pTmpBuf2.data()); | |
3262 i += 2; | |
3263 break; | |
3264 case 12: | |
3265 pReputation = npc->rep; | |
3266 if (pReputation >= 25) | |
3267 pText = pGlobalTXT_LocalizationStrings[379];//Ненавистный | |
3268 else | |
3269 { | |
3270 if (pReputation < 6) | |
3271 { | |
3272 if (pReputation >= -5) | |
3273 pText = pGlobalTXT_LocalizationStrings[399];//Нейтральная | |
3274 else | |
3275 { | |
3276 if (pReputation < -24) | |
3277 pText = pGlobalTXT_LocalizationStrings[434];//Почтенная | |
3278 else | |
3279 pText = pGlobalTXT_LocalizationStrings[402];//Дружелюбный | |
3280 } | |
3281 } | |
3282 else | |
3283 pText = pGlobalTXT_LocalizationStrings[392];//Недружелюбный | |
3284 } | |
3285 strcat(pTmpBuf2.data(), pText); | |
3286 dst = strlen(pTmpBuf2.data()); | |
3287 i += 2; | |
3288 break; | |
3289 case 13: | |
3290 strcat(pTmpBuf2.data(), pNPCStats->sub_495366_MispronounceName(pPlayer->pName[0], pPlayer->uSex)); | |
3291 dst = strlen(pTmpBuf2.data()); | |
3292 i += 2; | |
3293 break; | |
3294 case 14: | |
3295 if (npc->uSex) | |
3296 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
3297 else | |
3298 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
3299 strcat(pTmpBuf2.data(), pText); | |
3300 dst = strlen(pTmpBuf2.data()); | |
3301 i += 2; | |
3302 break; | |
3303 case 15: | |
3304 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" | |
3305 dst = strlen(pTmpBuf2.data()); | |
3306 i += 2; | |
3307 break; | |
3308 case 16: | |
3309 if (npc->uSex) | |
3310 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
3311 else | |
3312 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
3313 strcat(pTmpBuf2.data(), pText); | |
3314 dst = strlen(pTmpBuf2.data()); | |
3315 i += 2; | |
3316 break; | |
3317 case 17://текст наёмного НПС | |
3318 { | |
3319 uint pay_percentage = pNPCStats->pProfessions[npc->uProfession].uHirePrice / 100; | |
3320 if (!pay_percentage) | |
3321 pay_percentage = 1; | |
3322 sprintf(a1, "%lu", pay_percentage); | |
3323 strcat(pTmpBuf2.data(), a1); | |
3324 dst = strlen(pTmpBuf2.data()); | |
3325 i += 2; | |
3326 break; | |
3327 } | |
3328 case 18: | |
3329 case 19: | |
3330 case 20: | |
3331 case 21: | |
3332 case 22: | |
3333 case 26: | |
3334 strncpy(a1, lpsz + i + 1, 2); | |
3335 sprintf(a1, "%lu", atoi(a1)); | |
3336 strcat(pTmpBuf2.data(), a1); | |
3337 dst = strlen(pTmpBuf2.data()); | |
3338 i += 2; | |
3339 break; | |
3340 case 23: | |
3341 if (pMapStats->GetMapInfo(pCurrentMapName)) | |
3342 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName; | |
3343 else | |
3344 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" | |
3345 strcat(pTmpBuf2.data(), pText); | |
3346 dst = strlen(pTmpBuf2.data()); | |
3347 i += 2; | |
3348 break; | |
3349 case 24://название товара в продаже | |
3350 sprintfex(a1, format_4E2D80, Color16(255, 255, 155), a3->GetDisplayName()); | |
3351 strcat(pTmpBuf2.data(), a1); | |
3352 dst = strlen(pTmpBuf2.data()); | |
3353 i += 2; | |
3354 break; | |
3355 case 25: | |
3356 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
3357 switch (a5) | |
3358 { | |
3359 case 3: | |
3360 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
3361 break; | |
3362 case 4: | |
3363 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
3364 break; | |
3365 case 5: | |
3366 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
3367 break; | |
3368 case 6: | |
3369 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
3370 break; | |
3371 } | |
3372 sprintfex(a1, "%lu", v29); | |
3373 strcat(pTmpBuf2.data(), a1); | |
3374 dst = strlen(pTmpBuf2.data()); | |
3375 i += 2; | |
3376 break; | |
3377 case 27://текст продажи | |
3378 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
3379 if (a5 == 3) | |
3380 { | |
3381 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
3382 if (a3->IsBroken()) | |
3383 v29 = 1; | |
3384 sprintfex(a1, "%lu", v29); | |
3385 strcat(pTmpBuf2.data(), a1); | |
3386 dst = strlen(pTmpBuf2.data()); | |
3387 i += 2; | |
3388 break; | |
3389 } | |
3390 if (a5 != 4) | |
3391 { | |
3392 if (a5 == 5) | |
3393 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
3394 else | |
3395 { | |
3396 if (a5 == 6) | |
3397 { | |
3398 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
3399 if (a3->IsBroken()) | |
3400 v29 = 1; | |
3401 if (!v29) | |
3402 v29 = 1; | |
3403 sprintfex(a1, "%lu", v29); | |
3404 strcat(pTmpBuf2.data(), a1); | |
3405 dst = strlen(pTmpBuf2.data()); | |
3406 i += 2; | |
3407 break; | |
3408 } | |
3409 } | |
3410 sprintfex(a1, "%lu", v29); | |
3411 strcat(pTmpBuf2.data(), a1); | |
3412 dst = strlen(pTmpBuf2.data()); | |
3413 i += 2; | |
3414 break; | |
3415 } | |
3416 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); | |
3417 strcat(pTmpBuf2.data(), a1); | |
3418 dst = strlen(pTmpBuf2.data()); | |
3419 i += 2; | |
3420 break; | |
3421 case 28://профессия | |
3422 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); | |
3423 dst = strlen(pTmpBuf2.data()); | |
3424 i += 2; | |
3425 break; | |
3426 case 29: | |
3427 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); | |
3428 strcat(pTmpBuf2.data(), a1); | |
3429 dst = strlen(pTmpBuf2.data()); | |
3430 i += 2; | |
3431 break; | |
3432 case 30: | |
3433 if (!a6) | |
3434 { | |
3435 strcat(pTmpBuf2.data(), a4); | |
3436 dst = strlen(pTmpBuf2.data()); | |
3437 i += 2; | |
3438 break; | |
3439 } | |
3440 init_summoned_item(&v56, *a6); | |
3441 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); | |
3442 strcat(pTmpBuf2.data(), a1); | |
3443 dst = strlen(pTmpBuf2.data()); | |
3444 i += 2; | |
3445 break; | |
3446 case 31: | |
3447 case 32: | |
3448 case 33: | |
3449 case 34: | |
3450 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); | |
3451 dst = strlen(pTmpBuf2.data()); | |
3452 i += 2; | |
3453 break; | |
3454 default: | |
3455 if (v17 <= 50 || v17 > 70) | |
3456 { | |
3457 strncpy(a1, lpsz + i + 1, 2); | |
3458 sprintf(a1, "%lu", atoi(a1)); | |
3459 strcat(pTmpBuf2.data(), a1); | |
3460 dst = strlen(pTmpBuf2.data()); | |
3461 i += 2; | |
3462 break; | |
3463 } | |
3464 if (v17 - 51 >= 20) | |
3465 { | |
3466 strcat(pTmpBuf2.data(), a4); | |
3467 dst = strlen(pTmpBuf2.data()); | |
3468 i += 2; | |
3469 break; | |
3470 } | |
3471 init_summoned_item(&v56, pParty->PartyTimes._s_times[v17 - 51]); | |
3472 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); | |
3473 strcat(pTmpBuf2.data(), a1); | |
3474 dst = strlen(pTmpBuf2.data()); | |
3475 i += 2; | |
3476 break; | |
3477 } | |
3478 } | |
3479 } | |
3480 return pTmpBuf2.data(); | |
3481 } | |
3482 | |
3483 //----- (0044C175) -------------------------------------------------------- | |
3484 void ShowStatusBarString(const char *pString, unsigned int uNumSeconds) | |
3485 { | |
3486 strcpy(GameUI_Footer_TimedString.data(), pString); | |
3487 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount(); | |
3488 | |
3489 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; | |
3490 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data())) | |
3491 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; | |
3492 } | |
3493 | |
3494 //----- (0044C1D0) -------------------------------------------------------- | |
3495 void ShowNothingHereStatus() | |
3496 { | |
3497 if (!GameUI_Footer_TimeLeft) | |
3498 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here | |
3499 } | |
3500 | |
3501 //----- (0044C28B) -------------------------------------------------------- | |
3502 int const_2() | |
3503 { | |
3504 return 2; | |
3505 } |