link ac_radio

This commit is contained in:
Prakxo
2023-10-26 18:18:36 +02:00
parent 378047741f
commit 75e3e98071
4 changed files with 162 additions and 0 deletions
+4
View File
@@ -487,6 +487,10 @@ ac_douzou.c:
.text: [0x805AD6D8, 0x805AE704]
.rodata: [0x8064A7C0, 0x8064A7E8]
.data: [0x806C4DF0, 0x806C5018]
ac_radio.c:
.text: [0x805B887C,0x805B8C7C]
.rodata: [0x8064AB58,0x8064AB68]
.data: [0x806C6558,0x806C65A0]
ac_structure.c:
.text: [0x805BCA00, 0x805BD06C]
.rodata: [0x8064AC30, 0x8064AC38]
+13
View File
@@ -10,6 +10,19 @@ extern "C" {
extern ACTOR_PROFILE Radio_Profile;
typedef struct radio_actor_s RADIO_ACTOR;
typedef void (*RADIO_PROC)(RADIO_ACTOR*, GAME_PLAY*);
struct radio_actor_s{
ACTOR actor_class;
u8 pad[0x2A0 - 0x174];
RADIO_PROC proc;
u8 pad2[0x2B4 - 0x2A4];
int current_action;
int next_action;
u8 pad3[0x2DC - 0x2BC];
};
#ifdef __cplusplus
}
#endif
+1
View File
@@ -1504,6 +1504,7 @@ extern mActor_name_t bg_item_fg_sub_dig2take_conv(mActor_name_t item);
#define DUMMY_HANIWA1 (DUMMY_HANIWA0 + 1)
#define DUMMY_HANIWA2 (DUMMY_HANIWA1 + 1)
#define DUMMY_HANIWA3 (DUMMY_HANIWA2 + 1)
#define DUMMY_RADIO 0xF109
#define DUMMY_DOUZOU 0xF11D
#define RSV_DOOR 0xFE1B
+144
View File
@@ -0,0 +1,144 @@
#include "ac_radio.h"
#include "m_rcp.h"
#include "sys_matrix.h"
#include "m_name_table.h"
#include "bg_item.h"
#include "m_player_lib.h"
#include "m_field_info.h"
#include "m_demo.h"
#include "m_common_data.h"
static void aRAD_actor_ct(ACTOR*, GAME*);
static void aRAD_actor_init(ACTOR*, GAME*);
static void aRAD_actor_draw(ACTOR*, GAME*);
ACTOR_PROFILE Radio_Profile = {
mAc_PROFILE_RADIO,
ACTOR_PART_ITEM,
ACTOR_STATE_TA_SET,
AEROBICS_RADIO,
ACTOR_OBJ_BANK_KEEP,
sizeof(RADIO_ACTOR),
aRAD_actor_ct,
NONE_ACTOR_PROC,
aRAD_actor_init,
aRAD_actor_draw,
NULL,
};
extern Vtx obj_e_radio_shadow_v[];
extern Gfx obj_e_radio_shadowT_model[];
u8 aRAD_shadow_vtx_fix_flg_table[] = {1,0,0,1,0,1,1,0};
bIT_ShadowData_c aRAD_shadow_data = {
8,
aRAD_shadow_vtx_fix_flg_table,
60.0f,
obj_e_radio_shadow_v,
obj_e_radio_shadowT_model,
};
extern Gfx radio_DL_model[];
static void aRAD_setup_action(RADIO_ACTOR*, int);
static void aRAD_set_bgOffset(RADIO_ACTOR*, int);
static void aRAD_actor_ct(ACTOR* actor, GAME* game){
RADIO_ACTOR* radio = (RADIO_ACTOR*)actor;
aRAD_setup_action(radio, 0);
radio->next_action = 0;
aRAD_set_bgOffset(radio, 1);
}
static void aRAD_set_bgOffset(RADIO_ACTOR* radio, int offs){
offs = offs == 0 ? 3 : 3;
mCoBG_SetPlussOffset(radio->actor_class.home.position, offs, 100);
}
static void aRAD_wait(RADIO_ACTOR* radio, GAME_PLAY* play){
xyz_t def = {2.0f, 0.0f, -10.0f};
xyz_t newPos;
if(radio->next_action >= 0x24){
radio->next_action = 0;
Matrix_push();
Matrix_translate(radio->actor_class.world.position.x,radio->actor_class.world.position.y, radio->actor_class.world.position.z, 0);
Matrix_Position(&def, &newPos);
Matrix_pull();
Common_Get(clip.effect_clip->effect_make_proc)(32, newPos, 1, 0x6000, &play->game, AEROBICS_RADIO, 1,0);
}
radio->next_action++;
}
static void aRAD_setup_action(RADIO_ACTOR* radio, int action){
static RADIO_PROC proc[] = {aRAD_wait};
radio->proc = proc[action];
radio->current_action = action;
}
static void aRAD_actor_move(ACTOR* actor, GAME* game){
GAME_PLAY* play = (GAME_PLAY*)game;
RADIO_ACTOR* radio = (RADIO_ACTOR*)actor;
PLAYER_ACTOR* player;
int rbx;
int rbz;
int pbx;
int pbz;
player = GET_PLAYER_ACTOR(play);
mFI_Wpos2BlockNum(&rbx,&rbz, radio->actor_class.world.position);
mFI_Wpos2BlockNum(&pbx,&pbz, player->actor_class.world.position);
if(!mDemo_Check(mDemo_TYPE_SCROLL, &player->actor_class) && !mDemo_Check(mDemo_TYPE_SCROLL2, &player->actor_class)
&& !mDemo_Check(mDemo_TYPE_SCROLL3, &player->actor_class) && ((rbx != pbx) || (rbz != pbz))){
Actor_delete(&radio->actor_class);
}
else{
radio->proc(radio, play);
}
}
static void aRAD_actor_init(ACTOR* actor, GAME* game){
RADIO_ACTOR* radio = (RADIO_ACTOR*)actor;
xyz_t pos = radio->actor_class.home.position;
mFI_SetFG_common(DUMMY_RADIO, pos, 0);
aRAD_actor_move(actor, game);
radio->actor_class.mv_proc = aRAD_actor_move;
}
static void aRAD_actor_draw(ACTOR* actor, GAME* game){
RADIO_ACTOR* radio = (RADIO_ACTOR*)actor;
Mtx* cur;
GRAPH* graph = game->graph;
u16* pal;
Gfx* gfx;
OPEN_DISP(graph);
pal = Common_Get(clip.structure_clip)->get_pal_segment_proc(aSTR_PAL_RADIO);
cur = _Matrix_to_Mtx_new(graph);
if(cur != NULL){
_texture_z_light_fog_prim_npc(graph);
gfx = NOW_POLY_OPA_DISP;
gSPSegment(gfx++, 0x8, pal);
gSPMatrix(gfx++, cur,G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfx++,radio_DL_model);
SET_POLY_OPA_DISP(gfx);
Common_Get(clip.bg_item_clip)->draw_shadow_proc(game, &aRAD_shadow_data, 0);
}
CLOSE_DISP(graph);
}