taisei/src/projectile.h

109 lines
3 KiB
C
Raw Normal View History

/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
2017-09-12 04:28:15 +03:00
* Copyright (c) 2011-2017, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2017, Andrei Alexeyev <akari@alienslab.net>.
*/
#ifndef PROJECTILE
#define PROJECTILE
#include "util.h"
#include "resource/texture.h"
2017-02-26 22:59:51 +02:00
#include "color.h"
#include <stdbool.h>
2017-02-07 20:34:55 +02:00
enum {
RULE_ARGC = 4
};
struct Projectile;
typedef int (*ProjRule)(struct Projectile *p, int t);
typedef void (*ProjDRule)(struct Projectile *p, int t);
2011-07-06 14:33:53 +02:00
typedef enum {
FairyProj,
DeadProj,
Particle,
PlrProj
} ProjType;
typedef struct Projectile {
struct Projectile *next;
struct Projectile *prev;
complex pos;
complex pos0;
long birthtime;
float angle;
ProjRule rule;
ProjDRule draw;
Texture *tex;
2011-07-06 14:33:53 +02:00
ProjType type;
2017-02-26 22:59:51 +02:00
Color clr;
complex args[RULE_ARGC];
2012-08-12 22:29:10 +03:00
int grazed;
2017-09-06 00:02:40 +03:00
int maxviewportdist;
} Projectile;
#define create_particle3c(n,p,c,d,r,a1,a2,a3) create_particle4c(n,p,c,d,r,a1,a2,a3,0)
#define create_particle2c(n,p,c,d,r,a1,a2) create_particle4c(n,p,c,d,r,a1,a2,0,0)
#define create_particle1c(n,p,c,d,r,a1) create_particle4c(n,p,c,d,r,a1,0,0,0)
#define create_projectile3c(n,p,c,r,a1,a2,a3) create_projectile4c(n,p,c,r,a1,a2,a3,0)
#define create_projectile2c(n,p,c,r,a1,a2) create_projectile4c(n,p,c,r,a1,a2,0,0)
#define create_projectile1c(n,p,c,r,a1) create_projectile4c(n,p,c,r,a1,0,0,0)
2017-02-26 22:59:51 +02:00
Projectile *create_particle4c(char *name, complex pos, Color clr, ProjDRule draw, ProjRule rule, complex a1, complex a2, complex a3, complex a4);
Projectile *create_projectile4c(char *name, complex pos, Color clr, ProjRule rule, complex a1, complex a2, complex a3, complex a4);
Projectile *create_projectile_p(Projectile **dest, Texture *tex, complex pos, Color clr, ProjDRule draw, ProjRule rule, complex a1, complex a2, complex a3, complex a4);
void delete_projectile(Projectile **dest, Projectile *proj);
void delete_projectiles(Projectile **dest);
void draw_projectiles(Projectile *projs);
2011-04-26 16:55:18 +02:00
int collision_projectile(Projectile *p);
void process_projectiles(Projectile **projs, bool collision);
Projectile *get_proj(Projectile *hay, int birthtime);
int linear(Projectile *p, int t);
int accelerated(Projectile *p, int t);
int asymptotic(Projectile *p, int t);
void ProjDraw(Projectile *p, int t);
2017-03-31 14:09:57 +02:00
void _ProjDraw(Projectile *p, int t);
void PartDraw(Projectile *p, int t);
2017-04-20 18:37:46 +02:00
void ProjDrawNoFlareAdd(Projectile *p, int t);
2012-07-18 23:12:31 +02:00
void ProjDrawAdd(Projectile *p, int t);
2012-07-25 15:32:37 +02:00
void ProjDrawSub(Projectile *p, int t);
2012-07-18 23:12:31 +02:00
void Blast(Projectile *p, int t);
void Shrink(Projectile *p, int t);
2012-08-01 17:32:11 +02:00
void ShrinkAdd(Projectile *p, int t);
void GrowFade(Projectile *p, int t);
2012-07-30 17:57:38 +02:00
void GrowFadeAdd(Projectile *p, int t);
int bullet_flare_move(Projectile *p, int t);
void Fade(Projectile *p, int t);
2012-08-01 17:32:11 +02:00
void FadeAdd(Projectile *p, int t);
int timeout(Projectile *p, int t);
void DeathShrink(Projectile *p, int t);
int timeout_linear(Projectile *p, int t);
2011-08-28 10:57:45 +02:00
void Petal(Projectile *p, int t);
void petal_explosion(int n, complex pos);
void projectiles_preload(void);
#endif