Implement & partial match m_actor.c

This commit is contained in:
Cuyler36
2023-07-17 07:30:57 -04:00
parent c4f22ded37
commit e729e9dd81
35 changed files with 1228 additions and 110 deletions
+26 -1
View File
@@ -4,6 +4,8 @@
#include "types.h"
#include "m_actor.h"
#include "m_play.h"
#include "ac_npc_h.h"
#include "m_actor_dlftbls.h"
#ifdef __cplusplus
extern "C" {
@@ -11,11 +13,34 @@ extern "C" {
typedef struct ac_npc_clip_s aNPC_Clip_c;
typedef struct npc_draw_data_s {
s16 model_bank;
s16 texture_bank;
u8 _04[0x68]; // TODO
} aNPC_draw_data_c;
typedef int (*aNPC_SETUP_ACTOR_PROC)(GAME_PLAY*, mActor_name_t, s8, int, s16, int, int, int, int);
typedef void (*aNPC_DMA_DRAW_DATA_PROC)(aNPC_draw_data_c*, mActor_name_t);
typedef void (*aNPC_FREE_OVERLAY_AREA_PROC)(ACTOR_DLFTBL*);
typedef ACTOR* (*aNPC_GET_ACTOR_AREA_PROC)(size_t, const char*, int);
typedef void (*aNPC_FREE_ACTOR_AREA_PROC)(ACTOR*);
struct ac_npc_clip_s {
aNPC_SETUP_ACTOR_PROC setupActor_proc;
void* _004[(0x12C - 0x004) / sizeof(void*)];
void* _004;
aNPC_FREE_OVERLAY_AREA_PROC free_overlay_area_proc;
aNPC_GET_ACTOR_AREA_PROC get_actor_area_proc;
aNPC_FREE_ACTOR_AREA_PROC free_actor_area_proc;
aNPC_DMA_DRAW_DATA_PROC dma_draw_data_proc;
void* _018[(0x12C - 0x018) / sizeof(void*)];
};
struct npc_actor_s {
ACTOR actor_class;
// TODO: finish
u8 _174[0x718 - 0x174];
int texture_bank_idx; // TEMP: this is part of draw struct
u8 _71C[0x9D8 - 0x71C];
};
extern ACTOR_PROFILE Npc_Profile;
+16
View File
@@ -0,0 +1,16 @@
#ifndef AC_NPC_H_H
#define AC_NPC_H_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct npc_actor_s NPC_ACTOR;
#ifdef __cplusplus
}
#endif
#endif
-1
View File
@@ -223,7 +223,6 @@ typedef struct actor_overlay_info_s {
int used;
} aSTR_Overlay_info_c;
// TODO: finish clip
typedef struct actor_structure_clip_s {
aSTR_SETUP_ACTOR_PROC setup_actor_proc;
aSTR_GET_OVERLAY_AREA_PROC get_overlay_area_proc;
+19 -9
View File
@@ -17,10 +17,16 @@ extern "C" {
typedef void (*mActor_proc)(ACTOR*, GAME*);
#define NONE_ACTOR_PROC ((mActor_proc)&none_proc1)
#define mAc_MAX_ACTORS 200
#define ACTOR_STATE_NONE 0
#define ACTOR_STATE_NO_MOVE_WHILE_CULLED (1 << 4)
#define ACTOR_STATE_NO_DRAW_WHILE_CULLED (1 << 5)
#define ACTOR_STATE_11 (1 << 11)
#define ACTOR_STATE_NO_CULL (1 << 6)
#define ACTOR_STATE_INVISIBLE (1 << 7)
#define ACTOR_STATE_TA_SET (1 << 11)
#define ACTOR_STATE_LIGHTING (1 << 22) // does lighting NOT affect this actor?
#define ACTOR_STATE_24 (1 << 24)
#define ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES (1 << 29)
#define ACTOR_OBJ_BANK_NONE 0
@@ -34,8 +40,8 @@ enum actor_part {
ACTOR_PART_FG,
ACTOR_PART_ITEM,
ACTOR_PART_PLAYER,
ACTOR_PART_3, /* Thought this was for NPCs but maybe not? */
ACTOR_PART_NPC,
ACTOR_PART_4, /* TODO: figure this one out */
ACTOR_PART_BG,
ACTOR_PART_EFFECT,
ACTOR_PART_CONTROL,
@@ -340,16 +346,13 @@ struct actor_s {
/* 0x008 */ s8 block_x;
/* 0x009 */ s8 block_z;
/* 0x00A */ s16 move_actor_list_idx; /* used in aBC_setupCommonMvActor */
/* 0x00C */ xyz_t home_position; /* actor 'home' pos */
/* 0x018 */ s_xyz home_rotation; /* actor 'home' rotation */
/* 0x00C */ PositionAngle home; /* Home position & rotation */
/* 0x020 */ u32 state_bitfield; /* bitfield of current actor state */
/* 0x024 */ s16 actor_specific; /* actor specific temp data */
/* 0x026 */ s16 data_bank_id; /* data bank id actor is in */
/* 0x028 */ xyz_t world_position;
/* 0x034 */ s_xyz world_rotation;
/* 0x028 */ PositionAngle world; /* World position & rotation */
/* 0x03C */ xyz_t last_world_position; /* previous actor world position */
/* 0x048 */ xyz_t eye_position; /* actor "eyes" (head/lookat) world position */
/* 0x054 */ s_xyz eye_rotation; /* actor "eyes" (head/lookat) world rotation */
/* 0x048 */ PositionAngle eye; /* actor "eyes" (head/lookat) world position & rotation */
/* 0x05C */ xyz_t scale; /* actor size */
/* 0x068 */ xyz_t position_speed; /* actor movement velocity (see Actor_position_speed_set) */
/* 0x074 */ f32 speed; /* movement speed */
@@ -398,10 +401,17 @@ typedef struct actor_info_s {
Actor_list list[ACTOR_PART_NUM];
} Actor_info;
typedef struct actor_data_s {
s16 profile;
s_xyz position;
s_xyz rotation;
s16 arg;
} Actor_data;
extern void Actor_delete(ACTOR* actor);
extern ACTOR* Actor_info_fgName_search(Actor_info* actor_info, mActor_name_t fg_name, int part);
extern void Actor_world_to_eye(ACTOR* actor, f32 eye_height);
extern void Shape_Info_init(ACTOR* actor, f32 y_ofs, mActor_shadow_proc shadow_proc, f32 shadow_sizeX, f32 shadow_sizeZ);
extern void Shape_Info_init(ACTOR* actor, f32 ofs_y, mActor_shadow_proc shadow_proc, f32 shadow_size_x, f32 shadow_size_z);
extern void Actor_position_moveF(ACTOR* actor);
extern ACTOR* Actor_info_make_actor(Actor_info* actor_info, GAME* game, s16 profile, f32 x, f32 y, f32 z, short rot_x, short rot_y, short rot_z, s8 block_x, s8 block_z, s16 mvactor_list_no, mActor_name_t actor_name, s16 arg, s8 npc_idx, int data_bank);
extern void Setpos_HiliteReflect_init(xyz_t* wpos, GAME_PLAY* play);
+1
View File
@@ -8,6 +8,7 @@ extern "C" {
#endif
extern void mBI_ct();
extern void mBI_move(GAME_PLAY* play);
#ifdef __cplusplus
}
+2
View File
@@ -101,6 +101,8 @@ extern void ClObjPipe_set5(GAME_PLAY* play, ClObjPipe_c* pipe, ACTOR* owner, ClO
extern void CollisionCheck_Uty_ActorWorldPosSetPipeC(ACTOR* actor, ClObjPipe_c* col_pipe);
extern int CollisionCheck_setOC(GAME_PLAY* play, CollisionCheck_c* collision_check, ClObj_c* col_obj);
extern void CollisionCheck_Status_set3(Status_c* status, StatusData_c* data);
extern void CollisionCheck_Status_ct(Status_c* status);
extern void CollisionCheck_Status_Clear(Status_c* status);
#ifdef __cplusplus
}
+4 -2
View File
@@ -155,7 +155,9 @@ typedef struct common_data_s {
/* 0x02614D */ u8 transFadeDuration;
/* 0x02614E */ u8 transWipeSpeed;
/* 0x02614F */ u8 wipeType; /* maybe unused? */
/* 0x02614F */ u8 _26150[0x26164 - 0x26150];
/* 0x026150 */ s16 bg_item_type;
/* 0x026152 */ s16 bg_item_profile;
/* 0x026154 */ u8 _26154[0x26164 - 0x26154];
/* 0x026164 */ mNpc_NpcList_c npclist[ANIMAL_NUM_MAX];
/* 0x0264AC */ mNpc_NpcList_c unk_264AC; // fits exact size of npc list struct, seems unused
/* 0x0264E4 */ mNpc_NpcList_c island_npclist[1]; // TODO: define for island npc count
@@ -177,7 +179,7 @@ typedef struct common_data_s {
/* 0x028530 */ Door_data_c door_data; /* misc door data */
/* 0x028544 */ Door_data_c structure_exit_door_data; /* door data for when exiting a building */
/* 0x028558 */ u8 tmp1[0x028592 - 0x028558];
/* 0x028592 */ mActor_name_t demo_profiles[2];
/* 0x028592 */ s16 demo_profiles[mDemo_CLIP_TYPE_NUM - 1];
/* 0x028596 */ u8 _28596[0x285C0 - 0x28596];
/* 0x0285C0 */ s8 player_decoy_flag;
/* 0x0285C1 */ u8 _285C1[0x028838 - 0x0285C1];
+3
View File
@@ -148,6 +148,9 @@ extern mActor_name_t mFI_GetOtherFruit();
extern int mFI_Wpos2UtNum_inBlock(int* ut_x, int* ut_z, xyz_t wpos);
extern int mFI_GetItemNumInBlock(mActor_name_t item_no, mActor_name_t* block_items);
extern int mFI_BkNum2WposXZ(f32* wpos_x, f32* wpos_z, int block_x, int block_z);
extern void mFI_SetBearActor(GAME_PLAY* play, xyz_t wpos, int update_before_block_table);
extern void mFI_FieldMove(xyz_t player_wpos);
extern int mFI_search_unit_around(xyz_t* wpos, mActor_name_t item);
extern void mFI_PrintNowBGNum(gfxprint_t* gfxprint);
extern void mFI_PrintFgAttr(gfxprint_t* gfxprint);
+15 -5
View File
@@ -2,6 +2,7 @@
#define M_KANKYO_H
#include "types.h"
#include "m_lights.h"
#ifdef __cplusplus
extern "C" {
@@ -26,11 +27,20 @@ enum weather_intensity {
mEnv_WEATHER_INTENSITY_NUM,
};
typedef struct kankyo_s{
/*0x00 */ u8 pad[0x9A];
/*0x9A */ u8 ambientColor[3];
/*0x9E */ u8 pad2[0x32];
}Kankyo;
typedef void (*NATURE_PROC)(ACTOR*);
typedef struct nature_s {
NATURE_PROC proc;
void* arg;
} Nature;
typedef struct kankyo_s {
/* 0x00 */ Lights sun_light;
/* 0x0E */ u8 pad[0x9A - 0x0E];
/* 0x9A */ u8 ambientColor[3];
/* 0x9E */ u8 pad2[0xC8 - 0x9E];
/* 0xC8 */ Nature nature;
} Kankyo;
extern int mEnv_NowWeather();
+5
View File
@@ -46,6 +46,11 @@ typedef struct rgba_t { //can be put in other place
u8 r, g, b, a;
} rgba_t;
typedef struct {
xyz_t position;
s_xyz angle;
} PositionAngle;
extern void mem_copy(u8* dst, u8* src, size_t size);
extern void mem_clear(u8* dst, size_t size, u8 val);
extern int mem_cmp(u8* p1, u8* p2, size_t size);
+1 -1
View File
@@ -73,7 +73,7 @@ extern void LightsN_disp_BG(LightsN* lights, GRAPH* graph);
extern void LightsN_disp(LightsN* lights, GRAPH* graph);
extern void LightsN_list_check(LightsN* lights, LightNode* node, xyz_t* pos);
extern void Global_light_ct(Global_light* glight);
extern void Global_light_read(Global_light* glight, GRAPH* graph);
extern LightsN* Global_light_read(Global_light* glight, GRAPH* graph);
extern void Global_light_list_new(GAME_PLAY*, Global_light* glight, Lights* light);
extern void Global_light_list_delete(Global_light* glight, LightNode* light);
extern void Light_list_point_draw(GAME_PLAY* play);
+1
View File
@@ -207,6 +207,7 @@ extern u8 mNpc_GetPaperType();
extern void mMl_set_mail_name_npcinfo(Mail_nm_c* mail_name, AnmPersonalID_c* anm_pid);
extern int mNpc_ReceiveHPMail(Mail_c* hp_mail);
extern void mNpc_SendMailtoNpc(Mail_c* mail);
extern void mNpc_SetNpcinfo(ACTOR* actor, s8 npc_info_idx);
extern void mNpc_PrintRemoveInfo(gfxprint_t* gfxprint);
extern void mNpc_PrintFriendship_fdebug(gfxprint_t* gfxprint);
+18 -5
View File
@@ -20,11 +20,13 @@
extern "C" {
#endif
typedef int (*DRAW_CHK_PROC)(ACTOR*, GAME_PLAY*);
/* sizeof(struct game_play_s) == 0x2600 */
struct game_play_s {
/* 0x0000 */ GAME game;
// TODO: finish
/* 0x00E0 */ int _00E0;
/* 0x00E0 */ s16 scene_id;
/* 0x00E4 */ mFI_block_tbl_c block_table;
/* 0x00F4 */ mFI_block_tbl_c last_block_table;
/* 0x0104 */ u8 _0104[0x0110 - 0x0104];
@@ -38,10 +40,20 @@ struct game_play_s {
/* 0x1DEC */ Submenu submenu;
/* 0x1FA4 */ u8 _1FA4[0x2008 - 0x1FA4];
/* 0x2008 */ int next_scene_no;
/* 0x200C */ MtxF matrix;
/* 0x204C */ u8 _204C[0x2090 - 0x204C];
/* 0x200C */ MtxF projection_matrix;
/* 0x204C */ MtxF mtx_204C;
/* 0x208C */ int _208C;
/* 0x2090 */ u32 game_frame;
/* 0x2094 */ u8 _2094[0x20D0 - 0x2094];
/* 0x2094 */ u8 _2094;
/* 0x2095 */ u8 actor_data_num;
/* 0x2096 */ u8 ctrl_actor_data_num;
/* 0x2097 */ u8 obj_bank_data_num;
/* 0x2098 */ Actor_data* player_data;
/* 0x209C */ Actor_data* actor_data;
/* 0x20A0 */ s16* ctrl_actor_data;
/* 0x20A4 */ s16* obj_bank_data;
/* 0x20A8 */ int _20A8;
/* 0x20AC */ u8 _20AC[0x20D0 - 0x20AC];
/* 0x20D0 */ u8 fb_fade_type;
/* 0x20D1 */ u8 fb_wipe_type;
/* 0x20D2 */ u8 fb_mode;
@@ -49,7 +61,8 @@ struct game_play_s {
/* 0x20D8 */ fbdemo_wipe fbdemo_wipe;
/* 0x2318 */ fbdemo_fade color_fade;
/* 0x2328 */ CollisionCheck_c collision_check;
/* 0x23F8 */ u8 _23F8[0x2600 - 0x23F8];
/* 0x23F8 */ DRAW_CHK_PROC draw_chk_proc; // only used by mikanbox actor
/* 0x23FC */ u8 _23FC[0x2600 - 0x23FC];
};
+10 -2
View File
@@ -26,14 +26,22 @@ typedef struct object_bank_s {
s16 bank_id;
char* ram_start;
// TODO: others
u8 _08[0x5C - 8];
u8 _08[0x58 - 0x08];
s16 num_exist;
u8 _0x5A[0x5C - 0x5A];
} Object_Bank_c;
typedef struct object_exchange_s {
Object_Bank_c banks[mSc_OBJECT_BANK_NUM];
u8 _1928[0x1958-0x1928];
int _1928;
int _192C;
int exchange_id;
u8 _1934[0x1958-0x1934];
} Object_Exchange_c;
extern int mSc_bank_regist_check(Object_Exchange_c* exchange, s16 bank_id);
extern void mSc_regist_initial_exchange_bank(GAME_PLAY* play);
#ifdef __cplusplus
}
#endif
+2 -1
View File
@@ -2,12 +2,13 @@
#define SKIN_MATRIX_H
#include "libultra/ultratypes.h"
#include "libu64/u64types.h"
#ifdef __cplusplus
extern "C"{
#endif
void Skin_Matrix_PrjMulVector(MtxF*, Vec3f*, Vec3f*, f32*);
void Skin_Matrix_PrjMulVector(MtxF*, xyz_t*, xyz_t*, f32*);
void Skin_Matrix_MulMatrix(MtxF*, MtxF*, MtxF*);
void Skin_Matrix_SetScale(MtxF* , f32 , f32, f32);
void Skin_Matrix_SetTranslate(MtxF*, f32, f32, f32);