World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл UIArena.cpp

См. исходные тексты.

Функции

void Arena_SelectionFightLevel ()
 
void ArenaFight ()
 

Переменные

std::array< Vec2_int_, 20 > pMonsterArenaPlacements
 

Функции

◆ Arena_SelectionFightLevel()

void Arena_SelectionFightLevel ( )

См. определение в файле UIArena.cpp строка 34

34  {
35  // GUIButton *v5; // eax@18
36  // GUIButton *v6; // esi@19
37 
39  if (pParty->field_7B5_in_arena_quest == -1) {
41  } else {
42  int v0 = 0;
43  for (size_t i = 0; i < uNumActors; i++) {
44  if (pActors[i].uAIState == Dead ||
45  pActors[i].uAIState == Removed ||
46  pActors[i].uAIState == Disabled ||
47  pActors[i].uSummonerID != 0 &&
48  PID_TYPE(pActors[i].uSummonerID) == OBJECT_Player)
49  ++v0;
50  }
51  if (v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) {
53  ++*((char *)&pParty->monster_for_hunting_killed[3] +
54  (unsigned __int8)pParty->field_7B5_in_arena_quest +
55  1); // Ritor1:I dont know
56  for (uint i = 0; i < 4; i++)
57  pParty->pPlayers[i].SetVariable(
58  VAR_Award,
59  (unsigned __int8)pParty->field_7B5_in_arena_quest + 3);
61  pAudioPlayer->PlaySound(SOUND_51heroism03, 0, 0, -1, 0, 0);
63  } else {
65  pParty->vPosition.x = 3849;
66  pParty->vPosition.y = 5770;
67  pParty->vPosition.z = 1;
68  pParty->uFallStartY = 1;
69  pParty->sRotationY = 512;
70  pParty->sRotationX = 0;
71  pParty->uFallSpeed = 0;
72  pAudioPlayer->PlaySound(SOUND_51heroism03, 0, 0, -1, 0, 0);
73  }
74  }
75  } else {
79  471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0,
80  localization->GetString(79), // Close, Закрыть
82  pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0,
84  pDialogueWindow->CreateButton(480, 190, 0x8Cu, 0x1Eu, 1, 0,
86  pDialogueWindow->CreateButton(480, 220, 0x8Cu, 0x1Eu, 1, 0,
88  pDialogueWindow->CreateButton(480, 250, 0x8Cu, 0x1Eu, 1, 0,
91  }
92 }

Перекрестные ссылки GUIWindow::_41D08F_set_keyboard_control_group(), GUIWindow::CreateButton(), Dead, GUIWindow::DeleteButtons(), DIALOGUE_ARENA_ALREADY_WON, DIALOGUE_ARENA_REWARD, DIALOGUE_ARENA_WELCOME, Disabled, Party::field_7B5_in_arena_quest, Localization::GetString(), gold_transaction_amount, localization, Party::monster_for_hunting_killed, OBJECT_Player, pActors, Party::PartyFindsGold(), pAudioPlayer, pBtn_ExitCancel, pDialogueWindow, AudioPlayer::PlaySound(), pParty, Party::pPlayers, Removed, SOUND_51heroism03, Party::sRotationX, Party::sRotationY, uDialogueType, Party::uFallSpeed, Party::uFallStartY, ui_exit_cancel_button_background, UIMSG_Escape, UIMSG_SelectNPCDialogueOption, uNumActors, VAR_Award и Party::vPosition.

Используется в OnSelectNPCDialogueOption().

+ Граф вызовов:
+ Граф вызова функции:

◆ ArenaFight()

void ArenaFight ( )

MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8)

См. определение в файле UIArena.cpp строка 95

95  {
96  int v0; // edi@1
97  int v3; // eax@10
98  signed int v4; // esi@10
99  signed int v6; // ebx@34
100  signed int v13; // eax@49
101  int v14; // esi@49
102  int v15; // edx@50
103  int v16; // eax@51
104  signed int v17; // ecx@51
105  int v18; // edx@53
106  int i; // edi@55
107  signed int v22; // [sp-4h] [bp-144h]@51
108  __int16 v23[100]; // [sp+Ch] [bp-134h]@39
109  __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56
110  int v26; // [sp+134h] [bp-Ch]@1
111  int num_monsters; // [sp+13Ch] [bp-4h]@17
112 
113  v26 = 0;
117  window.uFrameZ = 452;
119  window.uFrameWidth, 13) +
120  7; // Пожалуйста, подождите пока я вызываю существ. Удачи.
121  render->BeginSceneD3D();
122 
124  pIndoor->Draw();
126  pOutdoor->Draw();
127 
128  render->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
129  render->BeginScene();
130  // if ( render->pRenderD3D )
131  render->FillRectFast(
135 
136  render->DrawTextureCustomHeight(8 / 640.0f, (352 - v0) / 480.0f,
137  ui_leather_mm7, v0);
138 
139  render->DrawTextureAlphaNew(8 / 640.0f, (347 - v0) / 480.0f,
142  localization->GetString(575), window.uFrameWidth,
143  0xDu); // Пожалуйста, подождите пока я вызываю существ. Удачи.
144  pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0);
145  render->EndScene();
146  render->Present();
147  pParty->vPosition.x = 3849;
148  pParty->vPosition.y = 5770;
149  pParty->vPosition.z = 1;
150  pParty->uFallStartY = 1;
151  pParty->sRotationY = 512;
152  pParty->sRotationX = 0;
153  pParty->uFallSpeed = 0;
154  /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
155  {
156  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType =
157  UIMSG_Escape;
158  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param =
159  1;
160  *(&pMessageQueue_50CBD0->uNumMessages + 3 *
161  pMessageQueue_50CBD0->uNumMessages + 3) = 0;
162  ++pMessageQueue_50CBD0->uNumMessages;
163  }*/
164  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
165  // v2 = pParty->pPlayers.data();
166  for (uint i = 0; i < 4; i++) {
167  v3 = pParty->pPlayers[i].GetActualLevel();
168  v4 = v26;
169  if (v3 > v26) {
170  v26 = pParty->pPlayers[i].GetActualLevel();
171  v4 = pParty->pPlayers[i].GetActualLevel();
172  }
173  // ++v2;
174  }
175  // while ( (signed int)v2 < (signed int)pParty->pHirelings.data() );
177  num_monsters = v4;
178  v4 /= 2;
180  // v5 = (signed __int64)((double)v26 * 1.5);
181  num_monsters = (int)((double)v26 * 1.5);
182  v4 /= 2;
184  // LODWORD(v5) = 2 * v4;
185  num_monsters = 2 * v4;
186  v4 /= 2;
188  num_monsters = 2 * v4;
189  v4 /= 2;
190  }
191  if (v4 < 1) v4 = 1;
192  if (v4 > 100) v4 = 100;
193  if (num_monsters > 100) num_monsters = 100;
194  if (v4 < 2) v4 = 2;
195  if (num_monsters < 2) num_monsters = 2;
196  v6 = 0;
197  // v27 = 1;
198  // v7 = (char *)&pMonsterStats->pInfos[1].uLevel;
199  for (unsigned int i = 1; i <= 258; i++) {
200  if (pMonsterStats->pInfos[i].uAIType != 1) { // if ( v7[8] != 1 )
204  // v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel;
206  if (pMonsterStats->pInfos[i].uLevel >= v4) {
207  if (pMonsterStats->pInfos[i].uLevel <= num_monsters)
208  v23[v6++] = i;
209  }
210  }
211  }
212  // ++v27;
213  // v7 += 88;
214  }
215  // while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel
216  // );
217  num_monsters = 6;
218  if (v6 < 6) num_monsters = v6;
219  // v9 = 0;
220  if (num_monsters > 0) {
221  for (uint i = 0; i < num_monsters; i++) {
222  // v10 = rand();
223  // ++v9;
224  // v12 = __OFSUB__(v9, num_monsters);
225  // v11 = v9 - num_monsters < 0;
226  // *((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6];
227  monster_ids[i] = v23[rand() % v6];
228  }
229  // while ( v11 ^ v12 );
230  }
231 
233  v16 = rand();
234  v17 = 3;
235  v22 = 50;
236  v18 = v16 % v17;
237  v13 = v22;
238  v14 = v18 + 6;
240  v16 = rand();
241  v17 = 7;
242  v22 = 100;
243  v18 = v16 % v17;
244  v13 = v22;
245  v14 = v18 + 6;
247  v15 = rand() % 11;
248  v13 = 200;
249  v14 = v15 + 10;
250  } else {
252  v13 = 500;
253  v14 = 20;
254  }
255  // else
256  //{
257  // v14 = v27;
258  // v13 = gold_transaction_amount;
259  //}
260  }
261  gold_transaction_amount = v26 * v13;
262  for (i = 0; i < v14; ++i)
263  Actor::Arena_summon_actor(monster_ids[rand() % num_monsters],
265  pMonsterArenaPlacements[i].y, 1);
266  pAudioPlayer->PlaySound(SOUND_51heroism03, 0, 0, -1, 0, 0);
267 }

