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