summaryrefslogtreecommitdiff
path: root/lib/snapshot.h
diff options
context:
space:
mode:
authorJoel Stålnacke <joel@saker.fi>2026-03-20 21:38:46 +0200
committerJoel Stålnacke <joel@saker.fi>2026-03-20 21:38:46 +0200
commit3870982f640260822bf605e693782ce9f5d79cf6 (patch)
tree29cba57f08ae2d0ea32968cba49b1c4e6f69987f /lib/snapshot.h
parent745406dc65aecc438a53f96badc387a32b7a338f (diff)
Get a player drawing on screenHEADmibomaster
Diffstat (limited to 'lib/snapshot.h')
-rw-r--r--lib/snapshot.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/snapshot.h b/lib/snapshot.h
index 022d989..028eac2 100644
--- a/lib/snapshot.h
+++ b/lib/snapshot.h
@@ -11,7 +11,6 @@ enum {
struct player {
uint8_t state;
uint8_t input;
- char pad[2];
vec2 pos;
vec2 vel;
};
@@ -25,15 +24,20 @@ struct ball {
struct snapshot {
char active;
uint32_t tick;
- struct player players[WORLD_MAX_PLAYERS];
- struct ball balls[WORLD_MAX_BULLETS];
+ int32_t players_len;
+ struct player *players;
+ int32_t balls_len;
+ struct ball *balls;
};
-int dp_snapshot_put_player(struct snapshot *, uint32_t id, const struct player *);
-struct player *dp_snapshot_get_player(struct snapshot *, uint32_t id);
-int dp_snapshot_remove_player(struct snapshot *, uint32_t id);
-int dp_snapshot_set_player_input(struct snapshot *, uint32_t id, uint8_t input);
+int dp_snapshot_init(struct snapshot *, int32_t players_len, int32_t balls_len);
+void dp_snapshot_deinit(struct snapshot *);
-int dp_snapshot_put_ball(struct snapshot *, uint32_t id, const struct ball *);
-struct ball *dp_snapshot_get_ball(struct snapshot *, uint32_t id);
-int dp_snapshot_remove_ball(struct snapshot *, uint32_t id);
+int dp_snapshot_put_player(struct snapshot *, int32_t id, const struct player *);
+struct player *dp_snapshot_get_player(struct snapshot *, int32_t id);
+int dp_snapshot_remove_player(struct snapshot *, int32_t id);
+int dp_snapshot_set_player_input(struct snapshot *, int32_t id, uint8_t input);
+
+int dp_snapshot_put_ball(struct snapshot *, int32_t id, const struct ball *);
+struct ball *dp_snapshot_get_ball(struct snapshot *, int32_t id);
+int dp_snapshot_remove_ball(struct snapshot *, int32_t id);