view Character.h @ 70:cee55c8365e9 default tip

fix
author Kazuma
date Thu, 19 May 2016 18:52:26 +0900
parents 2c85322348cf
children 3acdeb3dc3e8
line wrap: on
line source

#include "bool.h"

#ifndef CHARACTER_h
#define CHARACTER_h 1

/*state id*/
#define ALIVE 0
#define EXPLODE 1
#define DELETE 2

/*group id*/
#define MYSHIP 0
#define MYBULLET 1
#define ENEMY 2
#define ENEMYBULLET 3

#define FIX_NUM 17

//typedef void (*STATE)(CHARACTER *p);
typedef struct CHARACTER * (*State)(struct CHARACTER *p);
typedef struct CHARACTER * (*Collision)(struct CHARACTER *p);

typedef struct enemy_status {
  int charano;                 // sprite image number
  int sc;                     // score
  int p;                      // hardness
} table;


typedef struct CHARACTER{
  float x; //position
  float y;
 
  float vx; //velocity
  float vy;

  float vit; //vitality
  int score;
  int dt1;
  int dt2;
  int charano; //sprite_number
  BOOL tama; //bullet identifier
  BOOL f; //apiarance idenfifier
  float s;
  //int group;  
  int chara_id;
  int task;

  State state;
  Collision collision;
  struct CHARACTER *next;
  struct CHARACTER *prev;

} CHARACTER;


extern CHARACTER *active_chara_list;
extern CHARACTER *free_chara_list;
extern CHARACTER *kyeenemyno;
extern CHARACTER *tekino0;
extern CHARACTER *enemy_part1;
extern CHARACTER *enemy_part2;
extern CHARACTER *enemy_part3;
extern CHARACTER *enemy_part4;
extern CHARACTER *enemy_part5;

extern int filpcount;
extern int stage;
//extern teki enemy[300];
extern const table enemystate[50];

int init_chara_list(int num);
int extend_chara_list_pool(int num);
void TFon();
void TFoff();
void Putenemy(int charano, float x, float y, float vx, float vy,
	      CHARACTER * (*action)(CHARACTER *chara));
CHARACTER * delete_chara(CHARACTER *p);
void state_update();
void collision_detect();
void obj_draw();
void outofwindow();

#define ENEMY_STATUS(id,charno,score,hardness) {charno,score,hardness}

/**
 * enemyの種類一覧
 */
