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