# HG changeset patch # User Ritor1 # Date 1401690688 -21600 # Node ID 6eb63623cbe87b432b56bf9ac1349db15d9cec77 # Parent 802460e60eee89e8968935b27bc5069148e8537a# Parent bcd7fadbf7d2d8be25b7006285ce5b6422c09509 Слияние diff -r bcd7fadbf7d2 -r 6eb63623cbe8 AudioPlayer.h --- a/AudioPlayer.h Mon May 12 12:28:06 2014 +0600 +++ b/AudioPlayer.h Mon Jun 02 12:31:28 2014 +0600 @@ -121,6 +121,7 @@ SOUND_CloseBook = 231, SOUND_11090 = 11090, SOUND_12040 = 12040, + SOUND_Arena_Welcome = 14060, SOUND_20001 = 0x4E21, }; diff -r bcd7fadbf7d2 -r 6eb63623cbe8 Build/Visual Studio 2012/World of Might and Magic.vcxproj --- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj Mon May 12 12:28:06 2014 +0600 +++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj Mon Jun 02 12:31:28 2014 +0600 @@ -228,6 +228,7 @@ + @@ -483,6 +484,7 @@ + diff -r bcd7fadbf7d2 -r 6eb63623cbe8 Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters --- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Mon May 12 12:28:06 2014 +0600 +++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Mon Jun 02 12:31:28 2014 +0600 @@ -388,6 +388,9 @@ + + UI + @@ -962,6 +965,9 @@ + + UI + diff -r bcd7fadbf7d2 -r 6eb63623cbe8 GUIWindow.h --- a/GUIWindow.h Mon May 12 12:28:06 2014 +0600 +++ b/GUIWindow.h Mon Jun 02 12:31:28 2014 +0600 @@ -237,7 +237,7 @@ { DIALOGUE_USE_NPC_ABILITY = 9, DIALOGUE_13 = 0xD, - DIALOGUE_18 = 0x12, + DIALOGUE_18 = 18, DIALOGUE_EVT_A = 19, DIALOGUE_EVT_B = 20, DIALOGUE_EVT_C = 21, @@ -254,8 +254,8 @@ DIALOGUE_ARENA_SELECT_CHAMPION = 88, DIALOGUE_ARENA_WELCOME = 89, DIALOGUE_ARENA_FIGHT_NOT_OVER_YET = 90, - DIALOGUE_ARENA_REWARD = 0x5B, - DIALOGUE_ARENA_ALREADY_WON = 0x5C, + DIALOGUE_ARENA_REWARD = 91, + DIALOGUE_ARENA_ALREADY_WON = 92, }; diff -r bcd7fadbf7d2 -r 6eb63623cbe8 MediaPlayer.cpp --- a/MediaPlayer.cpp Mon May 12 12:28:06 2014 +0600 +++ b/MediaPlayer.cpp Mon Jun 02 12:31:28 2014 +0600 @@ -727,7 +727,7 @@ device_buffer = provider->CreateTrack16(audio.dec_ctx->channels, audio.dec_ctx->sample_rate, 2, num_audio_samples, audio_plain_data.Ptr()); - ReleaseAvcodec(); + Release(); return true; } } @@ -813,6 +813,7 @@ delete decoding_frame; if (last_resampled_frame_data[0]) av_freep(&last_resampled_frame_data[0]); + } bool Load(const wchar_t *filename, int dst_width, int dst_height, int cache_ms) // @@ -990,7 +991,7 @@ last_resampled_frame_num = desired_frame_number; memcpy(last_resampled_frame_data, rescaled_data, sizeof(rescaled_data)); memcpy(last_resampled_frame_linesize, rescaled_linesize, sizeof(rescaled_linesize)); - // av_freep(&rescaled_data[0]); + //av_freep(&rescaled_data[0]);// } } else diff -r bcd7fadbf7d2 -r 6eb63623cbe8 NPC.cpp --- a/NPC.cpp Mon May 12 12:28:06 2014 +0600 +++ b/NPC.cpp Mon Jun 02 12:31:28 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 bcd7fadbf7d2 -r 6eb63623cbe8 UI/UIArena.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UI/UIArena.cpp Mon Jun 02 12:31:28 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 bcd7fadbf7d2 -r 6eb63623cbe8 UI/UIArena.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UI/UIArena.h Mon Jun 02 12:31:28 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 bcd7fadbf7d2 -r 6eb63623cbe8 UI/UIHouses.cpp --- a/UI/UIHouses.cpp Mon May 12 12:28:06 2014 +0600 +++ b/UI/UIHouses.cpp Mon Jun 02 12:31:28 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 bcd7fadbf7d2 -r 6eb63623cbe8 mm7_2.cpp --- a/mm7_2.cpp Mon May 12 12:28:06 2014 +0600 +++ b/mm7_2.cpp Mon Jun 02 12:31:28 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) - { - Player* player = &pParty->pPlayers[i]; - player->sHealth = player->GetMaxHealth(); - - for (int j = 0; j < 14; ++j) - player->pConditions[i] = 0; - player->pConditions[18] = 0; - } - } - break; - - case MasterHealer: - { - for (int i = 0; i < 4; ++i) - { - Player* player = &pParty->pPlayers[i]; - player->sHealth = player->GetMaxHealth(); - - int v5 = LODWORD(player->pConditions[19]);//*((int *)v4 - 32); - int v6 = HIDWORD(player->pConditions[19]);//*((int *)v4 - 31); - memset(player->pConditions.data(), 0, 0xA0u); - - __debugbreak(); - *(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 |= 1u; - 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 |= 1u; - 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,400 +128,17 @@ } } -//----- (004BBCDD) -------------------------------------------------------- -void Arena_SelectionFightLevel() -{ - signed int v0; // ebp@3 - Actor *v1; // eax@4 - __int16 v2; // cx@5 - int v3; // esi@8 - Player *v4; // esi@14 - GUIButton *v5; // eax@18 - GUIButton *v6; // esi@19 - size_t v7; // [sp+10h] [bp-4h]@4 - - if ( pParty->field_7B5_in_arena_quest ) - { - if ( pParty->field_7B5_in_arena_quest == -1 ) - { - uDialogueType = 92; - } - else - { - v0 = 0; - if ( (signed int)uNumActors > 0 ) - { - v1 = pActors.data();//[0].uAIState; - v7 = uNumActors; - do - { - v2 = v1->uAIState; - if ( v1->uAIState == Dead || v2 == Removed || v2 == Disabled || (v3 = v1->uSummonerID) != 0 && PID_TYPE(v3) == OBJECT_Player) - ++v0; - ++v1; - --v7; - } - while ( v7 ); - } - if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) - { - uDialogueType = 91; - v4 = pParty->pPlayers.data(); - ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1); - do - { - v4->SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); - ++v4; - } - while ( (signed int)v4 < (signed int)pParty->pHirelings.data() ); - pParty->PartyFindsGold(gold_transaction_amount, 0); - pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); - pParty->field_7B5_in_arena_quest = -1; - } - else - { - uDialogueType = 90; - 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((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); - } - } - } - else - { - uDialogueType = 89; - 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(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], - pIcons_LOD->GetTexture(uExitCancelTextureId), 0); - pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x55u, 0, "", 0); - pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0); - pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0); - pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x58u, 0, "", 0); - pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); - } -} - -//----- (004BC109) -------------------------------------------------------- -void ArenaFight() -{ - int v0; // edi@1 - char *v1; // eax@7 -// Player *v2; // edi@9 - int v3; // eax@10 - signed int v4; // esi@10 - //signed __int64 v5; // qax@18 - signed int v6; // ebx@34 - //char *v7; // edi@34 -// int v8; // eax@37 - //int v9; // esi@43 - //int v10; // eax@44 -// unsigned __int8 v11; // sf@44 -// unsigned __int8 v12; // of@44 - 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 -// int monster_y; // ST18_4@56 -// int v21; // eax@56 - 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 v27; // [sp+138h] [bp-8h]@23 - 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((SoundID)14060, 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) { const char *v1; // eax@2 unsigned int result; // eax@3 -// Player *v3; // eax@7 -// const char *v4; // ST24_4@9 -// int v5; // eax@9 const char *v6; // eax@10 const char *v7; // edx@10 const char *v8; // ecx@12 const char *v9; // eax@14 unsigned int v10; // eax@25 GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1 - //MSG Msg; // [sp+88h] [bp-48h]@22 unsigned int v14; // [sp+A4h] [bp-2Ch]@5 void *v15; // [sp+A8h] [bp-28h]@1 const char *pInString; // [sp+ACh] [bp-24h]@5 @@ -678,7 +146,6 @@ unsigned int v18; // [sp+B4h] [bp-1Ch]@5 unsigned int v19; // [sp+B8h] [bp-18h]@5 int v20; // [sp+BCh] [bp-14h]@7 -// Player *i; // [sp+C0h] [bp-10h]@7 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5 @@ -722,9 +189,9 @@ } pInString = v1; v23 = pParty->uTimePlayed - 138240; - v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18; - v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18 / 0x1C / 0xC; - v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18 / 0x1C % 0xC; + v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24; + v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC; + v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC; v17 = v19 % 0x1C; if ( !v19 ) v19 = 1; @@ -742,15 +209,19 @@ v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0); pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0); strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time: + v7 = pGlobalTXT_LocalizationStrings[56]; if ( v17 != 1 ) v7 = pGlobalTXT_LocalizationStrings[57]; - v8 = pGlobalTXT_LocalizationStrings[146]; + + v8 = pGlobalTXT_LocalizationStrings[146];//Month, if ( v18 != 1 ) - v8 = pGlobalTXT_LocalizationStrings[148]; + v8 = pGlobalTXT_LocalizationStrings[148];//Months, + v9 = pGlobalTXT_LocalizationStrings[245]; if ( v14 != 1 ) v9 = pGlobalTXT_LocalizationStrings[132]; + sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7); strcat(pTmpBuf.data(), pTmpBuf2.data()); pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf.data(), 3u); @@ -830,9 +301,6 @@ return result; } - - - //----- (00451007) -------------------------------------------------------- int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, //changing this to some library function might be a good idea unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, @@ -1225,8 +693,6 @@ + (__PAIR__(v10, (unsigned __int16)a4 >> 2) & 0x1C00)); } - - //----- (004547E4) -------------------------------------------------------- void FactionTable::Initialize() { @@ -1276,8 +742,6 @@ pHostileTXT_Raw = nullptr; } - - //----- (004610AA) -------------------------------------------------------- void __fastcall PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2) { @@ -1295,23 +759,12 @@ //----- (00461103) -------------------------------------------------------- void _461103_load_level_sub() { - //GUIProgressBar *v0; // ebx@1 - //signed int v1; // ebp@1 - //char *v2; // esi@2 - //__int16 v3; // cx@3 int v4; // edx@8 - //size_t v5; // edi@14 signed int v6; // esi@14 - //char *v7; // edx@15 signed int v8; // ecx@16 -// int v9; // ecx@23 -// MonsterInfo *v10; // ebx@23 - //int *v11; // esi@23 int v12; // esi@25 int v13; // eax@26 __int16 v14; // ax@41 - //signed int v15; // [sp+10h] [bp-4Ch]@1 - //signed int v16; // [sp+10h] [bp-4Ch]@14 signed int v17; // [sp+14h] [bp-48h]@3 signed int v18; // [sp+14h] [bp-48h]@23 int v19; // [sp+18h] [bp-44h]@1 @@ -1590,7 +1043,6 @@ pIcons_LOD->RemoveTexturesPackFromTextureList(); } - //----- (00464479) -------------------------------------------------------- void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() { @@ -1688,7 +1140,6 @@ pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); } - //----- (00464866) -------------------------------------------------------- void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box) { @@ -1946,8 +1397,6 @@ } } - - //----- (004651F4) -------------------------------------------------------- bool MM7_Initialize(int game_width, int game_height) { diff -r bcd7fadbf7d2 -r 6eb63623cbe8 mm7_3.cpp --- a/mm7_3.cpp Mon May 12 12:28:06 2014 +0600 +++ b/mm7_3.cpp Mon Jun 02 12:31:28 2014 +0600 @@ -524,9 +524,7 @@ result = 0; } else - { result = 1; - } return result; } @@ -610,9 +608,7 @@ result = 0; } else - { result = 1; - } return result; } @@ -621,7 +617,7 @@ { int v3; // ebx@6 int v5; // eax@10 - int v6; // ecx@10 + //int v6; // ecx@10 signed int v8; // ebx@17 // unsigned __int8 v10; // sf@17 // unsigned __int16 v11; // ax@21 @@ -663,8 +659,10 @@ for (v75 = 0; v75 < uNumActors; ++v75) { - if ( pActors[v75].uAIState == Removed || pActors[v75].uAIState == Disabled || pActors[v75].uAIState == Summoned - || !pActors[v75].uMovementSpeed ) + if ( pActors[v75].uAIState == Removed + || pActors[v75].uAIState == Disabled + || pActors[v75].uAIState == Summoned + || !pActors[v75].uMovementSpeed ) continue; v3 = 0; v69 = 0; @@ -677,10 +675,10 @@ v70 = IsTerrainSlopeTooHigh(pActors[v75].vPosition.x, pActors[v75].vPosition.y); v5 = ODM_GetFloorLevel(pActors[v75].vPosition.x, pActors[v75].vPosition.y, pActors[v75].vPosition.z, pActors[v75].uActorHeight, &uIsOnWater, (int *)&v69, v3); - v6 = pActors[v75].vPosition.z; + //v6 = pActors[v75].vPosition.z; uIsAboveFloor = 0; v67 = v69 == 0; - if ( v6 > v5 + 1 ) + if ( pActors[v75].vPosition.z > v5 + 1 ) uIsAboveFloor = 1; if ( pActors[v75].uAIState == Dead && uIsOnWater && !uIsAboveFloor ) { @@ -967,18 +965,11 @@ //----- (0047253E) -------------------------------------------------------- void UpdateObjects() { -// unsigned int v0; // ebx@0 ObjectDesc *object; // eax@5 int v5; // ecx@6 -// __int16 v6; // cx@7 signed int v7; // eax@9 signed int v11; // eax@17 int v12; // edi@27 -// int v13; // eax@27 -// int v14; // ebx@27 -// unsigned int v15; // ecx@27 -// unsigned int v16; // edx@30 -// unsigned int v17; // edx@32 int v18; // [sp+4h] [bp-10h]@27 int v19; // [sp+8h] [bp-Ch]@27 @@ -2677,9 +2668,7 @@ v3 = v4->uRespawnIntervalDays; } else - { v4 = (MapInfo *)thisa; - } day_attrib &= ~DAY_ATTRIB_FOG; dword_6BE13C_uCurrentlyLoadedLocationID = v2; pOutdoor->Initialize( diff -r bcd7fadbf7d2 -r 6eb63623cbe8 mm7_4.cpp --- a/mm7_4.cpp Mon May 12 12:28:06 2014 +0600 +++ b/mm7_4.cpp Mon Jun 02 12:31:28 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() @@ -142,8 +143,6 @@ array_77EC08[i].field_108 = 0; } - - //----- (00491E3A) -------------------------------------------------------- void sub_491E3A() { @@ -1282,23 +1281,23 @@ case 12: pReputation = npc->rep; if ( pReputation >= 25 ) - pText = pGlobalTXT_LocalizationStrings[379]; + pText = pGlobalTXT_LocalizationStrings[379];// else { if ( pReputation < 6 ) { if ( pReputation >= -5 ) - pText = pGlobalTXT_LocalizationStrings[399]; + pText = pGlobalTXT_LocalizationStrings[399];// else { if ( pReputation < -24 ) - pText = pGlobalTXT_LocalizationStrings[434]; + pText = pGlobalTXT_LocalizationStrings[434];// else - pText = pGlobalTXT_LocalizationStrings[402]; + pText = pGlobalTXT_LocalizationStrings[402];// } } else - pText = pGlobalTXT_LocalizationStrings[392]; + pText = pGlobalTXT_LocalizationStrings[392];// } strcat(pTmpBuf2.data(), pText); dst = strlen(pTmpBuf2.data()); @@ -1501,10 +1500,6 @@ //----- (0049B04D) -------------------------------------------------------- void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) { - //stru154 *v3; // edi@1 - //signed int v4; // eax@1 - //signed int result; // eax@9 - //signed int v6; // [sp-8h] [bp-18h]@8 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 float v7; @@ -1660,18 +1655,12 @@ void OracleDialogue() { __int16 *v0; // edi@1 -// int v1; // ebx@3 -// Player *v2; // esi@3 -// int v3; // eax@4 signed int v4; // eax@9 int v5; // ebx@11 -// Player *v6; // esi@13 -// ItemGen *v7; // eax@14 signed int v8; // edi@14 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 signed int v10; // [sp+10h] [bp-8h]@13 int v11; // [sp+14h] [bp-4h]@1 -// Player *v12; // [sp+14h] [bp-4h]@11 contract_approved = 0; v11 = 0; @@ -1688,7 +1677,7 @@ for ( uint pl = 0; pl < 4; pl++ ) { //LOBYTE(v3) = pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)); - if ( pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)) ) + if ( pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0 + 1)) ) break; //++v2; //++v1; @@ -2055,7 +2044,7 @@ pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 1, 0); if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) { - pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); + pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);// v1 = 1; } pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);// diff -r bcd7fadbf7d2 -r 6eb63623cbe8 mm7_data.cpp --- a/mm7_data.cpp Mon May 12 12:28:06 2014 +0600 +++ b/mm7_data.cpp Mon Jun 02 12:31:28 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 bcd7fadbf7d2 -r 6eb63623cbe8 mm7_data.h --- a/mm7_data.h Mon May 12 12:28:06 2014 +0600 +++ b/mm7_data.h Mon Jun 02 12:31:28 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 bcd7fadbf7d2 -r 6eb63623cbe8 mm7_unsorted_subs.h --- a/mm7_unsorted_subs.h Mon May 12 12:28:06 2014 +0600 +++ b/mm7_unsorted_subs.h Mon Jun 02 12:31:28 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);