00001 #ifndef __OBJECTGUN_H
00002 #define __OBJECTGUN_H
00003
00004 class GunInterface
00005 {
00006 protected:
00007 Object* obj;
00008 FacingInterface* facing;
00009 ObjectInfo* missile_objinfo;
00010 float speed;
00011 int timer;
00012 int top_timer;
00013 int dir;
00014 void ResetCountdown();
00015 bool Countdown( int dt );
00016 bool Ready();
00017 void Fire();
00019 public:
00020 GunInterface( Object* _obj,
00021 FacingInterface* _facing,
00022 ObjectInfo* _missile_objinfo,
00023 float _speed,
00024 int _top_timer,
00025 int _dir ):
00026 obj( _obj ),
00027 facing( _facing ),
00028 missile_objinfo( _missile_objinfo ),
00029 speed( _speed ),
00030 timer( _top_timer ),
00031 top_timer( _top_timer ),
00032 dir( _dir ) {}
00033 virtual ~GunInterface() {}
00034
00035 virtual void Event( int evt ) {}
00036 virtual void HitTile( Tile* ) {}
00037 virtual void HitObj( Object* ) {}
00038 };
00039
00040 class GunPlayer: public GunInterface
00041 {
00042 private:
00043 int key_bits;
00044 int ammo;
00045 public:
00046 GunPlayer( Object* _obj,
00047 FacingInterface* _facing,
00048 ObjectInfo* _missile_objinfo,
00049 float _speed,
00050 int _top_timer,
00051 int _dir,
00052 int _key_bits ):
00053 GunInterface( _obj, _facing, _missile_objinfo,
00054 _speed, _top_timer, _dir ),
00055 key_bits( _key_bits ),
00056 ammo ( 0 )
00057 {}
00058 virtual ~GunPlayer() {}
00059 virtual void Event( int evt );
00060 int AmmoLeft();
00061 void GrantAmmo( int new_ammo );
00062 void SetAmmo( int new_ammo );
00063 };
00064
00065
00066
00067
00068
00069
00070
00071 class GunPeriodic: public GunInterface
00072 {
00073 public:
00074 GunPeriodic( Object* _obj,
00075 FacingInterface* _facing,
00076 ObjectInfo* _missile_objinfo,
00077 float _speed,
00078 int _dir,
00079 int _top_timer ):
00080 GunInterface( _obj, _facing, _missile_objinfo,
00081 _speed, _dir, _top_timer )
00082 {}
00083 virtual ~GunPeriodic() {}
00084 virtual void Event( int evt );
00085 };
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #endif