1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-02 22:14:33 +00:00

Some doc on actor overlays alloc types (#1266)

* Some doc on actor overlays alloc types

* Line breaks between defines at the top of actor.h

* plain english

* `ACTOR_ALLOC_` -> `ACTOROVL_ALLOC_`

* More line breaks

* `ACTOR_OVERLAY_ABSOLUTE_SPACE_SIZE` -> `ACTOROVL_ABSOLUTE_SPACE_SIZE`

* Document bug about Scarecrow's Song not setting the flag to restore Nayru's Love

* Try to document the check for needing to actor_kill to leave the absolute space being too broad

* "which overlay uses" (bad english) -> simplify to "which uses"

* Run formatter
This commit is contained in:
Dragorn421 2022-06-20 13:17:09 -07:00 committed by GitHub
parent b602276fef
commit 017a3aaf5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 539 additions and 463 deletions

View file

@ -7,8 +7,9 @@
#include "z64collision_check.h"
#define ACTOR_NUMBER_MAX 200
#define INVISIBLE_ACTOR_MAX 20
#define AM_FIELD_SIZE 0x27A0
#define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC colliders
#define MASS_HEAVY 0xFE // Can only be pushed by OC colliders from actors with IMMOVABLE or HEAVY mass.
@ -38,11 +39,50 @@ typedef struct {
/* 0x1C */ ActorFunc draw; // Draw function
} ActorInit; // size = 0x20
typedef enum {
/* 0 */ ALLOCTYPE_NORMAL,
/* 1 */ ALLOCTYPE_ABSOLUTE,
/* 2 */ ALLOCTYPE_PERMANENT
} AllocType;
/**
* @see ACTOROVL_ALLOC_ABSOLUTE
*/
#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x27A0
/**
* The actor overlay should be allocated memory for when loading,
* and the memory deallocated when there is no more actor using the overlay.
*
* `ACTOROVL_ALLOC_` defines indicate how an actor overlay should be loaded.
*
* @note Bitwise or-ing `ACTOROVL_ALLOC_` types is not meaningful.
* The `ACTOROVL_ALLOC_` types are 0, 1, 2 but checked against with a bitwise and.
*
* @see ACTOROVL_ALLOC_ABSOLUTE
* @see ACTOROVL_ALLOC_PERSISTENT
* @see actor_table.h
*/
#define ACTOROVL_ALLOC_NORMAL 0
/**
* The actor overlay should be loaded to "absolute space".
*
* Absolute space is a fixed amount of memory allocated once.
* The overlay will still need to be loaded again if at some point there is no more actor using the overlay.
*
* @note Only one such overlay may be loaded at a time.
* This is not checked: a newly loaded overlay will overwrite the previous one in absolute space,
* even if actors are still relying on the previous one. Actors using absolute-allocated overlays should be deleted
* when another absolute-allocated overlay is about to be used.
*
* @see ACTOROVL_ABSOLUTE_SPACE_SIZE
* @see ActorContext.absoluteSpace
* @see ACTOROVL_ALLOC_NORMAL
*/
#define ACTOROVL_ALLOC_ABSOLUTE (1 << 0)
/**
* The actor overlay should be loaded persistently.
* It will stay loaded until the current game state instance ends.
*
* @see ACTOROVL_ALLOC_NORMAL
*/
#define ACTOROVL_ALLOC_PERSISTENT (1 << 1)
typedef struct {
/* 0x00 */ u32 vromStart;
@ -52,7 +92,7 @@ typedef struct {
/* 0x10 */ void* loadedRamAddr; // original name: "allocp"
/* 0x14 */ ActorInit* initInfo;
/* 0x18 */ char* name;
/* 0x1C */ u16 allocType;
/* 0x1C */ u16 allocType; // See `ACTOROVL_ALLOC_` defines
/* 0x1E */ s8 numLoaded; // original name: "clients"
} ActorOverlay; // size = 0x20