Перекрестные ссылки _591428_endcap, Actor::Arena_summon_actor(), MonsterStats::BelongsToSupertype(), GUIFont::CalcTextHeight(), DIALOGUE_ARENA_SELECT_CHAMPION, DIALOGUE_ARENA_SELECT_KNIGHT, DIALOGUE_ARENA_SELECT_PAGE, DIALOGUE_ARENA_SELECT_SQUIRE, OutdoorLocation::Draw(), IndoorLocation::Draw(), GUIWindow::DrawText(), Party::field_7B5_in_arena_quest, GUIFont::FitTextInAWindow(), game_viewport_width, Localization::GetString(), gold_transaction_amount, LEVEL_Indoor, LEVEL_Outdoor, localization, MONSTER_SUPERTYPE_8, pAudioPlayer, pDialogueWindow, pFontArrus, pIndoor, MonsterStats::pInfos, AudioPlayer::PlaySound(), pMessageQueue_50CBD0, pMonsterArenaPlacements, pMonsterStats, pOutdoor, pParty, Party::pPlayers, pViewport, render, SOUND_51heroism03, Party::sRotationX, Party::sRotationY, MonsterInfo::uAIType, uCurrentlyLoadedLevelType, uDialogueType, Party::uFallSpeed, Party::uFallStartY, GUIWindow::uFrameWidth, ui_leather_mm7, MonsterInfo::uID, UIMSG_Escape, MonsterInfo::uLevel, Viewport::uViewportBR_X, Viewport::uViewportBR_Y, Viewport::uViewportTL_X, Viewport::uViewportTL_Y и Party::vPosition.

