Mercurial > mm7
annotate GUI/UI/UIArena.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
rev | line source |
---|---|
2501 | 1 #define _CRTDBG_MAP_ALLOC |
2567 | 2 #define _CRT_SECURE_NO_WARNINGS |
2501 | 3 #include <stdlib.h> |
4 #include <crtdbg.h> | |
5 | |
2541 | 6 #include "Engine/Engine.h" |
7 | |
2501 | 8 #include "../../Engine/Graphics/Sprites.h" |
9 | |
2502 | 10 #include "../../GUI/GUIWindow.h" |
11 #include "../../GUI/GUIFont.h" | |
2501 | 12 #include "../../Engine/Party.h" |
2502 | 13 #include "../../Media/Audio/AudioPlayer.h" |
2501 | 14 #include "../../Engine/Graphics/Outdoor.h" |
15 #include "../../Engine/LOD.h" | |
16 #include "../../Engine/Objects/Actor.h" | |
17 #include "../../Engine/Events.h" | |
18 #include "../../Engine/Graphics/Viewport.h" | |
19 #include "../../Engine/texts.h" | |
20 | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2567
diff
changeset
|
21 #include "GUI/UI/UIHouses.h" |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2567
diff
changeset
|
22 |
2501 | 23 std::array<Vec2_int_, 20> pMonsterArenaPlacements = |
24 {{ | |
25 Vec2_int_(1524, 8332), | |
26 Vec2_int_(2186, 8844), | |
27 Vec2_int_(3219, 9339), | |
28 Vec2_int_(4500, 9339), | |
29 Vec2_int_(5323, 9004), | |
30 Vec2_int_(0x177D, 0x2098), | |
31 Vec2_int_(0x50B, 0x1E15), | |
32 Vec2_int_(0x18FF, 0x1E15), | |
33 Vec2_int_(0x50B, 0xD69), | |
34 Vec2_int_(0x18FF, 0x1B15), | |
35 Vec2_int_(0x50B, 0x1021), | |
36 Vec2_int_(0x18FF, 0x1848), | |
37 Vec2_int_(0x50B, 0x12D7), | |
38 Vec2_int_(0x18FF, 0x15A3), | |
39 Vec2_int_(0x50B, 0x14DB), | |
40 Vec2_int_(0x18FF, 0x12D7), | |
41 Vec2_int_(0x50B, 0x1848), | |
42 Vec2_int_(0x18FF, 0x1021), | |
43 Vec2_int_(0x50B, 0x1B15), | |
44 Vec2_int_(0x18FF, 0xD69), | |
45 }} | |
46 ; | |
47 | |
48 //----- (004BBCDD) -------------------------------------------------------- | |
49 void Arena_SelectionFightLevel() | |
50 { | |
51 signed int v0; // ebp@3 | |
52 GUIButton *v5; // eax@18 | |
53 GUIButton *v6; // esi@19 | |
54 | |
55 if ( pParty->field_7B5_in_arena_quest ) | |
56 { | |
57 if ( pParty->field_7B5_in_arena_quest == -1 ) | |
58 { | |
59 uDialogueType = DIALOGUE_ARENA_ALREADY_WON; | |
60 } | |
61 else | |
62 { | |
63 v0 = 0; | |
64 for (size_t i = 0; i < uNumActors; i++ ) | |
65 { | |
66 if ( pActors[i].uAIState == Dead | |
67 || pActors[i].uAIState == Removed | |
68 || pActors[i].uAIState == Disabled | |
69 || pActors[i].uSummonerID != 0 && PID_TYPE(pActors[i].uSummonerID) == OBJECT_Player) | |
70 ++v0; | |
71 } | |
72 if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) | |
73 { | |
74 uDialogueType = DIALOGUE_ARENA_REWARD; | |
75 ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1);//Ritor1:I dont know | |
76 for ( uint i= 0; i < 4; i++ ) | |
77 pParty->pPlayers[i].SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); | |
78 pParty->PartyFindsGold(gold_transaction_amount, 0); | |
2534 | 79 pAudioPlayer->PlaySound(SOUND_51heroism03, 0, 0, -1, 0, 0, 0, 0); |
2501 | 80 pParty->field_7B5_in_arena_quest = -1; |
81 } | |
82 else | |
83 { | |
84 uDialogueType = DIALOGUE_ARENA_WELCOME; | |
85 pParty->vPosition.x = 3849; | |
86 pParty->vPosition.y = 5770; | |
87 pParty->vPosition.z = 1; | |
88 pParty->uFallStartY = 1; | |
89 pParty->sRotationY = 512; | |
90 pParty->sRotationX = 0; | |
91 pParty->uFallSpeed = 0; | |
2534 | 92 pAudioPlayer->PlaySound(SOUND_51heroism03, 0, 0, -1, 0, 0, 0, 0); |
2501 | 93 } |
94 } | |
95 } | |
96 else | |
97 { | |
98 uDialogueType = DIALOGUE_ARENA_WELCOME; | |
99 v5 = pDialogueWindow->pControlsHead; | |
100 if ( v5 ) | |
101 { | |
102 do | |
103 { | |
104 v6 = v5->pNext; | |
105 free(v5); | |
106 v5 = v6; | |
107 } | |
108 while ( v6 ); | |
109 } | |
110 pDialogueWindow->pControlsHead = 0; | |
111 pDialogueWindow->pControlsTail = 0; | |
112 pDialogueWindow->uNumControls = 0; | |
113 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, | |
114 pGlobalTXT_LocalizationStrings[79], //Close, Закрыть | |
2574 | 115 ui_exit_cancel_button_background, 0); |
2501 | 116 pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 85, 0, "", 0); |
117 pDialogueWindow->CreateButton(480, 190, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 86, 0, "", 0); | |
118 pDialogueWindow->CreateButton(480, 220, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 87, 0, "", 0); | |
119 pDialogueWindow->CreateButton(480, 250, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 88, 0, "", 0); | |
120 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); | |
121 } | |
122 } | |
123 | |
124 | |
125 //----- (004BC109) -------------------------------------------------------- | |
126 void ArenaFight() | |
127 { | |
128 int v0; // edi@1 | |
129 char *v1; // eax@7 | |
130 int v3; // eax@10 | |
131 signed int v4; // esi@10 | |
132 signed int v6; // ebx@34 | |
133 signed int v13; // eax@49 | |
134 int v14; // esi@49 | |
135 int v15; // edx@50 | |
136 int v16; // eax@51 | |
137 signed int v17; // ecx@51 | |
138 int v18; // edx@53 | |
139 int i; // edi@55 | |
140 signed int v22; // [sp-4h] [bp-144h]@51 | |
141 __int16 v23[100]; // [sp+Ch] [bp-134h]@39 | |
142 GUIWindow window; // [sp+D4h] [bp-6Ch]@1 | |
143 __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 | |
144 int v26; // [sp+134h] [bp-Ch]@1 | |
145 int num_monsters; // [sp+13Ch] [bp-4h]@17 | |
146 | |
147 v26 = 0; | |
148 pParty->field_7B5_in_arena_quest = uDialogueType; | |
149 memcpy(&window, pDialogueWindow, sizeof(window)); | |
150 window.uFrameWidth = game_viewport_width; | |
151 window.uFrameZ = 452; | |
152 v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7;// Пожалуйста, подождите пока я вызываю существ. Удачи. | |
153 pRenderer->BeginSceneD3D(); | |
154 | |
155 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
156 pIndoor->Draw(); | |
157 else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
158 pOutdoor->Draw(); | |
159 | |
160 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); | |
161 pRenderer->BeginScene(); | |
162 //if ( pRenderer->pRenderD3D ) | |
163 pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, | |
164 pViewport->uViewportBR_X - pViewport->uViewportTL_X, | |
165 pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, | |
166 0x7FF); | |
167 | |
2574 | 168 pRenderer->DrawTextureCustomHeight( |
169 8/640.0f, | |
170 (352 - v0)/480.0f, | |
171 ui_leather_mm7, | |
172 v0); | |
2501 | 173 |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2567
diff
changeset
|
174 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - v0)/480.0f, _591428_endcap); |
2501 | 175 v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);//Пожалуйста, подождите пока я вызываю существ. Удачи. |
176 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); | |
177 pRenderer->EndScene(); | |
178 pRenderer->Present(); | |
179 pParty->vPosition.x = 3849; | |
180 pParty->vPosition.y = 5770; | |
181 pParty->vPosition.z = 1; | |
182 pParty->uFallStartY = 1; | |
183 pParty->sRotationY = 512; | |
184 pParty->sRotationX = 0; | |
185 pParty->uFallSpeed = 0; | |
186 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
187 { | |
188 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; | |
189 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
190 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
191 ++pMessageQueue_50CBD0->uNumMessages; | |
192 }*/ | |
193 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0); | |
194 //v2 = pParty->pPlayers.data(); | |
195 for ( uint i = 0; i < 4; i++ ) | |
196 { | |
197 v3 = pParty->pPlayers[i].GetActualLevel(); | |
198 v4 = v26; | |
199 if ( v3 > v26 ) | |
200 { | |
201 v26 = pParty->pPlayers[i].GetActualLevel(); | |
202 v4 = pParty->pPlayers[i].GetActualLevel(); | |
203 } | |
204 //++v2; | |
205 } | |
206 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); | |
207 if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) | |
208 { | |
209 num_monsters = v4; | |
210 v4 /= 2; | |
211 } | |
212 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) | |
213 { | |
214 //v5 = (signed __int64)((double)v26 * 1.5); | |
215 num_monsters = (int)((double)v26 * 1.5); | |
216 v4 /= 2; | |
217 } | |
218 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) | |
219 { | |
220 //LODWORD(v5) = 2 * v4; | |
221 num_monsters = 2 * v4; | |
222 v4 /= 2; | |
223 } | |
224 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) | |
225 { | |
226 num_monsters = 2 * v4; | |
227 v4 /= 2; | |
228 } | |
229 if ( v4 < 1 ) | |
230 v4 = 1; | |
231 if ( v4 > 100 ) | |
232 v4 = 100; | |
233 if ( num_monsters > 100 ) | |
234 num_monsters = 100; | |
235 if ( v4 < 2 ) | |
236 v4 = 2; | |
237 if ( num_monsters < 2 ) | |
238 num_monsters = 2; | |
239 v6 = 0; | |
240 //v27 = 1; | |
241 //v7 = (char *)&pMonsterStats->pInfos[1].uLevel; | |
242 for ( uint i = 1; i <= 258; i++ ) | |
243 { | |
244 if ( pMonsterStats->pInfos[i].uAIType != 1 )//if ( v7[8] != 1 ) | |
245 { | |
246 if ( !MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8) ) //!MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) | |
247 { | |
248 //v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel; | |
249 if ( pMonsterStats->pInfos[i].uLevel >= v4 ) | |
250 { | |
251 if ( pMonsterStats->pInfos[i].uLevel <= num_monsters ) | |
252 v23[v6++] = i; | |
253 } | |
254 } | |
255 } | |
256 // ++v27; | |
257 //v7 += 88; | |
258 } | |
259 //while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); | |
260 num_monsters = 6; | |
261 if ( v6 < 6 ) | |
262 num_monsters = v6; | |
263 //v9 = 0; | |
264 if ( num_monsters > 0 ) | |
265 { | |
266 for ( uint i = 0; i < num_monsters; i++ ) | |
267 { | |
268 //v10 = rand(); | |
269 //++v9; | |
270 //v12 = __OFSUB__(v9, num_monsters); | |
271 //v11 = v9 - num_monsters < 0; | |
272 //*((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6]; | |
273 monster_ids[i] = v23[rand() % v6]; | |
274 } | |
275 //while ( v11 ^ v12 ); | |
276 } | |
277 if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) | |
278 { | |
279 v16 = rand(); | |
280 v17 = 3; | |
281 v22 = 50; | |
282 v18 = v16 % v17; | |
283 v13 = v22; | |
284 v14 = v18 + 6; | |
285 } | |
286 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) | |
287 { | |
288 v16 = rand(); | |
289 v17 = 7; | |
290 v22 = 100; | |
291 v18 = v16 % v17; | |
292 v13 = v22; | |
293 v14 = v18 + 6; | |
294 } | |
295 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) | |
296 { | |
297 v15 = rand() % 11; | |
298 v13 = 200; | |
299 v14 = v15 + 10; | |
300 } | |
301 else | |
302 { | |
303 if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) | |
304 { | |
305 v13 = 500; | |
306 v14 = 20; | |
307 } | |
308 //else | |
309 //{ | |
310 //v14 = v27; | |
311 //v13 = gold_transaction_amount; | |
312 //} | |
313 } | |
314 gold_transaction_amount = v26 * v13; | |
315 for ( i = 0; i < v14; ++i ) | |
316 Actor::Arena_summon_actor(monster_ids[rand() % num_monsters], pMonsterArenaPlacements[i].x, pMonsterArenaPlacements[i].y, 1); | |
2534 | 317 pAudioPlayer->PlaySound(SOUND_51heroism03, 0, 0, -1, 0, 0, 0, 0); |
2501 | 318 } |