diff options
author | Paul Gilbert | 2018-02-18 16:19:31 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-02-18 16:19:31 -0500 |
commit | 1d69120112e16a74a9d101a0d4d9de04196d29de (patch) | |
tree | ae61a6a3fc1d926470aa1ac5788d7a90ef8739aa /engines/xeen/dialogs_create_char.h | |
parent | c5981a1fad9c107e05d0a66eb42305823481863b (diff) | |
download | scummvm-rg350-1d69120112e16a74a9d101a0d4d9de04196d29de.tar.gz scummvm-rg350-1d69120112e16a74a9d101a0d4d9de04196d29de.tar.bz2 scummvm-rg350-1d69120112e16a74a9d101a0d4d9de04196d29de.zip |
XEEN: Split up code for create character dialog into it's own class
Diffstat (limited to 'engines/xeen/dialogs_create_char.h')
-rw-r--r-- | engines/xeen/dialogs_create_char.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/engines/xeen/dialogs_create_char.h b/engines/xeen/dialogs_create_char.h new file mode 100644 index 0000000000..6a33bcf06c --- /dev/null +++ b/engines/xeen/dialogs_create_char.h @@ -0,0 +1,102 @@ +/* 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_CREATE_CHAR_H +#define XEEN_DIALOGS_CREATE_CHAR_H + +#include "xeen/dialogs.h" +#include "xeen/character.h" + +namespace Xeen { + +class CreateCharacterDialog : public ButtonContainer { +private: + SpriteResource _icons; + SpriteResource _dice; + int _diceFrame[3]; + Common::Point _dicePos[3]; + Common::Point _diceInc[3]; +private: + /** + * Constructor + */ + CreateCharacterDialog(XeenEngine *vm); + + /** + * Loads the buttons for the dialog + */ + void loadButtons(); + + /** + * Print the dice animation + */ + void drawDice(SpriteResource &dice); + + /** + * Executes the dialog + */ + void execute(); + + /** + * Exchanging two attributes for the character being rolled + */ + int exchangeAttribute(int srcAttr); + + /** + * Set a list of flags for which classes the passed attribute set meet the + * minimum requirements of + */ + void checkClass(const uint attribs[TOTAL_ATTRIBUTES], bool allowedClasses[TOTAL_CLASSES]); + + /** + * Return details of the generated character + */ + int newCharDetails(const uint attribs[TOTAL_ATTRIBUTES], + bool allowedClasses[TOTAL_CLASSES], Race race, Sex sex, int classId, + int selectedClass, Common::String &msg); + + /** + * Print the selection arrow to indicate the selected class + */ + void printSelectionArrow(SpriteResource &icons, int selectedClass); + + /** + * Saves the rolled character into the roster + */ + bool saveCharacter(Character &c, int classId, Race race, + Sex sex, uint attribs[TOTAL_ATTRIBUTES]); + + /** + * Roll up some random values for the attributes, and return both them as + * well as a list of classes that the attributes meet the requirements for + */ + void throwDice(uint attribs[TOTAL_ATTRIBUTES], bool allowedClasses[TOTAL_CLASSES]); +public: + /** + * Shows the Create Character dialog + */ + static void show(XeenEngine *vm); +}; + +} // End of namespace Xeen + +#endif /* XEEN_DIALOGS_CREATE_CHAR_H */ |