This commit is contained in:
2025-09-01 11:10:28 -05:00
parent 368729f0f3
commit 3ce1566a2e
14 changed files with 105 additions and 17 deletions

View File

@@ -6,6 +6,7 @@
# Sources
target_sources(${DUSK_TARGET_NAME}
PRIVATE
rpg.c
)
# Subdirs

13
src/rpg/rpg.c Normal file
View File

@@ -0,0 +1,13 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "rpg.h"
#include "rpg/entity/player.h"
void rpgInit() {
}

13
src/rpg/rpg.h Normal file
View File

@@ -0,0 +1,13 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
/**
* Initializes the RPG subsystem.
*/
void rpgInit();

View File

@@ -8,7 +8,7 @@
#include "chunk.h"
#include "util/memory.h"
#include "assert/assert.h"
#include "world/world.h"
#include "rpg/world/world.h"
void renderChunkUpdated(chunk_t *chunk);
@@ -260,12 +260,12 @@ void chunkLoad(chunk_t *chunk, const uint16_t x, const uint16_t y) {
};
// Load this entity.
entityLoad(entity, data);
// entityLoad(entity, data);
data++;
}
// Allow the rendering platform to know this chunk is loaded.
renderChunkUpdated(chunk);
// renderChunkUpdated(chunk);
}
void chunkUnload(chunk_t *chunk) {

View File

@@ -7,15 +7,15 @@
#pragma once
#include "tile.h"
#include "display/render.h"
#include "display/display.h"
#define CHUNK_WIDTH 8
#define CHUNK_HEIGHT 8
#define CHUNK_TILE_COUNT (CHUNK_WIDTH * CHUNK_HEIGHT)
#define CHUNK_ENTITY_COUNT_MAX 8
#define CHUNK_MAP_WIDTH (((RENDER_WIDTH / TILE_WIDTH_HEIGHT)/CHUNK_WIDTH)+2)
#define CHUNK_MAP_HEIGHT (((RENDER_HEIGHT / TILE_WIDTH_HEIGHT)/CHUNK_HEIGHT)+2)
#define CHUNK_MAP_WIDTH (((DISPLAY_WIDTH / TILE_WIDTH_HEIGHT)/CHUNK_WIDTH)+2)
#define CHUNK_MAP_HEIGHT (((DISPLAY_HEIGHT / TILE_WIDTH_HEIGHT)/CHUNK_HEIGHT)+2)
#define CHUNK_MAP_COUNT (CHUNK_MAP_WIDTH * CHUNK_MAP_HEIGHT)
typedef struct {

View File

@@ -7,7 +7,7 @@
#pragma once
#include "chunk.h"
#include "entity/entity.h"
#include "rpg/entity/entity.h"
typedef struct {
uint8_t layerBase[CHUNK_TILE_COUNT];

View File

@@ -7,9 +7,9 @@
#include "overworld.h"
#include "chunk.h"
#include "display/render.h"
#include "display/display.h"
#include "assert/assert.h"
#include "entity/entity.h"
#include "rpg/entity/entity.h"
uint32_t OVERWORLD_CAMERA_X;
uint32_t OVERWORLD_CAMERA_Y;

16
src/rpg/world/world.h Normal file
View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "rpg/world/chunkdata.h"
#define WORLD_WIDTH 1
#define WORLD_HEIGHT 1
static const chunkdata_t *WORLD_CHUNKS[WORLD_HEIGHT * WORLD_WIDTH] = {
NULL
};