link ac_t_pistol

This commit is contained in:
Prakxo
2023-08-08 18:07:43 +02:00
parent a029940357
commit 448a42c252
6 changed files with 146 additions and 1 deletions
+4
View File
@@ -263,6 +263,10 @@ ac_set_ovl_insect.c:
.rodata: [0x80644E00, 0x80644E28]
.data: [0x8068CDE8, 0x8068E3C0]
.bss: [0x812FD048, 0x812FD270]
ac_t_pistol.c:
.text: [0x804A95F4, 0x804A9858]
.rodata: [0x80645EF8, 0x80645F00]
.data: [0x8068EE98, 0x8068EEF8]
ac_train_door.c:
.text: [0x804AC2D8, 0x804AC510]
.rodata: [0x80645F98, 0x80645FA8]
+16
View File
@@ -3,11 +3,27 @@
#include "types.h"
#include "m_actor.h"
#include "libultra/ultratypes.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*PISTOL_PROC)(ACTOR*);
typedef struct t_pistol_s{
ACTOR actor_class;
int unk174;
MtxF matrix_work;
int enable;
int unk1BC;
int process_id;
u8 pad2[0x8];
PISTOL_PROC proc;
int current_id;
}PISTOL_ACTOR;
extern ACTOR_PROFILE T_Pistol_Profile;
#ifdef __cplusplus
+2
View File
@@ -33,8 +33,10 @@ 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_7 7
#define ACTOR_OBJ_BANK_10 10
#define ACTOR_OBJ_BANK_11 11
#define ACTOR_OBJ_BANK_12 12
#define ACTOR_OBJ_BANK_16 16
#define ACTOR_OBJ_BANK_41 41
enum actor_part {
+1
View File
@@ -142,6 +142,7 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define GRASS_B (GRASS_A + 1)
#define GRASS_C (GRASS_B + 1)
#define BURIED_PITFALL0 0x002A
#define TREE_BEES 0x005E
+122
View File
@@ -0,0 +1,122 @@
#include "ac_t_pistol.h"
#include "m_name_table.h"
#include "sys_matrix.h"
#include "m_lib.h"
#include "m_rcp.h"
static void aTPT_actor_ct(ACTOR* actor, GAME* game);
static void aTPT_actor_move(ACTOR* actor, GAME* game);
static void aTPT_actor_draw(ACTOR* actor, GAME* game);
ACTOR_PROFILE T_Pistol_Profile = {
mAc_PROFILE_T_PISTOL,
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
sizeof(PISTOL_ACTOR),
&aTPT_actor_ct,
NONE_ACTOR_PROC,
&aTPT_actor_move,
&aTPT_actor_draw,
NULL
};
static void aTPT_setupAction(ACTOR* actor, int idx);
extern Gfx tol_kenjyu_1T_model[];
static void aTPT_actor_ct(ACTOR* actor, GAME* game){
aTPT_setupAction(actor, 1);
}
static void aTPT_calc_scale(ACTOR* actor, int idx){
static f32 aim[] = {1.0f, 0.0f};
f32 pistol_scale = actor->scale.x;
chase_f(&pistol_scale, aim[idx],0.05f);
actor->scale.x = pistol_scale;
actor->scale.y = pistol_scale;
actor->scale.z = pistol_scale;
}
static void aTPT_takeout(ACTOR* actor){
aTPT_calc_scale(actor, 0);
}
static void aTPT_putaway(ACTOR* actor){
aTPT_calc_scale(actor, 1);
}
static void aTPT_destruct(ACTOR* actor){
Actor_delete(actor);
}
static void aTPT_setupAction(ACTOR* actor, int idx){
PISTOL_ACTOR* pistol = (PISTOL_ACTOR*)actor;
static PISTOL_PROC process[] = {(PISTOL_PROC)none_proc1, aTPT_takeout,aTPT_putaway,aTPT_destruct,
(PISTOL_PROC)none_proc1,NULL};
static f32 start_scale[] = {0.0f, 0.0f, 1.0f,1.0f,1.0f,0.0f,0.0f};
f32 scale;
pistol->proc = process[idx];
pistol->current_id = idx;
pistol->process_id = idx;
scale = start_scale[idx];
pistol->actor_class.scale.x = scale;
pistol->actor_class.scale.y = scale;
pistol->actor_class.scale.z = scale;
}
static void aTPT_actor_move(ACTOR* actor, GAME* game){
PISTOL_ACTOR* pistol = (PISTOL_ACTOR*)actor;
int t = pistol->process_id;
if(t!= pistol->current_id){
aTPT_setupAction(actor, t);
}
pistol->proc(actor);
}
static void aTPT_actor_draw(ACTOR* actor, GAME* game){
PISTOL_ACTOR* pistol = (PISTOL_ACTOR*)actor;
GRAPH* graph = game->graph;
Gfx* gfxp;
OPEN_DISP(graph);
if(pistol->enable == 1){
Matrix_put(&pistol->matrix_work);
Matrix_Position_Zero(&pistol->actor_class.world.position);
pistol->enable = 0;
}
else{
Matrix_translate(pistol->actor_class.world.position.x, pistol->actor_class.world.position.y,
pistol->actor_class.world.position.z, FALSE);
Matrix_scale(0.01f, 0.01f, 0.01f, TRUE);
}
Matrix_scale(pistol->actor_class.scale.x, pistol->actor_class.scale.y, pistol->actor_class.scale.z, TRUE);
_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++, tol_kenjyu_1T_model);
SET_POLY_OPA_DISP(gfxp);
CLOSE_DISP(graph);
}
+1 -1
View File
@@ -15,7 +15,7 @@ static void aTR0_actor_draw(ACTOR* actor, GAME* game);
ACTOR_PROFILE Train0_Profile = {
mAc_PROFILE_TRAIN0,
ACTOR_PART_ITEM,
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | 1 << 11 | ACTOR_STATE_NO_MOVE_WHILE_CULLED, //figure out flag 0x800
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_TA_SET | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
TRAIN0,
ACTOR_OBJ_BANK_3,
sizeof(TRAIN0_ACTOR),