Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields

inventory.h

00001 
00002 /***************************************************************************
00003                           inventory.h  -  description
00004                              -------------------
00005     begin                : Sat May 3 2003
00006     copyright            : (C) 2003 by Gabor Torok
00007     email                : cctorok@yahoo.com
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef INVENTORY_H
00020 #define INVENTORY_H
00021 
00022 #include <iostream>
00023 #include "constants.h"
00024 #include "sdlhandler.h"
00025 #include "sdleventhandler.h"
00026 #include "sdlscreenview.h"
00027 #include "scourge.h"
00028 #include "rpg/character.h"
00029 #include "rpg/spell.h"
00030 #include "gui/window.h"
00031 #include "gui/button.h"
00032 #include "gui/cardcontainer.h"
00033 #include "gui/scrollinglist.h"
00034 #include "gui/scrollinglabel.h"
00035 #include "gui/draganddrop.h"
00036 #include "gui/canvas.h"
00037 #include "gui/widgetview.h"
00038 #include "creature.h"
00039 
00044 class Creature;
00045 
00046 class Inventory : public DragAndDropHandler, WidgetView {
00047 private:
00048     Scourge *scourge;
00049     int selected; // which player is selected?
00050     int selectedMode; // which mode is selected?
00051     enum mode {
00052           INVENTORY = 0, CHARACTER, SPELL, LOG, MISSION, PARTY
00053     };    
00054 
00055         // UI
00056         Window *mainWin;
00057         Button *inventoryButton, *skillsButton, *spellsButton, *partyButton, *closeButton;
00058         CardContainer *cards;
00059 
00060         // inventory screen
00061         //Label *invEquipLabel[Character::INVENTORY_COUNT];
00062   Canvas *paperDoll;
00063   int posX[Constants::INVENTORY_COUNT], posY[Constants::INVENTORY_COUNT];
00064         Label *inventoryWeightLabel, *coinsLabel;
00065         char inventoryWeightStr[80], coinsStr[80];
00066 
00067         Button *equipButton, *fixButton, *removeCurseButton, *skillAddButton, *skillSubButton;
00068         Button *combineButton, *enchantButton, *identifyButton, *openButton, *levelUpButton;
00069         Button *eatDrinkButton, *castScrollButton, *transcribeButton, *infoButton;
00070         ScrollingList *invList;
00071         char **pcInvText;
00072 
00073         // spell ui
00074         Button *castButton, *storeSpellButton;
00075         ScrollingList *schoolList;
00076         ScrollingList *spellList;
00077         Label *spellDescriptionLabel;
00078         char **schoolText;
00079         char **spellText;
00080         GLuint *spellIcons;
00081 
00082         // character info screen
00083         Label *nameAndClassLabel, *levelLabel, *hpLabel, *mpLabel;
00084         Label *thirstLabel, *hungerLabel, *skillLabel, *armorLabel;     
00085         //int stateCount;
00086         char **stateLine, **skillLine;
00087         GLuint *icons;
00088   char **protStateLine;
00089         GLuint *protIcons;
00090         ScrollingList *stateList, *skillList, *protStateList;
00091         char nameAndClassStr[80];
00092         char levelStr[80];
00093         char expStr[80];
00094         char hpStr[80];
00095         char mpStr[80];
00096         char thirstStr[80];
00097         char hungerStr[80];
00098         char skillModStr[80];
00099         char skillsStr[80];
00100         char armorStr[80];
00101         Canvas *attrCanvas;
00102 
00103         // mission
00104         char missionText[3000];
00105         ScrollingLabel *missionDescriptionLabel;
00106         Button *missionButton;
00107         ScrollingList *objectiveList;
00108         char **objectiveText;
00109         Color *missionColor, *itemColor;
00110   GLuint *itemIcon;
00111   Spell *storeSpell;
00112 
00113   // party
00114   char **formationText;
00115   ScrollingList *formationList;
00116   Button *layoutButton1, *layoutButton2, *layoutButton4;
00117 
00118 public:
00119     Inventory(Scourge *scourge);
00120         ~Inventory();
00121 
00122   inline bool inStoreSpellMode() { return storeSpellButton->isSelected(); }
00123   inline void setStoreSpellMode( bool b ) { storeSpellButton->setSelected( b ); if( !b ) storeSpell = NULL; }
00124   inline Spell *getStoreSpell() { return storeSpell; }
00125 
00126   void positionWindow();
00127   void show(bool animate=true);
00128         inline void hide() { mainWin->setVisible(false); }
00129         inline bool isVisible() { return mainWin->isVisible(); }
00130   inline Window *getWindow() { return mainWin; }
00131     bool handleEvent(SDL_Event *event);
00132         bool handleEvent(Widget *widget, SDL_Event *event);
00133     //void drawInventory();
00134         void refresh(int player=-1);
00135 
00136         // drag-n-drop
00137         void receive(Widget *widget);
00138         bool startDrag(Widget *widget, int x=0, int y=0);
00139 
00140         void drawWidget(Widget *w);
00141 
00142   void showSpells();
00143   void showSkills();
00144 
00145 protected:
00146         void setSelectedPlayerAndMode(int player, int mode);
00147         void moveItemTo(int playerIndex);
00148         void dropItem();
00149   // returns item's index in inventory or -1 if inv. was full
00150   int putItem();
00151   void equipItem();
00152         void showMemorizedSpellsInSchool(Creature *creature, MagicSchool *school);
00153         void showSpellDescription(Spell *spell);
00154         Spell *getSelectedSpell();
00155 };
00156 
00157 #endif

Generated on Thu Jun 16 21:50:43 2005 for scourge by  doxygen 1.4.0