link flag

This commit is contained in:
Prakxo
2023-09-23 18:37:27 +02:00
parent 30039a8e1f
commit 0635b4ebd7
4 changed files with 171 additions and 0 deletions
+4
View File
@@ -331,6 +331,10 @@ ac_t_cracker.c:
.text: [0x804A81F0, 0x804A8454]
.rodata: [0x80645EA8, 0x80645EB0]
.data: [0x8068EBC8, 0x8068EC28]
ac_t_flag.c:
.text: [0x804A8454, 0x804A8834]
.rodata: [0x80645EB0, 0x80645EC8]
.data: [0x8068EC28, 0x8068EC50]
ac_t_pistol.c:
.text: [0x804A95F4, 0x804A9858]
.rodata: [0x80645EF8, 0x80645F00]
+12
View File
@@ -3,6 +3,7 @@
#include "types.h"
#include "m_actor.h"
#include "ac_tools.h"
#ifdef __cplusplus
extern "C" {
@@ -10,6 +11,17 @@ extern "C" {
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;
xyz_t work;
}FLAG_ACTOR;
#ifdef __cplusplus
}
#endif
+1
View File
@@ -33,6 +33,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_6 6
#define ACTOR_OBJ_BANK_7 7
#define ACTOR_OBJ_BANK_10 10
#define ACTOR_OBJ_BANK_11 11
+154
View File
@@ -0,0 +1,154 @@
#include "ac_t_flag.h"
#include "m_rcp.h"
#include "evw_anime.h"
#include "sys_matrix.h"
#include "m_name_table.h"
static void aTFL_actor_draw(ACTOR*, GAME*);
ACTOR_PROFILE T_Flag_Profile = {
mAc_PROFILE_T_FLAG,
ACTOR_PART_BG,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_6,
sizeof(FLAG_ACTOR),
NONE_ACTOR_PROC,
NONE_ACTOR_PROC,
NONE_ACTOR_PROC,
aTFL_actor_draw,
NULL,
};
extern Vtx tol_hata_01_v[15];
extern Gfx tol_hata_e_model[];
extern Gfx tol_hata_hataT_model[];
extern EVW_ANIME_DATA tol_hata_01_evw_anime[];
static void aTFL_calc_angl(s16* dst, s16 fact, s16* addend, s16 addval){
if(fact < *dst){
*addend -= 0x3C0;
if(*addend < -addval){
*addend = -addval;
}
}
else{
*addend += 0x1E0;
if(*addend > addval){
*addend = addval;
}
}
*dst += *addend;
}
static void aTFL_make_vtx(Vtx* v, ACTOR* actor){
FLAG_ACTOR* flag = (FLAG_ACTOR*)actor;
TOOLS_ACTOR* tools = (TOOLS_ACTOR*)actor;
xyz_t pos;
s16 fact;
s16 obx;
f32 sins;
s16 pre;
s16 t;
fact = 0;
if(tools->enable == 1){
Matrix_put(&flag->tools_class.matrix_work);
Matrix_translate(0.0f,0.0f,48.0999984741f,1);
Matrix_Position_Zero(&pos);
if(flag->unk1D0 == 0){
xyz_t_move(&flag->work, &pos);
flag->unk1D0 = 1;
}
else{
fact = atans_table( pos.y - flag->work.y, -(pos.x - flag->work.x));
xyz_t_move(&flag->work, &pos);
}
}
mem_copy((u8*)v, (u8*)tol_hata_01_v, sizeof(tol_hata_01_v));
aTFL_calc_angl(&flag->angle, fact, &flag->addendedang, 0x9C4);
obx = (v[9].v.ob[0] * cos_s(flag->angle));
sins = sin_s(flag->angle);
pre = v[9].v.ob[0];
v[9].v.ob[0] = obx;
t = pre * sins;
v[9].v.ob[1] = t;
v[12].v.ob[0] = obx;
v[12].v.ob[1] = t;
obx = (v[10].v.ob[0] * cos_s(flag->angle));
sins = sin_s(flag->angle);
pre = v[10].v.ob[0];
v[10].v.ob[0] = obx;
t = pre * sins;
v[10].v.ob[1] = t;
v[11].v.ob[0] = obx;
v[11].v.ob[1] = t;
}
static void aTFL_actor_draw(ACTOR* actor, GAME* game){
FLAG_ACTOR* flag = (FLAG_ACTOR*)actor;
TOOLS_ACTOR* tools = (TOOLS_ACTOR*)actor;
GAME_PLAY* play = (GAME_PLAY*)game;
GRAPH* graph = game->graph;
Vtx* buf;
buf = GRAPH_ALLOC_TYPE(graph, Vtx, 15);
if(buf != NULL){
aTFL_make_vtx(buf, &tools->actor_class);
}
else{
buf = tol_hata_01_v;
}
if(tools->enable == 1){
Matrix_put(&flag->tools_class.matrix_work);
Matrix_Position_Zero(&actor->world.position);
tools->enable = 0;
}
else{
Matrix_translate(actor->world.position.x, actor->world.position.y,
actor->world.position.z, FALSE);
Matrix_scale(0.01f, 0.01f, 0.01f, TRUE);
}
OPEN_DISP(graph);
{
Gfx* gfxp;
_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_hata_e_model);
SET_POLY_OPA_DISP(gfxp);
Evw_Anime_Set(play, tol_hata_01_evw_anime);
}
{
Gfx* gfxp;
_texture_z_light_fog_prim_xlu(graph);
gfxp = NOW_POLY_XLU_DISP;
gSPMatrix(gfxp++, _Matrix_to_Mtx_new(graph),G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(gfxp++, 0x0A, buf);
gSPDisplayList(gfxp++, tol_hata_hataT_model);
SET_POLY_XLU_DISP(gfxp);
}
CLOSE_DISP(graph);
}