Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

players_common.h

00001 #ifndef DEF_PLAYERS_COMMON_H 00002 #define DEF_PLAYERS_COMMON_H 1 00003 00004 #include "characters_common.h" 00005 00006 #define MAX_ITEMS 3 00007 00008 //Player states 00009 //movement (while up/down/left/right key is pressed) 00010 #define STATE_MLEFT 0x00000400 00011 #define STATE_MRIGHT 0x00000800 00012 #define STATE_MUP 0x00001000 00013 #define STATE_MDOWN 0x00002000 00014 00018 class Player : public Character { 00019 public: 00020 Player(Sint16 xpos=0, Sint16 ypos=0, const ParameterMap& param=ParameterMap()); 00021 virtual ~Player(); 00022 static ParameterMap default_parameters; 00024 00025 00026 Frame getIcon() const; 00029 Uint8 getItemNum() { 00030 return currentitem; 00031 } 00032 Item* getItem(Uint8 num) { 00033 if (num<MAX_ITEMS) return items[num]; 00034 else return NULL; 00035 } 00039 bool pickupItem(Item* newitem); 00042 Item* moveItem() { 00043 return moveItem(currentitem); 00044 } 00046 void removeItem() { 00047 removeItem(currentitem); 00048 } 00052 void switchItem(bool right=true); 00054 Object* dropItem() { 00055 return dropItem(currentitem); 00056 } 00058 //VIRTUAL METHODS 00060 virtual void updateAnimState(); 00061 virtual void idle(Uint16); 00062 virtual void fall(Uint16); 00063 virtual Uint16 hit(Uint16 direction, Weapon& weap); 00066 virtual void clearStates(bool reset=false); 00067 virtual void setEvent(Event* ev); 00069 //Input methods 00071 00072 virtual void in_right() { } 00073 virtual void in_right(Uint16); 00075 virtual void in_left() { } 00076 virtual void in_left(Uint16); 00078 virtual void in_up() { } 00079 virtual void in_up(Uint16) { } 00081 virtual void in_down() { } 00082 virtual void in_down(Uint16) { } 00084 virtual void in_sp1() { } 00086 virtual void in_sp2() { } 00090 virtual void in_act(); 00092 virtual void in_use(); 00094 protected: 00096 virtual void addTouch(std::set<Object *>&); 00100 virtual void addEnter(std::set<Object *>&); 00101 virtual void removeTouch(std::set<Object *>&); 00102 virtual void removeEnter(std::set<Object *>&); 00104 00105 void removeItem(Uint8 num); 00106 Item* moveItem(Uint8 num); 00107 Object* dropItem(Uint8 num); 00109 00110 00111 00112 00113 virtual void crash(Uint16 dir=DIR_DOWN); 00115 virtual void die(); 00116 virtual Hit move(Uint16 dt, bool check=false); 00118 Item* items[MAX_ITEMS]; 00119 Uint8 currentitem; 00121 00122 Mix_Chunk* au_hit; 00123 Mix_Chunk* au_land; 00124 Mix_Chunk* au_act; 00125 Mix_Chunk* au_useerror; 00126 Mix_Chunk* au_newitem; 00127 Mix_Chunk* au_die; 00128 Mix_Chunk* au_elec; 00129 Mix_Chunk* au_drown; 00130 Mix_Chunk* au_fire; 00131 Mix_Chunk* au_heal; 00133 00134 EmptyAnimationPtr anim_left; 00135 EmptyAnimationPtr anim_right; 00136 EmptyAnimationPtr anim_rock_left; 00137 EmptyAnimationPtr anim_rock_right; 00138 EmptyAnimationPtr anim_walk_left; 00139 EmptyAnimationPtr anim_walk_right; 00140 EmptyAnimationPtr anim_push_left; 00141 EmptyAnimationPtr anim_push_right; 00142 EmptyAnimationPtr anim_fall_left; 00143 EmptyAnimationPtr anim_fall_right; 00144 EmptyAnimationPtr anim_fall_fast_left; 00145 EmptyAnimationPtr anim_fall_fast_right; 00146 EmptyAnimationPtr anim_crash_left; 00147 EmptyAnimationPtr anim_crash_right; 00148 EmptyAnimationPtr anim_rope_left; 00149 EmptyAnimationPtr anim_rope_right; 00150 EmptyAnimationPtr anim_teleport_left; 00151 EmptyAnimationPtr anim_teleport_right; 00152 EmptyAnimationPtr anim_die_crash_left; 00153 EmptyAnimationPtr anim_die_crash_right; 00154 EmptyAnimationPtr anim_die_burn_left; 00155 EmptyAnimationPtr anim_die_burn_right; 00156 EmptyAnimationPtr anim_die_bones_left; 00157 EmptyAnimationPtr anim_die_bones_right; 00158 EmptyAnimationPtr anim_die_elec_left; 00159 EmptyAnimationPtr anim_die_elec_right; 00160 EmptyAnimationPtr anim_die_spike_left; 00161 EmptyAnimationPtr anim_die_spike_right; 00162 EmptyAnimationPtr anim_die_water_left; 00163 EmptyAnimationPtr anim_die_water_right; 00164 EmptyAnimationPtr anim_fall_middle; 00165 EmptyAnimationPtr anim_climb; 00166 EmptyAnimationPtr anim_bar; 00168 }; 00169 00170 00176 class DeadPlayer : public Character { 00177 public: 00178 DeadPlayer(Sint16 xcord=0, Sint16 ycord=0, const ParameterMap& param=ParameterMap()); 00179 virtual ~DeadPlayer(); 00180 static ParameterMap default_parameters; 00181 }; 00182 00183 #endif

Generated on Sun Feb 5 13:02:35 2006 for Lost Penguins by doxygen 1.3.8