Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ This page lists all the individual contributions to the project by their author.
- Allow to change the speed of gas particles
- **CrimRecya**
- Fix `LimboKill` not working reliably
- Exclusive Sidebar for Superweapons
- **Ollerus**
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
4 changes: 4 additions & 0 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
<ClCompile Include="src\Utilities\AresHelper.cpp" />
<ClCompile Include="src\Utilities\AresAddressTable.cpp" />
<ClCompile Include="src\Misc\SyncLogging.cpp" />
<ClCompile Include="src\Misc\TacticalButtons.cpp" />
<ClCompile Include="src\Commands\SWShortcuts.cpp" />
<ClCompile Include="YRpp\StaticInits.cpp" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -272,6 +274,8 @@
<ClInclude Include="src\Utilities\AresHelper.h" />
<ClInclude Include="src\Utilities\AresFunctions.h" />
<ClInclude Include="lib\nameof\nameof.h" />
<ClInclude Include="src\Misc\TacticalButtons.h" />
<ClInclude Include="src\Commands\SWShortcuts.h" />
<ClInclude Include="YRpp\GameTextManager.h" />
</ItemGroup>
<ItemGroup>
Expand Down
44 changes: 43 additions & 1 deletion docs/User-Interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ IngameScore.LoseTheme= ; Soundtrack theme ID
- Default `Offset.ShieldDelta` for `InfoType=Shield` is `0,-10`, `0,0` for others.
- Default `Shape.Spacing` for buildings is `4,-2`, `4,0` for others.
- `ValueScaleDivisor` can be used to adjust scale of displayed values. Both the current & maximum value will be divided by the integer number given, if higher than 1.

In `rulesmd.ini`:
```ini
[DigitalDisplayTypes]
Expand Down Expand Up @@ -294,6 +294,12 @@ SelectionFlashDuration=0 ; integer, number of frames
- Switches on/off [frame by frame mode](Miscellanous.html#frame-step-in).
- For localization add `TXT_FRAME_BY_FRAME` and `TXT_FRAME_BY_FRAME_DESC` into your `.csf` file.

### `[ ]` Exclusive SW Sidebar Shortcuts
- Switches visible/invisible [this](#Exclusive-sidebar-for-superweapons).
- For localization add `TXT_EX_SW_SWITCH` and `TXT_EX_SW_SWITCH_DESC` into your `.csf` file.
- And Select the SWs in this exclusive sidebar.
- For localization add `TXT_EX_SW_BUTTON_XX` and `TXT_EX_SW_BUTTON_XX_DESC` into your `.csf` file. (`XX` -> `03`, `10` .etc)

## Loading screen

- PCX files can now be used as loadscreen images.
Expand Down Expand Up @@ -344,6 +350,42 @@ In `rulesmd.ini`:
MissingCameo=XXICON.SHP ; filename - including the .shp/.pcx extension
```

### Exclusive sidebar for superweapons

- Now, you can display a sidebar exclusive to superweapons through a series of settings. At the same time, you can specify the shortcuts for these buttons in the shortcut key settings.
- `SWSidebarBackground` controls whether to draw the background shape of the exclusive sidebar.
- `SWSidebarBackground.OnPCX` and `SWSidebarBackground.OffPCX` controlled the shapes of this exclusive sidebar's switch displaying, respectively used in non-hidden and hidden. Required sizes are all `10 * 50`.
- `SWSidebarBackground.TopPCX`, `SWSidebarBackground.CenterPCX` and `SWSidebarBackground.BottomPCX` controlled the materials that were combined to create the entire exclusive sidebar background shape. Their required sizes are respectively `80 * 20`, `80 * 50` and `80 * 20`. In `SWSidebarBackground.CenterPCX`, the position of the superweapon's `SidebarPCX` is 5 pixels away from the left contour of this background, 15 pixels away from the right contour, and 1 pixel away from both the upper and lower contours.
- `SW.InScreen.Show` controls whether the superweapon should be displayed first in the exclusive sidebar. If the exclusive sidebar is full (up to 10 are displayed), the overflowing superweapon's cameo will be added back to the original sidebar. If there is an empty space in the exclusive sidebar afterwards, it will no longer return to the exclusive sidebar, unless the permission to use the superweapon is regained (lost and gained again). Therefore, it is not recommended to place all superweapons in the exclusive sidebar.
- `SW.InScreen.PriorityHouses` controls if the superweapon is displayed first in the exclusive sidebar, players belonging to these houses will have priority in placing the superweapon cameo in the exclusive sidebar.
- `SW.InScreen.RequiredHouses` controls if the superweapon is displayed first in the exclusive sidebar, players must belong to these houses in order to have superweapon a real chance of being displayed in the exclusive sidebar. The default is empty, which means this condition will always be met.
- `SW.QuickFireAtMouse` controls whether the superweapon which is command by keyboards will forcibly launch to the mouse position without all Ares conditions check except charging and funds. If the mouse is not in the tactical map now, the superweapon will launch like `SW.QuickFireInScreen=true` do.
- `SW.QuickFireInScreen` controls whether the superweapon will forcibly launch to the center position of the current screen without all Ares conditions check except charging and funds.

