diff --git a/assets/untitled.tiled-session b/assets/untitled.tiled-session index 0620966..2bfebc1 100644 --- a/assets/untitled.tiled-session +++ b/assets/untitled.tiled-session @@ -5,9 +5,9 @@ }, "activeFile": "map/untitled.tmx", "expandedProjectPaths": [ - "map", + "tileset", ".", - "tileset" + "map" ], "file.lastUsedOpenFilter": "All Files (*)", "fileStates": { @@ -20,11 +20,11 @@ "scaleInEditor": 11 }, "map/untitled.tmx": { - "scale": 3.8326562499999994, + "scale": 2, "selectedLayer": 0, "viewCenter": { - "x": 169.5951730604591, - "y": 108.41045293326268 + "x": 285.5, + "y": 162.75 } }, "tileset/prarie.tsx": { diff --git a/src/rpg/rpg.c b/src/rpg/rpg.c index e6aeace..081cac4 100644 --- a/src/rpg/rpg.c +++ b/src/rpg/rpg.c @@ -7,7 +7,7 @@ #include "rpg.h" #include "entity/entity.h" -#include "rpg/world/world.h" +#include "rpg/world/map.h" #include "rpg/cutscene/cutscenesystem.h" #include "time/time.h" #include "rpgcamera.h" @@ -20,8 +20,7 @@ errorret_t rpgInit(void) { // Init cutscene subsystem cutsceneSystemInit(); - // Init the world. - worldInit(); + mapInit(); rpgCameraInit(); rpgTextboxInit(); @@ -47,9 +46,8 @@ void rpgUpdate(void) { // TODO: Do not update if the scene is not the map scene? - // Update the world. - worldUpdate(); - + mapUpdate(); + // Update overworld ents. entity_t *ent = &ENTITIES[0]; do { diff --git a/src/rpg/world/CMakeLists.txt b/src/rpg/world/CMakeLists.txt index 08b0b7c..ea50569 100644 --- a/src/rpg/world/CMakeLists.txt +++ b/src/rpg/world/CMakeLists.txt @@ -6,5 +6,5 @@ # Sources target_sources(${DUSK_TARGET_NAME} PRIVATE - world.c + map.c ) \ No newline at end of file diff --git a/src/rpg/world/map.c b/src/rpg/world/map.c new file mode 100644 index 0000000..9e292ac --- /dev/null +++ b/src/rpg/world/map.c @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "map.h" +#include "util/memory.h" + +map_t MAP; + +void mapInit() { + memoryZero(&MAP, sizeof(map_t)); + + for(uint32_t i = 0; i < MAP_CHUNK_COUNT; i++) { + MAP.chunkOrder[i] = &MAP.chunks[i]; + } +} + +void mapUpdate() { + +} \ No newline at end of file diff --git a/src/rpg/world/map.h b/src/rpg/world/map.h new file mode 100644 index 0000000..fd07d71 --- /dev/null +++ b/src/rpg/world/map.h @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2025 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "rpg/world/chunk.h" + +#define MAP_CHUNK_WIDTH 4 +#define MAP_CHUNK_HEIGHT 4 +#define MAP_CHUNK_DEPTH 4 +#define MAP_CHUNK_COUNT (MAP_CHUNK_WIDTH * MAP_CHUNK_HEIGHT * MAP_CHUNK_DEPTH) + +typedef struct map_s { + chunk_t chunks[MAP_CHUNK_COUNT]; + chunk_t *chunkOrder[MAP_CHUNK_COUNT]; + int16_t x, y, z; +} map_t; + +extern map_t MAP; + +/** + * Initializes the map. + */ +void mapInit(); + +/** + * Updates the map. + */ +void mapUpdate(); \ No newline at end of file diff --git a/src/rpg/world/world.c b/src/rpg/world/world.c deleted file mode 100644 index c0f6a8c..0000000 --- a/src/rpg/world/world.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2025 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#include "world.h" -#include "util/memory.h" - -world_t WORLD; - -void worldInit() { - memoryZero(&WORLD, sizeof(world_t)); - - for(uint32_t i = 0; i < WORLD_CHUNK_COUNT; i++) { - WORLD.chunkOrder[i] = &WORLD.chunks[i]; - } -} - -void worldUpdate() { - -} \ No newline at end of file diff --git a/src/rpg/world/world.h b/src/rpg/world/world.h deleted file mode 100644 index 68090cc..0000000 --- a/src/rpg/world/world.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2025 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -#include "rpg/world/chunk.h" - -#define WORLD_WIDTH 4 -#define WORLD_HEIGHT 4 -#define WORLD_DEPTH 4 -#define WORLD_CHUNK_COUNT (WORLD_WIDTH * WORLD_HEIGHT * WORLD_DEPTH) - -typedef struct world_s { - chunk_t chunks[WORLD_CHUNK_COUNT]; - chunk_t *chunkOrder[WORLD_CHUNK_COUNT]; - int16_t x, y, z; -} world_t; - -extern world_t WORLD; - -/** - * Initializes the world. - */ -void worldInit(); - -/** - * Updates the world. - */ -void worldUpdate(); \ No newline at end of file diff --git a/src/scene/scene/scenemap.h b/src/scene/scene/scenemap.h index 54a7b7f..1eaad44 100644 --- a/src/scene/scene/scenemap.h +++ b/src/scene/scene/scenemap.h @@ -8,12 +8,10 @@ #pragma once #include "scene/scene.h" #include "rpg/entity/entity.h" -#include "rpg/world/world.h" #include "display/camera.h" typedef struct { camera_t camera; - world_t world; } scenemap_t; errorret_t sceneMapInit(scenedata_t *data);