summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2023-07-10 19:47:39 -0700
committerGitHub <noreply@github.com>2023-07-10 22:47:39 -0400
commit913cd981c0b0213da3542b6368f026ea0d8214e3 (patch)
tree5c8a2ecf30e1d4951ea883668443f09812030ddb /src/code
parentdb6268a12e11c52867bf9d0307f28ab6bbf8498c (diff)
Deku Playground Docs (#1318)
* Actor shared memory * EnGameLupy * EnLiftNuts * object_dnt * PR Suggestions * Things I missed * sPad * Format * PR comments
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_actor.c44
-rw-r--r--src/code/z_sram_NES.c2
2 files changed, 25 insertions, 21 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 843b0eafd..0d72410ad 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -956,33 +956,37 @@ f32 Actor_GetPlayerImpact(PlayState* play, f32 range, Vec3f* pos, PlayerImpactTy
}
/**
- * Initializes an element of the `play->actorCtx.unk_20C` array to the `arg2` pointer, or allocates one using the
- * `size` argument in case `arg2` is NULL. This element is associated to an `id`
+ * Initializes an element of the `play->actorCtx.actorSharedMemory` array to the `ptr` pointer, or allocates one using
+ * the `size` argument in case `ptr` is NULL. This element is associated to an `id`.
*
- * In success returns the allocated pointer if `arg2` was NULL or the `arg2` pointer otherwise
- * In failure (There's no space left in `play->actorCtx.unk_20C` or an allocation error happened) returns NULL
+ * This allows allows different actors the ability to access the varible, and thus communicate with each other by
+ * reading/setting the value.
+ *
+ * In success: returns the allocated pointer if `ptr` was NULL or the `ptr` pointer otherwise.
+ * In failure (There's no space left in `play->actorCtx.actorSharedMemory` or an allocation error happened): returns
+ * NULL.
*
* Note there are no duplicated id checks.
*
* Used only by EnLiftNuts.
*/
-void* func_800B6584(PlayState* play, s16 id, void* arg2, size_t size) {
- ActorContext_unk_20C* entry = play->actorCtx.unk_20C;
+void* Actor_AddSharedMemoryEntry(PlayState* play, s16 id, void* ptr, size_t size) {
+ ActorSharedMemoryEntry* entry = play->actorCtx.actorSharedMemory;
s32 i;
- for (i = 0; i < ARRAY_COUNT(play->actorCtx.unk_20C); i++) {
+ for (i = 0; i < ARRAY_COUNT(play->actorCtx.actorSharedMemory); i++) {
if (entry->id == 0) {
- if (arg2 == NULL) {
- arg2 = ZeldaArena_Malloc(size);
- if (arg2 == NULL) {
+ if (ptr == NULL) {
+ ptr = ZeldaArena_Malloc(size);
+ if (ptr == NULL) {
return NULL;
}
entry->isDynamicallyInitialised = true;
}
entry->id = id;
- entry->ptr = arg2;
- return arg2;
+ entry->ptr = ptr;
+ return ptr;
}
entry++;
@@ -992,18 +996,18 @@ void* func_800B6584(PlayState* play, s16 id, void* arg2, size_t size) {
}
/**
- * Frees the first element of `play->actorCtx.unk_20C` with id `id`.
+ * Frees the first element of `play->actorCtx.actorSharedMemory` with id `id`.
*
* If success, the free'd pointer is returned.
* If failure, NULL is returned.
*
* Used only by EnLiftNuts.
*/
-void* func_800B6608(PlayState* play, s16 id) {
- ActorContext_unk_20C* entry = play->actorCtx.unk_20C;
+void* Actor_FreeSharedMemoryEntry(PlayState* play, s16 id) {
+ ActorSharedMemoryEntry* entry = play->actorCtx.actorSharedMemory;
s32 i;
- for (i = 0; i < ARRAY_COUNT(play->actorCtx.unk_20C); i++) {
+ for (i = 0; i < ARRAY_COUNT(play->actorCtx.actorSharedMemory); i++) {
if (id == entry->id) {
entry->id = 0;
if (entry->isDynamicallyInitialised) {
@@ -1020,16 +1024,16 @@ void* func_800B6608(PlayState* play, s16 id) {
}
/**
- * Retrieves the first pointer stored with the id `id`.
+ * Retrieves the first pointer stored with the id `id` from `play->actorCtx.actorSharedMemory`.
* If there's no pointer stored with that id, NULL is returned.
*
* Used only by EnGamelupy.
*/
-void* func_800B6680(PlayState* play, s16 id) {
- ActorContext_unk_20C* entry = play->actorCtx.unk_20C;
+void* Actor_FindSharedMemoryEntry(PlayState* play, s16 id) {
+ ActorSharedMemoryEntry* entry = play->actorCtx.actorSharedMemory;
s32 i;
- for (i = 0; i < ARRAY_COUNT(play->actorCtx.unk_20C); i++) {
+ for (i = 0; i < ARRAY_COUNT(play->actorCtx.actorSharedMemory); i++) {
if (id == entry->id) {
return entry->ptr;
}
diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c
index 7e0caa640..41c9fa9da 100644
--- a/src/code/z_sram_NES.c
+++ b/src/code/z_sram_NES.c
@@ -88,7 +88,7 @@ u16 sPersistentCycleWeekEventRegs[ARRAY_COUNT(gSaveContext.save.saveInfo.weekEve
/* 11 */ 0,
/* 12 */ PERSISTENT_WEEKEVENTREG(WEEKEVENTREG_12_10),
/* 13 */ PERSISTENT_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE),
- /* 14 */ PERSISTENT_WEEKEVENTREG(WEEKEVENTREG_14_80),
+ /* 14 */ PERSISTENT_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_DEKU_PLAYGROUND_HEART_PIECE),
/* 15 */ PERSISTENT_WEEKEVENTREG(WEEKEVENTREG_15_20),
/* 16 */ 0,
/* 17 */ 0,