Fixed some memory things on PSP

This commit is contained in:
2025-11-11 20:07:28 -06:00
parent 7d7a3f30e6
commit 4f8f6a47cb
6 changed files with 29 additions and 24 deletions

View File

@@ -1,9 +1,9 @@
{ {
"tiles": [ "tiles": [
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,
1, 1, 1, 1, 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,
1, 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,
1, 1, 1, 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, 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, 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, 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, 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, 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,

View File

@@ -31,11 +31,11 @@ errorret_t rpgInit(void) {
entityInit(ent, ENTITY_TYPE_PLAYER); entityInit(ent, ENTITY_TYPE_PLAYER);
RPG_CAMERA.mode = RPG_CAMERA_MODE_FOLLOW_ENTITY; RPG_CAMERA.mode = RPG_CAMERA_MODE_FOLLOW_ENTITY;
RPG_CAMERA.followEntity.followEntityId = ent->id; 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]; ent = &ENTITIES[1];
entityInit(ent, ENTITY_TYPE_NPC); 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! // All Good!
errorOk(); errorOk();

View File

@@ -10,8 +10,8 @@
#include "worldpos.h" #include "worldpos.h"
#include "display/mesh/mesh.h" #include "display/mesh/mesh.h"
#define CHUNK_VERTEX_COUNT_MAX (6 * CHUNK_TILE_COUNT * 3) #define CHUNK_VERTEX_COUNT_MAX (6 * CHUNK_TILE_COUNT * 2)
#define CHUNK_MESH_COUNT_MAX 16 #define CHUNK_MESH_COUNT_MAX 12
typedef struct chunk_s { typedef struct chunk_s {
chunkpos_t position; chunkpos_t position;

View File

@@ -10,12 +10,12 @@
#define CHUNK_WIDTH 16 #define CHUNK_WIDTH 16
#define CHUNK_HEIGHT 16 #define CHUNK_HEIGHT 16
#define CHUNK_DEPTH 32 #define CHUNK_DEPTH 8
#define CHUNK_TILE_COUNT (CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH) #define CHUNK_TILE_COUNT (CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH)
#define MAP_CHUNK_WIDTH 3 #define MAP_CHUNK_WIDTH 3
#define MAP_CHUNK_HEIGHT 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) #define MAP_CHUNK_COUNT (MAP_CHUNK_WIDTH * MAP_CHUNK_HEIGHT * MAP_CHUNK_DEPTH)
typedef int16_t worldunit_t; typedef int16_t worldunit_t;

View File

@@ -36,6 +36,7 @@ errorret_t sceneMapInit(scenedata_t *data) {
data->sceneMap.camera.lookatPixelPerfect.up data->sceneMap.camera.lookatPixelPerfect.up
); );
data->sceneMap.camera.lookatPixelPerfect.pixelsPerUnit = 1.0f; data->sceneMap.camera.lookatPixelPerfect.pixelsPerUnit = 1.0f;
data->sceneMap.camera.perspective.fov = glm_rad(90.0f);
errorOk(); errorOk();
} }

View File

@@ -8,7 +8,7 @@ from assethelpers import getAssetRelativePath
CHUNK_WIDTH = 16 CHUNK_WIDTH = 16
CHUNK_HEIGHT = 16 CHUNK_HEIGHT = 16
CHUNK_DEPTH = 32 CHUNK_DEPTH = 8
CHUNK_TILE_COUNT = CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH CHUNK_TILE_COUNT = CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH
TILE_WIDTH = 16.0 TILE_WIDTH = 16.0
TILE_HEIGHT = 16.0 TILE_HEIGHT = 16.0
@@ -31,18 +31,22 @@ def processTile(tileIndex, x=0, y=0, z=0):
# Tile 2, ramp up # Tile 2, ramp up
color = (255,0,0) color = (255,0,0)
vertices = [ vertices = [
{'position': (px, py, pz), 'color': color, 'uv': (0,0)}, # 0,0 {'position': (px, py, pz + TILE_DEPTH), '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, pz + TILE_DEPTH), '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 + TILE_WIDTH, py + TILE_HEIGHT, pz), 'color': color, 'uv': (1,1)}, # 1,1
{'position': (px, py, pz), 'color': color, 'uv': (0,0)}, # 0,0 (repeat) {'position': (px, py, pz + TILE_DEPTH), '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 + TILE_WIDTH, py + TILE_HEIGHT, pz), '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 + TILE_HEIGHT, pz), 'color': color, 'uv': (0,1)} # 0,1
] ]
indices = [0, 1, 2, 3, 4, 5] indices = [0, 1, 2, 3, 4, 5]
else: else:
# Determine color for checkerboard pattern # 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 = [ vertices = [
{'position': (px, py, pz), 'color': color, 'uv': (0,0)}, # 0,0 {'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, pz), 'color': color, 'uv': (1,0)}, # 1,0