taisei/src/enemy.h
laochailan c811fa76e7 Fx/API/Particles
Bullet creation and death effects (don't know what is new in detail), improvements on the "API", especially around create_projectile() and extensive use of particles in addtion with generic particle/projectile movement and drawing rules (see projectile.h)
2011-05-21 15:02:19 +02:00

59 lines
No EOL
1.2 KiB
C

/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
*/
#ifndef ENEMY_H
#define ENEMY_H
#include "animation.h"
#include <complex.h>
#include "projectile.h"
#undef complex
#define complex double _Complex
#include <stdarg.h>
struct Enemy;
typedef void (*EnemyLogicRule)(struct Enemy*, int t);
typedef EnemyLogicRule EnemyDrawRule;
enum {
ENEMY_IMMUNE = -9000
};
typedef struct Enemy {
struct Enemy *next;
struct Enemy *prev;
complex pos;
complex pos0;
long birthtime;
int dir; // TODO: deprecate those
int moving;
EnemyLogicRule logic_rule;
EnemyDrawRule draw_rule;
int hp;
void *parent;
complex args[RULE_ARGC];
} Enemy;
#define create_enemyg(drule, lrule, pos, hp, par, args) (create_enemy(&global.enemies, drule, lrule, pos, hp, par, args))
void create_enemy(Enemy **enemies, EnemyDrawRule draw_rule, EnemyLogicRule logic_rule,
complex pos, int hp, void *parent, complex args, ...);
void delete_enemy(Enemy **enemies, Enemy* enemy);
void draw_enemies(Enemy *enemies);
void delete_enemies(Enemy **enemies);
void process_enemies(Enemy **enemies);
void Fairy(Enemy*, int t);
#endif