#define ENEMY_STATUS_TABLE {\
      ENEMY_STATUS(UNUSED0,			0, 0, 0),\
      ENEMY_STATUS(ID_GREENCRAB,		ENEMY_GREENCRAB,	330, 98),\
      ENEMY_STATUS(ID_PLANE,			ENEMY_PLANE,		470, 37),\
      ENEMY_STATUS(ID_REDBULLET,		ENEMY_REDBULLET,	30, 16),\
      ENEMY_STATUS(ID_BOSS1ORGAN,		BOSS1_ORGAN,		25000, 10000),\
      ENEMY_STATUS(ID_BOSS1SIDEPARTS,		BOSS1_ORGAN,		10000, 10000),\
      ENEMY_STATUS(ID_BLUEBULLET,		ENEMY_BLUEBULLET,	40, 39),\
      ENEMY_STATUS(ID_LASER,			ENEMY_LASER,		100, 100000),\
      ENEMY_STATUS(ID_LIGHTNING,		ENEMY_LIGHTNING,	100, 100000),\
      ENEMY_STATUS(ID_ASTEROID,			ASTEROID,		170, 500),\
      ENEMY_STATUS(ID_ASTEROIDID_BOSS2BODY,	BOSS2_BODY,		100, 500),\
      ENEMY_STATUS(ID_BOSS2LEFTSHOULDER,	BOSS2_LEFTSHOULDER,	10000, 12000),\
      ENEMY_STATUS(ID_BOSS2RIGHTSHOULDER,	BOSS2_RIGHTSHOULDER,	10000, 12000),\
      ENEMY_STATUS(ID_BOSS2RIGHTARM,		BOSS2_RIGHTARM,		5000, 15000),\
      ENEMY_STATUS(ID_BOSS2LEFTARM,		BOSS2_LEFTARM,		5000, 15000),\
      ENEMY_STATUS(ID_BOSS2BATTERY,		BOSS2_BATTERY,		10000, 5000),\
      ENEMY_STATUS(ID_BOSS2OPENBATTERY,		BOSS2_OPENBATTERY,	10000, 5000),\
      ENEMY_STATUS(ID_BOSS2BROKENHATCH,		BOSS2_BROKENHATCH,	100, 500),\
      ENEMY_STATUS(ID_BOSS2DUMMY,		BOSS2_DUMMY,		50000, 15000),\
      ENEMY_STATUS(ID_BOSS2RIGHTSHOULDERUP,	BOSS2_RIGHTSHOULDERUP,	10000, 20000),\
      ENEMY_STATUS(ID_BOSS2LEFTSHOULDERUP,	BOSS2_LEFTSHOULDERUP,	10000, 15000),\
      ENEMY_STATUS(ID_BOSS2LEFTSHOULDERGIRD,	BOSS2_LEFTSHOULDERGIRD,	100, 20000),\
      ENEMY_STATUS(ID_BOSS2RIGHTARMBATTERY,	BOSS2_RIGHTARMBATTERY,	100, 500),\
      ENEMY_STATUS(ID_BOSS2LEFTARMBATTERY,	BOSS2_LEFTARMBATTERY,	100, 500),\
      ENEMY_STATUS(ID_ORBIT,			ORBITMACHINE,		20, 1000000),\
      ENEMY_STATUS(UNUSED1,			0, 0, 0),\
      ENEMY_STATUS(UNUSED2,			0, 0, 0),\
      ENEMY_STATUS(UNUSED3,			0, 0, 0),\
      ENEMY_STATUS(UNUSED4,			0, 0, 0),\
      ENEMY_STATUS(UNUSED5,			0, 0, 0),\
      ENEMY_STATUS(ID_BLACK_HOLE,		BLACKHOLE,		200000, 30000),\
      ENEMY_STATUS(UNUSED6,			0, 0, 0),\
      ENEMY_STATUS(UNUSED7,			0, 0, 0),\
      ENEMY_STATUS(UNUSED8,			0, 0, 0),\
      ENEMY_STATUS(UNUSED9,			0, 0, 0),\
      ENEMY_STATUS(UNUSED10,			0, 0, 0),\
      ENEMY_STATUS(UNUSED11,			0, 0, 0),\
      ENEMY_STATUS(UNUSED12,			0, 0, 0),\
      ENEMY_STATUS(UNUSED13,			0, 0, 0),\
      ENEMY_STATUS(UNUSED14,			0, 0, 0),\
      ENEMY_STATUS(ID_GUN_BATTERY,		GUNBATTERY,		540, 137),\
      ENEMY_STATUS(ID_PURPLE_CORE,		PURPLECORE,		840, 287),\
      ENEMY_STATUS(ID_SPACE_FISH,		SPACEFISH,		370, 137),\
      ENEMY_STATUS(ID_AUTOMISSILE,		MISSILE,		210, 24),\
      ENEMY_STATUS(ID_BOSS3,			BOSS3_BODY,		100000, 9600),\
      ENEMY_STATUS(UNUSED15,			0, 0, 0),\
      ENEMY_STATUS(UNUSED16,			0, 0, 0),\
      ENEMY_STATUS(UNUSED17,			0, 0, 0),\
      ENEMY_STATUS(UNUSED18,			0, 0, 0),\
      ENEMY_STATUS(ID_BOSS4,			BODD4_BODY,		300000, 20400)\
}

//#define ENEMY_STATUS(id,charno,score,hardness) id
//typedef enum ENEMY_STATUS EnemyId;
#endif