In `rulesmd.ini`:
```ini
[AudioVisual]
SWSidebarBackground=true ; boolean

[SOMESIDE] ; Side
SWSidebarBackground.OnPCX= ; filename - including the .pcx extension
SWSidebarBackground.OffPCX= ; filename - including the .pcx extension
SWSidebarBackground.TopPCX= ; filename - including the .pcx extension
SWSidebarBackground.CenterPCX= ; filename - including the .pcx extension
SWSidebarBackground.BottomPCX= ; filename - including the .pcx extension

[SOMESW] ; SuperWeapon
SW.InScreen.Show=false ; boolean
SW.InScreen.PriorityHouses= ; list of house types
SW.InScreen.RequiredHouses= ; list of house types
SW.QuickFireAtMouse=false ; boolean
SW.QuickFireInScreen=false ; boolean
```

```{note}
If you want to change the printing message of switch on/off, for localization add `TXT_EX_SW_BAR_VISIBLE` and `TXT_EX_SW_BAR_INVISIBLE` into your `.csf` file.
```

### Harvester counter

![image](_static/images/harvestercounter-01.gif)
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ New:
- Forbidding parallel AI queues for specific TechnoTypes (by Starkku)
- Nonprovocative Warheads (by Starkku)
- Option to restore `PowerSurplus` setting for AI (by Starkku)
- Exclusive Sidebar for Superweapons (by CrimRecya)
- `FireOnce` infantry sequence reset toggle (by Starkku)

Vanilla fixes:
Expand Down
12 changes: 12 additions & 0 deletions src/Commands/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ToggleDigitalDisplay.h"
#include "ToggleDesignatorRange.h"
#include "SaveVariablesToFile.h"
#include "SWShortcuts.h"

