diff --git a/config/rel_slices.yml b/config/rel_slices.yml index 237704cd..b66c851c 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -741,6 +741,9 @@ ac_tukimi.c: .text: [0x805C0CC8, 0x805C11A8] .rodata: [0x8064ADB0, 0x8064ADC0] .data: [0x806C7388, 0x806C7400] +ac_windmill.c: + .text: [0x805C1AB8, 0x805C1D34] + .data: [0x806C75D0, 0x806C76B8] ac_yatai.c: .text: [0x805C1D34, 0x805C217C] .rodata: [0x8064ADC0, 0x8064ADC8] diff --git a/include/m_name_table.h b/include/m_name_table.h index a6dfed79..3ff6b712 100644 --- a/include/m_name_table.h +++ b/include/m_name_table.h @@ -2702,6 +2702,7 @@ extern int mNT_check_unknown(mActor_name_t item_no); #define DUMMY_MIKUJI 0xF10D #define DUMMY_TAMA 0xF110 #define DUMMY_KOINOBORI 0xF114 +#define DUMMY_WINDMILL 0xF116 #define DUMMY_LOTUS 0xF11B #define DUMMY_DOUZOU 0xF11D #define DUMMY_NAMEPLATE 0xF11F diff --git a/src/ac_windmill.c b/src/ac_windmill.c new file mode 100644 index 00000000..7eaefad1 --- /dev/null +++ b/src/ac_windmill.c @@ -0,0 +1,41 @@ +#include "ac_windmill.h" + +#include "m_name_table.h" +#include "sys_matrix.h" +#include "m_lib.h" +#include "m_rcp.h" +#include "m_common_data.h" +#include "m_player_lib.h" + +static void aWIN_actor_dt(ACTOR* actor, GAME* game); +static void aWIN_actor_init(ACTOR* actor, GAME* game); +static void aWIN_actor_draw(ACTOR* actor, GAME* game); + +ACTOR_PROFILE Windmill_Profile = { + mAc_PROFILE_WINDMILL, + ACTOR_PART_ITEM, + ACTOR_STATE_NONE, + WINDMILL0, + ACTOR_OBJ_BANK_KEEP, + sizeof(STRUCTURE_ACTOR), + NONE_ACTOR_PROC, + &aWIN_actor_dt, + &aWIN_actor_init, + &aWIN_actor_draw, + NULL +}; + +u8 aWIN_shadow_vtx_fix_flg_table[] = { TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE }; + +static void aWIN_set_bgOffset(STRUCTURE_ACTOR* yatai, int idx); + +static void aWIN_actor_dt(ACTOR* actor, GAME* game) { + STRUCTURE_ACTOR* windmill = (STRUCTURE_ACTOR*)actor; + + aWIN_set_bgOffset(windmill, 0); + cKF_SkeletonInfo_R_dt(&windmill->keyframe); +} + +#include "../src/ac_windmill_move.c_inc" + +#include "../src/ac_windmill_draw.c_inc" diff --git a/src/ac_windmill_draw.c_inc b/src/ac_windmill_draw.c_inc new file mode 100644 index 00000000..0899ee1a --- /dev/null +++ b/src/ac_windmill_draw.c_inc @@ -0,0 +1,2 @@ +static void aWIN_actor_draw(ACTOR* actor, GAME* game) { +} diff --git a/src/ac_windmill_move.c_inc b/src/ac_windmill_move.c_inc new file mode 100644 index 00000000..1caf1f98 --- /dev/null +++ b/src/ac_windmill_move.c_inc @@ -0,0 +1,56 @@ +static void aWIN_set_bgOffset(STRUCTURE_ACTOR* windmill, int idx) { + static mCoBG_OffsetTable_c height_table_ct[9] = { + { 0x64, 12, 0, 12, 12, 12, 1 }, { 0x64, 12, 12, 12, 12, 12, 0 }, { 0x64, 12, 12, 12, 12, 0, 1 }, + { 0x64, 12, 12, 12, 12, 12, 0 }, { 0x64, 12, 12, 12, 12, 12, 0 }, { 0x64, 12, 12, 12, 12, 12, 0 }, + { 0x64, 12, 12, 0, 12, 12, 1 }, { 0x64, 12, 12, 12, 12, 12, 0 }, { 0x64, 12, 12, 12, 0, 12, 1 } + }; + + static mCoBG_OffsetTable_c height_table_dt[9] = { + { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 0, 0, 0, 0, 0, 0 }, + { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 0, 0, 0, 0, 0, 0 }, + { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 0, 0, 0, 0, 0, 0 }, { 0x64, 0, 0, 0, 0, 0, 0 } + }; + + static mCoBG_OffsetTable_c* height_table[2] = { height_table_dt, height_table_ct }; + + static f32 addX[3] = { -40.0f, 0.0f, 40.0f }; + static f32 addZ[3] = { -40.0f, 0.0f, 40.0f }; + + mCoBG_OffsetTable_c* offset; + int i; + xyz_t pos; + + offset = height_table[idx]; + for (i = 0; i < 3; i++) { + pos.z = windmill->actor_class.home.position.z + addZ[i]; + + pos.x = windmill->actor_class.home.position.x + addX[0]; + mCoBG_SetPluss5PointOffset_file(pos, offset[0], __FILE__, 109); + + pos.x = windmill->actor_class.home.position.x + addX[1]; + mCoBG_SetPluss5PointOffset_file(pos, offset[1], __FILE__, 113); + + pos.x = windmill->actor_class.home.position.x + addX[2]; + mCoBG_SetPluss5PointOffset_file(pos, offset[2], __FILE__, 117); + + offset += 3; + } +} + +static void aWIN_actor_move(ACTOR* actor, GAME* game) { + STRUCTURE_ACTOR* windmill = (STRUCTURE_ACTOR*)actor; + windmill->keyframe_state = cKF_SkeletonInfo_R_play(&windmill->keyframe); + (*windmill->action_proc)(windmill, (GAME_PLAY*)game); +} + +static void aWIN_actor_init(ACTOR* actor, GAME* game) { + STRUCTURE_ACTOR* windmill; + mActor_name_t windmill_actor_name; + + windmill = (STRUCTURE_ACTOR*)actor; + windmill_actor_name = windmill->arg0 + DUMMY_WINDMILL; + + mFI_SetFG_common(windmill_actor_name, actor->home.position, FALSE); + aWIN_actor_move(actor, game); + windmill->actor_class.mv_proc = aWIN_actor_move; +}