aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2008-05-05 17:18:11 +0000
committerJohannes Schickel2008-05-05 17:18:11 +0000
commitf42d222069d7ae130c85201e895e7f23d27c88d0 (patch)
tree6eab38aab26fb2fff6e92cd3bafdb579e7d6c0e0 /engines
parent81cfd2a716ff42d5425a456faff9068c92130969 (diff)
downloadscummvm-rg350-f42d222069d7ae130c85201e895e7f23d27c88d0.tar.gz
scummvm-rg350-f42d222069d7ae130c85201e895e7f23d27c88d0.tar.bz2
scummvm-rg350-f42d222069d7ae130c85201e895e7f23d27c88d0.zip
Got rid of some code duplication.
svn-id: r31880
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui_hof.cpp32
-rw-r--r--engines/kyra/gui_hof.h2
-rw-r--r--engines/kyra/gui_mr.cpp32
-rw-r--r--engines/kyra/gui_mr.h2
-rw-r--r--engines/kyra/gui_v2.cpp32
-rw-r--r--engines/kyra/gui_v2.h5
6 files changed, 37 insertions, 68 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 1ca90c6549..08cfd2a1e9 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -1001,18 +1001,6 @@ int GUI_HoF::gameOptionsTalkie(Button *caller) {
return 0;
}
-int GUI_HoF::toggleWalkspeed(Button *caller) {
- updateMenuButton(caller);
- if (_vm->_configWalkspeed == 5)
- _vm->_configWalkspeed = 3;
- else
- _vm->_configWalkspeed = 5;
- _vm->_timer->setDelay(0, _vm->_configWalkspeed);
- setupOptionsButtons();
- renewHighlight(_gameOptions);
- return 0;
-}
-
int GUI_HoF::changeLanguage(Button *caller) {
updateMenuButton(caller);
++_vm->_lang;
@@ -1022,26 +1010,6 @@ int GUI_HoF::changeLanguage(Button *caller) {
return 0;
}
-int GUI_HoF::toggleText(Button *caller) {
- updateMenuButton(caller);
-
- if (_vm->textEnabled()) {
- if (_vm->speechEnabled())
- _vm->_configVoice = 1;
- else
- _vm->_configVoice = 3;
- } else {
- if (_vm->speechEnabled())
- _vm->_configVoice = 2;
- else
- _vm->_configVoice = 0;
- }
-
- setupOptionsButtons();
- renewHighlight(_gameOptions);
- return 0;
-}
-
void GUI_HoF::setupOptionsButtons() {
if (_vm->_configWalkspeed == 3)
_gameOptions.item[0].itemId = 28;
diff --git a/engines/kyra/gui_hof.h b/engines/kyra/gui_hof.h
index 6abaff3797..d535fc13ea 100644
--- a/engines/kyra/gui_hof.h
+++ b/engines/kyra/gui_hof.h
@@ -69,9 +69,7 @@ private:
int gameOptions(Button *caller);
int gameOptionsTalkie(Button *caller);
- int toggleWalkspeed(Button *caller);
int changeLanguage(Button *caller);
- int toggleText(Button *caller);
void setupOptionsButtons();
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index 655585b734..bf04e66a51 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -1050,18 +1050,6 @@ void GUI_MR::setupOptionsButtons() {
_gameOptions.item[3].itemId = 17;
}
-int GUI_MR::toggleWalkspeed(Button *caller) {
- updateMenuButton(caller);
- if (_vm->_configWalkspeed == 5)
- _vm->_configWalkspeed = 3;
- else
- _vm->_configWalkspeed = 5;
- _vm->_mainCharacter.walkspeed = _vm->_configWalkspeed;
- setupOptionsButtons();
- renewHighlight(_gameOptions);
- return 0;
-}
-
int GUI_MR::changeLanguage(Button *caller) {
updateMenuButton(caller);
if (!_vm->queryGameFlag(0x1B2)) {
@@ -1089,25 +1077,5 @@ int GUI_MR::toggleSkipSupport(Button *caller) {
return 0;
}
-int GUI_MR::toggleText(Button *caller) {
- updateMenuButton(caller);
-
- if (_vm->textEnabled()) {
- if (_vm->speechEnabled())
- _vm->_configVoice = 1;
- else
- _vm->_configVoice = 3;
- } else {
- if (_vm->speechEnabled())
- _vm->_configVoice = 2;
- else
- _vm->_configVoice = 0;
- }
-
- setupOptionsButtons();
- renewHighlight(_gameOptions);
- return 0;
-}
-
} // end of namespace Kyra
diff --git a/engines/kyra/gui_mr.h b/engines/kyra/gui_mr.h
index fcf783492f..d994aa91da 100644
--- a/engines/kyra/gui_mr.h
+++ b/engines/kyra/gui_mr.h
@@ -69,11 +69,9 @@ private:
int gameOptions(Button *button);
void setupOptionsButtons();
- int toggleWalkspeed(Button *caller);
int changeLanguage(Button *caller);
int toggleStudioSFX(Button *caller);
int toggleSkipSupport(Button *caller);
- int toggleText(Button *caller);
KyraEngine_MR *_vm;
Screen_MR *_screen;
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index dd6a774ca0..4d78c8bb6f 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -518,6 +518,38 @@ int GUI_v2::quitOptionsMenu(Button *caller) {
return 0;
}
+int GUI_v2::toggleWalkspeed(Button *caller) {
+ updateMenuButton(caller);
+ if (_vm->_configWalkspeed == 5)
+ _vm->_configWalkspeed = 3;
+ else
+ _vm->_configWalkspeed = 5;
+ _vm->setWalkspeed(_vm->_configWalkspeed);
+ setupOptionsButtons();
+ renewHighlight(_gameOptions);
+ return 0;
+}
+
+int GUI_v2::toggleText(Button *caller) {
+ updateMenuButton(caller);
+
+ if (_vm->textEnabled()) {
+ if (_vm->speechEnabled())
+ _vm->_configVoice = 1;
+ else
+ _vm->_configVoice = 3;
+ } else {
+ if (_vm->speechEnabled())
+ _vm->_configVoice = 2;
+ else
+ _vm->_configVoice = 0;
+ }
+
+ setupOptionsButtons();
+ renewHighlight(_gameOptions);
+ return 0;
+}
+
int GUI_v2::clickLoadSlot(Button *caller) {
updateMenuButton(caller);
diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h
index a007ce84d8..764376f969 100644
--- a/engines/kyra/gui_v2.h
+++ b/engines/kyra/gui_v2.h
@@ -194,6 +194,11 @@ protected:
// options menu
int quitOptionsMenu(Button *caller);
+ int toggleWalkspeed(Button *caller);
+ int toggleText(Button *caller);
+
+ virtual void setupOptionsButtons() = 0;
+
// savename menu
bool _finishNameInput, _cancelNameInput;
Common::KeyState _keyPressed;