/****************************************************************
GALAXIANS (V1.0), BY AHARON HILLEL.
gcc version 3.2 (mingw special 20020817-1)
ALLEGRO VERSION: 4.1.12 (WIP)
ALLEGRO DATE: 2003-11-10
****************************************************************/
#include "base.h"
/***********************************************
PLACE ALL CLASSES THAT ARE USED BY GLAXIANS
GAME IN THIS FILE.
***********************************************/
#if !defined( _GALAXY_H_ )
#define _GALAXY_H_
#define GAL_GALAXY_FORMATION_Y_START 80
#define GALVADERS_GALAXY_FORMATION_Y_START 80
#define GALAXY_W 48
#define GALAXY_H 30
#define GALAXY_COLS 10
#define GALAXY_ROWS 6
#define GAL_GALVADERS_ROWS 5 // For galvaders game.
#define GALAXY_FIRST_RAW_SPRITE 50
#define GALAXY_INC_ROW_SPRITE 11
#define GALAXY_PLAYER_BULLET_SPEED -8
#define GALAXY_ATTACK_MODE_ROTATE_BACK 1
#define GALAXY_ATTACK_MODE_BACK_HOME 2
#define GALAXY_ATTACK_MODE_ATTACKING 3
/******* START - SPRITES ATTACK STATES **********
Attack states
---------------
X,Y
0,0 - up left (2)
0,1 - up left (2)
0,2 - just left (3)
0,3 - down left wing open. (9)
0,4 - down left wing open. (9)
1,0 - up left (2)
1,1 - up left (2)
1,2 - just left (3)
1,3 - down left (4)
1,4 - down left wing open. (9)
2,0 - up wings open. (0)
2,1 - up (1)
2,2 - Just down (natural state) (5)
2,3 - down (natural state) (5)
2,4 - down (natural state) (5)
3,0 - up right (8)
3,1 - up right (8)
3,2 - just right (7)
3,3 - down right (6)
3,4 - down right wing open (10)
4,0 - up right (8)
4,1 - up right (8)
4,2 - just right (7)
4,3 - down right wing open (10)
4,4 - down right wing open (10)
******** END - SPRITES ATTACK STATES **********/
struct st_attack_move_type
{
int x;
int y;
int times;
};
typedef st_attack_move_type st_attack_move;
typedef vector<st_attack_move> attack_moves;
struct st_attack_item_type
{
st_item *item;
int state_before_attack;
int base_index;
int bonus;
};
typedef struct st_attack_item_type st_attack_item;
class gal_attack
{
public:
static int attacks; // Count how many instances.
static int states[5][5]; // Contains states for sprite.
static int home_rotation_states[12];
inline static void set_player_half_width(int value) { player_half_width = value; };
inline static void set_lowest_y_shooting_point(int value) { lowest_y_shooting_point = value; };
gal_attack(st_item **attack_sprites, unsigned int f_min, unsigned int f_max, int n);
~gal_attack();
void build_attack_script(int exit_from_formation);
void remove(void);
void draw(void);
void do_attack(void);
inline int get_attack_mode(void) { return mode; };
private:
static int player_half_width;
static int lowest_y_shooting_point;
attack_moves moves;
attack_moves::iterator iter;
int n_moves;
int times;
int base_counter;
int home_rotation_state;
unsigned int frame_rate_min;
unsigned int frame_rate_max;
st_attack_item *items; // Attacking items.
int n_items; // How many of them
int mode; // Attack mode: attacking,way back to formation, or rotating.
unsigned int frame_rate;
unsigned int frame_counter;
int fire_rate;
int fire_counter;
int leftmost_x;
int top_y;
};
typedef list<class gal_attack *> attack_list;
extern attack_list gal_attack_list;
class gal_formation : public formation
{
private:
const int level;
int attack_counter;
int max_attacks;
unsigned int attack_min_speed;
unsigned int attack_max_speed;
int wave_counter;
int wave_rate;
int attack_row[2];
unsigned int frame_rate_n_items[3];
unsigned int frame_rate_index;
public:
static st_bullet_params bullet_params;
static st_pixel bullet_test_pixles[];
static st_colors bullet_test_colors;
gal_formation(const int l, const st_formation_param &p);
inline int get_max_attacks(void) { return max_attacks; };
inline int get_level(void) { return level; };
void action();
~gal_formation();
};
class gal_formation *create_galaxian_formation(unsigned char game_type, int level, RLE_SPRITE **dt, int index, BITMAP *dst);
struct st_star_type
{
int x;
int y;
int color;
int next_inc_color;
int visible;
unsigned int frame;
};
typedef struct st_star_type st_star;
class stars
{
private:
BITMAP *dest;
st_star *stars_info;
int n_stars;
int x_min;
int x_max;
int y_min;
int y_max;
unsigned int frames_show;
unsigned int frames_blank;
int *colors;
int n_colors;
int inc_color_every;
int y_inc;
int visible;
st_star *create_stars(void);
public:
stars();
stars(BITMAP *d_bmp, int n, int x_low, int y_low, int x_high, int y_high, int y_speed, int f_show, int f_blank, int color, int d);
stars(BITMAP *d_bmp, int n, int x_low, int y_low, int x_high, int y_high, int y_speed, int f_show, int f_blank, int *col, int n_col, int col_s, int d);
stars(const class stars &other);
void remove(void);
void draw(void);
void move(void);
~stars();
};
#endif // _GALAXY_H_
|