From f0b01c8eef186862c0de2378279509458efd4fe0 Mon Sep 17 00:00:00 2001 From: Prakxo Date: Wed, 21 Feb 2024 00:35:27 +0100 Subject: [PATCH] link ac_fallSESW.c --- config/rel_slices.yml | 4 ++ include/ac_fallSESW.h | 4 +- src/ac_fallSESW.c | 35 ++++++++++++++++ src/ac_fallSESW_draw.c_inc | 84 ++++++++++++++++++++++++++++++++++++++ src/ac_fallSESW_move.c_inc | 9 ++++ 5 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 src/ac_fallSESW.c create mode 100644 src/ac_fallSESW_draw.c_inc create mode 100644 src/ac_fallSESW_move.c_inc diff --git a/config/rel_slices.yml b/config/rel_slices.yml index 3f1063b4..802a4cef 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -693,6 +693,10 @@ ac_fallS.c: .text: [0x805AECE8, 0x805AEF84] .rodata: [0x8064A808, 0x8064A830] .data: [0x806C5120, 0x806C5148] +ac_fallSESW.c: + .text: [0x805AEF84, 0x805AF278] + .rodata: [0x8064A830, 0x8064A858] + .data: [0x806C5148, 0x806C51B0] ac_kago.c: .text: [0x805B1A08, 0x805B1D50] .data: [0x806C5750, 0x806C57A8] diff --git a/include/ac_fallSESW.h b/include/ac_fallSESW.h index 5300a108..a441e7f2 100644 --- a/include/ac_fallSESW.h +++ b/include/ac_fallSESW.h @@ -7,9 +7,9 @@ extern "C" { #endif -typedef struct actor_falls_south_east_west{ +typedef struct actor_falls_south_east_south_west{ STRUCTURE_ACTOR structure_class; -}FALLSEW_ACTOR; +}FALLSESW_ACTOR; extern ACTOR_PROFILE FallSESW_Profile; diff --git a/src/ac_fallSESW.c b/src/ac_fallSESW.c new file mode 100644 index 00000000..1e66c038 --- /dev/null +++ b/src/ac_fallSESW.c @@ -0,0 +1,35 @@ +#include "ac_fallSESW.h" +#include "m_name_table.h" +#include "evw_anime.h" +#include "m_common_data.h" +#include "m_lib.h" +#include "audio.h" +#include "sys_math3d.h" +#include "sys_matrix.h" + +extern Gfx obj_fallSESW_model[]; +extern Gfx obj_fallSE_rainbowT_model[]; +extern EVW_ANIME_DATA obj_fallSE_evw_anime; + + +static void aFLEW_actor_move(ACTOR* actor, GAME* game); +static void aFLEW_actor_draw(ACTOR* actor, GAME* game); + +ACTOR_PROFILE FallSESW_Profile = { + mAc_PROFILE_FALLSESW, + ACTOR_PART_ITEM, + ACTOR_STATE_TA_SET, + WATERFALL_EAST, + ACTOR_OBJ_BANK_KEEP, + sizeof(FALLSESW_ACTOR), + NONE_ACTOR_PROC, + NONE_ACTOR_PROC, + aFLEW_actor_move, + aFLEW_actor_draw, + NULL, +}; + +#include "../src/ac_fallSESW_move.c_inc" + +#include "../src/ac_fallSESW_draw.c_inc" + diff --git a/src/ac_fallSESW_draw.c_inc b/src/ac_fallSESW_draw.c_inc new file mode 100644 index 00000000..2ce0f3b0 --- /dev/null +++ b/src/ac_fallSESW_draw.c_inc @@ -0,0 +1,84 @@ + +void aFLEW_actor_draw(ACTOR* actor, GAME* game) { + static const xyz_t base_vec_z = {0.0f, 0.0f, 1.0f}; + static MtxF flip_mtx = {{ + {-1.0f, 0.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 1.0f, 0.0f}, + {0.0f, 0.0f, 0.0f, 1.0f}, + }}; + GAME_PLAY* play = (GAME_PLAY*)game; + + GRAPH* graph = game->graph; + xyz_t bboard; + int isWest; + xyz_t l; + f32 vecLen; + s16 angle; + Gfx* gfx; + int a; + + isWest = actor->npc_id == WATERFALL_WEST; + + _texture_z_light_fog_prim_xlu(graph); + + if (isWest != FALSE) { + Matrix_mult(&flip_mtx, TRUE); + } + + OPEN_DISP(graph); + + { + Gfx* gfx; + gfx = NOW_POLY_XLU_DISP; + gSPMatrix(gfx++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + NOW_POLY_XLU_DISP = gfx; + } + Evw_Anime_Set(play, &obj_fallSE_evw_anime); + + gfx = NOW_POLY_XLU_DISP; + gSPDisplayList(gfx++, obj_fallSESW_model); + + if (Common_Get(rainbow_opacity) > 0.0f) { + a = (256.0f * Common_Get(rainbow_opacity)); + + if (a > 255) { + a = 255; + } + bboard.x = play->billboard_matrix.mf[2][0]; + bboard.y = play->billboard_matrix.mf[2][1]; + bboard.z = play->billboard_matrix.mf[2][2]; + + if (isWest != FALSE) { + bboard.x *= -1.0f; + } + + Math3DVectorProduct2Vec(&base_vec_z, &bboard, &l); + + vecLen = Math3DVecLength(&l); + + if (vecLen >= 0.0000001f) { + xyz_t_mult_v(&l, 1.0f / vecLen); + angle = + RAD2SHORTANGLE(facos(base_vec_z.z * bboard.z + ((base_vec_z.x * bboard.x) + base_vec_z.y * bboard.y))); + + Matrix_translate(actor->world.position.x, actor->world.position.y, actor->world.position.z, FALSE); + if (actor->npc_id == WATERFALL_WEST) { + Matrix_mult(&flip_mtx, TRUE); + } + Matrix_RotateVector(angle, &l, TRUE); + Matrix_RotateY(-0x2000, TRUE); + Matrix_scale(actor->scale.x, actor->scale.y, actor->scale.z, TRUE); + + gSPMatrix(gfx++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetRenderMode(gfx++, G_RM_FOG_SHADE_A, G_RM_XLU_SURF2); + gDPSetEnvColor(gfx++, 255, 255, 255, a); + gSPLoadGeometryMode(gfx++, G_SHADE | G_FOG | G_SHADING_SMOOTH); + gSPDisplayList(gfx++, obj_fallSE_rainbowT_model); + } + } + + NOW_POLY_XLU_DISP = gfx; + CLOSE_DISP(graph); +} \ No newline at end of file diff --git a/src/ac_fallSESW_move.c_inc b/src/ac_fallSESW_move.c_inc new file mode 100644 index 00000000..5cfa0239 --- /dev/null +++ b/src/ac_fallSESW_move.c_inc @@ -0,0 +1,9 @@ +void aFLEW_actor_move(ACTOR* actor, GAME*) { + xyz_t pos; + + xyz_t_move(&pos, &actor->world.position); + + pos.y += 40.0f; + + sAdo_OngenPos((u32)actor, 12, &pos); +} \ No newline at end of file