Emdashless
This commit is contained in:
@@ -233,6 +233,16 @@ apply any changes before finishing the task.
|
|||||||
|
|
||||||
## Coding style
|
## Coding style
|
||||||
|
|
||||||
|
### ASCII only
|
||||||
|
Source files (`.c`, `.h`, `.js`) must contain only ASCII characters (U+0000–U+007F).
|
||||||
|
Non-ASCII characters are banned even in comments and string literals.
|
||||||
|
Use ASCII-only substitutes instead:
|
||||||
|
- `--` or `-` instead of `—` (em dash)
|
||||||
|
- `->` instead of `→` (arrow)
|
||||||
|
- `x` or `*` instead of `×` (multiplication)
|
||||||
|
|
||||||
|
Only non-script asset files (e.g. `.po` locale files) may contain non-ASCII text.
|
||||||
|
|
||||||
### Indentation
|
### Indentation
|
||||||
2 spaces. No tabs.
|
2 spaces. No tabs.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -22,8 +22,8 @@ player.create = function(texEntry) {
|
|||||||
r.texture = texEntry.texture;
|
r.texture = texEntry.texture;
|
||||||
r.type = Renderable.SPRITEBATCH;
|
r.type = Renderable.SPRITEBATCH;
|
||||||
r.color = new Color(220, 80, 80);
|
r.color = new Color(220, 80, 80);
|
||||||
// upright quad: (-0.5,0,0) → (0.5,1,0) in XY plane
|
// upright quad: (-0.5,0,0) -> (0.5,1,0) in XY plane
|
||||||
r.sprites = [[-0.5, 0, 0, 0.5, 1, 0, 0, 0, 1, 1]];
|
r.sprites = [[-0.5, 0, 0, 0.5, 1, 0, 0, 1, 1, 0]];
|
||||||
|
|
||||||
_position.localPosition = new Vec3(0, 1, 0);
|
_position.localPosition = new Vec3(0, 1, 0);
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-3
@@ -11,7 +11,7 @@ var assets = AssetBatch([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Pokemon DS-style camera: ~34 degrees elevation (atan(6/9)).
|
// Pokemon DS-style camera: ~34 degrees elevation (atan(6/9)).
|
||||||
// CAM_HEIGHT / CAM_DIST ratio controls the tilt — keep it under 0.7 for
|
// CAM_HEIGHT / CAM_DIST ratio controls the tilt - keep it under 0.7 for
|
||||||
// the characteristically shallow DS angle.
|
// the characteristically shallow DS angle.
|
||||||
const CAM_HEIGHT = 6;
|
const CAM_HEIGHT = 6;
|
||||||
const CAM_DIST = 9;
|
const CAM_DIST = 9;
|
||||||
@@ -38,7 +38,7 @@ scene.init = async function() {
|
|||||||
camPos = cam.add(Component.POSITION);
|
camPos = cam.add(Component.POSITION);
|
||||||
cam.add(Component.CAMERA);
|
cam.add(Component.CAMERA);
|
||||||
|
|
||||||
// Floor — infinite static plane at Y=0. Rendered as a large flat blue
|
// Floor - infinite static plane at Y=0. Rendered as a large flat blue
|
||||||
// slab using the default SHADER_MATERIAL (no texture needed).
|
// slab using the default SHADER_MATERIAL (no texture needed).
|
||||||
floorEntity = Entity.create();
|
floorEntity = Entity.create();
|
||||||
var floorPos = floorEntity.add(Component.POSITION);
|
var floorPos = floorEntity.add(Component.POSITION);
|
||||||
@@ -51,7 +51,7 @@ scene.init = async function() {
|
|||||||
floorPos.localScale = new Vec3(16, 0.2, 16);
|
floorPos.localScale = new Vec3(16, 0.2, 16);
|
||||||
floorPos.localPosition = new Vec3(0, -0.1, 0);
|
floorPos.localPosition = new Vec3(0, -0.1, 0);
|
||||||
|
|
||||||
// Player — spawns 1 unit above the floor so physics drops it cleanly.
|
// Player - spawns 1 unit above the floor so physics drops it cleanly.
|
||||||
player.create(texEntry);
|
player.create(texEntry);
|
||||||
|
|
||||||
// Initialise camera at the correct angle from the player's spawn position.
|
// Initialise camera at the correct angle from the player's spawn position.
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ errorret_t assetInit(void);
|
|||||||
bool_t assetFileExists(const char_t *filename);
|
bool_t assetFileExists(const char_t *filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets, or creates, a new asset entry. Internal — prefer assetLock.
|
* Gets, or creates, a new asset entry. Internal - prefer assetLock.
|
||||||
*
|
*
|
||||||
* @param name Filename of the asset.
|
* @param name Filename of the asset.
|
||||||
* @param type Type of the asset.
|
* @param type Type of the asset.
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void assetBatchInit(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if(batch->entries[i]->state == ASSET_ENTRY_STATE_LOADED) {
|
if(batch->entries[i]->state == ASSET_ENTRY_STATE_LOADED) {
|
||||||
/* Already loaded (cached) — count it now, no subscription needed. */
|
/* Already loaded (cached) - count it now, no subscription needed. */
|
||||||
batch->loadedCount++;
|
batch->loadedCount++;
|
||||||
} else if(batch->entries[i]->state == ASSET_ENTRY_STATE_ERROR) {
|
} else if(batch->entries[i]->state == ASSET_ENTRY_STATE_ERROR) {
|
||||||
batch->errorCount++;
|
batch->errorCount++;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
typedef struct assetloading_s assetloading_t;
|
typedef struct assetloading_s assetloading_t;
|
||||||
typedef struct assetentry_s assetentry_t;
|
typedef struct assetentry_s assetentry_t;
|
||||||
|
|
||||||
/** Input passed to the locale loader — currently unused. */
|
/** Input passed to the locale loader - currently unused. */
|
||||||
typedef struct { void *nothing; } assetlocaleloaderinput_t;
|
typedef struct { void *nothing; } assetlocaleloaderinput_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -100,7 +100,7 @@ typedef struct {
|
|||||||
uint8_t pluralDefaultIndex;
|
uint8_t pluralDefaultIndex;
|
||||||
} assetlocalefile_t;
|
} assetlocalefile_t;
|
||||||
|
|
||||||
/** Convenience alias — the loaded output type of a locale asset entry. */
|
/** Convenience alias - the loaded output type of a locale asset entry. */
|
||||||
typedef assetlocalefile_t assetlocaleoutput_t;
|
typedef assetlocalefile_t assetlocaleoutput_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ errorret_t spriteBatchInit();
|
|||||||
/**
|
/**
|
||||||
* Lowest-level buffer function. Writes sprites into the internal vertex buffer.
|
* Lowest-level buffer function. Writes sprites into the internal vertex buffer.
|
||||||
* Flushes automatically when the per-flush capacity is reached. Does not
|
* Flushes automatically when the per-flush capacity is reached. Does not
|
||||||
* modify material state — call spriteBatchSetState or use a high-level push
|
* modify material state - call spriteBatchSetState or use a high-level push
|
||||||
* function before buffering.
|
* function before buffering.
|
||||||
*
|
*
|
||||||
* @param sprites Pointer to the sprite array.
|
* @param sprites Pointer to the sprite array.
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ static void entityPositionEnsureWorld(entityposition_t *pos) {
|
|||||||
entityPositionEnsureLocal(pos);
|
entityPositionEnsureLocal(pos);
|
||||||
|
|
||||||
if(pos->parentEntityId != ENTITY_ID_INVALID) {
|
if(pos->parentEntityId != ENTITY_ID_INVALID) {
|
||||||
// Parented: world = parent.world × local. worldTransform must be written
|
// Parented: world = parent.world x local. worldTransform must be written
|
||||||
// because children (and this node's getters) read it.
|
// because children (and this node's getters) read it.
|
||||||
entityposition_t *parent = componentGetData(
|
entityposition_t *parent = componentGetData(
|
||||||
pos->parentEntityId, pos->parentComponentId, COMPONENT_TYPE_POSITION
|
pos->parentEntityId, pos->parentComponentId, COMPONENT_TYPE_POSITION
|
||||||
@@ -369,11 +369,11 @@ void entityPositionSetWorldRotation(
|
|||||||
// gimbal = stored[0][1], stored[1][1] = math[1][0], math[1][1]
|
// gimbal = stored[0][1], stored[1][1] = math[1][0], math[1][1]
|
||||||
const float_t lr00 = pr00*wr00 + pr01*wr10 + pr02*wr20; // math[0][0]
|
const float_t lr00 = pr00*wr00 + pr01*wr10 + pr02*wr20; // math[0][0]
|
||||||
const float_t lr10 = pr00*wr01 + pr01*wr11 + pr02*wr21; // math[0][1]
|
const float_t lr10 = pr00*wr01 + pr01*wr11 + pr02*wr21; // math[0][1]
|
||||||
const float_t lr20 = pr00*wr02 + pr01*wr12 + pr02*wr22; // [0][2] → sinBeta
|
const float_t lr20 = pr00*wr02 + pr01*wr12 + pr02*wr22; // [0][2] -> sinBeta
|
||||||
const float_t lr01 = pr10*wr00 + pr11*wr10 + pr12*wr20; // math[1][0]
|
const float_t lr01 = pr10*wr00 + pr11*wr10 + pr12*wr20; // math[1][0]
|
||||||
const float_t lr11 = pr10*wr01 + pr11*wr11 + pr12*wr21; // math[1][1]
|
const float_t lr11 = pr10*wr01 + pr11*wr11 + pr12*wr21; // math[1][1]
|
||||||
const float_t lr21 = pr10*wr02 + pr11*wr12 + pr12*wr22; // [1][2] → r21
|
const float_t lr21 = pr10*wr02 + pr11*wr12 + pr12*wr22; // [1][2] -> r21
|
||||||
const float_t lr22 = pr20*wr02 + pr21*wr12 + pr22*wr22; // [2][2] → r22
|
const float_t lr22 = pr20*wr02 + pr21*wr12 + pr22*wr22; // [2][2] -> r22
|
||||||
|
|
||||||
const float_t sinBeta = glm_clamp(lr20, -1.0f, 1.0f);
|
const float_t sinBeta = glm_clamp(lr20, -1.0f, 1.0f);
|
||||||
pos->rotation[1] = asinf(sinBeta);
|
pos->rotation[1] = asinf(sinBeta);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/*
|
/*
|
||||||
* Hot fields — flag checks, parent/child traversal (markDirty, ensureWorld)
|
* Hot fields - flag checks, parent/child traversal (markDirty, ensureWorld)
|
||||||
* only touch these. Kept at the front so they share the first cache line.
|
* only touch these. Kept at the front so they share the first cache line.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ typedef struct {
|
|||||||
componentid_t childComponentIds[ENTITY_POSITION_CHILDREN_MAX];
|
componentid_t childComponentIds[ENTITY_POSITION_CHILDREN_MAX];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Warm fields — read/written by PRS getters/setters.
|
* Warm fields - read/written by PRS getters/setters.
|
||||||
* Accessed more often than the matrices but less often than flags.
|
* Accessed more often than the matrices but less often than flags.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ typedef struct {
|
|||||||
vec3 scale;
|
vec3 scale;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cold fields — only touched when actually rebuilding transforms.
|
* Cold fields - only touched when actually rebuilding transforms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Local transform matrix, rebuilt lazily from position/rotation/scale. */
|
/** Local transform matrix, rebuilt lazily from position/rotation/scale. */
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ typedef enum {
|
|||||||
* Converts a facing direction to a normalized XZ vec2.
|
* Converts a facing direction to a normalized XZ vec2.
|
||||||
*
|
*
|
||||||
* @param facing The facing direction.
|
* @param facing The facing direction.
|
||||||
* @param dest Output vec2 — [0] is X, [1] is Z.
|
* @param dest Output vec2 - [0] is X, [1] is Z.
|
||||||
*/
|
*/
|
||||||
void facingDirToVec2(facingdir_t facing, vec2 dest);
|
void facingDirToVec2(facingdir_t facing, vec2 dest);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ void physicsWorldStep(const float_t dt) {
|
|||||||
physBodies[i] = entityPhysicsGet(physEnts[i], physComps[i]);
|
physBodies[i] = entityPhysicsGet(physEnts[i], physComps[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Phase 1: integrate dynamic bodies (gravity + velocity → position).
|
/* Phase 1: integrate dynamic bodies (gravity + velocity -> position).
|
||||||
* Writes directly to pos->position, matrix rebuilt at end. */
|
* Writes directly to pos->position, matrix rebuilt at end. */
|
||||||
for(entityid_t i = 0; i < physCount; i++) {
|
for(entityid_t i = 0; i < physCount; i++) {
|
||||||
if(!positions[i]) continue;
|
if(!positions[i]) continue;
|
||||||
|
|||||||
@@ -25,6 +25,6 @@ typedef struct {
|
|||||||
char_t header[SAVE_FILE_HEADER_SIZE];
|
char_t header[SAVE_FILE_HEADER_SIZE];
|
||||||
/** Format version read from the file; used to branch on older layouts. */
|
/** Format version read from the file; used to branch on older layouts. */
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
/** Runtime flag — true if this slot was successfully loaded or written. */
|
/** Runtime flag - true if this slot was successfully loaded or written. */
|
||||||
bool_t exists;
|
bool_t exists;
|
||||||
} savefile_t;
|
} savefile_t;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
extern scriptproto_t MODULE_ANIMATION_PROTO;
|
extern scriptproto_t MODULE_ANIMATION_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new Animation(keyframes) — creates an Animation from a JS array of
|
* new Animation(keyframes) - creates an Animation from a JS array of
|
||||||
* `{time, value, easing?}` descriptor objects.
|
* `{time, value, easing?}` descriptor objects.
|
||||||
*
|
*
|
||||||
* @param args[0] Array of keyframe descriptors.
|
* @param args[0] Array of keyframe descriptors.
|
||||||
@@ -24,7 +24,7 @@ extern scriptproto_t MODULE_ANIMATION_PROTO;
|
|||||||
moduleBaseFunction(moduleAnimationCtor);
|
moduleBaseFunction(moduleAnimationCtor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* animation.getValue(time) — interpolates the animation at `time`.
|
* animation.getValue(time) - interpolates the animation at `time`.
|
||||||
*
|
*
|
||||||
* @param args[0] Time in seconds (number).
|
* @param args[0] Time in seconds (number).
|
||||||
* @return Interpolated float value.
|
* @return Interpolated float value.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
extern scriptproto_t MODULE_EASING_PROTO;
|
extern scriptproto_t MODULE_EASING_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Easing.apply(type, t) — applies easing function `type` to normalized
|
* Easing.apply(type, t) - applies easing function `type` to normalized
|
||||||
* time `t` and returns the eased value.
|
* time `t` and returns the eased value.
|
||||||
*
|
*
|
||||||
* @param args[0] Easing type constant (EASING_*).
|
* @param args[0] Easing type constant (EASING_*).
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
extern scriptproto_t MODULE_ASSET_PROTO;
|
extern scriptproto_t MODULE_ASSET_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asset.exists(path) — returns true if the path exists in the asset archive.
|
* Asset.exists(path) - returns true if the path exists in the asset archive.
|
||||||
* @param args[0] Archive-relative path string.
|
* @param args[0] Archive-relative path string.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleAssetExists);
|
moduleBaseFunction(moduleAssetExists);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asset.lock(path, type, input?) — locks an asset entry and returns an
|
* Asset.lock(path, type, input?) - locks an asset entry and returns an
|
||||||
* AssetEntry. The entry begins loading in the background.
|
* AssetEntry. The entry begins loading in the background.
|
||||||
*
|
*
|
||||||
* @param args[0] Path string.
|
* @param args[0] Path string.
|
||||||
@@ -33,7 +33,7 @@ moduleBaseFunction(moduleAssetExists);
|
|||||||
moduleBaseFunction(moduleAssetLock);
|
moduleBaseFunction(moduleAssetLock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asset.requireLoaded(entry) — blocks until the entry is fully loaded.
|
* Asset.requireLoaded(entry) - blocks until the entry is fully loaded.
|
||||||
* @param args[0] An AssetEntry object.
|
* @param args[0] An AssetEntry object.
|
||||||
* @return The same AssetEntry for chaining.
|
* @return The same AssetEntry for chaining.
|
||||||
* @throws If the load fails.
|
* @throws If the load fails.
|
||||||
@@ -41,7 +41,7 @@ moduleBaseFunction(moduleAssetLock);
|
|||||||
moduleBaseFunction(moduleAssetRequireLoaded);
|
moduleBaseFunction(moduleAssetRequireLoaded);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asset.unlock(path) — releases the asset lock for the given path.
|
* Asset.unlock(path) - releases the asset lock for the given path.
|
||||||
* Prefer entry.unlock() on the AssetEntry object directly.
|
* Prefer entry.unlock() on the AssetEntry object directly.
|
||||||
* @param args[0] Path string originally passed to Asset.lock().
|
* @param args[0] Path string originally passed to Asset.lock().
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ typedef struct {
|
|||||||
} jsassetbatch_t;
|
} jsassetbatch_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GC free callback — disposes and frees the batch when the JS object is
|
* GC free callback - disposes and frees the batch when the JS object is
|
||||||
* garbage collected.
|
* garbage collected.
|
||||||
*
|
*
|
||||||
* @param ptr Native jsassetbatch_t pointer.
|
* @param ptr Native jsassetbatch_t pointer.
|
||||||
@@ -57,32 +57,32 @@ moduleBaseFunction(moduleAssetBatchGetIsLoaded);
|
|||||||
moduleBaseFunction(moduleAssetBatchGetHasError);
|
moduleBaseFunction(moduleAssetBatchGetHasError);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* requireLoaded() — blocks until every entry is loaded.
|
* requireLoaded() - blocks until every entry is loaded.
|
||||||
* @return this for chaining.
|
* @return this for chaining.
|
||||||
* @throws If any entry fails to load.
|
* @throws If any entry fails to load.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleAssetBatchRequireLoaded);
|
moduleBaseFunction(moduleAssetBatchRequireLoaded);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loaded() — returns a Promise that resolves when all entries load, or
|
* loaded() - returns a Promise that resolves when all entries load, or
|
||||||
* rejects if any entry errors. Resolves immediately if already loaded.
|
* rejects if any entry errors. Resolves immediately if already loaded.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleAssetBatchLoaded);
|
moduleBaseFunction(moduleAssetBatchLoaded);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lock() — acquires one additional lock on every entry.
|
* lock() - acquires one additional lock on every entry.
|
||||||
* @return this for chaining.
|
* @return this for chaining.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleAssetBatchLock);
|
moduleBaseFunction(moduleAssetBatchLock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unlock() — releases all locks and disposes the batch. The object is
|
* unlock() - releases all locks and disposes the batch. The object is
|
||||||
* invalid after this call.
|
* invalid after this call.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleAssetBatchUnlock);
|
moduleBaseFunction(moduleAssetBatchUnlock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* entry(index) — returns the AssetEntry at index, adding an independent
|
* entry(index) - returns the AssetEntry at index, adding an independent
|
||||||
* lock.
|
* lock.
|
||||||
* @param args[0] Index (number).
|
* @param args[0] Index (number).
|
||||||
* @return AssetEntry, or undefined if out of range.
|
* @return AssetEntry, or undefined if out of range.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ typedef struct {
|
|||||||
} jsassetentry_t;
|
} jsassetentry_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GC free callback — releases the asset lock when the AssetEntry JS object
|
* GC free callback - releases the asset lock when the AssetEntry JS object
|
||||||
* is garbage collected.
|
* is garbage collected.
|
||||||
*
|
*
|
||||||
* @param ptr Native jsassetentry_t pointer.
|
* @param ptr Native jsassetentry_t pointer.
|
||||||
@@ -39,7 +39,7 @@ void moduleAssetEntryFree(void *ptr, jerry_object_native_info_t *info);
|
|||||||
*/
|
*/
|
||||||
jsassetentry_t *moduleAssetEntrySelf(const jerry_call_info_t *callInfo);
|
jsassetentry_t *moduleAssetEntrySelf(const jerry_call_info_t *callInfo);
|
||||||
|
|
||||||
/** AssetEntry() constructor — always throws; not directly instantiable. */
|
/** AssetEntry() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(moduleAssetEntryCtor);
|
moduleBaseFunction(moduleAssetEntryCtor);
|
||||||
|
|
||||||
/** @return Archive-relative path used as the cache key. */
|
/** @return Archive-relative path used as the cache key. */
|
||||||
@@ -62,13 +62,13 @@ moduleBaseFunction(moduleAssetEntryGetIsLoaded);
|
|||||||
moduleBaseFunction(moduleAssetEntryGetTexture);
|
moduleBaseFunction(moduleAssetEntryGetTexture);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* requireLoaded() — blocks until the entry is LOADED or ERROR.
|
* requireLoaded() - blocks until the entry is LOADED or ERROR.
|
||||||
* @return this for chaining.
|
* @return this for chaining.
|
||||||
* @throws If the load fails.
|
* @throws If the load fails.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleAssetEntryRequireLoaded);
|
moduleBaseFunction(moduleAssetEntryRequireLoaded);
|
||||||
|
|
||||||
/** unlock() — releases the asset lock immediately. */
|
/** unlock() - releases the asset lock immediately. */
|
||||||
moduleBaseFunction(moduleAssetEntryUnlock);
|
moduleBaseFunction(moduleAssetEntryUnlock);
|
||||||
|
|
||||||
/** @return The onLoaded Event for this entry. */
|
/** @return The onLoaded Event for this entry. */
|
||||||
@@ -81,7 +81,7 @@ moduleBaseFunction(moduleAssetEntryGetOnUnloaded);
|
|||||||
moduleBaseFunction(moduleAssetEntryGetOnError);
|
moduleBaseFunction(moduleAssetEntryGetOnError);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loaded() — returns a Promise that resolves when the entry loads, or
|
* loaded() - returns a Promise that resolves when the entry loads, or
|
||||||
* rejects on error. Resolves immediately if already loaded.
|
* rejects on error. Resolves immediately if already loaded.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleAssetEntryLoaded);
|
moduleBaseFunction(moduleAssetEntryLoaded);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
extern scriptproto_t MODULE_CONSOLE_PROTO;
|
extern scriptproto_t MODULE_CONSOLE_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Console.print(...args) — concatenates all args tab-separated and prints
|
* Console.print(...args) - concatenates all args tab-separated and prints
|
||||||
* to the engine console.
|
* to the engine console.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleConsolePrint);
|
moduleBaseFunction(moduleConsolePrint);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ typedef struct {
|
|||||||
} jstexture_t;
|
} jstexture_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GC free callback — unlocks the asset entry when the Texture JS object is
|
* GC free callback - unlocks the asset entry when the Texture JS object is
|
||||||
* garbage collected.
|
* garbage collected.
|
||||||
*
|
*
|
||||||
* @param ptr Native jstexture_t pointer.
|
* @param ptr Native jstexture_t pointer.
|
||||||
@@ -37,7 +37,7 @@ void moduleTextureFree(void *ptr, jerry_object_native_info_t *info);
|
|||||||
*/
|
*/
|
||||||
jstexture_t *moduleTextureSelf(const jerry_call_info_t *callInfo);
|
jstexture_t *moduleTextureSelf(const jerry_call_info_t *callInfo);
|
||||||
|
|
||||||
/** Texture() constructor — always throws; not directly instantiable. */
|
/** Texture() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(moduleTextureCtor);
|
moduleBaseFunction(moduleTextureCtor);
|
||||||
|
|
||||||
/** @return Texture width in pixels, or undefined if not loaded. */
|
/** @return Texture width in pixels, or undefined if not loaded. */
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ extern jerry_value_t MODULE_FRAME_PENDING[MODULE_FRAME_PENDING_MAX];
|
|||||||
extern uint32_t MODULE_FRAME_PENDING_COUNT;
|
extern uint32_t MODULE_FRAME_PENDING_COUNT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* frame() — returns a Promise that resolves at the start of the next frame.
|
* frame() - returns a Promise that resolves at the start of the next frame.
|
||||||
* Used as `await frame()` inside an async script loop.
|
* Used as `await frame()` inside an async script loop.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleFrameFrame);
|
moduleBaseFunction(moduleFrameFrame);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ extern moduletimeoutentry_t MODULE_TIMEOUT_PENDING[MODULE_TIMEOUT_PENDING_MAX];
|
|||||||
extern uint32_t MODULE_TIMEOUT_PENDING_COUNT;
|
extern uint32_t MODULE_TIMEOUT_PENDING_COUNT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* timeout(ms) — returns a Promise that resolves after at least `ms`
|
* timeout(ms) - returns a Promise that resolves after at least `ms`
|
||||||
* milliseconds have elapsed. Used as `await timeout(500)`.
|
* milliseconds have elapsed. Used as `await timeout(500)`.
|
||||||
*
|
*
|
||||||
* @param args[0] Delay in milliseconds (number).
|
* @param args[0] Delay in milliseconds (number).
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
extern scriptproto_t MODULE_CAMERA_PROTO;
|
extern scriptproto_t MODULE_CAMERA_PROTO;
|
||||||
|
|
||||||
/** Camera() constructor — always throws; not directly instantiable. */
|
/** Camera() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(moduleCameraCtor);
|
moduleBaseFunction(moduleCameraCtor);
|
||||||
|
|
||||||
/** @return Entity ID that owns this camera component. */
|
/** @return Entity ID that owns this camera component. */
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
extern scriptproto_t MODULE_POSITION_PROTO;
|
extern scriptproto_t MODULE_POSITION_PROTO;
|
||||||
|
|
||||||
/** Position() constructor — always throws; not directly instantiable. */
|
/** Position() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(modulePositionCtor);
|
moduleBaseFunction(modulePositionCtor);
|
||||||
|
|
||||||
/** @return Entity ID that owns this position component. */
|
/** @return Entity ID that owns this position component. */
|
||||||
@@ -60,14 +60,14 @@ moduleBaseFunction(modulePositionGetWorldScale);
|
|||||||
moduleBaseFunction(modulePositionSetWorldScale);
|
moduleBaseFunction(modulePositionSetWorldScale);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lookAt(target, up?) — orients the component toward a target point.
|
* lookAt(target, up?) - orients the component toward a target point.
|
||||||
* @param args[0] Vec3 target position.
|
* @param args[0] Vec3 target position.
|
||||||
* @param args[1] Optional Vec3 up vector (defaults to world up).
|
* @param args[1] Optional Vec3 up vector (defaults to world up).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(modulePositionLookAt);
|
moduleBaseFunction(modulePositionLookAt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setParent(position?) — parents this component to another Position, or
|
* setParent(position?) - parents this component to another Position, or
|
||||||
* unparents when called with null/undefined.
|
* unparents when called with null/undefined.
|
||||||
* @param args[0] Position component or null/undefined.
|
* @param args[0] Position component or null/undefined.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
extern scriptproto_t MODULE_RENDERABLE_PROTO;
|
extern scriptproto_t MODULE_RENDERABLE_PROTO;
|
||||||
|
|
||||||
/** Renderable() constructor — always throws; not directly instantiable. */
|
/** Renderable() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(moduleRenderableCtor);
|
moduleBaseFunction(moduleRenderableCtor);
|
||||||
|
|
||||||
/** @return Entity ID that owns this renderable component. */
|
/** @return Entity ID that owns this renderable component. */
|
||||||
@@ -59,7 +59,7 @@ moduleBaseFunction(moduleRenderableSetTexture);
|
|||||||
moduleBaseFunction(moduleRenderableGetSprites);
|
moduleBaseFunction(moduleRenderableGetSprites);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets sprite data. Accepts an array of sub-arrays — 10 elements (3D) or
|
* Sets sprite data. Accepts an array of sub-arrays - 10 elements (3D) or
|
||||||
* 8 elements (2D, z defaults to 0).
|
* 8 elements (2D, z defaults to 0).
|
||||||
* @param args[0] Array of sprite sub-arrays.
|
* @param args[0] Array of sprite sub-arrays.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
extern scriptproto_t MODULE_PHYSICS_PROTO;
|
extern scriptproto_t MODULE_PHYSICS_PROTO;
|
||||||
|
|
||||||
/** Physics() constructor — always throws; not directly instantiable. */
|
/** Physics() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(modulePhysicsCtor);
|
moduleBaseFunction(modulePhysicsCtor);
|
||||||
|
|
||||||
/** @return Entity ID that owns this physics component. */
|
/** @return Entity ID that owns this physics component. */
|
||||||
@@ -51,7 +51,7 @@ moduleBaseFunction(modulePhysicsSetGravityScale);
|
|||||||
moduleBaseFunction(modulePhysicsGetOnGround);
|
moduleBaseFunction(modulePhysicsGetOnGround);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* applyImpulse(impulse) — applies an instantaneous force to the body.
|
* applyImpulse(impulse) - applies an instantaneous force to the body.
|
||||||
* @param args[0] Vec3 impulse vector.
|
* @param args[0] Vec3 impulse vector.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(modulePhysicsApplyImpulse);
|
moduleBaseFunction(modulePhysicsApplyImpulse);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
extern scriptproto_t MODULE_TRIGGER_PROTO;
|
extern scriptproto_t MODULE_TRIGGER_PROTO;
|
||||||
|
|
||||||
/** Trigger() constructor — always throws; not directly instantiable. */
|
/** Trigger() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(moduleTriggerCtor);
|
moduleBaseFunction(moduleTriggerCtor);
|
||||||
|
|
||||||
/** @return Entity ID that owns this trigger component. */
|
/** @return Entity ID that owns this trigger component. */
|
||||||
@@ -36,14 +36,14 @@ moduleBaseFunction(moduleTriggerGetMax);
|
|||||||
moduleBaseFunction(moduleTriggerSetMax);
|
moduleBaseFunction(moduleTriggerSetMax);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setBounds(min, max) — sets both AABB corners at once.
|
* setBounds(min, max) - sets both AABB corners at once.
|
||||||
* @param args[0] Vec3 minimum corner.
|
* @param args[0] Vec3 minimum corner.
|
||||||
* @param args[1] Vec3 maximum corner.
|
* @param args[1] Vec3 maximum corner.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleTriggerSetBounds);
|
moduleBaseFunction(moduleTriggerSetBounds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* contains(point) — tests whether a world-space point is inside the AABB.
|
* contains(point) - tests whether a world-space point is inside the AABB.
|
||||||
* @param args[0] Vec3 point.
|
* @param args[0] Vec3 point.
|
||||||
* @return true if the point is inside the trigger volume.
|
* @return true if the point is inside the trigger volume.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ typedef struct {
|
|||||||
componentid_t componentId;
|
componentid_t componentId;
|
||||||
} jscomponent_t;
|
} jscomponent_t;
|
||||||
|
|
||||||
/** Component() constructor — always throws; not directly instantiable. */
|
/** Component() constructor - always throws; not directly instantiable. */
|
||||||
moduleBaseFunction(moduleComponentCtor);
|
moduleBaseFunction(moduleComponentCtor);
|
||||||
|
|
||||||
/** @return The entity ID that owns this component. */
|
/** @return The entity ID that owns this component. */
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ typedef struct {
|
|||||||
entityid_t id;
|
entityid_t id;
|
||||||
} jsentity_t;
|
} jsentity_t;
|
||||||
|
|
||||||
/** Entity() constructor — always throws; use Entity.create() instead. */
|
/** Entity() constructor - always throws; use Entity.create() instead. */
|
||||||
moduleBaseFunction(moduleEntityCtor);
|
moduleBaseFunction(moduleEntityCtor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity.create() — allocates a new entity slot and returns an
|
* Entity.create() - allocates a new entity slot and returns an
|
||||||
* Entity JS object.
|
* Entity JS object.
|
||||||
* @return Entity JS object.
|
* @return Entity JS object.
|
||||||
* @throws If no entity slots are available.
|
* @throws If no entity slots are available.
|
||||||
@@ -31,13 +31,13 @@ moduleBaseFunction(moduleEntityCtor);
|
|||||||
moduleBaseFunction(moduleEntityCreate);
|
moduleBaseFunction(moduleEntityCreate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity.dispose(entity) — disposes an entity and all its components.
|
* Entity.dispose(entity) - disposes an entity and all its components.
|
||||||
* @param args[0] Entity JS object.
|
* @param args[0] Entity JS object.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleEntityDisposeEntity);
|
moduleBaseFunction(moduleEntityDisposeEntity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* entity.add(type) — adds a component of the given type to this entity.
|
* entity.add(type) - adds a component of the given type to this entity.
|
||||||
* @param args[0] Component type constant (e.g. COMPONENT_TYPE_POSITION).
|
* @param args[0] Component type constant (e.g. COMPONENT_TYPE_POSITION).
|
||||||
* @return Typed component JS object (Position, Camera, etc.).
|
* @return Typed component JS object (Position, Camera, etc.).
|
||||||
* @throws If the type is invalid or no component slots are available.
|
* @throws If the type is invalid or no component slots are available.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ typedef struct {
|
|||||||
} jsevent_t;
|
} jsevent_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GC free callback — unsubscribes all on() slots and releases JS function
|
* GC free callback - unsubscribes all on() slots and releases JS function
|
||||||
* refs when the Event object is garbage collected.
|
* refs when the Event object is garbage collected.
|
||||||
*
|
*
|
||||||
* @param ptr Native jsevent_t pointer.
|
* @param ptr Native jsevent_t pointer.
|
||||||
@@ -37,19 +37,19 @@ typedef struct {
|
|||||||
void moduleEventFree(void *ptr, jerry_object_native_info_t *info);
|
void moduleEventFree(void *ptr, jerry_object_native_info_t *info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* on(fn) — subscribes fn to the event. Returns this for chaining.
|
* on(fn) - subscribes fn to the event. Returns this for chaining.
|
||||||
* @param args[0] Function to call when the event fires.
|
* @param args[0] Function to call when the event fires.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleEventOn);
|
moduleBaseFunction(moduleEventOn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* off(fn) — removes a previously subscribed fn. Returns this for chaining.
|
* off(fn) - removes a previously subscribed fn. Returns this for chaining.
|
||||||
* @param args[0] The same function reference passed to on().
|
* @param args[0] The same function reference passed to on().
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleEventOff);
|
moduleBaseFunction(moduleEventOff);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait() — returns a Promise that resolves the next time the event fires.
|
* wait() - returns a Promise that resolves the next time the event fires.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleEventWait);
|
moduleBaseFunction(moduleEventWait);
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ jerry_value_t moduleEventCreate(event_t *event);
|
|||||||
* Returns the Event object pinned at pinKey on the parent JS object,
|
* Returns the Event object pinned at pinKey on the parent JS object,
|
||||||
* creating and pinning a new one on first access.
|
* creating and pinning a new one on first access.
|
||||||
*
|
*
|
||||||
* @param callInfo The call info — this_value is the parent object.
|
* @param callInfo The call info - this_value is the parent object.
|
||||||
* @param event The C event_t to wrap. Must outlive the parent object.
|
* @param event The C event_t to wrap. Must outlive the parent object.
|
||||||
* @param pinKey Property name used to cache the Event on the parent.
|
* @param pinKey Property name used to cache the Event on the parent.
|
||||||
* @return A JS Event value (caller must free).
|
* @return A JS Event value (caller must free).
|
||||||
|
|||||||
@@ -30,44 +30,44 @@ extern scriptproto_t MODULE_INPUT_PROTO;
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input.isDown(action) — true while the action is held this frame.
|
* Input.isDown(action) - true while the action is held this frame.
|
||||||
* @param args[0] Input action constant.
|
* @param args[0] Input action constant.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleInputIsDown);
|
moduleBaseFunction(moduleInputIsDown);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input.wasDown(action) — true if the action was held last frame.
|
* Input.wasDown(action) - true if the action was held last frame.
|
||||||
* @param args[0] Input action constant.
|
* @param args[0] Input action constant.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleInputWasDown);
|
moduleBaseFunction(moduleInputWasDown);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input.pressed(action) — true on the first frame the action is held.
|
* Input.pressed(action) - true on the first frame the action is held.
|
||||||
* @param args[0] Input action constant.
|
* @param args[0] Input action constant.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleInputPressed);
|
moduleBaseFunction(moduleInputPressed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input.released(action) — true on the first frame the action is released.
|
* Input.released(action) - true on the first frame the action is released.
|
||||||
* @param args[0] Input action constant.
|
* @param args[0] Input action constant.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleInputReleased);
|
moduleBaseFunction(moduleInputReleased);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input.getValue(action) — returns the analog value (0–1) of the action.
|
* Input.getValue(action) - returns the analog value (0-1) of the action.
|
||||||
* @param args[0] Input action constant.
|
* @param args[0] Input action constant.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleInputGetValue);
|
moduleBaseFunction(moduleInputGetValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input.axis(negative, positive) — returns a signed axis value in [-1, 1].
|
* Input.axis(negative, positive) - returns a signed axis value in [-1, 1].
|
||||||
* @param args[0] Negative action constant.
|
* @param args[0] Negative action constant.
|
||||||
* @param args[1] Positive action constant.
|
* @param args[1] Positive action constant.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleInputAxis);
|
moduleBaseFunction(moduleInputAxis);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input.bind(buttonName, action) — binds a named button to an action.
|
* Input.bind(buttonName, action) - binds a named button to an action.
|
||||||
* @param args[0] Button name string.
|
* @param args[0] Button name string.
|
||||||
* @param args[1] Input action constant.
|
* @param args[1] Input action constant.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,56 +12,56 @@
|
|||||||
extern scriptproto_t MODULE_BACKPACK_PROTO;
|
extern scriptproto_t MODULE_BACKPACK_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.isFull — true when all storage slots are occupied.
|
* Backpack.isFull - true when all storage slots are occupied.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleBackpackGetIsFull);
|
moduleBaseFunction(moduleBackpackGetIsFull);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.getCount(itemId) — quantity of itemId (0 if absent).
|
* Backpack.getCount(itemId) - quantity of itemId (0 if absent).
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleBackpackGetCount);
|
moduleBaseFunction(moduleBackpackGetCount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.has(itemId) — true if itemId is present with quantity > 0.
|
* Backpack.has(itemId) - true if itemId is present with quantity > 0.
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleBackpackHas);
|
moduleBaseFunction(moduleBackpackHas);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.isItemFull(itemId) — true if the stack is at max quantity.
|
* Backpack.isItemFull(itemId) - true if the stack is at max quantity.
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleBackpackIsItemFull);
|
moduleBaseFunction(moduleBackpackIsItemFull);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.set(itemId, quantity) — set quantity; removes when 0.
|
* Backpack.set(itemId, quantity) - set quantity; removes when 0.
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
* @param args[1] Quantity 0–255.
|
* @param args[1] Quantity 0-255.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleBackpackSet);
|
moduleBaseFunction(moduleBackpackSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.add(itemId, quantity) — add quantity units of itemId.
|
* Backpack.add(itemId, quantity) - add quantity units of itemId.
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
* @param args[1] Quantity to add (1–255).
|
* @param args[1] Quantity to add (1-255).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleBackpackAdd);
|
moduleBaseFunction(moduleBackpackAdd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.remove(itemId) — removes itemId entirely from the backpack.
|
* Backpack.remove(itemId) - removes itemId entirely from the backpack.
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleBackpackRemove);
|
moduleBaseFunction(moduleBackpackRemove);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backpack.sort(sortBy[, reverse]) — sort the backpack contents.
|
* Backpack.sort(sortBy[, reverse]) - sort the backpack contents.
|
||||||
*
|
*
|
||||||
* @param args[0] Sort type (INVENTORY_SORT_BY_ID or
|
* @param args[0] Sort type (INVENTORY_SORT_BY_ID or
|
||||||
* INVENTORY_SORT_BY_TYPE).
|
* INVENTORY_SORT_BY_TYPE).
|
||||||
|
|||||||
@@ -29,14 +29,14 @@ extern scriptproto_t MODULE_ITEM_PROTO;
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item.getName(itemId) — returns the item's string name.
|
* Item.getName(itemId) - returns the item's string name.
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleItemGetName);
|
moduleBaseFunction(moduleItemGetName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item.getType(itemId) — returns the item's type constant.
|
* Item.getType(itemId) - returns the item's type constant.
|
||||||
*
|
*
|
||||||
* @param args[0] Item ID constant (ITEM_ID_*).
|
* @param args[0] Item ID constant (ITEM_ID_*).
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
extern scriptproto_t MODULE_LOCALE_PROTO;
|
extern scriptproto_t MODULE_LOCALE_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locale.getText(id[, pluralCount[, arg1, ...]]) — returns the
|
* Locale.getText(id[, pluralCount[, arg1, ...]]) - returns the
|
||||||
* translated string for the given message ID.
|
* translated string for the given message ID.
|
||||||
*
|
*
|
||||||
* @param args[0] Message ID string.
|
* @param args[0] Message ID string.
|
||||||
@@ -23,7 +23,7 @@ extern scriptproto_t MODULE_LOCALE_PROTO;
|
|||||||
moduleBaseFunction(moduleLocaleGetText);
|
moduleBaseFunction(moduleLocaleGetText);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locale.setLocale(name) — switches the active locale by name.
|
* Locale.setLocale(name) - switches the active locale by name.
|
||||||
*
|
*
|
||||||
* @param args[0] Locale name string, e.g. "en-US".
|
* @param args[0] Locale name string, e.g. "en-US".
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
extern scriptproto_t MODULE_OVERWORLD_PROTO;
|
extern scriptproto_t MODULE_OVERWORLD_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overworld.loadMap(handle) — loads the map with the given handle string.
|
* Overworld.loadMap(handle) - loads the map with the given handle string.
|
||||||
* Disposes any currently loaded map first.
|
* Disposes any currently loaded map first.
|
||||||
*
|
*
|
||||||
* @param args[0] Map handle string (max 31 chars).
|
* @param args[0] Map handle string (max 31 chars).
|
||||||
@@ -20,14 +20,14 @@ extern scriptproto_t MODULE_OVERWORLD_PROTO;
|
|||||||
moduleBaseFunction(moduleOverworldLoadMap);
|
moduleBaseFunction(moduleOverworldLoadMap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overworld.isLoaded() — returns true when a map is currently loaded.
|
* Overworld.isLoaded() - returns true when a map is currently loaded.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleOverworldIsLoaded);
|
moduleBaseFunction(moduleOverworldIsLoaded);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overworld.setPosition(x, y, z) — slides the chunk window to the tile
|
* Overworld.setPosition(x, y, z) - slides the chunk window to the tile
|
||||||
* position (x, y, z).
|
* position (x, y, z).
|
||||||
*
|
*
|
||||||
* @param args[0] Tile X (integer).
|
* @param args[0] Tile X (integer).
|
||||||
@@ -37,12 +37,12 @@ moduleBaseFunction(moduleOverworldIsLoaded);
|
|||||||
moduleBaseFunction(moduleOverworldSetPosition);
|
moduleBaseFunction(moduleOverworldSetPosition);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overworld.update() — advances the map one tick.
|
* Overworld.update() - advances the map one tick.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleOverworldUpdate);
|
moduleBaseFunction(moduleOverworldUpdate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overworld.dispose() — unloads the current map.
|
* Overworld.dispose() - unloads the current map.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleOverworldJsDispose);
|
moduleBaseFunction(moduleOverworldJsDispose);
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ jerry_value_t moduleRequireAsyncFunc(
|
|||||||
|
|
||||||
jerry_value_t promise = jerry_promise();
|
jerry_value_t promise = jerry_promise();
|
||||||
|
|
||||||
// Already loaded — resolve immediately.
|
// Already loaded - resolve immediately.
|
||||||
if(entry->state == ASSET_ENTRY_STATE_LOADED) {
|
if(entry->state == ASSET_ENTRY_STATE_LOADED) {
|
||||||
jerry_value_t exports = (
|
jerry_value_t exports = (
|
||||||
jerry_value_is_undefined(entry->data.script.exports) ?
|
jerry_value_is_undefined(entry->data.script.exports) ?
|
||||||
@@ -167,7 +167,7 @@ jerry_value_t moduleRequireAsyncFunc(
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Already errored — reject immediately.
|
// Already errored - reject immediately.
|
||||||
if(entry->state == ASSET_ENTRY_STATE_ERROR) {
|
if(entry->state == ASSET_ENTRY_STATE_ERROR) {
|
||||||
assetUnlockEntry(entry);
|
assetUnlockEntry(entry);
|
||||||
jerry_value_t errStr = jerry_string_sz("Module load failed");
|
jerry_value_t errStr = jerry_string_sz("Module load failed");
|
||||||
|
|||||||
@@ -29,28 +29,28 @@ extern scriptproto_t MODULE_SAVE_PROTO;
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save.exists(slot) — true if a save file is present for the slot.
|
* Save.exists(slot) - true if a save file is present for the slot.
|
||||||
*
|
*
|
||||||
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleSaveExists);
|
moduleBaseFunction(moduleSaveExists);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save.load(slot) — loads the save file for the given slot.
|
* Save.load(slot) - loads the save file for the given slot.
|
||||||
*
|
*
|
||||||
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleSaveLoad);
|
moduleBaseFunction(moduleSaveLoad);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save.write(slot) — writes the save file for the given slot.
|
* Save.write(slot) - writes the save file for the given slot.
|
||||||
*
|
*
|
||||||
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleSaveWrite);
|
moduleBaseFunction(moduleSaveWrite);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save.delete(slot) — deletes the save file for the given slot.
|
* Save.delete(slot) - deletes the save file for the given slot.
|
||||||
*
|
*
|
||||||
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
* @param args[0] Save slot index (0 to SAVE_FILE_COUNT_MAX - 1).
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,17 +29,17 @@ extern scriptproto_t MODULE_STORY_PROTO;
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Story.get(flagId) — returns the current uint8 value of a story flag.
|
* Story.get(flagId) - returns the current uint8 value of a story flag.
|
||||||
*
|
*
|
||||||
* @param args[0] Story flag constant (STORY_FLAG_*).
|
* @param args[0] Story flag constant (STORY_FLAG_*).
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleStoryGet);
|
moduleBaseFunction(moduleStoryGet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Story.set(flagId, value) — sets a story flag to a uint8 value.
|
* Story.set(flagId, value) - sets a story flag to a uint8 value.
|
||||||
*
|
*
|
||||||
* @param args[0] Story flag constant (STORY_FLAG_*).
|
* @param args[0] Story flag constant (STORY_FLAG_*).
|
||||||
* @param args[1] Value 0–255.
|
* @param args[1] Value 0-255.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleStorySet);
|
moduleBaseFunction(moduleStorySet);
|
||||||
|
|
||||||
|
|||||||
@@ -12,29 +12,29 @@
|
|||||||
extern scriptproto_t MODULE_TEXTBOX_PROTO;
|
extern scriptproto_t MODULE_TEXTBOX_PROTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UITextbox.setText(text) — sets the textbox content and rebuilds layout.
|
* UITextbox.setText(text) - sets the textbox content and rebuilds layout.
|
||||||
*
|
*
|
||||||
* @param args[0] Null-terminated text string.
|
* @param args[0] Null-terminated text string.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleTextboxSetText);
|
moduleBaseFunction(moduleTextboxSetText);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UITextbox.nextPage() — advances to the next page; no-op on last page.
|
* UITextbox.nextPage() - advances to the next page; no-op on last page.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleTextboxNextPage);
|
moduleBaseFunction(moduleTextboxNextPage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UITextbox.update() — advances the typewriter scroll by one tick.
|
* UITextbox.update() - advances the typewriter scroll by one tick.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleTextboxUpdate);
|
moduleBaseFunction(moduleTextboxUpdate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UITextbox.draw() — draws the frame and visible text for this frame.
|
* UITextbox.draw() - draws the frame and visible text for this frame.
|
||||||
*/
|
*/
|
||||||
moduleBaseFunction(moduleTextboxDraw);
|
moduleBaseFunction(moduleTextboxDraw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UITextbox.setAdvanceAction(action) — sets the input action that
|
* UITextbox.setAdvanceAction(action) - sets the input action that
|
||||||
* advances the textbox when held.
|
* advances the textbox when held.
|
||||||
*
|
*
|
||||||
* @param args[0] Input action constant (INPUT_ACTION_*).
|
* @param args[0] Input action constant (INPUT_ACTION_*).
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ errorret_t assetInitDolphinDVD(void) {
|
|||||||
while(pos < rootSize) {
|
while(pos < rootSize) {
|
||||||
u8 recLen = dir[pos];
|
u8 recLen = dir[pos];
|
||||||
if(recLen == 0) {
|
if(recLen == 0) {
|
||||||
// Sector padding — skip to the start of the next sector.
|
// Sector padding - skip to the start of the next sector.
|
||||||
pos = (
|
pos = (
|
||||||
pos + (ASSET_DOLPHIN_DVD_SECTOR_SIZE - 1u)
|
pos + (ASSET_DOLPHIN_DVD_SECTOR_SIZE - 1u)
|
||||||
) & ~(ASSET_DOLPHIN_DVD_SECTOR_SIZE - 1u);
|
) & ~(ASSET_DOLPHIN_DVD_SECTOR_SIZE - 1u);
|
||||||
|
|||||||
@@ -114,12 +114,12 @@ void logError(const char_t *message, ...) {
|
|||||||
va_end(copy);
|
va_end(copy);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
// PAD_Init is idempotent — safe even if inputInit already called it,
|
// PAD_Init is idempotent - safe even if inputInit already called it,
|
||||||
// and handles the case where the error occurred before inputInit ran.
|
// and handles the case where the error occurred before inputInit ran.
|
||||||
PAD_Init();
|
PAD_Init();
|
||||||
while(SYS_MainLoop()) {
|
while(SYS_MainLoop()) {
|
||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
// START button matches the RAGEQUIT bind — allows exit on GC controller
|
// START button matches the RAGEQUIT bind - allows exit on GC controller
|
||||||
// when there is no Wiimote HOME button available.
|
// when there is no Wiimote HOME button available.
|
||||||
if(PAD_ButtonsDown(0) & PAD_BUTTON_START) break;
|
if(PAD_ButtonsDown(0) & PAD_BUTTON_START) break;
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|||||||
Reference in New Issue
Block a user