Move chunk assets from a single flat assetsraw/chunks (and assets/chunks) into per-map assetsraw/maps/<map>/chunks (assets/maps/<map>/chunks), so terrain mesh/model output no longer collides across maps sharing chunk coordinates. map_t gains a name[MAP_NAME_MAX] field plus mapSetMap()/ mapIsLoaded() (checks name[0] == '\0') in place of the old bool loaded flag; mapInit() now just resets state and mapSetMap() does the chunk grid load. Updated the chunk asset tool and the map editor's dev server/client to match.
32 lines
822 B
C
32 lines
822 B
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "entitytestfixture.h"
|
|
#include "rpg/overworld/map.h"
|
|
#include "rpg/overworld/tile.h"
|
|
#include "util/memory.h"
|
|
#include "util/string.h"
|
|
|
|
void entityTestFixtureReset(void) {
|
|
memoryZero(ENTITIES, sizeof(ENTITIES));
|
|
|
|
memoryZero(&MAP, sizeof(map_t));
|
|
stringCopy(MAP.name, "test", MAP_NAME_MAX);
|
|
MAP.chunkPosition = (chunkpos_t){ 0, 0, 0 };
|
|
|
|
chunk_t *chunk = &MAP.chunks[0];
|
|
chunk->position = (chunkpos_t){ 0, 0, 0 };
|
|
for(uint32_t i = 0; i < CHUNK_TILE_COUNT; i++) {
|
|
chunk->tiles[i] = (tile_t){ .shape = TILE_SHAPE_GROUND, .z = 0 };
|
|
}
|
|
for(uint8_t i = 0; i < CHUNK_ENTITY_COUNT_MAX; i++) {
|
|
chunk->entities[i] = 0xFF;
|
|
}
|
|
|
|
MAP.chunkOrder[0] = chunk;
|
|
}
|