# HG changeset patch # User Ritor1 # Date 1401626229 -21600 # Node ID 802460e60eee89e8968935b27bc5069148e8537a # Parent b4a79e3ef2f0aa21fd505c9b840d558ea07358bc add UIArena.cpp and UIArena.h and other diff -r b4a79e3ef2f0 -r 802460e60eee Build/Visual Studio 2012/World of Might and Magic.vcxproj --- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj Sun Jun 01 17:20:22 2014 +0600 +++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj Sun Jun 01 18:37:09 2014 +0600 @@ -228,6 +228,7 @@ + @@ -483,6 +484,7 @@ + diff -r b4a79e3ef2f0 -r 802460e60eee Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters --- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Sun Jun 01 17:20:22 2014 +0600 +++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Sun Jun 01 18:37:09 2014 +0600 @@ -388,6 +388,9 @@ + + UI + @@ -962,6 +965,9 @@ + + UI + diff -r b4a79e3ef2f0 -r 802460e60eee NPC.cpp --- a/NPC.cpp Sun Jun 01 17:20:22 2014 +0600 +++ b/NPC.cpp Sun Jun 01 18:37:09 2014 +0600 @@ -16,6 +16,9 @@ #include "MapInfo.h" #include "Level/Decoration.h" #include "Actor.h" +#include "AudioPlayer.h" +#include "CastSpellInfo.h" +#include "Overlays.h" int pDialogueNPCCount; std::array pDialogueNPCPortraits; @@ -1890,3 +1893,152 @@ else return pNPCTopics[407].pTopic; } + +//----- (004BB756) -------------------------------------------------------- +int UseNPCSkill(NPCProf profession) +{ + switch (profession) + { + case Healer: + { + for (int i = 0; i < 4; ++i) + pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); + } + break; + + case ExpertHealer: + { + for (int i = 0; i < 4; ++i) + { + __debugbreak(); + pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); + + for (int j = 0; j < 14; ++j) + pParty->pPlayers[i].pConditions[j] = 0; + pParty->pPlayers[i].pConditions[Condition_Good] = 0; + } + } + break; + + case MasterHealer: + { + for (int i = 0; i < 4; ++i) + { + __debugbreak(); //Ritor1:needed cleaned(Необходимо почистить) + Player* player = &pParty->pPlayers[i]; + pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); + + int v5 = LODWORD(player->pConditions[19]);//*((int *)v4 - 32); + int v6 = HIDWORD(player->pConditions[19]);//*((int *)v4 - 31); + memset(&pParty->pPlayers[i].pConditions, 0, sizeof(pParty->pPlayers[i].pConditions)); + + *(int *)&player->pActiveSkills[PLAYER_SKILL_SHIELD] = v5; + *(int *)&player->pActiveSkills[PLAYER_SKILL_CHAIN] = v6; + } + } + break; + + case Cook://Повар + { + if (pParty->uNumFoodRations >= 13) + return 1; + + Party::GiveFood(1); + } + break; + + case Chef: + { + if (pParty->uNumFoodRations >= 13) + return 1; + + if (pParty->uNumFoodRations == 13) + Party::GiveFood(1); + else + Party::GiveFood(2); + } + break; + + case WindMaster: + { + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2);//Нельзя применить знание Полет в помещении! + pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0); + } + else + { + int v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); + pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 60 * (256 * 2), 3, 1, v19, 0); + pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1; + pAudioPlayer->PlaySound(SOUND_11090, 0, 0, -1, 0, 0, 0, 0); + } + } + break; + + case WaterMaster: + { + int v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); + pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 60 * (256 * (2 + 1)), 3, 0, v20, 0); + pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1; + pAudioPlayer->PlaySound(SOUND_12040, 0, 0, -1, 0, 0, 0, 0); + } + break; + + case GateMaster: + { + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + dword_50C9DC = 195; + ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); + } + break; + + case Acolyte: _42777D_CastSpell_UseWand_ShootArrow(46, 0, 133, 0, 0); break; + case Piper: _42777D_CastSpell_UseWand_ShootArrow(51, 0, 133, 0, 0); break; + case FallenWizard: _42777D_CastSpell_UseWand_ShootArrow(86, 0, 133, 0, 0); break; + + case Teacher: + case Instructor: + case Armsmaster: + case Weaponsmaster: + case Apprentice: + case Mystic: + case Spellmaster: + case Trader: + case Merchant: + case Scout: + case Herbalist: + case Apothecary: + case Tinker: + case Locksmith: + case Fool: + case ChimneySweep: + case Porter: + case QuarterMaster: + case Factor: + case Banker: + case Horseman: + case Bard: + case Enchanter: + case Cartographer: + case Explorer: + case Pirate: + case Squire: + case Psychic: + case Gypsy: + case Diplomat: + case Duper: + case Burglar: + case Acolyte2: + case Initiate: + case Prelate: + case Monk: + case Sage: + case Hunter: + break; + + default: + assert(false && "Invalid enum value"); + } + return 0; +} \ No newline at end of file diff -r b4a79e3ef2f0 -r 802460e60eee UI/UIArena.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UI/UIArena.cpp Sun Jun 01 18:37:09 2014 +0600 @@ -0,0 +1,310 @@ +#define _CRT_SECURE_NO_WARNINGS + +#include "mm7_data.h" +#include "Sprites.h" + +#include "GUIWindow.h" +#include "GUIFont.h" +#include "Party.h" +#include "AudioPlayer.h" +#include "Outdoor.h" +#include "LOD.h" +#include "Actor.h" +#include "Events.h" +#include "Viewport.h" +#include "texts.h" +#include "MM7.h" + +std::array 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), + }} +; + +//----- (004BBCDD) -------------------------------------------------------- +void Arena_SelectionFightLevel() +{ + signed int v0; // ebp@3 + GUIButton *v5; // eax@18 + GUIButton *v6; // esi@19 + + if ( pParty->field_7B5_in_arena_quest ) + { + if ( pParty->field_7B5_in_arena_quest == -1 ) + { + uDialogueType = DIALOGUE_ARENA_ALREADY_WON; + } + else + { + v0 = 0; + for (size_t i = 0; i < uNumActors; i++ ) + { + if ( pActors[i].uAIState == Dead + || pActors[i].uAIState == Removed + || pActors[i].uAIState == Disabled + || pActors[i].uSummonerID != 0 && PID_TYPE(pActors[i].uSummonerID) == OBJECT_Player) + ++v0; + } + if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) + { + uDialogueType = DIALOGUE_ARENA_REWARD; + ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1);//Ritor1:I dont know + for ( uint i= 0; i < 4; i++ ) + pParty->pPlayers[i].SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); + pParty->PartyFindsGold(gold_transaction_amount, 0); + pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); + pParty->field_7B5_in_arena_quest = -1; + } + else + { + uDialogueType = DIALOGUE_ARENA_WELCOME; + pParty->vPosition.x = 3849; + pParty->vPosition.y = 5770; + pParty->vPosition.z = 1; + pParty->uFallStartY = 1; + pParty->sRotationY = 512; + pParty->sRotationX = 0; + pParty->uFallSpeed = 0; + pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); + } + } + } + else + { + uDialogueType = DIALOGUE_ARENA_WELCOME; + v5 = pDialogueWindow->pControlsHead; + if ( v5 ) + { + do + { + v6 = v5->pNext; + free(v5); + v5 = v6; + } + while ( v6 ); + } + pDialogueWindow->pControlsHead = 0; + pDialogueWindow->pControlsTail = 0; + pDialogueWindow->uNumControls = 0; + pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, + pGlobalTXT_LocalizationStrings[79], //Close, Закрыть + pIcons_LOD->GetTexture(uExitCancelTextureId), 0); + pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 85, 0, "", 0); + pDialogueWindow->CreateButton(480, 190, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 86, 0, "", 0); + pDialogueWindow->CreateButton(480, 220, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 87, 0, "", 0); + pDialogueWindow->CreateButton(480, 250, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 88, 0, "", 0); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); + } +} + + +//----- (004BC109) -------------------------------------------------------- +void ArenaFight() +{ + int v0; // edi@1 + char *v1; // eax@7 + int v3; // eax@10 + signed int v4; // esi@10 + signed int v6; // ebx@34 + signed int v13; // eax@49 + int v14; // esi@49 + int v15; // edx@50 + int v16; // eax@51 + signed int v17; // ecx@51 + int v18; // edx@53 + int i; // edi@55 + signed int v22; // [sp-4h] [bp-144h]@51 + __int16 v23[100]; // [sp+Ch] [bp-134h]@39 + GUIWindow window; // [sp+D4h] [bp-6Ch]@1 + __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 + int v26; // [sp+134h] [bp-Ch]@1 + int num_monsters; // [sp+13Ch] [bp-4h]@17 + + v26 = 0; + pParty->field_7B5_in_arena_quest = uDialogueType; + memcpy(&window, pDialogueWindow, sizeof(window)); + window.uFrameWidth = game_viewport_width; + window.uFrameZ = 452; + v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7;// Пожалуйста, подождите пока я вызываю существ. Удачи. + pRenderer->BeginSceneD3D(); + + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + pIndoor->Draw(); + else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) + pOutdoor->Draw(); + + pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); + pRenderer->BeginScene(); + //if ( pRenderer->pRenderD3D ) + pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, + pViewport->uViewportBR_X - pViewport->uViewportTL_X, + pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, + 0x7FF); + + Texture* pTex = pIcons_LOD->GetTexture(uTextureID_Leather); + pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0); + + pRenderer->DrawTextureIndexed(8, 347 - v0, pTexture_591428); + v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);//Пожалуйста, подождите пока я вызываю существ. Удачи. + pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); + pRenderer->EndScene(); + pRenderer->Present(); + pParty->vPosition.x = 3849; + pParty->vPosition.y = 5770; + pParty->vPosition.z = 1; + pParty->uFallStartY = 1; + pParty->sRotationY = 512; + pParty->sRotationX = 0; + pParty->uFallSpeed = 0; + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + //v2 = pParty->pPlayers.data(); + for ( uint i = 0; i < 4; i++ ) + { + v3 = pParty->pPlayers[i].GetActualLevel(); + v4 = v26; + if ( v3 > v26 ) + { + v26 = pParty->pPlayers[i].GetActualLevel(); + v4 = pParty->pPlayers[i].GetActualLevel(); + } + //++v2; + } + //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); + if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) + { + num_monsters = v4; + v4 /= 2; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) + { + //v5 = (signed __int64)((double)v26 * 1.5); + num_monsters = (int)((double)v26 * 1.5); + v4 /= 2; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) + { + //LODWORD(v5) = 2 * v4; + num_monsters = 2 * v4; + v4 /= 2; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) + { + num_monsters = 2 * v4; + v4 /= 2; + } + if ( v4 < 1 ) + v4 = 1; + if ( v4 > 100 ) + v4 = 100; + if ( num_monsters > 100 ) + num_monsters = 100; + if ( v4 < 2 ) + v4 = 2; + if ( num_monsters < 2 ) + num_monsters = 2; + v6 = 0; + //v27 = 1; + //v7 = (char *)&pMonsterStats->pInfos[1].uLevel; + for ( uint i = 1; i <= 258; i++ ) + { + if ( pMonsterStats->pInfos[i].uAIType != 1 )//if ( v7[8] != 1 ) + { + if ( !MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8) ) //!MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) + { + //v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel; + if ( pMonsterStats->pInfos[i].uLevel >= v4 ) + { + if ( pMonsterStats->pInfos[i].uLevel <= num_monsters ) + v23[v6++] = i; + } + } + } + // ++v27; + //v7 += 88; + } + //while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); + num_monsters = 6; + if ( v6 < 6 ) + num_monsters = v6; + //v9 = 0; + if ( num_monsters > 0 ) + { + for ( uint i = 0; i < num_monsters; i++ ) + { + //v10 = rand(); + //++v9; + //v12 = __OFSUB__(v9, num_monsters); + //v11 = v9 - num_monsters < 0; + //*((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6]; + monster_ids[i] = v23[rand() % v6]; + } + //while ( v11 ^ v12 ); + } + if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) + { + v16 = rand(); + v17 = 3; + v22 = 50; + v18 = v16 % v17; + v13 = v22; + v14 = v18 + 6; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) + { + v16 = rand(); + v17 = 7; + v22 = 100; + v18 = v16 % v17; + v13 = v22; + v14 = v18 + 6; + } + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) + { + v15 = rand() % 11; + v13 = 200; + v14 = v15 + 10; + } + else + { + if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) + { + v13 = 500; + v14 = 20; + } + //else + //{ + //v14 = v27; + //v13 = gold_transaction_amount; + //} + } + gold_transaction_amount = v26 * v13; + for ( i = 0; i < v14; ++i ) + Actor::Arena_summon_actor(monster_ids[rand() % num_monsters], pMonsterArenaPlacements[i].x, pMonsterArenaPlacements[i].y, 1); + pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); +} \ No newline at end of file diff -r b4a79e3ef2f0 -r 802460e60eee UI/UIArena.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UI/UIArena.h Sun Jun 01 18:37:09 2014 +0600 @@ -0,0 +1,9 @@ +#pragma once +#include "VectorTypes.h" +#include + + +extern std::array pMonsterArenaPlacements; + +void Arena_SelectionFightLevel(); +void ArenaFight(); \ No newline at end of file diff -r b4a79e3ef2f0 -r 802460e60eee UI/UIHouses.cpp --- a/UI/UIHouses.cpp Sun Jun 01 17:20:22 2014 +0600 +++ b/UI/UIHouses.cpp Sun Jun 01 18:37:09 2014 +0600 @@ -30,6 +30,8 @@ #include "..\Game.h" #include "..\CastSpellInfo.h" +#include "../Level/Decoration.h" + #include "..\stru159.h" int uHouse_ExitPic; // weak @@ -3299,4 +3301,89 @@ } while ((decode_step<24)&&!break_loop); } -} \ No newline at end of file +} + +//----- (004BD8B5) -------------------------------------------------------- +int HouseDialogPressCloseBtn() +{ + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); + pKeyActionMap->ResetKeys(); + activeLevelDecoration = nullptr; + current_npc_text = 0; + if ( pDialogueNPCCount == 0) + return 0; + + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && ShopTexture ) + { + ShopTexture->Release(); + ShopTexture = 0; + } + + switch(dialog_menu_id) + { + case -1: + _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); + pVideoPlayer->_4BF5B2(); + break; + + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + case HOUSE_DIALOGUE_LEARN_SKILLS: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: + pVideoPlayer->_4BF5B2(); + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + InitializaDialogueOptions(in_current_building_type); + break; + + case HOUSE_DIALOGUE_SHOP_SELL: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + case HOUSE_DIALOGUE_SHOP_REPAIR: + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; + InitializaDialogueOptions_Shops(in_current_building_type); + break; + + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: + pVideoPlayer->_4BF5B2(); + UI_CreateEndConversationButton(); + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; + InitializaDialogueOptions_Tavern(in_current_building_type); + break; + + case HOUSE_DIALOGUE_NULL: + case HOUSE_DIALOGUE_MAIN: + pDialogueNPCCount = 0; + pDialogueWindow->Release(); + dialog_menu_id = HOUSE_DIALOGUE_NULL; + pDialogueWindow = 0; + pIcons_LOD->SyncLoadedFilesCount(); + + if ( uNumDialogueNPCPortraits == 1 ) + return 0; + + pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; + if ( uNumDialogueNPCPortraits > 0 ) + { + for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i ) + { + HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i], + pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i], + 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0); + } + } + + pVideoPlayer->_4BF5B2(); + break; + + default: + pVideoPlayer->_4BF5B2(); + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + InitializaDialogueOptions(in_current_building_type); + break; + } + return 1; +} diff -r b4a79e3ef2f0 -r 802460e60eee mm7_2.cpp --- a/mm7_2.cpp Sun Jun 01 17:20:22 2014 +0600 +++ b/mm7_2.cpp Sun Jun 01 18:37:09 2014 +0600 @@ -72,155 +72,6 @@ bool __fastcall Initialize(HINSTANCE hInst, char *pCmdLine); -//----- (004BB756) -------------------------------------------------------- -int UseNPCSkill(NPCProf profession) -{ - switch (profession) - { - case Healer: - { - for (int i = 0; i < 4; ++i) - pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); - } - break; - - case ExpertHealer: - { - for (int i = 0; i < 4; ++i) - { - __debugbreak(); - pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); - - for (int j = 0; j < 14; ++j) - pParty->pPlayers[i].pConditions[j] = 0; - pParty->pPlayers[i].pConditions[Condition_Good] = 0; - } - } - break; - - case MasterHealer: - { - for (int i = 0; i < 4; ++i) - { - __debugbreak(); - Player* player = &pParty->pPlayers[i]; - pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); - - int v5 = LODWORD(player->pConditions[19]);//*((int *)v4 - 32); - int v6 = HIDWORD(player->pConditions[19]);//*((int *)v4 - 31); - memset(&pParty->pPlayers[i].pConditions, 0, sizeof(pParty->pPlayers[i].pConditions)); - - *(int *)&player->pActiveSkills[PLAYER_SKILL_SHIELD] = v5; - *(int *)&player->pActiveSkills[PLAYER_SKILL_CHAIN] = v6; - } - } - break; - - case Cook://Повар - { - if (pParty->uNumFoodRations >= 13) - return 1; - - Party::GiveFood(1); - } - break; - - case Chef: - { - if (pParty->uNumFoodRations >= 13) - return 1; - - if (pParty->uNumFoodRations == 13) - Party::GiveFood(1); - else - Party::GiveFood(2); - } - break; - - case WindMaster: - { - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2);//Нельзя применить знание Полет в помещении! - pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0); - } - else - { - int v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); - pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 60 * (256 * 2), 3, 1, v19, 0); - pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1; - pAudioPlayer->PlaySound(SOUND_11090, 0, 0, -1, 0, 0, 0, 0); - } - } - break; - - case WaterMaster: - { - int v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); - pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 60 * (256 * (2 + 1)), 3, 0, v20, 0); - pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1; - pAudioPlayer->PlaySound(SOUND_12040, 0, 0, -1, 0, 0, 0, 0); - } - break; - - case GateMaster: - { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - dword_50C9DC = 195; - ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); - } - break; - - case Acolyte: _42777D_CastSpell_UseWand_ShootArrow(46, 0, 133, 0, 0); break; - case Piper: _42777D_CastSpell_UseWand_ShootArrow(51, 0, 133, 0, 0); break; - case FallenWizard: _42777D_CastSpell_UseWand_ShootArrow(86, 0, 133, 0, 0); break; - - case Teacher: - case Instructor: - case Armsmaster: - case Weaponsmaster: - case Apprentice: - case Mystic: - case Spellmaster: - case Trader: - case Merchant: - case Scout: - case Herbalist: - case Apothecary: - case Tinker: - case Locksmith: - case Fool: - case ChimneySweep: - case Porter: - case QuarterMaster: - case Factor: - case Banker: - case Horseman: - case Bard: - case Enchanter: - case Cartographer: - case Explorer: - case Pirate: - case Squire: - case Psychic: - case Gypsy: - case Diplomat: - case Duper: - case Burglar: - case Acolyte2: - case Initiate: - case Prelate: - case Monk: - case Sage: - case Hunter: - break; - - default: - assert(false && "Invalid enum value"); - } - return 0; -} - //----- (004BBA85) -------------------------------------------------------- void CheckBountyRespawnAndAward() { @@ -277,359 +128,6 @@ } } -//----- (004BBCDD) -------------------------------------------------------- -void Arena_SelectionFightLevel() -{ - signed int v0; // ebp@3 - GUIButton *v5; // eax@18 - GUIButton *v6; // esi@19 - - if ( pParty->field_7B5_in_arena_quest ) - { - if ( pParty->field_7B5_in_arena_quest == -1 ) - { - uDialogueType = DIALOGUE_ARENA_ALREADY_WON; - } - else - { - v0 = 0; - for (size_t i = 0; i < uNumActors; i++ ) - { - if ( pActors[i].uAIState == Dead - || pActors[i].uAIState == Removed - || pActors[i].uAIState == Disabled - || pActors[i].uSummonerID != 0 && PID_TYPE(pActors[i].uSummonerID) == OBJECT_Player) - ++v0; - } - if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) - { - uDialogueType = DIALOGUE_ARENA_REWARD; - ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1);//Ritor1:I dont know - for ( uint i= 0; i < 4; i++ ) - pParty->pPlayers[i].SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); - pParty->PartyFindsGold(gold_transaction_amount, 0); - pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); - pParty->field_7B5_in_arena_quest = -1; - } - else - { - uDialogueType = DIALOGUE_ARENA_WELCOME; - pParty->vPosition.x = 3849; - pParty->vPosition.y = 5770; - pParty->vPosition.z = 1; - pParty->uFallStartY = 1; - pParty->sRotationY = 512; - pParty->sRotationX = 0; - pParty->uFallSpeed = 0; - pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); - } - } - } - else - { - uDialogueType = DIALOGUE_ARENA_WELCOME; - v5 = pDialogueWindow->pControlsHead; - if ( v5 ) - { - do - { - v6 = v5->pNext; - free(v5); - v5 = v6; - } - while ( v6 ); - } - pDialogueWindow->pControlsHead = 0; - pDialogueWindow->pControlsTail = 0; - pDialogueWindow->uNumControls = 0; - pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, - pGlobalTXT_LocalizationStrings[79], //Close, Закрыть - pIcons_LOD->GetTexture(uExitCancelTextureId), 0); - pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 85, 0, "", 0); - pDialogueWindow->CreateButton(480, 190, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 86, 0, "", 0); - pDialogueWindow->CreateButton(480, 220, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 87, 0, "", 0); - pDialogueWindow->CreateButton(480, 250, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 88, 0, "", 0); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); - } -} - -//----- (004BC109) -------------------------------------------------------- -void ArenaFight() -{ - int v0; // edi@1 - char *v1; // eax@7 - int v3; // eax@10 - signed int v4; // esi@10 - signed int v6; // ebx@34 - signed int v13; // eax@49 - int v14; // esi@49 - int v15; // edx@50 - int v16; // eax@51 - signed int v17; // ecx@51 - int v18; // edx@53 - int i; // edi@55 - signed int v22; // [sp-4h] [bp-144h]@51 - __int16 v23[100]; // [sp+Ch] [bp-134h]@39 - GUIWindow window; // [sp+D4h] [bp-6Ch]@1 - __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 - int v26; // [sp+134h] [bp-Ch]@1 - int num_monsters; // [sp+13Ch] [bp-4h]@17 - - v26 = 0; - pParty->field_7B5_in_arena_quest = uDialogueType; - memcpy(&window, pDialogueWindow, sizeof(window)); - window.uFrameWidth = game_viewport_width; - window.uFrameZ = 452; - v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7;// Пожалуйста, подождите пока я вызываю существ. Удачи. - pRenderer->BeginSceneD3D(); - - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - pIndoor->Draw(); - else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - pOutdoor->Draw(); - - pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); - pRenderer->BeginScene(); - //if ( pRenderer->pRenderD3D ) - pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, - pViewport->uViewportBR_X - pViewport->uViewportTL_X, - pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, - 0x7FF); - - Texture* pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0); - - pRenderer->DrawTextureIndexed(8, 347 - v0, pTexture_591428); - v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);//Пожалуйста, подождите пока я вызываю существ. Удачи. - pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); - pRenderer->EndScene(); - pRenderer->Present(); - pParty->vPosition.x = 3849; - pParty->vPosition.y = 5770; - pParty->vPosition.z = 1; - pParty->uFallStartY = 1; - pParty->sRotationY = 512; - pParty->sRotationX = 0; - pParty->uFallSpeed = 0; - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - //v2 = pParty->pPlayers.data(); - for ( uint i = 0; i < 4; i++ ) - { - v3 = pParty->pPlayers[i].GetActualLevel(); - v4 = v26; - if ( v3 > v26 ) - { - v26 = pParty->pPlayers[i].GetActualLevel(); - v4 = pParty->pPlayers[i].GetActualLevel(); - } - //++v2; - } - //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); - if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) - { - num_monsters = v4; - v4 /= 2; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) - { - //v5 = (signed __int64)((double)v26 * 1.5); - num_monsters = (int)((double)v26 * 1.5); - v4 /= 2; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) - { - //LODWORD(v5) = 2 * v4; - num_monsters = 2 * v4; - v4 /= 2; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) - { - num_monsters = 2 * v4; - v4 /= 2; - } - if ( v4 < 1 ) - v4 = 1; - if ( v4 > 100 ) - v4 = 100; - if ( num_monsters > 100 ) - num_monsters = 100; - if ( v4 < 2 ) - v4 = 2; - if ( num_monsters < 2 ) - num_monsters = 2; - v6 = 0; - //v27 = 1; - //v7 = (char *)&pMonsterStats->pInfos[1].uLevel; - for ( uint i = 1; i <= 258; i++ ) - { - if ( pMonsterStats->pInfos[i].uAIType != 1 )//if ( v7[8] != 1 ) - { - if ( !MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8) ) //!MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) - { - //v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel; - if ( pMonsterStats->pInfos[i].uLevel >= v4 ) - { - if ( pMonsterStats->pInfos[i].uLevel <= num_monsters ) - v23[v6++] = i; - } - } - } - // ++v27; - //v7 += 88; - } - //while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); - num_monsters = 6; - if ( v6 < 6 ) - num_monsters = v6; - //v9 = 0; - if ( num_monsters > 0 ) - { - for ( uint i = 0; i < num_monsters; i++ ) - { - //v10 = rand(); - //++v9; - //v12 = __OFSUB__(v9, num_monsters); - //v11 = v9 - num_monsters < 0; - //*((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6]; - monster_ids[i] = v23[rand() % v6]; - } - //while ( v11 ^ v12 ); - } - if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) - { - v16 = rand(); - v17 = 3; - v22 = 50; - v18 = v16 % v17; - v13 = v22; - v14 = v18 + 6; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) - { - v16 = rand(); - v17 = 7; - v22 = 100; - v18 = v16 % v17; - v13 = v22; - v14 = v18 + 6; - } - else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) - { - v15 = rand() % 11; - v13 = 200; - v14 = v15 + 10; - } - else - { - if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) - { - v13 = 500; - v14 = 20; - } - //else - //{ - //v14 = v27; - //v13 = gold_transaction_amount; - //} - } - gold_transaction_amount = v26 * v13; - for ( i = 0; i < v14; ++i ) - Actor::Arena_summon_actor(monster_ids[rand() % num_monsters], pMonsterArenaPlacements[i].x, pMonsterArenaPlacements[i].y, 1); - pAudioPlayer->PlaySound(SOUND_Arena_Welcome, 0, 0, -1, 0, 0, 0, 0); -} - -//----- (004BD8B5) -------------------------------------------------------- -int HouseDialogPressCloseBtn() -{ - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); - pKeyActionMap->ResetKeys(); - activeLevelDecoration = nullptr; - current_npc_text = 0; - if ( pDialogueNPCCount == 0) - return 0; - - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && ShopTexture ) - { - ShopTexture->Release(); - ShopTexture = 0; - } - - switch(dialog_menu_id) - { - case -1: - _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); - pVideoPlayer->_4BF5B2(); - break; - - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - case HOUSE_DIALOGUE_LEARN_SKILLS: - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: - pVideoPlayer->_4BF5B2(); - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - InitializaDialogueOptions(in_current_building_type); - break; - - case HOUSE_DIALOGUE_SHOP_SELL: - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - case HOUSE_DIALOGUE_SHOP_REPAIR: - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; - InitializaDialogueOptions_Shops(in_current_building_type); - break; - - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: - case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: - pVideoPlayer->_4BF5B2(); - UI_CreateEndConversationButton(); - dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; - InitializaDialogueOptions_Tavern(in_current_building_type); - break; - - case HOUSE_DIALOGUE_NULL: - case HOUSE_DIALOGUE_MAIN: - pDialogueNPCCount = 0; - pDialogueWindow->Release(); - dialog_menu_id = HOUSE_DIALOGUE_NULL; - pDialogueWindow = 0; - pIcons_LOD->SyncLoadedFilesCount(); - - if ( uNumDialogueNPCPortraits == 1 ) - return 0; - - pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; - if ( uNumDialogueNPCPortraits > 0 ) - { - for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i ) - { - HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i], - pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i], - 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0); - } - } - - pVideoPlayer->_4BF5B2(); - break; - - default: - pVideoPlayer->_4BF5B2(); - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - InitializaDialogueOptions(in_current_building_type); - break; - } - return 1; -} - //----- (004BF91E) -------------------------------------------------------- unsigned int GameOverMenu(void *ecx0) { diff -r b4a79e3ef2f0 -r 802460e60eee mm7_4.cpp --- a/mm7_4.cpp Sun Jun 01 17:20:22 2014 +0600 +++ b/mm7_4.cpp Sun Jun 01 18:37:09 2014 +0600 @@ -29,6 +29,7 @@ #include "Lights.h" #include "Level/Decoration.h" #include "mm7_data.h" +#include "UI\UIArena.h" //----- (0046CC4B) -------------------------------------------------------- void check_event_triggers() diff -r b4a79e3ef2f0 -r 802460e60eee mm7_data.cpp --- a/mm7_data.cpp Sun Jun 01 17:20:22 2014 +0600 +++ b/mm7_data.cpp Sun Jun 01 18:37:09 2014 +0600 @@ -707,30 +707,6 @@ std::array price_for_membership={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak -std::array 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), - }} -; std::array<__int16, 32> word_4F0F30 ={{ 4, 7, 10, 11, 4, 7, 10, 11, 4, 7, 10, 11, diff -r b4a79e3ef2f0 -r 802460e60eee mm7_data.h --- a/mm7_data.h Sun Jun 01 17:20:22 2014 +0600 +++ b/mm7_data.h Sun Jun 01 18:37:09 2014 +0600 @@ -373,7 +373,6 @@ extern std::array<__int16, 54> _4F0882_evt_VAR_PlayerItemInHands_vals; extern std::array pMaxLevelPerTrainingHallType; extern std::array price_for_membership; // weak -extern std::array pMonsterArenaPlacements; extern std::array<__int16, 32> word_4F0F30; // weak extern std::array ai_array_4F5E68; extern std::array ai_array_4F6638_actor_ids; diff -r b4a79e3ef2f0 -r 802460e60eee mm7_unsorted_subs.h --- a/mm7_unsorted_subs.h Sun Jun 01 17:20:22 2014 +0600 +++ b/mm7_unsorted_subs.h Sun Jun 01 18:37:09 2014 +0600 @@ -57,8 +57,6 @@ void __fastcall DrawTextAtStatusBar(const char *Str, int a5); __int64 GetExperienceRequiredForLevel(int a1); void CheckBountyRespawnAndAward(); -void Arena_SelectionFightLevel(); -void ArenaFight(); int HouseDialogPressCloseBtn(); bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); void ODM_LoadAndInitialize(const char *pLevelFilename, struct ODMRenderParams *thisa);