DEFINE_HOOK(0x533066, CommandClassCallback_Register, 0x6)
{
Expand All @@ -19,6 +20,17 @@ DEFINE_HOOK(0x533066, CommandClassCallback_Register, 0x6)
MakeCommand<QuickSaveCommandClass>();
MakeCommand<ToggleDigitalDisplayCommandClass>();
MakeCommand<ToggleDesignatorRangeCommandClass>();
MakeCommand<SWShortcutsCommandClass<0>>();
MakeCommand<SWShortcutsCommandClass<1>>();
MakeCommand<SWShortcutsCommandClass<2>>();
MakeCommand<SWShortcutsCommandClass<3>>();
MakeCommand<SWShortcutsCommandClass<4>>();
MakeCommand<SWShortcutsCommandClass<5>>();
MakeCommand<SWShortcutsCommandClass<6>>();
MakeCommand<SWShortcutsCommandClass<7>>();
MakeCommand<SWShortcutsCommandClass<8>>();
MakeCommand<SWShortcutsCommandClass<9>>();
MakeCommand<SWShortcutsCommandClass<10>>();

if (Phobos::Config::DevelopmentCommands)
{
Expand Down
1 change: 1 addition & 0 deletions src/Commands/SWShortcuts.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "SWShortcuts.h"
79 changes: 79 additions & 0 deletions src/Commands/SWShortcuts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#pragma once

#include "Commands.h"

#include <Utilities/GeneralUtils.h>
#include <Misc/TacticalButtons.h>

// Super Weapon Sidebar Keyboard shortcut command class
constexpr const char* ShortcutNames[11] = { "SW Sidebar Display",
"SW Sidebar Shortcuts Num 01", "SW Sidebar Shortcuts Num 02", "SW Sidebar Shortcuts Num 03",
"SW Sidebar Shortcuts Num 04", "SW Sidebar Shortcuts Num 05", "SW Sidebar Shortcuts Num 06",
"SW Sidebar Shortcuts Num 07", "SW Sidebar Shortcuts Num 08", "SW Sidebar Shortcuts Num 09",
"SW Sidebar Shortcuts Num 10" };
constexpr const char* ShortcutUINamesTXT[11] = { "TXT_EX_SW_SWITCH",
"TXT_EX_SW_BUTTON_01", "TXT_EX_SW_BUTTON_02", "TXT_EX_SW_BUTTON_03", "TXT_EX_SW_BUTTON_04", "TXT_EX_SW_BUTTON_05",
"TXT_EX_SW_BUTTON_06", "TXT_EX_SW_BUTTON_07", "TXT_EX_SW_BUTTON_08", "TXT_EX_SW_BUTTON_09", "TXT_EX_SW_BUTTON_10" };
constexpr const wchar_t* ShortcutUINames[11] = { L"SW sidebar display",
L"Quick Select SW 01", L"Quick Select SW 02", L"Quick Select SW 03", L"Quick Select SW 04", L"Quick Select SW 05",
L"Quick Select SW 06", L"Quick Select SW 07", L"Quick Select SW 08", L"Quick Select SW 09", L"Quick Select SW 10" };
constexpr const char* ShortcutUIDescriptionsTXT[11] = { "TXT_EX_SW_SWITCH_DESC",
"TXT_EX_SW_BUTTON_01_DESC", "TXT_EX_SW_BUTTON_02_DESC", "TXT_EX_SW_BUTTON_03_DESC",
"TXT_EX_SW_BUTTON_04_DESC", "TXT_EX_SW_BUTTON_05_DESC", "TXT_EX_SW_BUTTON_06_DESC",
"TXT_EX_SW_BUTTON_07_DESC", "TXT_EX_SW_BUTTON_08_DESC", "TXT_EX_SW_BUTTON_09_DESC",
"TXT_EX_SW_BUTTON_10_DESC" };
constexpr const wchar_t* ShortcutUIDescriptions[11] = {
L"Switch between visible/invisible modes for exclusive SW sidebar",
L"Select No.01 SW in left sidebar", L"Select No.02 SW in left sidebar", L"Select No.03 SW in left sidebar",
L"Select No.04 SW in left sidebar", L"Select No.05 SW in left sidebar", L"Select No.06 SW in left sidebar",
L"Select No.07 SW in left sidebar", L"Select No.08 SW in left sidebar", L"Select No.09 SW in left sidebar",
L"Select No.10 SW in left sidebar"};

template<size_t KeyIndex>
class SWShortcutsCommandClass : public CommandClass
{
public:
// CommandClass
virtual const char* GetName() const override;
virtual const wchar_t* GetUIName() const override;
virtual const wchar_t* GetUICategory() const override;
virtual const wchar_t* GetUIDescription() const override;
virtual void Execute(WWKey eInput) const override;
};

template<size_t KeyIndex>
inline const char* SWShortcutsCommandClass<KeyIndex>::GetName() const
{
return ShortcutNames[KeyIndex];
}

template<size_t KeyIndex>
inline const wchar_t* SWShortcutsCommandClass<KeyIndex>::GetUIName() const
{
return GeneralUtils::LoadStringUnlessMissing(ShortcutUINamesTXT[KeyIndex], ShortcutUINames[KeyIndex]);
}

template<size_t KeyIndex>
inline const wchar_t* SWShortcutsCommandClass<KeyIndex>::GetUICategory() const
{
return CATEGORY_CONTROL;
}

template<size_t KeyIndex>
inline const wchar_t* SWShortcutsCommandClass<KeyIndex>::GetUIDescription() const
{
return GeneralUtils::LoadStringUnlessMissing(ShortcutUIDescriptionsTXT[KeyIndex], ShortcutUIDescriptions[KeyIndex]);
}

template<size_t KeyIndex>
inline void SWShortcutsCommandClass<KeyIndex>::Execute(WWKey eInput) const
{
if (KeyIndex > 0)
{
TacticalButtonsClass::Instance.KeyboardCall = true;
TacticalButtonsClass::Instance.SWSidebarTrigger(KeyIndex);
return;
}

TacticalButtonsClass::Instance.SWSidebarSwitch();
}
3 changes: 3 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->Vehicles_DefaultDigitalDisplayTypes.Read(exINI, GameStrings::AudioVisual, "Vehicles.DefaultDigitalDisplayTypes");
this->Aircraft_DefaultDigitalDisplayTypes.Read(exINI, GameStrings::AudioVisual, "Aircraft.DefaultDigitalDisplayTypes");

this->SWSidebarBackground.Read(exINI, GameStrings::AudioVisual, "SWSidebarBackground");

this->VoxelLightSource.Read(exINI, GameStrings::AudioVisual, "VoxelLightSource");
// this->VoxelShadowLightSource.Read(exINI, GameStrings::AudioVisual, "VoxelShadowLightSource");

Expand Down Expand Up @@ -360,6 +362,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->ShowDesignatorRange)
.Process(this->DropPodTrailer)
.Process(this->PodImage)
.Process(this->SWSidebarBackground)
.Process(this->VoxelLightSource)
// .Process(this->VoxelShadowLightSource)
.Process(this->UseFixedVoxelLighting)
Expand Down
3 changes: 3 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class RulesExt
Valueable<AnimTypeClass*> Promote_VeteranAnimation;
Valueable<AnimTypeClass*> Promote_EliteAnimation;

Valueable<bool> SWSidebarBackground;

Nullable<Vector3D<float>> VoxelLightSource;
// Nullable<Vector3D<float>> VoxelShadowLightSource;
Valueable<bool> UseFixedVoxelLighting;
Expand Down Expand Up @@ -256,6 +258,7 @@ class RulesExt
, ShowDesignatorRange { true }
, DropPodTrailer { }
, PodImage { }
, SWSidebarBackground { true }
, VoxelLightSource { }
// , VoxelShadowLightSource { }
, UseFixedVoxelLighting { false }
Expand Down
15 changes: 15 additions & 0 deletions src/Ext/SWType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void SWTypeExt::ExtData::Serialize(T& Stm)
.Process(this->SW_NegBuildings)
.Process(this->SW_InitialReady)
.Process(this->SW_PostDependent)
.Process(this->SidebarPCX)
.Process(this->CameoPal)
.Process(this->UIDescription)
.Process(this->CameoPriority)
.Process(this->LimboDelivery_Types)
Expand All @@ -47,6 +49,11 @@ void SWTypeExt::ExtData::Serialize(T& Stm)
.Process(this->ShowTimer_Priority)
.Process(this->Convert_Pairs)
.Process(this->ShowDesignatorRange)
.Process(this->SW_QuickFireAtMouse)
.Process(this->SW_QuickFireInScreen)
.Process(this->SW_InScreen_Show)
.Process(this->SW_InScreen_PriorityHouses)
.Process(this->SW_InScreen_RequiredHouses)
.Process(this->UseWeeds)
.Process(this->UseWeeds_Amount)
.Process(this->UseWeeds_StorageTimer)
Expand Down Expand Up @@ -80,6 +87,8 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->SW_NegBuildings.Read(exINI, pSection, "SW.NegBuildings");
this->SW_InitialReady.Read(exINI, pSection, "SW.InitialReady");
this->SW_PostDependent.Read(exINI, pSection, "SW.PostDependent");
this->SidebarPCX.Read(pINI, pSection, "SidebarPCX");
this->CameoPal.LoadFromINI(pINI, pSection, "SidebarPalette");

this->UIDescription.Read(exINI, pSection, "UIDescription");
this->CameoPriority.Read(exINI, pSection, "CameoPriority");
Expand Down Expand Up @@ -160,6 +169,12 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)