Используется в OnSelectNPCDialogueOption().

+ Граф вызовов:
+ Граф вызова функции:

Переменные

◆ pMonsterArenaPlacements

std::array<Vec2_int_, 20> pMonsterArenaPlacements
Инициализатор
= {{
Vec2_int_(1524, 8332), Vec2_int_(2186, 8844),
Vec2_int_(3219, 9339), Vec2_int_(4500, 9339),
Vec2_int_(5323, 9004), Vec2_int_(0x177D, 0x2098),
Vec2_int_(0x50B, 0x1E15), Vec2_int_(0x18FF, 0x1E15),
Vec2_int_(0x50B, 0xD69), Vec2_int_(0x18FF, 0x1B15),
Vec2_int_(0x50B, 0x1021), Vec2_int_(0x18FF, 0x1848),
Vec2_int_(0x50B, 0x12D7), Vec2_int_(0x18FF, 0x15A3),
Vec2_int_(0x50B, 0x14DB), Vec2_int_(0x18FF, 0x12D7),
Vec2_int_(0x50B, 0x1848), Vec2_int_(0x18FF, 0x1021),
Vec2_int_(0x50B, 0x1B15), Vec2_int_(0x18FF, 0xD69),
}}

См. определение в файле UIArena.cpp строка 21

Используется в ArenaFight().

