Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclusive SuperWeapon Sidebar #1384

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
99358b3
first commit
NetsuNegi Sep 18, 2024
54ec5e9
Rebase
ZivDero Sep 25, 2024
070450d
Add SWSidebarClass
NetsuNegi Sep 26, 2024
d2cb60d
what
NetsuNegi Sep 26, 2024
6de7e13
Update SWSidebarClass.cpp
NetsuNegi Sep 26, 2024
137cb4b
Add tags
NetsuNegi Sep 26, 2024
f065885
Move some hooks
NetsuNegi Sep 26, 2024
fee49a9
implement draw background and single column
NetsuNegi Sep 26, 2024
be3ad52
Add hotkey to fire SW
NetsuNegi Sep 26, 2024
263b2ef
Update FireTacticalSW.h
NetsuNegi Sep 26, 2024
4a21edc
Merge branch 'develop' into origin/branch/exclusive-sw-sidebar
NetsuNegi Sep 26, 2024
57aa56a
Update docs
NetsuNegi Sep 26, 2024
e25a370
Merge branch 'origin/branch/exclusive-sw-sidebar' of https://github.c…
NetsuNegi Sep 26, 2024
de6ece6
remove useless picture
NetsuNegi Sep 26, 2024
0b25cc9
limit cameos
NetsuNegi Sep 26, 2024
06a0777
Restore pyramid shaped arrangement
NetsuNegi Sep 27, 2024
8883505
fix error
NetsuNegi Sep 27, 2024
f3462d1
refactor code
NetsuNegi Sep 27, 2024
ba5a4da
Remove `ExclusiveSWSidebarBackground`
NetsuNegi Sep 27, 2024
8504b2f
Update SWSidebarClass.cpp
NetsuNegi Sep 27, 2024
18be905
Update SWSidebarClass.cpp
NetsuNegi Sep 27, 2024
70173ca
it should can S/L now
NetsuNegi Sep 28, 2024
aa807d7
Add toggle button
NetsuNegi Sep 29, 2024
6a5f2b9
finish
NetsuNegi Sep 29, 2024
72f9223
Update SWSidebarClass.cpp
NetsuNegi Sep 29, 2024
80553b2
Adjust SW cameo draw sequence
NetsuNegi Sep 29, 2024
f7a9937
finish toggle SW sidebar button
NetsuNegi Sep 29, 2024
436dad6
update docs
NetsuNegi Sep 29, 2024
617692c
Update FireTacticalSW.h
NetsuNegi Sep 30, 2024
4e53ca8
Update User-Interface.md
NetsuNegi Oct 1, 2024
a21cf0a
fixes
NetsuNegi Oct 1, 2024
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
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ This page lists all the individual contributions to the project by their author.
- Disguised units not using the correct palette if target has custom palette bugfix
- Tunnel/Walk/Mech locomotor being stuck when moving too fast bugfix
- Assign Super Weapon cameo to any sidebar tab
- Exclusive SuperWeapon Sidebar
- **Apollo** - Translucent SHP drawing patches
- **ststl**
- Customizable ShowTimer priority of superweapons
Expand Down Expand Up @@ -359,6 +360,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 SuperWeapon Sidebar
- **Ollerus**
- Build limit group enhancement
- Customizable rocker amplitude
Expand Down
9 changes: 9 additions & 0 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Commands\ToggleSWSidebar.cpp" />
<ClCompile Include="src\Ext\Sidebar\SWSidebar\SWColumnClass.cpp" />
<ClCompile Include="src\Ext\Sidebar\SWSidebar\SWSidebarClass.cpp" />
<ClCompile Include="src\Ext\Sidebar\SWSidebar\TacticalButtonClass.cpp" />
<ClCompile Include="src\Ext\Techno\Hooks.Cloak.cpp" />
<ClCompile Include="src\New\Entity\AttachEffectClass.cpp" />
<ClCompile Include="src\New\Type\AttachEffectTypeClass.cpp" />
Expand Down Expand Up @@ -182,6 +186,11 @@
<ClCompile Include="YRpp\StaticInits.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Commands\FireTacticalSW.h" />
<ClInclude Include="src\Commands\ToggleSWSidebar.h" />
<ClInclude Include="src\Ext\Sidebar\SWSidebar\SWColumnClass.h" />
<ClInclude Include="src\Ext\Sidebar\SWSidebar\SWSidebarClass.h" />
<ClInclude Include="src\Ext\Sidebar\SWSidebar\TacticalButtonClass.h" />
<ClInclude Include="src\New\Entity\AttachEffectClass.h" />
<ClInclude Include="src\New\Type\AttachEffectTypeClass.h" />
<ClInclude Include="src\Commands\FrameByFrame.h" />
Expand Down
2 changes: 1 addition & 1 deletion YRpp
Submodule YRpp updated 2 files
+2 −0 FileSystem.h
+1 −1 TiberiumClass.h
35 changes: 34 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 @@ -553,6 +553,39 @@ In `RA2MD.ini`:
[Phobos]
ToolTipBlur=false ; boolean, whether the blur effect of tooltips will be enabled.
```

### Exclusive SuperWeapon Sidebar

- It is possible to put sw cameos on the left of screen like C&C3 when `ExclusiveSuperWeaponSidebar` is true.
- In theory, it should be compatible with Ares
- Cameos arranged in a pyramid shape.
- `ExclusiveSWSidebar.Interval` specific how many leptons between two columns.
- `ExclusiveSuperWeaponSidebar.Max` controls the maximum number of icons on the leftmost side, which also depends on the current game resolution.
- `ExclusiveSWSidebar.MaxColumn` controls that maximum count of columns.
- You can also launch first 10 SW by hotkey.

In `uimd.ini`:
```ini
[Sidebar]
ExclusiveSWSidebar=false ; boolean
ExclusiveSWSidebar.Interval=0 ; integer
ExclusiveSWSidebar.Max=0 ; integer
ExclusiveSWSidebar.MaxColumn= ; integer
```

In `rulesmd.ini`
```ini
[SOMESIDE]
ExclusiveSWSidebar.TopPCX= ; filename - including the .pcx extension
ExclusiveSWSidebar.CenterPCX= ; filename - including the .pcx extension
ExclusiveSWSidebar.BottomPCX= ; filename - including the .pcx extension
ExclusiveSWSidebar.ToggleShape= ; filename - including the .shp extension

