Skip to content
Merged
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
2 changes: 2 additions & 0 deletions Generals/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ class GlobalData : public SubsystemInterface

Real m_keyboardScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling
Real m_keyboardDefaultScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling
Bool m_drawScrollAnchor; ///< Set that the scroll anchor should be enabled
Bool m_moveScrollAnchor; ///< set that the scroll anchor should move

Bool m_animateWindows; ///< Should we animate window transitions?

Expand Down
2 changes: 2 additions & 0 deletions Generals/Code/GameEngine/Include/Common/UserPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class OptionPreferences : public UserPreferences
void setOnlineIPAddress(UnsignedInt IP); // convenience function
Bool getAlternateMouseModeEnabled(void); // convenience function
Real getScrollFactor(void); // convenience function
Bool getDrawScrollAnchor(void);
Bool getMoveScrollAnchor(void);
CursorCaptureMode getCursorCaptureMode() const;
Bool getSendDelay(void); // convenience function
Int getFirewallBehavior(void); // convenience function
Expand Down
4 changes: 4 additions & 0 deletions Generals/Code/GameEngine/Source/Common/GlobalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,8 @@ GlobalData::GlobalData()
m_loadScreenRender = FALSE;

m_keyboardDefaultScrollFactor = m_keyboardScrollFactor = 0.5f;
m_drawScrollAnchor = FALSE;
m_moveScrollAnchor = FALSE;
m_scrollAmountCutoff = 10.0f;
m_cameraAdjustSpeed = 0.1f;
m_enforceMaxCameraHeight = TRUE;
Expand Down Expand Up @@ -1164,6 +1166,8 @@ void GlobalData::parseGameDataDefinition( INI* ini )
OptionPreferences optionPref;
TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled();
TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor();
TheWritableGlobalData->m_drawScrollAnchor = optionPref.getDrawScrollAnchor();
TheWritableGlobalData->m_moveScrollAnchor = optionPref.getMoveScrollAnchor();
TheWritableGlobalData->m_defaultIP = optionPref.getLANIPAddress();
TheWritableGlobalData->m_firewallSendDelay = optionPref.getSendDelay();
TheWritableGlobalData->m_firewallBehavior = optionPref.getFirewallBehavior();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,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;
Expand Down Expand Up @@ -1177,6 +1203,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() )
(*pref)["MoveScrollAnchor"] = "yes";
else
(*pref)["MoveScrollAnchor"] = "no";
}

//-------------------------------------------------------------------------------------------------
// slider music volume
val = GadgetSliderGetPosition(sliderMusicVolume);
Expand Down Expand Up @@ -1785,7 +1829,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()))
{
GadgetCheckBoxSetChecked( checkDrawAnchor, true);
TheInGameUI->setDrawRMBScrollAnchor(true);
Expand All @@ -1797,7 +1841,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);
Expand Down Expand Up @@ -2126,25 +2170,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 )
Expand Down
2 changes: 2 additions & 0 deletions Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,8 @@ void InGameUI::init( void )

m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID;

setDrawRMBScrollAnchor(TheGlobalData->m_drawScrollAnchor);
setMoveRMBScrollAnchor(TheGlobalData->m_moveScrollAnchor);

} // end init

Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ class GlobalData : public SubsystemInterface

Real m_keyboardScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling
Real m_keyboardDefaultScrollFactor; ///< Factor applied to game scrolling speed via keyboard scrolling
Bool m_drawScrollAnchor; ///< Set that the scroll anchor should be enabled
Bool m_moveScrollAnchor; ///< set that the scroll anchor should move

Bool m_animateWindows; ///< Should we animate window transitions?

Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class OptionPreferences : public UserPreferences
Bool getRetaliationModeEnabled(); // convenience function
Bool getDoubleClickAttackMoveEnabled(void); // convenience function
Real getScrollFactor(void); // convenience function
Bool getDrawScrollAnchor(void);
Bool getMoveScrollAnchor(void);
CursorCaptureMode getCursorCaptureMode() const;
Bool getSendDelay(void); // convenience function
Int getFirewallBehavior(void); // convenience function
Expand Down
4 changes: 4 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,8 @@ GlobalData::GlobalData()
m_loadScreenRender = FALSE;

m_keyboardDefaultScrollFactor = m_keyboardScrollFactor = 0.5f;
m_drawScrollAnchor = FALSE;
m_moveScrollAnchor = FALSE;
m_scrollAmountCutoff = 10.0f;
m_cameraAdjustSpeed = 0.1f;
m_enforceMaxCameraHeight = TRUE;
Expand Down Expand Up @@ -1192,6 +1194,8 @@ void GlobalData::parseGameDataDefinition( INI* ini )
TheWritableGlobalData->m_clientRetaliationModeEnabled = optionPref.getRetaliationModeEnabled();
TheWritableGlobalData->m_doubleClickAttackMove = optionPref.getDoubleClickAttackMoveEnabled();
TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor();
TheWritableGlobalData->m_drawScrollAnchor = optionPref.getDrawScrollAnchor();
TheWritableGlobalData->m_moveScrollAnchor = optionPref.getMoveScrollAnchor();
TheWritableGlobalData->m_defaultIP = optionPref.getLANIPAddress();
TheWritableGlobalData->m_firewallSendDelay = optionPref.getSendDelay();
TheWritableGlobalData->m_firewallBehavior = optionPref.getFirewallBehavior();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1237,6 +1263,24 @@ static void saveOptions( void )
(*pref)["ScrollFactor"] = prefString;
}

//-------------------------------------------------------------------------------------------------
// draw scroll anchor
{
if( TheInGameUI->getDrawRMBScrollAnchor() )

Copy link
Copy Markdown
Author

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.

(*pref)["DrawScrollAnchor"] = "yes";
else
(*pref)["DrawScrollAnchor"] = "no";
}

//-------------------------------------------------------------------------------------------------
// move scroll anchor
{
if( TheInGameUI->getMoveRMBScrollAnchor() )
Comment thread
Mauller marked this conversation as resolved.
Outdated
(*pref)["MoveScrollAnchor"] = "yes";
else
(*pref)["MoveScrollAnchor"] = "no";
}

//-------------------------------------------------------------------------------------------------
// slider music volume
val = GadgetSliderGetPosition(sliderMusicVolume);
Expand Down Expand Up @@ -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()))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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);
Expand All @@ -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);
Expand Down Expand Up @@ -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 )
Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,8 @@ void InGameUI::init( void )

m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID;

setDrawRMBScrollAnchor(TheGlobalData->m_drawScrollAnchor);
setMoveRMBScrollAnchor(TheGlobalData->m_moveScrollAnchor);
Comment thread
Mauller marked this conversation as resolved.
Outdated
Comment thread
Mauller marked this conversation as resolved.
Outdated

} // end init

Expand Down
Loading