diff options
-rw-r--r-- | devtools/create_xeen/constants.cpp | 3 | ||||
-rw-r--r-- | dists/engine-data/dark.cc | bin | 0 -> 11217676 bytes | |||
-rw-r--r-- | dists/engine-data/xeen.ccs | bin | 41774 -> 41807 bytes | |||
-rw-r--r-- | engines/xeen/combat.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/dialogs_difficulty.cpp | 77 | ||||
-rw-r--r-- | engines/xeen/dialogs_difficulty.h | 60 | ||||
-rw-r--r-- | engines/xeen/module.mk | 1 | ||||
-rw-r--r-- | engines/xeen/resources.cpp | 1 | ||||
-rw-r--r-- | engines/xeen/resources.h | 1 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_menu.cpp | 8 |
10 files changed, 151 insertions, 2 deletions
diff --git a/devtools/create_xeen/constants.cpp b/devtools/create_xeen/constants.cpp index 8fc5b92a32..ef2b16c42d 100644 --- a/devtools/create_xeen/constants.cpp +++ b/devtools/create_xeen/constants.cpp @@ -1767,6 +1767,8 @@ const char *const MUSIC_FILES2[6][7] = { { "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m" } }; +const char *const DIFFICULTY_TEXT = "\v000\t000\x3""cSelect Game Preference"; + void writeConstants(CCArchive &cc) { Common::MemFile file; file.syncString(CREDITS); @@ -2093,6 +2095,7 @@ void writeConstants(CCArchive &cc) { file.syncStrings(GOOBER, 3); file.syncStrings(MUSIC_FILES1, 5); file.syncStrings2D((const char *const *)MUSIC_FILES2, 6, 7); + file.syncString(DIFFICULTY_TEXT); cc.add("CONSTANTS", file); } diff --git a/dists/engine-data/dark.cc b/dists/engine-data/dark.cc Binary files differnew file mode 100644 index 0000000000..875ed74d66 --- /dev/null +++ b/dists/engine-data/dark.cc diff --git a/dists/engine-data/xeen.ccs b/dists/engine-data/xeen.ccs Binary files differindex 1561baa809..46d09c3124 100644 --- a/dists/engine-data/xeen.ccs +++ b/dists/engine-data/xeen.ccs diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index 2f512f6fd8..32984c1527 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -1708,7 +1708,7 @@ void Combat::getWeaponDamage(Character &c, RangeType rangeType) { if (_weaponDamage < 1) _weaponDamage = 0; - if (!party._difficulty) { + if (party._difficulty == ADVENTURER) { _hitChanceBonus += 5; _weaponDamage *= 3; } diff --git a/engines/xeen/dialogs_difficulty.cpp b/engines/xeen/dialogs_difficulty.cpp new file mode 100644 index 0000000000..e7c7445ebb --- /dev/null +++ b/engines/xeen/dialogs_difficulty.cpp @@ -0,0 +1,77 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "xeen/dialogs_difficulty.h" +#include "xeen/resources.h" +#include "xeen/xeen.h" + +namespace Xeen { + +int DifficultyDialog::show(XeenEngine *vm) { + DifficultyDialog *dlg = new DifficultyDialog(vm); + int result = dlg->execute(); + delete dlg; + + return result; +} + +DifficultyDialog::DifficultyDialog(XeenEngine *vm) : ButtonContainer(vm) { + loadButtons(); +} + +int DifficultyDialog::execute() { + EventsManager &events = *_vm->_events; + Interface &intf = *_vm->_interface; + Party &party = *_vm->_party; + Windows &windows = *_vm->_windows; + + Window &w = windows[6]; + w.open(); + w.writeString(Res.DIFFICULTY_TEXT); + drawButtons(&w); + + int result = -1; + while (!_vm->shouldExit()) { + events.pollEventsAndWait(); + checkEvents(_vm); + + if (_buttonValue == Common::KEYCODE_a) + result = ADVENTURER; + else if (_buttonValue == Common::KEYCODE_w) + result = WARRIOR; + else if (_buttonValue != Common::KEYCODE_ESCAPE) + continue; + + break; + } + + w.close(); + return result; +} + +void DifficultyDialog::loadButtons() { + _sprites.load("choice.icn"); + addButton(Common::Rect(68, 167, 158, 187), Common::KEYCODE_a, &_sprites); + addButton(Common::Rect(166, 167, 256, 187), Common::KEYCODE_w, &_sprites); +} + +} // End of namespace Xeen diff --git a/engines/xeen/dialogs_difficulty.h b/engines/xeen/dialogs_difficulty.h new file mode 100644 index 0000000000..e0771a50b9 --- /dev/null +++ b/engines/xeen/dialogs_difficulty.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef XEEN_DIALOGS_DIFFICULTY_H +#define XEEN_DIALOGS_DIFFICULTY_H + +#include "xeen/dialogs.h" +#include "xeen/party.h" + +namespace Xeen { + +class DifficultyDialog : public ButtonContainer { +private: + SpriteResource _sprites; + + /** + * Constructor + */ + DifficultyDialog(XeenEngine *vm); + + /** + * Shows the dialog + */ + int execute(); + + /** + * Loads buttons for the dialog + */ + void loadButtons(); +public: + /** + * Shows the difficulty selection dialog + * @param vm Engine reference + * @returns 0=Adventurer, 1=Warrior, -1 exit + */ + static int show(XeenEngine *vm); +}; + +} // End of namespace Xeen + +#endif /* XEEN_DIALOGS_DIFFICULTY_H */ diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk index c963ad35b1..2a5ef613bf 100644 --- a/engines/xeen/module.mk +++ b/engines/xeen/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ dialogs_char_info.o \ dialogs_control_panel.o \ dialogs_create_char.o \ + dialogs_difficulty.o \ dialogs_dismiss.o \ dialogs_exchange.o \ dialogs_info.o \ diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index 7f9e1df134..0aa7d8ac83 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -386,6 +386,7 @@ void Resources::loadData() { file.syncStrings(GOOBER, 3); file.syncStrings(MUSIC_FILES1, 5); file.syncStrings2D(&MUSIC_FILES2[0][0], 6, 7); + file.syncString(DIFFICULTY_TEXT); } } // End of namespace Xeen diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h index 09f7202801..67ac992ad3 100644 --- a/engines/xeen/resources.h +++ b/engines/xeen/resources.h @@ -441,6 +441,7 @@ public: const char *GOOBER[3]; const char *MUSIC_FILES1[5]; const char *MUSIC_FILES2[6][7]; + const char *DIFFICULTY_TEXT; public: /** * Constructor diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp index dad16ec89d..ff2e9ac3e8 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp @@ -22,8 +22,9 @@ #include "common/scummsys.h" #include "xeen/worldofxeen/worldofxeen_menu.h" -#include "xeen/resources.h" #include "xeen/worldofxeen/worldofxeen.h" +#include "xeen/dialogs_difficulty.h" +#include "xeen/resources.h" namespace Xeen { namespace WorldOfXeen { @@ -104,6 +105,11 @@ void WorldOfXeenMenu::execute() { break; } else if (key == 'S') { // Start new game + int result = DifficultyDialog::show(_vm); + if (result == -1) + break; + + _vm->_party->_difficulty = (Difficulty)result; WOX_VM._pendingAction = WOX_PLAY_GAME; closeWindow(); return; |