-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_mode.h
52 lines (38 loc) · 1.27 KB
/
game_mode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef GAME_MODE_H
#define GAME_MODE_H
#include "include/wasm3.h"
#include "game_modes/deps/drawing_api.h"
#include "minimal_state_info.h"
#include "hashmap.h"
#include "player_def.h"
#include "map.h"
MinimalTeamInfo* get_wasm_team_ptr(IM3Runtime rt);
#define game_mode_data_teams get_wasm_team_ptr(game_mode_data->rt)
typedef struct UninitGameMode {
const char* full_path;
IM3Runtime rt;
IM3Function name;
} UninitGameMode;
typedef struct PlayerScore {
uint64_t id;
uint64_t score;
} PlayerScore;
typedef enum GameMode {
Deathmatch,
TeamDeathmatch,
} GameMode;
#define Team MinimalTeamInfo
typedef struct GameModeData {
DrawableObject* drawable_objects;
uint8_t num_teams;
IM3Runtime rt;
} GameModeData;
GameModeData init_gamemode_data(IM3Runtime rt, const Map* map);
bool spawn_player(Player* player, const Map* map, GameModeData* game_mode_data);
bool calculate_scores(const Team** winning_team, GameModeData* game_mode_data);
bool add_player_to_team(Player* player, const Map* map, GameModeData* game_mode_data);
Team* find_team_of_id(uint64_t team_id, GameModeData* game_mode_data);
void sync_players_to_teams(Player* players, uint8_t num_players, GameModeData* game_mode_data);
uint64_t get_num_drawable_objects(IM3Runtime rt);
bool team_kill(IM3Runtime rt);
#endif