this->ShowDesignatorRange.Read(exINI, pSection, "ShowDesignatorRange");

this->SW_QuickFireAtMouse.Read(exINI, pSection, "SW.QuickFireAtMouse");
this->SW_QuickFireInScreen.Read(exINI, pSection, "SW.QuickFireInScreen");
this->SW_InScreen_Show.Read(exINI, pSection, "SW.InScreen.Show");
this->SW_InScreen_PriorityHouses = pINI->ReadHouseTypesList(pSection, "SW.InScreen.PriorityHouses", this->SW_InScreen_PriorityHouses);
this->SW_InScreen_RequiredHouses = pINI->ReadHouseTypesList(pSection, "SW.InScreen.RequiredHouses", this->SW_InScreen_RequiredHouses);

this->UseWeeds.Read(exINI, pSection, "UseWeeds");
this->UseWeeds_Amount.Read(exINI, pSection, "UseWeeds.Amount");
this->UseWeeds_StorageTimer.Read(exINI, pSection, "UseWeeds.StorageTimer");
Expand Down
14 changes: 14 additions & 0 deletions src/Ext/SWType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class SWTypeExt
ValueableVector<BuildingTypeClass*> SW_NegBuildings;
Valueable<bool> SW_InitialReady;
ValueableIdx<SuperWeaponTypeClass> SW_PostDependent;
PhobosPCXFile SidebarPCX;
CustomPalette CameoPal;

Valueable<CSFText> UIDescription;
Valueable<int> CameoPriority;
Expand Down Expand Up @@ -65,6 +67,12 @@ class SWTypeExt

std::vector<TypeConvertGroup> Convert_Pairs;

Valueable<bool> SW_QuickFireAtMouse;
Valueable<bool> SW_QuickFireInScreen;
Valueable<bool> SW_InScreen_Show;
DWORD SW_InScreen_PriorityHouses;
DWORD SW_InScreen_RequiredHouses;

