From 4f8f6a47cb39012fc4bc39cf80c89f6a2907067a Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 11 Nov 2025 20:07:28 -0600 Subject: [PATCH] Fixed some memory things on PSP --- assets/map/map/0_0_0.json | 18 +++++++++--------- src/rpg/rpg.c | 4 ++-- src/rpg/world/chunk.h | 4 ++-- src/rpg/world/worldpos.h | 4 ++-- src/scene/scene/scenemap.c | 1 + tools/assetstool/processmap.py | 22 +++++++++++++--------- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/assets/map/map/0_0_0.json b/assets/map/map/0_0_0.json index f3c2d98..3e6bb52 100644 --- a/assets/map/map/0_0_0.json +++ b/assets/map/map/0_0_0.json @@ -1,9 +1,9 @@ { "tiles": [ - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -18,12 +18,12 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/rpg/rpg.c b/src/rpg/rpg.c index 1ad3c11..0c3a454 100644 --- a/src/rpg/rpg.c +++ b/src/rpg/rpg.c @@ -31,11 +31,11 @@ errorret_t rpgInit(void) { entityInit(ent, ENTITY_TYPE_PLAYER); RPG_CAMERA.mode = RPG_CAMERA_MODE_FOLLOW_ENTITY; RPG_CAMERA.followEntity.followEntityId = ent->id; - ent->position.x = 0, ent->position.y = 0; + ent->position.x = 2, ent->position.y = 2; ent = &ENTITIES[1]; entityInit(ent, ENTITY_TYPE_NPC); - ent->position.x = 6, ent->position.y = 4; + ent->position.x = 4, ent->position.y = 0, ent->position.z = 1; // All Good! errorOk(); diff --git a/src/rpg/world/chunk.h b/src/rpg/world/chunk.h index 2e3b457..74b8a40 100644 --- a/src/rpg/world/chunk.h +++ b/src/rpg/world/chunk.h @@ -10,8 +10,8 @@ #include "worldpos.h" #include "display/mesh/mesh.h" -#define CHUNK_VERTEX_COUNT_MAX (6 * CHUNK_TILE_COUNT * 3) -#define CHUNK_MESH_COUNT_MAX 16 +#define CHUNK_VERTEX_COUNT_MAX (6 * CHUNK_TILE_COUNT * 2) +#define CHUNK_MESH_COUNT_MAX 12 typedef struct chunk_s { chunkpos_t position; diff --git a/src/rpg/world/worldpos.h b/src/rpg/world/worldpos.h index 540eb2b..f4e9318 100644 --- a/src/rpg/world/worldpos.h +++ b/src/rpg/world/worldpos.h @@ -10,12 +10,12 @@ #define CHUNK_WIDTH 16 #define CHUNK_HEIGHT 16 -#define CHUNK_DEPTH 32 +#define CHUNK_DEPTH 8 #define CHUNK_TILE_COUNT (CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH) #define MAP_CHUNK_WIDTH 3 #define MAP_CHUNK_HEIGHT 3 -#define MAP_CHUNK_DEPTH 1 +#define MAP_CHUNK_DEPTH 3 #define MAP_CHUNK_COUNT (MAP_CHUNK_WIDTH * MAP_CHUNK_HEIGHT * MAP_CHUNK_DEPTH) typedef int16_t worldunit_t; diff --git a/src/scene/scene/scenemap.c b/src/scene/scene/scenemap.c index 22b9baf..5506fca 100644 --- a/src/scene/scene/scenemap.c +++ b/src/scene/scene/scenemap.c @@ -36,6 +36,7 @@ errorret_t sceneMapInit(scenedata_t *data) { data->sceneMap.camera.lookatPixelPerfect.up ); data->sceneMap.camera.lookatPixelPerfect.pixelsPerUnit = 1.0f; + data->sceneMap.camera.perspective.fov = glm_rad(90.0f); errorOk(); } diff --git a/tools/assetstool/processmap.py b/tools/assetstool/processmap.py index bdee00c..82a908d 100644 --- a/tools/assetstool/processmap.py +++ b/tools/assetstool/processmap.py @@ -8,7 +8,7 @@ from assethelpers import getAssetRelativePath CHUNK_WIDTH = 16 CHUNK_HEIGHT = 16 -CHUNK_DEPTH = 32 +CHUNK_DEPTH = 8 CHUNK_TILE_COUNT = CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH TILE_WIDTH = 16.0 TILE_HEIGHT = 16.0 @@ -28,21 +28,25 @@ def processTile(tileIndex, x=0, y=0, z=0): return None elif tileIndex == 2: - # Tile 2, ramp up + # Tile 2, ramp up color = (255,0,0) vertices = [ - {'position': (px, py, pz), 'color': color, 'uv': (0,0)}, # 0,0 - {'position': (px + TILE_WIDTH, py, pz), 'color': color, 'uv': (1,0)}, # 1,0 - {'position': (px + TILE_WIDTH, py + TILE_HEIGHT, pz + TILE_DEPTH), 'color': color, 'uv': (1,1)}, # 1,1 - {'position': (px, py, pz), 'color': color, 'uv': (0,0)}, # 0,0 (repeat) - {'position': (px + TILE_WIDTH, py + TILE_HEIGHT, pz + TILE_DEPTH), 'color': color, 'uv': (1,1)}, # 1,1 (repeat) - {'position': (px, py + TILE_HEIGHT, pz + TILE_DEPTH), 'color': color, 'uv': (0,1)} # 0,1 + {'position': (px, py, pz + TILE_DEPTH), 'color': color, 'uv': (0,0)}, # 0,0 + {'position': (px + TILE_WIDTH, py, pz + TILE_DEPTH), 'color': color, 'uv': (1,0)}, # 1,0 + {'position': (px + TILE_WIDTH, py + TILE_HEIGHT, pz), 'color': color, 'uv': (1,1)}, # 1,1 + {'position': (px, py, pz + TILE_DEPTH), 'color': color, 'uv': (0,0)}, # 0,0 (repeat) + {'position': (px + TILE_WIDTH, py + TILE_HEIGHT, pz), 'color': color, 'uv': (1,1)}, # 1,1 (repeat) + {'position': (px, py + TILE_HEIGHT, pz), 'color': color, 'uv': (0,1)} # 0,1 ] indices = [0, 1, 2, 3, 4, 5] else: # Determine color for checkerboard pattern - color = (255,255,255) if (x + y) % 2 == 0 else (0,0,0) + if tileIndex == 1: + color = (0, 255, 0) + else: + color = (0, 0, 255) + vertices = [ {'position': (px, py, pz), 'color': color, 'uv': (0,0)}, # 0,0 {'position': (px + TILE_WIDTH, py, pz), 'color': color, 'uv': (1,0)}, # 1,0