From 1b8ad8370c9174e24645e95be50d96b83ea82234 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Wed, 11 Jun 2025 17:47:02 -0400 Subject: [PATCH] Implement & link ac_npc_majin4 --- configure.py | 2 +- include/ac_npc_majin4.h | 18 +- include/audio_defs.h | 1 + src/actor/npc/ac_npc_majin4.c | 166 +++++++++++++++++ src/actor/npc/ac_npc_majin4_schedule.c_inc | 196 +++++++++++++++++++++ src/actor/npc/ac_npc_majin4_talk.c_inc | 65 +++++++ src/game/m_rcp.c | 18 +- 7 files changed, 455 insertions(+), 11 deletions(-) create mode 100644 src/actor/npc/ac_npc_majin4.c create mode 100644 src/actor/npc/ac_npc_majin4_schedule.c_inc create mode 100644 src/actor/npc/ac_npc_majin4_talk.c_inc diff --git a/configure.py b/configure.py index e49fa087..ebd728fe 100644 --- a/configure.py +++ b/configure.py @@ -1120,7 +1120,7 @@ config.libs = [ Object(Matching, "actor/npc/ac_npc_majin.c"), Object(Matching, "actor/npc/ac_npc_majin2.c"), Object(Matching, "actor/npc/ac_npc_majin3.c"), - Object(NonMatching, "actor/npc/ac_npc_majin4.c"), + Object(Matching, "actor/npc/ac_npc_majin4.c"), Object(Matching, "actor/npc/ac_npc_majin5.c"), Object(Matching, "actor/npc/ac_npc_mamedanuki.c"), Object(Matching, "actor/npc/ac_npc_mask_cat.c"), diff --git a/include/ac_npc_majin4.h b/include/ac_npc_majin4.h index 007b0246..f7fab3ae 100644 --- a/include/ac_npc_majin4.h +++ b/include/ac_npc_majin4.h @@ -3,11 +3,28 @@ #include "types.h" #include "m_actor.h" +#include "ac_npc.h" #ifdef __cplusplus extern "C" { #endif +typedef struct npc_majin4_actor_s NPC_MAJIN4_ACTOR; + +typedef void (*aMJN4_THINK_PROC)(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play); +typedef void (*aMJN4_TALK_PROC)(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play); + +struct npc_majin4_actor_s { + NPC_ACTOR npc_class; + int think_idx; + int next_think_idx; + aMJN4_THINK_PROC think_proc; + int talk_idx; + aMJN4_TALK_PROC talk_proc; + int reset_timer; + int se_clear_timer; +}; + extern ACTOR_PROFILE Npc_Majin4_Profile; #ifdef __cplusplus @@ -15,4 +32,3 @@ extern ACTOR_PROFILE Npc_Majin4_Profile; #endif #endif - diff --git a/include/audio_defs.h b/include/audio_defs.h index f8e66832..e34d3571 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -282,6 +282,7 @@ typedef enum audio_sound_effects { NA_SE_43D = 0x43D, + NA_SE_43E = 0x43E, NA_SE_43F = 0x43F, NA_SE_ROD_STROKE_SMALL = 0x445, diff --git a/src/actor/npc/ac_npc_majin4.c b/src/actor/npc/ac_npc_majin4.c new file mode 100644 index 00000000..131d8f2c --- /dev/null +++ b/src/actor/npc/ac_npc_majin4.c @@ -0,0 +1,166 @@ +#include "ac_npc_majin4.h" + +#include +#include "libultra/libultra.h" +#include "m_common_data.h" +#include "m_player_lib.h" +#include "m_font.h" +#include "m_msg.h" +#include "ac_reset_demo.h" +#include "m_bgm.h" +#include "m_house.h" +#include "m_rcp.h" + +enum { + aMJN4_THINK_START_WAIT, + aMJN4_THINK_START_WAIT_ST, + aMJN4_THINK_CALL, + aMJN4_THINK_FORCE_RESET_END_WAIT, + aMJN4_THINK_COLOR_FILTER_END_WAIT, + aMJN4_THINK_CALL_2, + aMJN4_THINK_EXIT, + + aMJN4_THINK_NUM +}; + +enum { + aMJN4_TALK_END_WAIT, + + aMJN4_TALK_NUM +}; + +static void aMJN4_actor_ct(ACTOR* actorx, GAME* game); +static void aMJN4_actor_dt(ACTOR* actorx, GAME* game); +static void aMJN4_actor_move(ACTOR* actorx, GAME* game); +static void aMJN4_actor_draw(ACTOR* actorx, GAME* game); +static void aMJN4_actor_save(ACTOR* actorx, GAME* game); +static void aMJN4_actor_init(ACTOR* actorx, GAME* game); + +// clang-format off +ACTOR_PROFILE Npc_Majin4_Profile = { + mAc_PROFILE_NPC_MAJIN4, + ACTOR_PART_NPC, + ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED, + SP_NPC_MAJIN4, + ACTOR_OBJ_BANK_KEEP, + sizeof(NPC_MAJIN4_ACTOR), + aMJN4_actor_ct, + aMJN4_actor_dt, + aMJN4_actor_init, + mActor_NONE_PROC1, + aMJN4_actor_save, +}; +// clang-format on + +static u8 l_fade_alpha = 0; +static u64 l_ResetTime = 0; + +static void aMJN4_force_talk_request(ACTOR* actorx, GAME* game); +static void aMJN4_norm_talk_request(ACTOR* actorx, GAME* game); +static int aMJN4_talk_init(ACTOR* actorx, GAME* game); +static int aMJN4_talk_end_chk(ACTOR* actorx, GAME* game); + +static void aMJN4_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type); +static void aMJN4_setup_think_proc(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play, int think_idx); +static void aMJN4_change_talk_proc(NPC_MAJIN4_ACTOR* actor, int talk_idx); + +static void aMJN4_actor_ct(ACTOR* actorx, GAME* game) { + static aNPC_ct_data_c ct_data = { + aMJN4_actor_move, + aMJN4_actor_draw, + aNPC_CT_SCHED_TYPE_SPECIAL, + (aNPC_TALK_REQUEST_PROC)none_proc1, + aMJN4_talk_init, + aMJN4_talk_end_chk, + 0, + }; + + if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) { + NPC_MAJIN4_ACTOR* actor = (NPC_MAJIN4_ACTOR*)actorx; + + actor->npc_class.schedule.schedule_proc = aMJN4_schedule_proc; + NPC_CLIP->ct_proc(actorx, game, &ct_data); + } + + l_fade_alpha = 0; + l_ResetTime = 0; +} + +static void aMJN4_actor_save(ACTOR* actorx, GAME* game) { + NPC_CLIP->save_proc(actorx, game); +} + +static void aMJN4_actor_dt(ACTOR* actorx, GAME* game) { + NPC_CLIP->dt_proc(actorx, game); + eEC_CLIP->effect_kill_proc(eEC_EFFECT_RESET_HOLE, RSV_NO); + if (CLIP(demo_clip2) != NULL && CLIP(demo_clip2)->type == mDemo_CLIP_TYPE_RESET_DEMO) { + ACTOR* demox = (ACTOR*)CLIP(demo_clip2)->demo_class; + + if (demox != NULL) { + RESET_DEMO_ACTOR* reset_demo = (RESET_DEMO_ACTOR*)demox; + + reset_demo->reset_actor = NULL; + reset_demo->request_light = FALSE; + } + } +} + +static void aMJN4_actor_init(ACTOR* actorx, GAME* game) { + NPC_CLIP->init_proc(actorx, game); +} + +static void aMJN4_actor_move(ACTOR* actorx, GAME* game) { + NPC_CLIP->move_proc(actorx, game); + actorx->shape_info.draw_shadow = FALSE; +} + +static void aMJN4_set_animation(NPC_MAJIN4_ACTOR* actor, int think_idx) { + static s16 animeSeqNo[] = { aNPC_ANIM_WAIT1, aNPC_ANIM_WAIT1, aNPC_ANIM_APPEAR1, aNPC_ANIM_WAIT_R1, aNPC_ANIM_WAIT_R1, aNPC_ANIM_WAIT_R1, aNPC_ANIM_GO_UG1 }; + + NPC_CLIP->animation_init_proc((ACTOR*)actor, animeSeqNo[think_idx], FALSE); +} + +#include "../src/actor/npc/ac_npc_majin4_talk.c_inc" +#include "../src/actor/npc/ac_npc_majin4_schedule.c_inc" + +static void aMJN4_prenmi_draw(NPC_MAJIN4_ACTOR* actor, GAME* game) { + GRAPH* graph = game->graph; + + OPEN_DISP(graph); + if (l_fade_alpha != 0) { + Gfx* gfx = NOW_OVERLAY_DISP; + + fade_black_draw(&gfx, l_fade_alpha); + SET_OVERLAY_DISP(gfx); + + if (l_ResetTime != 0) { + Gfx* gfx = NOW_OVERLAY_DISP; + f32 time = OSTicksToMicroseconds(osGetTime() - l_ResetTime); + f32 line_y; + + if (time < 500000.0f) { + u32 alpha; + + + gDPPipeSync(gfx++); + gDPSetOtherMode(gfx++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); + gDPSetCombineMode(gfx++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + + alpha = (int)((time / 500000.0f) * -200.0f + 250.0f); + line_y = (time / 500000.0f) * -15.0f + 127.0f; + gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, alpha); + + gfx = gfx_gSPTextureRectangle1(gfx, 0, (u32)(line_y * 4), 320 << G_TEXTURE_IMAGE_FRAC, (u32)((line_y + 1) * 4), G_TX_RENDERTILE, 0, 0, 0, 0); + gDPPipeSync(gfx++); + } + + SET_OVERLAY_DISP(gfx); + } + } + CLOSE_DISP(graph); +} + +static void aMJN4_actor_draw(ACTOR* actorx, GAME* game) { + NPC_CLIP->draw_proc(actorx, game); + aMJN4_prenmi_draw((NPC_MAJIN4_ACTOR*)actorx, game); +} diff --git a/src/actor/npc/ac_npc_majin4_schedule.c_inc b/src/actor/npc/ac_npc_majin4_schedule.c_inc new file mode 100644 index 00000000..582144a3 --- /dev/null +++ b/src/actor/npc/ac_npc_majin4_schedule.c_inc @@ -0,0 +1,196 @@ +static void aMJN4_set_request_act(NPC_MAJIN4_ACTOR* actor) { + actor->npc_class.request.act_priority = 1; + actor->npc_class.request.act_idx = aNPC_ACT_SPECIAL; + actor->npc_class.request.act_type = aNPC_ACT_TYPE_SEARCH; +} + +static void aMJN4_act_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + nactorx->action.step = 0; +} + +static void aMJN4_act_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) { + static aNPC_SUB_PROC act_proc[] = { aMJN4_act_init_proc, (aNPC_SUB_PROC)none_proc1, (aNPC_SUB_PROC)none_proc1 }; + + (*act_proc[type])(nactorx, play); +} + +static void aMJN4_start_wait(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + if (!mPlib_check_player_actor_main_index_OutDoorMove2((GAME*)play)) { + aMJN4_setup_think_proc(actor, play, aMJN4_THINK_CALL); + } +} + +static void aMJN4_start_wait_st(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + ACTOR* playerx = GET_PLAYER_ACTOR_ACTOR(play); + + if (playerx != NULL && playerx->world.position.z > 970.0f) { + aMJN4_setup_think_proc(actor, play, aMJN4_THINK_CALL); + } +} + +static void aMJN4_force_reset_end_wait(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + if (actor->reset_timer == 0) { + l_ResetTime = 0; + aMJN4_setup_think_proc(actor, play, aMJN4_THINK_COLOR_FILTER_END_WAIT); + } else { + actor->reset_timer--; + } + + if (actor->se_clear_timer > 0) { + actor->se_clear_timer--; + + if (actor->se_clear_timer == 0) { + if (CLIP(weather_clip) != NULL) { + CLIP(weather_clip)->stop_sound(); + } + + mBGMPsComp_scene_mode(6); + actor->se_clear_timer = -1; + } + } +} + +static void aMJN4_color_filter_end_wait(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + int alpha = l_fade_alpha; + + alpha -= 8; + if (alpha < 0) { + alpha = 0; + aMJN4_setup_think_proc(actor, play, aMJN4_THINK_CALL_2); + } + + l_fade_alpha = alpha; +} + +static void aMJN4_exit(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + if (actor->npc_class.draw.main_animation_state == cKF_STATE_STOPPED) { + Actor_delete((ACTOR*)actor); + } +} + +static void aMJN4_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + NPC_MAJIN4_ACTOR* actor = (NPC_MAJIN4_ACTOR*)nactorx; + + if (nactorx->action.idx == aNPC_ACT_SPECIAL) { + actor->think_proc(actor, play); + } else if (nactorx->action.step == aNPC_ACTION_END_STEP) { + aMJN4_set_request_act(actor); + } +} + +static void aMJN4_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + static f32 def_posX[] = { 2180.0f, 2300.0f, 2180.0f, 2300.0f, 2260.0f }; + static f32 def_posZ[] = { 1460.0f, 1460.0f, 1740.0f, 1740.0f, 980.0f }; + static s16 def_angl[] = { 0xD41D, 0x2BE3, 0xD41D, 0x2BE3, 0x4000 }; + static int def_think_idx[] = { aMJN4_THINK_START_WAIT, aMJN4_THINK_START_WAIT, aMJN4_THINK_START_WAIT, aMJN4_THINK_START_WAIT, aMJN4_THINK_START_WAIT_ST }; + NPC_MAJIN4_ACTOR* actor = (NPC_MAJIN4_ACTOR*)nactorx; + ACTOR* actorx = (ACTOR*)nactorx; + int pos_idx; + + actor->npc_class.action.act_proc = aMJN4_act_proc; + aMJN4_set_request_act(actor); + actorx->status_data.weight = MASSTYPE_HEAVY; + Common_Set(reset_type, 0); + + if (play->block_table.block_z == 1) { + pos_idx = 4; + } else { + pos_idx = mHS_get_arrange_idx(Common_Get(player_no)); + } + + actorx->world.position.x = def_posX[pos_idx]; + actorx->world.position.z = def_posZ[pos_idx]; + actorx->shape_info.rotation.y = def_angl[pos_idx]; + actorx->world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos(actorx->world.position, 0.0f); + aMJN4_setup_think_proc(actor, play, def_think_idx[pos_idx]); +} + +static void aMJN4_call_init(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + actor->npc_class.condition_info.hide_request = FALSE; + actor->npc_class.talk_info.default_turn_animation = aNPC_ANIM_APPEAR1; + actor->npc_class.talk_info.default_animation = aNPC_ANIM_APPEAR1; + + eEC_CLIP->effect_make_proc(eEC_EFFECT_RESET_HOLE, ((ACTOR*)actor)->world.position, 3, ((ACTOR*)actor)->shape_info.rotation.y, (GAME*)play, RSV_NO, 0, 0); + if (CLIP(demo_clip2) != NULL && CLIP(demo_clip2)->type == mDemo_CLIP_TYPE_RESET_DEMO) { + ACTOR* demox = (ACTOR*)CLIP(demo_clip2)->demo_class; + + if (demox != NULL) { + RESET_DEMO_ACTOR* reset_demo = (RESET_DEMO_ACTOR*)demox; + + reset_demo->request_light = TRUE; + } + } +} + +static void aMJN4_force_reset_end_wait_init(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + l_fade_alpha = 255; + l_ResetTime = osGetTime(); + mPlib_request_main_demo_wait_type1((GAME*)play, FALSE, NULL); + sAdo_OngenTrgStart(NA_SE_43E, &actor->npc_class.actor_class.world.position); + actor->reset_timer = 180; + actor->se_clear_timer = 8; +} + +static void aMJN4_color_filter_end_wait_init(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play) { + mBGMPsComp_scene_mode(1); + if (CLIP(weather_clip) != NULL) { + CLIP(weather_clip)->start_sound(); + } +} + +typedef void (*aMJN4_THINK_INIT_PROC)(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play); + +typedef struct { + aMJN4_THINK_PROC think_proc; + aMJN4_THINK_INIT_PROC think_init_proc; + aNPC_TALK_REQUEST_PROC talk_request_proc; + u8 talk_idx; + u8 think_idx_when_talk_done; +} aMJN4_think_data_c; + +static void aMJN4_setup_think_proc(NPC_MAJIN4_ACTOR* actor, GAME_PLAY* play, int think_idx) { + // clang-format off + static aMJN4_think_data_c dt_tbl[] = { + {aMJN4_start_wait, (aMJN4_THINK_INIT_PROC)none_proc1, (aNPC_TALK_REQUEST_PROC)none_proc1, 0, aMJN4_THINK_START_WAIT}, + {aMJN4_start_wait_st, (aMJN4_THINK_INIT_PROC)none_proc1, (aNPC_TALK_REQUEST_PROC)none_proc1, 0, aMJN4_THINK_START_WAIT_ST}, + {(aMJN4_THINK_PROC)none_proc1, aMJN4_call_init, aMJN4_force_talk_request, 0, aMJN4_THINK_FORCE_RESET_END_WAIT}, + {aMJN4_force_reset_end_wait, aMJN4_force_reset_end_wait_init, (aNPC_TALK_REQUEST_PROC)none_proc1, 0, aMJN4_THINK_FORCE_RESET_END_WAIT}, + {aMJN4_color_filter_end_wait, aMJN4_color_filter_end_wait_init, (aNPC_TALK_REQUEST_PROC)none_proc1, 0, aMJN4_THINK_COLOR_FILTER_END_WAIT}, + {(aMJN4_THINK_PROC)none_proc1, (aMJN4_THINK_INIT_PROC)none_proc1, aMJN4_force_talk_request, 1, aMJN4_THINK_EXIT}, + {aMJN4_exit, (aMJN4_THINK_INIT_PROC)none_proc1, (aNPC_TALK_REQUEST_PROC)none_proc1, 0, aMJN4_THINK_EXIT}, + }; + // clang-format on + + aMJN4_think_data_c* data_p = &dt_tbl[think_idx]; + + actor->think_idx = think_idx; + actor->think_proc = data_p->think_proc; + actor->npc_class.talk_info.talk_request_proc = data_p->talk_request_proc; + actor->talk_idx = data_p->talk_idx; + actor->next_think_idx = data_p->think_idx_when_talk_done; + aMJN4_set_animation(actor, think_idx); + (*data_p->think_init_proc)(actor, play); +} + +static void aMJN4_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) { + static aNPC_SUB_PROC think_proc[] = { aMJN4_think_init_proc, aMJN4_think_main_proc }; + + (*think_proc[type])(nactorx, play); +} + +static void aMJN4_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + nactorx->think.think_proc = aMJN4_think_proc; + NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT); +} + +static void aMJN4_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + if (!NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT)) { + NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_MAIN); + } +} + +static void aMJN4_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) { + static aNPC_SUB_PROC sche_proc[] = { aMJN4_schedule_init_proc, aMJN4_schedule_main_proc }; + + (*sche_proc[type])(nactorx, play); +} diff --git a/src/actor/npc/ac_npc_majin4_talk.c_inc b/src/actor/npc/ac_npc_majin4_talk.c_inc new file mode 100644 index 00000000..593d88d8 --- /dev/null +++ b/src/actor/npc/ac_npc_majin4_talk.c_inc @@ -0,0 +1,65 @@ +typedef struct { + int msg_no; + aMJN4_TALK_PROC talk_proc; +} aMJN4_talk_data_c; + +static void aMJN4_set_force_talk_info(ACTOR* actorx) { + static aMJN4_talk_data_c dt_tbl[] = { + { 0x250F, (aMJN4_TALK_PROC)none_proc1 }, + { 0x2512, (aMJN4_TALK_PROC)none_proc1 }, + }; + NPC_MAJIN4_ACTOR* actor = (NPC_MAJIN4_ACTOR*)actorx; + aMJN4_talk_data_c* data_p = &dt_tbl[actor->talk_idx]; + + mDemo_Set_msg_num(data_p->msg_no); + mDemo_Set_talk_turn(TRUE); + actor->talk_proc = data_p->talk_proc; + mPlib_Set_able_hand_all_item_in_demo(TRUE); + + if (actor->talk_idx == aMJN4_TALK_END_WAIT) { + mBGMPsComp_make_ps_quiet(0); + } +} + +static void aMJN4_force_talk_request(ACTOR* actorx, GAME* game) { + mDemo_Request(mDemo_TYPE_SPEAK, actorx, aMJN4_set_force_talk_info); +} + +static int aMJN4_talk_init2(ACTOR* actorx, GAME* game) { + NPC_MAJIN4_ACTOR* actor = (NPC_MAJIN4_ACTOR*)actorx; + + actor->npc_class.talk_info.talk_request_proc = (aNPC_TALK_REQUEST_PROC)none_proc1; + mDemo_Set_ListenAble(); + return TRUE; +} + +static int aMJN4_talk_init(ACTOR* actorx, GAME* game) { + NPC_MAJIN4_ACTOR* actor = (NPC_MAJIN4_ACTOR*)actorx; + int ret = FALSE; + + if (actor->npc_class.draw.animation_id == aNPC_ANIM_APPEAR1 && actor->npc_class.draw.main_animation_state == cKF_STATE_STOPPED) { + + actor->npc_class.talk_info.default_turn_animation = aNPC_ANIM_WAIT_R1; + actor->npc_class.talk_info.default_animation = aNPC_ANIM_WAIT_R1; + actor->npc_class.talk_info.talk_init_proc = aMJN4_talk_init2; + aMJN4_talk_init2(actorx, game); + ret = TRUE; + } + + return ret; +} + +static int aMJN4_talk_end_chk(ACTOR* actorx, GAME* game) { + NPC_MAJIN4_ACTOR* actor = (NPC_MAJIN4_ACTOR*)actorx; + GAME_PLAY* play = (GAME_PLAY*)game; + int ret = FALSE; + + actor->talk_proc(actor, play); + if (mDemo_CAN_ACTOR_TALK(actorx)) { + actor->npc_class.talk_info.melody_inst = 0; + aMJN4_setup_think_proc(actor, play, actor->next_think_idx); + ret = TRUE; + } + + return ret; +} diff --git a/src/game/m_rcp.c b/src/game/m_rcp.c index aabdc15c..c097b349 100644 --- a/src/game/m_rcp.c +++ b/src/game/m_rcp.c @@ -410,7 +410,7 @@ extern void DisplayList_initialize(GRAPH* graph, u8 clear_r, u8 clear_g, u8 clea mFont_Main_start(graph); } -extern void fade_rgba8888_draw(Gfx** gfxp, u32 color) { +extern void fade_rgba8888_draw(Gfx** gfxp, u32 alpha) { static Gfx fade_gfx[6] = { gsDPPipeSync(), gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | @@ -434,10 +434,10 @@ extern void fade_rgba8888_draw(Gfx** gfxp, u32 color) { Gfx* gfx; - if ((color & 0xFF) == 255) { - u32 r = ((color >> 16) & 0xF800); - u32 g = ((color >> 13) & 0x7FFC0); - u32 b = (color >> 10) & 0x7FFFFF; + if ((alpha & 0xFF) == 255) { + u32 r = ((alpha >> 16) & 0xF800); + u32 g = ((alpha >> 13) & 0x7FFC0); + u32 b = (alpha >> 10) & 0x7FFFFF; u32 c = ((r | g | b | 1)); u32 f = c | ((c & 0xFFFF) << 16); @@ -445,16 +445,16 @@ extern void fade_rgba8888_draw(Gfx** gfxp, u32 color) { gDPSetFillColor(gfx, f); gSPDisplayList(gfx + 1, fill_gfx); *gfxp = gfx + 2; - } else if ((color & 0xFF) != 0) { + } else if ((alpha & 0xFF) != 0) { gfx = *gfxp; - gDPSetColor(gfx, G_SETPRIMCOLOR, color); + gDPSetColor(gfx, G_SETPRIMCOLOR, alpha); gSPDisplayList(gfx + 1, fade_gfx); *gfxp = gfx + 2; } } -extern void fade_black_draw(Gfx** gfx, u32 color) { - fade_rgba8888_draw(gfx, color); +extern void fade_black_draw(Gfx** gfx, u32 alpha) { + fade_rgba8888_draw(gfx, alpha); } extern Gfx* gfx_gDPFillRectangle1(Gfx* gfx, u32 ulx, u32 uly, u32 lrx, u32 lry) {