World of Might and Magic
0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
|
См. документацию.
92 bool Game::Configure(std::shared_ptr<const Configuration>
config) {
159 if (
engine->config->NoMargareth())
169 assert(
false &&
"Invalid game state");
224 render->PresentBlackScreen();
225 if (!
engine->config->NoVideo()) {
226 if (!
engine->config->no_logo) {
231 if (!
engine->config->no_intro) {
260 uint hireling_slot = 0;
262 for (
uint i = 0; i < 2; ++i) {
273 buf[hireling_slot++] = i + 2;
279 memset(&actor, 0,
sizeof(actor));
343 unsigned int pMapNum;
401 unsigned int uNumSeconds;
405 char *v200 =
nullptr;
422 memset(&actor, 0, 0x344u);
559 render->ClearZBuffer(0, 479);
1022 }
while ((
signed int)pPlayer7 <
1032 }
while ((
signed int)pPlayer8 <
1039 char pLevelName[32];
1041 v41 = strtok(pLevelName,
".");
1042 strcpy(pLevelName, v41);
1060 bool bOnWater =
false;
1064 engine->_461103_load_level_sub();
1088 v44 = (
unsigned __int16)v42;
1089 v45 = PID_TYPE(v44);
1096 pSpellInfo->
uFlags &= ~0x40u;
1117 pSpellInfo->
uFlags &= ~0x40u;
1133 if (v45 != 6)
continue;
1142 pSpellInfo->
uFlags &= ~0x40u;
1163 pSpellInfo->
uFlags &= ~0x40u;
1195 pSpellInfo->
uFlags &= ~0x02u;
1198 pSpellInfo->
uFlags &= ~0x0100u;
1201 pSpellInfo->
uFlags &= ~0x0200u;
1206 .SetRecoveryTime(300);
1261 v127 = uMessageParam + 204;
1267 if (uMessageParam >= pPlayer->
vBeacons.size()) {
1279 String pMapName =
"Not in Map Stats";
1286 475, pMapName.c_str(),
1317 2.133333333333333));
1353 if (uMessageParam) {
1354 switch (uMessageParam) {
1368 if (uMessageParam != 5) {
1373 v65 = uMessageParam;
1423 .CanCastSpell(0x14u);
1436 v63) && !
engine->config->debug_town_portal)
1441 if (uMessageParam) {
1442 switch (uMessageParam) {
1468 if (uMessageParam) {
1469 switch (uMessageParam) {
1483 if (uMessageParam != 5) {
1528 size_t map_index = atoi(frameTableTxtLine.
pProperties[0]);
1529 if (map_index <= 0 || map_index >= 77)
continue;
1540 if (frameTableTxtLine.
uPropCount != 3)
continue;
1553 if ((
x > -32768) && (
x < 32768) && (
y > -32768) && (
y < 32768) && (
z >= 0) && (
z < 10000)) {
1562 status_string =
"Can't jump to that location!";
1568 if (
engine->IsUnderwater()) {
1587 v44 = (
unsigned __int16)v83;
1589 if (PID_TYPE(v44) != 3 || v84 >= 5120)
continue;
1592 pSpellInfo->
uFlags &= ~0x08;
1595 pSpellInfo->
uFlags &= ~0x0100u;
1597 pSpellInfo->
uFlags &= ~0x0200u;
1622 if (
pActors[uMessageParam].uAIState == 5)
1623 pActors[uMessageParam].LootActor();
1632 if (
pActors[uMessageParam].uAIState == 5)
1633 pActors[uMessageParam].LootActor();
1696 if (uMessageParam == 111 || uMessageParam == 114 ||
1697 uMessageParam == 116)
1789 pPlayerNum = rand() % 4;
1844 ->lastOpenedSpellbookPage]
1872 ->lastOpenedSpellbookPage;
1912 int skill_count = 0;
1914 for (
uint i = 0; i < 9; i++) {
1916 engine->config->debug_all_magic) {
1918 uAction = skill_count;
1919 v217[skill_count++] = i;
1929 uAction = skill_count - 1;
1932 if (uAction >= skill_count)
1954 ||
engine->config->debug_all_magic) {
1996 if (
engine->IsUnderwater()) {
2045 render->SaveScreenshot(
"gamma.pcx", 155, 117);
2087 HEXRAYS_LOWORD(
v2) = *(
short *)v105;
2093 if ((uNumSeconds & 0x3F) < 0x3C) {
2094 *(
short *)v105 = uNumSeconds + 1;
2117 ->ShowInventoryTab();
2129 switch (uMessageParam) {
2179 (
int)pButton,
String(),
false);
2197 currHour = (currHour - 12);
2204 "%d:%02d%s %s %d %s %d", currHour,
2221 pPlayer5 =
pPlayers[uMessageParam];
2224 429, pPlayer5->
pName,
2234 (
unsigned char)(8 * uMessageParam - 8) | 4);
2241 pPlayers[uMessageParam]->GetHealth(),
2242 pPlayers[uMessageParam]->GetMaxHealth(),
2244 pPlayers[uMessageParam]->GetMana(),
2245 pPlayers[uMessageParam]->GetMaxMana(),
2269 engine->OnGameViewportClick();
2294 uNumSeconds = 131072;
2306 if ((
signed int)v118 <= 2048) {
2320 uNumSeconds = 32768;
2321 v118 = (
unsigned __int64)((
signed __int64)(
signed int)
2327 (
unsigned __int64)((
signed __int64)(
signed int)
2341 if ((
signed int)v118 < 256) {
2347 pItemID = rand() % 500;
2348 for (
uint i = 0; i < 500; ++i) {
2349 if (pItemID + i > 499) pItemID = 0;
2358 pItemID = rand() % 500;
2359 for (
uint i = 0; i < 500; ++i) {
2360 if (pItemID + i > 499) pItemID = 0;
2399 for (
uint i = 1; i < 5; ++i) {
2400 for (
int ski = 0; ski < 37; ++ski) {
2441 if (
pPlayers[i]->skillBlaster == 0)
2451 if (
pPlayers[i]->skillLeather == 0)
2516 if (
pPlayers[i]->skillMerchant == 0)
2526 if (
pPlayers[i]->skillBodybuilding == 0)
2531 if (
pPlayers[i]->skillMeditation == 0)
2536 if (
pPlayers[i]->skillPerception == 0)
2545 if (
pPlayers[i]->skillDisarmTrap == 0)
2555 if (
pPlayers[i]->skillUnarmed == 0)
2560 if (
pPlayers[i]->skillMonsterId == 0)
2565 if (
pPlayers[i]->skillArmsmaster == 0)
2570 if (
pPlayers[i]->skillStealing == 0)
2575 if (
pPlayers[i]->skillAlchemy == 0)
2580 if (
pPlayers[i]->skillLearning == 0)
2605 engine->ToggleDebugTownPortal();
2609 engine->ToggleDebugWizardEye();
2613 engine->ToggleDebugAllMagic();
2617 engine->ToggleDebugTerrain();
2621 engine->ToggleDebugLightmap();
2625 engine->ToggleDebugTurboSpeed();
2629 engine->ToggleDebugNoActors();
2633 engine->ToggleDebugDrawDist();
2637 engine->ToggleDebugSnow();
2641 engine->ToggleDebugNoDamage();
2645 engine->ToggleDebugPortalLines();
2649 engine->ToggleDebugPickedFace();
2653 engine->ToggleDebugShowFPS();
2657 engine->ToggleDebugSeasonsChange();
2705 const char *pLocationName;
2718 extern bool use_music_folder;
2735 GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME;
2744 bool game_finished =
false;
2746 window->PeekMessageLoop();
2794 game_finished =
true;
2810 game_finished =
true;
2836 for (
uint i = 0; i < 4; ++i)
2849 for (
int i = 1; i < 5; ++i) {
2866 pLocationName =
"out02.odm";
2872 pLocationName =
"out01.odm";
2874 strcpy(Source, pLocationName);
2893 int num_conscious_players = 0;
2894 int conscious_players_ids[4] = {-1, -1, -1, -1};
2895 for (
int i = 0; i < 4; ++i) {
2897 conscious_players_ids[num_conscious_players++] = i;
2899 if (num_conscious_players) {
2901 conscious_players_ids[rand() % num_conscious_players];
2913 }
while (!game_finished);
2916 engine->ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
void OnPaperdollLeftClick()
unsigned int uLoadGameUI_SelectedSlot
void SetRecoveryTime(signed int sRecoveryTime)
void CloseWindowBackground()
@ UIMSG_HintSelectRemoveQuickSpellBtn
const char * pProperties[30]
static void StealFrom(unsigned int uActorID)
const char * GetString(unsigned int index) const
const char * GetCharacterConditionName(unsigned int index) const
unsigned __int16 skillSword
std::array< LevelDecoration, 3000 > pLevelDecorations
std::shared_ptr< Engine > CreateEngine(const std::string &command_line)
static void GrabItem(bool all=false)
unsigned __int16 skillMeditation
static void TakeFood(int amount)
@ UIMSG_ClickAwardsDownBtn
@ UIMSG_SPellbook_ShowHightlightedSpellInfo
void CloseTargetedSpellWindow()
size_t GetSubNodesCount() const
unsigned int uTimeElapsed
unsigned int uCurrentMonth
void SetUserInterface(PartyAlignment align, bool bReplace)
GameTime & GetPlayingTime()
void SetMusicVolume(int music_level)
void PlayFullscreenMovie(const std::string &pMovieName)
void UIShop_Buy_Identify_Repair()
void TeleportToStartingPoint(MapStartPoint point)
unsigned int uCurrentMinute
@ UIMSG_ShowStatus_ManaHP
struct SpriteFrameTable * pSpriteFrameTable
unsigned __int16 skillArmsmaster
unsigned __int16 skillItemId
std::array< SpriteObject, MAX_SPRITE_OBJECTS > pSpriteObjects
int Start_Party_Teleport_Flag
unsigned __int16 skillBlaster
int Autonotes_Misc_page_flag
@ UIMSG_LloydsBeacon_FlippingBtn
unsigned __int16 skillDodge
static void SetFood(int amount)
int GetNextActiveCharacter()
Vis_SelectionFilter vis_sprite_filter_3
@ PARTY_QUEST_EMERALD_MARGARETH_OFF
GUIWindow * pGUIWindow_CurrentMenu
ArcomageGame * pArcomageGame
@ GAME_STATE_FINAL_WINDOW
int lloyds_beacon_spell_id
unsigned __int16 skillLearning
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
unsigned __int16 skillStealing
void SetCurrentMenuID(MENU_STATE uMenu)
DecalBuilder * decal_builder
@ UIMSG_CastSpell_Character_Big_Improvement
MAP_TYPE GetMapInfo(const String &Str2)
@ UIMSG_ClickHouseNPCPortrait
void ShowMM7IntroVideo_and_LoadingScreen()
unsigned __int8 hirelingScrollPosition
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
unsigned __int16 skillRepair
@ UIMSG_CastSpell_Character_Small_Improvement
void GameUI_WritePointedObjectStatusString()
unsigned __int16 skillSpear
std::shared_ptr< Engine > engine
struct BLVFaceExtra * pFaceExtras
@ UIMSG_CastSpell_Shoot_Monster
unsigned __int16 skillAxe
unsigned __int16 skillBow
unsigned int uDefaultPartyHeight
std::array< int, 6 > dword_4E4560
@ UIMSG_ClickExitCharacterWindowBtn
@ UIMSG_CastSpell_Monster_Improvement
unsigned __int8 _quest_bits[64]
Localization * localization
void GameUI_LoadPlayerPortraintsAndVoices()
void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box)
@ GAME_STATE_LOADING_GAME
unsigned int uCurrentHour
char pStartingMapName[32]
@ UIMSG_TransitionWindowCloseBtn
unsigned __int16 skillDagger
void GameUI_StatusBar_Set(const String &str)
char lastOpenedSpellbookPage
unsigned __int16 skillLight
ItemGen * ptr_50C9A4_ItemToEnchant
unsigned __int16 skillMerchant
std::array< Player, 4 > pPlayers
void GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID)
void GameUI_DrawHiredNPCs()
int bDialogueUI_InitializeActor_NPC_ID
unsigned __int16 skillBodybuilding
@ UIMSG_SpellBook_PressTab
int _576E2C_current_minimap_zoom
unsigned int uDefaultEyelevel
unsigned int uCurrentMonthWeek
void _494035_timed_effects__water_walking_damage__etc()
@ UIMSG_CastSpell_Telekinesis
@ UIMSG_SelectShopDialogueOption
__int64 lloyds_beacon_spell_level
Vis_SelectionFilter vis_door_filter
static void OnChestLeftClick()
unsigned int uSkillPoints
std::array< unsigned __int16, 37 > pActiveSkills
NZIArray< struct Player *, 5 > pPlayers
static void UpdateActorAI()
int get_picked_object_zbuf_val()
Texture * GetImage_PCXFromFile(const String &name)
@ UIMSG_StartHireling2Dialogue
void UpdateSunlightVectors()
unsigned __int16 skillLeather
void Level_LoadEvtAndStr(const char *pLevelName)
@ GAME_STATE_GAME_QUITTING_TO_MAIN_MENU
enum CURRENT_SCREEN current_screen_type
unsigned int _494820_training_time(unsigned int a1)
unsigned __int16 skillDisarmTrap
struct stru262_TurnBased * pTurnEngine
int MM_Main(const char *pCmdLine)
@ UIMSG_ShowStatus_DateTime
unsigned __int16 skillWater
struct MapStats * pMapStats
std::array< SpellBuff, 20 > pPartyBuffs
void _42777D_CastSpell_UseWand_ShootArrow(SPELL_TYPE spell, unsigned int uPlayerID, unsigned int a4, __int16 flags, int a6)
std::array< TownPortalData, 6 > TownPortalList
unsigned int uLevelMapStatsID
int _506F14_resting_stage
unsigned int uPartyHeight
MENU_STATE GetCurrentMenuID()
int dword_507B00_spell_info_to_draw_in_popup
void OnSelectShopDialogueOption(signed int uMessageParam)
struct ItemsTable * pItemsTable
unsigned __int16 skillAlchemy
EGLSurface EGLint EGLint y
void Reset(bool bPreserveBloodsplats)
void GameUI_StatusBar_Update(bool force_hide)
Image * rest_ui_hourglass_frame_current
unsigned __int16 skillMonsterId
@ UIMSG_MouseLeftClickInScreen
@ SCREEN_BRANCHLESS_NPC_DIALOG
void ProcessInputActions()
unsigned __int16 skillStaff
GUIWindow * window_SpeakInHouse
bool Initialize(Type type)
struct NPCData * ptr_50C9E0
bool CheckActors_proximity()
unsigned __int16 skillPlate
GLenum GLuint GLenum GLsizei const GLchar * buf
int Party_Teleport_Cam_Pitch
@ UIMSG_OnFinalWindowClose
std::array< int, 6 > dword_4E4590
struct GUIMessageQueue * pMessageQueue_50C9E8
int npcIdToDismissAfterDialogue
unsigned int uMinimapZoom
void CharacterUI_ReleaseButtons()
int _50C9D0_AfterEnchClickEventId
bool PartyCreationUI_Loop()
unsigned char days_played_without_rest
Image * gamma_preview_image
int _506F18_num_minutes_to_sleep
@ UIMSG_MouseLeftClickInGame
void SetCondition(unsigned int uConditionIdx, int blockable)
std::array< int, 6 > dword_4E4578
@ UIMSG_ClickAwardScrollBar
void PlaySpellSound(unsigned int spell, unsigned int pid)
GUIProgressBar * pGameLoadingUI_ProgressBar
struct ViewingParams * viewparams
unsigned __int16 skillChain
void GetHouseGoodbyeSpeech()
char * Party_Teleport_Map_Name
static void ExecuteCredits()
std::array< PlayerSpellbookChapter, 9 > pChapters
void ResetSomeSpriteFlags()
void GameUI_StatusBar_Clear()
@ UIMSG_OnCastLloydsBeacon
bool _506360_installing_beacon
@ UIMSG_ShowStatus_Player
@ UIMSG_CastSpellFromBook
char sub_4637E0_is_there_popup_onscreen()
char pPressedKeysBuffer[257]
LODFile_IconsBitmaps * pIcons_LOD
@ UIMSG_CHANGE_LOCATION_ClickCencelBtn
signed int dword_5B65D0_dialogue_actor_npc_id
void StopChannels(int uStartChannel, int uEndChannel)
std::array< Actor, 500 > pActors
unsigned int uPointingObjectID
MENU_STATE sCurrentMenuID
int Party_Teleport_Cam_Yaw
int uCurrentHouse_Animation
EGLSurface EGLNativeWindowType * window
unsigned __int16 uTimeToRecovery
void End(bool bPlaySound)
int uRestUI_FoodRequiredToRest
void ChangeActivation(int a1)
@ UIMSG_InventoryLeftClick
int GetSubNodeIndex(const String &name) const
void Transition_StopSound_Autosave(const char *pMapName, MapStartPoint start_point)
int _506348_current_lloyd_playerid
std::array< int, 6 > dword_4E45A8
char DoInteractionWithTopmostZObject(int a1, int a2)
Image * rest_ui_sky_frame_current
unsigned __int16 skillShield
void _4B4224_UpdateNPCTopics(int _this)
struct ActionQueue * pPartyActionQueue
bool _50C9A0_IsEnchantingInProgress
void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
void PopMessage(UIMessageType *pMsg, int *pParam, int *a4)
@ UIMSG_BuyInShop_Identify_Repair
void LoadLevel_InitializeLevelEvt()
void CreateDefaultParty(bool bDebugGiveItems=false)
PaletteManager * pPaletteManager
int GetTerrainHeightsAroundParty2(int a1, int a2, bool *pIsOnWater, int bFloatAboveWater)
const char * GetAmPm(unsigned int index) const
int CycleCharacter(bool backwards)
@ UIMSG_ClickInstallRemoveQuickSpellBtn
struct SpellStats * pSpellStats
FrameTableTxtLine * txt_file_frametable_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table)
std::array< int, 4 > pTurnBasedPlayerRecoveryTimes
char town_portal_caster_id
void GivePartyExp(unsigned int pEXPNum)
unsigned __int16 skillBody
std::array< NPCData, 2 > pHirelings
unsigned __int16 skillMind
unsigned int uNumGoldInBank
unsigned int game_ui_status_bar_event_string_time_left
std::string s_SavedMapName
void RestAndHeal(int minutes)
void ClickNPCTopic(int uMessageParam)
void Rest(unsigned int uMinsToRest)
@ MENU_LoadingProcInMainMenu
unsigned int uCurrentDayOfMonth
@ GAME_STATE_CHANGE_LOCATION
@ UIMSG_HiredNPC_CastSpell
void Game_StartHirelingDialogue(unsigned int hireling_id)
ODMRenderParams * pODMRenderParams
unsigned __int16 skillDark
GUIWindow * pBooksButtonOverlay
int sub_410D99_get_map_index(int a1)
unsigned int uDialogueType
@ UIMSG_CloseAfterInstallBeacon
PLAYER_CLASS_TYPE classType
struct OtherOverlayList * pOtherOverlayList
int Party_Teleport_Z_Speed
int HouseDialogPressCloseBtn()
unsigned __int16 skillEarth
unsigned int uRequiredMana
void Game_StartDialogue(unsigned int actor_id)
const char * GetMonthName(unsigned int index) const
struct KeyboardActionMapping * pKeyActionMap
unsigned int GetMajorConditionIdx()
Image * game_ui_statusbar
std::vector< LloydBeacon > vBeacons
GLfloat GLfloat GLfloat v2
float flt_6BE3A4_debug_recmod1
@ UIMSG_TransitionUI_Confirm
unsigned int uActiveCharacter
String FormatString(unsigned int index,...) const
unsigned __int16 skillUnarmed
void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
bool SetBeacon(size_t index, size_t power)
void __cdecl __debugbreak(void)
struct NPCStats * pNPCStats
@ UIMSG_ClickInventoryBtn
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
bool GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5)
int _45063B_spawn_some_monster(MapInfo *a1, int a2)
void PlaySound(PlayerSpeech speech, int a3)
void GameUI_StatusBar_ClearEventString()
@ GAME_STATE_NEWGAME_OUT_GAMEMENU
unsigned __int16 skillAir
String GetSubNodeName(size_t index) const
int dword_6BE364_game_settings_1
void LoadGame(unsigned int uSlot)
const char * GetDayName(unsigned int index) const
void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line)
void SetCursorImage(const String &name)
LEVEL_TYPE uCurrentlyLoadedLevelType
@ PARTY_QUEST_FINISHED_EMERALD_ISLE
@ UIMSG_DebugSeasonsChange
char Is_out15odm_underwater()
@ SCREEN_KEYBOARD_OPTIONS
int _50C9D8_AfterEnchClickEventTimeout
int GetSector(int sX, int sY, int sZ)
@ WINDOW_CharacterWindow_Awards
MapStartPoint uLevel_StartingPointType
struct ObjectDesc * pObjects
AudioPlayer * pAudioPlayer
static bool IsKeyBeingHeld(int vKey)
std::shared_ptr< Game > CreateGame(const std::string &command_line)
const char * GetClassName(unsigned int index) const
bool CanCastSpell(unsigned int uRequiredMana)
static void PrepareArcomage()
GLsizei const GLchar *const * string
@ SOUND_StartMainChoice02
int _50C9D4_AfterEnchClickEventSecondParam
void PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2)
struct GUIMessageQueue * pMessageQueue_50CBD0
void Cancel_Spell_Cast_In_Progress()
OutdoorLocation * pOutdoor
void UpdateUserInput_and_MapSpecificStuff()
int _50C9A8_item_enchantment_timer
int some_active_character
unsigned int uCurrentYear
unsigned __int8 uQuickSpell
unsigned __int16 skillSpirit
GUIWindow * pGUIWindow_CastTargetedSpell
String StringPrintf(const char *fmt,...)
unsigned __int16 skillMace
static void AddGold(int amount)
std::array< std::array< char, 37 >, 36 > byte_4ED970_skill_learn_ability_by_class_table
std::shared_ptr< Engine > engine
void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello)
void PrepareWorld(unsigned int _0_box_loading_1_fullscreen)
@ UIMSG_StartHireling1Dialogue
@ UIMSG_SelectNPCDialogueOption
unsigned __int16 skillPerception
int Autonotes_Instructors_page_flag
static void InitializeActors()
@ UIMSG_OpenSpellbookPage
struct ObjectList * pObjectList
NZIArray< ItemDesc, 800 > pItems
static void SetGold(int amount)
void SaveGame(bool IsAutoSAve, bool NotSaveWorld)
static void _42ECB5_PlayerAttacksActor()
@ TE_HAVE_PENDING_ACTIONS
std::shared_ptr< const Configuration > config
unsigned __int16 skillFire
static void GiveFood(int amount)
void _427E01_cast_spell()
std::shared_ptr< IRender > render