GUIWindow::DrawText
void DrawText(GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
Definition: GUIWindow.cpp:694
uNumActors
size_t uNumActors
Definition: Actor.cpp:39
Party::vPosition
Vec3_int_ vPosition
Definition: Party.h:250
ui_leather_mm7
Image * ui_leather_mm7
Definition: GUIWindow.cpp:106
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
Party::uFallSpeed
int uFallSpeed
Definition: Party.h:259
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
GUIWindow
Definition: GUIWindow.h:433
ui_exit_cancel_button_background
Image * ui_exit_cancel_button_background
Definition: GUIWindow.cpp:89
Viewport::uViewportTL_Y
int uViewportTL_Y
Definition: Viewport.h:23
DIALOGUE_ARENA_SELECT_SQUIRE
@ DIALOGUE_ARENA_SELECT_SQUIRE
Definition: GUIWindow.h:281
pMonsterStats
struct MonsterStats * pMonsterStats
Definition: Monsters.cpp:8
Party::sRotationX
int sRotationX
Definition: Party.h:252
GUIWindow::CreateButton
GUIButton * CreateButton(int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
Definition: GUIWindow.cpp:717
gold_transaction_amount
int gold_transaction_amount
Definition: mm7_data.cpp:775
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
Party::field_7B5_in_arena_quest
char field_7B5_in_arena_quest
Definition: Party.h:293
game_viewport_width
unsigned int game_viewport_width
Definition: mm7_data.cpp:194
localization
Localization * localization
Definition: Localization.cpp:11
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
DIALOGUE_ARENA_SELECT_KNIGHT
@ DIALOGUE_ARENA_SELECT_KNIGHT
Definition: GUIWindow.h:282
DIALOGUE_ARENA_SELECT_CHAMPION
@ DIALOGUE_ARENA_SELECT_CHAMPION
Definition: GUIWindow.h:283
GUIWindow::uFrameWidth
unsigned int uFrameWidth
Definition: GUIWindow.h:470
pIndoor
IndoorLocation * pIndoor
Definition: Indoor.cpp:49
Dead
@ Dead
Definition: Actor.h:80
GUIWindow::_41D08F_set_keyboard_control_group
void _41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5)
Definition: GUIWindow.cpp:273
Party::uFallStartY
int uFallStartY
Definition: Party.h:265
Party::PartyFindsGold
void PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal)
Definition: Party.cpp:976
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
pBtn_ExitCancel
GUIButton * pBtn_ExitCancel
Definition: GUIButton.cpp:28
pParty
Party * pParty
Definition: Party.cpp:30
MonsterInfo::uAIType
uint8_t uAIType
Definition: Monsters.h:130
pFontArrus
GUIFont * pFontArrus
Definition: GUIFont.cpp:18
GUIWindow::DeleteButtons
void DeleteButtons()
Definition: GUIWindow.cpp:305
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
Disabled
@ Disabled
Definition: Actor.h:94
MonsterInfo::uID
uint16_t uID
Definition: Monsters.h:169
IndoorLocation::Draw
void Draw()
Definition: Indoor.cpp:322
v1
GLfloat GLfloat v1
Definition: SDL_opengl_glext.h:694
GUIFont::CalcTextHeight
unsigned int CalcTextHeight(const String &str, unsigned int width, int x_offset, bool return_on_carriage=false)
Definition: GUIFont.cpp:246
pMonsterArenaPlacements
std::array< Vec2_int_, 20 > pMonsterArenaPlacements
Definition: UIArena.cpp:21
pActors
std::array< Actor, 500 > pActors
Definition: Actor.cpp:38
Viewport::uViewportBR_X
int uViewportBR_X
Definition: Viewport.h:24
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
MonsterStats::pInfos
MonsterInfo pInfos[265]
Definition: Monsters.h:194
LEVEL_Outdoor
@ LEVEL_Outdoor
Definition: Indoor.h:287
Actor::Arena_summon_actor
static void Arena_summon_actor(int monster_id, int16_t x, int y, int z)
Definition: Actor.cpp:3697
Removed
@ Removed
Definition: Actor.h:86
DIALOGUE_ARENA_ALREADY_WON
@ DIALOGUE_ARENA_ALREADY_WON
Definition: GUIWindow.h:287
Viewport::uViewportBR_Y
int uViewportBR_Y
Definition: Viewport.h:25
VAR_Award
@ VAR_Award
Definition: Events.h:140
LEVEL_Indoor
@ LEVEL_Indoor
Definition: Indoor.h:286
OBJECT_Player
@ OBJECT_Player
Definition: Actor.h:68
pViewport
struct Viewport * pViewport
Definition: mm7_data.cpp:21
MonsterStats::BelongsToSupertype
static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
Definition: Monsters.cpp:1200
uDialogueType
unsigned int uDialogueType
Definition: mm7_data.cpp:604
DIALOGUE_ARENA_SELECT_PAGE
@ DIALOGUE_ARENA_SELECT_PAGE
Definition: GUIWindow.h:280
DIALOGUE_ARENA_REWARD
@ DIALOGUE_ARENA_REWARD
Definition: GUIWindow.h:286
uint
unsigned int uint
Definition: MM7.h:4
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
DIALOGUE_ARENA_WELCOME
@ DIALOGUE_ARENA_WELCOME
Definition: GUIWindow.h:284
GUIFont::FitTextInAWindow
String FitTextInAWindow(const String &inString, unsigned int width, int uX, bool return_on_carriage=false)
Definition: GUIFont.cpp:311
MONSTER_SUPERTYPE_8
@ MONSTER_SUPERTYPE_8
Definition: Monsters.h:77
uCurrentlyLoadedLevelType
LEVEL_TYPE uCurrentlyLoadedLevelType
Definition: Indoor.cpp:52
SOUND_51heroism03
@ SOUND_51heroism03
Definition: AudioPlayer.h:102
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
v0
GLfloat v0
Definition: SDL_opengl_glext.h:693
pMessageQueue_50CBD0
struct GUIMessageQueue * pMessageQueue_50CBD0
Definition: GUIWindow.cpp:86
pDialogueWindow
GUIWindow * pDialogueWindow
Definition: GUIWindow.cpp:50
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
Viewport::uViewportTL_X
int uViewportTL_X
Definition: Viewport.h:22
OutdoorLocation::Draw
void Draw()
Definition: Outdoor.cpp:160
Party::sRotationY
int sRotationY
Definition: Party.h:251
String
std::string String
Definition: Strings.h:10
UIMSG_SelectNPCDialogueOption
@ UIMSG_SelectNPCDialogueOption
Definition: GUIWindow.h:118
_591428_endcap
Image * _591428_endcap
Definition: UIHouses.cpp:52
Party::monster_for_hunting_killed
std::array< __int16, 5 > monster_for_hunting_killed
Definition: Party.h:289
MonsterInfo::uLevel
uint8_t uLevel
Definition: Monsters.h:122
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52