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

monster.h

00001 /***************************************************************************
00002                           monster.h  -  description
00003                              -------------------
00004     begin                : Mon Jul 7 2003
00005     copyright            : (C) 2003 by Gabor Torok
00006     email                : cctorok@yahoo.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef MONSTER_H
00019 #define MONSTER_H
00020 
00021 #include <vector>
00022 #include <map>
00023 #include <stdio.h>
00024 #include "../constants.h"
00025 #include "rpgitem.h"
00026 #include "spell.h"
00027 
00032 using namespace std;
00033   
00034 class Monster  {
00035 
00036  private:
00037   char *type;
00038   char *descriptiveType;
00039   int hp;
00040   int mp;
00041   int level;
00042   char *model_name;
00043   char *skin_name;
00044   char description[300];
00045   int money;
00046   int speed;
00047   int baseArmor;
00048   int rareness;
00049   float scale;
00050   bool npc;
00051   char *portrait;
00052   GLuint portraitTexture;
00053   vector<RpgItem*> items;
00054   vector<Spell*> spells;
00055   map<string,int> skills;
00056 
00057   static map<int, vector<Monster*>* > monsters;
00058   static map<int, vector<string>*>* currentSoundMap;
00059   static vector<string> monsterTypes;
00060   static vector<Monster*> npcs;
00061   static map<string, string> modelToDescriptiveType;
00062 
00063 public:
00064   Monster(char *type, char *descriptiveType, int level, int hp, int mp, char *model, char *skin, int rareness, int speed, int baseArmor, float scale, bool npc, char *portrait);
00065   ~Monster();
00066 
00067   static map<string, map<int, vector<string>*>*> soundMap;
00068   static map<string, Monster*> npcPos;
00069   static map<string, Monster*> monstersByName;  
00070 
00071   inline float getScale() { return scale; }
00072   inline int getBaseArmor() { return baseArmor; }
00073   inline int getRareness() { return rareness; }
00074   inline int getSpeed() { return speed; }
00075   inline char *getType() { return type; };
00076   inline static char *getDescriptiveType( char *modelName ) {
00077     string modelStr = modelName;
00078     if( modelToDescriptiveType.find( modelStr ) == modelToDescriptiveType.end() ) 
00079       return NULL;
00080     else return (char*)( modelToDescriptiveType[ modelStr ].c_str() );
00081   }
00082   inline int getHp() { return hp; }  
00083   inline int getMp() { return mp; }  
00084   inline int getLevel() { return level; }  
00085   inline char *getModelName() { return model_name; }
00086   inline char *getSkinName() { return skin_name; }
00087   inline char *getDescription() { return description; }
00088   inline int getStartingItemCount() { return items.size(); }
00089   inline RpgItem *getStartingItem(int index) { return items[index]; }
00090   inline void addItem(RpgItem *item) { items.push_back(item); }
00091   inline int getStartingSpellCount() { return spells.size(); }
00092   inline Spell *getStartingSpell(int index) { return spells[index]; }
00093   inline void addSpell(Spell *spell) { spells.push_back(spell); }
00094   int getSkillLevel(const char *skillName);
00095   const char *getRandomSound(int type);
00096   inline bool isNpc() { return npc; }
00097   inline char *getPortrait() { return portrait; }
00098   inline GLuint getPortraitTexture() { return portraitTexture; }
00099   inline void setPortraitTexture( GLuint n ) { portraitTexture = n; }
00100 
00101   static void initMonsters();
00102   static Monster *getRandomMonster(int level);
00103   static Monster *getMonsterByName(char *name);  
00104   static map<int, vector<string>*>* getSoundMap( char *monsterType );
00105 
00112   static bool getIndexOrFindByIndex(Monster **monster, int *index);
00113 
00114   static const char *getRandomMonsterType( int level );
00115   static const char *getMonsterType(char *type);
00116   static const Monster *getRandomNpc();
00117 
00118  protected:
00119   static void addMd2Sounds( char *model_name, map<int, vector<string>*>* currentSoundMap );
00123   static void addSound( int type, char *line, map<int, vector<string>*>* currentSoundMap );
00124 
00125 };
00126 
00127 #endif

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