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