Schrift fest in Firmware eingebacken, damit die auch funktioniert, wenn auf dem
[hackover2013-badge-firmware.git] / badge / jumpnrun / moveable.h
1 #ifndef INCLUDED_BADGE_JUMPNRUN_MOVEABLE_H
2 #define INCLUDED_BADGE_JUMPNRUN_MOVEABLE_H
3
4 #include "../util/util.h"
5 #include <stdint.h>
6
7 enum {
8 // Do not collide with JUMPNRUN_ENEMY_* and JUMPNRUN_PLAYER_* flags.
9 JUMPNRUN_MOVEABLE_TOUCHING_GROUND = 1,
10 JUMPNRUN_MOVEABLE_MIRRORED = 2,
11 JUMPNRUN_MOVEABLE_DYING = 4
12 };
13
14 enum {
15 JUMPNRUN_SPLOSION_FRAMES = 4,
16 JUMPNRUN_SPLOSION_TICKS_PER_FRAME = 15
17 };
18
19 typedef struct jumpnrun_moveable {
20 rectangle hitbox;
21 vec2d inertia;
22
23 uint8_t tick_minor;
24 uint8_t anim_frame;
25
26 uint8_t flags;
27 uint8_t jumpable_frames;
28 } jumpnrun_moveable;
29
30 static inline bool jumpnrun_moveable_touching_ground(jumpnrun_moveable const *self) { return self->flags & JUMPNRUN_MOVEABLE_TOUCHING_GROUND; }
31 static inline bool jumpnrun_moveable_mirrored (jumpnrun_moveable const *self) { return self->flags & JUMPNRUN_MOVEABLE_MIRRORED ; }
32 static inline bool jumpnrun_moveable_dying (jumpnrun_moveable const *self) { return self->flags & JUMPNRUN_MOVEABLE_DYING ; }
33
34 static inline bool jumpnrun_moveable_finished_dying (jumpnrun_moveable const *self) { return jumpnrun_moveable_dying(self) && self->tick_minor >= JUMPNRUN_SPLOSION_FRAMES * JUMPNRUN_SPLOSION_TICKS_PER_FRAME; }
35
36 #endif
This page took 0.052706 seconds and 5 git commands to generate.