World of Might and Magic
0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
|
См. документацию.
60 unsigned int uBufferSize) {
63 if ((ptr ==
nullptr) || (
size > uBufferSize)) {
64 Error(
"File %s Size %lu - Buffer size %lu", pContainerName,
size, uBufferSize);
67 memcpy(pBuffer, ptr,
size);
74 struct raw_event_header {
75 unsigned char evt_size;
76 unsigned char evt_id_l;
77 unsigned char evt_id_h;
78 unsigned char evt_sequence_num;
81 unsigned int offset_in;
82 raw_event_header *current_hdr;
89 current_hdr = (raw_event_header *)
pGlobalEVT.data();
94 current_hdr->evt_id_l + (current_hdr->evt_id_h << 8);
96 current_hdr->evt_sequence_num;
98 offset_in += current_hdr->evt_size + 1;
100 current_hdr = (raw_event_header *)&
pGlobalEVT[offset_in];
109 struct raw_event_header {
110 unsigned char evt_size;
111 unsigned char evt_id_l;
112 unsigned char evt_id_h;
113 unsigned char evt_sequence_num;
116 unsigned int offset_in;
117 raw_event_header *current_hdr;
127 current_hdr = (raw_event_header *)
pLevelEVT.data();
132 current_hdr->evt_id_l + (current_hdr->evt_id_h << 8);
134 current_hdr->evt_sequence_num;
136 offset_in += current_hdr->evt_size + 1;
138 current_hdr = (raw_event_header *)&
pLevelEVT[offset_in];
273 unsigned __int16 v24;
326 if (uEventID == 114) {
341 curr_seq_num = entry_line;
373 curr_seq_num = _evt->
v6 - 1;
380 ((_evt->
v9 + ((
unsigned int)_evt->
v10 << 8)) << 8))
382 if (player_choose < 0)
goto LABEL_47;
383 if (player_choose <= 3) {
386 .pActiveSkills[3486 * player_choose + _evt->
v5];
388 if (player_choose == 4) {
390 ->pActiveSkills[_evt->
v5];
392 if (player_choose == 5) {
394 v21 = 3486 * v130 + _evt->
v5;
396 HEXRAYS_LOWORD(v21) =
403 while (v23 < v19 || !*(&v136 + _evt->
v6)) {
410 curr_seq_num = _evt->
v11 - 1;
417 .pActiveSkills[_evt->
v5 +
425 if ((v24 & 0x3F) >= v19 && *(&v136 + _evt->
v6)) {
426 curr_seq_num = _evt->
v11 - 1;
434 if (canShowMessages) {
436 memset(&Dst, 0, 0x344u);
440 ((_evt->
v7 + ((
unsigned int)_evt->
v8 << 8)) << 8))
448 ((_evt->
v7 + ((
unsigned int)_evt->
v8 << 8)) << 8))
454 if (EVT_DWORD(_evt->
v5)) {
468 v27 = EVT_DWORD(_evt->
v5);
476 pEventID = _evt->
v10 +
482 ((_evt->
v6 + ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
486 if (pIndex == 0) pNPC->
evt_A = pEventID;
487 if (pIndex == 1) pNPC->
evt_B = pEventID;
488 if (pIndex == 2) pNPC->
evt_C = pEventID;
489 if (pIndex == 3) pNPC->
evt_D = pEventID;
490 if (pIndex == 4) pNPC->
evt_E = pEventID;
491 if (pIndex == 5) pNPC->
evt_F = pEventID;
493 if (pEventID == 78) {
501 window->GetHeight(), 170,
"");
503 61, 424, 31, 0, 2, 94,
506 177, 424, 31, 0, 2, 94,
509 292, 424, 31, 0, 2, 94,
512 407, 424, 31, 0, 2, 94,
525 EVT_DWORD(_evt->
v9), _evt->
v13);
536 ((_evt->
v6 + ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
537 << 8)] = _evt->
v9 + ((
uint)_evt->
v10 << 8);
542 *(&
pActors[0].uGroup + 0x11000000 * _evt->
v8 +
544 ((_evt->
v6 + ((
uint)_evt->
v7 << 8)) << 8))) =
554 ((_evt->
v6 + ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
562 if (
pActors[actor_id].uGroup == v38)
563 pActors[actor_id].uGroup = v39;
570 ((_evt->
v6 + ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
578 if (
pActors[actor_id].uGroup == v42)
597 window->GetHeight(), 165, 0);
612 curr_seq_num = _evt->
v5 - 1;
618 if (_evt->
v5 <= 3u) {
621 }
else if (_evt->
v5 == 4) {
624 }
else if (_evt->
v5 == 5) {
625 for (
int i = 0; i < 4; ++i)
638 }
else if (_evt->
v5 == 4) {
641 }
else if (_evt->
v5 == 5) {
642 for (
int i = 0; i < 4; ++i)
652 player_choose = _evt->
v5;
660 ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
678 _evt->
v25, _evt->
v26, 0, 0);
682 pValue = EVT_DWORD(_evt->
v7);
683 if (player_choose <= 3) {
684 if (
pPlayers[player_choose]->CompareVariable(
688 curr_seq_num = _evt->
v11 - 1;
690 }
else if (player_choose == 4) {
696 curr_seq_num = _evt->
v11 - 1;
699 }
else if (player_choose == 5) {
701 for (
int i = 1; i < 5; ++i) {
706 curr_seq_num = _evt->
v11 - 1;
711 }
else if (player_choose == 6) {
712 if (
pPlayers[rand() % 4 + 1]->CompareVariable(
716 curr_seq_num = _evt->
v11 - 1;
724 EVT_BYTE(_evt->
v10))) {
726 curr_seq_num = _evt->
v11 - 1;
732 pValue = EVT_DWORD(_evt->
v7);
733 if (player_choose <= 3) {
736 }
else if (player_choose == 4) {
740 }
else if (player_choose == 5) {
742 for (
int i = 1; i < 5; ++i) {
743 if (
pPlayers[i]->HasItem(pValue, 1)) {
750 for (
int i = 1; i < 5; ++i)
754 }
else if (player_choose == 6) {
761 pValue = EVT_DWORD(_evt->
v7);
762 if (player_choose <= 3) {
765 }
else if (player_choose == 4) {
769 }
else if (player_choose == 5) {
771 for (
int i = 1; i < 5; ++i)
774 }
else if (player_choose == 6) {
781 pValue = EVT_DWORD(_evt->
v7);
782 if (player_choose <= 3) {
786 }
else if (player_choose == 4) {
790 }
else if (player_choose == 5) {
791 for (
int i = 1; i < 5; ++i) {
795 }
else if (player_choose == 6) {
799 v83 = EVT_WORD(_evt->
v5);
801 v83 == 22 || v83 == 23 || v83 == 24) {
831 curr_seq_num = v11 - 1;
838 v11 = (
unsigned __int8)*(
840 rand() % ((_evt->
v5 != 0) + (_evt->
v6 != 0) +
841 (_evt->
v7 != 0) + (_evt->
v8 != 0) +
842 (_evt->
v9 != 0) + (_evt->
v10 != 0)));
843 curr_seq_num = v11 - 1;
848 if ((
unsigned __int8)_evt->
v5 <= 3) {
850 .ReceiveDamage(EVT_DWORD(_evt->
v7),
871 for (
uint pl_id = 0; pl_id < 4; pl_id++)
882 EVT_DWORD(_evt->
v9), _evt->
v13);
897 EVT_DWORD(_evt->
v9), _evt->
v13);
905 v90 = EVT_DWORD(_evt->
v5);
911 if (canShowMessages == 1) {
918 if (canShowMessages == 1) {
938 EVT_DWORD(_evt->
v8), EVT_DWORD(_evt->
v12),
939 EVT_DWORD(_evt->
v16), EVT_DWORD(_evt->
v20),
940 EVT_DWORD(_evt->
v24), EVT_DWORD(_evt->
v28));
955 _evt->
v5, _evt->
v6, _evt->
v7, EVT_DWORD(_evt->
v8),
956 EVT_DWORD(_evt->
v12), EVT_DWORD(_evt->
v16),
957 EVT_DWORD(_evt->
v20), EVT_DWORD(_evt->
v24));
979 ((_evt->
v6 + ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
983 ((_evt->
v6 + ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
1002 v97 = v96 + ((_evt->
v26 +
1005 v134 = v96 + ((_evt->
v26 +
1008 if (_evt->
v29 || _evt->
v30) {
1010 _evt->
v29, _evt->
v30, v135, v132, v126, v129, v95,
1011 v134, (
char *)&_evt->
v31);
1031 v99 = (
char *)&_evt->
v31;
1034 v100 = v94 | v132 | v126 | v95 | v97 | v98;
1097 ((_evt->
v6 + ((_evt->
v7 + ((
uint)_evt->
v8 << 8)) << 8))
1106 ((_evt->
v8 + ((_evt->
v9 + ((
uint)_evt->
v10 << 8)) << 8))
1109 if (v102) item.
uItemID = v102;
1119 v104 = EVT_DWORD(_evt->
v5);
1122 window->GetHeight(), v104);
1160 signed int event_index;
1163 unsigned int str_index;
1175 .uEventOffsetInEVT];
1176 last_evt = test_evt;
1185 str_index = EVT_DWORD(test_evt->
v5);
1193 str_index = EVT_DWORD(test_evt->
v5);
1194 if (str_index < 525)
1228 .vPosition.GetDistanceTo(
pActors[j].vPosition) <
1253 return (monthPlusOne == 12 && daysPlusOne >= 21 ||
1254 monthPlusOne == 1 || monthPlusOne == 2 ||
1255 monthPlusOne == 3 && daysPlusOne <= 20);
1258 return (monthPlusOne == 9 && daysPlusOne >= 21 ||
1259 monthPlusOne == 10 || monthPlusOne == 11 ||
1260 monthPlusOne == 12 && daysPlusOne <= 20);
1263 return (monthPlusOne == 6 && daysPlusOne >= 21 ||
1264 monthPlusOne == 7 || monthPlusOne == 8 ||
1265 monthPlusOne == 9 && daysPlusOne <= 20);
1268 return (monthPlusOne == 3 && daysPlusOne >= 21 ||
1269 monthPlusOne == 4 || monthPlusOne == 5 ||
1270 monthPlusOne == 6 && daysPlusOne <= 20);
1273 Error(
"Unknown season");
1282 unsigned int uUniqueName) {
1283 unsigned int map_id;
1284 size_t old_num_actors;
1293 pSpawnPoint.
uKind = 3;
1300 for (
uint i = (
unsigned int)old_num_actors;
1304 pActors[i].dword_000334_unique_name = uUniqueName;
void SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName)
const char * GetString(unsigned int index) const
std::array< LevelDecoration, 3000 > pLevelDecorations
unsigned int uCurrentMonth
static void ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle)
static const unsigned int uDoublePiMask
@ LEVEL_DECORATION_TRIGGERED_BY_MONSTER
void sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
std::array< SpriteObject, MAX_SPRITE_OBJECTS > pSpriteObjects
void ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle)
int Start_Party_Teleport_Flag
signed int uSomeOtherEVT_NumEvents
void sub_4451A8_press_any_key(int a1, int a2, int a4)
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 * >())
void sub_448518_npc_set_item(int npc, unsigned int item, int a3)
HOUSE_DIALOGUE_MENU dialog_menu_id
void * LoadCompressedTexture(const String &pContainer, size_t *data_size=nullptr)
MAP_TYPE GetMapInfo(const String &Str2)
std::array< NPCTopic, 789 > pNPCTopics
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
void init_event_triggers()
std::array< EventIndex, 4400 > pSomeEVT_Events
GLuint GLuint GLsizei count
uint16_t pGroups_copy[51]
void SyncLoadedFilesCount()
Localization * localization
std::array< Player, 4 > pPlayers
int bDialogueUI_InitializeActor_NPC_ID
@ EVENT_ToggleActorGroupFlag
NZIArray< struct Player *, 5 > pPlayers
void Initialize_GlobalEVT()
uint16_t GetDecorIdByName(const char *pName)
std::array< char, 46080 > pGlobalEVT
bool sub_4465DF_check_season(int a1)
enum CURRENT_SCREEN current_screen_type
static void ToggleFlag(int uChestID, uint16_t uFlag, unsigned int bToggle)
int dword_5B65C4_cancelEventProcessing
struct MapStats * pMapStats
@ EVENT_CharacterAnimation
struct ItemsTable * pItemsTable
std::array< EventIndex, 4400 > pSomeOtherEVT_Events
EGLSurface EGLint EGLint y
void Door_switch_animation(unsigned int uDoorID, int a2)
unsigned int uGlobalEVT_NumEvents
GUIWindow * window_SpeakInHouse
bool Initialize(Type type)
LevelDecoration * activeLevelDecoration
std::array< EventIndex, 4400 > pGlobalEVT_Index
int Party_Teleport_Cam_Pitch
@ LEVEL_DECORATION_INVISIBLE
@ LEVEL_DECORATION_TRIGGERED_BY_TOUCH
void sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName)
GUIProgressBar * pGameLoadingUI_ProgressBar
struct ViewingParams * viewparams
void GenerateItem(int treasure_level, unsigned int uTreasureType, ItemGen *pItem)
void AddVariable(enum VariableType var, signed int val)
std::array< char, 9216 > pLevelEVT
char * GetEventHintString(unsigned int uEventID)
void check_event_triggers()
int IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive)
std::array< unsigned char, 125 > _decor_events
LODFile_IconsBitmaps * pIcons_LOD
static void GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, struct AIDirection *pOut, int a4)
signed int dword_5B65D0_dialogue_actor_npc_id
void StopChannels(int uStartChannel, int uEndChannel)
std::array< Actor, 500 > pActors
int Party_Teleport_Cam_Yaw
int uCurrentHouse_Animation
size_t uNumLevelDecorations
EGLSurface EGLNativeWindowType * window
String branchless_dialogue_str
void Transition_StopSound_Autosave(const char *pMapName, MapStartPoint start_point)
@ LEVEL_DECORATION_TRIGGERED_BY_OBJECT
unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize)
unsigned int uLevelStrFileSize
void LoadLevel_InitializeLevelEvt()
unsigned int uLevelEVT_Size
std::array< EventIndex, 4400 > pLevelEVT_Index
size_t num_event_triggers
LODFile_IconsBitmaps * pEvents_LOD
void EventCastSpell(int uSpellID, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz)
std::array< char, 9216 > pLevelStr
static bool Open(int uChestID)
unsigned int game_ui_status_bar_event_string_time_left
unsigned int uGlobalEVT_Size
unsigned int uCurrentDayOfMonth
@ GAME_STATE_CHANGE_LOCATION
int Party_Teleport_Z_Speed
int HouseDialogPressCloseBtn()
void sub_44892E_set_faces_bit(int sCogNumber, int bit, int on)
std::array< unsigned int, 500 > pLevelStrOffsets
unsigned int uActiveCharacter
void __cdecl __debugbreak(void)
signed int uLevelEVT_NumEvents
struct NPCStats * pNPCStats
static bool sub_42F7EB_DropItemAt(SPRITE_OBJECT_TYPE sprite, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
bool EnterHouse(enum HOUSE_ID uHouseID)
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
void ToggleLight(signed int uLightID, unsigned int bToggle)
void SetHoldingItem(ItemGen *pItem)
struct stru193_math * stru_5C6E00
MapsLongTimer MapsLongTimersList[100]
static void GiveItem(signed int uActorID, unsigned int uItemID, unsigned int bGive)
void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line)
AudioPlayer * pAudioPlayer
void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5)
struct GUIMessageQueue * pMessageQueue_50CBD0
stru123 stru_5E4C90_MapPersistVars
GUIWindow * pDialogueWindow
unsigned int uLevelStrNumStrings
String game_ui_status_bar_event_string
void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello)
std::array< int, 3000 > event_triggers
signed int uSomeEVT_NumEvents
@ HOUSE_BODY_GUILD_ERATHIA
struct DecorationList * pDecorationList
@ EVENT_ToggleIndoorLight