working multiplayer
This commit is contained in:
42
src/game.h
Normal file
42
src/game.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef GREMLIN_GAME_H
|
||||
#define GREMLIN_GAME_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef struct team_t team_t;
|
||||
typedef struct player_t player_t;
|
||||
typedef struct game_t game_t;
|
||||
|
||||
#define GAME_TEAM_COUNT 8
|
||||
#define GAME_PLAYER_COUNT 64
|
||||
|
||||
struct player_t {
|
||||
uint8_t id;
|
||||
uint8_t status;
|
||||
double x, y, z;
|
||||
double rx, ry, rz, rw;
|
||||
double vx, vy, vz;
|
||||
team_t *team;
|
||||
};
|
||||
|
||||
struct team_t {
|
||||
uint8_t id;
|
||||
double x, y, z;
|
||||
float color[4];
|
||||
};
|
||||
|
||||
struct game_t {
|
||||
team_t team[GAME_TEAM_COUNT];
|
||||
player_t player[GAME_PLAYER_COUNT];
|
||||
int32_t max_player_id;
|
||||
};
|
||||
|
||||
extern void game_setup(game_t *game);
|
||||
extern team_t *game_team_with_least_players(game_t *game);
|
||||
extern player_t *game_spawn_player(game_t *game, team_t *team);
|
||||
extern player_t *game_spawn_player_id(game_t *game, team_t *team, uint8_t id);
|
||||
extern team_t *game_team(game_t *game, uint8_t id);
|
||||
extern player_t *game_player(game_t *game, uint8_t id);
|
||||
extern void game_update_players(game_t *game, double dt);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user