1
/***************************************************************************
2
* Copyright (C) 2004 by Bjorn Hansen *
3
* holomorph@users.sourceforge.net *
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. *
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. *
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
***************************************************************************/
24
#define RECHARGE_FRAME_INTERVAL_ON 50
25
#define RECHARGE_FRAME_INTERVAL_OFF 3000
27
#include "../include/entity.h"
28
#include "../include/balder2dtypes.h"
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;
40
const int LEFT_ROT = 1;
41
const int RIGHT_ROT = 2;
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};
51
class Probe: public Entity {
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;
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);
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);
71
void RotateRight ( bool );
72
void RotateLeft ( bool );
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; }
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;}
91
void DrawAmmo(SDL_Surface*);
92
float charge_remaining;
98
short int pushOffState;
107
int startRechargeMSec;
108
int currentRechargeMSec;
109
int rechargeFrameInterval;
110
bool rechargeFrameOn;