Initial commit.

This commit is contained in:
2025-10-26 15:42:34 -05:00
commit f1db7de87c
29 changed files with 781 additions and 0 deletions

35
src/world/map.h Executable file
View File

@@ -0,0 +1,35 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "world/chunk.h"
#include "entity/entity.h"
#define MAP_ENTITY_COUNT 8
#define MAP_WIDTH_IN_CHUNKS 3
#define MAP_HEIGHT_IN_CHUNKS 3
#define MAP_CHUNK_COUNT (MAP_WIDTH_IN_CHUNKS * MAP_HEIGHT_IN_CHUNKS)
typedef struct map_s {
// Loaded chunks.
chunk_t chunks[MAP_CHUNK_COUNT];
chunk_t *order[MAP_CHUNK_COUNT];
int8_t firstChunk;
// Map entities
entity_t entities[MAP_ENTITY_COUNT];
// Size of map (in chunks)
uint8_t width, height;
} map_t;
/**
* Update the map for one tick.
*
* @param map Pointer to the map to update.
*/
void mapTick(map_t *map);