Skip to content

Conversation

@CrimRecya
Copy link
Contributor

@CrimRecya CrimRecya commented Sep 15, 2024

  • 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:

[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

@github-actions
Copy link

github-actions bot commented Sep 15, 2024

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Fryone
Copy link
Contributor

Fryone commented Sep 15, 2024

I have 2 questions: is it scrollable and what's with Techno's positioned behind it?

@Metadorius
Copy link
Member

Does the custom stuff like floating numbers, digital display etc. get properly excluded from the SW sidebar?

@CrimRecya
Copy link
Contributor Author

No, it's not scrollable yet. At least not now.
This image should be able to illustrate the drawing well. It will be drawn after all map content is completed, before the several timers.
display

@Metadorius
Copy link
Member

I think you don't need scrolling though, you can just make the pyramid shape as it is in C&C3.

@Fryone
Copy link
Contributor

Fryone commented Sep 15, 2024

I'm just thinking about possibility of exploiting it to hide troops from enemy.

// universal functionality can be achieved. - CrimRecya

// It would be great if it could be modularized
// TODO TacticalButtonClass::TacticalButtonGroup::TacticalButton
Copy link
Contributor

Choose a reason for hiding this comment

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

It's cool to have this implemented from scratch, but please use the tools the game already has built in first.
I recommend that you inherit your button from ControlClass (it already has functions called when it's hovered on/off), and look at SelectClass to see how it should work in regards to the actual execution.

You can also refer to my code here:
https://github.com/Rampastring/Vinifera/blob/ceba7041a1c6a376a4733e1024e0b8adcd8abf7c/src/extensions/sidebar/sidebarext.h#L74

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the principle behind this. May I ask if every button is a ControlClass object

Copy link
Member

Choose a reason for hiding this comment

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

I think so. Not sure, maybe we even have the class for unit icons ingame even, I remember something like this being ingame.

// Button index 1-9 : Super weapons buttons
static void DrawButtonForSW();
static void RecheckButtonForSW();
static bool InsertButtonForSW(int& superIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Insert/Move seems redundant. You should do it closer to the way the sidebar does.

Have an vector of SW button data (maybe store their global type heap id as well?).
Then when time has come to update the sw list (something has been added/removed), add/remove to the vector, then just call sort on it.

// It would be great if it could be modularized
// TODO TacticalButtonClass::TacticalButtonGroup::TacticalButton

class TacticalButtonClass
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is SW_specific, then maybe SpecialAbilityButtonClass?
And then remove all the "ForSw" postfixed on function names

static bool CheckMouseOverBackground(const Point2D* pMousePosition);

public:
inline bool MouseOverButtons();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use ControlClass capabilities

Copy link
Member

@Metadorius Metadorius left a comment

Choose a reason for hiding this comment

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

  1. Are you currently able to have no new graphics apart from just the icons? Like them just floating on the side.
  2. It would be cool to be able to hide the superweapons that are displayed that way from the main sidebar tab, if that is not too much effort.
  3. The biggest nitpick here is what @ZivDero said about using an already existing class. You have done a great job of making it work, but I think inheriting from the existing class will cut down on a lot of code for this.

Comment on lines 38 to 39
int SuperWeaponButtonData[9];
int SuperWeaponButtonCount;
Copy link
Member

Choose a reason for hiding this comment

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

I think it will be good to replace this with a dynamic vector, and place any superweapons exceeding the size in a pyramid shape:
image

The hotkeys I think are fine to be made only for first 10 supers though.

@CrimRecya
Copy link
Contributor Author

At present, there is too little information known about ControlClass and SelectClass, and I cannot meet these requirement. I will close this PR.

@CrimRecya CrimRecya closed this Sep 16, 2024
@Metadorius
Copy link
Member

You don't need to close the PR. How can we help you figure it out? I've sent the IDA definitions of the relevant classes and vtable layouts, so you can insert them in IDA and read the codes.

@CrimRecya
Copy link
Contributor Author

cameo
Now supports SW.UseAITargeting and can be hidden. I won't redo it through SelectClass, for me, this is already a complete feature.

@CrimRecya CrimRecya reopened this Sep 19, 2024
@Speederovsky
Copy link

Speederovsky commented Sep 20, 2024

I only set one SW.InScreen.Show=yes on a major SW for a quick test so far, and what it seems to be doing (at least in a singleplayer mission test map) is: when it's not scrolled to the top of the Armory tab, it wants to launch the SW that is in the top-right corner just 1 row beyond the visible range (the first cameo on the right "hidden" by the sidebar tab buttons). Depending on how positioned your Armory tab is, it will want to launch a different SW.

The same thing happened for additionally defined SWs on the left side when I added 2 more: these cameos all wanted to launch the SW "hidden to the right" when Armory tab was not scrolled to the top. Game resolution was 1400x900 for this test, if it matters.

These new icons only want to launch the properly defined SW when the Armory tab is scrolled to the top.

EDIT: Oh, if my tab is set to something else than SWs and scrolled down, clicking on an icon on the left results in starting production of whatever object is "located/hidden" at the same spot rather than firing the intended SW.

@CrimRecya
Copy link
Contributor Author

I only set one SW.InScreen.Show=yes on a major SW for a quick test so far, and what it seems to be doing (at least in a singleplayer mission test map) is: when it's not scrolled to the top of the Armory tab, it wants to launch the SW that is in the top-right corner just 1 row beyond the visible range (the first cameo on the right "hidden" by the sidebar tab buttons). Depending on how positioned your Armory tab is, it will want to launch a different SW.

The same thing happened for additionally defined SWs on the left side when I added 2 more: these cameos all wanted to launch the SW "hidden to the right" when Armory tab was not scrolled to the top. Game resolution was 1400x900 for this test, if it matters.

These new icons only want to launch the properly defined SW when the Armory tab is scrolled to the top.

EDIT: Oh, if my tab is set to something else than SWs and scrolled down, clicking on an icon on the left results in starting production of whatever object is "located/hidden" at the same spot rather than firing the intended SW.

Thank you so much for your feedback. I think I have some preliminary ideas about this issue and I will fix it soon.

@Metadorius
Copy link
Member

@CrimRecya as you see we now have two pull requests open that implement the same feature.

From what I see, your pull request is more feature-rich but @NetsuNegi's pull request is based on YR's ControlClass, which is more preferable from the code standpoint, so both implementations have their strengths and weaknesses.

I suggest that you and @NetsuNegi cooperate and produce a unified pull request which would include the best work from you both. Maybe take his pull feature as a base and bring on all the nice features that your sidebar has, but ultimately that is up to you how you want to deal with this.

What do you think of this?

@Metadorius
Copy link
Member

For reference, I am talking about this PR if you haven't seen it: #1384

@CrimRecya
Copy link
Contributor Author

@CrimRecya as you see we now have two pull requests open that implement the same feature.

From what I see, your pull request is more feature-rich but @NetsuNegi's pull request is based on YR's ControlClass, which is more preferable from the code standpoint, so both implementations have their strengths and weaknesses.

I suggest that you and @NetsuNegi cooperate and produce a unified pull request which would include the best work from you both. Maybe take his pull feature as a base and bring on all the nice features that your sidebar has, but ultimately that is up to you how you want to deal with this.

What do you think of this?

Oh, I saw his great implement. However, although I am willing to collaborate to create a better implement, in fact, I am currently busy with my daily work and limited to small modifications and fixes for all my implements I have made. I don't have enough time to make drastic changes to this implement right now, at least until next year. In addition, this implement also laid the foundation for another implement that I have public but not pull request yet.
select
So in the current stable state, I think I will temporarily put this on hold here. Of course, if necessary, I can also close it or convert it into a draft.

@CrimRecya CrimRecya closed this Sep 30, 2024
@CrimRecya CrimRecya deleted the develop-SWsidebar branch September 30, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants