mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-02 22:14:33 +00:00
Actor Struct Changes (and a few related things) (#617)
* reformat header * type -> category * done for now i think * some more stuff * first -> head * focus * flag comment * ground -> floor * remove asm, name wrapper funcs * name func, format * review * targetPriority, format * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "0305ec2c2" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "0305ec2c2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * comment * review * feet flags * horse shadow
This commit is contained in:
parent
20206fba0d
commit
00a5edea71
697 changed files with 8157 additions and 7942 deletions
|
@ -13,50 +13,47 @@
|
|||
#define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects.
|
||||
|
||||
struct Actor;
|
||||
// From z64.h
|
||||
struct GlobalContext;
|
||||
|
||||
// From z64light.h
|
||||
struct Lights;
|
||||
|
||||
typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*);
|
||||
typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct GlobalContext*);
|
||||
typedef u16 (*callback1_800343CC)(struct GlobalContext*, struct Actor*);
|
||||
typedef s16 (*callback2_800343CC)(struct GlobalContext*, struct Actor*);
|
||||
|
||||
typedef struct {
|
||||
Vec3f pos;
|
||||
Vec3s rot;
|
||||
} PosRot; // size = 0x14
|
||||
|
||||
|
||||
typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*);
|
||||
typedef u16 (*callback1_800343CC)(struct GlobalContext*, struct Actor*);
|
||||
typedef s16 (*callback2_800343CC)(struct GlobalContext*, struct Actor*);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 id;
|
||||
/* 0x02 */ u8 type; // Classifies actor and determines when actor will execute
|
||||
/* 0x02 */ u8 category; // Classifies actor and determines when it will update or draw
|
||||
/* 0x04 */ u32 flags;
|
||||
/* 0x08 */ s16 objectId;
|
||||
/* 0x0C */ u32 instanceSize;
|
||||
/* 0x10 */ ActorFunc init; // Constructor
|
||||
/* 0x14 */ ActorFunc destroy; // Destructor
|
||||
/* 0x18 */ ActorFunc update; // Main Update Function
|
||||
/* 0x18 */ ActorFunc update; // Update Function
|
||||
/* 0x1C */ ActorFunc draw; // Draw function
|
||||
} ActorInit; // size = 0x20
|
||||
|
||||
typedef enum {
|
||||
ALLOCTYPE_NORMAL,
|
||||
ALLOCTYPE_ABSOLUTE,
|
||||
ALLOCTYPE_PERMANENT
|
||||
/* 0 */ ALLOCTYPE_NORMAL,
|
||||
/* 1 */ ALLOCTYPE_ABSOLUTE,
|
||||
/* 2 */ ALLOCTYPE_PERMANENT
|
||||
} AllocType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 vromStart;
|
||||
/* 0x04 */ u32 vromEnd;
|
||||
/* 0x00 */ u32 vromStart;
|
||||
/* 0x04 */ u32 vromEnd;
|
||||
/* 0x08 */ void* vramStart;
|
||||
/* 0x0C */ void* vramEnd;
|
||||
/* 0x10 */ void* loadedRamAddr; // original name: "allocp"
|
||||
/* 0x14 */ ActorInit* initInfo;
|
||||
/* 0x18 */ char* name;
|
||||
/* 0x1C */ u16 allocType;
|
||||
/* 0x1E */ s8 nbLoaded; // original name: "clients"
|
||||
/* 0x1C */ u16 allocType;
|
||||
/* 0x1E */ s8 nbLoaded; // original name: "clients"
|
||||
} ActorOverlay; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
|
@ -65,103 +62,131 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 health;
|
||||
/* 0x02 */ s16 unk_02;
|
||||
/* 0x04 */ s16 unk_04;
|
||||
/* 0x02 */ s16 cylRadius;
|
||||
/* 0x04 */ s16 cylHeight;
|
||||
/* 0x06 */ u8 mass;
|
||||
} CollisionCheckInfoInit;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 health;
|
||||
/* 0x02 */ s16 unk_02;
|
||||
/* 0x04 */ s16 unk_04;
|
||||
/* 0x06 */ s16 unk_06;
|
||||
/* 0x02 */ s16 cylRadius;
|
||||
/* 0x04 */ s16 cylHeight;
|
||||
/* 0x06 */ s16 cylYShift;
|
||||
/* 0x08 */ u8 mass;
|
||||
} CollisionCheckInfoInit2;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ DamageTable* damageTable; // For actors which contain one (example: Stalfos)...
|
||||
/* 0x00 */ DamageTable* damageTable;
|
||||
/* 0x04 */ Vec3f displacement; // Amount to correct velocity (0x5C) by when colliding into a body
|
||||
/* 0x10 */ s16 unk_10;
|
||||
/* 0x12 */ s16 unk_12;
|
||||
/* 0x14 */ u16 unk_14;
|
||||
/* 0x16 */ u8 mass; // Used to compute displacement, 50 is common value, 0xFF for infinite mass/unmoveable
|
||||
/* 0x17 */ u8 health;
|
||||
/* 0x18 */ u8 damage; // Amount to decrement health by
|
||||
/* 0x19 */ u8 damageEffect; // Stores what effect should occur when hit by a weapon
|
||||
/* 0x1A */ u8 atHitEffect; // Stores what effect should occur when AT connects with an AC
|
||||
/* 0x1B */ u8 acHitEffect; // Stores what effect should occur when AC is touched by an AT
|
||||
/* 0x10 */ s16 cylRadius; // Used for various purposes
|
||||
/* 0x12 */ s16 cylHeight; // Used for various purposes
|
||||
/* 0x14 */ s16 cylYShift; // Unused. Purpose inferred from Cylinder16 and CollisionCheck_CylSideVsLineSeg
|
||||
/* 0x16 */ u8 mass; // Used to compute displacement for OC collisions
|
||||
/* 0x17 */ u8 health; // Note: some actors may use their own health variable instead of this one
|
||||
/* 0x18 */ u8 damage; // Amount to decrement health by
|
||||
/* 0x19 */ u8 damageEffect; // Stores what effect should occur when hit by a weapon
|
||||
/* 0x1A */ u8 atHitEffect; // Stores what effect should occur when AT connects with an AC
|
||||
/* 0x1B */ u8 acHitEffect; // Stores what effect should occur when AC is touched by an AT
|
||||
} CollisionCheckInfo; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3s rot; // Current actor shape rotation
|
||||
/* 0x06 */ s16 unk_06;
|
||||
/* 0x08 */ f32 unk_08; // Model y axis offset. Represents model space units. collision mesh related
|
||||
/* 0x0C */ void (*shadowDrawFunc)(struct Actor*, struct Lights*, struct GlobalContext*);
|
||||
/* 0x10 */ f32 unk_10;
|
||||
/* 0x14 */ u8 unk_14;
|
||||
/* 0x15 */ u8 unk_15;
|
||||
/* 0x00 */ Vec3s rot; // Current actor shape rotation
|
||||
/* 0x06 */ s16 face; // Used to index eyebrow/eye/mouth textures. Only used by player
|
||||
/* 0x08 */ f32 yOffset; // Model y axis offset. Represents model space units
|
||||
/* 0x0C */ ActorShadowFunc shadowDraw; // Shadow draw function
|
||||
/* 0x10 */ f32 shadowScale; // Changes the size of the shadow
|
||||
/* 0x14 */ u8 shadowAlpha; // Default is 255
|
||||
/* 0x15 */ u8 feetFloorFlags; // Set if the actor's foot is clipped under the floor. & 1 is right foot, & 2 is left
|
||||
/* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDraw
|
||||
} ActorShape; // size = 0x18
|
||||
|
||||
typedef struct Actor {
|
||||
/* 0x000 */ s16 id; // Actor Id
|
||||
/* 0x002 */ u8 type; // Actor Type. Refer to the corresponding enum for values
|
||||
/* 0x003 */ s8 room; // Room number the actor is in. -1 denotes that the actor won't despawn on a room change
|
||||
/* 0x004 */ u32 flags; // Flags used for various purposes
|
||||
/* 0x008 */ PosRot initPosRot; // Initial position/rotation when spawned. Is sometimes used for other purposes
|
||||
/* 0x01C */ s16 params; // original name: "args_data"; Configurable variable set by an actor's spawn data
|
||||
/* 0x01E */ s8 objBankIndex; // original name: "bank"; Object bank index of this actor's object dependency
|
||||
/* 0x01F */ s8 unk_1F;
|
||||
/* 0x020 */ u16 sfx; // Plays sound effect relative to actor's location (if within range of camera?)
|
||||
/* 0x024 */ PosRot posRot; // position/rotation in the world
|
||||
/* 0x038 */ PosRot posRot2;
|
||||
/* 0x04C */ f32 unk_4C;
|
||||
/* 0x050 */ Vec3f scale; // Sets x,y,z scaling factor. Typically, a factor of 0.01 is used for each axis
|
||||
/* 0x05C */ Vec3f velocity;
|
||||
/* 0x068 */ f32 speedXZ; // Always positive, stores how fast the actor is traveling along the XZ plane
|
||||
/* 0x06C */ f32 gravity; // Acceleration due to gravity; value is added to Y velocity every frame
|
||||
/* 0x070 */ f32 minVelocityY; // Sets the lower bounds cap on velocity along the Y axis
|
||||
/* 0x074 */ CollisionPoly* wallPoly; // Wall polygon an actor is touching
|
||||
/* 0x078 */ CollisionPoly* floorPoly; // Floor polygon an actor is over/touching
|
||||
/* 0x07C */ u8 wallPolySource; // Complex Poly Surface Source. 0x32 = Scene
|
||||
/* 0x07D */ u8 floorPolySource; // Complex Poly Surface Source. 0x32 = Scene. related to 0x80/88
|
||||
/* 0x07E */ s16 wallPolyRot; // Rotation of the wall poly
|
||||
/* 0x080 */ f32 groundY; // Floor poly height
|
||||
/* 0x084 */ f32 yDistToWater; // Distance from water surface
|
||||
/* 0x088 */ u16 bgCheckFlags;
|
||||
/* 0x08A */ s16 yawTowardsLink;
|
||||
/* 0x08C */ f32 xyzDistToLinkSq;
|
||||
/* 0x090 */ f32 xzDistToLink;
|
||||
/* 0x094 */ f32 yDistToLink;
|
||||
/* 0x098 */ CollisionCheckInfo colChkInfo;
|
||||
/* 0x0B4 */ ActorShape shape;
|
||||
/* 0x0CC */ Vec3f unk_CC[2];
|
||||
/* 0x0E4 */ Vec3f projectedPos; // actor position in projected space
|
||||
/* 0x0F0 */ f32 projectedW; // w component of the projected actor position vector
|
||||
/* 0x0F4 */ f32 uncullZoneForward; // amount to increase the uncull zone forward by (in projected space)
|
||||
/* 0x0F8 */ f32 uncullZoneScale; // amount to increase the uncull zone scale by (in projected space)
|
||||
/* 0x0FC */ f32 uncullZoneDownward; // amount to increase uncull zone downward by (in projected space)
|
||||
/* 0x100 */ Vec3f pos4; // previous position
|
||||
/* 0x10C */ u8 unk_10C; // Z-Target related
|
||||
/* 0x10D */ u8 unk_10D; // Z-Target related
|
||||
/* 0x10E */ u16 textId; // Text id to pass to link/display when interacting with an actor
|
||||
/* 0x110 */ u16 freezeTimer;
|
||||
/* 0x112 */ u16 dmgEffectParams; // Specifies damage effect color (white/red/blue) and if opaque or translucent
|
||||
/* 0x114 */ u8 dmgEffectTimer;
|
||||
/* 0x115 */ u8 isDrawn; // Indicates whether the actor is currently being drawn (but not seen through lens)
|
||||
/* 0x116 */ u8 unk_116;
|
||||
/* 0x117 */ u8 naviEnemyId; // Sets what 0600 dialog to display when talking to navi. Default 0xFF
|
||||
/* 0x118 */ struct Actor* parent;
|
||||
/* 0x11C */ struct Actor* child;
|
||||
/* 0x120 */ struct Actor* prev; // Previous Actor of this type
|
||||
/* 0x124 */ struct Actor* next; // Next Actor of this type
|
||||
/* 0x128 */ ActorFunc init; // Initialization Routine. Called by Actor_Init or Actor_UpdateAll
|
||||
/* 0x12C */ ActorFunc destroy; // Destruction Routine. Called by Actor_Destroy
|
||||
/* 0x130 */ ActorFunc update; // Update Routine. Called by Actor_UpdateAll
|
||||
/* 0x134 */ ActorFunc draw; // Draw Routine. Called by Actor_Draw
|
||||
/* 0x000 */ s16 id; // Actor ID
|
||||
/* 0x002 */ u8 category; // Actor category. Refer to the corresponding enum for values
|
||||
/* 0x003 */ s8 room; // Room number the actor is in. -1 denotes that the actor won't despawn on a room change
|
||||
/* 0x004 */ u32 flags; // Flags used for various purposes
|
||||
/* 0x008 */ PosRot home; // Initial position/rotation when spawned. Can be used for other purposes
|
||||
/* 0x01C */ s16 params; // Configurable variable set by the actor's spawn data; original name: "args_data"
|
||||
/* 0x01E */ s8 objBankIndex; // Object bank index of the actor's object dependency; original name: "bank"
|
||||
/* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on
|
||||
/* 0x020 */ u16 sfx; // SFX ID to play. Sound plays when value is set, then is cleared the following update cycle
|
||||
/* 0x024 */ PosRot world; // Position/rotation in the world
|
||||
/* 0x038 */ PosRot focus; // Target reticle focuses on this position. For player this represents head pos and rot
|
||||
/* 0x04C */ f32 targetArrowOffset; // Height offset of the target arrow relative to `focus` position
|
||||
/* 0x050 */ Vec3f scale; // Scale of the actor in each axis
|
||||
/* 0x05C */ Vec3f velocity; // Velocity of the actor in each axis
|
||||
/* 0x068 */ f32 speedXZ; // How fast the actor is traveling along the XZ plane
|
||||
/* 0x06C */ f32 gravity; // Acceleration due to gravity. Value is added to Y velocity every frame
|
||||
/* 0x070 */ f32 minVelocityY; // Sets the lower bounds cap on velocity along the Y axis
|
||||
/* 0x074 */ CollisionPoly* wallPoly; // Wall polygon the actor is touching
|
||||
/* 0x078 */ CollisionPoly* floorPoly; // Floor polygon directly below the actor
|
||||
/* 0x07C */ u8 wallBgId; // Bg ID of the wall polygon the actor is touching
|
||||
/* 0x07D */ u8 floorBgId; // Bg ID of the floor polygon directly below the actor
|
||||
/* 0x07E */ s16 wallYaw; // Y rotation of the wall polygon the actor is touching
|
||||
/* 0x080 */ f32 floorHeight; // Y position of the floor polygon directly below the actor
|
||||
/* 0x084 */ f32 yDistToWater; // Distance to the surface of active waterbox. Negative value means above water
|
||||
/* 0x088 */ u16 bgCheckFlags; // See comments below actor struct for wip docs. TODO: macros for these flags
|
||||
/* 0x08A */ s16 yawTowardsPlayer; // Y rotation difference between the actor and the player
|
||||
/* 0x08C */ f32 xyzDistToPlayerSq; // Squared distance between the actor and the player in the x,y,z axis
|
||||
/* 0x090 */ f32 xzDistToPlayer; // Distance between the actor and the player in the XZ plane
|
||||
/* 0x094 */ f32 yDistToPlayer; // Dist is negative if the actor is above the player
|
||||
/* 0x098 */ CollisionCheckInfo colChkInfo; // Variables related to the Collision Check system
|
||||
/* 0x0B4 */ ActorShape shape; // Variables related to the physical shape of the actor
|
||||
/* 0x0E4 */ Vec3f projectedPos; // Position of the actor in projected space
|
||||
/* 0x0F0 */ f32 projectedW; // w component of the projected actor position
|
||||
/* 0x0F4 */ f32 uncullZoneForward; // Amount to increase the uncull zone forward by (in projected space)
|
||||
/* 0x0F8 */ f32 uncullZoneScale; // Amount to increase the uncull zone scale by (in projected space)
|
||||
/* 0x0FC */ f32 uncullZoneDownward; // Amount to increase uncull zone downward by (in projected space)
|
||||
/* 0x100 */ Vec3f prevPos; // World position from the previous update cycle
|
||||
/* 0x10C */ u8 isTargeted; // Set to true if the actor is currently being targeted by the player
|
||||
/* 0x10D */ u8 targetPriority; // Lower values have higher priority. Resets to 0 when player stops targeting
|
||||
/* 0x10E */ u16 textId; // Text ID to pass to link/display when interacting with the actor
|
||||
/* 0x110 */ u16 freezeTimer; // Actor does not update when set. Timer decrements automatically
|
||||
/* 0x112 */ u16 colorFilterParams; // Set color filter to red, blue, or white. Toggle opa or xlu
|
||||
/* 0x114 */ u8 colorFilterTimer; // A non-zero value enables the color filter. Decrements automatically
|
||||
/* 0x115 */ u8 isDrawn; // Set to true if the actor is currently being drawn. Always stays false for lens actors
|
||||
/* 0x116 */ u8 dropFlag; // Configures what item is dropped by the actor from `Item_DropCollectibleRandom`
|
||||
/* 0x117 */ u8 naviEnemyId; // Sets what 0600 dialog to display when talking to navi. Default 0xFF
|
||||
/* 0x118 */ struct Actor* parent; // Usage is actor specific. Set if actor is spawned via `Actor_SpawnAsChild`
|
||||
/* 0x11C */ struct Actor* child; // Usage is actor specific. Set if actor is spawned via `Actor_SpawnAsChild`
|
||||
/* 0x120 */ struct Actor* prev; // Previous actor of this category
|
||||
/* 0x124 */ struct Actor* next; // Next actor of this category
|
||||
/* 0x128 */ ActorFunc init; // Initialization Routine. Called by `Actor_Init` or `Actor_UpdateAll`
|
||||
/* 0x12C */ ActorFunc destroy; // Destruction Routine. Called by `Actor_Destroy`
|
||||
/* 0x130 */ ActorFunc update; // Update Routine. Called by `Actor_UpdateAll`
|
||||
/* 0x134 */ ActorFunc draw; // Draw Routine. Called by `Actor_Draw`
|
||||
/* 0x138 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor
|
||||
/* 0x13C */ char dbgPad[0x10]; // Padding that only exists in the debug rom
|
||||
/* 0x13C */ char dbgPad[0x10]; // Padding that only exists in the debug rom
|
||||
} Actor; // size = 0x14C
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ FOOT_LEFT,
|
||||
/* 1 */ FOOT_RIGHT
|
||||
} ActorFootIndex;
|
||||
|
||||
/*
|
||||
BgCheckFlags WIP documentation:
|
||||
& 0x001 : Standing on the ground
|
||||
& 0x002 : Has touched the ground (only active for 1 frame)
|
||||
& 0x004 : Has left the ground (only active for 1 frame)
|
||||
& 0x008 : Touching a wall
|
||||
& 0x010 : Touching a ceiling
|
||||
& 0x020 : On or below water surface
|
||||
& 0x040 : Has touched water (actor is responsible for unsetting this the frame it touches the water)
|
||||
& 0x080 : Similar to & 0x1 but with no velocity check and is cleared every frame
|
||||
& 0x100 : Crushed between a floor and ceiling (triggers a void for player)
|
||||
& 0x200 : Unknown (only set/used by player so far)
|
||||
*/
|
||||
|
||||
/*
|
||||
colorFilterParams WIP documentation
|
||||
& 0x8000 : white
|
||||
& 0x4000 : red
|
||||
if neither of the above are set : blue
|
||||
|
||||
(& 0x1F00 >> 5) | 7 : color intensity
|
||||
0x2000 : translucent, else opaque
|
||||
*/
|
||||
|
||||
typedef struct DynaPolyActor {
|
||||
/* 0x000 */ struct Actor actor;
|
||||
|
@ -264,19 +289,19 @@ typedef struct EnAObj {
|
|||
} EnAObj; // size = 0x1C8
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ ACTORTYPE_SWITCH,
|
||||
/* 0x01 */ ACTORTYPE_BG,
|
||||
/* 0x02 */ ACTORTYPE_PLAYER,
|
||||
/* 0x03 */ ACTORTYPE_EXPLOSIVES,
|
||||
/* 0x04 */ ACTORTYPE_NPC,
|
||||
/* 0x05 */ ACTORTYPE_ENEMY,
|
||||
/* 0x06 */ ACTORTYPE_PROP,
|
||||
/* 0x07 */ ACTORTYPE_ITEMACTION,
|
||||
/* 0x08 */ ACTORTYPE_MISC,
|
||||
/* 0x09 */ ACTORTYPE_BOSS,
|
||||
/* 0x0A */ ACTORTYPE_DOOR,
|
||||
/* 0x0B */ ACTORTYPE_CHEST
|
||||
} ActorType;
|
||||
/* 0x00 */ ACTORCAT_SWITCH,
|
||||
/* 0x01 */ ACTORCAT_BG,
|
||||
/* 0x02 */ ACTORCAT_PLAYER,
|
||||
/* 0x03 */ ACTORCAT_EXPLOSIVE,
|
||||
/* 0x04 */ ACTORCAT_NPC,
|
||||
/* 0x05 */ ACTORCAT_ENEMY,
|
||||
/* 0x06 */ ACTORCAT_PROP,
|
||||
/* 0x07 */ ACTORCAT_ITEMACTION,
|
||||
/* 0x08 */ ACTORCAT_MISC,
|
||||
/* 0x09 */ ACTORCAT_BOSS,
|
||||
/* 0x0A */ ACTORCAT_DOOR,
|
||||
/* 0x0B */ ACTORCAT_CHEST
|
||||
} ActorCategory;
|
||||
|
||||
typedef enum {
|
||||
/* 0x0000 */ ACTOR_PLAYER,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue