Mirai's Miscellaneous Misadventures

M36 / include / mimimi / sprites.h

1// copyright 2022 zamfofex
2// license: AGPLv3 or later
3
4#ifndef MIMIMI_SPRITES_H
5#define MIMIMI_SPRITES_H
6
7struct mimimi_behavior;
8struct mimimi_allocator;
9struct mimimi_ground;
10struct mimimi_position;
11
12struct mimimi_physics
13{
14	int dx, dy;
15	unsigned char airborne;
16	int width, height;
17	int gravity;
18};
19
20struct mimimi_life
21{
22	int knocked_time;
23	int immunity_time;
24	int pristinity;
25	int max_pristinity;
26	int recovery_time;
27};
28
29struct mimimi_fall
30{
31	int max_speed;
32	int knocked_time;
33};
34
35struct mimimi_walk
36{
37	int ground_speed;
38	int airborne_speed;
39	int direction;
40};
41
42struct mimimi_jump
43{
44	int strength;
45};
46
47struct mimimi_dash
48{
49	int x_strength;
50	int y_strength;
51};
52
53struct mimimi_path_finding
54{
55	struct mimimi_ground *ground;
56	struct mimimi_position *target;
57	struct mimimi_sprite *sprite;
58	struct mimimi_jump *jump;
59	struct mimimi_behavior *jump_behavior;
60	int radius;
61};
62
63struct mimimi_sprite
64{
65	struct mimimi_position *position;
66	struct mimimi_physics *physics;
67	struct mimimi_life *life;
68	struct mimimi_fall *fall;
69	struct mimimi_walk *walk;
70	struct mimimi_behavior *behavior;
71	unsigned char awake;
72};
73
74struct mimimi_behavior *mimimi_physics(struct mimimi_physics *physics, struct mimimi_position *position, struct mimimi_ground *ground, struct mimimi_allocator *allocator);
75struct mimimi_behavior *mimimi_collision_physics(struct mimimi_physics *physics, struct mimimi_position *position, struct mimimi_ground *ground, struct mimimi_allocator *allocator);
76struct mimimi_behavior *mimimi_dynamics(struct mimimi_physics *physics, struct mimimi_position *position, struct mimimi_allocator *allocator);
77
78struct mimimi_behavior *mimimi_life(struct mimimi_life *life, struct mimimi_allocator *allocator);
79struct mimimi_behavior *mimimi_fall(struct mimimi_fall *fall, struct mimimi_physics *physics, struct mimimi_life *life, struct mimimi_allocator *allocator);
80struct mimimi_behavior *mimimi_walk(struct mimimi_walk *walk, struct mimimi_physics *physics, struct mimimi_allocator *allocator);
81
82struct mimimi_behavior *mimimi_positioned_physics(struct mimimi_physics *physics, struct mimimi_position *position, struct mimimi_ground *ground, struct mimimi_position *transform, struct mimimi_allocator *allocator);
83
84struct mimimi_behavior *mimimi_jump(struct mimimi_jump *jump, struct mimimi_physics *physics, struct mimimi_allocator *allocator);
85struct mimimi_behavior *mimimi_dash(struct mimimi_dash *dash, struct mimimi_physics *physics, struct mimimi_walk *walk, struct mimimi_allocator *allocator);
86
87struct mimimi_behavior *mimimi_find_path(struct mimimi_path_finding *path_finding, struct mimimi_ground *ground, struct mimimi_position *target, struct mimimi_sprite *sprite, struct mimimi_allocator *allocator);
88
89struct mimimi_behavior *mimimi_conveyor(struct mimimi_sprite *sprite, struct mimimi_ground *ground, unsigned char which, int speed, struct mimimi_allocator *allocator);
90struct mimimi_behavior *mimimi_trampoline(struct mimimi_sprite *sprite, struct mimimi_ground *ground, unsigned char which, int restitution, struct mimimi_allocator *allocator);
91
92#endif