Skip to content

Commit

Permalink
KOTOR: Add left/right functionality to remaining buttons in options
Browse files Browse the repository at this point in the history
  • Loading branch information
fdde committed Oct 29, 2017
1 parent 75c923a commit 9f63a81
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 0 deletions.
148 changes: 148 additions & 0 deletions src/engines/kotor/gui/options/graphicsadv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include "src/common/configman.h"

#include "src/aurora/talkman.h"

#include "src/engines/aurora/widget.h"

#include "src/engines/kotor/gui/options/graphicsadv.h"
Expand Down Expand Up @@ -64,6 +66,15 @@ OptionsGraphicsAdvancedMenu::~OptionsGraphicsAdvancedMenu() {
void OptionsGraphicsAdvancedMenu::show() {
GUI::show();

_textureQuality = CLIP(ConfigMan.getInt("texturequality", 0), 0, 2);
updateTextureQuality(_textureQuality);

_antiAliasing = CLIP(ConfigMan.getInt("antialiasing", 0), 0, 3);
updateAntiAliasing(_antiAliasing);

_anisotropy = CLIP(ConfigMan.getInt("anisotropy", 0), 0, 4);
updateAnisotropy(_anisotropy);

_frameBufferEffects = ConfigMan.getBool("framebuffereffects", false);
setCheckBoxState("CB_FRAMEBUFF", _frameBufferEffects);

Expand All @@ -76,7 +87,70 @@ void OptionsGraphicsAdvancedMenu::show() {

void OptionsGraphicsAdvancedMenu::callbackActive(Widget &widget) {

if (widget.getTag() == "BTN_TEXQUALRIGHT") {
_textureQuality++;
if (_textureQuality > 2) {
_textureQuality = 2;
}
updateTextureQuality(_textureQuality);
return;
}

if (widget.getTag() == "BTN_TEXQUALLEFT") {
_textureQuality--;
if (_textureQuality < 0) {
_textureQuality = 0;
}
updateTextureQuality(_textureQuality);
return;
}

if (widget.getTag() == "BTN_ANTIALIASRIGHT") {
_antiAliasing++;
if (_antiAliasing > 3) {
_antiAliasing = 3;
}
updateAntiAliasing(_antiAliasing);
return;
}

if (widget.getTag() == "BTN_ANTIALIASLEFT") {
_antiAliasing--;
if (_antiAliasing < 0) {
_antiAliasing = 0;
}
updateAntiAliasing(_antiAliasing);
return;
}

if (widget.getTag() == "BTN_ANISOTROPYRIGHT") {
_anisotropy++;
if (_anisotropy > 4) {
_anisotropy = 4;
}
updateAnisotropy(_anisotropy);
return;
}

if (widget.getTag() == "BTN_ANISOTROPYLEFT") {
_anisotropy--;
if (_anisotropy < 0) {
_anisotropy = 0;
}
updateAnisotropy(_anisotropy);
return;
}

if (widget.getTag() == "BTN_DEFAULT") {
_textureQuality = 0;
updateTextureQuality(_textureQuality);

_antiAliasing = 0;
updateAntiAliasing(_antiAliasing);

_anisotropy = 0;
updateAnisotropy(_anisotropy);

_frameBufferEffects = false;
setCheckBoxState("CB_FRAMEBUFF", _frameBufferEffects);

Expand Down Expand Up @@ -114,7 +188,81 @@ void OptionsGraphicsAdvancedMenu::callbackActive(Widget &widget) {
}
}

void OptionsGraphicsAdvancedMenu::updateTextureQuality(int textureQuality) {
WidgetButton &texQualButton = *getButton("BTN_TEXQUAL", true);
WidgetButton &leftButton = *getButton("BTN_TEXQUALLEFT", true);
WidgetButton &rightButton = *getButton("BTN_TEXQUALRIGHT", true);

texQualButton.setText(TalkMan.getString(48003 + textureQuality));

if (_textureQuality == 0) {
leftButton.hide();
} else {
leftButton.show();
}

if (_textureQuality == 2) {
rightButton.hide();
} else {
rightButton.show();
}
}

void OptionsGraphicsAdvancedMenu::updateAntiAliasing(int antiAliasing) {
WidgetButton &antiAliasButton = *getButton("BTN_ANTIALIAS", true);
WidgetButton &leftButton = *getButton("BTN_ANTIALIASLEFT", true);
WidgetButton &rightButton = *getButton("BTN_ANTIALIASRIGHT", true);

Common::UString text;

if (antiAliasing == 0)
text = TalkMan.getString(47996);
else if (antiAliasing == 1)
text = TalkMan.getString(47997);
else if (antiAliasing == 2)
text = TalkMan.getString(47999);
else if (antiAliasing == 3)
text = TalkMan.getString(49125);

antiAliasButton.setText(text);

if (_antiAliasing == 0) {
leftButton.hide();
} else {
leftButton.show();
}

if (_antiAliasing == 3) {
rightButton.hide();
} else {
rightButton.show();
}
}

void OptionsGraphicsAdvancedMenu::updateAnisotropy(int anisotropy) {
WidgetButton &anisotropyButton = *getButton("BTN_ANISOTROPY", true);
WidgetButton &leftButton = *getButton("BTN_ANISOTROPYLEFT", true);
WidgetButton &rightButton = *getButton("BTN_ANISOTROPYRIGHT", true);

anisotropyButton.setText(TalkMan.getString(49079 + anisotropy));

if (_anisotropy == 0) {
leftButton.hide();
} else {
leftButton.show();
}

if (_anisotropy == 4) {
rightButton.hide();
} else {
rightButton.show();
}
}

void OptionsGraphicsAdvancedMenu::adoptChanges() {
ConfigMan.setInt("texturequality", _textureQuality, true);
ConfigMan.setInt("antialiasing", _antiAliasing, true);
ConfigMan.setInt("anisotropy", _anisotropy, true);
ConfigMan.setBool("framebuffereffects", _softShadows, true);
ConfigMan.setBool("softshadows", _softShadows, true);
ConfigMan.setBool("vsync", _vsync, true);
Expand Down
8 changes: 8 additions & 0 deletions src/engines/kotor/gui/options/graphicsadv.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,17 @@ class OptionsGraphicsAdvancedMenu : public GUI {
void callbackActive(Widget &widget);

private:
int _textureQuality;
int _antiAliasing;
int _anisotropy;

bool _frameBufferEffects;
bool _softShadows;
bool _vsync;

void updateTextureQuality(int textureQuality);
void updateAntiAliasing(int antiAliasing);
void updateAnisotropy(int anisotropy);
};

} // End of namespace KotOR
Expand Down
49 changes: 49 additions & 0 deletions src/engines/kotor/gui/options/soundadv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include "src/common/configman.h"

#include "src/aurora/talkman.h"

#include "src/engines/aurora/widget.h"

#include "src/engines/kotor/gui/options/soundadv.h"
Expand Down Expand Up @@ -53,13 +55,39 @@ OptionsSoundAdvancedMenu::~OptionsSoundAdvancedMenu() {
void OptionsSoundAdvancedMenu::show() {
GUI::show();

_eax = CLIP(ConfigMan.getInt("eax", 0), 0, 3);
updateEAX(_eax);

_forceSoftware = ConfigMan.getBool("forcesoftware", false);
setCheckBoxState("CB_FORCESOFTWARE", _forceSoftware);
}

void OptionsSoundAdvancedMenu::callbackActive(Widget &widget) {

if (widget.getTag() == "BTN_EAXRIGHT") {
if (0) { // if we have EAX
_eax++;
if (_eax > 3) {
_eax = 3;
}
updateEAX(_eax);
}
return;
}

if (widget.getTag() == "BTN_EAXLEFT") {
_eax--;
if (_eax < 0) {
_eax = 0;
}
updateEAX(_eax);
return;
}

if (widget.getTag() == "BTN_DEFAULT") {
_eax = 0;
updateEAX(_eax);

_forceSoftware = false;
setCheckBoxState("CB_FORCESOFTWARE", _forceSoftware);
}
Expand All @@ -81,7 +109,28 @@ void OptionsSoundAdvancedMenu::callbackActive(Widget &widget) {
}
}

void OptionsSoundAdvancedMenu::updateEAX(int eax) {
WidgetButton &eaxButton = *getButton("BTN_EAX", true);
WidgetButton &leftButton = *getButton("BTN_EAXLEFT", true);
WidgetButton &rightButton = *getButton("BTN_EAXRIGHT", true);

eaxButton.setText(TalkMan.getString(48573 + eax));

if (_eax == 0) {
leftButton.hide();
} else {
leftButton.show();
}

if (_eax == 3) {
rightButton.hide();
} else {
rightButton.show();
}
}

void OptionsSoundAdvancedMenu::adoptChanges() {
ConfigMan.setInt("eax", _eax, true);
ConfigMan.setBool("forcesoftware", _forceSoftware, true);
}

Expand Down
3 changes: 3 additions & 0 deletions src/engines/kotor/gui/options/soundadv.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class OptionsSoundAdvancedMenu : public GUI {
void callbackActive(Widget &widget);

private:
int _eax;
bool _forceSoftware;

void updateEAX(int eax);
};

} // End of namespace KotOR
Expand Down

0 comments on commit 9f63a81

Please sign in to comment.