Files
snejk/src/game/shared/game_world.h

37 lines
1.1 KiB
C

#ifndef WORLD_H
#define WORLD_H
#include <stdint.h>
#include "entity.h"
#include "grid.h"
#include "shared/squeue.h"
#include "shared/random.h"
typedef struct {
uint32_t seed;
Random_Generator random_generator;
SQueue entity_id_queue;
Entity *entities;
uint16_t max_entities;
Grid grid;
} Game_World;
Game_World *game_world_create(uint32_t seed, uint16_t level_width, uint16_t level_height);
void game_world_destroy(Game_World *world);
bool game_world_create_entity(Game_World *world, Entity_Type type, uint16_t x, uint16_t y, Entity_ID *out_entity_id);
void game_world_destroy_entity(Game_World *world, Entity_ID entity_id, bool destroy_children);
// TODO: SS - "void game_world_spawn_player(Game_World *world, ..)"
Entity *game_world_try_get_entity_by_id(Game_World *world, Entity_ID id);
#define MAX_ATTEMPTS_AT_FINDING_POSITION_TO_SPAWN 8
bool game_world_find_position_to_spawn(Game_World *world, uint16_t *out_x, uint16_t *out_y);
Entity_Movement_Direction game_world_choose_initial_move_direction_based_on_coords(Game_World *world, uint16_t x, uint16_t y);
#endif