Implement & link ac_sample.c

This commit is contained in:
Cuyler36
2023-06-22 13:19:42 -04:00
parent 70f8954c41
commit e208087de0
14 changed files with 383 additions and 14 deletions
+34
View File
@@ -0,0 +1,34 @@
#ifndef AC_SAMPLE_H
#define AC_SAMPLE_H
#include "types.h"
#include "m_actor.h"
#include "m_collision_obj.h"
#include "c_keyframe.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sample_actor_s {
ACTOR actor_class;
cKF_SkeletonInfo_R_c keyframe;
s_xyz work_area[8];
s_xyz morph_area[8];
ClObjPipe_c stand;
int main_action;
int draw_action;
char* obj_bank_ram_start; // maybe unused in AC? was used to exchange data on N64
} SAMPLE_ACTOR;
extern ACTOR_PROFILE Sample_Profile;
#ifdef __cplusplus
}
#endif
#endif
+1 -1
View File
@@ -93,7 +93,7 @@ extern f32 cKF_HermitCalc(f32 t, f32 tension, f32 p0, f32 p1, f32 m0, f32 m1);
extern void cKF_SkeletonInfo_subRotInterpolation(f32 t, s16* out, s16 rot1, s16 rot2);
extern void cKF_SkeletonInfo_R_ct(cKF_SkeletonInfo_R_c* keyframe, cKF_Skeleton_R_c* skeleton, cKF_Animation_R_c* animation, s_xyz* work_table, s_xyz* target_table);
extern void cKF_SkeletonInfo_R_dt();
extern void cKF_SkeletonInfo_R_dt(cKF_SkeletonInfo_R_c* keyframe);
extern void cKF_SkeletonInfo_R_init_standard_stop(cKF_SkeletonInfo_R_c* keyframe, cKF_Animation_R_c* animation, s_xyz* rotation_diff_table);
extern void cKF_SkeletonInfo_R_init_standard_stop_morph(cKF_SkeletonInfo_R_c* keyframe, cKF_Animation_R_c* animation, s_xyz* rotation_diff_table, f32 morph);
+2
View File
@@ -18,6 +18,7 @@ typedef void (*mActor_proc)(ACTOR*, GAME*);
#define ACTOR_OBJ_BANK_NONE 0
#define ACTOR_OBJ_BANK_3 3 /* TODO: rename, also likely an enum */
#define ACTOR_OBJ_BANK_12 12
enum actor_part {
ACTOR_PART_FG,
@@ -139,6 +140,7 @@ typedef struct actor_info_s {
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);
#ifdef __cplusplus
}
+84
View File
@@ -0,0 +1,84 @@
#ifndef M_COLLISION_OBJ_H
#define M_COLLISION_OBJ_H
#include "types.h"
#include "m_actor.h"
#include "sys_math3d.h"
#include "m_play_h.h"
#ifdef __cplusplus
extern "C" {
#endif
enum collision_type {
ClObj_TYPE_JNT_SPH,
ClObj_TYPE_PIPE,
ClObj_TYPE_TRIS,
ClObj_TYPE_NUM
};
typedef struct collision_obj_s {
ACTOR* owner_actor; // actor which owns this collision object
ACTOR* collided_actor; // actor which the owner collided with or NULL
u8 collision_flags0;
u8 collision_flags1;
u8 collision_type;
} ClObj_c;
typedef struct collision_elem_s {
u8 flags;
} ClObjElem_c;
typedef struct collision_pipe_attribute_s {
Math3D_pipe_c pipe;
} ClObjPipeAttr_c;
typedef struct collision_pipe_s {
ClObj_c collision_obj;
ClObjElem_c element;
ClObjPipeAttr_c attribute;
} ClObjPipe_c;
/* static data */
typedef struct collision_obj_data_s {
u8 collision_flags0;
u8 collision_flags1;
u8 type;
} ClObjData_c;
typedef struct collision_obj_elem_data_s {
u8 flags;
} ClObjElemData_c;
typedef struct collision_obj_pipe_attr_data_s {
Math3D_pipe_c pipe;
} ClObjPipeAttrData_c;
typedef struct collision_obj_pipe_data_s {
ClObjData_c collision_data;
ClObjElemData_c element_data;
ClObjPipeAttrData_c attribute_data;
} ClObjPipeData_c;
#define Cl_COLLIDER_NUM 50
typedef struct collision_check_s {
u16 flags;
int collider_num;
ClObj_c* collider_table[Cl_COLLIDER_NUM];
} CollisionCheck_c;
extern void ClObjPipe_ct(GAME_PLAY* play, ClObjPipe_c* pipe);
extern void ClObjPipe_dt(GAME_PLAY* play, ClObjPipe_c* pipe);
extern void ClObjPipe_set5(GAME_PLAY* play, ClObjPipe_c* pipe, ACTOR* owner, ClObjPipeData_c* data);
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);
#ifdef __cplusplus
}
#endif
#endif
+24
View File
@@ -0,0 +1,24 @@
#ifndef M_DEMO_H
#define M_DEMO_H
#include "types.h"
#include "m_actor_type.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*mDemo_REQUEST_PROC)(ACTOR*);
extern int mDemo_Request(int type, ACTOR* actor, mDemo_REQUEST_PROC request_proc);
extern void mDemo_Set_msg_num(int msg_num);
extern int mDemo_Check(int type, ACTOR* actor);
extern int mDemo_Check_DiffAngle_forTalk(s16 angle);
extern int mDemo_Check_ListenAble();
extern void mDemo_Set_ListenAble();
#ifdef __cplusplus
}
#endif
#endif
+6 -9
View File
@@ -9,19 +9,16 @@ extern "C" {
#endif
/* TODO: fill out message struct */
typedef struct message_window_s M_MSG_WINDOW;
typedef struct message_window_s mMsg_Window_c;
extern int mMsg_Get_Length_String(u8* buf, size_t buf_size);
extern M_MSG_WINDOW* mMsg_Get_base_window_p();
extern void mMsg_Set_free_str(M_MSG_WINDOW* msg, int free_str_no, u8* str, size_t str_size);
extern mMsg_Window_c* mMsg_Get_base_window_p();
extern void mMsg_Set_free_str(mMsg_Window_c* msg, int free_str_no, u8* str, int str_size);
extern void mMsg_debug_draw(gfxprint_t* gfxprint);
extern void mMsg_aram_init();
extern int mMsg_Check_MainHide(M_MSG_WINDOW* msg);
extern int mMsg_Check_MainHide(mMsg_Window_c* msg);
extern void mMsg_Set_item_str(mMsg_Window_c* msg_win, int str_no, u8* item_str, int str_len);
extern void mMsg_Set_mail_str(mMsg_Window_c* msg_win, int str_no, u8* str, int str_len);
#ifdef __cplusplus
}
+3
View File
@@ -472,6 +472,9 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define TRAIN0 0x580A
#define TRAIN1 0x580B
#define MISC_ACTOR_START 0x9000
#define MISC_ACTOR_SAMPLE MISC_ACTOR_START
#define SP_NPC_START 0xD000
#define SP_NPC_ARTIST (SP_NPC_START + 0) // D000
#define SP_NPC_BROKER (SP_NPC_START + 1) // D001
+6 -3
View File
@@ -10,7 +10,9 @@
#include "m_pause.h"
#include "m_field_info.h"
#include "m_fbdemo_wipe.h"
#include "m_collision_obj.h"
#include "m_play_h.h"
#include "m_scene.h"
#ifdef __cplusplus
extern "C" {
@@ -23,7 +25,8 @@ struct game_play_s {
/* 0x00E0 */ int _00E0;
/* 0x00E4 */ mFI_block_tbl_c block_table;
/* 0x00F4 */ mFI_block_tbl_c last_block_table;
/* 0x0104 */ u8 _0104[0x1A68 - 0x0104];
/* 0x0104 */ u8 _0104[0x0110 - 0x0104];
/* 0x0110 */ Object_Exchange_c object_exchange;
/* 0x1A68 */ View view;
/* 0x1B88 */ Camera2 camera;
/* 0x1CC0 */ u8 _1CC0[0x1DA0 - 0x1CC0];
@@ -38,10 +41,10 @@ struct game_play_s {
/* 0x20D1 */ u8 fb_wipe_type;
/* 0x20D2 */ u8 fb_mode;
/* 0x20D3 */ u8 fb_wipe_mode;
/* 0x20D4 */ //int _20D4;
/* 0x20D8 */ fbdemo_wipe fbdemo_wipe;
/* 0x2318 */ fbdemo_fade color_fade;
/* 0x2328 */ u8 _2328[0x2600 - 0x2328];
/* 0x2328 */ CollisionCheck_c collision_check;
/* 0x23F8 */ u8 _23F8[0x2600 - 0x23F8];
};
+1
View File
@@ -16,6 +16,7 @@ extern Gfx* gfx_tex_scroll2(Gfx** gfxpp, u32 x, u32 y, int width, int height);
extern void DisplayList_initialize(GRAPH* graph, u32 clear_r, u32 clear_g, u32 clear_b, GAME* game);
extern void fade_black_draw(Gfx** gfxpp, u32 alpha);
extern void rect_moji(GRAPH* graph);
extern void _texture_z_light_fog_prim(GRAPH* graph);
#ifdef __cplusplus
}
+14
View File
@@ -20,6 +20,20 @@ typedef struct door_data_s {
u8 pad[3]; // possibly necessary due to struct copy
} Door_data_c;
#define mSc_OBJECT_BANK_NUM 70
typedef struct object_bank_s {
s16 bank_id;
char* ram_start;
// TODO: others
u8 _08[0x5C - 8];
} Object_Bank_c;
typedef struct object_exchange_s {
Object_Bank_c banks[mSc_OBJECT_BANK_NUM];
u8 _1928[0x1958-0x1928];
} Object_Exchange_c;
#ifdef __cplusplus
}
#endif
+7
View File
@@ -8,6 +8,13 @@
extern "C" {
#endif
typedef struct math_3d_pipe_s {
s16 radius;
s16 height;
s16 offset;
s_xyz center;
} Math3D_pipe_c;
extern f32 Math3DVecLength(xyz_t* vec);
extern xyz_t ZeroVec;