1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
// Description:
// Our Hero!
//
// Copyright (C) 2001 Frank Becker
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
//
#ifndef _Hero_hpp_
#define _Hero_hpp_
#include <Singleton.hpp>
#include <Model.hpp>
#include <Direction.hpp>
#include <ParticleType.hpp>
#include <Skill.hpp>
class Weapon;
class Hero: public ParticleType
{
friend class Singleton<Hero>;
public:
enum MountedWeapon
{
PRIMARY_WEAPON,
SECONDARY_WEAPON,
TERTIARY_WEAPON,
MAX_WEAPONS
};
bool init( void);
void reset( void);
virtual void init( ParticleInfo *p);
virtual bool update( ParticleInfo *p);
virtual void hit( ParticleInfo *p, int damage, int /*radIndex*/);
virtual void draw( ParticleInfo *){ /* not used, see other draw */; }
virtual void draw( void);
void drawWeapon( unsigned int weapNum);
void move( float dx, float dy);
void move( Direction::DirectionEnum d, bool isDown);
void allowVerticalMovement(bool allow);
bool weaponLoaded( int weapNum);
void weaponFire( bool isDown, int weapNum=0);
bool alive( void)
{
return _isAlive;
}
void alive( bool a)
{
_isAlive = a;
}
void addEnergy( int val);
void addShield( int val);
float getEnergy( void)
{
return (float)_energy;
}
float getShieldEnergy( void)
{
return (float)_shieldEnergy;
}
float getWeaponEnergy( void)
{
return _weaponEnergy;
}
void setArmorPierce( float damageMultiplier);
float getArmorPierce( void)
{
return _damageMultiplier;
}
void upgradeWeapons( void);
void assignWeapons( Skill::SkillEnum skill);
float lastXPos;
float lastYPos;
private:
virtual ~Hero();
Hero( void);
Hero( const Hero&);
Hero &operator=(const Hero&);
void spawnSparks( int spawnCount, float r, ParticleInfo &pi);
Model *_model;
ParticleInfo *pInfo;
float _moveLeft;
float _moveRight;
float _moveUp;
float _moveDown;
float _maxY;
bool _isAlive;
int _energy;
int _shieldEnergy;
float _weaponEnergy;
float _weaponReload[ MAX_WEAPONS];
bool _weaponAutofire[ MAX_WEAPONS];
Weapon *_weapon[ MAX_WEAPONS];
int _weaponAmmo[ MAX_WEAPONS];
float _damageMultiplier;
bool _autofireOn;
float _sint[360];
float _cost[360];
};
typedef Singleton<Hero> HeroS;
#endif
|