~ubuntu-branches/ubuntu/lucid/balder2d/lucid

« back to all changes in this revision

Viewing changes to include/probe.h

  • Committer: Bazaar Package Importer
  • Author(s): Bjørn Hansen
  • Date: 2006-10-14 15:33:42 UTC
  • Revision ID: james.westby@ubuntu.com-20061014153342-un0jglolcs01gcow
Tags: upstream-1.0~rc1
Import upstream version 1.0~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2004 by Bjorn Hansen                                    *
 
3
 *   holomorph@users.sourceforge.net                                       *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 *   This program is distributed in the hope that it will be useful,       *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
13
 *   GNU General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU General Public License     *
 
16
 *   along with this program; if not, write to the                         *
 
17
 *   Free Software Foundation, Inc.,                                       *
 
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
19
 ***************************************************************************/
 
20
 
 
21
#ifndef PROBE_H
 
22
#define PROBE_H
 
23
 
 
24
#define RECHARGE_FRAME_INTERVAL_ON 50
 
25
#define RECHARGE_FRAME_INTERVAL_OFF 3000
 
26
 
 
27
#include "../include/entity.h"
 
28
#include "../include/balder2dtypes.h"
 
29
#include <math.h>
 
30
 
 
31
namespace Balder{
 
32
const int PROBEWIDTH = 32;
 
33
const int PROBEHEIGHT = 32;
 
34
const int AMMOWIDTH = 4;
 
35
const int AMMOHEIGHT = 4;
 
36
const int MAXFRAME = 47; // 48 frames, starting at frame 0
 
37
const int HITFRAMES = 11;
 
38
const int SPAWNFRAMES = 30;
 
39
const int NO_ROT = 0;
 
40
const int LEFT_ROT = 1;
 
41
const int RIGHT_ROT = 2;
 
42
// pushOffState:
 
43
// 0 = not ready to push off, still it stick mode
 
44
// 1 = ready to push off, ie, have stuck to a wall and released the stick key
 
45
// 2 = pushing off, just waiting for the push(stick) key to be released again
 
46
enum {PUSH_NOT_READY, PUSH_READY, PUSH_POWERING};
 
47
 
 
48
class Projectile;
 
49
class PowerUp;
 
50
 
 
51
class Probe: public Entity {
 
52
  private:
 
53
          static const int MAXHITS;
 
54
          static const double MAXCHARGE;
 
55
          static const int RECHARGETIME;
 
56
          static const double RECHARGERATE;
 
57
          static const double MAXSPEED;
 
58
          static const double POWERUPTIME; //in frames
 
59
          static const double TURNINGSPEED;
 
60
  public:
 
61
    Probe(GameManager* , double x_position, double y_position,
 
62
        double x_velocity, double y_velocity, bool stuck, probe_color, player_id);
 
63
    void SetProbeState(double x_pos, double y_pos, double x_vel, double y_vel, bool stuck);
 
64
    void Move ( );
 
65
    bool Collide (Entity*);
 
66
    bool Collide (Probe*);
 
67
    bool Collide (Projectile*);
 
68
    bool Collide(PowerUp*);
 
69
    bool AddImpulse(double x_vel, double y_vel);
 
70
    void Die();
 
71
    void RotateRight ( bool  );
 
72
    void RotateLeft ( bool  );
 
73
    void Stick ( bool  );
 
74
    void PushOff (  );
 
75
    void Fire (  );
 
76
    const std::string GetType() const { return "probe";}
 
77
    const player_id GetOwner() const {return owner;}
 
78
    virtual SDL_Rect* GetFrame (  );
 
79
    virtual void DrawOnto(SDL_Surface*);
 
80
    const double GetRotationAngle() const { return facing_angle; }
 
81
    // stat stuff
 
82
    const probe_color GetProbeColor() const { return color;}
 
83
    const int GetLife() const {return life_remaining;}
 
84
    const int GetCharge()const {return (int)charge_remaining;}
 
85
    const double GetPushOffSpeed()const {return pushOffSpeed;}
 
86
    const double GetMAXSPEED()const {return MAXSPEED;}
 
87
    const bool GetStuckStatus() const {return stuck;}
 
88
    const int GetDeaths(){return deaths;}
 
89
    void Remove();
 
90
  private:
 
91
    void DrawAmmo(SDL_Surface*);
 
92
    float charge_remaining;
 
93
    int life_remaining;
 
94
    float shield_power;
 
95
    double facing_angle;
 
96
    bool stick;
 
97
    bool stuck;
 
98
    short int pushOffState;
 
99
    double pushOffSpeed;
 
100
    int rotation_state;
 
101
    double x_vel_add;
 
102
    double y_vel_add;
 
103
    int death_frame;
 
104
    int hit_frame;
 
105
    int spawn_frame;
 
106
    double ammo_angle;
 
107
    int startRechargeMSec;
 
108
    int currentRechargeMSec;
 
109
    int rechargeFrameInterval;
 
110
    bool rechargeFrameOn;
 
111
    probe_color color;
 
112
        player_id owner;
 
113
        int powerups;
 
114
        int deaths;
 
115
        bool removeFromGame;
 
116
private:
 
117
    void Destroy();
 
118
    void Spawn();
 
119
};
 
120
 
 
121
}
 
122
#endif