Author SHA1 Message Date
YourWishes 327c2bec70 Show map name in the debug player position overlay
Useful now that multiple maps can be loaded, to tell which map the
printed coordinates belong to.
2026-09-07 22:34:02 -05:00
YourWishes fc0195d9f7 Bump ASSET_FILE_NAME_MAX to 128
Per-map chunk model paths (maps/<map>/models/chunks/chunk_X_Y_Z_0.json)
were hitting the old 48-char limit, crashing assetEntryInit's length
assert during initial chunk/cutscene loading.
2026-09-07 22:33:57 -05:00
YourWishes db42bca44b Reintroduce multiple maps: per-map chunk directories + map_t name/mapSetMap
Move chunk assets from a single flat assetsraw/chunks (and assets/chunks)
into per-map assetsraw/maps/<map>/chunks (assets/maps/<map>/chunks), so
terrain mesh/model output no longer collides across maps sharing chunk
coordinates. map_t gains a name[MAP_NAME_MAX] field plus mapSetMap()/
mapIsLoaded() (checks name[0] == '\0') in place of the old bool loaded
flag; mapInit() now just resets state and mapSetMap() does the chunk
grid load. Updated the chunk asset tool and the map editor's dev
server/client to match.
2026-09-07 21:28:07 -05:00
170 changed files with 544 additions and 614 deletions

No files matched your search