[SOMESW]
AllowInExclusiveSidebar=true ; boolean
ExclusiveSidebar.PriorityHouses= ; list of house types
ExclusiveSidebar.RequiredHouses= ; list of house types
```
## Miscellanous

### Skip saving game on starting a new campaign
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ New:
- `FireOnce` infantry sequence reset toggle (by Starkku)
- Assign Super Weapon cameo to any sidebar tab (by NetsuNegi)
- Customizing effect of level lighting on air units (by Starkku)
- Exclusive SuperWeapon Sidebar (by NetsuNegi & CrimRecya)

Vanilla fixes:
- Allow AI to repair structures built from base nodes/trigger action 125/SW delivery in single player missions (by Trsdy)
Expand Down
14 changes: 14 additions & 0 deletions src/Commands/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "ToggleDigitalDisplay.h"
#include "ToggleDesignatorRange.h"
#include "SaveVariablesToFile.h"
#include "ToggleSWSidebar.h"
#include "FireTacticalSW.h"

DEFINE_HOOK(0x533066, CommandClassCallback_Register, 0x6)
{
Expand All @@ -19,6 +21,18 @@ DEFINE_HOOK(0x533066, CommandClassCallback_Register, 0x6)
MakeCommand<QuickSaveCommandClass>();
MakeCommand<ToggleDigitalDisplayCommandClass>();
MakeCommand<ToggleDesignatorRangeCommandClass>();
MakeCommand<ToggleSWSidebar>();

MakeCommand<FireTacticalSWCommandClass<0>>();
MakeCommand<FireTacticalSWCommandClass<1>>();
MakeCommand<FireTacticalSWCommandClass<2>>();
MakeCommand<FireTacticalSWCommandClass<3>>();
MakeCommand<FireTacticalSWCommandClass<4>>();
MakeCommand<FireTacticalSWCommandClass<5>>();
MakeCommand<FireTacticalSWCommandClass<6>>();
MakeCommand<FireTacticalSWCommandClass<7>>();
MakeCommand<FireTacticalSWCommandClass<8>>();
MakeCommand<FireTacticalSWCommandClass<9>>();
Comment on lines +24 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enough for commands to appear in the settings and save/load in/from keyboard.ini. Why the other fluff?


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

#include <Ext/Sidebar/Body.h>
#include <Ext/Sidebar/SWSidebar/SWSidebarClass.h>

template<size_t Index>
class FireTacticalSWCommandClass : 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 Index>
inline const char* FireTacticalSWCommandClass<Index>::GetName() const
{
_snprintf_s(Phobos::readBuffer, Phobos::readLength, "FireTacticalSW%d", Index);
return Phobos::readBuffer;
}

template<size_t Index>
inline const wchar_t* FireTacticalSWCommandClass<Index>::GetUIName() const
{
_snwprintf_s(Phobos::wideBuffer, Phobos::readLength, L"Fire Super Weapon %d", Index);
return StringTable::TryFetchString("TXT_FIRE_TACTICAL_SW_XX", Phobos::wideBuffer);
}

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

template<size_t Index>
inline const wchar_t* FireTacticalSWCommandClass<Index>::GetUIDescription() const
{
_snwprintf_s(Phobos::wideBuffer, Phobos::readLength, L"Fires Super Weapon %d.", Index);
return StringTable::TryFetchString("TXT_FIRE_TACTICAL_SW_XX_DESC", Phobos::wideBuffer);
}

template<size_t Index>
inline void FireTacticalSWCommandClass<Index>::Execute(WWKey eInput) const
{
if (!SWSidebarClass::IsEnabled())
return;

const auto& columns = SWSidebarClass::Global()->Columns;

if (columns.empty())
return;

const auto& buttons = columns.front()->Buttons;

if (buttons.size() > Index)
buttons[Index]->LaunchSuper();
}
38 changes: 38 additions & 0 deletions src/Commands/ToggleSWSidebar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "ToggleSWSidebar.h"
#include <HouseClass.h>

#include <Utilities/GeneralUtils.h>
#include <Ext/Sidebar/SWSidebar/SWSidebarClass.h>

const char* ToggleSWSidebar::GetName() const
{
return "Toggle Super Weapon Sidebar";
}

const wchar_t* ToggleSWSidebar::GetUIName() const
{
return GeneralUtils::LoadStringUnlessMissing("TXT_TOGGLE_SW_SIDEBAR", L"Toggle Super Weapon Sidebar");
}

const wchar_t* ToggleSWSidebar::GetUICategory() const
{
return CATEGORY_INTERFACE;
}

const wchar_t* ToggleSWSidebar::GetUIDescription() const
{
return GeneralUtils::LoadStringUnlessMissing("TXT_TOGGLE_SW_SIDEBAR_DESC", L"Toggle the Super Weapon Sidebar.");
}

void ToggleSWSidebar::Execute(WWKey eInput) const
{
ToggleSWButtonClass::SwitchSidebar();

if (SidebarExt::Global()->SWSidebar_Enable)
MessageListClass::Instance->PrintMessage(GeneralUtils::LoadStringUnlessMissing("TXT_EX_SW_SIDEBAR_ENABLE", L"Super Weapon Sidebar Enabled."), RulesClass::Instance->MessageDelay, HouseClass::CurrentPlayer->ColorSchemeIndex, true);
else
MessageListClass::Instance->PrintMessage(GeneralUtils::LoadStringUnlessMissing("TXT_EX_SW_SIDEBAR_DISABLE", L"Super Weapon Sidebar Disabled."), RulesClass::Instance->MessageDelay, HouseClass::CurrentPlayer->ColorSchemeIndex, true);

if (SWSidebarClass::Global()->CurrentColumn)
MouseClass::Instance->UpdateCursor(MouseCursorType::Default, false);
}
14 changes: 14 additions & 0 deletions src/Commands/ToggleSWSidebar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "Commands.h"

// Display damage strings
class ToggleSWSidebar : public CommandClass
{
public:
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;
};
2 changes: 1 addition & 1 deletion src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class RulesExt

Valueable<double> AircraftLevelLightMultiplier;
Valueable<double> JumpjetLevelLightMultiplier;

Nullable<Vector3D<float>> VoxelLightSource;
// Nullable<Vector3D<float>> VoxelShadowLightSource;
Valueable<bool> UseFixedVoxelLighting;
Expand Down
44 changes: 44 additions & 0 deletions src/Ext/SWType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ void SWTypeExt::ExtData::Serialize(T& Stm)
{
Stm
.Process(this->Money_Amount)
.Process(this->EVA_Impatient)
.Process(this->EVA_InsufficientFunds)
.Process(this->EVA_SelectTarget)
.Process(this->SW_UseAITargeting)
.Process(this->SW_AutoFire)
.Process(this->SW_ManualFire)
.Process(this->SW_ShowCameo)
.Process(this->SW_Unstoppable)
.Process(this->SW_Inhibitors)
.Process(this->SW_AnyInhibitor)
.Process(this->SW_Designators)
Expand All @@ -24,6 +32,10 @@ void SWTypeExt::ExtData::Serialize(T& Stm)
.Process(this->SW_NegBuildings)
.Process(this->SW_InitialReady)
.Process(this->SW_PostDependent)
.Process(this->Message_CannotFire)
.Process(this->Message_InsufficientFunds)
.Process(this->Message_ColorScheme)
.Process(this->Message_FirerColor)
.Process(this->UIDescription)
.Process(this->CameoPriority)
.Process(this->LimboDelivery_Types)
Expand All @@ -48,6 +60,11 @@ void SWTypeExt::ExtData::Serialize(T& Stm)
.Process(this->Convert_Pairs)
.Process(this->ShowDesignatorRange)
.Process(this->TabIndex)
.Process(this->ExclusiveSidebar_Allow)
.Process(this->ExclusiveSidebar_PriorityHouses)
.Process(this->ExclusiveSidebar_RequiredHouses)
.Process(this->SidebarPal)
.Process(this->SidebarPCX)
.Process(this->UseWeeds)
.Process(this->UseWeeds_Amount)
.Process(this->UseWeeds_StorageTimer)
Expand All @@ -69,6 +86,14 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)

// from ares
this->Money_Amount.Read(exINI, pSection, "Money.Amount");
this->EVA_Impatient.Read(exINI, pSection, "EVA.Impatient");
this->EVA_InsufficientFunds.Read(exINI, pSection, "EVA.InsufficientFunds");
this->EVA_SelectTarget.Read(exINI, pSection, "EVA.SelectTarget");
this->SW_UseAITargeting.Read(exINI, pSection, "SW.UseAITargeting");
this->SW_AutoFire.Read(exINI, pSection, "SW.AutoFire");
this->SW_ManualFire.Read(exINI, pSection, "SW.ManualFire");
this->SW_ShowCameo.Read(exINI, pSection, "SW.ShowCameo");
this->SW_Unstoppable.Read(exINI, pSection, "SW.Unstoppable");
this->SW_Inhibitors.Read(exINI, pSection, "SW.Inhibitors");
this->SW_AnyInhibitor.Read(exINI, pSection, "SW.AnyInhibitor");
this->SW_Designators.Read(exINI, pSection, "SW.Designators");
Expand All @@ -82,6 +107,18 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->SW_InitialReady.Read(exINI, pSection, "SW.InitialReady");
this->SW_PostDependent.Read(exINI, pSection, "SW.PostDependent");

this->Message_CannotFire.Read(exINI, pSection, "Message.CannotFire");
this->Message_InsufficientFunds.Read(exINI, pSection, "Message.InsufficientFunds");

// messages and their properties
this->Message_FirerColor.Read(exINI, pSection, "Message.FirerColor");
if (pINI->ReadString(pSection, "Message.Color", NONE_STR, Phobos::readBuffer))
{
this->Message_ColorScheme = ColorScheme::FindIndex(Phobos::readBuffer);
if (this->Message_ColorScheme < 0)
Debug::INIParseFailed(pSection, "Message.Color", Phobos::readBuffer, "Expected a valid color scheme name.");
}

this->UIDescription.Read(exINI, pSection, "UIDescription");
this->CameoPriority.Read(exINI, pSection, "CameoPriority");
this->LimboDelivery_Types.Read(exINI, pSection, "LimboDelivery.Types");
Expand Down Expand Up @@ -163,6 +200,13 @@ void SWTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)

this->TabIndex.Read(exINI, pSection, "TabIndex");
GeneralUtils::IntValidCheck(&this->TabIndex, pSection, "TabIndex", 1, 0, 3);

this->ExclusiveSidebar_Allow.Read(exINI, pSection, "ExclusiveSidebar.Allow");
this->ExclusiveSidebar_PriorityHouses = pINI->ReadHouseTypesList(pSection, "ExclusiveSidebar.PriorityHouses", this->ExclusiveSidebar_PriorityHouses);
this->ExclusiveSidebar_RequiredHouses = pINI->ReadHouseTypesList(pSection, "ExclusiveSidebar.RequiredHouses", this->ExclusiveSidebar_RequiredHouses);

this->SidebarPal.LoadFromINI(pINI, pSection, "SidebarPalette");
this->SidebarPCX.Read(pINI, pSection, "SidebarPCX");

this->UseWeeds.Read(exINI, pSection, "UseWeeds");
this->UseWeeds_Amount.Read(exINI, pSection, "UseWeeds.Amount");
Expand Down
Loading
Loading