map
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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,8 +46,7 @@ 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];
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
# Sources
|
||||
target_sources(${DUSK_TARGET_NAME}
|
||||
PRIVATE
|
||||
world.c
|
||||
map.c
|
||||
)
|
||||
23
src/rpg/world/map.c
Normal file
23
src/rpg/world/map.c
Normal file
@@ -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() {
|
||||
|
||||
}
|
||||
32
src/rpg/world/map.h
Normal file
32
src/rpg/world/map.h
Normal file
@@ -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();
|
||||
@@ -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() {
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user