Author SHA1 Message Date
YourWishesandClaude Opus 5 5cf81aa238 Normalize code style to match established conventions
An assistant-written stretch of code had drifted from the conventions the
older hand-written files establish. Sweeps the whole of src/ back into line.

Systematic:
- @returns -> @return (163 occurrences, 84 files). Concentrated in ui/ and
  rpg/cutscene/; the rest of the tree already used @return 646 times.
- Lowercase "null" -> "NULL" in assert/error message strings (170
  occurrences, 28 files), matching the dominant 441-use spelling. Covers
  "cannot be null", "must not be null" and adjectival uses.

Localized:
- sort.c: drop a stray #include <stdlib.h> that sat *above* the copyright
  header, leaving it the only file in the repo without a leading header
  block. Also drops the same redundant include from random.c and npcturn.c
  (dusk.h already pulls in stdlib.h).
- Convert 7 files' license headers from // lines to the /** */ block form.
- cutscenesystem.c: memset -> memoryZero, matching the identical call ~20
  lines further down and the rest of the codebase.
- Struct tags suffixed _t -> _s: threadlock_t -> threadmutex_s (which also
  makes the tag match its typedef) and chunkpos_t -> chunkpos_s.
- Convert 20 inline /* */ block comments to // across the mesh builders,
  assetfile.c and assetlocaleloader.c.
- Pointer truthiness if(!ptr) -> if(ptr == NULL) in 16 places, matching the
  267 existing explicit comparisons. Boolean !x checks are left alone.
- entityanim.h: drop a JSDoc-style type annotation from an @return.
- Document easing.h's 16 undeclared easing functions and
  assetjsonloader.h's 3 loader callbacks.

