Initial commit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-08 01:30:33 -05:00
commit 2007fb7edc
200 files changed
+27710

No files matched your search

+102
View File
@@ -0,0 +1,102 @@
#pragma once
#include "anm2.h"
#include <vector>
struct Game;
// Describes a spray of square particles, fanned around angle by spread. Fill is how far their colour takes over their
// black middle.
struct Burst
{
float angle = 0;
float fill = 0;
float gravity = 0;
float life = 0.4f;
float size = 3;
float speed = 100;
float spread = PI;
int count = 8;
};
struct Particle
{
Color color;
Vec2 position;
Vec2 velocity;
float fill;
float gravity;
float life;
float lifeMax;
float size;
};
// Text that hops up from where it appears and fades, like damage numbers. Jitter shakes it, in pixels.
// Damage numbers also keep their value and which target they're over, so quick hits can add up.
struct Popup
{
Color color;
Vec2 position;
Vec2 velocity;
char text[16];
float jitter;
float life;
float scale;
int target;
int value;
};
// Damage dealt at a moment in game time, for the DPS readout.
struct Hit
{
float time = 0;
int amount = 0;
};
// A muzzle flash: a brief white star at the barrel, pointing along the shot.
struct Flash
{
Color color;
Vec2 position;
float angle = 0;
float life = 0;
float size = 0;
};
// A fading copy of a sprite left behind by something moving fast.
struct Afterimage
{
Pose pose;
float life = 0;
};
// Particles, afterimages, text popups, screen shake and the damage-per-second tally. While muted (during a
// rollback replay) it ignores new requests.
class Effects
{
public:
bool isMuted = false;
void burst(Burst burst, Vec2 position, float angle, Color color);
void afterimage_spawn(Pose pose);
void flash_spawn(Vec2 position, float angle, float size, Color color);
void afterimage_draw(Game& game);
void number_spawn(Vec2 position, int value, int target, Color color);
void dps_record(int amount);
float dps_get();
void popup_spawn(Vec2 position, const char* text, Color color);
void shake_add(float amount);
Vec2 shake_get();
void update();
void draw(Game& game);
void clear();
private:
std::vector<Afterimage> afterimages;
std::vector<Flash> flashes;
std::vector<Hit> hits;
std::vector<Particle> particles;
std::vector<Popup> popups;
float shake = 0;
int ticks = 0;
};