00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef PARTY_EDITOR_H
00019 #define PARTY_EDITOR_H
00020
00021 #include <string.h>
00022 #include "constants.h"
00023 #include "sdlhandler.h"
00024 #include "sdleventhandler.h"
00025 #include "sdlscreenview.h"
00026 #include "scourge.h"
00027 #include "userconfiguration.h"
00028 #include "util.h"
00029 #include "gui/window.h"
00030 #include "gui/button.h"
00031 #include "gui/canvas.h"
00032 #include "gui/scrollinglist.h"
00033 #include "gui/cardcontainer.h"
00034 #include "gui/widgetview.h"
00035 #include "gui/scrollinglabel.h"
00036
00041 class Scourge;
00042 class UserConfiguration;
00043
00044 typedef struct _CharacterInfo {
00045 TextField *name;
00046
00047 ScrollingList *charType;
00048 ScrollingLabel *charTypeDescription;
00049 char **charTypeStr;
00050
00051 ScrollingList *deityType;
00052 ScrollingLabel *deityTypeDescription;
00053 char **deityTypeStr;
00054
00055 Canvas *portrait;
00056 Button *nextPortrait;
00057 Button *prevPortrait;
00058 int portraitIndex;
00059
00060 Canvas *model;
00061 Button *nextModel;
00062 Button *prevModel;
00063 int modelIndex;
00064
00065 Label *skillLabel;
00066 ScrollingList *skills;
00067 Button *skillAddButton, *skillRerollButton, *skillSubButton;
00068 int availableSkillMod;
00069 char **skillLine;
00070 Color *skillColor;
00071 int skill[ Constants::SKILL_COUNT ], skillMod[ Constants::SKILL_COUNT ];
00072 ScrollingLabel *skillDescription;
00073
00074 Button *back, *next;
00075
00076 } CharacterInfo;
00077
00078 class PartyEditor : public WidgetView {
00079 private:
00080
00081 enum {
00082 INTRO_TEXT = 0,
00083 CREATE_CHAR_0,
00084 CREATE_CHAR_1,
00085 CREATE_CHAR_2,
00086 CREATE_CHAR_3,
00087 OUTRO_TEXT
00088 };
00089
00090 Scourge *scourge;
00091 Window *mainWin;
00092 CardContainer *cards;
00093 Label *intro;
00094 Button *cancel, *done;
00095 Button *toIntro, *toChar0, *toLastChar;
00096 CharacterInfo info[ MAX_PARTY_SIZE ];
00097 int step;
00098 Uint32 lastTick;
00099 float zrot;
00100 map<CharacterModelInfo*, GLShape*> shapes;
00101
00102 public:
00103 PartyEditor(Scourge *scourge);
00104 ~PartyEditor();
00105
00106 void drawWidget(Widget *w);
00107 void drawAfter();
00108
00109 inline bool isVisible() { return mainWin->isVisible(); }
00110 inline void setVisible( bool b ) { mainWin->setVisible( b ); }
00111 inline Widget *getStartGameButton() { return done; }
00112 inline Widget *getCancelButton() { return cancel; }
00113 void reset();
00114 void handleEvent( Widget *widget, SDL_Event *event );
00115 void createParty( Creature **pc, int *partySize );
00116
00117 protected:
00118 void createCharUI( int step, CharacterInfo *info );
00119 void deleteLoadedShapes();
00120 void rollSkills( CharacterInfo *info );
00121 void updateUI( CharacterInfo *info );
00122 };
00123
00124 #endif