Valueable<bool> UseWeeds;
Valueable<int> UseWeeds_Amount;
Valueable<bool> UseWeeds_StorageTimer;
Expand All @@ -84,6 +92,7 @@ class SWTypeExt
, SW_NegBuildings {}
, SW_InitialReady { false }
, SW_PostDependent {}
, CameoPal {}
, UIDescription {}
, CameoPriority { 0 }
, LimboDelivery_Types {}
Expand All @@ -107,6 +116,11 @@ class SWTypeExt
, ShowTimer_Priority { 0 }
, Convert_Pairs {}
, ShowDesignatorRange { true }
, SW_QuickFireAtMouse { false }
, SW_QuickFireInScreen { false }
, SW_InScreen_Show { false }
, SW_InScreen_PriorityHouses { 0u }
, SW_InScreen_RequiredHouses { 0xFFFFFFFFu }
, UseWeeds { false }
, UseWeeds_Amount { RulesClass::Instance->WeedCapacity }
, UseWeeds_StorageTimer { false }
Expand Down
10 changes: 10 additions & 0 deletions src/Ext/Side/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ void SideExt::ExtData::LoadFromINIFile(CCINIClass* pINI)
this->ToolTip_Background_Opacity.Read(exINI, pSection, "ToolTip.Background.Opacity");
this->ToolTip_Background_BlurSize.Read(exINI, pSection, "ToolTip.Background.BlurSize");
this->BriefingTheme = pINI->ReadTheme(pSection, "BriefingTheme", this->BriefingTheme);
this->SWSidebarBackground_OnPCX.Read(pINI, pSection, "SWSidebarBackground.OnPCX");
this->SWSidebarBackground_OffPCX.Read(pINI, pSection, "SWSidebarBackground.OffPCX");
this->SWSidebarBackground_TopPCX.Read(pINI, pSection, "SWSidebarBackground.TopPCX");
this->SWSidebarBackground_CenterPCX.Read(pINI, pSection, "SWSidebarBackground.CenterPCX");
this->SWSidebarBackground_BottomPCX.Read(pINI, pSection, "SWSidebarBackground.BottomPCX");
}

// =============================
Expand Down Expand Up @@ -70,6 +75,11 @@ void SideExt::ExtData::Serialize(T& Stm)
.Process(this->IngameScore_WinTheme)
.Process(this->IngameScore_LoseTheme)
.Process(this->BriefingTheme)
.Process(this->SWSidebarBackground_OnPCX)
.Process(this->SWSidebarBackground_OffPCX)
.Process(this->SWSidebarBackground_TopPCX)
.Process(this->SWSidebarBackground_CenterPCX)
.Process(this->SWSidebarBackground_BottomPCX)
;
}

Expand Down
5 changes: 5 additions & 0 deletions src/Ext/Side/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ class SideExt
Nullable<int> ToolTip_Background_Opacity;
Nullable<float> ToolTip_Background_BlurSize;
Valueable<int> BriefingTheme;
PhobosPCXFile SWSidebarBackground_OnPCX;
PhobosPCXFile SWSidebarBackground_OffPCX;
PhobosPCXFile SWSidebarBackground_TopPCX;
PhobosPCXFile SWSidebarBackground_CenterPCX;
PhobosPCXFile SWSidebarBackground_BottomPCX;

ExtData(SideClass* OwnerObject) : Extension<SideClass>(OwnerObject)
, ArrayIndex { -1 }
Expand Down
21 changes: 21 additions & 0 deletions src/Misc/PhobosToolTip.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <Helpers/Macro.h>

#include "PhobosToolTip.h"
#include "TacticalButtons.h"

#include <AircraftClass.h>
#include <BuildingClass.h>
Expand Down Expand Up @@ -199,6 +200,26 @@ DEFINE_HOOK(0x6A9316, SidebarClass_StripClass_HelpText, 0x6)
return 0x6A93DE;
}

DEFINE_HOOK(0x4AE511, DisplayClass_GetToolTip_SkipTacticalTip, 0x5)
{
enum { UseButtonTip = 0x4AE5F8, SkipGameCode = 0x4AE69B };

const int buttonIndex = TacticalButtonsClass::Instance.GetButtonIndex();

if (buttonIndex < 0)
return 0;

if (!buttonIndex)
return SkipGameCode;

if (buttonIndex <= 10)
R->EAX(PhobosToolTip::Instance.GetBuffer());
else
R->EAX(0);

return UseButtonTip;
}

// TODO: reimplement CCToolTip::Draw2 completely

DEFINE_HOOK(0x478EE1, CCToolTip_Draw2_SetBuffer, 0x6)
Expand Down
Loading