Ares
|
#include "Interface.h"
#include "../Ares.h"
#include "../Ares.CRT.h"
#include "../Ext/Campaign/Body.h"
#include "../Utilities/Constructs.h"
#include <StringTable.h>
#include <MessageBox.h>
#include <VocClass.h>
#include <Strsafe.h>
Functions | |
DEFINE_HOOK (62267F, Dialog_Show_GetTemplate, 6) | |
DEFINE_HOOK (6226EE, Dialog_Show_UpdateControls, 6) | |
DEFINE_HOOK (52DDBA, Frontend_WndProc_MessageBox, 5) | |
DEFINE_HOOK (52E446, Frontend_WndProc_JustAfterAction, 6) | |
DEFINE_HOOK (53208D, Main_hDlg_SinglePlayerButtonClick, 6) | |
DEFINE_HOOK (5320C2, Main_hDlg_WWOnlineButtonClick, 6) | |
DEFINE_HOOK (532051, Main_hDlg_NetworkButtonClick, 6) | |
DEFINE_HOOK (5320AE, Main_hDlg_MoviesAndCreditsButtonClick, 6) | |
DEFINE_HOOK (52D724, SinglePlayer_hDlg_CampaignButtonClick, 6) | |
DEFINE_HOOK (52D713, SinglePlayer_hDlg_SkirmishButtonClick, 6) | |
DEFINE_HOOK (52D7ED, MoviesAndCredits_hDlg_SneakPeeksButtonClick, 6) | |
DEFINE_HOOK (52D7FB, MoviesAndCredits_hDlg_PlayMoviesButtonClick, 6) | |
DEFINE_HOOK (52D809, MoviesAndCredits_hDlg_ViewCreditsButtonClick, 6) | |
DEFINE_HOOK (52F00B, CampaignMenu_hDlg_PopulateCampaignList, 5) | |
DEFINE_HOOK (52EC18, CampaignMenu_hDlg_PreHandleGeneral, 5) | |
DEFINE_HOOK (52ED21, CampaignMenu_hDlg_ClickedPlay, 9) | |
DEFINE_HOOK (52EF39, CampaignMenu_hDlg_ImageMouseDown, 5) | |
DEFINE_HOOK (52EE04, CampaignMenu_hDlg_SelectHoverSound, 6) | |
DEFINE_HOOK (52F232, CampaignMenu_hDlg_StartCampaign, 6) | |
DEFINE_HOOK (60378B, CampaignMenu_ChooseButtonPalette, 6) | |
DEFINE_HOOK (603A2E, CampaignMenu_ChooseButtonImage, 6) | |
DEFINE_HOOK (60A90A, CampaignMenu_StaticButtonImage, 5) | |
DEFINE_HOOK (60357E, CampaignMenu_SetAnimationDuration, 5) | |
DEFINE_HOOK (52F191, CampaignMenu_InitializeMoreButtons, 5) | |
DEFINE_HOOK (6041ED, DialogFunc_SubText_CampaignIconA, 5) | |
DEFINE_HOOK (6041F5, DialogFunc_CampaignMenu_CampaignIconB, 5) | |
DEFINE_HOOK (69A310, Game_GetLinkedColor, 7) | |
DEFINE_HOOK (4E42A0, GameSetup_GetColorTooltip, 5) | |
DEFINE_HOOK (4E46BB, hWnd_PopulateWithColors, 7) | |
DEFINE_HOOK (4E4A41, hWnd_DrawColors_A, 7) | |
DEFINE_HOOK (4E4B47, hWnd_DrawColors_B, 7) | |
DEFINE_HOOK (4E4556, hWnd_GetSlotColorIndex, 7) | |
DEFINE_HOOK (4E4580, hWnd_IsAvailableColor, 5) | |
DEFINE_HOOK (4E4C9D, hWnd_WhateverColors_A, 7) | |
DEFINE_HOOK (4E4D67, hWnd_WhateverColors_B, 7) | |
DEFINE_HOOK (60FAD7, Ownerdraw_PostProcessColors, A) | |
DEFINE_HOOK (612DA9, Handle_Button_Messages_Color, 6) | |
DEFINE_HOOK (613072, Handle_Button_Messages_DisabledColor, 7) | |
DEFINE_HOOK (61664C, Handle_Checkbox_Messages_Color, 5) | |
DEFINE_HOOK (616655, Handle_Checkbox_Messages_Disabled, 5) | |
DEFINE_HOOK (616AF0, Handle_RadioButton_Messages_Color, 6) | |
DEFINE_HOOK (615DF7, Handle_Static_Messages_Color, 6) | |
DEFINE_HOOK (615AB7, Handle_Static_Messages_Disabled, 6) | |
DEFINE_HOOK (619A4F, Handle_Listbox_Messages_Color, 6) | |
DEFINE_HOOK (6198D3, Handle_Listbox_Messages_DisabledA, 6) | |
DEFINE_HOOK (619A5F, Handle_Listbox_Messages_DisabledB, 6) | |
DEFINE_HOOK (619270, Handle_Listbox_Messages_SelectionA, 5) | |
DEFINE_HOOK (619288, Handle_Listbox_Messages_SelectionB, 6) | |
DEFINE_HOOK (617A2B, Handle_Combobox_Messages_Color, 6) | |
DEFINE_HOOK (617A57, Handle_Combobox_Messages_Disabled, 6) | |
DEFINE_HOOK (60DDA6, Handle_Combobox_Dropdown_Messages_SelectionA, 5) | |
DEFINE_HOOK (60DDB6, Handle_Combobox_Dropdown_Messages_SelectionB, 6) | |
DEFINE_HOOK (61E2A5, Handle_Slider_Messages_Color, 5) | |
DEFINE_HOOK (61E2B1, Handle_Slider_Messages_Disabled, 5) | |
DEFINE_HOOK (61E8A0, Handle_GroupBox_Messages_Color, 6) | |
DEFINE_HOOK (614FF2, Handle_NewEdit_Messages_Color, 6) | |
DEFINE_HOOK (69B949, Game_ProcessRandomPlayers_ColorsA, 6) | |
DEFINE_HOOK (69BA13, Game_ProcessRandomPlayers_ColorsB, 6) | |
DEFINE_HOOK (69B69B, GameModeClass_PickRandomColor_Unlimited, 6) | |
DEFINE_HOOK (69B7FF, GameModeClass_SetColor_Unlimited, 6) |
DEFINE_HOOK | ( | 62267F | , |
Dialog_Show_GetTemplate | , | ||
6 | |||
) |
{ GET(int, iID, EBP); Interface::lastDialogTemplateID = iID; return 0; }
DEFINE_HOOK | ( | 69B7FF | , |
GameModeClass_SetColor_Unlimited | , | ||
6 | |||
) |
{ R->EAX(ScenarioClass::Instance->Random.RandomRanged(0, Ares::UISettings::ColorCount - 1)); return 0x69B813; }
DEFINE_HOOK | ( | 69B69B | , |
GameModeClass_PickRandomColor_Unlimited | , | ||
6 | |||
) |
{ R->EAX(ScenarioClass::Instance->Random.RandomRanged(0, Ares::UISettings::ColorCount - 1)); return 0x69B6AF; }
DEFINE_HOOK | ( | 69BA13 | , |
Game_ProcessRandomPlayers_ColorsB | , | ||
6 | |||
) |
{ R->EAX(ScenarioClass::Instance->Random.RandomRanged(0, Ares::UISettings::ColorCount - 1)); return 0x69BA28; }
DEFINE_HOOK | ( | 69B949 | , |
Game_ProcessRandomPlayers_ColorsA | , | ||
6 | |||
) |
{ R->EAX(ScenarioClass::Instance->Random.RandomRanged(0, Ares::UISettings::ColorCount - 1)); return 0x69B95E; }
DEFINE_HOOK | ( | 614FF2 | , |
Handle_NewEdit_Messages_Color | , | ||
6 | |||
) |
{ R->EDX(Ares::UISettings::uiColorTextEdit); return 0x614FF8; }
DEFINE_HOOK | ( | 61E8A0 | , |
Handle_GroupBox_Messages_Color | , | ||
6 | |||
) |
{ R->ECX(Ares::UISettings::uiColorTextGroupbox); return 0x61E8A6; }
DEFINE_HOOK | ( | 61E2B1 | , |
Handle_Slider_Messages_Disabled | , | ||
5 | |||
) |
{ R->EAX(Ares::UISettings::uiColorDisabledSlider); return 0x61E2B6; }
DEFINE_HOOK | ( | 61E2A5 | , |
Handle_Slider_Messages_Color | , | ||
5 | |||
) |
{ R->EAX(Ares::UISettings::uiColorTextSlider); return 0x61E2AA; }
DEFINE_HOOK | ( | 60DDB6 | , |
Handle_Combobox_Dropdown_Messages_SelectionB | , | ||
6 | |||
) |
{ R->DL(Ares::UISettings::uiColorSelectionCombobox >> 16); return 0x60DDBC; }
DEFINE_HOOK | ( | 60DDA6 | , |
Handle_Combobox_Dropdown_Messages_SelectionA | , | ||
5 | |||
) |
{ R->EAX(Ares::UISettings::uiColorSelectionCombobox); return 0x60DDAB; }
DEFINE_HOOK | ( | 617A57 | , |
Handle_Combobox_Messages_Disabled | , | ||
6 | |||
) |
{ R->EBX(Ares::UISettings::uiColorDisabledCombobox); return 0x617A5D; }
DEFINE_HOOK | ( | 617A2B | , |
Handle_Combobox_Messages_Color | , | ||
6 | |||
) |
{ R->EBX(Ares::UISettings::uiColorTextCombobox); return 0x617A31; }
DEFINE_HOOK | ( | 619288 | , |
Handle_Listbox_Messages_SelectionB | , | ||
6 | |||
) |
{ R->DL(Ares::UISettings::uiColorSelectionList >> 16); return 0x61928E; }
DEFINE_HOOK | ( | 619270 | , |
Handle_Listbox_Messages_SelectionA | , | ||
5 | |||
) |
{ R->EAX(Ares::UISettings::uiColorSelectionList); return 0x619275; }
DEFINE_HOOK | ( | 619A5F | , |
Handle_Listbox_Messages_DisabledB | , | ||
6 | |||
) |
{ R->ESI(Ares::UISettings::uiColorDisabledList); return 0x619A65; }
DEFINE_HOOK | ( | 6198D3 | , |
Handle_Listbox_Messages_DisabledA | , | ||
6 | |||
) |
{ R->EBX(Ares::UISettings::uiColorDisabledList); return 0x6198D9; }
DEFINE_HOOK | ( | 619A4F | , |
Handle_Listbox_Messages_Color | , | ||
6 | |||
) |
{ R->ESI(Ares::UISettings::uiColorTextList); return 0x619A55; }
DEFINE_HOOK | ( | 615AB7 | , |
Handle_Static_Messages_Disabled | , | ||
6 | |||
) |
{ R->ECX(Ares::UISettings::uiColorDisabledLabel); return 0x615ABD; }
DEFINE_HOOK | ( | 615DF7 | , |
Handle_Static_Messages_Color | , | ||
6 | |||
) |
{ R->ECX(Ares::UISettings::uiColorTextLabel); return 0x615DFD; }
DEFINE_HOOK | ( | 616AF0 | , |
Handle_RadioButton_Messages_Color | , | ||
6 | |||
) |
{ R->ECX(Ares::UISettings::uiColorTextRadio); return 0x616AF6; }
DEFINE_HOOK | ( | 616655 | , |
Handle_Checkbox_Messages_Disabled | , | ||
5 | |||
) |
{ R->EAX(Ares::UISettings::uiColorDisabledCheckbox); return 0x61665A; }
DEFINE_HOOK | ( | 61664C | , |
Handle_Checkbox_Messages_Color | , | ||
5 | |||
) |
{ R->EAX(Ares::UISettings::uiColorTextCheckbox); return 0x616651; }
DEFINE_HOOK | ( | 613072 | , |
Handle_Button_Messages_DisabledColor | , | ||
7 | |||
) |
{ R->EDI(Ares::UISettings::uiColorDisabledButton); return 0x613138; }
DEFINE_HOOK | ( | 612DA9 | , |
Handle_Button_Messages_Color | , | ||
6 | |||
) |
{ R->EDI(Ares::UISettings::uiColorTextButton); return 0x612DAF; }
DEFINE_HOOK | ( | 60FAD7 | , |
Ownerdraw_PostProcessColors | , | ||
A | |||
) |
{ // copy original instruction *(int*)0xAC1B90 = 0x443716; // update colors *(int*)0xAC18A4 = Ares::UISettings::uiColorText; *(int*)0xAC184C = Ares::UISettings::uiColorCaret; *(int*)0xAC4604 = Ares::UISettings::uiColorSelection; *(int*)0xAC1B98 = Ares::UISettings::uiColorBorder1; *(int*)0xAC1B94 = Ares::UISettings::uiColorBorder2; *(int*)0xAC1AF8 = Ares::UISettings::uiColorDisabledObserver; *(int*)0xAC1CB0 = Ares::UISettings::uiColorTextObserver; *(int*)0xAC4880 = Ares::UISettings::uiColorSelectionObserver; *(int*)0xAC1CB4 = Ares::UISettings::uiColorDisabled; // skip initialization bool inited = *(bool*)0xAC48D4; return inited ? 0x60FB5D : 0x60FAE3; }
DEFINE_HOOK | ( | 4E4D67 | , |
hWnd_WhateverColors_B | , | ||
7 | |||
) |
{ GET(int, idx, EAX); GET(int, value, ESI); Ares::UISettings::Colors[idx+1].selectedIndex = value; return 0x4E4D6E; }
DEFINE_HOOK | ( | 4E4C9D | , |
hWnd_WhateverColors_A | , | ||
7 | |||
) |
{ GET(int, curSel, EAX); int idx = -1; for(int i=0; i<Ares::UISettings::ColorCount; ++i) { if(Ares::UISettings::Colors[i+1].selectedIndex == curSel) { idx = i; break; } } if(idx != -1) { Ares::UISettings::Colors[idx+1].selectedIndex = -1; } return 0x4E4CC9; }
DEFINE_HOOK | ( | 4E4580 | , |
hWnd_IsAvailableColor | , | ||
5 | |||
) |
{ GET(int, slot, ECX); R->AL(Ares::UISettings::Colors[slot+1].selectedIndex == -1); return 0x4E4592; }
DEFINE_HOOK | ( | 4E4556 | , |
hWnd_GetSlotColorIndex | , | ||
7 | |||
) |
{ GET(int, slot, ECX); int ret = -1; for(int i=0; i<Ares::UISettings::ColorCount; ++i) { if(Ares::UISettings::Colors[i+1].selectedIndex == slot) { ret = i+1; break; } } R->EAX(ret); return 0x4E4570; }
DEFINE_HOOK | ( | 4E4B47 | , |
hWnd_DrawColors_B | , | ||
7 | |||
) |
{ GET(int, idx, EBP); GET(int, value, ESI); Ares::UISettings::Colors[idx+1].selectedIndex = value; return 0x4E4B4E; }
DEFINE_HOOK | ( | 4E4A41 | , |
hWnd_DrawColors_A | , | ||
7 | |||
) |
{ GET(int, curSel, EAX); int idx = -1; for(int i=0; i<Ares::UISettings::ColorCount; ++i) { if(Ares::UISettings::Colors[i+1].selectedIndex == curSel) { idx = i; break; } } if(idx != -1) { Ares::UISettings::Colors[idx+1].selectedIndex = -1; } return 0x4E4A6D; }
DEFINE_HOOK | ( | 4E46BB | , |
hWnd_PopulateWithColors | , | ||
7 | |||
) |
{ GET(HWND, hWnd, ESI); GET_STACK(int, idxSlot, 0x14); // add all colors int curSel = 0; for(int i=0; i<Ares::UISettings::ColorCount; ++i) { Interface::ColorData* pSlot = &Ares::UISettings::Colors[i+1]; bool isCurrent = pSlot->selectedIndex == idxSlot; if(isCurrent || pSlot->selectedIndex == -1) { int idx = SendMessageA(hWnd, WW_CB_ADDITEM, 0, 0x822B78); SendMessageA(hWnd, WW_SETCOLOR, idx, pSlot->colorRGB); SendMessageA(hWnd, CB_SETITEMDATA, idx, i); if(isCurrent) { curSel = idx; } } } SendMessageA(hWnd, CB_SETCURSEL, curSel, 0); SendMessageA(hWnd, 0x4F1, 0, 0); return 0x4E4749; }
DEFINE_HOOK | ( | 4E42A0 | , |
GameSetup_GetColorTooltip | , | ||
5 | |||
) |
{ GET(int, idx, ECX); const wchar_t* ret = NULL; if(idx == -2) { // random ret = StringTable::LoadStringA("STT:PlayerColorRandom"); } else if(idx <= Ares::UISettings::ColorCount) { // houses and observer ret = Ares::UISettings::Colors[(idx+1)%(Ares::UISettings::ColorCount+1)].sttToolTipSublineText; } R->EAX(ret); return 0x4E43B9; }
DEFINE_HOOK | ( | 69A310 | , |
Game_GetLinkedColor | , | ||
7 | |||
) |
{ GET_STACK(int, idx, 0x4); // get the slot Interface::ColorData* slot = NULL; if(idx == -2 || idx == Ares::UISettings::ColorCount) { // observer color slot = &Ares::UISettings::Colors[0]; } else if(idx < Ares::UISettings::ColorCount) { // house color slot = &Ares::UISettings::Colors[idx+1]; } // retrieve the color scheme index int ret = 0; if(slot) { if(slot->colorSchemeIndex == -1) { slot->colorSchemeIndex = ColorScheme::FindIndex(slot->colorScheme); if(slot->colorSchemeIndex == -1) { Debug::Log("Color scheme \"%s\" not found.\n", slot->colorScheme ? slot->colorScheme : ""); slot->colorSchemeIndex = 4; } } ret = slot->colorSchemeIndex; } R->EAX(ret + 1); return 0x69A334; }
DEFINE_HOOK | ( | 6041F5 | , |
DialogFunc_CampaignMenu_CampaignIconB | , | ||
5 | |||
) |
{
return 0x6041FA;
}
DEFINE_HOOK | ( | 6041ED | , |
DialogFunc_SubText_CampaignIconA | , | ||
5 | |||
) |
{ GET(int, iID, EAX); int idxSlot = Interface::getSlotIndex(iID); if(idxSlot > -1) { int idxCampaign = Interface::slots[idxSlot]-1; if((idxCampaign > -1) && *Ares::UISettings::Campaigns[idxCampaign].ToolTip) { R->EAX(Ares::UISettings::Campaigns[idxCampaign].ToolTip); return 0x6041F4; } } return 0x60421D; }
DEFINE_HOOK | ( | 52F191 | , |
CampaignMenu_InitializeMoreButtons | , | ||
5 | |||
) |
{ GET(HWND, hDlg, ESI); if(!Ares::UISettings::CampaignList) { // register buttons as campaign buttons SendDlgItemMessageA(hDlg, 1773, 0x4D5u, 0, 0); SendDlgItemMessageA(hDlg, 1773, 0x4D4u, 0, 0); if(HWND hItem = GetDlgItem(hDlg, 1771)) { PostMessageA(hItem, 0x4D7u, 0, (LPARAM)hDlg); } if(HWND hItem = GetDlgItem(hDlg, 1773)) { PostMessageA(hItem, 0x4D7u, 0, (LPARAM)hDlg); } // create the order in which the campaigns will appear. // this matters for three campaigns as it seems the // usual item count should be 1-2 and not 2-1. if(Ares::UISettings::Campaigns[3].Valid) { // in order of appearance for(int i=0; i<4; ++i) { Interface::slots[i] = i + 1; } } else { // at most three campaigns. special order. int order[4] = {1, 0, 2, 3}; for(int i=0; i<4; ++i) { Interface::slots[i] = order[i]; } } // remove the ones that are not there for(int i=0; i<4; ++i) { int idxCampaign = Interface::slots[i] - 1; if(!Ares::UISettings::Campaigns[idxCampaign].Valid) { // disable slot Interface::slots[i] = 0; } else { // update the subline text if(HWND hItem = GetDlgItem(hDlg, i + 1959)) { SendMessageA(hItem, 0x4B2u, 0, (LPARAM)StringTable::LoadStringA(Ares::UISettings::Campaigns[idxCampaign].Subline)); } } } } return 0; }
DEFINE_HOOK | ( | 60357E | , |
CampaignMenu_SetAnimationDuration | , | ||
5 | |||
) |
{ GET(HWND, iID, EAX); return ((Interface::getSlotIndex((int)iID) > -1) ? 0x6035C5 : 0x6035E6); }
DEFINE_HOOK | ( | 60A90A | , |
CampaignMenu_StaticButtonImage | , | ||
5 | |||
) |
{ GET(HWND, iID, EAX); return ((Interface::getSlotIndex((int)iID) > -1) ? 0x60A982 : 0x60A9ED); }
DEFINE_HOOK | ( | 603A2E | , |
CampaignMenu_ChooseButtonImage | , | ||
6 | |||
) |
{ GET(int, iID, EAX); int idxSlot = Interface::getSlotIndex(iID); if(idxSlot > -1) { int idxCampaign = Interface::slots[idxSlot]-1; if(idxCampaign > -1) { R->EAX(Ares::UISettings::Campaigns[idxCampaign].Image); return 0x603A3A; } } return 0x603A35; }
DEFINE_HOOK | ( | 60378B | , |
CampaignMenu_ChooseButtonPalette | , | ||
6 | |||
) |
{ GET(int, iID, EDI); int idxSlot = Interface::getSlotIndex(iID); if(idxSlot > -1) { int idxCampaign = Interface::slots[idxSlot]-1; if(idxCampaign > -1 && Ares::UISettings::Campaigns[idxCampaign].Palette->Convert) { R->EAX(Ares::UISettings::Campaigns[idxCampaign].Palette->Convert); return 0x603798; } } return 0x6037FE; }
DEFINE_HOOK | ( | 52F232 | , |
CampaignMenu_hDlg_StartCampaign | , | ||
6 | |||
) |
{ GET(int, iID, EBP); // get the campaign hovered above int idxSlot = Interface::getSlotIndex(iID); char* campaignID = NULL; if(idxSlot > -1) { int idxCampaign = Interface::slots[idxSlot]-1; if(idxCampaign > -1) { campaignID = Ares::UISettings::Campaigns[idxCampaign].Battle; } } R->ECX(campaignID); return 0x52F260; }
DEFINE_HOOK | ( | 52EE04 | , |
CampaignMenu_hDlg_SelectHoverSound | , | ||
6 | |||
) |
{ GET(HWND, hDlg, ESI); GET(int, iID, EBX); GET(int, lastiID, EAX); int idxSlot = Interface::getSlotIndex(iID); if(idxSlot > -1) { if(iID != lastiID) { // get the campaign hovered above int idxCampaign = Interface::slots[idxSlot]-1; char* campaignID = NULL; if(idxCampaign > -1) { campaignID = Ares::UISettings::Campaigns[idxCampaign].Battle; } // find the campaign hover sound if(campaignID && *campaignID) { int sound = -1; int idxBattle = CampaignClass::FindIndex(campaignID); if(idxBattle > -1) { if(CampaignExt::ExtData *pData = CampaignExt::Array.GetItem(idxBattle)) { sound = VocClass::FindIndex(pData->HoverSound); } } // the actual book keeping SendDlgItemMessageA(hDlg, iID, 0x4D3, 0, 0); *(DWORD*)(0x825C20) = sound; return 0x52EE2D; } } return 0x52F3DC; } return 0; }
DEFINE_HOOK | ( | 52EF39 | , |
CampaignMenu_hDlg_ImageMouseDown | , | ||
5 | |||
) |
{ GET(int, iID, EAX); // this is an image button. play click sound. int idxSlot = Interface::getSlotIndex(iID); if(idxSlot > -1) { int idxCampaign = Interface::slots[idxSlot]-1; if((idxCampaign > -1) && *Ares::UISettings::Campaigns[idxCampaign].Battle) { return 0x52EF52; } } return 0x52F3DC; }
DEFINE_HOOK | ( | 52ED21 | , |
CampaignMenu_hDlg_ClickedPlay | , | ||
9 | |||
) |
{ GET(HWND, hDlg, ESI); // find out which campaign is selected int idxItem = SendDlgItemMessageA(hDlg, 1109, LB_GETCURSEL, 0, 0); int idxCampaign = SendDlgItemMessageA(hDlg, 1109, LB_GETITEMDATA, idxItem, 0); // set it ourselves R->EAX(idxCampaign); return 0x52ED2D; }
DEFINE_HOOK | ( | 52EC18 | , |
CampaignMenu_hDlg_PreHandleGeneral | , | ||
5 | |||
) |
{ GET(HWND, hDlg, ESI); GET(int, msg, EBX); GET(int, lParam, EBP); // catch the selection change event of the campaign list if(msg == WM_COMMAND) { int iID = LOWORD(lParam); int iCmd = HIWORD(lParam); if((iID == 1109) && (iCmd == LBN_SELCHANGE)) { int index = SendDlgItemMessageA(hDlg, 1109, LB_GETCURSEL, 0, 0); int idxCampaign = SendDlgItemMessageA(hDlg, 1109, LB_GETITEMDATA, index, 0); if(CampaignExt::lastSelectedCampaign != idxCampaign) { // play the hover sound CampaignExt::ExtData* pData = CampaignExt::Array.GetItem(idxCampaign); if(pData) { int idxSound = VocClass::FindIndex(pData->HoverSound); if(idxSound > -1) { VocClass::PlayGlobal(idxSound, 1.0f, 8192, 0); } // set the summary text if(HWND hSovLabel = GetDlgItem(hDlg, 1960)) { const wchar_t* summary = NULL; if(*pData->Summary) { summary = StringTable::LoadStringA(pData->Summary); } SendMessageA(hSovLabel, 0x4B2, 0, (LPARAM)summary); } } // cache the selected index CampaignExt::lastSelectedCampaign = idxCampaign; } // enable the play button if(HWND hItem = GetDlgItem(hDlg, 1038)) { EnableWindow(hItem, (index >= 0)); } } } return 0; }
DEFINE_HOOK | ( | 52F00B | , |
CampaignMenu_hDlg_PopulateCampaignList | , | ||
5 | |||
) |
{ GET(HWND, hDlg, ESI); GET(HWND, hList, EBP); // use button selection screen? if(!Ares::UISettings::CampaignList) { return 0; } // fill in the campaigns list for(int i=0; i<CampaignExt::Array.Count; ++i) { CampaignExt::ExtData *pData = CampaignExt::Array.GetItem(i); if(pData && pData->isVisible()) { int newIndex = SendMessageA(hList, 0x4CD, 0, (WPARAM)pData->AttachedToObject->Description); SendMessageA(hList, LB_SETITEMDATA, newIndex, i); } } // disable the play button as there is nothing selected. we don't select // the first campaign here so the user will get the introduction sound. if(HWND hItem = GetDlgItem(hDlg, 1038)) { EnableWindow(hItem, false); } return 0x52F07F; }
DEFINE_HOOK | ( | 52D809 | , |
MoviesAndCredits_hDlg_ViewCreditsButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::ViewCreditsButton, "VIEWCREDITSBUTTON", pAction, 4) ? 0x52D80F : 0); }
DEFINE_HOOK | ( | 52D7FB | , |
MoviesAndCredits_hDlg_PlayMoviesButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::PlayMoviesButton, "PLAYMOVIESBUTTON", pAction, 4) ? 0x52D801 : 0); }
DEFINE_HOOK | ( | 52D7ED | , |
MoviesAndCredits_hDlg_SneakPeeksButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::SneakPeeksButton, "SNEAKPEEKSBUTTON", pAction, 4) ? 0x52D7F3 : 0); }
DEFINE_HOOK | ( | 52D713 | , |
SinglePlayer_hDlg_SkirmishButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::SkirmishButton, "SKIRMISHBUTTON", pAction, 1) ? 0x52D719 : 0); }
DEFINE_HOOK | ( | 52D724 | , |
SinglePlayer_hDlg_CampaignButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::CampaignButton, "CAMPAIGNBUTTON", pAction, 1) ? 0x52D72A : 0); }
DEFINE_HOOK | ( | 5320AE | , |
Main_hDlg_MoviesAndCreditsButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::MoviesAndCreditsButton, "MOVIESANDCREDITSBUTTON", pAction, 18) ? 0x5320B4 : 0); }
DEFINE_HOOK | ( | 532051 | , |
Main_hDlg_NetworkButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::NetworkButton, "NETWORKBUTTON", pAction, 18) ? 0x532057 : 0); }
DEFINE_HOOK | ( | 5320C2 | , |
Main_hDlg_WWOnlineButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::WWOnlineButton, "WWONLINEBUTTON", pAction, 18) ? 0x5320C8 : 0); }
DEFINE_HOOK | ( | 53208D | , |
Main_hDlg_SinglePlayerButtonClick | , | ||
6 | |||
) |
{ GET(int*, pAction, EAX); return (Interface::invokeClickAction(Ares::UISettings::SinglePlayerButton, "SINGLEPLAYERBUTTON", pAction, 18) ? 0x532093 : 0); }
DEFINE_HOOK | ( | 52E446 | , |
Frontend_WndProc_JustAfterAction | , | ||
6 | |||
) |
{ GET(int, thisAction, ESI); if((Interface::nextAction != thisAction) && (Interface::nextReturnMenu >= 0)) { R->ESI(Interface::nextReturnMenu); Interface::nextReturnMenu = -1; } return 0; }
DEFINE_HOOK | ( | 52DDBA | , |
Frontend_WndProc_MessageBox | , | ||
5 | |||
) |
{ if(Interface::nextMessageText) { const wchar_t* ok = StringTable::LoadStringA("TXT_OK"); MessageBox::Show(Interface::nextMessageText, ok, NULL); Interface::nextMessageText = NULL; return 0x52DE39; } return 0; }
DEFINE_HOOK | ( | 6226EE | , |
Dialog_Show_UpdateControls | , | ||
6 | |||
) |
{ GET(HWND, hDlg, ESI); Interface::updateMenu(hDlg); return 0; }