No behavioral change. Builds clean with no new warnings; ctest shows the
same 6 pre-existing failures as HEAD, verified against a pristine worktree.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-07 17:10:32 -05:00
136 changed files with 562 additions and 412 deletions
+11 -9
View File
@@ -1,7 +1,9 @@
// Copyright (c) 2026 Dominic Masters /**
// * Copyright (c) 2026 Dominic Masters
// This software is released under the MIT License. *
// https://opensource.org/licenses/MIT * This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "animation.h" #include "animation.h"
#include "assert/assert.h" #include "assert/assert.h"
@@ -14,9 +16,9 @@ void animationInit(
uint16_t *keyframeCounts, uint16_t *keyframeCounts,
const uint16_t layerCount const uint16_t layerCount
) { ) {
assertNotNull(anim, "Animation pointer cannot be null."); assertNotNull(anim, "Animation pointer cannot be NULL.");
assertNotNull(keyframes, "Keyframes pointer cannot be null."); assertNotNull(keyframes, "Keyframes pointer cannot be NULL.");
assertNotNull(keyframeCounts, "Keyframe counts pointer cannot be null."); assertNotNull(keyframeCounts, "Keyframe counts pointer cannot be NULL.");
assertTrue(layerCount > 0, "Layer count must be greater than zero."); assertTrue(layerCount > 0, "Layer count must be greater than zero.");
memoryZero(anim, sizeof(animation_t)); memoryZero(anim, sizeof(animation_t));
@@ -49,7 +51,7 @@ void animationInit(
} }
float_t animationGetLayerValue(const animation_t *anim, const uint16_t layer) { 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."); assertTrue(layer < anim->layerCount, "Layer index out of bounds.");
uint16_t keyframeCount = anim->keyframeCounts[layer]; uint16_t keyframeCount = anim->keyframeCounts[layer];
@@ -61,7 +63,7 @@ void animationUpdate(
animation_t *anim, animation_t *anim,
const float_t deltaTime 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."); assertTrue(deltaTime >= 0, "Delta time must be non-negative.");
bool_t justCompleted = false; bool_t justCompleted = false;
+6 -4
View File
@@ -1,7 +1,9 @@
// Copyright (c) 2026 Dominic Masters /**
// * Copyright (c) 2026 Dominic Masters
// This software is released under the MIT License. *
// https://opensource.org/licenses/MIT * This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once #pragma once
#include "keyframe.h" #include "keyframe.h"
+6 -4
View File
@@ -1,7 +1,9 @@
// Copyright (c) 2026 Dominic Masters /**
// * Copyright (c) 2026 Dominic Masters
// This software is released under the MIT License. *
// https://opensource.org/licenses/MIT * This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "easing.h" #include "easing.h"
#include "assert/assert.h" #include "assert/assert.h"
+123 -4
View File
@@ -1,7 +1,9 @@
// Copyright (c) 2026 Dominic Masters /**
// * Copyright (c) 2026 Dominic Masters
// This software is released under the MIT License. *
// https://opensource.org/licenses/MIT * This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once #pragma once
#include "dusk.h" #include "dusk.h"
@@ -45,19 +47,136 @@ extern const easingfn_t EASING_FUNCTIONS[EASING_COUNT];
*/ */
float_t easingApply(const easingtype_t type, const float_t t); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); float_t easingInOutBack(const float_t t);
+1 -1
View File
@@ -14,7 +14,7 @@ float_t keyframeGetValue(
const uint32_t keyframeCount, const uint32_t keyframeCount,
const float_t time 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(keyframeCount > 0, "Keyframe count must be more than 0.");
assertTrue(time >= 0, "Time must be non-negative."); assertTrue(time >= 0, "Time must be non-negative.");
#ifdef DUSK_ASSERTIONS #ifdef DUSK_ASSERTIONS
+6 -4
View File
@@ -1,7 +1,9 @@
// Copyright (c) 2026 Dominic Masters /**
// * Copyright (c) 2026 Dominic Masters
// This software is released under the MIT License. *
// https://opensource.org/licenses/MIT * This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once #pragma once
#include "easing.h" #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 // assetInitPlatform must either define both ASSET.zip/ASSET.zipStored or
// throw an error. // throw an error.
errorChain(assetInitPlatform()); errorChain(assetInitPlatform());
assertNotNull(ASSET.zip, "Asset zip null without error."); assertNotNull(ASSET.zip, "Asset zip NULL without error.");
assertNotNull(ASSET.zipStored, "Asset stored zip null without error."); assertNotNull(ASSET.zipStored, "Asset stored zip NULL without error.");
threadInit(&ASSET.loadThread, assetUpdateAsync); threadInit(&ASSET.loadThread, assetUpdateAsync);
threadStart(&ASSET.loadThread); threadStart(&ASSET.loadThread);
+9 -13
View File
@@ -279,7 +279,7 @@ errorret_t assetFileLineReaderAppend(
errorOk(); errorOk();
} }
/* reserve room for optional NUL terminator */ // reserve room for optional NUL terminator
if(reader->lineLength + srcLength >= reader->outBufferSize) { if(reader->lineLength + srcLength >= reader->outBufferSize) {
errorThrow("Line length exceeds output buffer size."); errorThrow("Line length exceeds output buffer size.");
} }
@@ -328,7 +328,7 @@ errorret_t assetFileLineReaderFill(assetfilelinereader_t *reader) {
size_t unreadBytes = assetFileLineReaderUnreadBytes(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) { if(unreadBytes == 0) {
reader->bufferStart = 0; reader->bufferStart = 0;
reader->bufferEnd = 0; reader->bufferEnd = 0;
@@ -349,18 +349,14 @@ errorret_t assetFileLineReaderFill(assetfilelinereader_t *reader) {
errorOk(); errorOk();
} }
/* // There are unread bytes left but no newline in them.
* There are unread bytes left but no newline in them. // If bufferStart > 0, slide unread bytes to front so we can read more.
* If bufferStart > 0, slide unread bytes to front so we can read more. // This only happens when necessary to make space.
* This only happens when necessary to make space.
*/
if(reader->bufferEnd == reader->readBufferSize) { if(reader->bufferEnd == reader->readBufferSize) {
if(reader->bufferStart == 0) { if(reader->bufferStart == 0) {
/* // Entire read buffer is unread and contains no newline.
* Entire read buffer is unread and contains no newline. // Caller must have a large enough outBuffer to accumulate across fills,
* Caller must have a large enough outBuffer to accumulate across fills, // so we consume these bytes into outBuffer before refilling.
* so we consume these bytes into outBuffer before refilling.
*/
errorOk(); errorOk();
} }
@@ -403,7 +399,7 @@ errorret_t assetFileLineReaderNext(assetfilelinereader_t *reader) {
size_t chunkLength = (size_t)newlineIndex - reader->bufferStart; size_t chunkLength = (size_t)newlineIndex - reader->bufferStart;
errorret_t ret; errorret_t ret;
/* strip CR in CRLF */ // strip CR in CRLF
if( if(
chunkLength > 0 && chunkLength > 0 &&
reader->readBuffer[(size_t)newlineIndex - 1] == '\r' reader->readBuffer[(size_t)newlineIndex - 1] == '\r'
+1 -1
View File
@@ -62,7 +62,7 @@ errorret_t assetModelLoaderSync(assetloading_t *loading) {
// Parse required mesh path. // Parse required mesh path.
yyjson_val *meshVal = yyjson_obj_get(root, "mesh"); yyjson_val *meshVal = yyjson_obj_get(root, "mesh");
if(!meshVal || !yyjson_is_str(meshVal)) { if(meshVal == NULL || !yyjson_is_str(meshVal)) {
assetUnlockEntry(jsonEntry); assetUnlockEntry(jsonEntry);
loading->entry->state = ASSET_ENTRY_STATE_ERROR; loading->entry->state = ASSET_ENTRY_STATE_ERROR;
errorThrow("Model JSON missing 'mesh' string"); 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. * on the main thread; this callback is never reached.
* *
* @param loading Loading information for the asset being loaded. * @param loading Loading information for the asset being loaded.
* @returns Always success. * @return Always success.
*/ */
errorret_t assetModelLoaderAsync(assetloading_t *loading); errorret_t assetModelLoaderAsync(assetloading_t *loading);
@@ -44,7 +44,7 @@ errorret_t assetModelLoaderAsync(assetloading_t *loading);
* within ASSET_LOADING_COUNT_MAX slot limits. * within ASSET_LOADING_COUNT_MAX slot limits.
* *
* @param loading Loading information for the asset being loaded. * @param loading Loading information for the asset being loaded.
* @returns Error code indicating success or failure. * @return Error code indicating success or failure.
*/ */
errorret_t assetModelLoaderSync(assetloading_t *loading); errorret_t assetModelLoaderSync(assetloading_t *loading);
@@ -53,6 +53,6 @@ errorret_t assetModelLoaderSync(assetloading_t *loading);
* sub-asset entries. * sub-asset entries.
* *
* @param entry Asset entry containing the model to dispose. * @param entry Asset entry containing the model to dispose.
* @returns Error code indicating success or failure. * @return Error code indicating success or failure.
*/ */
errorret_t assetModelDispose(assetentry_t *entry); errorret_t assetModelDispose(assetentry_t *entry);
+1 -1
View File
@@ -77,7 +77,7 @@ errorret_t assetJsonLoaderSync(assetloading_t *loading) {
memoryFree(buffer); memoryFree(buffer);
loading->loading.json.buffer = NULL; loading->loading.json.buffer = NULL;
if(!loading->entry->data.json) { if(loading->entry->data.json == NULL) {
assetLoaderErrorThrow(loading, "Failed to parse JSON"); assetLoaderErrorThrow(loading, "Failed to parse JSON");
} }
@@ -41,6 +41,32 @@ typedef struct {
typedef yyjson_doc * assetjsonoutput_t; 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); 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); 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); errorret_t assetJsonDispose(assetentry_t *entry);
@@ -93,7 +93,7 @@ errorret_t assetLocaleParseHeader(
// Find "Plural-Forms: " line and parse out plural form info // Find "Plural-Forms: " line and parse out plural form info
char_t *pluralFormsLine = strstr(headerBuffer, "Plural-Forms:"); char_t *pluralFormsLine = strstr(headerBuffer, "Plural-Forms:");
if(!pluralFormsLine) { if(pluralFormsLine == NULL) {
errorOk(); errorOk();
} }
@@ -101,7 +101,7 @@ errorret_t assetLocaleParseHeader(
// Expect nplurals // Expect nplurals
char_t *npluralsStr = strstr(pluralFormsLine, "nplurals="); char_t *npluralsStr = strstr(pluralFormsLine, "nplurals=");
if(!npluralsStr) { if(npluralsStr == NULL) {
errorThrow("Failed to find nplurals in Plural-Forms header."); errorThrow("Failed to find nplurals in Plural-Forms header.");
} }
npluralsStr += strlen("nplurals="); npluralsStr += strlen("nplurals=");
@@ -120,7 +120,7 @@ errorret_t assetLocaleParseHeader(
// Expect plural= // Expect plural=
char_t *pluralStr = strstr(pluralFormsLine, "plural="); char_t *pluralStr = strstr(pluralFormsLine, "plural=");
if(!pluralStr) { if(pluralStr == NULL) {
errorThrow("Failed to find plural in Plural-Forms header."); errorThrow("Failed to find plural in Plural-Forms header.");
} }
pluralStr += strlen("plural="); pluralStr += strlen("plural=");
@@ -128,7 +128,7 @@ errorret_t assetLocaleParseHeader(
// Expect ( [expressions] ) // Expect ( [expressions] )
char_t *openParen = strchr(pluralStr, '('); char_t *openParen = strchr(pluralStr, '(');
char_t *closeParen = strrchr(pluralStr, ')'); char_t *closeParen = strrchr(pluralStr, ')');
if(!openParen || !closeParen || closeParen < openParen) { if(openParen == NULL || closeParen == NULL || closeParen < openParen) {
errorThrow("Failed to find plural expression in Plural-Forms header."); 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. // At the point this funciton is called, we are looking for an opening quote.
char_t *start = strchr((char_t *)lineBuffer, '"'); char_t *start = strchr((char_t *)lineBuffer, '"');
if(!start) { if(start == NULL) {
errorThrow("Expected open (0) \""); errorThrow("Expected open (0) \"");
} }
char *end = strchr(start + 1, '"'); char *end = strchr(start + 1, '"');
if(!end) { if(end == NULL) {
errorThrow("Expected close (0) \""); errorThrow("Expected close (0) \"");
} }
*end = '\0'; *end = '\0';
@@ -690,7 +690,7 @@ errorret_t assetLocaleGetStringLookup(
// Parse until ] // Parse until ]
char *end = strchr(ptr, ']'); char *end = strchr(ptr, ']');
if(!end) { if(end == NULL) {
errorThrow("Expected ] for plural form, found: %s", lineBuffer); errorThrow("Expected ] for plural form, found: %s", lineBuffer);
} }
*end = '\0'; *end = '\0';
@@ -854,7 +854,7 @@ errorret_t assetLocaleGetStringWithArgs(
inIndex++; inIndex++;
/* Escaped percent */ // Escaped percent
if(format[inIndex] == '%') { if(format[inIndex] == '%') {
if(outIndex + 1 >= bufferSize) { if(outIndex + 1 >= bufferSize) {
memoryFree(format); memoryFree(format);
@@ -880,7 +880,7 @@ errorret_t assetLocaleGetStringWithArgs(
specBuffer[specLength++] = '%'; specBuffer[specLength++] = '%';
/* Allow flags / width / precision */ // Allow flags / width / precision
while(format[inIndex] != '\0') { while(format[inIndex] != '\0') {
char_t ch = format[inIndex]; char_t ch = format[inIndex];
+5 -5
View File
@@ -55,8 +55,8 @@ void capsuleBuffer(
vertices[vi].uv[1] = (v); \ vertices[vi].uv[1] = (v); \
vi++; vi++;
/* ---- Top hemisphere ---- */ // ---- Top hemisphere ----
/* phi ranges from PI/2 (top pole) down to 0 (equator). */ // phi ranges from PI/2 (top pole) down to 0 (equator).
const float_t capStep = (float_t)GLM_PI_2 / (float_t)capRings; const float_t capStep = (float_t)GLM_PI_2 / (float_t)capRings;
for(int32_t i = 0; i < capRings; i++) { for(int32_t i = 0; i < capRings; i++) {
const float_t phi1 = (float_t)GLM_PI_2 - (float_t)i * capStep; 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 lxz1 = radius * cosf(phi1);
const float_t lxz2 = radius * cosf(phi2); const float_t lxz2 = radius * cosf(phi2);
/* UV: top cap occupies v in [0.5 + halfHeightFrac .. 1.0]: we use a // UV: top cap occupies v in [0.5 + halfHeightFrac .. 1.0]: we use a
* simple per-band normalisation against the full height. */ // 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 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); 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 yTop = cy + halfHeight;
const float_t yBot = cy - halfHeight; const float_t yBot = cy - halfHeight;
+6 -4
View File
@@ -1,7 +1,9 @@
// Copyright (c) 2026 Dominic Masters /**
// * Copyright (c) 2026 Dominic Masters
// This software is released under the MIT License. *
// https://opensource.org/licenses/MIT * This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once #pragma once
#include "display/display.h" #include "display/display.h"
+3 -3
View File
@@ -59,7 +59,7 @@ void planeBuffer(
switch(axis) { switch(axis) {
case PLANE_AXIS_XY: { 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]; const float_t z = min[2];
PLANE_VERT(0, min[0], min[1], z, u0, v0) PLANE_VERT(0, min[0], min[1], z, u0, v0)
PLANE_VERT(1, max[0], min[1], z, u1, v0) PLANE_VERT(1, max[0], min[1], z, u1, v0)
@@ -71,7 +71,7 @@ void planeBuffer(
} }
case PLANE_AXIS_XZ: { 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]; const float_t y = min[1];
PLANE_VERT(0, min[0], y, min[2], u0, v0) PLANE_VERT(0, min[0], y, min[2], u0, v0)
PLANE_VERT(1, max[0], y, min[2], u1, v0) PLANE_VERT(1, max[0], y, min[2], u1, v0)
@@ -83,7 +83,7 @@ void planeBuffer(
} }
case PLANE_AXIS_YZ: { 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]; const float_t x = min[0];
PLANE_VERT(0, x, min[1], min[2], u0, v0) PLANE_VERT(0, x, min[1], min[2], u0, v0)
PLANE_VERT(1, x, max[1], min[2], u1, 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; int32_t vi = 0;
for(int32_t i = 0; i < stacks; i++) { 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 phi1 = (float_t)GLM_PI_2 - (float_t)i * stackStep;
const float_t phi2 = (float_t)GLM_PI_2 - (float_t)(i + 1) * 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); \ vertices[vi].uv[1] = (v); \
vi++; 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(x0, y0, maxZ, 0.0f, 0.0f)
PRISM_VERT(x1, y1, maxZ, 1.0f, 0.0f) PRISM_VERT(x1, y1, maxZ, 1.0f, 0.0f)
PRISM_VERT(x2, y2, maxZ, 0.5f, 1.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(x2, y2, minZ, 0.5f, 1.0f)
PRISM_VERT(x1, y1, minZ, 1.0f, 0.0f) PRISM_VERT(x1, y1, minZ, 1.0f, 0.0f)
PRISM_VERT(x0, y0, minZ, 0.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(x0, y0, minZ, 0.0f, 0.0f)
PRISM_VERT(x1, y1, minZ, 1.0f, 0.0f) PRISM_VERT(x1, y1, minZ, 1.0f, 0.0f)
PRISM_VERT(x1, y1, maxZ, 1.0f, 1.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(x1, y1, maxZ, 1.0f, 1.0f)
PRISM_VERT(x0, y0, maxZ, 0.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(x1, y1, minZ, 0.0f, 0.0f)
PRISM_VERT(x2, y2, minZ, 1.0f, 0.0f) PRISM_VERT(x2, y2, minZ, 1.0f, 0.0f)
PRISM_VERT(x2, y2, maxZ, 1.0f, 1.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(x2, y2, maxZ, 1.0f, 1.0f)
PRISM_VERT(x1, y1, maxZ, 0.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(x2, y2, minZ, 0.0f, 0.0f)
PRISM_VERT(x0, y0, minZ, 1.0f, 0.0f) PRISM_VERT(x0, y0, minZ, 1.0f, 0.0f)
PRISM_VERT(x0, y0, maxZ, 1.0f, 1.0f) PRISM_VERT(x0, y0, maxZ, 1.0f, 1.0f)
+10 -10
View File
@@ -13,14 +13,14 @@
shader_t *bound = NULL; shader_t *bound = NULL;
errorret_t shaderInit(shader_t *shader, const shaderdefinition_t *def) { 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)); errorChain(shaderInitPlatform(shader, def));
bound = NULL; bound = NULL;
errorOk(); errorOk();
} }
errorret_t shaderBind(shader_t *shader) { errorret_t shaderBind(shader_t *shader) {
assertNotNull(shader, "Shader cannot be null"); assertNotNull(shader, "Shader cannot be NULL");
errorChain(shaderBindPlatform(shader)); errorChain(shaderBindPlatform(shader));
bound = shader; bound = shader;
errorOk(); errorOk();
@@ -31,9 +31,9 @@ errorret_t shaderSetMatrix(
const char_t *name, const char_t *name,
mat4 matrix mat4 matrix
) { ) {
assertNotNull(shader, "Shader cannot be null"); assertNotNull(shader, "Shader cannot be NULL");
assertStrLenMin(name, 1, "Uniform name cannot be empty"); 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."); assertTrue(bound == shader, "Shader must be bound.");
errorChain(shaderSetMatrixPlatform(shader, name, matrix)); errorChain(shaderSetMatrixPlatform(shader, name, matrix));
errorOk(); errorOk();
@@ -44,7 +44,7 @@ errorret_t shaderSetTexture(
const char_t *name, const char_t *name,
texture_t *texture texture_t *texture
) { ) {
assertNotNull(shader, "Shader cannot be null"); assertNotNull(shader, "Shader cannot be NULL");
assertStrLenMin(name, 1, "Uniform name cannot be empty"); assertStrLenMin(name, 1, "Uniform name cannot be empty");
assertTrue(bound == shader, "Shader must be bound."); assertTrue(bound == shader, "Shader must be bound.");
errorChain(shaderSetTexturePlatform(shader, name, texture)); errorChain(shaderSetTexturePlatform(shader, name, texture));
@@ -56,7 +56,7 @@ errorret_t shaderSetColor(
const char_t *name, const char_t *name,
color_t color color_t color
) { ) {
assertNotNull(shader, "Shader cannot be null"); assertNotNull(shader, "Shader cannot be NULL");
assertStrLenMin(name, 1, "Uniform name cannot be empty"); assertStrLenMin(name, 1, "Uniform name cannot be empty");
assertTrue(bound == shader, "Shader must be bound."); assertTrue(bound == shader, "Shader must be bound.");
errorChain(shaderSetColorPlatform(shader, name, color)); errorChain(shaderSetColorPlatform(shader, name, color));
@@ -67,16 +67,16 @@ errorret_t shaderSetMaterial(
shader_t *shader, shader_t *shader,
const shadermaterial_t *material const shadermaterial_t *material
) { ) {
assertNotNull(shader, "Shader cannot be null"); assertNotNull(shader, "Shader cannot be NULL");
assertNotNull(material, "Material cannot be null"); assertNotNull(material, "Material cannot be NULL");
assertTrue(bound == shader, "Shader must be bound."); 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"); assertNotNull(shader->definition->setMaterial, "Def lacks setMaterial");
return shader->definition->setMaterial(shader, material); return shader->definition->setMaterial(shader, material);
} }
errorret_t shaderDispose(shader_t *shader) { errorret_t shaderDispose(shader_t *shader) {
assertNotNull(shader, "Shader cannot be null"); assertNotNull(shader, "Shader cannot be NULL");
bound = NULL; bound = NULL;
errorChain(shaderDisposePlatform(shader)); errorChain(shaderDisposePlatform(shader));
errorOk(); errorOk();
+3 -3
View File
@@ -41,10 +41,10 @@ errorret_t shaderListInit() {
} }
assertNotNull( assertNotNull(
SHADER_LIST_DEFS[i].shader, "Shader cannot be null" SHADER_LIST_DEFS[i].shader, "Shader cannot be NULL"
); );
assertNotNull( assertNotNull(
SHADER_LIST_DEFS[i].definition, "Shader definition cannot be null" SHADER_LIST_DEFS[i].definition, "Shader definition cannot be NULL"
); );
errorChain(shaderInit( errorChain(shaderInit(
@@ -78,7 +78,7 @@ errorret_t shaderListDispose(void) {
} }
assertNotNull( 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)); errorChain(shaderDispose(SHADER_LIST_DEFS[i].shader));
+4 -4
View File
@@ -31,9 +31,9 @@ errorret_t spriteBatchBuffer(
shader_t *shader, shader_t *shader,
const shadermaterial_t material 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"); 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? // Did the shader or material data change?
if(shader != SPRITEBATCH.shader) { if(shader != SPRITEBATCH.shader) {
@@ -92,9 +92,9 @@ void spriteBatchBufferToMesh(
meshvertex_t *vertices, meshvertex_t *vertices,
const uint32_t verticesSize 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"); assertTrue(count > 0, "Count must be greater than zero");
assertNotNull(vertices, "Vertices cannot be null"); assertNotNull(vertices, "Vertices cannot be NULL");
assertTrue( assertTrue(
verticesSize >= count * QUAD_VERTEX_COUNT, "Vertices array too small" 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 y Screen y position of the sprite's top-left corner.
* @param width Width of the sprite in screen space. * @param width Width of the sprite in screen space.
* @param height Height of the sprite in screen space. * @param height Height of the sprite in screen space.
* @returns The populated sprite. * @return The populated sprite.
*/ */
spritebatchsprite_t spriteBatchSpriteTilesetPosition( spritebatchsprite_t spriteBatchSpriteTilesetPosition(
const tileset_t *tileset, 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, const inputaction_t negY, const inputaction_t posY,
vec2 result vec2 result
) { ) {
assertNotNull(result, "Result vector cannot be null"); assertNotNull(result, "Result vector cannot be NULL");
result[0] = inputAxisDynamic(negX, posX); result[0] = inputAxisDynamic(negX, posX);
result[1] = inputAxisDynamic(negY, posY); result[1] = inputAxisDynamic(negY, posY);
} }
@@ -162,7 +162,7 @@ float_t inputGetLastValue(const inputaction_t action) {
const inputaction_t negY, const inputaction_t posY, const inputaction_t negY, const inputaction_t posY,
vec2 result vec2 result
) { ) {
assertNotNull(result, "Result vector cannot be null"); assertNotNull(result, "Result vector cannot be NULL");
float_t x = inputAxisDynamic(negX, posX); float_t x = inputAxisDynamic(negX, posX);
float_t y = inputAxisDynamic(negY, posY); float_t y = inputAxisDynamic(negY, posY);
float_t mag = sqrtf(x * x + y * y); float_t mag = sqrtf(x * x + y * y);
@@ -208,7 +208,7 @@ void inputAxis2D(
const inputaction_t negY, const inputaction_t posY, const inputaction_t negY, const inputaction_t posY,
vec2 result vec2 result
) { ) {
assertNotNull(result, "Result vector cannot be null"); assertNotNull(result, "Result vector cannot be NULL");
result[0] = inputAxis(negX, posX); result[0] = inputAxis(negX, posX);
result[1] = inputAxis(negY, posY); result[1] = inputAxis(negY, posY);
} }
@@ -218,7 +218,7 @@ void inputAngle2D(
const inputaction_t negY, const inputaction_t posY, const inputaction_t negY, const inputaction_t posY,
vec2 result vec2 result
) { ) {
assertNotNull(result, "Result vector cannot be null"); assertNotNull(result, "Result vector cannot be NULL");
float_t x = inputAxis(negX, posX); float_t x = inputAxis(negX, posX);
float_t y = inputAxis(negY, posY); float_t y = inputAxis(negY, posY);
float_t mag = sqrtf(x * x + y * y); float_t mag = sqrtf(x * x + y * y);
+1 -1
View File
@@ -82,6 +82,6 @@ void battleFighterInit(
* is not dead). * is not dead).
* *
* @param fighter Pointer to the fighter to check. * @param fighter Pointer to the fighter to check.
* @returns True if the fighter can act. * @return True if the fighter can act.
*/ */
bool_t battleFighterIsAlive(const battlefighter_t *fighter); bool_t battleFighterIsAlive(const battlefighter_t *fighter);
+1 -1
View File
@@ -136,7 +136,7 @@ void cutsceneSystemNext() {
// Start item. // Start item.
const cutsceneitem_t *item = cutsceneSystemGetCurrentItem(); const cutsceneitem_t *item = cutsceneSystemGetCurrentItem();
memset(&CUTSCENE_SYSTEM.data, 0, sizeof(CUTSCENE_SYSTEM.data)); memoryZero(&CUTSCENE_SYSTEM.data, sizeof(CUTSCENE_SYSTEM.data));
cutsceneItemStart(item, &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. * Asserts the resolved entity is within bounds.
* *
* @param entityIndex Raw entity index or sentinel value. * @param entityIndex Raw entity index or sentinel value.
* @returns Pointer to the resolved entity. * @return Pointer to the resolved entity.
*/ */
entity_t * cutsceneSystemGetEntity(const uint8_t entityIndex); entity_t * cutsceneSystemGetEntity(const uint8_t entityIndex);
@@ -155,7 +155,7 @@ entity_t * cutsceneSystemGetEntity(const uint8_t entityIndex);
* a concrete map area ID. * a concrete map area ID.
* *
* @param areaId Raw map area ID or sentinel value. * @param areaId Raw map area ID or sentinel value.
* @returns The resolved map area ID. * @return The resolved map area ID.
*/ */
uint8_t cutsceneSystemGetAreaId(const uint8_t areaId); 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. * sentinel) to a concrete UI_TEXTBOX_MINI_LIST slot index.
* *
* @param index Raw slot index or sentinel value. * @param index Raw slot index or sentinel value.
* @returns The resolved slot index. * @return The resolved slot index.
*/ */
uint8_t cutsceneSystemGetTextMiniId(const uint8_t 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 * once its keyboard closes). Empty ("") if nothing has been cached yet
* for the running cutscene. * for the running cutscene.
* *
* @returns The cached text. * @return The cached text.
*/ */
const char_t * cutsceneSystemGetTextCache(void); const char_t * cutsceneSystemGetTextCache(void);
@@ -36,7 +36,7 @@ void cutsceneAudioFadeStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioFadeUpdate( bool_t cutsceneAudioFadeUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -16,7 +16,7 @@
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once the channel is no longer fading. * @return true once the channel is no longer fading.
*/ */
bool_t cutsceneAudioFadeWaitUpdate( bool_t cutsceneAudioFadeWaitUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneAudioPauseStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioPauseUpdate( bool_t cutsceneAudioPauseUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -38,7 +38,7 @@ void cutsceneAudioPlayStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioPlayUpdate( bool_t cutsceneAudioPlayUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneAudioResumeStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioResumeUpdate( bool_t cutsceneAudioResumeUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -37,7 +37,7 @@ void cutsceneAudioSetStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioSetUpdate( bool_t cutsceneAudioSetUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -34,7 +34,7 @@ void cutsceneAudioSetLoopStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioSetLoopUpdate( bool_t cutsceneAudioSetLoopUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -31,7 +31,7 @@ void cutsceneAudioSetPanStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioSetPanUpdate( bool_t cutsceneAudioSetPanUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneAudioStopStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneAudioStopUpdate( bool_t cutsceneAudioStopUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -32,7 +32,7 @@ void cutsceneBattleForceActionStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneBattleForceActionUpdate( bool_t cutsceneBattleForceActionUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -20,7 +20,7 @@ typedef struct {
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once BATTLE.state equals the watched state. * @return true once BATTLE.state equals the watched state.
*/ */
bool_t cutsceneBattleWaitStateUpdate( bool_t cutsceneBattleWaitStateUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -43,7 +43,7 @@ void cutsceneStartBattleStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once the battle has ended. * @return true once the battle has ended.
*/ */
bool_t cutsceneStartBattleUpdate( bool_t cutsceneStartBattleUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -52,7 +52,7 @@ void cutsceneConcurrentStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once every child has completed. * @return true once every child has completed.
*/ */
bool_t cutsceneConcurrentUpdate( bool_t cutsceneConcurrentUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -15,7 +15,7 @@
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns false always. * @return false always.
*/ */
bool_t cutsceneIdleUpdate( bool_t cutsceneIdleUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -29,7 +29,7 @@ void cutsceneMarkerStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneMarkerUpdate( bool_t cutsceneMarkerUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -27,7 +27,7 @@ void cutsceneQuitGameStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns false always. * @return false always.
*/ */
bool_t cutsceneQuitGameUpdate( bool_t cutsceneQuitGameUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -27,7 +27,7 @@ void cutsceneRestartStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns false always. * @return false always.
*/ */
bool_t cutsceneRestartUpdate( bool_t cutsceneRestartUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -33,7 +33,7 @@ void cutsceneSceneStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneSceneUpdate( bool_t cutsceneSceneUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -25,7 +25,7 @@ void cutsceneSetPauseStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneSetPauseUpdate( bool_t cutsceneSetPauseUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -27,7 +27,7 @@ void cutsceneWaitStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true when the wait has elapsed. * @return true when the wait has elapsed.
*/ */
bool_t cutsceneWaitUpdate( bool_t cutsceneWaitUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -26,7 +26,7 @@ void cutsceneCallbackStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneCallbackUpdate( bool_t cutsceneCallbackUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
+2 -2
View File
@@ -213,7 +213,7 @@ void cutsceneItemStart(
* *
* @param item The cutscene item to tick. * @param item The cutscene item to tick.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true if the item is complete and the cutscene should advance. * @return true if the item is complete and the cutscene should advance.
*/ */
bool_t cutsceneItemUpdate( bool_t cutsceneItemUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -252,7 +252,7 @@ void cutsceneCutsceneStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns false always. * @return false always.
*/ */
bool_t cutsceneCutsceneUpdate( bool_t cutsceneCutsceneUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
+1 -1
View File
@@ -30,7 +30,7 @@ void cutscenePrintStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutscenePrintUpdate( bool_t cutscenePrintUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -31,7 +31,7 @@ void cutsceneEntityAddStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneEntityAddUpdate( bool_t cutsceneEntityAddUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -28,7 +28,7 @@ void cutsceneEntityRemoveStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneEntityRemoveUpdate( bool_t cutsceneEntityRemoveUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -30,7 +30,7 @@ void cutsceneEntityTeleportStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneEntityTeleportUpdate( bool_t cutsceneEntityTeleportUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -32,7 +32,7 @@ void cutsceneEntityTurnStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once the entity is idle and facing the target direction. * @return true once the entity is idle and facing the target direction.
*/ */
bool_t cutsceneEntityTurnUpdate( bool_t cutsceneEntityTurnUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -36,7 +36,7 @@ void cutsceneEntityWalkToStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once all waypoints have been reached. * @return true once all waypoints have been reached.
*/ */
bool_t cutsceneEntityWalkToUpdate( bool_t cutsceneEntityWalkToUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -36,7 +36,7 @@ void cutsceneEntityWalkToEntityStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once the entity has reached the target's side. * @return true once the entity has reached the target's side.
*/ */
bool_t cutsceneEntityWalkToEntityUpdate( bool_t cutsceneEntityWalkToEntityUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -30,7 +30,7 @@ void cutsceneItemGiveStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneItemGiveUpdate( bool_t cutsceneItemGiveUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -34,7 +34,7 @@ void cutsceneMapAreaAddStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneMapAreaAddUpdate( bool_t cutsceneMapAreaAddUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -29,7 +29,7 @@ void cutsceneMapAreaRemoveStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneMapAreaRemoveUpdate( bool_t cutsceneMapAreaRemoveUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -38,7 +38,7 @@ void cutsceneMapAreaWaitStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once any watched area has been triggered. * @return true once any watched area has been triggered.
*/ */
bool_t cutsceneMapAreaWaitUpdate( bool_t cutsceneMapAreaWaitUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -34,7 +34,7 @@ void cutsceneSaveDeviceCheckStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns false always. * @return false always.
*/ */
bool_t cutsceneSaveDeviceCheckUpdate( bool_t cutsceneSaveDeviceCheckUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -33,7 +33,7 @@ void cutsceneSaveLoadAllSlotsStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns false always. * @return false always.
*/ */
bool_t cutsceneSaveLoadAllSlotsUpdate( bool_t cutsceneSaveLoadAllSlotsUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -32,7 +32,7 @@ void cutsceneEmojiStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneEmojiUpdate( bool_t cutsceneEmojiUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
+1 -1
View File
@@ -33,7 +33,7 @@ void cutsceneFadeStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once the overlay transition has completed. * @return true once the overlay transition has completed.
*/ */
bool_t cutsceneFadeUpdate( bool_t cutsceneFadeUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -36,7 +36,7 @@ void cutsceneKeyboardStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once the keyboard has closed; false while still open. * @return true once the keyboard has closed; false while still open.
*/ */
bool_t cutsceneKeyboardUpdate( bool_t cutsceneKeyboardUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -71,7 +71,7 @@ void cutsceneModalStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once immediately for a message-only modal; false * @return true once immediately for a message-only modal; false
* always for a modal with options. * always for a modal with options.
*/ */
bool_t cutsceneModalUpdate( bool_t cutsceneModalUpdate(
@@ -114,7 +114,7 @@ void cutsceneModalCloseStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneModalCloseUpdate( bool_t cutsceneModalCloseUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -46,7 +46,7 @@ void cutsceneModalOptionsMarkersStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns false always. * @return false always.
*/ */
bool_t cutsceneModalOptionsMarkersUpdate( bool_t cutsceneModalOptionsMarkersUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -30,7 +30,7 @@ void cutsceneShakeStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneShakeUpdate( bool_t cutsceneShakeUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
+1 -1
View File
@@ -30,7 +30,7 @@ void cutsceneTextStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true once the textbox has been dismissed. * @return true once the textbox has been dismissed.
*/ */
bool_t cutsceneTextUpdate( bool_t cutsceneTextUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -33,7 +33,7 @@ void cutsceneTextMiniStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneTextMiniUpdate( bool_t cutsceneTextMiniUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -28,7 +28,7 @@ void cutsceneTextMiniHideStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneTextMiniHideUpdate( bool_t cutsceneTextMiniHideUpdate(
const cutsceneitem_t *item, const cutsceneitem_t *item,
@@ -37,7 +37,7 @@ void cutsceneUIShowStart(
* *
* @param item The cutscene item. * @param item The cutscene item.
* @param data Runtime data storage. * @param data Runtime data storage.
* @returns true always. * @return true always.
*/ */
bool_t cutsceneUIShowUpdate( bool_t cutsceneUIShowUpdate(
const cutsceneitem_t *item, 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. * Used to lift entity render position to mid-ramp height.
* *
* @param pos World position to sample. * @param pos World position to sample.
* @returns float_t The Z offset to apply. * @return The Z offset to apply.
*/ */
float_t entityAnimTileZOffset(const worldpos_t pos); float_t entityAnimTileZOffset(const worldpos_t pos);
+7 -7
View File
@@ -63,7 +63,7 @@ void entityUpdate(entity_t *entity);
* Returns true if the entity is in a state where it can turn. * Returns true if the entity is in a state where it can turn.
* *
* @param entity Pointer to the entity to check. * @param entity Pointer to the entity to check.
* @returns True if the entity can turn. * @return True if the entity can turn.
*/ */
bool_t entityCanTurn(entity_t *entity); bool_t entityCanTurn(entity_t *entity);
@@ -71,7 +71,7 @@ bool_t entityCanTurn(entity_t *entity);
* Returns true if the entity is in a state where it can walk. * Returns true if the entity is in a state where it can walk.
* *
* @param entity Pointer to the entity to check. * @param entity Pointer to the entity to check.
* @returns True if the entity can walk. * @return True if the entity can walk.
*/ */
bool_t entityCanWalk(entity_t *entity); bool_t entityCanWalk(entity_t *entity);
@@ -79,7 +79,7 @@ bool_t entityCanWalk(entity_t *entity);
* Returns true if the entity is in a state where it can run. * Returns true if the entity is in a state where it can run.
* *
* @param entity Pointer to the entity to check. * @param entity Pointer to the entity to check.
* @returns True if the entity can run. * @return True if the entity can run.
*/ */
bool_t entityCanRun(entity_t *entity); bool_t entityCanRun(entity_t *entity);
@@ -89,7 +89,7 @@ bool_t entityCanRun(entity_t *entity);
* range below ENTITY_GLOBAL_ID_START. * range below ENTITY_GLOBAL_ID_START.
* *
* @param entity Pointer to the entity to check. * @param entity Pointer to the entity to check.
* @returns True if the entity can be unloaded. * @return True if the entity can be unloaded.
*/ */
bool_t entityCanUnload(entity_t *entity); bool_t entityCanUnload(entity_t *entity);
@@ -112,7 +112,7 @@ void entityTurn(entity_t *entity, const entitydir_t direction);
* @param direction The direction the entity is moving in. * @param direction The direction the entity is moving in.
* @param newPos The world position the entity is moving to. * @param newPos The world position the entity is moving to.
* @param tileNew In/out: the tile at newPos, possibly cleared to TILE_NULL. * @param tileNew In/out: the tile at newPos, possibly cleared to TILE_NULL.
* @returns True if the entity should be raised up onto the ramp. * @return True if the entity should be raised up onto the ramp.
*/ */
bool_t entityWalkCheckRampUp( bool_t entityWalkCheckRampUp(
const tile_t tileCurrent, const tile_t tileCurrent,
@@ -128,7 +128,7 @@ bool_t entityWalkCheckRampUp(
* @param tileNew The tile at the position the entity is moving to. * @param tileNew The tile at the position the entity is moving to.
* @param newPos The world position the entity is moving to. * @param newPos The world position the entity is moving to.
* @param direction The direction the entity is moving in. * @param direction The direction the entity is moving in.
* @returns True if the entity should fall to the tile below newPos. * @return True if the entity should fall to the tile below newPos.
*/ */
bool_t entityWalkCheckFall( bool_t entityWalkCheckFall(
const tile_t tileNew, const worldpos_t newPos, const entitydir_t direction const tile_t tileNew, const worldpos_t newPos, const entitydir_t direction
@@ -139,7 +139,7 @@ bool_t entityWalkCheckFall(
* *
* @param entity The entity that is moving (excluded from the check). * @param entity The entity that is moving (excluded from the check).
* @param newPos The world position to check for occupancy. * @param newPos The world position to check for occupancy.
* @returns True if another entity occupies newPos. * @return True if another entity occupies newPos.
*/ */
bool_t entityWalkIsBlockedByEntity(entity_t *entity, const worldpos_t newPos); bool_t entityWalkIsBlockedByEntity(entity_t *entity, const worldpos_t newPos);
+1 -1
View File
@@ -17,7 +17,7 @@
* @param entity Pointer to the entity to move. * @param entity Pointer to the entity to move.
* @param target The world position to move toward. * @param target The world position to move toward.
* @param walkAround Whether to try perpendicular directions when blocked. * @param walkAround Whether to try perpendicular directions when blocked.
* @returns true if the entity is already at target, false otherwise. * @return true if the entity is already at target, false otherwise.
*/ */
bool_t entityPathStep( bool_t entityPathStep(
entity_t *entity, entity_t *entity,
@@ -21,7 +21,7 @@ typedef struct {
* Callback invoked to initialize a global entity. * Callback invoked to initialize a global entity.
* *
* @param create Pointer to the entity/position being initialized. * @param create Pointer to the entity/position being initialized.
* @returns An error code. * @return An error code.
*/ */
typedef void (*entityglobalinitcallback_t)( typedef void (*entityglobalinitcallback_t)(
entityglobalcreate_t *create entityglobalcreate_t *create
-1
View File
@@ -9,7 +9,6 @@
#include "rpg/entity/entity.h" #include "rpg/entity/entity.h"
#include "util/random.h" #include "util/random.h"
#include "time/time.h" #include "time/time.h"
#include <stdlib.h>
void npcRandomTurnInit(npc_t *npc) { void npcRandomTurnInit(npc_t *npc) {
npcrandomturn_t *turn = &npc->moveData.randomTurn; npcrandomturn_t *turn = &npc->moveData.randomTurn;
+1 -1
View File
@@ -40,7 +40,7 @@ void playerInit(entity_t *entity);
* Returns true if the player entity is in a state where it can interact. * Returns true if the player entity is in a state where it can interact.
* *
* @param entity Pointer to the player entity to check. * @param entity Pointer to the player entity to check.
* @returns True if the entity can interact. * @return True if the entity can interact.
*/ */
bool_t playerCanInteract(entity_t *entity); bool_t playerCanInteract(entity_t *entity);
+9 -9
View File
@@ -21,49 +21,49 @@ void backpackInit() {
} }
inventory_t *backpackGetInventory(const itemtype_t type) { inventory_t *backpackGetInventory(const itemtype_t type) {
assertTrue(type > ITEM_TYPE_NULL, "Item type must not be null"); assertTrue(type > ITEM_TYPE_NULL, "Item type must not be NULL");
assertTrue(type < ITEM_TYPE_COUNT, "Item type out of range"); assertTrue(type < ITEM_TYPE_COUNT, "Item type out of range");
return &BACKPACK.inventories[type]; return &BACKPACK.inventories[type];
} }
void backpackAdd(const itemid_t item, const uint8_t quantity) { void backpackAdd(const itemid_t item, const uint8_t quantity) {
assertTrue(item > ITEM_ID_NULL, "Item ID must not be null"); assertTrue(item > ITEM_ID_NULL, "Item ID must not be NULL");
assertTrue(item < ITEM_ID_COUNT, "Item ID out of range"); assertTrue(item < ITEM_ID_COUNT, "Item ID out of range");
inventoryAdd(backpackGetInventory(ITEMS[item].type), item, quantity); inventoryAdd(backpackGetInventory(ITEMS[item].type), item, quantity);
} }
void backpackRemove(const itemid_t item) { void backpackRemove(const itemid_t item) {
assertTrue(item > ITEM_ID_NULL, "Item ID must not be null"); assertTrue(item > ITEM_ID_NULL, "Item ID must not be NULL");
assertTrue(item < ITEM_ID_COUNT, "Item ID out of range"); assertTrue(item < ITEM_ID_COUNT, "Item ID out of range");
inventoryRemove(backpackGetInventory(ITEMS[item].type), item); inventoryRemove(backpackGetInventory(ITEMS[item].type), item);
} }
void backpackSet(const itemid_t item, const uint8_t quantity) { void backpackSet(const itemid_t item, const uint8_t quantity) {
assertTrue(item > ITEM_ID_NULL, "Item ID must not be null"); assertTrue(item > ITEM_ID_NULL, "Item ID must not be NULL");
assertTrue(item < ITEM_ID_COUNT, "Item ID out of range"); assertTrue(item < ITEM_ID_COUNT, "Item ID out of range");
inventorySet(backpackGetInventory(ITEMS[item].type), item, quantity); inventorySet(backpackGetInventory(ITEMS[item].type), item, quantity);
} }
uint8_t backpackGetCount(const itemid_t item) { uint8_t backpackGetCount(const itemid_t item) {
assertTrue(item > ITEM_ID_NULL, "Item ID must not be null"); assertTrue(item > ITEM_ID_NULL, "Item ID must not be NULL");
assertTrue(item < ITEM_ID_COUNT, "Item ID out of range"); assertTrue(item < ITEM_ID_COUNT, "Item ID out of range");
return inventoryGetCount(backpackGetInventory(ITEMS[item].type), item); return inventoryGetCount(backpackGetInventory(ITEMS[item].type), item);
} }
bool_t backpackItemExists(const itemid_t item) { bool_t backpackItemExists(const itemid_t item) {
assertTrue(item > ITEM_ID_NULL, "Item ID must not be null"); assertTrue(item > ITEM_ID_NULL, "Item ID must not be NULL");
assertTrue(item < ITEM_ID_COUNT, "Item ID out of range"); assertTrue(item < ITEM_ID_COUNT, "Item ID out of range");
return inventoryItemExists(backpackGetInventory(ITEMS[item].type), item); return inventoryItemExists(backpackGetInventory(ITEMS[item].type), item);
} }
bool_t backpackIsFull(const itemtype_t type) { bool_t backpackIsFull(const itemtype_t type) {
assertTrue(type > ITEM_TYPE_NULL, "Item type must not be null"); assertTrue(type > ITEM_TYPE_NULL, "Item type must not be NULL");
assertTrue(type < ITEM_TYPE_COUNT, "Item type out of range"); assertTrue(type < ITEM_TYPE_COUNT, "Item type out of range");
return inventoryIsFull(backpackGetInventory(type)); return inventoryIsFull(backpackGetInventory(type));
} }
bool_t backpackItemFull(const itemid_t item) { bool_t backpackItemFull(const itemid_t item) {
assertTrue(item > ITEM_ID_NULL, "Item ID must not be null"); assertTrue(item > ITEM_ID_NULL, "Item ID must not be NULL");
assertTrue(item < ITEM_ID_COUNT, "Item ID out of range"); assertTrue(item < ITEM_ID_COUNT, "Item ID out of range");
return inventoryItemFull(backpackGetInventory(ITEMS[item].type), item); return inventoryItemFull(backpackGetInventory(ITEMS[item].type), item);
} }
@@ -73,7 +73,7 @@ void backpackSort(
const inventorysort_t sortBy, const inventorysort_t sortBy,
const bool_t reverse const bool_t reverse
) { ) {
assertTrue(type > ITEM_TYPE_NULL, "Item type must not be null"); assertTrue(type > ITEM_TYPE_NULL, "Item type must not be NULL");
assertTrue(type < ITEM_TYPE_COUNT, "Item type out of range"); assertTrue(type < ITEM_TYPE_COUNT, "Item type out of range");
inventorySort(backpackGetInventory(type), sortBy, reverse); inventorySort(backpackGetInventory(type), sortBy, reverse);
} }
+5 -5
View File
@@ -24,7 +24,7 @@ void backpackInit();
* Returns the inventory for a given item type. * Returns the inventory for a given item type.
* *
* @param type The item type. * @param type The item type.
* @returns Pointer to the inventory for that type. * @return Pointer to the inventory for that type.
*/ */
inventory_t *backpackGetInventory(const itemtype_t type); inventory_t *backpackGetInventory(const itemtype_t type);
@@ -55,7 +55,7 @@ void backpackSet(const itemid_t item, const uint8_t quantity);
* Gets the quantity of an item in the backpack. * Gets the quantity of an item in the backpack.
* *
* @param item The item ID to check. * @param item The item ID to check.
* @returns The quantity held. * @return The quantity held.
*/ */
uint8_t backpackGetCount(const itemid_t item); uint8_t backpackGetCount(const itemid_t item);
@@ -63,7 +63,7 @@ uint8_t backpackGetCount(const itemid_t item);
* Checks if an item exists in the backpack (quantity > 0). * Checks if an item exists in the backpack (quantity > 0).
* *
* @param item The item ID to check. * @param item The item ID to check.
* @returns true if the item exists. * @return true if the item exists.
*/ */
bool_t backpackItemExists(const itemid_t item); bool_t backpackItemExists(const itemid_t item);
@@ -71,7 +71,7 @@ bool_t backpackItemExists(const itemid_t item);
* Checks if the inventory for a given type is full. * Checks if the inventory for a given type is full.
* *
* @param type The item type to check. * @param type The item type to check.
* @returns true if the type's inventory is full. * @return true if the type's inventory is full.
*/ */
bool_t backpackIsFull(const itemtype_t type); bool_t backpackIsFull(const itemtype_t type);
@@ -79,7 +79,7 @@ bool_t backpackIsFull(const itemtype_t type);
* Checks if an item's stack is full in the backpack. * Checks if an item's stack is full in the backpack.
* *
* @param item The item ID to check. * @param item The item ID to check.
* @returns true if the item stack is full. * @return true if the item stack is full.
*/ */
bool_t backpackItemFull(const itemid_t item); bool_t backpackItemFull(const itemid_t item);
+1 -1
View File
@@ -15,7 +15,7 @@ errorret_t itemGetName(
char_t *buffer, char_t *buffer,
const size_t bufferSize const size_t bufferSize
) { ) {
assertTrue(item > ITEM_ID_NULL, "Item ID must not be null"); assertTrue(item > ITEM_ID_NULL, "Item ID must not be NULL");
assertTrue(item < ITEM_ID_COUNT, "Item ID out of range"); assertTrue(item < ITEM_ID_COUNT, "Item ID out of range");
errorChain(localeManagerGetString(ITEMS[item].name, buffer, bufferSize, 0)); errorChain(localeManagerGetString(ITEMS[item].name, buffer, bufferSize, 0));
+6 -6
View File
@@ -76,7 +76,7 @@ void mapAreaInit(
* *
* @param area Pointer to the map area to check. * @param area Pointer to the map area to check.
* @param position The world position to check. * @param position The world position to check.
* @returns true if the position is inside the area. * @return true if the position is inside the area.
*/ */
bool_t mapAreaIsInside(const maparea_t *area, const worldpos_t position); bool_t mapAreaIsInside(const maparea_t *area, const worldpos_t position);
@@ -86,7 +86,7 @@ bool_t mapAreaIsInside(const maparea_t *area, const worldpos_t position);
* *
* @param area Pointer to the map area to check. * @param area Pointer to the map area to check.
* @param chunk Pointer to the chunk to check. * @param chunk Pointer to the chunk to check.
* @returns true if the chunk overlaps the area. * @return true if the chunk overlaps the area.
*/ */
bool_t mapAreaIsChunkOverlappingOrInside( bool_t mapAreaIsChunkOverlappingOrInside(
const maparea_t *area, const maparea_t *area,
@@ -98,7 +98,7 @@ bool_t mapAreaIsChunkOverlappingOrInside(
* occupies a position within its bounds. * occupies a position within its bounds.
* *
* @param area Pointer to the map area to check. * @param area Pointer to the map area to check.
* @returns true if no entity is inside the area. * @return true if no entity is inside the area.
*/ */
bool_t mapAreaCanUnload(const maparea_t *area); bool_t mapAreaCanUnload(const maparea_t *area);
@@ -107,7 +107,7 @@ bool_t mapAreaCanUnload(const maparea_t *area);
* *
* @param area Pointer to the map area to check. * @param area Pointer to the map area to check.
* @param entity Pointer to the entity to check. * @param entity Pointer to the entity to check.
* @returns true if the entity's type should trigger this area's callback. * @return true if the entity's type should trigger this area's callback.
*/ */
bool_t mapAreaShouldNotify(const maparea_t *area, const entity_t *entity); bool_t mapAreaShouldNotify(const maparea_t *area, const entity_t *entity);
@@ -122,7 +122,7 @@ bool_t mapAreaShouldNotify(const maparea_t *area, const entity_t *entity);
* should trigger the callback. * should trigger the callback.
* @param trigger Bitwise MAP_TRIGGER_* flags for which conditions should * @param trigger Bitwise MAP_TRIGGER_* flags for which conditions should
* invoke the callback. * invoke the callback.
* @returns The ID of the newly added map area. * @return The ID of the newly added map area.
*/ */
uint8_t mapAreaAdd( uint8_t mapAreaAdd(
const worldpos_t min, const worldpos_t min,
@@ -176,7 +176,7 @@ void mapAreaNoopCallback(entity_t *entity, const uint8_t trigger);
* should trigger the callback. * should trigger the callback.
* @param trigger Bitwise MAP_TRIGGER_* flags for which conditions should * @param trigger Bitwise MAP_TRIGGER_* flags for which conditions should
* invoke the callback. * invoke the callback.
* @returns The ID of the newly added map area. * @return The ID of the newly added map area.
*/ */
uint8_t mapAreaAddGlobal( uint8_t mapAreaAddGlobal(
const worldpos_t min, const worldpos_t min,
+1 -1
View File
@@ -53,7 +53,7 @@ typedef struct worldpos_s {
worldunit_t x, y, z; worldunit_t x, y, z;
} worldpos_t; } worldpos_t;
typedef struct chunkpos_t { typedef struct chunkpos_s {
chunkunit_t x, y, z; chunkunit_t x, y, z;
} chunkpos_t; } chunkpos_t;
+4 -4
View File
@@ -49,7 +49,7 @@ errorret_t saveUpdate() {
if(SAVE.findingAvailableDevice) { if(SAVE.findingAvailableDevice) {
assertNotNull( assertNotNull(
SAVE.findAvailableCallback, SAVE.findAvailableCallback,
"Callback cannot be null while looking for devices" "Callback cannot be NULL while looking for devices"
); );
// Yes, we have a device available, fire the callback. // Yes, we have a device available, fire the callback.
@@ -94,7 +94,7 @@ void saveFindAvailableDevice(
void *user void *user
) { ) {
assertIsMainThread("Invalid thread"); assertIsMainThread("Invalid thread");
assertNotNull(callback, "Callback cannot be null"); assertNotNull(callback, "Callback cannot be NULL");
assertFalse( assertFalse(
SAVE.findingAvailableDevice, SAVE.findingAvailableDevice,
"Already finding an available device" "Already finding an available device"
@@ -122,7 +122,7 @@ void saveFindAvailableDevice(
// No currently available device, check them IN ORDER, starting at 0 // No currently available device, check them IN ORDER, starting at 0
savedevice_t *deviceToCheck = &SAVE.devices[0]; savedevice_t *deviceToCheck = &SAVE.devices[0];
assertNotNull(deviceToCheck, "Device to check cannot be null"); assertNotNull(deviceToCheck, "Device to check cannot be NULL");
saveDeviceCheckAvailability( saveDeviceCheckAvailability(
deviceToCheck, deviceToCheck,
saveOnDeviceAvailabilityChecked, saveOnDeviceAvailabilityChecked,
@@ -131,7 +131,7 @@ void saveFindAvailableDevice(
} }
void saveOnDeviceAvailabilityChecked(savedevice_t *device, void *user) { void saveOnDeviceAvailabilityChecked(savedevice_t *device, void *user) {
assertNotNull(device, "Device cannot be null"); assertNotNull(device, "Device cannot be NULL");
assertTrue( assertTrue(
SAVE.findingAvailableDevice, SAVE.findingAvailableDevice,
"Not currently finding an available device" "Not currently finding an available device"
+14 -14
View File
@@ -20,7 +20,7 @@
#endif #endif
errorret_t saveDeviceInit(savedevice_t *device) { errorret_t saveDeviceInit(savedevice_t *device) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
memoryZero(device, sizeof(savedevice_t)); memoryZero(device, sizeof(savedevice_t));
device->state = 0xFF;// We set this because the platform must define it. device->state = 0xFF;// We set this because the platform must define it.
@@ -39,7 +39,7 @@ errorret_t saveDeviceInit(savedevice_t *device) {
} }
errorret_t saveDeviceUpdate(savedevice_t *device) { errorret_t saveDeviceUpdate(savedevice_t *device) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
assertIsMainThread("Invalid thread"); assertIsMainThread("Invalid thread");
// Perform a device update. // Perform a device update.
@@ -55,7 +55,7 @@ errorret_t saveDeviceUpdate(savedevice_t *device) {
} }
void saveDeviceFireCallback(savedevice_t *device) { void saveDeviceFireCallback(savedevice_t *device) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
assertIsMainThread("Invalid thread"); assertIsMainThread("Invalid thread");
assertFalse(device->fireCallback, "Device callback already fired?"); assertFalse(device->fireCallback, "Device callback already fired?");
device->fireCallback = true; device->fireCallback = true;
@@ -66,8 +66,8 @@ void saveDeviceCheckAvailability(
savedevicestatecallback_t callback, savedevicestatecallback_t callback,
void *user void *user
) { ) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
assertNotNull(callback, "callback cannot be null"); assertNotNull(callback, "callback cannot be NULL");
assertIsMainThread("Invalid thread"); assertIsMainThread("Invalid thread");
// The device must be in a state that we allow checking the availability. // The device must be in a state that we allow checking the availability.
@@ -471,8 +471,8 @@ errorret_t saveDeviceSlotWrite(
saveslot_t *slot, saveslot_t *slot,
const uint8_t slotIndex const uint8_t slotIndex
) { ) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
assertNotNull(slot, "slot cannot be null"); assertNotNull(slot, "slot cannot be NULL");
#if defined(SAVE_DEVICE_DATA_RAW) #if defined(SAVE_DEVICE_DATA_RAW)
errorChain(saveDeviceRawStoreItem(device, NULL, slot, slotIndex)); errorChain(saveDeviceRawStoreItem(device, NULL, slot, slotIndex));
@@ -488,8 +488,8 @@ errorret_t saveDeviceSlotRead(
saveslot_t *slot, saveslot_t *slot,
const uint8_t slotIndex const uint8_t slotIndex
) { ) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
assertNotNull(slot, "slot cannot be null"); assertNotNull(slot, "slot cannot be NULL");
#if defined(SAVE_DEVICE_DATA_RAW) #if defined(SAVE_DEVICE_DATA_RAW)
errorChain(saveDeviceRawFetchItem(device, NULL, slot, slotIndex)); errorChain(saveDeviceRawFetchItem(device, NULL, slot, slotIndex));
@@ -504,8 +504,8 @@ errorret_t saveDeviceSettingsWrite(
savedevice_t *device, savedevice_t *device,
savesettings_t *settings savesettings_t *settings
) { ) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
assertNotNull(settings, "settings cannot be null"); assertNotNull(settings, "settings cannot be NULL");
#if defined(SAVE_DEVICE_DATA_RAW) #if defined(SAVE_DEVICE_DATA_RAW)
errorChain(saveDeviceRawStoreItem(device, settings, NULL, 0)); errorChain(saveDeviceRawStoreItem(device, settings, NULL, 0));
@@ -520,8 +520,8 @@ errorret_t saveDeviceSettingsRead(
savedevice_t *device, savedevice_t *device,
savesettings_t *settings savesettings_t *settings
) { ) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
assertNotNull(settings, "settings cannot be null"); assertNotNull(settings, "settings cannot be NULL");
#if defined(SAVE_DEVICE_DATA_RAW) #if defined(SAVE_DEVICE_DATA_RAW)
errorChain(saveDeviceRawFetchItem(device, settings, NULL, 0)); errorChain(saveDeviceRawFetchItem(device, settings, NULL, 0));
@@ -533,7 +533,7 @@ errorret_t saveDeviceSettingsRead(
} }
errorret_t saveDeviceDispose(savedevice_t *device) { errorret_t saveDeviceDispose(savedevice_t *device) {
assertNotNull(device, "device cannot be null"); assertNotNull(device, "device cannot be NULL");
errorChain(saveDevicePlatformDispose(device)); errorChain(saveDevicePlatformDispose(device));
errorOk(); errorOk();
} }
+6 -6
View File
@@ -11,7 +11,7 @@
#include "savejson.h" #include "savejson.h"
void saveSettingsInit(savesettings_t *settings) { void saveSettingsInit(savesettings_t *settings) {
assertNotNull(settings, "Settings cannot be null"); assertNotNull(settings, "Settings cannot be NULL");
memorySet(settings, 0, sizeof(savesettings_t)); memorySet(settings, 0, sizeof(savesettings_t));
@@ -28,9 +28,9 @@ errorret_t saveSettingsWriteJSON(
yyjson_mut_doc *doc, yyjson_mut_doc *doc,
yyjson_mut_val *object yyjson_mut_val *object
) { ) {
assertNotNull(settings, "Settings cannot be null"); assertNotNull(settings, "Settings cannot be NULL");
assertNotNull(doc, "Doc cannot be null"); assertNotNull(doc, "Doc cannot be NULL");
assertNotNull(object, "Object cannot be null"); assertNotNull(object, "Object cannot be NULL");
writeInt32("someSetting", settings->someSetting); writeInt32("someSetting", settings->someSetting);
writeFloat("audioMasterVolume", settings->audioMasterVolume); writeFloat("audioMasterVolume", settings->audioMasterVolume);
@@ -43,8 +43,8 @@ errorret_t saveSettingsWriteJSON(
} }
errorret_t saveSettingsReadJSON(savesettings_t *settings, yyjson_val *object) { errorret_t saveSettingsReadJSON(savesettings_t *settings, yyjson_val *object) {
assertNotNull(settings, "Settings cannot be null"); assertNotNull(settings, "Settings cannot be NULL");
assertNotNull(object, "Object cannot be null"); assertNotNull(object, "Object cannot be NULL");
readInt32("someSetting", settings->someSetting, 0); readInt32("someSetting", settings->someSetting, 0);
readFloat("audioMasterVolume", settings->audioMasterVolume, 1.0f); readFloat("audioMasterVolume", settings->audioMasterVolume, 1.0f);
+8 -8
View File
@@ -12,19 +12,19 @@
#include "time/time.h" #include "time/time.h"
void saveSlotInit(saveslot_t *slot) { void saveSlotInit(saveslot_t *slot) {
assertNotNull(slot, "Slot cannot be null"); assertNotNull(slot, "Slot cannot be NULL");
memorySet(slot, 0, sizeof(saveslot_t)); memorySet(slot, 0, sizeof(saveslot_t));
slot->version = 1; slot->version = 1;
} }
bool_t saveSlotInUse(saveslotcache_t *slot) { bool_t saveSlotInUse(saveslotcache_t *slot) {
assertNotNull(slot, "Slot cannot be null"); assertNotNull(slot, "Slot cannot be NULL");
return slot->name[0] != '\0'; return slot->name[0] != '\0';
} }
bool_t saveSlotHasSaved(saveslotcache_t *slot) { bool_t saveSlotHasSaved(saveslotcache_t *slot) {
assertNotNull(slot, "Slot cannot be null"); assertNotNull(slot, "Slot cannot be NULL");
return slot->time.time != 0; return slot->time.time != 0;
} }
@@ -33,9 +33,9 @@ errorret_t saveSlotWriteJSON(
yyjson_mut_doc *doc, yyjson_mut_doc *doc,
yyjson_mut_val *object yyjson_mut_val *object
) { ) {
assertNotNull(slot, "Slot cannot be null"); assertNotNull(slot, "Slot cannot be NULL");
assertNotNull(doc, "Doc cannot be null"); assertNotNull(doc, "Doc cannot be NULL");
assertNotNull(object, "Object cannot be null"); assertNotNull(object, "Object cannot be NULL");
// Update time // Update time
slot->cachedData.time = timeGetEpoch(); slot->cachedData.time = timeGetEpoch();
@@ -48,8 +48,8 @@ errorret_t saveSlotWriteJSON(
} }
errorret_t saveSlotReadJSON(saveslot_t *slot, yyjson_val *object) { errorret_t saveSlotReadJSON(saveslot_t *slot, yyjson_val *object) {
assertNotNull(slot, "Slot cannot be null"); assertNotNull(slot, "Slot cannot be NULL");
assertNotNull(object, "Object cannot be null"); assertNotNull(object, "Object cannot be NULL");
char_t saveJsonStringBuffer[SAVE_JSON_STRING_BUFFER_SIZE]; char_t saveJsonStringBuffer[SAVE_JSON_STRING_BUFFER_SIZE];
+4 -4
View File
@@ -14,7 +14,7 @@
#include "rpg/cutscene/cutscenesystem.h" #include "rpg/cutscene/cutscenesystem.h"
errorret_t sceneInitialInit(scenedata_t *sceneData) { errorret_t sceneInitialInit(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
memoryZero(&sceneData->initial, sizeof(sceneinitial_t)); memoryZero(&sceneData->initial, sizeof(sceneinitial_t));
// Set background color to black for the initial scene // Set background color to black for the initial scene
@@ -29,16 +29,16 @@ errorret_t sceneInitialInit(scenedata_t *sceneData) {
} }
errorret_t sceneInitialUpdate(scenedata_t *sceneData) { errorret_t sceneInitialUpdate(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
errorOk(); errorOk();
} }
errorret_t sceneInitialRender(scenedata_t *sceneData) { errorret_t sceneInitialRender(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
errorOk(); errorOk();
} }
errorret_t sceneInitialDispose(scenedata_t *sceneData) { errorret_t sceneInitialDispose(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
errorOk(); errorOk();
} }
+4 -4
View File
@@ -27,17 +27,17 @@
#include "util/memory.h" #include "util/memory.h"
errorret_t sceneOverworldInit(scenedata_t *sceneData) { errorret_t sceneOverworldInit(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
errorOk(); errorOk();
} }
errorret_t sceneOverworldUpdate(scenedata_t *sceneData) { errorret_t sceneOverworldUpdate(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
errorOk(); errorOk();
} }
errorret_t sceneOverworldRender(scenedata_t *sceneData) { errorret_t sceneOverworldRender(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
sceneoverworld_t *overworld = &sceneData->overworld; sceneoverworld_t *overworld = &sceneData->overworld;
sceneOverworldCullUpdate(overworld); sceneOverworldCullUpdate(overworld);
@@ -259,6 +259,6 @@ errorret_t sceneOverworldDrawChunksProps(const sceneoverworld_t *overworld) {
} }
errorret_t sceneOverworldDispose(scenedata_t *sceneData) { errorret_t sceneOverworldDispose(scenedata_t *sceneData) {
assertNotNull(sceneData, "Scene data cannot be null"); assertNotNull(sceneData, "Scene data cannot be NULL");
errorOk(); errorOk();
} }
+6 -4
View File
@@ -1,7 +1,9 @@
// Copyright (c) 2026 Dominic Masters /**
// * Copyright (c) 2026 Dominic Masters
// This software is released under the MIT License. *
// https://opensource.org/licenses/MIT * This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "scene.h" #include "scene.h"
#include "assert/assert.h" #include "assert/assert.h"
+1 -1
View File
@@ -14,7 +14,7 @@
#error "At least one threading implementation must be defined." #error "At least one threading implementation must be defined."
#endif #endif
typedef struct threadlock_t { typedef struct threadmutex_s {
#ifdef DUSK_THREAD_PTHREAD #ifdef DUSK_THREAD_PTHREAD
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
+2 -2
View File
@@ -122,8 +122,8 @@ size_t timeEpochFormat(
char_t* buffer, char_t* buffer,
const size_t bufferSize const size_t bufferSize
) { ) {
assertNotNull(format, "Format string cannot be null"); assertNotNull(format, "Format string cannot be NULL");
assertNotNull(buffer, "Buffer cannot be null"); assertNotNull(buffer, "Buffer cannot be NULL");
assertTrue(bufferSize > 0, "Buffer size must be greater than 0"); assertTrue(bufferSize > 0, "Buffer size must be greater than 0");
size_t bufferIndex = 0; size_t bufferIndex = 0;
+2 -2
View File
@@ -42,14 +42,14 @@ errorret_t uiCutsceneInit() {
errorret_t uiCutsceneDraw() { errorret_t uiCutsceneDraw() {
const cutsceneitem_t *item = cutsceneSystemGetCurrentItem(); const cutsceneitem_t *item = cutsceneSystemGetCurrentItem();
if(!item || !CUTSCENE_SYSTEM.scene) { if(item == NULL || CUTSCENE_SYSTEM.scene == NULL) {
stringCopy( stringCopy(
UICUTSCENE.countText, "Cutscene Inactive", UI_CUTSCENE_TEXT_MAX - 1 UICUTSCENE.countText, "Cutscene Inactive", UI_CUTSCENE_TEXT_MAX - 1
); );
UICUTSCENE.itemText[0] = '\0'; UICUTSCENE.itemText[0] = '\0';
} else { } else {
const char_t *name = CUTSCENE_ITEM_CALLBACKS[item->type].jsonName; const char_t *name = CUTSCENE_ITEM_CALLBACKS[item->type].jsonName;
if(!name) name = "???"; if(name == NULL) name = "???";
stringFormat( stringFormat(
UICUTSCENE.countText, UICUTSCENE.countText,
+1 -1
View File
@@ -38,7 +38,7 @@ errorret_t uiPlayerPosDraw() {
break; break;
} }
} }
if(!player) errorOk(); if(player == NULL) errorOk();
chunkpos_t chunkPos; chunkpos_t chunkPos;
worldPosToChunkPos(&player->position, &chunkPos); worldPosToChunkPos(&player->position, &chunkPos);
+10 -10
View File
@@ -112,7 +112,7 @@ typedef void (*uikeyboardinputcallback_t)(
* @param c The character about to be entered (SPACE included, DEL/ * @param c The character about to be entered (SPACE included, DEL/
* confirm/cancel excluded - those aren't text being entered). * confirm/cancel excluded - those aren't text being entered).
* @param user Arbitrary pointer passed via uikeyboardopen_t.user. * @param user Arbitrary pointer passed via uikeyboardopen_t.user.
* @returns True to allow the character, false to reject it (ignored, * @return True to allow the character, false to reject it (ignored,
* nothing is entered). * nothing is entered).
*/ */
typedef bool_t (*uikeyboardkeypresscallback_t)(const char_t c, void *user); typedef bool_t (*uikeyboardkeypresscallback_t)(const char_t c, void *user);
@@ -254,7 +254,7 @@ errorret_t uiKeyboardDraw(void);
/** /**
* Returns true when the keyboard dialog is currently open. * Returns true when the keyboard dialog is currently open.
* *
* @returns True if open. * @return True if open.
*/ */
bool_t uiKeyboardIsOpen(void); bool_t uiKeyboardIsOpen(void);
@@ -303,7 +303,7 @@ void uiKeyboardFocusConfirm(void);
* UI_KEYBOARD.trimmed is false, so whitespace-only text was never * UI_KEYBOARD.trimmed is false, so whitespace-only text was never
* reduced to empty) a string of only whitespace. * reduced to empty) a string of only whitespace.
* *
* @returns True if blank. * @return True if blank.
*/ */
bool_t uiKeyboardTextIsBlank(void); bool_t uiKeyboardTextIsBlank(void);
@@ -376,7 +376,7 @@ void uiKeyboardMenuClosed(const uimenu_t *menu);
* nothing. * nothing.
* *
* @param menu The keyboard's menu. * @param menu The keyboard's menu.
* @returns Always true - this always fully handles back itself * @return Always true - this always fully handles back itself
* (backspace, explicit close, or swallow), never falling through to the * (backspace, explicit close, or swallow), never falling through to the
* default pop. * default pop.
*/ */
@@ -388,7 +388,7 @@ bool_t uiKeyboardMenuCancel(const uimenu_t *menu);
* handle. * handle.
* *
* @param key A table entry, possibly NULL. * @param key A table entry, possibly NULL.
* @returns key, or "" if key was NULL. * @return key, or "" if key was NULL.
*/ */
const char_t * uiKeyboardNormalizeKey(const char_t *key); const char_t * uiKeyboardNormalizeKey(const char_t *key);
@@ -398,7 +398,7 @@ const char_t * uiKeyboardNormalizeKey(const char_t *key);
* *
* @param shift Current shift state. * @param shift Current shift state.
* @param caps Current caps state. * @param caps Current caps state.
* @returns The selected table. * @return The selected table.
*/ */
const char_t *const * uiKeyboardSelectTable( const char_t *const * uiKeyboardSelectTable(
const bool_t shift, const bool_t shift,
@@ -420,7 +420,7 @@ const char_t *const * uiKeyboardSelectTable(
* UI_KEYBOARD_KEY_COUNT entries. * UI_KEYBOARD_KEY_COUNT entries.
* @param shift Initial shift state - see uiKeyboardGetChar. * @param shift Initial shift state - see uiKeyboardGetChar.
* @param caps Initial caps state - see uiKeyboardGetChar. * @param caps Initial caps state - see uiKeyboardGetChar.
* @returns The number of items written (UI_KEYBOARD_KEY_COUNT). * @return The number of items written (UI_KEYBOARD_KEY_COUNT).
*/ */
uint8_t uiKeyboardBuildItems( uint8_t uiKeyboardBuildItems(
uimenuitem_t *items, uimenuitem_t *items,
@@ -453,7 +453,7 @@ void uiKeyboardUpdateDisplay(
* own (possibly shifted) label.text. * own (possibly shifted) label.text.
* *
* @param index Grid slot index, from 0 to UI_KEYBOARD_KEY_COUNT - 1. * @param index Grid slot index, from 0 to UI_KEYBOARD_KEY_COUNT - 1.
* @returns The slot's canonical label. * @return The slot's canonical label.
*/ */
const char_t * uiKeyboardGetCanonicalKey(const uint8_t index); const char_t * uiKeyboardGetCanonicalKey(const uint8_t index);
@@ -464,7 +464,7 @@ const char_t * uiKeyboardGetCanonicalKey(const uint8_t index);
* (SPACE, DEL, SHIFT, CAPS, or blank filler). * (SPACE, DEL, SHIFT, CAPS, or blank filler).
* *
* @param index Grid slot index, from 0 to UI_KEYBOARD_KEY_COUNT - 1. * @param index Grid slot index, from 0 to UI_KEYBOARD_KEY_COUNT - 1.
* @returns True if shift affects this slot's character. * @return True if shift affects this slot's character.
*/ */
bool_t uiKeyboardIsShiftSensitive(const uint8_t index); bool_t uiKeyboardIsShiftSensitive(const uint8_t index);
@@ -481,7 +481,7 @@ bool_t uiKeyboardIsShiftSensitive(const uint8_t index);
* @param index Grid slot index, from 0 to UI_KEYBOARD_KEY_COUNT - 1. * @param index Grid slot index, from 0 to UI_KEYBOARD_KEY_COUNT - 1.
* @param shift Current shift state (one-shot, see UI_KEYBOARD.shift). * @param shift Current shift state (one-shot, see UI_KEYBOARD.shift).
* @param caps Current caps state (persistent toggle, see UI_KEYBOARD.caps). * @param caps Current caps state (persistent toggle, see UI_KEYBOARD.caps).
* @returns The character to display/type. * @return The character to display/type.
*/ */
char_t uiKeyboardGetChar( char_t uiKeyboardGetChar(
const uint8_t index, const uint8_t index,
+2 -2
View File
@@ -63,7 +63,7 @@ void uiSaveSlotInit(
* Returns whether the save slot widget is highlighted. * Returns whether the save slot widget is highlighted.
* *
* @param saveSlot The save slot widget to query. * @param saveSlot The save slot widget to query.
* @returns True if highlighted. * @return True if highlighted.
*/ */
bool_t uiSaveSlotIsHighlighted(const uisaveslot_t *saveSlot); bool_t uiSaveSlotIsHighlighted(const uisaveslot_t *saveSlot);
@@ -79,7 +79,7 @@ void uiSaveSlotSetHighlighted(uisaveslot_t *saveSlot, const bool_t highlighted);
* Returns the save slot widget's display type. * Returns the save slot widget's display type.
* *
* @param saveSlot The save slot widget to query. * @param saveSlot The save slot widget to query.
* @returns The display type. * @return The display type.
*/ */
uisaveslotdisplaytype_t uiSaveSlotGetDisplayType(const uisaveslot_t *saveSlot); uisaveslotdisplaytype_t uiSaveSlotGetDisplayType(const uisaveslot_t *saveSlot);
+1 -1
View File
@@ -93,7 +93,7 @@ errorret_t uiSelectSaveDraw(void);
/** /**
* Returns true when the select-save panel is currently open. * Returns true when the select-save panel is currently open.
* *
* @returns True if open. * @return True if open.
*/ */
bool_t uiSelectSaveIsOpen(void); bool_t uiSelectSaveIsOpen(void);
+2 -2
View File
@@ -36,14 +36,14 @@ errorret_t uiConfirmInit(void);
/** /**
* Returns true when the confirm dialog is currently open. * Returns true when the confirm dialog is currently open.
* *
* @returns True if open. * @return True if open.
*/ */
bool_t uiConfirmIsOpen(void); bool_t uiConfirmIsOpen(void);
/** /**
* Returns the result of the most recently dismissed confirm dialog. * Returns the result of the most recently dismissed confirm dialog.
* *
* @returns True if Confirm was selected, false otherwise. * @return True if Confirm was selected, false otherwise.
*/ */
bool_t uiConfirmGetResult(void); bool_t uiConfirmGetResult(void);
+1 -1
View File
@@ -67,7 +67,7 @@ void uiFocusInit(void);
* @param direction Called on a direction press/hold before the default * @param direction Called on a direction press/hold before the default
* cell-to-cell movement is applied; may be NULL. * cell-to-cell movement is applied; may be NULL.
* @param user Arbitrary pointer stored on the item before changed fires. * @param user Arbitrary pointer stored on the item before changed fires.
* @returns Pointer to the newly pushed focus item. * @return Pointer to the newly pushed focus item.
*/ */
uifocusitem_t * uiFocusPush( uifocusitem_t * uiFocusPush(
const uint8_t cols, const uint8_t cols,
+1 -1
View File
@@ -32,7 +32,7 @@ typedef bool_t (*uifocusitemcallback_t)(const uifocusitem_t *item);
* *
* @param item The focus item that is currently focused. * @param item The focus item that is currently focused.
* @param direction The direction that was pressed. * @param direction The direction that was pressed.
* @returns True if the direction was fully handled and the default * @return True if the direction was fully handled and the default
* grid movement should be skipped; false to fall through to it. * grid movement should be skipped; false to fall through to it.
*/ */
typedef bool_t (*uifocusitemdirectioncallback_t)( typedef bool_t (*uifocusitemdirectioncallback_t)(
+1 -1
View File
@@ -59,7 +59,7 @@ void uiFatalErrorOpen(const char_t *message);
/** /**
* Returns whether the fatal error overlay is currently open. * Returns whether the fatal error overlay is currently open.
* *
* @returns True if open. * @return True if open.
*/ */
bool_t uiFatalErrorIsOpen(void); bool_t uiFatalErrorIsOpen(void);

Some files were not shown because too many files have changed in this diff Show More