@@ -1,5 +1,5 @@
{
"mesh": "meshes/chunks/chunk_-1_0_0_0.dmf",
"mesh": "maps/overworld/meshes/chunks/chunk_-1_0_0_0.dmf",
"color": [
255,
255,
@@ -1,5 +1,5 @@
{
"mesh": "meshes/chunks/chunk_0_0_0_0.dmf",
"mesh": "maps/overworld/meshes/chunks/chunk_0_0_0_0.dmf",
"color": [
255,
255,
@@ -1,5 +1,5 @@
{
"mesh": "meshes/chunks/chunk_0_1_0_0.dmf",
"mesh": "maps/overworld/meshes/chunks/chunk_0_1_0_0.dmf",
"color": [
255,
255,
@@ -1,5 +1,5 @@
{
"mesh": "meshes/chunks/chunk_1_0_0_0.dmf",
"mesh": "maps/overworld/meshes/chunks/chunk_1_0_0_0.dmf",
"color": [
255,
255,
@@ -1,5 +1,5 @@
{
"mesh": "meshes/chunks/chunk_1_1_0_0.dmf",
"mesh": "maps/overworld/meshes/chunks/chunk_1_1_0_0.dmf",
"color": [
255,
255,
@@ -1,5 +1,5 @@
{
"mesh": "meshes/chunks/chunk_2_0_0_0.dmf",
"mesh": "maps/overworld/meshes/chunks/chunk_2_0_0_0.dmf",
"color": [
255,
255,
+1
View File
@@ -0,0 +1 @@
{}
+7 -5
View File
@@ -345,12 +345,14 @@
return promise;
}
const MAP_NAME = "overworld";
function chunkPaths(x, y, z) {
return {
raw: `assetsraw/chunks/chunk_${x}_${y}_${z}.json`,
dcf: `assets/chunks/${x}_${y}_${z}.dcf`,
terrainDmf: `assets/meshes/chunks/chunk_${x}_${y}_${z}_0.dmf`,
terrainModel: `assets/models/chunks/chunk_${x}_${y}_${z}_0.json`,
raw: `assetsraw/maps/${MAP_NAME}/chunks/chunk_${x}_${y}_${z}.json`,
dcf: `assets/maps/${MAP_NAME}/chunks/${x}_${y}_${z}.dcf`,
terrainDmf: `assets/maps/${MAP_NAME}/meshes/chunks/chunk_${x}_${y}_${z}_0.dmf`,
terrainModel: `assets/maps/${MAP_NAME}/models/chunks/chunk_${x}_${y}_${z}_0.json`,
};
}
@@ -767,7 +769,7 @@
async function buildChunkBrowseList() {
const list = document.getElementById("chunkBrowseList");
list.innerHTML = "";
const res = await apiLs("assetsraw/chunks");
const res = await apiLs(`assetsraw/maps/${MAP_NAME}/chunks`);
for(const entry of res.entries || []) {
const m = entry.name.match(/^chunk_(-?\d+)_(-?\d+)_(-?\d+)\.json$/);
if(!m) continue;
+4 -1
View File
@@ -209,7 +209,10 @@ class Handler(BaseHTTPRequestHandler):
self.send_json({"error": "invalid chunk coordinates"}, 400)
return
json_path = PROJECT_ROOT / "assetsraw" / "chunks" / f"chunk_{x}_{y}_{z}.json"
json_path = (
PROJECT_ROOT / "assetsraw" / "maps" / "overworld" / "chunks"
/ f"chunk_{x}_{y}_{z}.json"
)
if not json_path.is_file():
self.send_json({"error": "chunk json not found"}, 404)
return
+9 -11
View File
@@ -1,9 +1,7 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "animation.h"
#include "assert/assert.h"
@@ -16,9 +14,9 @@ void animationInit(
uint16_t *keyframeCounts,
const uint16_t layerCount
) {
assertNotNull(anim, "Animation pointer cannot be NULL.");
assertNotNull(keyframes, "Keyframes pointer cannot be NULL.");
assertNotNull(keyframeCounts, "Keyframe counts pointer cannot be NULL.");
assertNotNull(anim, "Animation pointer cannot be null.");
assertNotNull(keyframes, "Keyframes pointer cannot be null.");
assertNotNull(keyframeCounts, "Keyframe counts pointer cannot be null.");
assertTrue(layerCount > 0, "Layer count must be greater than zero.");
memoryZero(anim, sizeof(animation_t));
@@ -51,7 +49,7 @@ void animationInit(
}
float_t animationGetLayerValue(const animation_t *anim, const uint16_t layer) {
assertNotNull(anim, "Animation pointer cannot be NULL.");
assertNotNull(anim, "Animation pointer cannot be null.");
assertTrue(layer < anim->layerCount, "Layer index out of bounds.");
uint16_t keyframeCount = anim->keyframeCounts[layer];
@@ -63,7 +61,7 @@ void animationUpdate(
animation_t *anim,
const float_t deltaTime
) {
assertNotNull(anim, "Animation pointer cannot be NULL.");
assertNotNull(anim, "Animation pointer cannot be null.");
assertTrue(deltaTime >= 0, "Delta time must be non-negative.");
bool_t justCompleted = false;
+4 -6
View File
@@ -1,9 +1,7 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "keyframe.h"
+4 -6
View File
@@ -1,9 +1,7 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "easing.h"
#include "assert/assert.h"
+4 -123
View File
@@ -1,9 +1,7 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dusk.h"
@@ -47,136 +45,19 @@ extern const easingfn_t EASING_FUNCTIONS[EASING_COUNT];
*/
float_t easingApply(const easingtype_t type, const float_t t);
/**
* No easing - returns t unchanged.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, equal to t.
*/
float_t easingLinear(const float_t t);
/**
* Sinusoidal easing in: starts slow, accelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInSine(const float_t t);
/**
* Sinusoidal easing out: starts fast, decelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingOutSine(const float_t t);
/**
* Sinusoidal easing in and out: slow at both ends, fastest in
* the middle.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInOutSine(const float_t t);
/**
* Quadratic easing in: starts slow, accelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInQuad(const float_t t);
/**
* Quadratic easing out: starts fast, decelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingOutQuad(const float_t t);
/**
* Quadratic easing in and out: slow at both ends, fastest in the
* middle.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInOutQuad(const float_t t);
/**
* Cubic easing in: starts slow, accelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInCubic(const float_t t);
/**
* Cubic easing out: starts fast, decelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingOutCubic(const float_t t);
/**
* Cubic easing in and out: slow at both ends, fastest in the
* middle.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInOutCubic(const float_t t);
/**
* Quartic easing in: starts slow, accelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInQuart(const float_t t);
/**
* Quartic easing out: starts fast, decelerates to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingOutQuart(const float_t t);
/**
* Quartic easing in and out: slow at both ends, fastest in the
* middle.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, in the range [0, 1].
*/
float_t easingInOutQuart(const float_t t);
/**
* Back easing in: overshoots backwards before moving to the end.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, which may fall below 0.
*/
float_t easingInBack(const float_t t);
/**
* Back easing out: overshoots past the end before settling on it.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, which may rise above 1.
*/
float_t easingOutBack(const float_t t);
/**
* Back easing in and out: overshoots backwards at the start and
* past the end before settling on it.
*
* @param t The input time, in the range [0, 1].
* @return The eased value, which may fall below 0 or rise above 1.
*/
float_t easingInOutBack(const float_t t);
+1 -1
View File
@@ -14,7 +14,7 @@ float_t keyframeGetValue(
const uint32_t keyframeCount,
const float_t time
) {
assertNotNull(keyframes, "Keyframes pointer cannot be NULL.");
assertNotNull(keyframes, "Keyframes pointer cannot be null.");
assertTrue(keyframeCount > 0, "Keyframe count must be more than 0.");
assertTrue(time >= 0, "Time must be non-negative.");
#ifdef DUSK_ASSERTIONS
+4 -6
View File
@@ -1,9 +1,7 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "easing.h"
+2 -2
View File
@@ -28,8 +28,8 @@ errorret_t assetInit(void) {
// assetInitPlatform must either define both ASSET.zip/ASSET.zipStored or
// throw an error.
errorChain(assetInitPlatform());
assertNotNull(ASSET.zip, "Asset zip NULL without error.");
assertNotNull(ASSET.zipStored, "Asset stored zip NULL without error.");
assertNotNull(ASSET.zip, "Asset zip null without error.");
assertNotNull(ASSET.zipStored, "Asset stored zip null without error.");
threadInit(&ASSET.loadThread, assetUpdateAsync);
threadStart(&ASSET.loadThread);
+13 -9
View File
@@ -279,7 +279,7 @@ errorret_t assetFileLineReaderAppend(
errorOk();
}
// reserve room for optional NUL terminator
/* reserve room for optional NUL terminator */
if(reader->lineLength + srcLength >= reader->outBufferSize) {
errorThrow("Line length exceeds output buffer size.");
}
@@ -328,7 +328,7 @@ errorret_t assetFileLineReaderFill(assetfilelinereader_t *reader) {
size_t unreadBytes = assetFileLineReaderUnreadBytes(reader);
// If buffer is fully consumed, refill from start.
/* If buffer is fully consumed, refill from start. */
if(unreadBytes == 0) {
reader->bufferStart = 0;
reader->bufferEnd = 0;
@@ -349,14 +349,18 @@ errorret_t assetFileLineReaderFill(assetfilelinereader_t *reader) {
errorOk();
}
// There are unread bytes left but no newline in them.
// If bufferStart > 0, slide unread bytes to front so we can read more.
// This only happens when necessary to make space.
/*
* There are unread bytes left but no newline in them.
* If bufferStart > 0, slide unread bytes to front so we can read more.
* This only happens when necessary to make space.
*/
if(reader->bufferEnd == reader->readBufferSize) {
if(reader->bufferStart == 0) {
// Entire read buffer is unread and contains no newline.
// Caller must have a large enough outBuffer to accumulate across fills,
// so we consume these bytes into outBuffer before refilling.
/*
* Entire read buffer is unread and contains no newline.
* Caller must have a large enough outBuffer to accumulate across fills,
* so we consume these bytes into outBuffer before refilling.
*/
errorOk();
}
@@ -399,7 +403,7 @@ errorret_t assetFileLineReaderNext(assetfilelinereader_t *reader) {
size_t chunkLength = (size_t)newlineIndex - reader->bufferStart;
errorret_t ret;
// strip CR in CRLF
/* strip CR in CRLF */
if(
chunkLength > 0 &&
reader->readBuffer[(size_t)newlineIndex - 1] == '\r'
+1 -1
View File
@@ -9,7 +9,7 @@
#include "error/error.h"
#include <zip.h>
#define ASSET_FILE_NAME_MAX 48
#define ASSET_FILE_NAME_MAX 128
// Max bytes requested per zip_fread() call in assetFileRead(). Some
// zip_fread() implementations (seen on PSP) reject a single call asking
+1 -1
View File
@@ -62,7 +62,7 @@ errorret_t assetModelLoaderSync(assetloading_t *loading) {
// Parse required mesh path.
yyjson_val *meshVal = yyjson_obj_get(root, "mesh");
if(meshVal == NULL || !yyjson_is_str(meshVal)) {
if(!meshVal || !yyjson_is_str(meshVal)) {
assetUnlockEntry(jsonEntry);
loading->entry->state = ASSET_ENTRY_STATE_ERROR;
errorThrow("Model JSON missing 'mesh' string");
+3 -3
View File
@@ -32,7 +32,7 @@ typedef struct {
* on the main thread; this callback is never reached.
*
* @param loading Loading information for the asset being loaded.
* @return Always success.
* @returns Always success.
*/
errorret_t assetModelLoaderAsync(assetloading_t *loading);
@@ -44,7 +44,7 @@ errorret_t assetModelLoaderAsync(assetloading_t *loading);
* within ASSET_LOADING_COUNT_MAX slot limits.
*
* @param loading Loading information for the asset being loaded.
* @return Error code indicating success or failure.
* @returns Error code indicating success or failure.
*/
errorret_t assetModelLoaderSync(assetloading_t *loading);
@@ -53,6 +53,6 @@ errorret_t assetModelLoaderSync(assetloading_t *loading);
* sub-asset entries.
*
* @param entry Asset entry containing the model to dispose.
* @return Error code indicating success or failure.
* @returns Error code indicating success or failure.
*/
errorret_t assetModelDispose(assetentry_t *entry);
+1 -1
View File
@@ -77,7 +77,7 @@ errorret_t assetJsonLoaderSync(assetloading_t *loading) {
memoryFree(buffer);
loading->loading.json.buffer = NULL;
if(loading->entry->data.json == NULL) {
if(!loading->entry->data.json) {
assetLoaderErrorThrow(loading, "Failed to parse JSON");
}
@@ -41,32 +41,6 @@ typedef struct {
typedef yyjson_doc * assetjsonoutput_t;
/**
* Asynchronous loader callback. Opens the JSON file and reads the whole of
* it into a heap buffer, so the main thread is not blocked on I/O. The
* buffer is parsed later, on the main thread, by assetJsonLoaderSync. Sets
* the entry state to `ASSET_ENTRY_STATE_PENDING_SYNC` on success.
*
* @param loading The loading slot for this asset entry.
* @return OK on success, error otherwise.
*/
errorret_t assetJsonLoaderAsync(assetloading_t *loading);
/**
* Synchronous loader callback. Drives the load state machine: on the first
* call it queues the async read, and once that has completed it parses the
* buffer into a `yyjson_doc` (comments and trailing commas allowed), frees
* the buffer and marks the entry `ASSET_ENTRY_STATE_LOADED`.
*
* @param loading The loading slot for this asset entry.
* @return OK on success, error otherwise.
*/
errorret_t assetJsonLoaderSync(assetloading_t *loading);
/**
* Dispose callback. Frees the parsed `yyjson_doc` held by the entry.
*
* @param entry The asset entry to dispose.
* @return OK on success, error otherwise.
*/
errorret_t assetJsonDispose(assetentry_t *entry);
@@ -93,7 +93,7 @@ errorret_t assetLocaleParseHeader(
// Find "Plural-Forms: " line and parse out plural form info
char_t *pluralFormsLine = strstr(headerBuffer, "Plural-Forms:");
if(pluralFormsLine == NULL) {
if(!pluralFormsLine) {
errorOk();
}
@@ -101,7 +101,7 @@ errorret_t assetLocaleParseHeader(
// Expect nplurals
char_t *npluralsStr = strstr(pluralFormsLine, "nplurals=");
if(npluralsStr == NULL) {
if(!npluralsStr) {
errorThrow("Failed to find nplurals in Plural-Forms header.");
}
npluralsStr += strlen("nplurals=");
@@ -120,7 +120,7 @@ errorret_t assetLocaleParseHeader(
// Expect plural=
char_t *pluralStr = strstr(pluralFormsLine, "plural=");
if(pluralStr == NULL) {
if(!pluralStr) {
errorThrow("Failed to find plural in Plural-Forms header.");
}
pluralStr += strlen("plural=");
@@ -128,7 +128,7 @@ errorret_t assetLocaleParseHeader(
// Expect ( [expressions] )
char_t *openParen = strchr(pluralStr, '(');
char_t *closeParen = strrchr(pluralStr, ')');
if(openParen == NULL || closeParen == NULL || closeParen < openParen) {
if(!openParen || !closeParen || closeParen < openParen) {
errorThrow("Failed to find plural expression in Plural-Forms header.");
}
@@ -399,12 +399,12 @@ errorret_t assetLocaleLineUnbuffer(
// At the point this funciton is called, we are looking for an opening quote.
char_t *start = strchr((char_t *)lineBuffer, '"');
if(start == NULL) {
if(!start) {
errorThrow("Expected open (0) \"");
}
char *end = strchr(start + 1, '"');
if(end == NULL) {
if(!end) {
errorThrow("Expected close (0) \"");
}
*end = '\0';
@@ -690,7 +690,7 @@ errorret_t assetLocaleGetStringLookup(
// Parse until ]
char *end = strchr(ptr, ']');
if(end == NULL) {
if(!end) {
errorThrow("Expected ] for plural form, found: %s", lineBuffer);
}
*end = '\0';
@@ -854,7 +854,7 @@ errorret_t assetLocaleGetStringWithArgs(
inIndex++;
// Escaped percent
/* Escaped percent */
if(format[inIndex] == '%') {
if(outIndex + 1 >= bufferSize) {
memoryFree(format);
@@ -880,7 +880,7 @@ errorret_t assetLocaleGetStringWithArgs(
specBuffer[specLength++] = '%';
// Allow flags / width / precision
/* Allow flags / width / precision */
while(format[inIndex] != '\0') {
char_t ch = format[inIndex];
+5 -5
View File
@@ -55,8 +55,8 @@ void capsuleBuffer(
vertices[vi].uv[1] = (v); \
vi++;
// ---- Top hemisphere ----
// phi ranges from PI/2 (top pole) down to 0 (equator).
/* ---- Top hemisphere ---- */
/* phi ranges from PI/2 (top pole) down to 0 (equator). */
const float_t capStep = (float_t)GLM_PI_2 / (float_t)capRings;
for(int32_t i = 0; i < capRings; i++) {
const float_t phi1 = (float_t)GLM_PI_2 - (float_t)i * capStep;
@@ -67,8 +67,8 @@ void capsuleBuffer(
const float_t lxz1 = radius * cosf(phi1);
const float_t lxz2 = radius * cosf(phi2);
// UV: top cap occupies v in [0.5 + halfHeightFrac .. 1.0]: we use a
// simple per-band normalisation against the full height.
/* UV: top cap occupies v in [0.5 + halfHeightFrac .. 1.0]: we use a
* simple per-band normalisation against the full height. */
const float_t v1 = 1.0f - (float_t)i / (float_t)(2 * capRings + 1);
const float_t v2 = 1.0f - (float_t)(i + 1) / (float_t)(2 * capRings + 1);
@@ -97,7 +97,7 @@ void capsuleBuffer(
}
}
// ---- Cylindrical body ----
/* ---- Cylindrical body ---- */
{
const float_t yTop = cy + halfHeight;
const float_t yBot = cy - halfHeight;
+4 -6
View File
@@ -1,9 +1,7 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
// Copyright (c) 2026 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "display/display.h"
+3 -3
View File
@@ -59,7 +59,7 @@ void planeBuffer(
switch(axis) {
case PLANE_AXIS_XY: {
// Flat in XY at z = min[2]; spans X and Y.
/* Flat in XY at z = min[2]; spans X and Y. */
const float_t z = min[2];
PLANE_VERT(0, min[0], min[1], z, u0, v0)
PLANE_VERT(1, max[0], min[1], z, u1, v0)
@@ -71,7 +71,7 @@ void planeBuffer(
}
case PLANE_AXIS_XZ: {
// Flat in XZ at y = min[1]; spans X and Z.
/* Flat in XZ at y = min[1]; spans X and Z. */
const float_t y = min[1];
PLANE_VERT(0, min[0], y, min[2], u0, v0)
PLANE_VERT(1, max[0], y, min[2], u1, v0)
@@ -83,7 +83,7 @@ void planeBuffer(
}
case PLANE_AXIS_YZ: {
// Flat in YZ at x = min[0]; spans Y and Z.
/* Flat in YZ at x = min[0]; spans Y and Z. */
const float_t x = min[0];
PLANE_VERT(0, x, min[1], min[2], u0, v0)
PLANE_VERT(1, x, max[1], min[2], u1, v0)
+1 -1
View File
@@ -44,7 +44,7 @@ void sphereBuffer(
int32_t vi = 0;
for(int32_t i = 0; i < stacks; i++) {
// Latitude angles: top of band -> bottom of band
/* Latitude angles: top of band -> bottom of band */
const float_t phi1 = (float_t)GLM_PI_2 - (float_t)i * stackStep;
const float_t phi2 = (float_t)GLM_PI_2 - (float_t)(i + 1) * stackStep;
+5 -5
View File
@@ -47,17 +47,17 @@ void triPrismBuffer(
vertices[vi].uv[1] = (v); \
vi++;
// --- Front face (z = maxZ), CCW from +Z ---
/* --- Front face (z = maxZ), CCW from +Z --- */
PRISM_VERT(x0, y0, maxZ, 0.0f, 0.0f)
PRISM_VERT(x1, y1, maxZ, 1.0f, 0.0f)
PRISM_VERT(x2, y2, maxZ, 0.5f, 1.0f)
// --- Back face (z = minZ), CCW from -Z (reverse winding) ---
/* --- Back face (z = minZ), CCW from -Z (reverse winding) --- */
PRISM_VERT(x2, y2, minZ, 0.5f, 1.0f)
PRISM_VERT(x1, y1, minZ, 1.0f, 0.0f)
PRISM_VERT(x0, y0, minZ, 0.0f, 0.0f)
// --- Side face 0: edge p0->p1 ---
/* --- Side face 0: edge p0->p1 --- */
PRISM_VERT(x0, y0, minZ, 0.0f, 0.0f)
PRISM_VERT(x1, y1, minZ, 1.0f, 0.0f)
PRISM_VERT(x1, y1, maxZ, 1.0f, 1.0f)
@@ -66,7 +66,7 @@ void triPrismBuffer(
PRISM_VERT(x1, y1, maxZ, 1.0f, 1.0f)
PRISM_VERT(x0, y0, maxZ, 0.0f, 1.0f)
// --- Side face 1: edge p1->p2 ---
/* --- Side face 1: edge p1->p2 --- */
PRISM_VERT(x1, y1, minZ, 0.0f, 0.0f)
PRISM_VERT(x2, y2, minZ, 1.0f, 0.0f)
PRISM_VERT(x2, y2, maxZ, 1.0f, 1.0f)
@@ -75,7 +75,7 @@ void triPrismBuffer(
PRISM_VERT(x2, y2, maxZ, 1.0f, 1.0f)
PRISM_VERT(x1, y1, maxZ, 0.0f, 1.0f)
// --- Side face 2: edge p2->p0 ---
/* --- Side face 2: edge p2->p0 --- */
PRISM_VERT(x2, y2, minZ, 0.0f, 0.0f)
PRISM_VERT(x0, y0, minZ, 1.0f, 0.0f)
PRISM_VERT(x0, y0, maxZ, 1.0f, 1.0f)
+10 -10
View File
@@ -13,14 +13,14 @@
shader_t *bound = NULL;
errorret_t shaderInit(shader_t *shader, const shaderdefinition_t *def) {
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
errorChain(shaderInitPlatform(shader, def));
bound = NULL;
errorOk();
}
errorret_t shaderBind(shader_t *shader) {
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
errorChain(shaderBindPlatform(shader));
bound = shader;
errorOk();
@@ -31,9 +31,9 @@ errorret_t shaderSetMatrix(
const char_t *name,
mat4 matrix
) {
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
assertStrLenMin(name, 1, "Uniform name cannot be empty");
assertNotNull(matrix, "Matrix cannot be NULL");
assertNotNull(matrix, "Matrix cannot be null");
assertTrue(bound == shader, "Shader must be bound.");
errorChain(shaderSetMatrixPlatform(shader, name, matrix));
errorOk();
@@ -44,7 +44,7 @@ errorret_t shaderSetTexture(
const char_t *name,
texture_t *texture
) {
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
assertStrLenMin(name, 1, "Uniform name cannot be empty");
assertTrue(bound == shader, "Shader must be bound.");
errorChain(shaderSetTexturePlatform(shader, name, texture));
@@ -56,7 +56,7 @@ errorret_t shaderSetColor(
const char_t *name,
color_t color
) {
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
assertStrLenMin(name, 1, "Uniform name cannot be empty");
assertTrue(bound == shader, "Shader must be bound.");
errorChain(shaderSetColorPlatform(shader, name, color));
@@ -67,16 +67,16 @@ errorret_t shaderSetMaterial(
shader_t *shader,
const shadermaterial_t *material
) {
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(material, "Material cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
assertNotNull(material, "Material cannot be null");
assertTrue(bound == shader, "Shader must be bound.");
assertNotNull(shader->definition, "Shader definition cannot be NULL");
assertNotNull(shader->definition, "Shader definition cannot be null");
assertNotNull(shader->definition->setMaterial, "Def lacks setMaterial");
return shader->definition->setMaterial(shader, material);
}
errorret_t shaderDispose(shader_t *shader) {
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
bound = NULL;
errorChain(shaderDisposePlatform(shader));
errorOk();
+3 -3
View File
@@ -41,10 +41,10 @@ errorret_t shaderListInit() {
}
assertNotNull(
SHADER_LIST_DEFS[i].shader, "Shader cannot be NULL"
SHADER_LIST_DEFS[i].shader, "Shader cannot be null"
);
assertNotNull(
SHADER_LIST_DEFS[i].definition, "Shader definition cannot be NULL"
SHADER_LIST_DEFS[i].definition, "Shader definition cannot be null"
);
errorChain(shaderInit(
@@ -78,7 +78,7 @@ errorret_t shaderListDispose(void) {
}
assertNotNull(
SHADER_LIST_DEFS[i].shader, "Shader cannot be NULL"
SHADER_LIST_DEFS[i].shader, "Shader cannot be null"
);
errorChain(shaderDispose(SHADER_LIST_DEFS[i].shader));
+4 -4
View File
@@ -31,9 +31,9 @@ errorret_t spriteBatchBuffer(
shader_t *shader,
const shadermaterial_t material
) {
assertNotNull(sprites, "Sprites cannot be NULL");
assertNotNull(sprites, "Sprites cannot be null");
assertTrue(count > 0, "Count must be greater than zero");
assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(shader, "Shader cannot be null");
// Did the shader or material data change?
if(shader != SPRITEBATCH.shader) {
@@ -92,9 +92,9 @@ void spriteBatchBufferToMesh(
meshvertex_t *vertices,
const uint32_t verticesSize
) {
assertNotNull(sprites, "Sprites cannot be NULL");
assertNotNull(sprites, "Sprites cannot be null");
assertTrue(count > 0, "Count must be greater than zero");
assertNotNull(vertices, "Vertices cannot be NULL");
assertNotNull(vertices, "Vertices cannot be null");
assertTrue(
verticesSize >= count * QUAD_VERTEX_COUNT, "Vertices array too small"
);
@@ -27,7 +27,7 @@ typedef struct {
* @param y Screen y position of the sprite's top-left corner.
* @param width Width of the sprite in screen space.
* @param height Height of the sprite in screen space.
* @return The populated sprite.
* @returns The populated sprite.
*/
spritebatchsprite_t spriteBatchSpriteTilesetPosition(
const tileset_t *tileset,
+4 -4
View File
@@ -152,7 +152,7 @@ float_t inputGetLastValue(const inputaction_t action) {
const inputaction_t negY, const inputaction_t posY,
vec2 result
) {
assertNotNull(result, "Result vector cannot be NULL");
assertNotNull(result, "Result vector cannot be null");
result[0] = inputAxisDynamic(negX, posX);
result[1] = inputAxisDynamic(negY, posY);
}
@@ -162,7 +162,7 @@ float_t inputGetLastValue(const inputaction_t action) {
const inputaction_t negY, const inputaction_t posY,
vec2 result
) {
assertNotNull(result, "Result vector cannot be NULL");
assertNotNull(result, "Result vector cannot be null");
float_t x = inputAxisDynamic(negX, posX);
float_t y = inputAxisDynamic(negY, posY);
float_t mag = sqrtf(x * x + y * y);
@@ -208,7 +208,7 @@ void inputAxis2D(
const inputaction_t negY, const inputaction_t posY,
vec2 result
) {
assertNotNull(result, "Result vector cannot be NULL");
assertNotNull(result, "Result vector cannot be null");
result[0] = inputAxis(negX, posX);
result[1] = inputAxis(negY, posY);
}
@@ -218,7 +218,7 @@ void inputAngle2D(
const inputaction_t negY, const inputaction_t posY,
vec2 result
) {
assertNotNull(result, "Result vector cannot be NULL");
assertNotNull(result, "Result vector cannot be null");
float_t x = inputAxis(negX, posX);
float_t y = inputAxis(negY, posY);
float_t mag = sqrtf(x * x + y * y);
+1 -1
View File
@@ -82,6 +82,6 @@ void battleFighterInit(
* is not dead).
*
* @param fighter Pointer to the fighter to check.
* @return True if the fighter can act.
* @returns True if the fighter can act.
*/
bool_t battleFighterIsAlive(const battlefighter_t *fighter);
+1 -1
View File
@@ -136,7 +136,7 @@ void cutsceneSystemNext() {
// Start item.
const cutsceneitem_t *item = cutsceneSystemGetCurrentItem();
memoryZero(&CUTSCENE_SYSTEM.data, sizeof(CUTSCENE_SYSTEM.data));
memset(&CUTSCENE_SYSTEM.data, 0, sizeof(CUTSCENE_SYSTEM.data));
cutsceneItemStart(item, &CUTSCENE_SYSTEM.data);
}
+4 -4
View File
@@ -146,7 +146,7 @@ void cutsceneSystemSetOnComplete(cutscenecallback_t onComplete);
* Asserts the resolved entity is within bounds.
*
* @param entityIndex Raw entity index or sentinel value.
* @return Pointer to the resolved entity.
* @returns Pointer to the resolved entity.
*/
entity_t * cutsceneSystemGetEntity(const uint8_t entityIndex);
@@ -155,7 +155,7 @@ entity_t * cutsceneSystemGetEntity(const uint8_t entityIndex);
* a concrete map area ID.
*
* @param areaId Raw map area ID or sentinel value.
* @return The resolved map area ID.
* @returns The resolved map area ID.
*/
uint8_t cutsceneSystemGetAreaId(const uint8_t areaId);
@@ -164,7 +164,7 @@ uint8_t cutsceneSystemGetAreaId(const uint8_t areaId);
* sentinel) to a concrete UI_TEXTBOX_MINI_LIST slot index.
*
* @param index Raw slot index or sentinel value.
* @return The resolved slot index.
* @returns The resolved slot index.
*/
uint8_t cutsceneSystemGetTextMiniId(const uint8_t index);
@@ -174,7 +174,7 @@ uint8_t cutsceneSystemGetTextMiniId(const uint8_t index);
* once its keyboard closes). Empty ("") if nothing has been cached yet
* for the running cutscene.
*
* @return The cached text.
* @returns The cached text.
*/
const char_t * cutsceneSystemGetTextCache(void);
@@ -36,7 +36,7 @@ void cutsceneAudioFadeStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioFadeUpdate(
const cutsceneitem_t *item,
@@ -16,7 +16,7 @@
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once the channel is no longer fading.
* @returns true once the channel is no longer fading.
*/
bool_t cutsceneAudioFadeWaitUpdate(
const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneAudioPauseStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioPauseUpdate(
const cutsceneitem_t *item,
@@ -38,7 +38,7 @@ void cutsceneAudioPlayStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioPlayUpdate(
const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneAudioResumeStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioResumeUpdate(
const cutsceneitem_t *item,
@@ -37,7 +37,7 @@ void cutsceneAudioSetStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioSetUpdate(
const cutsceneitem_t *item,
@@ -34,7 +34,7 @@ void cutsceneAudioSetLoopStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioSetLoopUpdate(
const cutsceneitem_t *item,
@@ -31,7 +31,7 @@ void cutsceneAudioSetPanStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioSetPanUpdate(
const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneAudioStopStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneAudioStopUpdate(
const cutsceneitem_t *item,
@@ -32,7 +32,7 @@ void cutsceneBattleForceActionStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneBattleForceActionUpdate(
const cutsceneitem_t *item,
@@ -20,7 +20,7 @@ typedef struct {
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once BATTLE.state equals the watched state.
* @returns true once BATTLE.state equals the watched state.
*/
bool_t cutsceneBattleWaitStateUpdate(
const cutsceneitem_t *item,
@@ -43,7 +43,7 @@ void cutsceneStartBattleStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once the battle has ended.
* @returns true once the battle has ended.
*/
bool_t cutsceneStartBattleUpdate(
const cutsceneitem_t *item,
@@ -52,7 +52,7 @@ void cutsceneConcurrentStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once every child has completed.
* @returns true once every child has completed.
*/
bool_t cutsceneConcurrentUpdate(
const cutsceneitem_t *item,
@@ -15,7 +15,7 @@
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return false always.
* @returns false always.
*/
bool_t cutsceneIdleUpdate(
const cutsceneitem_t *item,
@@ -29,7 +29,7 @@ void cutsceneMarkerStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneMarkerUpdate(
const cutsceneitem_t *item,
@@ -27,7 +27,7 @@ void cutsceneQuitGameStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return false always.
* @returns false always.
*/
bool_t cutsceneQuitGameUpdate(
const cutsceneitem_t *item,
@@ -27,7 +27,7 @@ void cutsceneRestartStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return false always.
* @returns false always.
*/
bool_t cutsceneRestartUpdate(
const cutsceneitem_t *item,
@@ -33,7 +33,7 @@ void cutsceneSceneStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneSceneUpdate(
const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneSetPauseStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneSetPauseUpdate(
const cutsceneitem_t *item,
@@ -27,7 +27,7 @@ void cutsceneWaitStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true when the wait has elapsed.
* @returns true when the wait has elapsed.
*/
bool_t cutsceneWaitUpdate(
const cutsceneitem_t *item,
@@ -26,7 +26,7 @@ void cutsceneCallbackStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneCallbackUpdate(
const cutsceneitem_t *item,
+2 -2
View File
@@ -213,7 +213,7 @@ void cutsceneItemStart(
*
* @param item The cutscene item to tick.
* @param data Runtime data storage.
* @return true if the item is complete and the cutscene should advance.
* @returns true if the item is complete and the cutscene should advance.
*/
bool_t cutsceneItemUpdate(
const cutsceneitem_t *item,
@@ -252,7 +252,7 @@ void cutsceneCutsceneStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return false always.
* @returns false always.
*/
bool_t cutsceneCutsceneUpdate(
const cutsceneitem_t *item,
+1 -1
View File
@@ -30,7 +30,7 @@ void cutscenePrintStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutscenePrintUpdate(
const cutsceneitem_t *item,
@@ -31,7 +31,7 @@ void cutsceneEntityAddStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneEntityAddUpdate(
const cutsceneitem_t *item,
@@ -28,7 +28,7 @@ void cutsceneEntityRemoveStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneEntityRemoveUpdate(
const cutsceneitem_t *item,
@@ -30,7 +30,7 @@ void cutsceneEntityTeleportStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneEntityTeleportUpdate(
const cutsceneitem_t *item,
@@ -32,7 +32,7 @@ void cutsceneEntityTurnStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once the entity is idle and facing the target direction.
* @returns true once the entity is idle and facing the target direction.
*/
bool_t cutsceneEntityTurnUpdate(
const cutsceneitem_t *item,
@@ -36,7 +36,7 @@ void cutsceneEntityWalkToStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once all waypoints have been reached.
* @returns true once all waypoints have been reached.
*/
bool_t cutsceneEntityWalkToUpdate(
const cutsceneitem_t *item,
@@ -36,7 +36,7 @@ void cutsceneEntityWalkToEntityStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once the entity has reached the target's side.
* @returns true once the entity has reached the target's side.
*/
bool_t cutsceneEntityWalkToEntityUpdate(
const cutsceneitem_t *item,
@@ -30,7 +30,7 @@ void cutsceneItemGiveStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneItemGiveUpdate(
const cutsceneitem_t *item,
@@ -34,7 +34,7 @@ void cutsceneMapAreaAddStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneMapAreaAddUpdate(
const cutsceneitem_t *item,
@@ -29,7 +29,7 @@ void cutsceneMapAreaRemoveStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneMapAreaRemoveUpdate(
const cutsceneitem_t *item,
@@ -38,7 +38,7 @@ void cutsceneMapAreaWaitStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once any watched area has been triggered.
* @returns true once any watched area has been triggered.
*/
bool_t cutsceneMapAreaWaitUpdate(
const cutsceneitem_t *item,
@@ -34,7 +34,7 @@ void cutsceneSaveDeviceCheckStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return false always.
* @returns false always.
*/
bool_t cutsceneSaveDeviceCheckUpdate(
const cutsceneitem_t *item,
@@ -33,7 +33,7 @@ void cutsceneSaveLoadAllSlotsStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return false always.
* @returns false always.
*/
bool_t cutsceneSaveLoadAllSlotsUpdate(
const cutsceneitem_t *item,
@@ -32,7 +32,7 @@ void cutsceneEmojiStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneEmojiUpdate(
const cutsceneitem_t *item,
+1 -1
View File
@@ -33,7 +33,7 @@ void cutsceneFadeStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once the overlay transition has completed.
* @returns true once the overlay transition has completed.
*/
bool_t cutsceneFadeUpdate(
const cutsceneitem_t *item,
@@ -36,7 +36,7 @@ void cutsceneKeyboardStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once the keyboard has closed; false while still open.
* @returns true once the keyboard has closed; false while still open.
*/
bool_t cutsceneKeyboardUpdate(
const cutsceneitem_t *item,
@@ -71,7 +71,7 @@ void cutsceneModalStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once immediately for a message-only modal; false
* @returns true once immediately for a message-only modal; false
* always for a modal with options.
*/
bool_t cutsceneModalUpdate(
@@ -114,7 +114,7 @@ void cutsceneModalCloseStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneModalCloseUpdate(
const cutsceneitem_t *item,
@@ -46,7 +46,7 @@ void cutsceneModalOptionsMarkersStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return false always.
* @returns false always.
*/
bool_t cutsceneModalOptionsMarkersUpdate(
const cutsceneitem_t *item,
@@ -30,7 +30,7 @@ void cutsceneShakeStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneShakeUpdate(
const cutsceneitem_t *item,
+1 -1
View File
@@ -30,7 +30,7 @@ void cutsceneTextStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true once the textbox has been dismissed.
* @returns true once the textbox has been dismissed.
*/
bool_t cutsceneTextUpdate(
const cutsceneitem_t *item,
@@ -33,7 +33,7 @@ void cutsceneTextMiniStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneTextMiniUpdate(
const cutsceneitem_t *item,
@@ -28,7 +28,7 @@ void cutsceneTextMiniHideStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneTextMiniHideUpdate(
const cutsceneitem_t *item,
@@ -37,7 +37,7 @@ void cutsceneUIShowStart(
*
* @param item The cutscene item.
* @param data Runtime data storage.
* @return true always.
* @returns true always.
*/
bool_t cutsceneUIShowUpdate(
const cutsceneitem_t *item,
+1 -1
View File
@@ -41,6 +41,6 @@ void entityAnimUpdate(entity_t *entity);
* Used to lift entity render position to mid-ramp height.
*
* @param pos World position to sample.
* @return The Z offset to apply.
* @returns float_t The Z offset to apply.
*/
float_t entityAnimTileZOffset(const worldpos_t pos);
Loaded 100 of 170 files, more files were not shown because too many files have changed in this diff. Show more