From 246b3e7fda329db8984fcb01e65d29985b0691f9 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Thu, 7 Dec 2023 17:56:08 -0500 Subject: [PATCH] Implement & link ac_t_npc_sao --- config/rel_slices.yml | 4 ++ include/ac_t_anrium1.h | 1 - include/ac_t_bag1.h | 1 - include/ac_t_bag2.h | 1 - include/ac_t_biscus1.h | 1 - include/ac_t_biscus2.h | 1 - include/ac_t_biscus3.h | 1 - include/ac_t_biscus4.h | 1 - include/ac_t_cobra1.h | 1 - include/ac_t_cracker.h | 1 - include/ac_t_flag.h | 2 - include/ac_t_hanabi.h | 1 - include/ac_t_hasu1.h | 1 - include/ac_t_hat1.h | 1 - include/ac_t_hat2.h | 1 - include/ac_t_hat3.h | 1 - include/ac_t_npc_sao.h | 18 +++++++ include/ac_t_pistol.h | 1 - include/ac_tools.h | 16 ++++--- include/m_actor.h | 2 +- rel/ac_t_anrium1.c | 10 ++-- rel/ac_t_bag1.c | 10 ++-- rel/ac_t_bag2.c | 10 ++-- rel/ac_t_biscus1.c | 10 ++-- rel/ac_t_biscus2.c | 10 ++-- rel/ac_t_biscus3.c | 10 ++-- rel/ac_t_biscus4.c | 10 ++-- rel/ac_t_cobra1.c | 10 ++-- rel/ac_t_cracker.c | 8 ++-- rel/ac_t_flag.c | 6 +-- rel/ac_t_hanabi.c | 8 ++-- rel/ac_t_hasu1.c | 10 ++-- rel/ac_t_hat1.c | 10 ++-- rel/ac_t_hat2.c | 10 ++-- rel/ac_t_hat3.c | 10 ++-- rel/ac_t_npc_sao.c | 105 +++++++++++++++++++++++++++++++++++++++++ rel/ac_t_pistol.c | 8 ++-- rel/ac_tools.c | 6 +-- 38 files changed, 215 insertions(+), 103 deletions(-) create mode 100644 rel/ac_t_npc_sao.c diff --git a/config/rel_slices.yml b/config/rel_slices.yml index 64ea0c4e..aecd51fb 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -452,6 +452,10 @@ ac_t_hat2.c: ac_t_hat3.c: .text: [0x804A8E98, 0x804A8FEC] .data: [0x8068ED70, 0x8068EDB0] +ac_t_npc_sao.c: + .text: [0x804A9348, 0x804A95F4] + .rodata: [0x80645EE0, 0x80645EF8] + .data: [0x8068EE58, 0x8068EE98] 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 fe9f746f..4443b369 100644 --- a/include/ac_t_anrium1.h +++ b/include/ac_t_anrium1.h @@ -14,7 +14,6 @@ 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; diff --git a/include/ac_t_bag1.h b/include/ac_t_bag1.h index 940e33c9..3ec83785 100644 --- a/include/ac_t_bag1.h +++ b/include/ac_t_bag1.h @@ -15,7 +15,6 @@ typedef void (*BAG1_PROC)(ACTOR*); typedef struct t_bag1_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; BAG1_PROC proc; int current_id; }BAG1_ACTOR; diff --git a/include/ac_t_bag2.h b/include/ac_t_bag2.h index 0d468ae7..8bba57e1 100644 --- a/include/ac_t_bag2.h +++ b/include/ac_t_bag2.h @@ -15,7 +15,6 @@ typedef void (*BAG2_PROC)(ACTOR*); typedef struct t_bag2_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; BAG2_PROC proc; int current_id; }BAG2_ACTOR; diff --git a/include/ac_t_biscus1.h b/include/ac_t_biscus1.h index 7a9e9dfe..f36eb80b 100644 --- a/include/ac_t_biscus1.h +++ b/include/ac_t_biscus1.h @@ -15,7 +15,6 @@ typedef void (*BISCUS1_PROC)(ACTOR*); typedef struct t_biscus1_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; BISCUS1_PROC proc; int current_id; }BISCUS1_ACTOR; diff --git a/include/ac_t_biscus2.h b/include/ac_t_biscus2.h index a5624cd0..a74837bf 100644 --- a/include/ac_t_biscus2.h +++ b/include/ac_t_biscus2.h @@ -15,7 +15,6 @@ typedef void (*BISCUS2_PROC)(ACTOR*); typedef struct t_biscus2_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; BISCUS2_PROC proc; int current_id; }BISCUS2_ACTOR; diff --git a/include/ac_t_biscus3.h b/include/ac_t_biscus3.h index 16201c8b..b39ea872 100644 --- a/include/ac_t_biscus3.h +++ b/include/ac_t_biscus3.h @@ -15,7 +15,6 @@ typedef void (*BISCUS3_PROC)(ACTOR*); typedef struct t_biscus3_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; BISCUS3_PROC proc; int current_id; }BISCUS3_ACTOR; diff --git a/include/ac_t_biscus4.h b/include/ac_t_biscus4.h index 8a8c720d..fe8bc6df 100644 --- a/include/ac_t_biscus4.h +++ b/include/ac_t_biscus4.h @@ -16,7 +16,6 @@ typedef void (*BISCUS4_PROC)(ACTOR*); typedef struct t_biscus4_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; BISCUS4_PROC proc; int current_id; }BISCUS4_ACTOR; diff --git a/include/ac_t_cobra1.h b/include/ac_t_cobra1.h index 96bcb0fd..796193b9 100644 --- a/include/ac_t_cobra1.h +++ b/include/ac_t_cobra1.h @@ -16,7 +16,6 @@ typedef void (*COBRA1_PROC)(ACTOR*); typedef struct t_cobra1_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; COBRA1_PROC proc; int current_id; }COBRA1_ACTOR; diff --git a/include/ac_t_cracker.h b/include/ac_t_cracker.h index 8f3a5b78..b5baaf37 100644 --- a/include/ac_t_cracker.h +++ b/include/ac_t_cracker.h @@ -15,7 +15,6 @@ typedef void (*CRACKER_PROC)(ACTOR*); typedef struct t_cracker_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; CRACKER_PROC proc; int current_id; }CRACKER_ACTOR; diff --git a/include/ac_t_flag.h b/include/ac_t_flag.h index 6cbf75c0..38773e7b 100644 --- a/include/ac_t_flag.h +++ b/include/ac_t_flag.h @@ -13,8 +13,6 @@ extern ACTOR_PROFILE T_Flag_Profile; typedef struct t_flag_s{ TOOLS_ACTOR tools_class; - u32 unk1C4; - u32 unk1C8; s16 angle; s16 addendedang; int unk1D0; diff --git a/include/ac_t_hanabi.h b/include/ac_t_hanabi.h index d59c03d3..c66aea02 100644 --- a/include/ac_t_hanabi.h +++ b/include/ac_t_hanabi.h @@ -15,7 +15,6 @@ typedef void (*HANABI_PROC)(ACTOR*); typedef struct t_hanabi_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; HANABI_PROC proc; int current_id; }HANABI_ACTOR; diff --git a/include/ac_t_hasu1.h b/include/ac_t_hasu1.h index d78b2b47..30feafa5 100644 --- a/include/ac_t_hasu1.h +++ b/include/ac_t_hasu1.h @@ -15,7 +15,6 @@ typedef void (*HASU1_PROC)(ACTOR*); typedef struct t_hasu1_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; HASU1_PROC proc; int current_id; }HASU1_ACTOR; diff --git a/include/ac_t_hat1.h b/include/ac_t_hat1.h index 61fe66c7..491611e8 100644 --- a/include/ac_t_hat1.h +++ b/include/ac_t_hat1.h @@ -15,7 +15,6 @@ typedef void (*HAT1_PROC)(ACTOR*); typedef struct t_hat1_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; HAT1_PROC proc; int current_id; }HAT1_ACTOR; diff --git a/include/ac_t_hat2.h b/include/ac_t_hat2.h index 7657c966..05f88eb9 100644 --- a/include/ac_t_hat2.h +++ b/include/ac_t_hat2.h @@ -15,7 +15,6 @@ typedef void (*HAT2_PROC)(ACTOR*); typedef struct t_hat2_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; HAT2_PROC proc; int current_id; }HAT2_ACTOR; diff --git a/include/ac_t_hat3.h b/include/ac_t_hat3.h index 01942bb6..9793de50 100644 --- a/include/ac_t_hat3.h +++ b/include/ac_t_hat3.h @@ -15,7 +15,6 @@ typedef void (*HAT3_PROC)(ACTOR*); typedef struct t_hat3_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; HAT3_PROC proc; int current_id; }HAT3_ACTOR; diff --git a/include/ac_t_npc_sao.h b/include/ac_t_npc_sao.h index 1017c501..36f455a8 100644 --- a/include/ac_t_npc_sao.h +++ b/include/ac_t_npc_sao.h @@ -3,11 +3,29 @@ #include "types.h" #include "m_actor.h" +#include "ac_tools.h" #ifdef __cplusplus extern "C" { #endif +typedef struct npc_sao_tool_s NPC_SAO_TOOL_ACTOR; +typedef void (*aTNS_ACTION_PROC)(NPC_SAO_TOOL_ACTOR*); + +struct npc_sao_tool_s { + TOOLS_ACTOR tool_class; + aTNS_ACTION_PROC action_proc; // 0x1cc + u8 action; // 0x1d0 + short rotation_y; // 0x1d2 + f32 pos_x; // 0x1d4 + f32 pos_y; // 0x1d8 + f32 pos_z; // 0x1dc +}; + +extern void aTNS_actor_ct(ACTOR* actorx, GAME* game); +extern void aTNS_actor_move(ACTOR* actorx, GAME* game); +extern void aTNS_actor_draw(ACTOR* actorx, GAME* game); + extern ACTOR_PROFILE T_NpcSao_Profile; #ifdef __cplusplus diff --git a/include/ac_t_pistol.h b/include/ac_t_pistol.h index f46b3f44..f50bf997 100644 --- a/include/ac_t_pistol.h +++ b/include/ac_t_pistol.h @@ -14,7 +14,6 @@ typedef void (*PISTOL_PROC)(ACTOR*); typedef struct t_pistol_s{ TOOLS_ACTOR tools_class; - u8 pad2[0x8]; PISTOL_PROC proc; int current_id; }PISTOL_ACTOR; diff --git a/include/ac_tools.h b/include/ac_tools.h index e29b2a18..a12ef03d 100644 --- a/include/ac_tools.h +++ b/include/ac_tools.h @@ -60,15 +60,17 @@ typedef enum { } ToolName; typedef struct tools_s{ - ACTOR actor_class; - ToolName tool_name; - MtxF matrix_work; - int enable; - int unk1BC; - int process_id; + /* 0x000 */ ACTOR actor_class; + /* 0x174 */ int tool_name; + /* 0x178 */ MtxF matrix_work; + /* 0x1B8 */ int init_matrix; + /* 0x1BC */ int unk1BC; + /* 0x1C0 */ int work0; + /* 0x1C4 */ int work1; + /* 0x1C8 */ int work2; }TOOLS_ACTOR; -typedef TOOLS_ACTOR* (*ToolBirthProc)(ToolName, int, TOOLS_ACTOR*, GAME_PLAY*, s16, int*); +typedef TOOLS_ACTOR* (*ToolBirthProc)(int, int, TOOLS_ACTOR*, GAME_PLAY*, s16, int*); typedef int (*ToolChgRequestModeProc)(ACTOR*, TOOLS_ACTOR*, int); typedef struct ToolClip { diff --git a/include/m_actor.h b/include/m_actor.h index 9f77ec32..5418d0ad 100644 --- a/include/m_actor.h +++ b/include/m_actor.h @@ -409,7 +409,7 @@ typedef enum bank_id { ACTOR_OBJ_BANK_367, ACTOR_OBJ_BANK_368, ACTOR_OBJ_BANK_369, - ACTOR_OBJ_BANK_370, + ACTOR_OBJ_BANK_NPC_SAO, ACTOR_OBJ_BANK_371, ACTOR_OBJ_BANK_372, ACTOR_OBJ_BANK_373, diff --git a/rel/ac_t_anrium1.c b/rel/ac_t_anrium1.c index eea48f70..a3638419 100644 --- a/rel/ac_t_anrium1.c +++ b/rel/ac_t_anrium1.c @@ -46,15 +46,15 @@ static void aTA1_setupAction(ACTOR*actor, int action){ anrium->proc = process[action]; anrium->current_id = action; - anrium->tools_class.process_id = action; + anrium->tools_class.work0 = 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); + if(anrium->tools_class.work0 != anrium->current_id){ + aTA1_setupAction(actor, anrium->tools_class.work0); } anrium->proc(actor); @@ -66,7 +66,7 @@ static void aTA1_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(anrium->tools_class.enable == 1){ + if(anrium->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTA1_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&anrium->tools_class.matrix_work); Matrix_Position_Zero(&anrium->tools_class.actor_class.world.position); - anrium->tools_class.enable = 0; + anrium->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_bag1.c b/rel/ac_t_bag1.c index 9b650b70..1aeba6b9 100644 --- a/rel/ac_t_bag1.c +++ b/rel/ac_t_bag1.c @@ -46,15 +46,15 @@ static void aTBG1_setupAction(ACTOR*actor, int action){ bag->proc = process[action]; bag->current_id = action; - bag->tools_class.process_id = action; + bag->tools_class.work0 = action; } static void aTBG1_actor_move(ACTOR* actor, GAME*){ BAG1_ACTOR* bag = (BAG1_ACTOR*)actor; - if(bag->tools_class.process_id != bag->current_id){ - aTBG1_setupAction(actor, bag->tools_class.process_id); + if(bag->tools_class.work0 != bag->current_id){ + aTBG1_setupAction(actor, bag->tools_class.work0); } bag->proc(actor); @@ -66,7 +66,7 @@ static void aTBG1_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(bag->tools_class.enable == 1){ + if(bag->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTBG1_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&bag->tools_class.matrix_work); Matrix_Position_Zero(&bag->tools_class.actor_class.world.position); - bag->tools_class.enable = 0; + bag->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_bag2.c b/rel/ac_t_bag2.c index 357a5382..37d01894 100644 --- a/rel/ac_t_bag2.c +++ b/rel/ac_t_bag2.c @@ -46,15 +46,15 @@ static void aTBG2_setupAction(ACTOR*actor, int action){ bag->proc = process[action]; bag->current_id = action; - bag->tools_class.process_id = action; + bag->tools_class.work0 = action; } static void aTBG2_actor_move(ACTOR* actor, GAME*){ BAG2_ACTOR* bag = (BAG2_ACTOR*)actor; - if(bag->tools_class.process_id != bag->current_id){ - aTBG2_setupAction(actor, bag->tools_class.process_id); + if(bag->tools_class.work0 != bag->current_id){ + aTBG2_setupAction(actor, bag->tools_class.work0); } bag->proc(actor); @@ -66,7 +66,7 @@ static void aTBG2_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(bag->tools_class.enable == 1){ + if(bag->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTBG2_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&bag->tools_class.matrix_work); Matrix_Position_Zero(&bag->tools_class.actor_class.world.position); - bag->tools_class.enable = 0; + bag->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_biscus1.c b/rel/ac_t_biscus1.c index a07ce983..d7dd4b79 100644 --- a/rel/ac_t_biscus1.c +++ b/rel/ac_t_biscus1.c @@ -46,15 +46,15 @@ static void aTB1_setupAction(ACTOR*actor, int action){ biscus->proc = process[action]; biscus->current_id = action; - biscus->tools_class.process_id = action; + biscus->tools_class.work0 = action; } static void aTB1_actor_move(ACTOR* actor, GAME*){ BISCUS1_ACTOR* biscus = (BISCUS1_ACTOR*)actor; - if(biscus->tools_class.process_id != biscus->current_id){ - aTB1_setupAction(actor, biscus->tools_class.process_id); + if(biscus->tools_class.work0 != biscus->current_id){ + aTB1_setupAction(actor, biscus->tools_class.work0); } biscus->proc(actor); @@ -66,7 +66,7 @@ static void aTB1_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(biscus->tools_class.enable == 1){ + if(biscus->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTB1_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&biscus->tools_class.matrix_work); Matrix_Position_Zero(&biscus->tools_class.actor_class.world.position); - biscus->tools_class.enable = 0; + biscus->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_biscus2.c b/rel/ac_t_biscus2.c index afdafa83..f3fd648a 100644 --- a/rel/ac_t_biscus2.c +++ b/rel/ac_t_biscus2.c @@ -46,15 +46,15 @@ static void aTB2_setupAction(ACTOR*actor, int action){ biscus->proc = process[action]; biscus->current_id = action; - biscus->tools_class.process_id = action; + biscus->tools_class.work0 = action; } static void aTB2_actor_move(ACTOR* actor, GAME*){ BISCUS2_ACTOR* biscus = (BISCUS2_ACTOR*)actor; - if(biscus->tools_class.process_id != biscus->current_id){ - aTB2_setupAction(actor, biscus->tools_class.process_id); + if(biscus->tools_class.work0 != biscus->current_id){ + aTB2_setupAction(actor, biscus->tools_class.work0); } biscus->proc(actor); @@ -66,7 +66,7 @@ static void aTB2_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(biscus->tools_class.enable == 1){ + if(biscus->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTB2_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&biscus->tools_class.matrix_work); Matrix_Position_Zero(&biscus->tools_class.actor_class.world.position); - biscus->tools_class.enable = 0; + biscus->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_biscus3.c b/rel/ac_t_biscus3.c index d9d87daa..6efc508f 100644 --- a/rel/ac_t_biscus3.c +++ b/rel/ac_t_biscus3.c @@ -46,15 +46,15 @@ static void aTB3_setupAction(ACTOR*actor, int action){ biscus->proc = process[action]; biscus->current_id = action; - biscus->tools_class.process_id = action; + biscus->tools_class.work0 = action; } static void aTB3_actor_move(ACTOR* actor, GAME*){ BISCUS3_ACTOR* biscus = (BISCUS3_ACTOR*)actor; - if(biscus->tools_class.process_id != biscus->current_id){ - aTB3_setupAction(actor, biscus->tools_class.process_id); + if(biscus->tools_class.work0 != biscus->current_id){ + aTB3_setupAction(actor, biscus->tools_class.work0); } biscus->proc(actor); @@ -66,7 +66,7 @@ static void aTB3_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(biscus->tools_class.enable == 1){ + if(biscus->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTB3_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&biscus->tools_class.matrix_work); Matrix_Position_Zero(&biscus->tools_class.actor_class.world.position); - biscus->tools_class.enable = 0; + biscus->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_biscus4.c b/rel/ac_t_biscus4.c index 373a8a3d..3515bb0b 100644 --- a/rel/ac_t_biscus4.c +++ b/rel/ac_t_biscus4.c @@ -46,15 +46,15 @@ static void aTB4_setupAction(ACTOR*actor, int action){ biscus->proc = process[action]; biscus->current_id = action; - biscus->tools_class.process_id = action; + biscus->tools_class.work0 = action; } static void aTB4_actor_move(ACTOR* actor, GAME*){ BISCUS4_ACTOR* biscus = (BISCUS4_ACTOR*)actor; - if(biscus->tools_class.process_id != biscus->current_id){ - aTB4_setupAction(actor, biscus->tools_class.process_id); + if(biscus->tools_class.work0 != biscus->current_id){ + aTB4_setupAction(actor, biscus->tools_class.work0); } biscus->proc(actor); @@ -66,7 +66,7 @@ static void aTB4_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(biscus->tools_class.enable == 1){ + if(biscus->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTB4_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&biscus->tools_class.matrix_work); Matrix_Position_Zero(&biscus->tools_class.actor_class.world.position); - biscus->tools_class.enable = 0; + biscus->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_cobra1.c b/rel/ac_t_cobra1.c index 6872859f..c360f1fc 100644 --- a/rel/ac_t_cobra1.c +++ b/rel/ac_t_cobra1.c @@ -46,15 +46,15 @@ static void aTCB1_setupAction(ACTOR*actor, int action){ cobra->proc = process[action]; cobra->current_id = action; - cobra->tools_class.process_id = action; + cobra->tools_class.work0 = action; } static void aTCB1_actor_move(ACTOR* actor, GAME*){ COBRA1_ACTOR* cobra = (COBRA1_ACTOR*)actor; - if(cobra->tools_class.process_id != cobra->current_id){ - aTCB1_setupAction(actor, cobra->tools_class.process_id); + if(cobra->tools_class.work0 != cobra->current_id){ + aTCB1_setupAction(actor, cobra->tools_class.work0); } cobra->proc(actor); @@ -66,7 +66,7 @@ static void aTCB1_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(cobra->tools_class.enable == 1){ + if(cobra->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTCB1_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&cobra->tools_class.matrix_work); Matrix_Position_Zero(&cobra->tools_class.actor_class.world.position); - cobra->tools_class.enable = 0; + cobra->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_cracker.c b/rel/ac_t_cracker.c index bef3ae4d..0966ecb1 100644 --- a/rel/ac_t_cracker.c +++ b/rel/ac_t_cracker.c @@ -69,7 +69,7 @@ static void aTCR_setupAction(ACTOR* actor, int idx){ cracker->proc = process[idx]; cracker->current_id = idx; - cracker->tools_class.process_id = idx; + cracker->tools_class.work0 = idx; scale = start_scale[idx]; cracker->tools_class.actor_class.scale.x = scale; @@ -81,7 +81,7 @@ static void aTCR_setupAction(ACTOR* actor, int idx){ static void aTCR_actor_move(ACTOR* actor, GAME* game){ CRACKER_ACTOR* cracker = (CRACKER_ACTOR*)actor; - int t = cracker->tools_class.process_id; + int t = cracker->tools_class.work0; if(t!= cracker->current_id){ aTCR_setupAction(actor, t); } @@ -96,10 +96,10 @@ static void aTCR_actor_draw(ACTOR* actor, GAME* game){ OPEN_DISP(graph); - if(cracker->tools_class.enable == 1){ + if(cracker->tools_class.init_matrix == 1){ Matrix_put(&cracker->tools_class.matrix_work); Matrix_Position_Zero(&cracker->tools_class.actor_class.world.position); - cracker->tools_class.enable = 0; + cracker->tools_class.init_matrix = 0; } else{ Matrix_translate(cracker->tools_class.actor_class.world.position.x, cracker->tools_class.actor_class.world.position.y, diff --git a/rel/ac_t_flag.c b/rel/ac_t_flag.c index f43be835..0c55870d 100644 --- a/rel/ac_t_flag.c +++ b/rel/ac_t_flag.c @@ -60,7 +60,7 @@ static void aTFL_make_vtx(Vtx* v, ACTOR* actor){ fact = 0; - if(tools->enable == 1){ + if(tools->init_matrix == 1){ Matrix_put(&flag->tools_class.matrix_work); Matrix_translate(0.0f,0.0f,48.0999984741f,1); Matrix_Position_Zero(&pos); @@ -114,10 +114,10 @@ static void aTFL_actor_draw(ACTOR* actor, GAME* game){ buf = tol_hata_01_v; } - if(tools->enable == 1){ + if(tools->init_matrix == 1){ Matrix_put(&flag->tools_class.matrix_work); Matrix_Position_Zero(&actor->world.position); - tools->enable = 0; + tools->init_matrix = 0; } else{ Matrix_translate(actor->world.position.x, actor->world.position.y, diff --git a/rel/ac_t_hanabi.c b/rel/ac_t_hanabi.c index b05306ff..6baaa9b3 100644 --- a/rel/ac_t_hanabi.c +++ b/rel/ac_t_hanabi.c @@ -73,7 +73,7 @@ static void aTHB_setupAction(ACTOR* actor, int idx){ hanabi->proc = process[idx]; hanabi->current_id = idx; - hanabi->tools_class.process_id = idx; + hanabi->tools_class.work0 = idx; scale = start_scale[idx]; hanabi->tools_class.actor_class.scale.x = scale; @@ -85,7 +85,7 @@ static void aTHB_setupAction(ACTOR* actor, int idx){ static void aTHB_actor_move(ACTOR* actor, GAME* game){ HANABI_ACTOR* hanabi = (HANABI_ACTOR*)actor; - int t = hanabi->tools_class.process_id; + int t = hanabi->tools_class.work0; if(t!= hanabi->current_id){ aTHB_setupAction(actor, t); } @@ -100,10 +100,10 @@ static void aTHB_actor_draw(ACTOR* actor, GAME* game){ OPEN_DISP(graph); - if(hanabi->tools_class.enable == 1){ + if(hanabi->tools_class.init_matrix == 1){ Matrix_put(&hanabi->tools_class.matrix_work); Matrix_Position_Zero(&hanabi->tools_class.actor_class.world.position); - hanabi->tools_class.enable = 0; + hanabi->tools_class.init_matrix = 0; } else{ Matrix_translate(hanabi->tools_class.actor_class.world.position.x, hanabi->tools_class.actor_class.world.position.y, diff --git a/rel/ac_t_hasu1.c b/rel/ac_t_hasu1.c index 64ba45ae..94931031 100644 --- a/rel/ac_t_hasu1.c +++ b/rel/ac_t_hasu1.c @@ -46,15 +46,15 @@ static void aTHS1_setupAction(ACTOR*actor, int action){ hasu->proc = process[action]; hasu->current_id = action; - hasu->tools_class.process_id = action; + hasu->tools_class.work0 = action; } static void aTHS1_actor_move(ACTOR* actor, GAME*){ HASU1_ACTOR* hasu = (HASU1_ACTOR*)actor; - if(hasu->tools_class.process_id != hasu->current_id){ - aTHS1_setupAction(actor, hasu->tools_class.process_id); + if(hasu->tools_class.work0 != hasu->current_id){ + aTHS1_setupAction(actor, hasu->tools_class.work0); } hasu->proc(actor); @@ -66,7 +66,7 @@ static void aTHS1_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(hasu->tools_class.enable == 1){ + if(hasu->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTHS1_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&hasu->tools_class.matrix_work); Matrix_Position_Zero(&hasu->tools_class.actor_class.world.position); - hasu->tools_class.enable = 0; + hasu->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_hat1.c b/rel/ac_t_hat1.c index dad77995..b0e808b2 100644 --- a/rel/ac_t_hat1.c +++ b/rel/ac_t_hat1.c @@ -46,15 +46,15 @@ static void aTHT1_setupAction(ACTOR*actor, int action){ hat->proc = process[action]; hat->current_id = action; - hat->tools_class.process_id = action; + hat->tools_class.work0 = action; } static void aTHT1_actor_move(ACTOR* actor, GAME*){ HAT1_ACTOR* hat = (HAT1_ACTOR*)actor; - if(hat->tools_class.process_id != hat->current_id){ - aTHT1_setupAction(actor, hat->tools_class.process_id); + if(hat->tools_class.work0 != hat->current_id){ + aTHT1_setupAction(actor, hat->tools_class.work0); } hat->proc(actor); @@ -66,7 +66,7 @@ static void aTHT1_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(hat->tools_class.enable == 1){ + if(hat->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTHT1_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&hat->tools_class.matrix_work); Matrix_Position_Zero(&hat->tools_class.actor_class.world.position); - hat->tools_class.enable = 0; + hat->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_hat2.c b/rel/ac_t_hat2.c index a894d9f4..f3b77d04 100644 --- a/rel/ac_t_hat2.c +++ b/rel/ac_t_hat2.c @@ -46,15 +46,15 @@ static void aTHT2_setupAction(ACTOR*actor, int action){ hat->proc = process[action]; hat->current_id = action; - hat->tools_class.process_id = action; + hat->tools_class.work0 = action; } static void aTHT2_actor_move(ACTOR* actor, GAME*){ HAT2_ACTOR* hat = (HAT2_ACTOR*)actor; - if(hat->tools_class.process_id != hat->current_id){ - aTHT2_setupAction(actor, hat->tools_class.process_id); + if(hat->tools_class.work0 != hat->current_id){ + aTHT2_setupAction(actor, hat->tools_class.work0); } hat->proc(actor); @@ -66,7 +66,7 @@ static void aTHT2_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(hat->tools_class.enable == 1){ + if(hat->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTHT2_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&hat->tools_class.matrix_work); Matrix_Position_Zero(&hat->tools_class.actor_class.world.position); - hat->tools_class.enable = 0; + hat->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_hat3.c b/rel/ac_t_hat3.c index a831535d..e89564a1 100644 --- a/rel/ac_t_hat3.c +++ b/rel/ac_t_hat3.c @@ -46,15 +46,15 @@ static void aTHT3_setupAction(ACTOR*actor, int action){ hat->proc = process[action]; hat->current_id = action; - hat->tools_class.process_id = action; + hat->tools_class.work0 = action; } static void aTHT3_actor_move(ACTOR* actor, GAME*){ HAT3_ACTOR* hat = (HAT3_ACTOR*)actor; - if(hat->tools_class.process_id != hat->current_id){ - aTHT3_setupAction(actor, hat->tools_class.process_id); + if(hat->tools_class.work0 != hat->current_id){ + aTHT3_setupAction(actor, hat->tools_class.work0); } hat->proc(actor); @@ -66,7 +66,7 @@ static void aTHT3_actor_draw(ACTOR* actor, GAME* game){ GRAPH* graph; Gfx* gfxp; - if(hat->tools_class.enable == 1){ + if(hat->tools_class.init_matrix == 1){ graph = game->graph; OPEN_DISP(graph); @@ -74,7 +74,7 @@ static void aTHT3_actor_draw(ACTOR* actor, GAME* game){ Matrix_put(&hat->tools_class.matrix_work); Matrix_Position_Zero(&hat->tools_class.actor_class.world.position); - hat->tools_class.enable = 0; + hat->tools_class.init_matrix = 0; _texture_z_light_fog_prim_npc(graph); diff --git a/rel/ac_t_npc_sao.c b/rel/ac_t_npc_sao.c new file mode 100644 index 00000000..fdcb800d --- /dev/null +++ b/rel/ac_t_npc_sao.c @@ -0,0 +1,105 @@ +#include "ac_t_npc_sao.h" + +#include "m_name_table.h" +#include "sys_matrix.h" + +static void aTNS_setupAction(ACTOR* actorx, u8 action); + +ACTOR_PROFILE T_NpcSao_Profile = { + mAc_PROFILE_T_NPCSAO, + ACTOR_PART_BG, + ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED, + EMPTY_NO, + ACTOR_OBJ_BANK_NPC_SAO, + sizeof(NPC_SAO_TOOL_ACTOR), + &aTNS_actor_ct, + NONE_ACTOR_PROC, + &aTNS_actor_move, + &aTNS_actor_draw, + NULL +}; + +extern void aTNS_actor_ct(ACTOR* actorx, GAME* game) { + aTNS_setupAction(actorx, 1); +} + +static void aTNS_destruct(NPC_SAO_TOOL_ACTOR* npc_sao) { + Actor_delete((ACTOR*)npc_sao); +} + +static void aTNS_setupAction(ACTOR* actorx, u8 action) { + NPC_SAO_TOOL_ACTOR* npc_sao = (NPC_SAO_TOOL_ACTOR*)actorx; + + static aTNS_ACTION_PROC process[] = { + (aTNS_ACTION_PROC)&none_proc1, + (aTNS_ACTION_PROC)&none_proc1, + (aTNS_ACTION_PROC)&none_proc1, + &aTNS_destruct, + (aTNS_ACTION_PROC)&none_proc1, + NULL + }; + + npc_sao->action_proc = process[action]; + npc_sao->action = action; + npc_sao->tool_class.work0 = action; +} + +extern void aTNS_actor_move(ACTOR* actorx, GAME* game) { + NPC_SAO_TOOL_ACTOR* npc_sao = (NPC_SAO_TOOL_ACTOR*)actorx; + s16 rotation_y; + ACTOR* parent_actor; + s16 parent_rotation_y; + int temp; + f32 pos_offset; + + if (npc_sao->tool_class.work0 != npc_sao->action) { + aTNS_setupAction(actorx, npc_sao->tool_class.work0); + } + + (npc_sao->action_proc)(npc_sao); + + parent_actor = actorx->parent_actor; + temp = npc_sao->rotation_y; + parent_rotation_y = parent_actor->shape_info.rotation.y; + rotation_y = temp + ((int)(fqrand() * 6.0f + 2.0f) * 256); + + npc_sao->pos_x = parent_actor->world.position.x + sin_s(parent_rotation_y) * 100.0f; + npc_sao->pos_y = parent_actor->world.position.y + -20.0f + sin_s(rotation_y) * 1.5f; + npc_sao->pos_z = parent_actor->world.position.z + cos_s(parent_rotation_y) * 100.0f; + + npc_sao->rotation_y = rotation_y; +} + +extern Gfx tol_npcsao_1_sao_model[]; +extern Gfx tol_npcsao_1_uki_model[]; + +extern void aTNS_actor_draw(ACTOR* actorx, GAME* game) { + NPC_SAO_TOOL_ACTOR* npc_sao = (NPC_SAO_TOOL_ACTOR*)actorx; + GRAPH* g = game->graph; + Gfx* gfx; + + if (npc_sao->tool_class.init_matrix == TRUE) { + Matrix_put(&npc_sao->tool_class.matrix_work); + Matrix_Position_Zero(&actorx->world.position); + npc_sao->tool_class.init_matrix = FALSE; + } + else { + Matrix_translate(actorx->world.position.x, actorx->world.position.y, actorx->world.position.z, FALSE); + Matrix_scale(0.01f, 0.01f, 0.01f, TRUE); + } + + _texture_z_light_fog_prim_npc(g); + + OPEN_DISP(g); + gfx = NOW_POLY_OPA_DISP; + + gSPMatrix(gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfx++, tol_npcsao_1_sao_model); + Matrix_translate(npc_sao->pos_x, npc_sao->pos_y, npc_sao->pos_z, FALSE); + Matrix_scale(0.01f, 0.01f, 0.01f, 1); + gSPMatrix(gfx++, _Matrix_to_Mtx_new(g), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfx++, tol_npcsao_1_uki_model); + + SET_POLY_OPA_DISP(gfx); + CLOSE_DISP(g); +} diff --git a/rel/ac_t_pistol.c b/rel/ac_t_pistol.c index 23da5485..7060be95 100644 --- a/rel/ac_t_pistol.c +++ b/rel/ac_t_pistol.c @@ -69,7 +69,7 @@ static void aTPT_setupAction(ACTOR* actor, int idx){ pistol->proc = process[idx]; pistol->current_id = idx; - pistol->tools_class.process_id = idx; + pistol->tools_class.work0 = idx; scale = start_scale[idx]; pistol->tools_class.actor_class.scale.x = scale; @@ -81,7 +81,7 @@ static void aTPT_setupAction(ACTOR* actor, int idx){ static void aTPT_actor_move(ACTOR* actor, GAME* game){ PISTOL_ACTOR* pistol = (PISTOL_ACTOR*)actor; - int t = pistol->tools_class.process_id; + int t = pistol->tools_class.work0; if(t!= pistol->current_id){ aTPT_setupAction(actor, t); } @@ -96,10 +96,10 @@ static void aTPT_actor_draw(ACTOR* actor, GAME* game){ OPEN_DISP(graph); - if(pistol->tools_class.enable == 1){ + if(pistol->tools_class.init_matrix == 1){ Matrix_put(&pistol->tools_class.matrix_work); Matrix_Position_Zero(&pistol->tools_class.actor_class.world.position); - pistol->tools_class.enable = 0; + pistol->tools_class.init_matrix = 0; } else{ Matrix_translate(pistol->tools_class.actor_class.world.position.x, pistol->tools_class.actor_class.world.position.y, diff --git a/rel/ac_tools.c b/rel/ac_tools.c index fad5fe61..5fcfb6d2 100644 --- a/rel/ac_tools.c +++ b/rel/ac_tools.c @@ -59,7 +59,7 @@ static void aTOL_check_data_bank(int id, ACTOR* actor){ } } -static TOOLS_ACTOR* aTOL_birth_proc(ToolName name, int id, TOOLS_ACTOR* tool, +static TOOLS_ACTOR* aTOL_birth_proc(int name, int id, TOOLS_ACTOR* tool, GAME_PLAY* play, s16 arg, int* arg5){ static s16 profile_table[] = { mAc_PROFILE_T_UMBRELLA, mAc_PROFILE_T_UMBRELLA, mAc_PROFILE_T_UMBRELLA, mAc_PROFILE_T_UMBRELLA, mAc_PROFILE_T_UMBRELLA, @@ -86,7 +86,7 @@ static TOOLS_ACTOR* aTOL_birth_proc(ToolName name, int id, TOOLS_ACTOR* tool, profile_table[name], 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, 0, arg, -1); if(child != NULL){ - child->process_id = id; + child->work0 = id; child->tool_name = name; } @@ -103,7 +103,7 @@ static int aTOL_chg_request_mode_proc(ACTOR* actor ,TOOLS_ACTOR* tool, int id){ return 0; } - tool->process_id = id; + tool->work0 = id; return 1; }