1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef XEEN_DIALOGS_CREATE_CHAR_H 24 #define XEEN_DIALOGS_CREATE_CHAR_H 25 26 #include "xeen/dialogs/dialogs.h" 27 #include "xeen/character.h" 28 29 namespace Xeen { 30 31 class CreateCharacterDialog : public ButtonContainer { 32 private: 33 SpriteResource _icons; 34 SpriteResource _dice; 35 Common::Point _diceSize; 36 int _diceFrame[3]; 37 Common::Point _dicePos[3]; 38 Common::Point _diceInc[3]; 39 uint _attribs[TOTAL_ATTRIBUTES]; 40 bool _allowedClasses[TOTAL_CLASSES]; 41 private: 42 /** 43 * Constructor 44 */ 45 CreateCharacterDialog(XeenEngine *vm); 46 47 /** 48 * Loads the buttons for the dialog 49 */ 50 void loadButtons(); 51 52 /** 53 * Draws on-screen icons 54 */ 55 void drawIcons(); 56 57 /** 58 * Draws on-screen icons 59 */ 60 void drawIcons2(); 61 62 /** 63 * Animate the dice rolling around 64 */ 65 void drawDice(); 66 67 /** 68 * Executes the dialog 69 */ 70 void execute(); 71 72 /** 73 * Returns the attribute that a given keycode represents 74 */ 75 int getAttribFromKeycode(int keycode) const; 76 77 /** 78 * Handles the logic for swapping attributes 79 * @param keycode Key pressed representing one of the attributes 80 * @returns True if swap occurred 81 */ 82 bool swapAttributes(int keycode); 83 84 /** 85 * Exchanging two attributes for the character being rolled 86 */ 87 int exchangeAttribute(int srcAttr); 88 89 /** 90 * Set a list of flags for which classes the passed attribute set meet the 91 * minimum requirements of 92 */ 93 void checkClass(); 94 95 /** 96 * Return details of the generated character 97 */ 98 int newCharDetails(Race race, Sex sex, int classId, int selectedClass, Common::String &msg); 99 100 /** 101 * Print the selection arrow to indicate the selected class 102 */ 103 void printSelectionArrow(int selectedClass); 104 105 /** 106 * Saves the rolled character into the roster 107 */ 108 bool saveCharacter(Character &c, int classId, Race race, Sex sex); 109 110 /** 111 * Roll up some random values for the attributes, and return both them as 112 * well as a list of classes that the attributes meet the requirements for 113 */ 114 void rollAttributes(); 115 public: 116 /** 117 * Shows the Create Character dialog 118 */ 119 static void show(XeenEngine *vm); 120 }; 121 122 } // End of namespace Xeen 123 124 #endif /* XEEN_DIALOGS_CREATE_CHAR_H */ 125