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