From 4600cba63a7c93c49c3de4f392b80ad2889364f0 Mon Sep 17 00:00:00 2001 From: Prakxo Date: Mon, 18 Sep 2023 17:40:46 +0200 Subject: [PATCH] link anrium1 --- config/rel_slices.yml | 3 ++ include/ac_t_anrium1.h | 11 +++++- rel/ac_t_anrium1.c | 90 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 rel/ac_t_anrium1.c diff --git a/config/rel_slices.yml b/config/rel_slices.yml index 32d8c0eb..2aa3a2b9 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -303,6 +303,9 @@ ac_set_ovl_insect.c: .rodata: [0x80644E00, 0x80644E28] .data: [0x8068CDE8, 0x8068E3C0] .bss: [0x812FD048, 0x812FD270] +ac_t_anrium1.c: + .text: [0x804A7750, 0x804A78A4] + .data: [0x8068E9C8, 0x8068EA08] ac_t_pistol.c: .text: [0x804A95F4, 0x804A9858] .rodata: [0x80645EF8, 0x80645F00] diff --git a/include/ac_t_anrium1.h b/include/ac_t_anrium1.h index 7bf43d38..fe9f746f 100644 --- a/include/ac_t_anrium1.h +++ b/include/ac_t_anrium1.h @@ -2,7 +2,7 @@ #define AC_T_ANRIUM1_H #include "types.h" -#include "m_actor.h" +#include "ac_tools.h" #ifdef __cplusplus extern "C" { @@ -10,6 +10,15 @@ extern "C" { extern ACTOR_PROFILE T_Anrium1_Profile; +typedef void (*ANRIUM1_PROC)(ACTOR*); + +typedef struct t_anrium_s{ + TOOLS_ACTOR tools_class; + u8 pad2[0x8]; + ANRIUM1_PROC proc; + int current_id; +}ANRIUM1_ACTOR; + #ifdef __cplusplus } #endif diff --git a/rel/ac_t_anrium1.c b/rel/ac_t_anrium1.c new file mode 100644 index 00000000..ebe710e4 --- /dev/null +++ b/rel/ac_t_anrium1.c @@ -0,0 +1,90 @@ +#include "ac_t_anrium1.h" + +#include "m_name_table.h" +#include "sys_matrix.h" +#include "m_lib.h" +#include "m_rcp.h" + + +static void aTA1_actor_ct(ACTOR* actor, GAME*); +static void aTA1_actor_move(ACTOR* actor, GAME*); +static void aTA1_actor_draw(ACTOR* actor, GAME*); +static void aTA1_setupAction(ACTOR*, int); + +ACTOR_PROFILE T_Anrium1_Profile = { + mAc_PROFILE_T_ANRIUM1, + ACTOR_PART_BG, + ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED, + EMPTY_NO, + ACTOR_OBJ_BANK_16, + sizeof(ANRIUM1_ACTOR), + &aTA1_actor_ct, + NONE_ACTOR_PROC, + &aTA1_actor_move, + &aTA1_actor_draw, + NULL +}; + +extern Gfx crw_anrium1_body_model[]; + +static void aTA1_actor_ct(ACTOR* actor, GAME*){ + + aTA1_setupAction(actor,4); +} + +static void aTA1_destruct(ACTOR* actor){ + + Actor_delete(actor); +} + + +static void aTA1_setupAction(ACTOR*actor, int action){ + ANRIUM1_ACTOR* anrium = (ANRIUM1_ACTOR*)actor; + static ANRIUM1_PROC process[] = { + (ANRIUM1_PROC)none_proc1,(ANRIUM1_PROC)none_proc1,(ANRIUM1_PROC)none_proc1,aTA1_destruct,(ANRIUM1_PROC)none_proc1,NULL + }; + + anrium->proc = process[action]; + anrium->current_id = action; + anrium->tools_class.process_id = action; + +} + +static void aTA1_actor_move(ACTOR* actor, GAME*){ + ANRIUM1_ACTOR* anrium = (ANRIUM1_ACTOR*)actor; + + if(anrium->tools_class.process_id != anrium->current_id){ + aTA1_setupAction(actor, anrium->tools_class.process_id); + } + + anrium->proc(actor); +} + +static void aTA1_actor_draw(ACTOR* actor, GAME* game){ + ANRIUM1_ACTOR* anrium = (ANRIUM1_ACTOR*)actor; + + GRAPH* graph; + Gfx* gfxp; + + if(anrium->tools_class.enable == 1){ + graph = game->graph; + + OPEN_DISP(graph); + + Matrix_put(&anrium->tools_class.matrix_work); + Matrix_Position_Zero(&anrium->tools_class.actor_class.world.position); + + anrium->tools_class.enable = 0; + + _texture_z_light_fog_prim_npc(graph); + + gfxp = NOW_POLY_OPA_DISP; + gSPMatrix(gfxp++, _Matrix_to_Mtx_new(graph),G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfxp++, crw_anrium1_body_model); + SET_POLY_OPA_DISP(gfxp); + + CLOSE_DISP(graph); + } + + +} \ No newline at end of file