57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
//---
|
|
// particles: Visual objects with no interactions
|
|
//---
|
|
|
|
#pragma once
|
|
|
|
#include "fixed.h"
|
|
#include "geometry.h"
|
|
#include "anim.h"
|
|
|
|
#include <gint/defs/types.h>
|
|
|
|
/* Particles with no interaction but visual effects */
|
|
typedef struct {
|
|
/* Particle type */
|
|
uint16_t type;
|
|
/* Time lived (milliseconds) */
|
|
uint16_t age;
|
|
/* Position on the map (used for sorting and layered rendering) */
|
|
fpoint_t pos;
|
|
|
|
} particle_t;
|
|
|
|
/* Particle types */
|
|
enum {
|
|
PARTICLE_DAMAGE = 0,
|
|
PARTICLE_DASH = 1,
|
|
};
|
|
|
|
/* Update time and layout for a particle (type-generic). */
|
|
bool particle_update(particle_t *p, fixed_t dt);
|
|
|
|
/* Render a particle through the map and camera. */
|
|
void particle_render(int x, int y, particle_t const *p);
|
|
|
|
//---
|
|
// Damage particles (text)
|
|
//---
|
|
|
|
/* Damage text particles */
|
|
typedef struct {
|
|
particle_t particle;
|
|
/* Damage value */
|
|
int damage;
|
|
/* Color (accepts C_RED; everything else is white) */
|
|
uint16_t color;
|
|
|
|
} particle_damage_t;
|
|
|
|
/* Dash trail particles */
|
|
typedef struct {
|
|
particle_t particle;
|
|
/* Source sprite */
|
|
anim_frame_t const *frame;
|
|
|
|
} particle_dash_t;
|