forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 212
feat(options): Add user configuration options for the Scroll Anchor feature #1500
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -378,6 +378,32 @@ Real OptionPreferences::getScrollFactor(void) | |
| return factor/100.0f; | ||
| } | ||
|
|
||
| Bool OptionPreferences::getDrawScrollAnchor(void) | ||
| { | ||
| OptionPreferences::const_iterator it = find("DrawScrollAnchor"); | ||
| // TheSuperHackers @info this default is based on the same variable within InGameUi.ini | ||
| if (it == end()) | ||
| return FALSE; | ||
|
|
||
| if (stricmp(it->second.str(), "yes") == 0) { | ||
| return TRUE; | ||
| } | ||
| return FALSE; | ||
| } | ||
|
|
||
| Bool OptionPreferences::getMoveScrollAnchor(void) | ||
| { | ||
| OptionPreferences::const_iterator it = find("MoveScrollAnchor"); | ||
| // TheSuperHackers @info this default is based on the same variable within InGameUi.ini | ||
| if (it == end()) | ||
| return TRUE; | ||
|
|
||
| if (stricmp(it->second.str(), "yes") == 0) { | ||
| return TRUE; | ||
| } | ||
| return FALSE; | ||
| } | ||
|
|
||
| CursorCaptureMode OptionPreferences::getCursorCaptureMode() const | ||
| { | ||
| CursorCaptureMode mode = CursorCaptureMode_Default; | ||
|
|
@@ -1237,6 +1263,24 @@ static void saveOptions( void ) | |
| (*pref)["ScrollFactor"] = prefString; | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| // draw scroll anchor | ||
| { | ||
| if( TheInGameUI->getDrawRMBScrollAnchor() ) | ||
| (*pref)["DrawScrollAnchor"] = "yes"; | ||
| else | ||
| (*pref)["DrawScrollAnchor"] = "no"; | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| // move scroll anchor | ||
| { | ||
| if( TheInGameUI->getMoveRMBScrollAnchor() ) | ||
|
Mauller marked this conversation as resolved.
Outdated
|
||
| (*pref)["MoveScrollAnchor"] = "yes"; | ||
| else | ||
| (*pref)["MoveScrollAnchor"] = "no"; | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------------------------- | ||
| // slider music volume | ||
| val = GadgetSliderGetPosition(sliderMusicVolume); | ||
|
|
@@ -1854,7 +1898,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) | |
| //set scroll options | ||
| AsciiString test = (*pref)["DrawScrollAnchor"]; | ||
| DEBUG_LOG(("DrawScrollAnchor == [%s]", test.str())); | ||
| if (test == "Yes" || (test.isEmpty() && TheInGameUI->getDrawRMBScrollAnchor())) | ||
| if (test == "yes" || (test.isEmpty() && TheInGameUI->getDrawRMBScrollAnchor())) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These blocks of code currently don't get hit since the options related to them are not implemented in the option menu, but i tweaked the text to match other places. |
||
| { | ||
| GadgetCheckBoxSetChecked( checkDrawAnchor, true); | ||
| TheInGameUI->setDrawRMBScrollAnchor(true); | ||
|
|
@@ -1866,7 +1910,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData ) | |
| } | ||
| test = (*pref)["MoveScrollAnchor"]; | ||
| DEBUG_LOG(("MoveScrollAnchor == [%s]", test.str())); | ||
| if (test == "Yes" || (test.isEmpty() && TheInGameUI->getMoveRMBScrollAnchor())) | ||
| if (test == "yes" || (test.isEmpty() && TheInGameUI->getMoveRMBScrollAnchor())) | ||
| { | ||
| GadgetCheckBoxSetChecked( checkMoveAnchor, true); | ||
| TheInGameUI->setMoveRMBScrollAnchor(true); | ||
|
|
@@ -2197,25 +2241,25 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg, | |
| if( GadgetCheckBoxIsChecked( control ) ) | ||
| { | ||
| TheInGameUI->setDrawRMBScrollAnchor(true); | ||
| (*pref)["DrawScrollAnchor"] = "Yes"; | ||
| (*pref)["DrawScrollAnchor"] = "yes"; | ||
| } | ||
| else | ||
| { | ||
| TheInGameUI->setDrawRMBScrollAnchor(false); | ||
| (*pref)["DrawScrollAnchor"] = "No"; | ||
| (*pref)["DrawScrollAnchor"] = "no"; | ||
| } | ||
| } | ||
| else if(controlID == checkMoveAnchorID ) | ||
| { | ||
| if( GadgetCheckBoxIsChecked( control ) ) | ||
| { | ||
| TheInGameUI->setMoveRMBScrollAnchor(true); | ||
| (*pref)["MoveScrollAnchor"] = "Yes"; | ||
| (*pref)["MoveScrollAnchor"] = "yes"; | ||
| } | ||
| else | ||
| { | ||
| TheInGameUI->setMoveRMBScrollAnchor(false); | ||
| (*pref)["MoveScrollAnchor"] = "No"; | ||
| (*pref)["MoveScrollAnchor"] = "no"; | ||
| } | ||
| } | ||
| else if(controlID == checkSaveCameraID ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These are here to allow the option to be saved to the options.ini as the other options menu code related to the scroll anchor is never hit in the current options menu.