link ac_bags

This commit is contained in:
Prakxo
2023-09-18 18:11:35 +02:00
parent 4600cba63a
commit 212b5bba70
5 changed files with 206 additions and 0 deletions
+6
View File
@@ -306,6 +306,12 @@ ac_set_ovl_insect.c:
ac_t_anrium1.c:
.text: [0x804A7750, 0x804A78A4]
.data: [0x8068E9C8, 0x8068EA08]
ac_t_bag1.c:
.text: [0x804A78A4, 0x804A79F8]
.data: [0x8068EA08, 0x8068EA48]
ac_t_bag2.c:
.text: [0x804A79F8, 0x804A7B4C]
.data: [0x8068EA48, 0x8068EA88]
ac_t_pistol.c:
.text: [0x804A95F4, 0x804A9858]
.rodata: [0x80645EF8, 0x80645F00]
+10
View File
@@ -3,6 +3,7 @@
#include "types.h"
#include "m_actor.h"
#include "ac_tools.h"
#ifdef __cplusplus
extern "C" {
@@ -10,6 +11,15 @@ extern "C" {
extern ACTOR_PROFILE T_Bag1_Profile;
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;
#ifdef __cplusplus
}
#endif
+10
View File
@@ -3,6 +3,7 @@
#include "types.h"
#include "m_actor.h"
#include "ac_tools.h"
#ifdef __cplusplus
extern "C" {
@@ -10,6 +11,15 @@ extern "C" {
extern ACTOR_PROFILE T_Bag2_Profile;
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;
#ifdef __cplusplus
}
#endif
+90
View File
@@ -0,0 +1,90 @@
#include "ac_t_bag1.h"
#include "m_name_table.h"
#include "sys_matrix.h"
#include "m_lib.h"
#include "m_rcp.h"
static void aTBG1_actor_ct(ACTOR* actor, GAME*);
static void aTBG1_actor_move(ACTOR* actor, GAME*);
static void aTBG1_actor_draw(ACTOR* actor, GAME*);
static void aTBG1_setupAction(ACTOR*, int);
ACTOR_PROFILE T_Bag1_Profile = {
mAc_PROFILE_T_BAG1,
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
sizeof(BAG1_ACTOR),
&aTBG1_actor_ct,
NONE_ACTOR_PROC,
&aTBG1_actor_move,
&aTBG1_actor_draw,
NULL
};
extern Gfx crw_bag1_body_model[];
static void aTBG1_actor_ct(ACTOR* actor, GAME*){
aTBG1_setupAction(actor,4);
}
static void aTBG1_destruct(ACTOR* actor){
Actor_delete(actor);
}
static void aTBG1_setupAction(ACTOR*actor, int action){
BAG1_ACTOR* bag = (BAG1_ACTOR*)actor;
static BAG1_PROC process[] = {
(BAG1_PROC)none_proc1,(BAG1_PROC)none_proc1,(BAG1_PROC)none_proc1,aTBG1_destruct,(BAG1_PROC)none_proc1,NULL
};
bag->proc = process[action];
bag->current_id = action;
bag->tools_class.process_id = 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);
}
bag->proc(actor);
}
static void aTBG1_actor_draw(ACTOR* actor, GAME* game){
BAG1_ACTOR* bag = (BAG1_ACTOR*)actor;
GRAPH* graph;
Gfx* gfxp;
if(bag->tools_class.enable == 1){
graph = game->graph;
OPEN_DISP(graph);
Matrix_put(&bag->tools_class.matrix_work);
Matrix_Position_Zero(&bag->tools_class.actor_class.world.position);
bag->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_bag1_body_model);
SET_POLY_OPA_DISP(gfxp);
CLOSE_DISP(graph);
}
}
+90
View File
@@ -0,0 +1,90 @@
#include "ac_t_bag2.h"
#include "m_name_table.h"
#include "sys_matrix.h"
#include "m_lib.h"
#include "m_rcp.h"
static void aTBG2_actor_ct(ACTOR* actor, GAME*);
static void aTBG2_actor_move(ACTOR* actor, GAME*);
static void aTBG2_actor_draw(ACTOR* actor, GAME*);
static void aTBG2_setupAction(ACTOR*, int);
ACTOR_PROFILE T_Bag2_Profile = {
mAc_PROFILE_T_BAG2,
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
sizeof(BAG2_ACTOR),
&aTBG2_actor_ct,
NONE_ACTOR_PROC,
&aTBG2_actor_move,
&aTBG2_actor_draw,
NULL
};
extern Gfx crw_bag2_body_model[];
static void aTBG2_actor_ct(ACTOR* actor, GAME*){
aTBG2_setupAction(actor,4);
}
static void aTBG2_destruct(ACTOR* actor){
Actor_delete(actor);
}
static void aTBG2_setupAction(ACTOR*actor, int action){
BAG2_ACTOR* bag = (BAG2_ACTOR*)actor;
static BAG2_PROC process[] = {
(BAG2_PROC)none_proc1,(BAG2_PROC)none_proc1,(BAG2_PROC)none_proc1,aTBG2_destruct,(BAG2_PROC)none_proc1,NULL
};
bag->proc = process[action];
bag->current_id = action;
bag->tools_class.process_id = 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);
}
bag->proc(actor);
}
static void aTBG2_actor_draw(ACTOR* actor, GAME* game){
BAG2_ACTOR* bag = (BAG2_ACTOR*)actor;
GRAPH* graph;
Gfx* gfxp;
if(bag->tools_class.enable == 1){
graph = game->graph;
OPEN_DISP(graph);
Matrix_put(&bag->tools_class.matrix_work);
Matrix_Position_Zero(&bag->tools_class.actor_class.world.position);
bag->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_bag2_body_model);
SET_POLY_OPA_DISP(gfxp);
CLOSE_DISP(graph);
}
}