mirror of
https://github.com/zeldaret/af.git
synced 2026-09-26 13:33:16 -04:00
7c055329a7
* Rename symbols * First pass on struct Hanami_Npc1 * Actor funcs (ct, save, dt, init, draw) OK * Add trailing member to struct_809AEFA4 * Update Clip_unk_040_unk_E4 typedef to ActorFunc signature in order to unify *_actor_draw signatures * All talk functions and proc functions (minus aHM1_think_main_proc.s) OK * mFI_GetPuleIdx (func_8008930C_jp) OK; rename symbols (m_field_info) * aHM1_set_animation OK * aHM1_actor_move OK; update *_actor_move function signature to ActorFunc across project * aHM1_set_request_act, aHM1_check_moveRange OK * aHM1_check_inBlock OK; fix style in aHM1_check_moveRange * aHM1_turn, aHM1_walk, aHM1_set_spd_info OK * aHM1_think_init_proc OK * aHM1_revise_moveRange OK with fake (all functions matching) * Remove extraneous prototypes * Fix aHM1_think_main_proc signature * Import data * Fix aHM1_revise_moveRange signature * Standardize actor accesses * Improve define usage * Name blockX and blockZ members in Actor struct * Remove extraneous comments * mFI_BkNum2WposXZ OK (m_field_info) * Add defines to m_field_info * Formatting pass * Remove extraneous comments * Fix unk_18 type in struct_809AEFA4 --------- Co-authored-by: emilybrooks <emilybrooksemilybrooks@gmail.com>
275 lines
9.5 KiB
C
275 lines
9.5 KiB
C
#ifndef M_ACTOR_H
|
|
#define M_ACTOR_H
|
|
|
|
#include "ultra64.h"
|
|
#include "m_collision_obj.h"
|
|
#include "m_collision_bg.h"
|
|
#include "z64math.h"
|
|
#include "unk.h"
|
|
|
|
struct Actor;
|
|
struct Game_Play;
|
|
struct ActorEntry;
|
|
struct ActorOverlay;
|
|
struct LightsN;
|
|
struct GraphicsContext;
|
|
|
|
typedef enum AllocType {
|
|
/* 0 */ ALLOCTYPE_NORMAL,
|
|
/* 1 */ ALLOCTYPE_ABSOLUTE,
|
|
/* 2 */ ALLOCTYPE_PERMANENT
|
|
} AllocType;
|
|
|
|
typedef enum ActorPart {
|
|
/* 0 */ ACTOR_PART_0,
|
|
/* 1 */ ACTOR_PART_1,
|
|
/* 2 */ ACTOR_PART_PLAYER,
|
|
/* 3 */ ACTOR_PART_NPC,
|
|
/* 4 */ ACTOR_PART_4,
|
|
/* 5 */ ACTOR_PART_5,
|
|
/* 6 */ ACTOR_PART_6,
|
|
/* 7 */ ACTOR_PART_7,
|
|
/* 8 */ ACTOR_PART_MAX
|
|
} ActorPart;
|
|
|
|
typedef enum ActorFootIndex {
|
|
/* 0 */ FOOT_LEFT,
|
|
/* 1 */ FOOT_RIGHT,
|
|
/* 2 */ FOOT_MAX
|
|
} ActorFootIndex;
|
|
|
|
// TODO: figure out if those values make sense as an enum or if they should be changed to defines
|
|
typedef enum FgNameF000 {
|
|
/* 0x0 */ FGNAME_F000_0 = 0x0,
|
|
/* 0x0 */ FGNAME_F000_1 = 0x1,
|
|
/* 0x4 */ FGNAME_F000_4 = 0x4,
|
|
/* 0x5 */ FGNAME_F000_5 = 0x5,
|
|
/* 0x8 */ FGNAME_F000_8 = 0x8,
|
|
/* 0xD */ FGNAME_F000_D = 0xD,
|
|
/* 0xE */ FGNAME_F000_E
|
|
} FgNameF000;
|
|
|
|
typedef void (*ActorFunc)(struct Actor* this, struct Game_Play* game_play);
|
|
|
|
// a.k.a. ActorInit
|
|
typedef struct ActorProfile {
|
|
/* 0x00 */ s16 name;
|
|
/* 0x02 */ u8 part;
|
|
/* 0x04 */ u32 flags;
|
|
/* 0x08 */ u16 unk_08;
|
|
/* 0x0A */ s16 objectId;
|
|
/* 0x0C */ size_t instanceSize;
|
|
/* 0x10 */ ActorFunc ct;
|
|
/* 0x14 */ ActorFunc dt;
|
|
/* 0x18 */ ActorFunc update;
|
|
/* 0x1C */ ActorFunc draw;
|
|
/* 0x20 */ ActorFunc save;
|
|
} ActorProfile; // size = 0x24
|
|
|
|
typedef struct PosRot {
|
|
/* 0x00 */ xyz_t pos;
|
|
/* 0x0C */ s_xyz rot;
|
|
} PosRot; // size = 0x14
|
|
|
|
typedef void (*Shape_Info_unk_0C)(struct Actor*, struct LightsN*, struct Game_Play*);
|
|
|
|
typedef struct Shape_Info {
|
|
/* 0x00 */ s_xyz rot;
|
|
/* 0x08 */ f32 unk_08;
|
|
/* 0x0C */ Shape_Info_unk_0C unk_0C;
|
|
/* 0x10 */ f32 shadowSizeX;
|
|
/* 0x14 */ f32 shadowSizeZ;
|
|
/* 0x18 */ f32 shadowSizeRate;
|
|
/* 0x1C */ f32 shadowAlphaRate;
|
|
/* 0x20 */ u32 unk_20;
|
|
/* 0x24 */ xyz_t* shadowPosition; // maybe PosRot*
|
|
/* 0x28 */ s32 unk_28;
|
|
/* 0x2C */ u8 drawShadow;
|
|
/* 0x2D */ s8 unk_2D;
|
|
/* 0x2E */ u8 forceShadow;
|
|
/* 0x2F */ UNK_TYPE1 unk_2F[0x1];
|
|
/* 0x30 */ xyz_t feetPos[FOOT_MAX];
|
|
} Shape_Info; // size = 0x48
|
|
|
|
typedef struct Actor {
|
|
/* 0x000 */ s16 name; // id
|
|
/* 0x002 */ u8 part; // category
|
|
/* 0x003 */ u8 unk_003; // If set to 1 then fgdata will be restored independently of the actor's part
|
|
/* 0x004 */ u16 unk_004;
|
|
/* 0x006 */ u16 fgName;
|
|
/* 0x008 */ s8 blockX;
|
|
/* 0x009 */ s8 blockZ;
|
|
/* 0x00A */ s16 unk_00A;
|
|
/* 0x00C */ PosRot home;
|
|
/* 0x020 */ u32 flags;
|
|
/* 0x024 */ s16 params;
|
|
/* 0x026 */ s16 unk_026; // objBankIndex
|
|
/* 0x028 */ PosRot world;
|
|
/* 0x03C */ xyz_t prevPos;
|
|
/* 0x048 */ PosRot eye; // focus
|
|
/* 0x05C */ xyz_t scale;
|
|
/* 0x068 */ xyz_t velocity;
|
|
/* 0x074 */ f32 speed;
|
|
/* 0x078 */ f32 gravity;
|
|
/* 0x07C */ f32 terminalVelocity;
|
|
/* 0x080 */ UNK_TYPE1 unk_080[0x4];
|
|
/* 0x084 */ mCoBG_Check colCheck;
|
|
/* 0x0B4 */ u8 unk_0B4;
|
|
/* 0x0B5 */ u8 isDrawn;
|
|
/* 0x0B6 */ s16 yawTowardsPlayer;
|
|
/* 0x0B8 */ f32 xyzDistToPlayerSq;
|
|
/* 0x0BC */ f32 xzDistToPlayer;
|
|
/* 0x0C0 */ f32 playerHeightRel;
|
|
/* 0x0C4 */ CollisionCheck_Status colStatus; // made-up name
|
|
/* 0x0DC */ Shape_Info shape;
|
|
/* 0x124 */ xyz_t projectedPos;
|
|
/* 0x130 */ f32 projectedW;
|
|
/* 0x134 */ f32 uncullZoneScale;
|
|
/* 0x138 */ f32 uncullZoneDownward;
|
|
/* 0x13C */ f32 unk_13C;
|
|
/* 0x140 */ f32 unk_140;
|
|
/* 0x144 */ f32 unk_144;
|
|
/* 0x148 */ u8 unk_148;
|
|
/* 0x149 */ u8 unk_149;
|
|
/* 0x14A */ UNK_TYPE1 unk_14A[0x2];
|
|
/* 0x14C */ struct Actor* parent;
|
|
/* 0x150 */ struct Actor* child;
|
|
/* 0x154 */ struct Actor* prev;
|
|
/* 0x158 */ struct Actor* next;
|
|
/* 0x15C */ ActorFunc ct;
|
|
/* 0x160 */ ActorFunc dt;
|
|
/* 0x164 */ ActorFunc update;
|
|
/* 0x168 */ ActorFunc draw;
|
|
/* 0x16C */ ActorFunc save;
|
|
/* 0x170 */ struct ActorOverlay* overlayEntry;
|
|
} Actor; // size = 0x174
|
|
|
|
// Guessed from OoT's BodyBreak
|
|
typedef struct Part_Break {
|
|
/* 0x00 */ MtxF* matrices;
|
|
/* 0x04 */ s16* objectIds;
|
|
/* 0x08 */ s16 count;
|
|
/* 0x0C */ Gfx** dLists;
|
|
/* 0x10 */ s32 val;
|
|
/* 0x14 */ s32 prevLimbIndex;
|
|
} Part_Break; // size = 0x18
|
|
|
|
typedef struct ActorListEntry {
|
|
/* 0x0 */ s32 unk_0;
|
|
/* 0x4 */ Actor* head;
|
|
} ActorListEntry; // size = 0x8
|
|
|
|
// a.k.a. ActorContext
|
|
typedef struct ActorInfo {
|
|
/* 0x00 */ s32 unk_00;
|
|
/* 0x00 */ ActorListEntry actorLists[ACTOR_PART_MAX];
|
|
} ActorInfo; // size = 0x44
|
|
|
|
//
|
|
#define ACTOR_FLAG_1 (1 << 0)
|
|
//
|
|
#define ACTOR_FLAG_2 (1 << 1)
|
|
//
|
|
#define ACTOR_FLAG_4 (1 << 2)
|
|
//
|
|
#define ACTOR_FLAG_8 (1 << 3)
|
|
//
|
|
#define ACTOR_FLAG_10 (1 << 4)
|
|
//
|
|
#define ACTOR_FLAG_20 (1 << 5)
|
|
//
|
|
#define ACTOR_FLAG_40 (1 << 6)
|
|
//
|
|
#define ACTOR_FLAG_80 (1 << 7)
|
|
//
|
|
#define ACTOR_FLAG_100 (1 << 8)
|
|
//
|
|
#define ACTOR_FLAG_200 (1 << 9)
|
|
//
|
|
#define ACTOR_FLAG_400 (1 << 10)
|
|
//
|
|
#define ACTOR_FLAG_800 (1 << 11)
|
|
//
|
|
#define ACTOR_FLAG_1000 (1 << 12)
|
|
//
|
|
#define ACTOR_FLAG_2000 (1 << 13)
|
|
//
|
|
#define ACTOR_FLAG_4000 (1 << 14)
|
|
//
|
|
#define ACTOR_FLAG_8000 (1 << 15)
|
|
//
|
|
#define ACTOR_FLAG_10000 (1 << 16)
|
|
//
|
|
#define ACTOR_FLAG_20000 (1 << 17)
|
|
//
|
|
#define ACTOR_FLAG_40000 (1 << 18)
|
|
//
|
|
#define ACTOR_FLAG_80000 (1 << 19)
|
|
//
|
|
#define ACTOR_FLAG_100000 (1 << 20)
|
|
//
|
|
#define ACTOR_FLAG_200000 (1 << 21)
|
|
//
|
|
#define ACTOR_FLAG_400000 (1 << 22)
|
|
//
|
|
#define ACTOR_FLAG_800000 (1 << 23)
|
|
//
|
|
#define ACTOR_FLAG_1000000 (1 << 24)
|
|
//
|
|
#define ACTOR_FLAG_2000000 (1 << 25)
|
|
//
|
|
#define ACTOR_FLAG_4000000 (1 << 26)
|
|
//
|
|
#define ACTOR_FLAG_8000000 (1 << 27)
|
|
//
|
|
#define ACTOR_FLAG_10000000 (1 << 28)
|
|
//
|
|
#define ACTOR_FLAG_20000000 (1 << 29)
|
|
//
|
|
#define ACTOR_FLAG_40000000 (1 << 30)
|
|
//
|
|
#define ACTOR_FLAG_80000000 (1 << 31)
|
|
|
|
#define ACTOR_FGNAME_GET_F000(fgName) (((fgName) & 0xF000) >> 12)
|
|
|
|
void projection_pos_set(struct Game_Play* game_play, xyz_t* worldPos, xyz_t* projectedPos, f32* invW);
|
|
void Actor_world_to_eye(Actor* actor, f32 arg1);
|
|
void Actor_position_move(Actor* actor);
|
|
void Actor_position_speed_set(Actor* actor);
|
|
void Actor_position_moveF(Actor* actor);
|
|
s32 Actor_player_look_direction_check(Actor* actor, s16 maxAngleDiff, struct Game_Play* game_play);
|
|
void Actor_display_position_set(struct Game_Play* game_play, Actor* actor, s16* x, s16* y);
|
|
void Shape_Info_init(Actor* actor, f32 arg1, Shape_Info_unk_0C arg2, f32 arg3, f32 arg4);
|
|
void Actor_foot_shadow_pos_set(Actor* actor, s32 limbIndex, s32 leftFootIndex, xyz_t* leftFootPos, s32 rightFootIndex, xyz_t* rightFootPos);
|
|
void Actor_delete(Actor* actor);
|
|
s32 Actor_draw_actor_no_culling_check(Actor* actor);
|
|
s32 Actor_draw_actor_no_culling_check2(Actor* actor, xyz_t* arg1, f32 arg2);
|
|
void Actor_cull_check(Actor* actor);
|
|
void Actor_delete_check(Actor* actor, struct Game_Play* game_play);
|
|
void Actor_info_ct(struct Game_Play* game_play2, ActorInfo* actorInfo, struct ActorEntry* actorEntry);
|
|
void Actor_info_dt(ActorInfo* actorInfo, struct Game_Play* game_play);
|
|
void Actor_info_call_actor(struct Game_Play* game_play, ActorInfo* actorInfo);
|
|
void Actor_info_draw_actor(struct Game_Play* game_play, ActorInfo* actorInfo);
|
|
void Actor_free_overlay_area(struct ActorOverlay* overlayEntry);
|
|
void Actor_get_overlay_area(struct ActorOverlay* overlayEntry, const u8* arg1, size_t overlaySize);
|
|
void Actor_init_actor_class(Actor* actor, ActorProfile* profile, struct ActorOverlay* overlayEntry, struct Game_Play* game_play, s32 arg4, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 blockX, s8 blockZ, s16 argD, u16 fgName, s16 params);
|
|
Actor* Actor_info_make_actor(ActorInfo* actorInfo, struct Game_Play* game_play, s16 actorId, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 arg9, s8 argA, s16 argB, u16 fgName, s16 params, s8 argE, s32 argF);
|
|
Actor* Actor_info_make_child_actor(ActorInfo* actorInfo, Actor* arg1, struct Game_Play* game_play, s16 actorId, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s16 argA, u16 fgName, s16 params, s32 argD);
|
|
void restore_fgdata(Actor* actor, struct Game_Play* game_play);
|
|
void restore_fgdata_one(Actor* actor, struct Game_Play* game_play);
|
|
void restore_fgdata_all(struct Game_Play* game_play);
|
|
void Actor_info_save_actor(struct Game_Play* game_play);
|
|
Actor* Actor_info_delete(ActorInfo* actorInfo, Actor* actor, struct Game_Play* game_play);
|
|
Actor* Actor_info_name_search(ActorInfo* actorInfo, s16 name, ActorPart part);
|
|
Actor* Actor_info_fgName_search(ActorInfo* actorInfo, u16 fgName, ActorPart part);
|
|
void Part_Break_init(Part_Break* partBreak, s32 count, UNK_TYPE arg2);
|
|
Gfx* HiliteReflect_new(xyz_t* object, xyz_t* eye, xyz_t* lightDir, struct GraphicsContext* gfxCtx, Gfx* gfx, Hilite** hilite);
|
|
Hilite* HiliteReflect_init(xyz_t* object, xyz_t* eye, xyz_t* lightDir, struct GraphicsContext* gfxCtx);
|
|
Hilite* HiliteReflect_xlu_init(xyz_t* object, xyz_t* eye, xyz_t* lightDir, struct GraphicsContext* gfxCtx);
|
|
Hilite* HiliteReflect_light_init(xyz_t* object, xyz_t* eye, xyz_t* lightDir, struct GraphicsContext* gfxCtx);
|
|
Hilite* Setpos_HiliteReflect_init(xyz_t* object, struct Game_Play* game_play);
|
|
Hilite* Setpos_HiliteReflect_xlu_init(xyz_t* object, struct Game_Play* game_play);
|
|
Hilite* Setpos_HiliteReflect_light_init(xyz_t* object, struct Game_Play* game_play);
|
|
|
|
#endif
|