2021-05-04 17:41:30 +00:00
|
|
|
#pragma once
|
|
|
|
#include "system.h"
|
|
|
|
#include "librg.h"
|
2021-05-05 09:25:05 +00:00
|
|
|
#include "packet.h"
|
2021-05-04 17:41:30 +00:00
|
|
|
#include "flecs/flecs.h"
|
|
|
|
|
|
|
|
#define WORLD_ERROR_NONE +0x0000
|
|
|
|
#define WORLD_ERROR_OUTOFMEM -0x0001
|
|
|
|
#define WORLD_ERROR_INVALID_BLOCKS -0x0002
|
|
|
|
#define WORLD_ERROR_INVALID_DIMENSIONS -0x0003
|
|
|
|
#define WORLD_ERROR_INVALID_BUFFER -0x0004
|
|
|
|
#define WORLD_ERROR_TRACKER_FAILED -0x0005
|
|
|
|
|
2021-05-09 14:41:19 +00:00
|
|
|
#define WORLD_LAYERING 0
|
2021-05-09 13:52:46 +00:00
|
|
|
#define WORLD_TRACKER_LAYERS 3
|
2021-05-09 19:12:11 +00:00
|
|
|
#define WORLD_TRACKER_UPDATE_FAST_MS 100
|
|
|
|
#define WORLD_TRACKER_UPDATE_NORMAL_MS 500
|
|
|
|
#define WORLD_TRACKER_UPDATE_SLOW_MS 1000
|
2021-05-09 10:27:10 +00:00
|
|
|
|
2021-05-04 19:22:55 +00:00
|
|
|
#define WORLD_PKT_READER(name) int32_t name(void* data, uint32_t datalen, void *udata)
|
2021-05-04 17:41:30 +00:00
|
|
|
typedef WORLD_PKT_READER(world_pkt_reader_proc);
|
|
|
|
|
2021-05-04 19:22:55 +00:00
|
|
|
#define WORLD_PKT_WRITER(name) int32_t name(pkt_header *pkt, void *udata)
|
2021-05-04 17:41:30 +00:00
|
|
|
typedef WORLD_PKT_WRITER(world_pkt_writer_proc);
|
|
|
|
|
2021-05-06 15:30:38 +00:00
|
|
|
void world_setup_pkt_handlers(world_pkt_reader_proc *reader_proc, world_pkt_writer_proc *writer_proc);
|
2021-05-08 06:55:12 +00:00
|
|
|
int32_t world_init(int32_t seed, uint16_t block_size, uint16_t chunk_size, uint16_t chunk_amount);
|
2021-05-04 17:41:30 +00:00
|
|
|
int32_t world_destroy(void);
|
|
|
|
int32_t world_update(void);
|
2021-05-04 19:22:55 +00:00
|
|
|
int32_t world_read(void* data, uint32_t datalen, void *udata);
|
|
|
|
int32_t world_write(pkt_header *pkt, void *udata);
|
2021-05-04 17:41:30 +00:00
|
|
|
|
|
|
|
uint32_t world_buf(uint8_t const **ptr, uint32_t *width);
|
|
|
|
ecs_world_t * world_ecs(void);
|
|
|
|
librg_world * world_tracker(void);
|
|
|
|
|
2021-05-04 19:22:55 +00:00
|
|
|
uint16_t world_block_size(void);
|
2021-05-04 17:41:30 +00:00
|
|
|
uint16_t world_chunk_size(void);
|
2021-05-08 06:55:12 +00:00
|
|
|
uint16_t world_chunk_amount(void);
|
|
|
|
uint16_t world_dim(void);
|