-
-
Notifications
You must be signed in to change notification settings - Fork 124
Passive acquire mode #1849
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
base: develop
Are you sure you want to change the base?
Passive acquire mode #1849
Conversation
|
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. |
|
Previously when discussing stances we figured there should be a button/indicator at bottom bar. Have this went anywhere? If I recall correctly, someone even had the code to add custom buttons there. |
Hmmmm ... where is that code then🤔 |
|
Aggressive stance if I'm not wrong :-/ |
#1464 did not touch the bottom bar. |
|
Could there be visual indicator on techno to tell which of them is in aggressive/passive stance if it’s toggleable? |
|
Maybe it could be drawn next to the unit like the insignia. |
I think @Otamaa had the code for custom vanilla bottom bar buttons? |
my code is more big than Crim one , i do play around with these for a bit just for fun : |
@Metadorius The existing code has exceeded 500 lines. I think it's better to complete this PR before initiating a new one to finish these tasks, to avoid overwhelming the reviewer with too much code. What do you think? |
@TaranDahl I propose to take CrimRecya's implementation of the bottom bar buttons from #1453 separately as a new PR without any extra logics (maybe could do a new button for triggering Select Next Idle Harvester command; however, I am not sure if the buttons have to be always tied to CommandClass, this is up for discussion), reviewing/refactoring it so it fits our standards, merging, and then rebasing this PR so it can use it. oh and don't merge latest develop commit, we're deciding how to proceed on it |
|
resolved the situation with develop, feel free to merge it |
CrimRecya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some minor issues, but overall it looks good. I think the bottom bar part can be added after merging, of course, it depends on what you think.
| #include <CCINIClass.h> | ||
| #include <InputManagerClass.h> | ||
| #include <MouseClass.h> | ||
| #include <WWMouseClass.h> | ||
|
|
||
| #include <Utilities/Macro.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need these for the time being.
| isAllSelectedUnitAggressiveMode = false; | ||
| TechnoVectorNonAggressive.push_back(pTechno); | ||
| } | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line of return is a bit redundant.
| isAllSelectedUnitCeasefireMode = false; | ||
| TechnoVectorNonCeasefire.push_back(pTechno); | ||
| } | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| @@ -1,4 +1,4 @@ | |||
| #include "Body.h" | |||
| #include "Body.h" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may have accidentally modified the encoding format of the file.
| @@ -1,4 +1,4 @@ | |||
| #pragma once | |||
| #pragma once | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| @@ -1,4 +1,4 @@ | |||
| #pragma once | |||
| #pragma once | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| DEFINE_HOOK(0x6F8E1F, TechnoClass_SelectAutoTarget_CeasefireMode, 0x6) | ||
| { | ||
| GET(TechnoTypeClass*, pType, EAX); | ||
| GET(TechnoClass*, pThis, ESI); | ||
| R->CL(pType->NoAutoFire || (TechnoExt::ExtMap.Find(pThis)->GetPassiveAcquireMode()) == PassiveAcquireMode::Ceasefire); | ||
| return R->Origin() + 0x6; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this hook will make AI to ignore the ceasefire mode?
| #pragma once | ||
| #include <InfantryClass.h> | ||
| #include <AnimClass.h> | ||
|
|
||
| #include <Ext/TechnoType/Body.h> | ||
| #include <Ext/BuildingType/Body.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, prioritize including these dependencies in separate files instead of including them in header files.
| auto previousMode = this->PassiveAquireMode; | ||
| this->PassiveAquireMode = newMode; | ||
|
|
||
| if (newMode == previousMode) | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| auto previousMode = this->PassiveAquireMode; | |
| this->PassiveAquireMode = newMode; | |
| if (newMode == previousMode) | |
| return; | |
| const auto previousMode = this->PassiveAquireMode; | |
| if (newMode == previousMode) | |
| return; | |
| this->PassiveAquireMode = newMode; |
|
|
||
| const auto pThis = this->OwnerObject(); | ||
| const auto pTechnoType = this->TypeExtData->OwnerObject(); | ||
| int voiceIndex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it's just a suggestion. I just don't like having an uninitialized variable. You can try encapsulating the following code into a static inline or lambda function called process... and returning a voice index.
@CrimRecya How about this |
Passive acquire mode
[General] -> EnablePassiveAcquireModeis set totrue. When you press one of these hotkeys:[TechnoType] -> Voice(Enter/Exit)(Aggressive/Ceasefire)Mode.[TechnoType] -> PassiveAcquireMode.Togglableto specify whether the unit can toggle its mode.[TechnoType] -> PassiveAcquireModeto specify the unit's initial mode.In
rulesmd.ini:[ ]Ceasefire ModeTXT_CEASEFIRE_MODE,TXT_CEASEFIRE_MODE_DESC,MSG:CEASEFIRE_MODE_ONandMSG:CEASEFIRE_MODE_OFFinto your.csffile.[ ]Aggressive ModeTXT_AGGRESSIVE_MODE,TXT_AGGRESSIVE_MODE_DESC,MSG:AGGRESSIVE_MODE_ONandMSG:AGGRESSIVE_MODE_OFFinto your.csffile.