From 4f65d08eb5826c9c3520fd398b2e76ab09168193 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:40:26 +0100 Subject: [PATCH] Rumble doc (#1375) * Rumble doc * Fixes, suggested changes * Improve padmgr retrace callback related code * Name some rumble-adjacent things, further suggested changes * Further suggested changes * Suggested changes --- include/functions.h | 12 -- include/padmgr.h | 36 ++++- include/regs.h | 3 + include/rumble.h | 51 ++++++ include/z64.h | 17 +- spec | 4 +- src/code/code_800A9F30.c | 91 ----------- src/code/code_800D2E30.c | 119 -------------- src/code/game.c | 4 +- src/code/padmgr.c | 2 +- src/code/sys_rumble.c | 151 ++++++++++++++++++ src/code/z_actor.c | 4 +- src/code/z_construct.c | 8 +- src/code/z_debug.c | 2 +- src/code/z_demo.c | 2 +- src/code/z_game_over.c | 35 ++-- src/code/z_kankyo.c | 4 +- src/code/z_play.c | 4 +- src/code/z_rumble.c | 135 ++++++++++++++++ .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 10 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 6 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c | 2 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 2 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 6 +- .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c | 4 +- .../ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c | 2 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 2 +- .../ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c | 2 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c | 2 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.c | 4 +- .../z_bg_mori_rakkatenjo.c | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 2 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 6 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 8 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 4 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 4 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 4 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 4 +- src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 4 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 2 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 2 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 2 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 4 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 38 ++--- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 2 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 2 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 6 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 8 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 26 +-- .../actors/ovl_Obj_Switch/z_obj_switch.c | 4 +- .../actors/ovl_player_actor/z_player.c | 48 +++--- .../ovl_file_choose/z_file_choose.c | 2 +- .../ovl_file_choose/z_file_copy_erase.c | 4 +- .../ovl_file_choose/z_file_nameset_PAL.c | 2 +- 59 files changed, 533 insertions(+), 393 deletions(-) create mode 100644 include/rumble.h delete mode 100644 src/code/code_800A9F30.c delete mode 100644 src/code/code_800D2E30.c create mode 100644 src/code/sys_rumble.c create mode 100644 src/code/z_rumble.c diff --git a/include/functions.h b/include/functions.h index 8df78a215a..eddb732f8e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1288,15 +1288,6 @@ void SsSram_Init(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 u8 handlePulse, u32 handleSpeed); void SsSram_Dma(void* dramAddr, size_t size, s32 direction); void SsSram_ReadWrite(u32 addr, void* dramAddr, size_t size, s32 direction); -void func_800A9F30(PadMgr*, s32); -void func_800A9F6C(f32, u8, u8, u8); -void func_800AA000(f32, u8, u8, u8); -void func_800AA0B4(void); -void func_800AA0F0(void); -u32 func_800AA148(void); -void func_800AA15C(void); -void func_800AA16C(void); -void func_800AA178(u32); View* View_New(GraphicsContext* gfxCtx); void View_Free(View* view); void View_Init(View*, GraphicsContext*); @@ -1693,9 +1684,6 @@ u64* SysUcode_GetUCodeBoot(void); size_t SysUcode_GetUCodeBootSize(void); u64* SysUcode_GetUCode(void); u64* SysUcode_GetUCodeData(void); -void func_800D2E30(UnkRumbleStruct* arg0); -void func_800D3140(UnkRumbleStruct* arg0); -void func_800D3178(UnkRumbleStruct* arg0); void func_800D31A0(void); void func_800D31F0(void); void func_800D3210(void); diff --git a/include/padmgr.h b/include/padmgr.h index bddb136eb9..65705949ea 100644 --- a/include/padmgr.h +++ b/include/padmgr.h @@ -40,8 +40,8 @@ typedef struct PadMgr { /* 0x045C */ vu8 rumbleOffTimer; // amount of VI retraces to not rumble for, takes priority over rumbleOnTimer /* 0x045D */ vu8 rumbleOnTimer; // amount of VI retraces to rumble for /* 0x045E */ u8 isResetting; - /* 0x0460 */ void (*retraceCallback)(struct PadMgr* padMgr, s32 arg); - /* 0x0464 */ s32 retraceCallbackValue; + /* 0x0460 */ void (*retraceCallback)(struct PadMgr* padMgr, void* arg); + /* 0x0464 */ void* retraceCallbackArg; } PadMgr; // size = 0x468 extern PadMgr gPadMgr; @@ -70,4 +70,36 @@ void PadMgr_RumbleReset(PadMgr* padMgr); void PadMgr_RumbleSetSingle(PadMgr* padMgr, u32 port, u32 rumble); void PadMgr_RumbleSet(PadMgr* padMgr, u8* enable); +// Retrace callback + +/** + * Sets the padmgr retrace callback that runs while waiting for controller input. The callback may be passed a single + * user-provided argument. The callback function should be `void (*)(PadMgr*, void*)`. + * + * @param callback callback to run before rumble state is updated for the current VI + * @param arg the argument to pass to the calback + * + * @see PADMGR_UNSET_RETRACE_CALLACK + */ +#define PADMGR_SET_RETRACE_CALLACK(padmgr, callback, arg) \ + do { \ + (padmgr)->retraceCallback = (callback); \ + (padmgr)->retraceCallbackArg = (arg); \ + } while (0) + +/** + * Unsets the current padmgr retrace callback if it and the argument are the same as the ones already registered. + * + * @param callback the callback to unset, if it is set + * @param arg the argument to unset, if it is set + * + * @see PADMGR_SET_RETRACE_CALLACK + */ +#define PADMGR_UNSET_RETRACE_CALLACK(padmgr, callback, arg) \ + if ((padmgr)->retraceCallback == (callback) && (padmgr)->retraceCallbackArg == (arg)) { \ + (padmgr)->retraceCallback = NULL; \ + (padmgr)->retraceCallbackArg = NULL; \ + } \ + (void)0 + #endif diff --git a/include/regs.h b/include/regs.h index d9b0708fd9..a873e34c96 100644 --- a/include/regs.h +++ b/include/regs.h @@ -171,6 +171,9 @@ #define R_ITEM_AMMO_Y(i) VREG(68 + (i)) #define R_ITEM_ICON_WIDTH(i) VREG(76 + (i)) #define R_ITEM_BTN_WIDTH(i) VREG(80 + (i)) +#define R_GAME_OVER_RUMBLE_STRENGTH VREG(90) +#define R_GAME_OVER_RUMBLE_DURATION VREG(91) +#define R_GAME_OVER_RUMBLE_DECREASE_RATE VREG(92) #define R_DISABLE_INPUT_DISPLAY HREG(47) #define R_ENABLE_PLAY_LOGS HREG(63) #define R_EN_GOROIWA_SPEED mREG(12) diff --git a/include/rumble.h b/include/rumble.h new file mode 100644 index 0000000000..2ce8f4e71a --- /dev/null +++ b/include/rumble.h @@ -0,0 +1,51 @@ +#ifndef RUMBLE_H +#define RUMBLE_H + +#include "ultra64.h" + +#define RUMBLE_MAX_REQUESTS 64 + +typedef enum { + RUMBLE_STATE_CLEAR, + RUMBLE_STATE_RUNNING, + RUMBLE_STATE_RESET +} RumbleState; + +typedef struct { + /* 0x000 */ u8 rumbleEnable[MAXCONTROLLERS]; + /* 0x004 */ u8 reqStrengths[RUMBLE_MAX_REQUESTS]; // Source strength modulated by distance to the source + /* 0x044 */ u8 reqDurations[RUMBLE_MAX_REQUESTS]; // Duration until decreaseRate kicks in + /* 0x084 */ u8 reqDecreaseRates[RUMBLE_MAX_REQUESTS]; // Decreases the strength by this much every Vertical Retrace, once the strength hits 0 the request slot is freed + /* 0x0C4 */ u8 reqAccumulators[RUMBLE_MAX_REQUESTS]; // Starts at 0, incremented by the strength every Vertical Retrace + /* 0x104 */ u8 state; + /* 0x105 */ u8 updateEnabled; + /* 0x106 */ u16 onTimer; // Duration for which there has been an active rumble request running + /* 0x108 */ u16 offTimer; // Duration for which there has not been an active rumble request running, capped at 5 + /* 0x10A */ u8 overrideStrength; // overrides requests with these parameters + /* 0x10B */ u8 overrideDuration; + /* 0x10C */ u8 overrideDecreaseRate; + /* 0x10D */ u8 overrideAccumulator; +} RumbleMgr; // size = 0x10E + +// internal + +void RumbleMgr_Init(RumbleMgr* rumbleMgr); +void RumbleMgr_Destroy(RumbleMgr* rumbleMgr); +void RumbleMgr_Update(RumbleMgr* rumbleMgr); + +// external + +void Rumble_Override(f32 distSq, u8 sourceStrength, u8 duration, u8 decreaseRate); +void Rumble_Request(f32 distSq, u8 sourceStrength, u8 duration, u8 decreaseRate); + +void Rumble_Init(void); +void Rumble_Destroy(void); + +s32 Rumble_Controller1HasRumblePak(void); + +void Rumble_Reset(void); +void Rumble_ClearRequests(void); + +void Rumble_SetUpdateEnabled(u32 enable); + +#endif diff --git a/include/z64.h b/include/z64.h index 7128cd1b2a..c63dcab5bf 100644 --- a/include/z64.h +++ b/include/z64.h @@ -36,6 +36,7 @@ #include "padmgr.h" #include "fault.h" #include "sched.h" +#include "rumble.h" #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 @@ -1813,22 +1814,6 @@ typedef struct { /* 0x08 */ Color_RGBA8_u32 envColor; } struct_80166500; // size = 0x10 -typedef struct { - /* 0x000 */ u8 rumbleEnable[4]; - /* 0x004 */ u8 unk_04[0x40]; - /* 0x044 */ u8 unk_44[0x40]; - /* 0x084 */ u8 unk_84[0x40]; - /* 0x0C4 */ u8 unk_C4[0x40]; - /* 0x104 */ u8 unk_104; - /* 0x105 */ u8 unk_105; - /* 0x106 */ u16 unk_106; - /* 0x108 */ u16 unk_108; - /* 0x10A */ u8 unk_10A; - /* 0x10B */ u8 unk_10B; - /* 0x10C */ u8 unk_10C; - /* 0x10D */ u8 unk_10D; -} UnkRumbleStruct; // size = 0x10E - typedef struct { /* 0x00 */ char unk_00[0x18]; /* 0x18 */ s32 unk_18; diff --git a/spec b/spec index 45a3273ffc..f726a7a2e5 100644 --- a/spec +++ b/spec @@ -360,7 +360,7 @@ beginseg include "build/src/code/z_skin_matrix.o" include "build/src/code/z_sram.o" include "build/src/code/z_ss_sram.o" - include "build/src/code/code_800A9F30.o" + include "build/src/code/z_rumble.o" include "build/data/z_text.data.o" include "build/data/unk_8012ABC0.data.o" include "build/src/code/z_view.o" @@ -402,7 +402,7 @@ beginseg include "build/src/code/sys_math_atan.o" include "build/src/code/sys_matrix.o" include "build/src/code/sys_ucode.o" - include "build/src/code/code_800D2E30.o" + include "build/src/code/sys_rumble.o" include "build/src/code/code_800D31A0.o" include "build/src/code/irqmgr.o" include "build/src/code/debug_malloc.o" diff --git a/src/code/code_800A9F30.c b/src/code/code_800A9F30.c deleted file mode 100644 index b8f4e1ce8d..0000000000 --- a/src/code/code_800A9F30.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "global.h" - -UnkRumbleStruct D_80160FD0; - -void func_800A9F30(PadMgr* a, s32 b) { - func_800D2E30(&D_80160FD0); - PadMgr_RumbleSet(a, D_80160FD0.rumbleEnable); -} - -void func_800A9F6C(f32 a, u8 b, u8 c, u8 d) { - s32 temp1; - s32 temp2; - - if (1000000.0f < a) { - temp1 = 1000; - } else { - temp1 = sqrtf(a); - } - - if ((temp1 < 1000) && (b != 0) && (d != 0)) { - temp2 = b - (temp1 * 255) / 1000; - if (temp2 > 0) { - D_80160FD0.unk_10A = temp2; - D_80160FD0.unk_10B = c; - D_80160FD0.unk_10C = d; - } - } -} - -void func_800AA000(f32 a, u8 b, u8 c, u8 d) { - s32 temp1; - s32 temp2; - s32 i; - - if (1000000.0f < a) { - temp1 = 1000; - } else { - temp1 = sqrtf(a); - } - - if (temp1 < 1000 && b != 0 && d != 0) { - temp2 = b - (temp1 * 255) / 1000; - - for (i = 0; i < 0x40; i++) { - if (D_80160FD0.unk_04[i] == 0) { - if (temp2 > 0) { - D_80160FD0.unk_04[i] = temp2; - D_80160FD0.unk_44[i] = c; - D_80160FD0.unk_84[i] = d; - } - break; - } - } - } -} - -void func_800AA0B4(void) { - func_800D3140(&D_80160FD0); - - gPadMgr.retraceCallback = func_800A9F30; - gPadMgr.retraceCallbackValue = 0; - - if (1) {} -} - -void func_800AA0F0(void) { - PadMgr* padmgr = &gPadMgr; - - if ((padmgr->retraceCallback == func_800A9F30) && (padmgr->retraceCallbackValue == 0)) { - padmgr->retraceCallback = NULL; - padmgr->retraceCallbackValue = 0; - } - - func_800D3178(&D_80160FD0); -} - -u32 func_800AA148(void) { - return gPadMgr.pakType[0] == 1; -} - -void func_800AA15C(void) { - D_80160FD0.unk_104 = 2; -} - -void func_800AA16C(void) { - D_80160FD0.unk_104 = 0; -} - -void func_800AA178(u32 a) { - D_80160FD0.unk_105 = !!a; -} diff --git a/src/code/code_800D2E30.c b/src/code/code_800D2E30.c deleted file mode 100644 index a182926f10..0000000000 --- a/src/code/code_800D2E30.c +++ /dev/null @@ -1,119 +0,0 @@ -#include "global.h" - -void func_800D2E30(UnkRumbleStruct* arg0) { - static u8 D_8012DBB0 = 1; - s32 i; - s32 unk_a3; - s32 index = -1; - - for (i = 0; i < 4; i++) { - arg0->rumbleEnable[i] = 0; - } - - if (arg0->unk_105 == 0) { - if (D_8012DBB0 != 0) { - for (i = 0; i < 4; i++) { - gPadMgr.pakType[i] = 0; - } - } - D_8012DBB0 = arg0->unk_105; - return; - } - - D_8012DBB0 = arg0->unk_105; - - if (arg0->unk_104 == 2) { - for (i = 0; i < 4; ++i) { - gPadMgr.pakType[i] = 0; - } - - for (i = 0; i < 0x40; i++) { - arg0->unk_C4[i] = 0; - arg0->unk_84[i] = 0; - arg0->unk_44[i] = 0; - arg0->unk_04[i] = 0; - } - arg0->unk_106 = arg0->unk_108 = arg0->unk_10A = arg0->unk_10B = arg0->unk_10C = arg0->unk_10D = 0; - arg0->unk_104 = 1; - } - if (arg0->unk_104 != 0) { - for (i = 0; i < 0x40; i++) { - if (arg0->unk_04[i] != 0) { - if (arg0->unk_44[i] > 0) { - arg0->unk_44[i]--; - } else { - unk_a3 = arg0->unk_04[i] - arg0->unk_84[i]; - if (unk_a3 > 0) { - arg0->unk_04[i] = unk_a3; - } else { - arg0->unk_04[i] = 0; - } - } - - unk_a3 = arg0->unk_C4[i] + arg0->unk_04[i]; - arg0->unk_C4[i] = unk_a3; - if (index == -1) { - index = i; - arg0->rumbleEnable[0] = (unk_a3 >= 0x100); - } else if (arg0->unk_04[index] < arg0->unk_04[i]) { - index = i; - arg0->rumbleEnable[0] = (unk_a3 >= 0x100); - } - } - } - if (arg0->unk_10A != 0) { - if (arg0->unk_10B > 0) { - arg0->unk_10B--; - } else { - unk_a3 = arg0->unk_10A - arg0->unk_10C; - if (unk_a3 > 0) { - arg0->unk_10A = unk_a3; - } else { - arg0->unk_10A = 0; - } - } - unk_a3 = arg0->unk_10D + arg0->unk_10A; - arg0->unk_10D = unk_a3; - arg0->rumbleEnable[0] = (unk_a3 >= 0x100); - } - if (arg0->unk_10A != 0) { - unk_a3 = arg0->unk_10A; - } else { - if (index == -1) { - unk_a3 = 0; - } else { - unk_a3 = arg0->unk_04[index]; - } - } - if (unk_a3 == 0) { - if ((++arg0->unk_108) >= 6) { - arg0->unk_106 = 0; - arg0->unk_108 = 5; - } - } else { - arg0->unk_108 = 0; - if ((++arg0->unk_106) >= 0x1C21) { - arg0->unk_104 = 0; - } - } - } else { - for (i = 0; i < 0x40; i++) { - arg0->unk_C4[i] = 0; - arg0->unk_84[i] = 0; - arg0->unk_44[i] = 0; - arg0->unk_04[i] = 0; - } - - arg0->unk_106 = arg0->unk_108 = arg0->unk_10A = arg0->unk_10B = arg0->unk_10C = arg0->unk_10D = 0; - } -} - -void func_800D3140(UnkRumbleStruct* arg0) { - bzero(arg0, sizeof(UnkRumbleStruct)); - arg0->unk_104 = 2; - arg0->unk_105 = 1; -} - -void func_800D3178(UnkRumbleStruct* arg0) { - bzero(arg0, sizeof(UnkRumbleStruct)); -} diff --git a/src/code/game.c b/src/code/game.c index 4d49db966b..1138d815fd 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -410,7 +410,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g ViMode_Init(&sViMode); } SpeedMeter_Init(&D_801664D0); - func_800AA0B4(); + Rumble_Init(); osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK); endTime = osGetTime(); @@ -431,7 +431,7 @@ void GameState_Destroy(GameState* gameState) { if (gameState->destroy != NULL) { gameState->destroy(gameState); } - func_800AA0F0(); + Rumble_Destroy(); SpeedMeter_Destroy(&D_801664D0); func_800ACE90(&D_801664F0); func_800AD950(&D_80166500); diff --git a/src/code/padmgr.c b/src/code/padmgr.c index b8830d5a20..eb80320383 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -361,7 +361,7 @@ void PadMgr_HandleRetrace(PadMgr* padMgr) { // Execute retrace callback if (padMgr->retraceCallback != NULL) { - padMgr->retraceCallback(padMgr, padMgr->retraceCallbackValue); + padMgr->retraceCallback(padMgr, padMgr->retraceCallbackArg); } // Wait for controller data diff --git a/src/code/sys_rumble.c b/src/code/sys_rumble.c new file mode 100644 index 0000000000..8991f26cbe --- /dev/null +++ b/src/code/sys_rumble.c @@ -0,0 +1,151 @@ +/** + * @file sys_rumble.c + * + * This file implements a manager for storing and processing rumble pak requests made by the game state. Despite some + * parts of the system appearing to accommodate all four controller ports, only controller 1 will rumble according to + * the processed requests. + * This file is half of the system that runs on the padmgr thread alongside controller communications. The rest of the + * system that receives the requests from the game state runs on the graph thread and is implemented in `z_rumble.c`. + * + * @see RumbleMgr + * @see z_rumble.c + * + * @note Original filename is likely sys_vibrate.c or similar as it is ordered after sys_ucode.c + */ +#include "global.h" + +/** + * Rumble manager update, runs on Vertical Retrace on the padmgr thread. + */ +void RumbleMgr_Update(RumbleMgr* rumbleMgr) { + static u8 sWasEnabled = true; + s32 i; + s32 strength; + s32 strongestIndex = -1; + + // Clear enable status for all controllers + for (i = 0; i < MAXCONTROLLERS; i++) { + rumbleMgr->rumbleEnable[i] = false; + } + + if (!rumbleMgr->updateEnabled) { + if (sWasEnabled) { + // If it was previously enabled, reset pak type + for (i = 0; i < MAXCONTROLLERS; i++) { + gPadMgr.pakType[i] = CONT_PAK_NONE; + } + } + sWasEnabled = rumbleMgr->updateEnabled; + return; + } + + sWasEnabled = rumbleMgr->updateEnabled; + + if (rumbleMgr->state == RUMBLE_STATE_RESET) { + // Reset + for (i = 0; i < MAXCONTROLLERS; i++) { + gPadMgr.pakType[i] = CONT_PAK_NONE; + } + + for (i = 0; i < RUMBLE_MAX_REQUESTS; i++) { + rumbleMgr->reqAccumulators[i] = 0; + rumbleMgr->reqDecreaseRates[i] = 0; + rumbleMgr->reqDurations[i] = 0; + rumbleMgr->reqStrengths[i] = 0; + } + + rumbleMgr->onTimer = rumbleMgr->offTimer = rumbleMgr->overrideStrength = rumbleMgr->overrideDuration = + rumbleMgr->overrideDecreaseRate = rumbleMgr->overrideAccumulator = 0; + + rumbleMgr->state = RUMBLE_STATE_RUNNING; + } + + if (rumbleMgr->state != RUMBLE_STATE_CLEAR) { + // Search for index with largest strength + for (i = 0; i < RUMBLE_MAX_REQUESTS; i++) { + if (rumbleMgr->reqStrengths[i] != 0) { + // Non-empty request slot + if (rumbleMgr->reqDurations[i] > 0) { + rumbleMgr->reqDurations[i]--; + } else { + // After duration, decrease the strength by the decrease rate + strength = rumbleMgr->reqStrengths[i] - rumbleMgr->reqDecreaseRates[i]; + rumbleMgr->reqStrengths[i] = MAX(strength, 0); + } + + // Increment accumulator by the strength + strength = rumbleMgr->reqAccumulators[i] + rumbleMgr->reqStrengths[i]; + rumbleMgr->reqAccumulators[i] = strength; + + if (strongestIndex == -1) { + strongestIndex = i; + // Rumble is enabled on the controller only when there is overflow of the accumulator, overflow + // will happen more often for larger request strengths making it feel stronger to the player + rumbleMgr->rumbleEnable[0] = strength > 255; + } else if (rumbleMgr->reqStrengths[i] > rumbleMgr->reqStrengths[strongestIndex]) { + strongestIndex = i; + rumbleMgr->rumbleEnable[0] = strength > 255; + } + } + } + + if (rumbleMgr->overrideStrength != 0) { + // Set override + if (rumbleMgr->overrideDuration > 0) { + rumbleMgr->overrideDuration--; + } else { + // Once the duration is over, start decrementing the strength + strength = rumbleMgr->overrideStrength - rumbleMgr->overrideDecreaseRate; + rumbleMgr->overrideStrength = MAX(strength, 0); + } + // Increment accumulator, set rumble enabled on overflow + strength = rumbleMgr->overrideAccumulator + rumbleMgr->overrideStrength; + rumbleMgr->overrideAccumulator = strength; + rumbleMgr->rumbleEnable[0] = strength > 255; + } + + if (rumbleMgr->overrideStrength != 0) { + strength = rumbleMgr->overrideStrength; + } else { + strength = (strongestIndex == -1) ? 0 : rumbleMgr->reqStrengths[strongestIndex]; + } + + if (strength == 0) { + // No rumble + if ((++rumbleMgr->offTimer) > 5) { + // After 5 VIs with no rumble, reset the rumble on timer + rumbleMgr->onTimer = 0; + rumbleMgr->offTimer = 5; + } + } else { + // Rumble + rumbleMgr->offTimer = 0; + if ((++rumbleMgr->onTimer) > 7200) { // 2 minutes at 60 VI/s, 2 minutes 24 seconds at 50 VI/s + // Clear all requests if rumble has been on for too long + rumbleMgr->state = RUMBLE_STATE_CLEAR; + } + } + } else { + // Clear all requests + for (i = 0; i < RUMBLE_MAX_REQUESTS; i++) { + rumbleMgr->reqAccumulators[i] = 0; + rumbleMgr->reqDecreaseRates[i] = 0; + rumbleMgr->reqDurations[i] = 0; + rumbleMgr->reqStrengths[i] = 0; + } + + // Clear override request + rumbleMgr->onTimer = rumbleMgr->offTimer = rumbleMgr->overrideStrength = rumbleMgr->overrideDuration = + rumbleMgr->overrideDecreaseRate = rumbleMgr->overrideAccumulator = 0; + } +} + +void RumbleMgr_Init(RumbleMgr* rumbleMgr) { + bzero(rumbleMgr, sizeof(RumbleMgr)); + rumbleMgr->state = RUMBLE_STATE_RESET; + rumbleMgr->updateEnabled = true; +} + +void RumbleMgr_Destroy(RumbleMgr* rumbleMgr) { + bzero(rumbleMgr, sizeof(RumbleMgr)); +} diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 5e331cbe4f..ccffed09b8 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3523,9 +3523,9 @@ void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3) { void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3) { if (arg2 >= 5) { - func_800AA000(actor->xyzDistToPlayerSq, 0xFF, 0x14, 0x96); + Rumble_Request(actor->xyzDistToPlayerSq, 255, 20, 150); } else { - func_800AA000(actor->xyzDistToPlayerSq, 0xB4, 0x14, 0x64); + Rumble_Request(actor->xyzDistToPlayerSq, 180, 20, 100); } func_80033DB8(play, arg2, arg3); diff --git a/src/code/z_construct.c b/src/code/z_construct.c index c886bc73a4..7375b14606 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -595,9 +595,11 @@ void func_80111070(void) { VREG(87) = 64; VREG(88) = 66; VREG(89) = 0; - VREG(90) = 126; - VREG(91) = 124; - VREG(92) = -63; + R_GAME_OVER_RUMBLE_STRENGTH = 126; + R_GAME_OVER_RUMBLE_DURATION = 124; + //! @bug This is eventually cast to a u8 after some scaling in `GameOver_Update`, negative numbers typically + //! become large (fast) decrease rates + R_GAME_OVER_RUMBLE_DECREASE_RATE = -63; } void func_80112098(PlayState* play) { diff --git a/src/code/z_debug.c b/src/code/z_debug.c index f268da0d37..45e8dc4df5 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -229,7 +229,7 @@ void func_8006390C(Input* input) { if (iREG(0)) { iREG(0) = 0; - func_800AA000(0, iREG(1), iREG(2), iREG(3)); + Rumble_Request(0.0f, iREG(1), iREG(2), iREG(3)); } break; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index c01ee84080..e1c4f7db39 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -465,7 +465,7 @@ void Cutscene_Command_FadeBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusi // Command 9: ? void Cutscene_Command_09(PlayState* play, CutsceneContext* csCtx, CsCmdUnknown9* cmd) { if (csCtx->frames == cmd->startFrame) { - func_800AA000(0.0f, cmd->unk_06, cmd->unk_07, cmd->unk_08); + Rumble_Request(0.0f, cmd->unk_06, cmd->unk_07, cmd->unk_08); } } diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 388b7ec297..5f72a5aa87 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -20,9 +20,9 @@ void GameOver_Update(PlayState* play) { GameOverContext* gameOverCtx = &play->gameOverCtx; s16 i; s16 j; - s32 v90; - s32 v91; - s32 v92; + s32 rumbleStrength; + s32 rumbleDuration; + s32 rumbleDecreaseRate; switch (gameOverCtx->state) { case GAMEOVER_DEATH_START: @@ -74,13 +74,15 @@ void GameOver_Update(PlayState* play) { Environment_InitGameOverLights(play); gGameOverTimer = 20; - if (1) {} - v90 = VREG(90); - v91 = VREG(91); - v92 = VREG(92); - func_800AA000(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)), - ((v92 > 0x64) ? 0xFF : (v92 * 0xFF) / 0x64)); + if (1) {} + rumbleStrength = R_GAME_OVER_RUMBLE_STRENGTH; + rumbleDuration = R_GAME_OVER_RUMBLE_DURATION; + rumbleDecreaseRate = R_GAME_OVER_RUMBLE_DECREASE_RATE; + + Rumble_Request(0.0f, ((rumbleStrength > 100) ? 255 : (rumbleStrength * 255) / 100), + (CLAMP_MAX(rumbleDuration * 3, 255)), + ((rumbleDecreaseRate > 100) ? 255 : (rumbleDecreaseRate * 255) / 100)); gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; @@ -94,7 +96,7 @@ void GameOver_Update(PlayState* play) { if (gGameOverTimer == 0) { play->pauseCtx.state = 8; gameOverCtx->state++; - func_800AA15C(); + Rumble_Reset(); } break; @@ -108,14 +110,15 @@ void GameOver_Update(PlayState* play) { case GAMEOVER_REVIVE_RUMBLE: gGameOverTimer = 50; gameOverCtx->state++; + if (1) {} + rumbleStrength = R_GAME_OVER_RUMBLE_STRENGTH; + rumbleDuration = R_GAME_OVER_RUMBLE_DURATION; + rumbleDecreaseRate = R_GAME_OVER_RUMBLE_DECREASE_RATE; - v90 = VREG(90); - v91 = VREG(91); - v92 = VREG(92); - - func_800AA000(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)), - ((v92 > 0x64) ? 0xFF : (v92 * 0xFF) / 0x64)); + Rumble_Request(0.0f, ((rumbleStrength > 100) ? 255 : (rumbleStrength * 255) / 100), + (CLAMP_MAX(rumbleDuration * 3, 255)), + ((rumbleDecreaseRate > 100) ? 255 : (rumbleDecreaseRate * 255) / 100)); break; case GAMEOVER_REVIVE_WAIT_GROUND: diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 3eef3457a7..ec49412555 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -437,7 +437,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) } gCustomLensFlareOn = false; - func_800AA15C(); + Rumble_Reset(); } u8 Environment_SmoothStepToU8(u8* pvalue, u8 target, u8 scale, u8 step, u8 minStep) { @@ -883,7 +883,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) && (((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) { - func_800AA16C(); + Rumble_ClearRequests(); } if (pauseCtx->state == 0) { diff --git a/src/code/z_play.c b/src/code/z_play.c index b191dd1cfa..f501a93cf9 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -852,7 +852,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3580); this->gameplayFrames++; - func_800AA178(1); + Rumble_SetUpdateEnabled(true); if (this->actorCtx.freezeFlashTimer && (this->actorCtx.freezeFlashTimer-- < 5)) { osSyncPrintf("FINISH=%d\n", this->actorCtx.freezeFlashTimer); @@ -902,7 +902,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3662); } } else { - func_800AA178(0); + Rumble_SetUpdateEnabled(false); } PLAY_LOG(3672); diff --git a/src/code/z_rumble.c b/src/code/z_rumble.c new file mode 100644 index 0000000000..49a54e7aab --- /dev/null +++ b/src/code/z_rumble.c @@ -0,0 +1,135 @@ +/** + * @file z_rumble.c + * + * This file implements an interface for the game state to set up, manage and request use of the rumble pak. Despite + * some parts of the system appearing to accommodate all four controller ports, only controller 1 can be instructed + * to rumble. + * This file is half of the system that runs on the graph thread alongside the game state. The rest of the system that + * processes the requests runs on the padmgr thread and is implemented in `sys_rumble.c`. + * + * @see sys_rumble.c + * + * @note Original filename is likely z_vibrate.c or similar as it is ordered after z_ss_sram.c and before z_view.c + */ +#include "global.h" + +RumbleMgr sRumbleMgr; + +/** + * Padmgr callback to update the state of rumble on Vertical Retrace. + * + * Unlike every other function in this file, this runs on the padmgr thread. + */ +void Rumble_Update(PadMgr* padMgr, void* arg) { + RumbleMgr_Update(&sRumbleMgr); + PadMgr_RumbleSet(padMgr, sRumbleMgr.rumbleEnable); +} + +/** + * Forces the rumble state to use the supplied parameters. + * The parameters are the same as in `Rumble_Request`. + * + * @see Rumble_Request + */ +void Rumble_Override(f32 distSq, u8 sourceStrength, u8 duration, u8 decreaseRate) { + s32 dist; + s32 strength; + + if (distSq > SQ(1000)) { + dist = 1000; + } else { + dist = sqrtf(distSq); + } + + if (dist < 1000 && sourceStrength != 0 && decreaseRate != 0) { + // Decrease the strength linearly with distance + strength = sourceStrength - (dist * 255) / 1000; + + if (strength > 0) { + // Note: sRumbleMgr is a shared resource between the graph and padmgr threads, no locking is done + // to ensure that the entire request is written before it is possibly used. + sRumbleMgr.overrideStrength = strength; + sRumbleMgr.overrideDuration = duration; + sRumbleMgr.overrideDecreaseRate = decreaseRate; + } + } +} + +/** + * Submits a request to the rumble manager with the properties given in the arguments. If there is no free request slot + * the request is silently dropped. + * + * @param distSq + * Squared distance, usually taken to be from an apparent source to the player in world coordinates. + * @param sourceStrength + * The strength of the rumble at 0 distance from the source. + * The rumble source strength decreases linearly with distance, a distance of 0 results in the full source strength + * while a distance of 1000 or greater is discarded. A source strength of 0 is discarded. A minimum source strength + * of 1 drops to 0 at 3 units of distance from the source. A maximum source strength of 255 drops to 0 at 1000 + * units of distance from the source. + * Note that, once the request has been submitted, if the distance to the source changes in subsequent frames while + * the rumble request is still running, the request will not be updated with the new distance. + * @param duration + * The duration for which the rumble will sustain full strength. It is measured in Vertical Retraces rather than + * game frames. There are ~60 Retraces/s on NTSC and 50 Retraces/s on PAL. + * @param decreaseRate + * The amount by which to lower the strength every Vertical Retrace once duration has hit 0. + */ +void Rumble_Request(f32 distSq, u8 sourceStrength, u8 duration, u8 decreaseRate) { + s32 dist; + s32 strength; + s32 i; + + if (distSq > SQ(1000)) { + dist = 1000; + } else { + dist = sqrtf(distSq); + } + + if (dist < 1000 && sourceStrength != 0 && decreaseRate != 0) { + // Decrease the strength linearly with distance + strength = sourceStrength - (dist * 255) / 1000; + + for (i = 0; i < RUMBLE_MAX_REQUESTS; i++) { + // Search for an empty slot + if (sRumbleMgr.reqStrengths[i] == 0) { + if (strength > 0) { + // Note: sRumbleMgr is a shared resource between the graph and padmgr threads, no locking is done + // to ensure that the entire request is written before it is possibly used. + sRumbleMgr.reqStrengths[i] = strength; + sRumbleMgr.reqDurations[i] = duration; + sRumbleMgr.reqDecreaseRates[i] = decreaseRate; + } + break; + } + } + } +} + +void Rumble_Init(void) { + RumbleMgr_Init(&sRumbleMgr); + PADMGR_SET_RETRACE_CALLACK(&gPadMgr, Rumble_Update, NULL); +} + +void Rumble_Destroy(void) { + PadMgr* padmgr = &gPadMgr; + + PADMGR_UNSET_RETRACE_CALLACK(padmgr, Rumble_Update, NULL); + RumbleMgr_Destroy(&sRumbleMgr); +} + +s32 Rumble_Controller1HasRumblePak(void) { + return gPadMgr.pakType[0] == CONT_PAK_RUMBLE; +} + +void Rumble_Reset(void) { + sRumbleMgr.state = RUMBLE_STATE_RESET; +} + +void Rumble_ClearRequests(void) { + sRumbleMgr.state = RUMBLE_STATE_CLEAR; +} + +void Rumble_SetUpdateEnabled(u32 enable) { + sRumbleMgr.updateEnabled = !!enable; +} diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index 60b600dcea..3a246de55e 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -182,7 +182,7 @@ void func_8086C054(BgBdanObjects* this, PlayState* play) { player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3300.0f; - func_800AA000(0.0f, 0xFF, 0x14, 0x96); + Rumble_Request(0.0f, 255, 20, 150); } } else if (this->timer != 0) { if (this->timer != 0) { @@ -207,13 +207,13 @@ void func_8086C1A0(BgBdanObjects* this, PlayState* play) { this->actionFunc = func_8086C29C; this->timer = 30; BgBdanObjects_SetContactRu1(this, 2); - func_800AA000(0.0f, 0xFF, 0x14, 0x96); + Rumble_Request(0.0f, 255, 20, 150); } else { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - func_800AA000(0.0f, 0x78, 0x14, 0xA); + Rumble_Request(0.0f, 120, 20, 10); this->timer = 11; } func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_RISING - SFX_FLAG); @@ -261,14 +261,14 @@ void func_8086C3D8(BgBdanObjects* this, PlayState* play) { player->actor.world.pos.z = -3500.0f; player->actor.shape.rot.y = 0x7530; player->actor.world.rot.y = player->actor.shape.rot.y; - func_800AA000(0.0f, 0xFF, 0x1E, 0x96); + Rumble_Request(0.0f, 255, 30, 150); } else { func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG); if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - func_800AA000(0.0f, 0x78, 0x14, 0xA); + Rumble_Request(0.0f, 120, 20, 10); this->timer = 11; } if (this->dyna.actor.child != NULL) { diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index c86e52d15f..dcde8ae0f1 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -273,7 +273,7 @@ void func_8086D694(BgBdanSwitch* this, PlayState* play) { if (this->unk_1C8 <= 0.1f) { func_8086D730(this); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH); - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } } } @@ -336,7 +336,7 @@ void func_8086D8CC(BgBdanSwitch* this, PlayState* play) { if (this->unk_1C8 <= 0.6f) { func_8086D9F8(this); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH); - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } } @@ -351,7 +351,7 @@ void func_8086D95C(BgBdanSwitch* this, PlayState* play) { if (this->unk_1C8 <= 0.1f) { func_8086DB24(this); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH); - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } } } diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index 118792ffc9..13002a1bed 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -127,7 +127,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) { f32 effectStrength; Math_SmoothStepToF(&this->dyna.actor.speedXZ, 4.0f, 0.5f, 0.025f, 0.0f); - func_800AA000(500.0f, 0x78, 0x14, 0xA); + Rumble_Request(500.0f, 120, 20, 10); if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 200.0f - 20.0f, 0.075f, this->dyna.actor.speedXZ, 0.0075f) == 0.0f) { diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 50052e3218..8427de56fc 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -244,7 +244,7 @@ void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play) { BgDodoago_SpawnSparkles(&pos, play); Math_StepToS(&this->state, 100, 3); - func_800AA000(500.0f, 0x78, 0x14, 0xA); + Rumble_Request(500.0f, 120, 20, 10); if (Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, 0x1333, 110 - this->state, 0x3E8, 0x32) == 0) { BgDodoago_SetupAction(this, BgDodoago_DoNothing); diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 50c358532f..09ae894532 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -189,7 +189,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, PlayState* play) { thisx->velocity.z = Rand_CenteredFloat(8.0f); BgHeavyBlock_SetPieceRandRot(this, 1.0f); Audio_PlayActorSfx2(thisx, NA_SE_EV_ROCK_BROKEN); - func_800AA000(thisx->xzDistToPlayer, 0x96, 0xA, 8); + Rumble_Request(thisx->xzDistToPlayer, 150, 10, 8); } } @@ -348,7 +348,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, PlayState* play) { f32 xOffset; if (this->timer == 11) { - func_800AA000(0.0f, 0xFF, 0x14, 0x14); + Rumble_Request(0.0f, 255, 20, 20); func_8002F7DC(&player->actor, NA_SE_PL_PULL_UP_BIGROCK); LOG_STRING("NA_SE_PL_PULL_UP_BIGROCK", "../z_bg_heavy_block.c", 691); } @@ -390,7 +390,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) { this->dyna.actor.floorHeight = yIntersect; if (this->dyna.actor.home.pos.y <= yIntersect) { - func_800AA000(0.0f, 0xFF, 0x3C, 4); + Rumble_Request(0.0f, 255, 60, 4); switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BREAKABLE: diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 65dd3835e3..89e35e26b8 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -313,7 +313,7 @@ void func_80888860(BgHidanHamstep* this, PlayState* play) { Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0); Quake_SetCountdown(quakeIndex, 20); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 255, 20, 150); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 255, 20, 150); func_80888638(this, play); osSyncPrintf("A(%d)\n", this->dyna.actor.params); } @@ -373,7 +373,7 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { Quake_SetCountdown(quakeIndex, 7); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - func_800AA000(10000.0f, 255, 20, 150); + Rumble_Request(SQ(100.0f), 255, 20, 150); func_808884C8(this, play); if ((this->dyna.actor.params & 0xFF) == 5) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index 37868fff61..4d86d48545 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -161,7 +161,7 @@ void func_808894B0(BgHidanHrock* this, PlayState* play) { (Math_CosS(this->dyna.actor.world.rot.y + (this->unk_168 << 0xE)) * 5.0f) + this->dyna.actor.home.pos.z; if (!(this->unk_168 % 4)) { - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 180, 10, 100); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 10, 100); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_SHAKE); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index be72c84868..a624b7084a 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -233,7 +233,7 @@ void func_8088B69C(BgHidanRock* this, PlayState* play) { } if (!(this->timer % 4)) { - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x0A, 0x64); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 10, 100); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_SHAKE); } } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index 180ab558c8..8ee7ed17ce 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -143,7 +143,7 @@ void func_8088E5D0(BgHidanSima* this, PlayState* play) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; } if (!(this->timer % 4)) { - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 180, 10, 100); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 10, 100); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_SHAKE); } } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c index 2377320e5b..0855aca933 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c @@ -128,7 +128,7 @@ void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play) { if ((this->dyna.actor.world.pos.x == this->closedPos.x) && (this->dyna.actor.world.pos.y == this->closedPos.y) && (this->dyna.actor.world.pos.z == this->closedPos.z)) { - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); this->actionFunc = BgMizuShutter_WaitForSwitch; } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 6dfa50286a..0e9dcd2653 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -282,10 +282,10 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, PlayState* play) { } if (this->targetY < this->actor.world.pos.y) { - func_800AA000(0.0f, 0x78, 0x14, 0xA); + Rumble_Request(0.0f, 120, 20, 10); func_8002F948(&this->actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } else if (this->targetY > this->actor.world.pos.y) { - func_800AA000(0.0f, 0x78, 0x14, 0xA); + Rumble_Request(0.0f, 120, 20, 10); func_8002F948(&this->actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index d2c542b9ee..fc8d312138 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -156,7 +156,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play) { if (this->bounceCount == 0) { this->fallCount++; func_800788CC(NA_SE_EV_STONE_BOUND); - func_800AA000(SQ(thisx->yDistToPlayer), 0xFF, 0x14, 0x96); + Rumble_Request(SQ(thisx->yDistToPlayer), 255, 20, 150); } thisx->world.pos.y = 403.0f - (thisx->world.pos.y - 403.0f) * bounceVel[this->bounceCount] / fabsf(thisx->velocity.y); diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index e4b7dbb44d..c13711fa67 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -145,7 +145,7 @@ void func_808A91AC(BgRelayObjects* this, PlayState* play) { void func_808A9234(BgRelayObjects* this, PlayState* play) { this->dyna.actor.velocity.y += this->dyna.actor.gravity; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); if (this->unk_169 != play->roomCtx.curRoom.num) { func_800788CC(NA_SE_EN_PO_LAUGH); diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 66e9d3d103..d071e3a325 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -680,7 +680,7 @@ void BossDodongo_Walk(BossDodongo* this, PlayState* play) { func_80033E88(&this->actor, play, 4, 10); } else { this->unk_1B6 = 10; - func_800A9F6C(0.0f, 180, 20, 100); + Rumble_Override(0.0f, 180, 20, 100); } } } diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 79d09fe1cf..371330da66 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -3944,7 +3944,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_REFLECT_MG, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(this->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); } else { spBA = 1; this->actor.world.rot.y = Math_Atan2S(zDistFromGanondorf, xDistFromGanondorf); @@ -3955,7 +3955,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { Audio_PlaySfxGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); if (hitWithBottle == false) { // if ganondorf is 250 units away from link, at least 3 volleys are required @@ -4424,7 +4424,7 @@ void func_808E2544(Actor* thisx, PlayState* play) { this->collider.base.acFlags &= ~AC_HIT; if (!(acHitInfo->toucher.dmgFlags & DMG_SHIELD) || Player_HasMirrorShieldEquipped(play)) { - func_800AA000(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); this->unk_1C2 = 0xC; this->actor.speedXZ = -30.0f; diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 48644ffd13..51ec679480 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -431,7 +431,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { if (this->unk_398 == 30) { D_80906D78 = 1; this->unk_314 = 1; - func_800A9F6C(0.0f, 0xC8, 0x14, 0x14); + Rumble_Override(0.0f, 200, 20, 20); } if (this->unk_398 == 30) { func_80078884(NA_SE_EV_GRAVE_EXPLOSION); @@ -643,7 +643,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { this->actor.velocity.y = 0.0f; Animation_MorphToPlayOnce(&this->skelAnime, &gGanonUncurlAndFlailAnim, 0.0f); func_808FD4D4(this, play, 0, 3); - func_800A9F6C(0.0f, 0xC8, 0x14, 0x14); + Rumble_Override(0.0f, 200, 20, 20); } break; case 21: @@ -720,7 +720,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { if (this->unk_398 == 228) { func_80078884(NA_SE_IT_SHIELD_REFLECT_SW); func_8002DF54(play, &this->actor, 0x56); - func_800A9F6C(0.0f, 0xFF, 0xA, 0x32); + Rumble_Override(0.0f, 255, 10, 50); } if (this->unk_398 >= 229) { play->envCtx.fillScreen = true; @@ -924,7 +924,7 @@ void func_808FF898(BossGanon2* this, PlayState* play) { sp28.z = 1.0f; Matrix_MultVec3f(&sp28, &gj->unk_26C); gj->killFlag = true; - func_800A9F6C(0.0f, 0x96, 0x14, 0x32); + Rumble_Override(0.0f, 150, 20, 50); this->unk_392 = 6; return; } diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 6d6b79370b..391a1026e9 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -890,7 +890,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { this->currentAnimFrameCount = Animation_GetLastFrame(&gGohmaInitialLandingAnim); BossGoma_PlayEffectsAndSfx(this, play, 0, 5); this->framesUntilNextAction = 15; - func_800A9F6C(0.0f, 0xC8, 0x14, 0x14); + Rumble_Override(0.0f, 200, 20, 20); } break; @@ -1000,7 +1000,7 @@ void BossGoma_Defeated(BossGoma* this, PlayState* play) { if (Animation_OnFrame(&this->skelanime, 107.0f)) { BossGoma_PlayEffectsAndSfx(this, play, 0, 8); - func_800A9F6C(0.0f, 0x96, 0x14, 0x14); + Rumble_Override(0.0f, 150, 20, 20); } this->visualState = VISUALSTATE_DEFEATED; diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index ff4c0094f1..a2184614d4 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -504,7 +504,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { swingSizeAccel = 60.0f; if ((this->sfxTimer % 32) == 0) { Audio_PlaySfxIncreasinglyTransposed(&this->tentTipPos, NA_SE_EN_MOFER_WAVE, gMorphaTransposeTable); - func_800AA000(0, 100, 5, 2); + Rumble_Request(0, 100, 5, 2); func_8002F7DC(&player->actor, NA_SE_VO_LI_FREEZE + player->ageProperties->unk_92); } } else { @@ -518,7 +518,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { swingSizeAccel = 70.0f; if ((this->sfxTimer % 16) == 0) { Audio_PlaySfxIncreasinglyTransposed(&this->tentTipPos, NA_SE_EN_MOFER_WAVE, gMorphaTransposeTable); - func_800AA000(0, 160, 5, 4); + Rumble_Request(0, 160, 5, 4); func_8002F7DC(&player->actor, NA_SE_VO_LI_FREEZE + player->ageProperties->unk_92); } } diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 6c92dc49f3..4d728c3f99 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -433,7 +433,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) { if (!this->ready) { sFloor->dyna.actor.params = BONGOFLOOR_HIT; this->ready = true; - func_800AA000(this->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); Audio_PlayActorSfx2(&sFloor->dyna.actor, NA_SE_EN_SHADEST_TAIKO_HIGH); } else if (GET_EVENTCHKINF(EVENTCHKINF_77)) { sHands[RIGHT]->actor.draw = BossSst_DrawHand; @@ -1282,7 +1282,7 @@ void BossSst_HandDownbeat(BossSst* this, PlayState* play) { } else { BossSst_HandSetupDownbeatEnd(this); } - func_800AA000(this->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); Audio_PlayActorSfx2(&this->actor, NA_SE_EN_SHADEST_TAIKO_HIGH); } } diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index fed332efcb..b21d10703c 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -1118,7 +1118,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) { this->groundBlastPos.y = 0.0f; this->groundBlastPos.z = 0.0f; play->envCtx.lightBlend = 1.0f; - func_800AA000(0.0f, 0x64, 5, 4); + Rumble_Request(0.0f, 100, 5, 4); } else if (beamReflection == 0) { BossTw_BeamHitPlayerCheck(this, play); @@ -4328,7 +4328,7 @@ s32 BossTw_BlastShieldCheck(BossTw* this, PlayState* play) { if (info->toucher.dmgFlags & DMG_SHIELD) { this->work[INVINC_TIMER] = 7; play->envCtx.lightBlend = 1.0f; - func_800AA000(0.0f, 100, 5, 4); + Rumble_Request(0.0f, 100, 5, 4); if (Player_HasMirrorShieldEquipped(play)) { if (this->blastType == 1) { diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index a1c1dd14db..7f45c38fd6 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -32,7 +32,7 @@ void DemoGt_PlayExplosion2Sfx(PlayState* play, Vec3f* pos) { } void DemoGt_Rumble(PlayState* play) { - func_800AA000(0.0f, 0x32, 0xA, 5); + Rumble_Request(0.0f, 50, 10, 5); } void DemoGt_SpawnDust(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 scaleStep, s16 life) { diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 77cc315c5e..93bc4b21d3 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -576,7 +576,7 @@ void func_809973E8(DoorShutter* this, PlayState* play) { Quake_SetSpeed(quakeId, -32536); Quake_SetQuakeValues(quakeId, 2, 0, 0, 0); Quake_SetCountdown(quakeId, 10); - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100); func_80997220(this, play); } } @@ -769,7 +769,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) { void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 camId) { s16 quakeId = Quake_Add(Play_GetCamera(play, camId), 3); - func_800A9F6C(0.0f, 180, 20, 100); + Rumble_Override(0.0f, 180, 20, 100); Quake_SetSpeed(quakeId, 20000); Quake_SetQuakeValues(quakeId, y, 0, 0, 0); Quake_SetCountdown(quakeId, countdown); diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index c6a9f89a88..9c2f3dc7a5 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -435,7 +435,7 @@ void func_809BD8DC(EnBigokuta* this, PlayState* play) { EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 2000); Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DAIOCTA_LAND_WATER); Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GOLON_LAND_BIG); - func_800AA000(0.0f, 0xFF, 0x14, 0x96); + Rumble_Request(0.0f, 255, 20, 150); } } else if (this->unk_196 < -1) { this->actor.world.pos.y = this->actor.home.pos.y - (sinf((this->unk_196 + 1) * (M_PI / 10)) * 20.0f); diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 85b390822d..445250e8d5 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -170,7 +170,7 @@ void EnBom_Explode(EnBom* this, PlayState* play) { if (this->explosionCollider.elements[0].dim.modelSphere.radius == 0) { this->actor.flags |= ACTOR_FLAG_5; - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); } this->explosionCollider.elements[0].dim.worldSphere.radius += this->actor.shape.rot.z + 8; diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index b9ddf45ba0..b7ca309528 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -261,7 +261,7 @@ void EnBombf_Explode(EnBombf* this, PlayState* play) { if (this->explosionCollider.elements[0].dim.modelSphere.radius == 0) { this->actor.flags |= ACTOR_FLAG_5; - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); } this->explosionCollider.elements[0].dim.modelSphere.radius += 8; diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index eeb95d2b1d..d9fb15c80f 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -496,7 +496,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_REFLECT_MG, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(this->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); } else { if (bossGnd->flyMode == GND_FLY_NEUTRAL) { angleModX = Rand_CenteredFloat(0x2000); @@ -525,7 +525,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); } } else if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) { killMode = BALL_BURST; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 982a95d3f3..5d05a3f526 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -1312,7 +1312,7 @@ void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.375f; if (SkelAnime_Update(&this->skin.skelAnime)) { EnHorse_PlayTrottingSfx(this); - func_800AA000(0.0f, 60, 8, 255); + Rumble_Request(0.0f, 60, 8, 255); if (this->actor.speedXZ >= 6.0f) { EnHorse_StartGallopingInterruptable(this); } else if (this->actor.speedXZ < 3.0f) { @@ -1380,7 +1380,7 @@ void EnHorse_MountedGallop(EnHorse* this, PlayState* play) { this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; if (SkelAnime_Update(&this->skin.skelAnime)) { EnHorse_PlayGallopingSfx(this); - func_800AA000(0, 120, 8, 255); + Rumble_Request(0, 120, 8, 255); if (EnHorse_PlayerCanMove(this, play) == true) { if (stickMag >= 10.0f && Math_CosS(stickAngle) <= -0.5f) { EnHorse_StartBraking(this, play); @@ -1404,7 +1404,7 @@ void EnHorse_StartRearing(EnHorse* this) { Audio_PlaySfxGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_21C, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - func_800AA000(0.0f, 180, 20, 100); + Rumble_Request(0.0f, 180, 20, 100); Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } @@ -1413,13 +1413,13 @@ void EnHorse_MountedRearing(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; - this->actor.speedXZ = 0; + this->actor.speedXZ = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND2, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0, 180, 20, 100); + Rumble_Request(0.0f, 180, 20, 100); } } @@ -1476,7 +1476,7 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_21C, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - func_800AA000(0.0f, 180, 20, 100); + Rumble_Request(0.0f, 180, 20, 100); this->stateFlags &= ~ENHORSE_STOPPING_NEIGH_SOUND; } else { EnHorse_StartMountedIdleResetAnim(this); @@ -1607,7 +1607,7 @@ void EnHorse_StartLowJump(EnHorse* this, PlayState* play) { Audio_PlaySfxGeneral(NA_SE_EV_HORSE_JUMP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 170, 10, 10); + Rumble_Request(0.0f, 170, 10, 10); } void EnHorse_Stub1(EnHorse* this) { @@ -1642,7 +1642,7 @@ void EnHorse_LowJump(EnHorse* this, PlayState* play) { (curFrame > 17.0f && this->actor.world.pos.y < this->actor.floorHeight - this->actor.velocity.y + 80.0f)) { Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 255, 10, 80); + Rumble_Request(0.0f, 255, 10, 80); this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; @@ -1682,7 +1682,7 @@ void EnHorse_StartHighJump(EnHorse* this, PlayState* play) { this->stateFlags |= ENHORSE_CALC_RIDER_POS; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_JUMP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 170, 10, 10); + Rumble_Request(0.0f, 170, 10, 10); } void EnHorse_Stub2(EnHorse* this) { @@ -1718,7 +1718,7 @@ void EnHorse_HighJump(EnHorse* this, PlayState* play) { (curFrame > 23.0f && this->actor.world.pos.y < this->actor.floorHeight - this->actor.velocity.y + 80.0f)) { Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 255, 10, 80); + Rumble_Request(0.0f, 255, 10, 80); this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; @@ -2142,7 +2142,7 @@ void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* act if (SkelAnime_Update(&this->skin.skelAnime)) { EnHorse_PlayGallopingSfx(this); - func_800AA000(0.0f, 120, 8, 255); + Rumble_Request(0.0f, 120, 8, 255); Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], this->actor.speedXZ * 0.3f); } @@ -2174,7 +2174,7 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play) { this->stateFlags |= ENHORSE_CALC_RIDER_POS; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_JUMP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 170, 10, 10); + Rumble_Request(0.0f, 170, 10, 10); } void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { @@ -2219,7 +2219,7 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->cutsceneFlags |= 1; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 255, 10, 80); + Rumble_Request(0.0f, 255, 10, 80); this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.velocity.y = 0; @@ -2303,7 +2303,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* if (SkelAnime_Update(&this->skin.skelAnime)) { EnHorse_PlayGallopingSfx(this); - func_800AA000(0.0f, 120, 8, 255); + Rumble_Request(0.0f, 120, 8, 255); Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], this->actor.speedXZ * 0.3f); } @@ -2487,12 +2487,12 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { animSpeed = this->actor.speedXZ * 0.25f; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_RUN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 60, 8, 255); + Rumble_Request(0.0f, 60, 8, 255); } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_RUN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 120, 8, 255); + Rumble_Request(0.0f, 120, 8, 255); } else { animSpeed = 1.0f; } @@ -2766,7 +2766,7 @@ void EnHorse_BridgeJumpInit(EnHorse* this, PlayState* play) { } Audio_PlaySfxGeneral(NA_SE_EV_HORSE_JUMP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 170, 10, 10); + Rumble_Request(0.0f, 170, 10, 10); this->postDrawFunc = NULL; } @@ -2816,7 +2816,7 @@ void EnHorse_CheckBridgeJumpLanding(EnHorse* this, PlayState* play) { EnHorse_JumpLanding(this, play); Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - func_800AA000(0.0f, 255, 10, 80); + Rumble_Request(0.0f, 255, 10, 80); } } @@ -3321,7 +3321,7 @@ void EnHorse_CheckBoost(EnHorse* thisx, PlayState* play2) { if (!(this->stateFlags & ENHORSE_BOOST) && !(this->stateFlags & ENHORSE_FLAG_8) && !(this->stateFlags & ENHORSE_FLAG_9)) { if (this->numBoosts > 0) { - func_800AA000(0.0f, 180, 20, 100); + Rumble_Request(0.0f, 180, 20, 100); this->stateFlags |= ENHORSE_BOOST; this->stateFlags |= ENHORSE_FIRST_BOOST_REGEN; this->stateFlags |= ENHORSE_FLAG_8; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 7834a2bd8a..31b3acf0ce 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -428,7 +428,7 @@ void func_80A74EBC(EnIk* this, PlayState* play) { sp2C.y = this->actor.world.pos.y; Audio_PlayActorSfx2(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); Camera_AddQuake(&play->mainCamera, 2, 0x19, 5); - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); CollisionCheck_SpawnShieldParticles(play, &sp2C); } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 5b24bc47e5..851cf501a4 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -436,7 +436,7 @@ void EnIshi_Fly(EnIshi* this, PlayState* play) { Quake_SetSpeed(quakeIdx, -0x3CB0); Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0); Quake_SetCountdown(quakeIdx, 7); - func_800AA000(this->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); } Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 3b2f699e1b..264bb6805f 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -173,7 +173,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { } if (player->unk_858 >= 0.1f) { - func_800AA000(0.0f, (s32)(player->unk_858 * 150.0f) & 0xFF, 2, (s32)(player->unk_858 * 150.0f) & 0xFF); + Rumble_Request(0.0f, (s32)(player->unk_858 * 150.0f), 2, (s32)(player->unk_858 * 150.0f)); } if (player->stateFlags2 & PLAYER_STATE2_17) { diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 56d839f399..195ed29bd2 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -858,7 +858,7 @@ void EnMb_ClubAttack(EnMb* this, PlayState* play) { effSpawnPos = this->effSpawnPos; effSpawnPos.y = this->actor.floorHeight; Audio_PlayActorSfx2(&this->actor, NA_SE_EN_MONBLIN_HAM_LAND); - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); EffectSsBlast_SpawnWhiteShockwave(play, &effSpawnPos, &effWhiteShockwaveDynamics, &effWhiteShockwaveDynamics); func_80033480(play, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1); @@ -1043,7 +1043,7 @@ void EnMb_ClubDamaged(EnMb* this, PlayState* play) { if (this->timer3 != 0) { Animation_PlayOnce(&this->skelAnime, &gEnMbClubStandUpAnim); this->timer3 = 0; - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); Camera_AddQuake(&play->mainCamera, 2, 25, 5); } else { EnMb_SetupClubWaitPlayerNear(this); @@ -1102,7 +1102,7 @@ void EnMb_ClubDead(EnMb* this, PlayState* play) { Actor_Kill(&this->actor); } } else if ((s32)this->skelAnime.curFrame == 15 || (s32)this->skelAnime.curFrame == 22) { - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); Actor_SpawnFloorDustRing(play, &this->actor, &effPos, 50.0f, 10, 3.0f, 400, 60, false); Audio_PlayActorSfx2(&this->actor, NA_SE_EN_RIZA_DOWN); Camera_AddQuake(&play->mainCamera, 2, 25, 5); diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 8e96625d4c..67567ed167 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -363,7 +363,7 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { player->actor.freezeTimer = 40; func_8008EEAC(play, &this->actor); GET_PLAYER(play)->unk_684 = &this->actor; - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); } this->playerStunWaitTimer = 60; @@ -525,7 +525,7 @@ void EnRd_Grab(EnRd* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &gGibdoRedeadGrabAttackAnim); this->grabState++; play->damagePlayer(play, -8); - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 1, 0xC); + Rumble_Request(this->actor.xzDistToPlayer, 255, 1, 12); this->grabDamageTimer = 20; FALLTHROUGH; case REDEAD_GRAB_START: @@ -561,7 +561,7 @@ void EnRd_Grab(EnRd* this, PlayState* play) { this->grabDamageTimer--; if (this->grabDamageTimer == 0) { play->damagePlayer(play, -8); - func_800AA000(this->actor.xzDistToPlayer, 0xF0, 1, 0xC); + Rumble_Request(this->actor.xzDistToPlayer, 240, 1, 12); this->grabDamageTimer = 20; func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92); } @@ -603,7 +603,7 @@ void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play) { if (ABS(yaw) < 0x2008) { if (!(this->rdFlags & 0x80)) { player->actor.freezeTimer = 60; - func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); + Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); func_8008EEAC(play, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 75908ef3c1..6d1061ecad 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -622,7 +622,7 @@ void EnRr_Reach(EnRr* this, PlayState* play) { void EnRr_GrabPlayer(EnRr* this, PlayState* play) { Player* player = GET_PLAYER(play); - func_800AA000(this->actor.xyzDistToPlayerSq, 120, 2, 120); + Rumble_Request(this->actor.xyzDistToPlayerSq, 120, 2, 120); if ((this->frameCount % 8) == 0) { Audio_PlayActorSfx2(&this->actor, NA_SE_EN_LIKE_EAT); } diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 4e118e2ace..3b925d3615 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -921,7 +921,7 @@ s32 EnZl4_CsLookWindow(EnZl4* this, PlayState* play) { play->csCtx.state = CS_STATE_UNSKIPPABLE_INIT; } } else { - func_800AA000(0.0f, 0xA0, 0xA, 0x28); + Rumble_Request(0.0f, 160, 10, 40); func_8002DF54(play, &this->actor, 1); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_30); EnZl4_SetActiveCamDir(play, 11); diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index a1bd4e0b71..420cb29780 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -3486,7 +3486,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } D_80B7E122 = phi_v0; D_80B7E0A4 = phi_v0; - func_800A9F6C(0.0f, 60, phi_v0 * 3, 10); + Rumble_Override(0.0f, 60, phi_v0 * 3, 10); } else { if (this->unk_1AC > 70.0f) { phi_v0 = (s16)Rand_ZeroFloat(5.0f) + 10; @@ -3499,7 +3499,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } D_80B7E122 = phi_v0; D_80B7E0A4 = phi_v0; - func_800A9F6C(0.0f, 180, phi_v0 * 3, 10); + Rumble_Override(0.0f, 180, phi_v0 * 3, 10); } D_80B7E124 = 0; @@ -3541,11 +3541,11 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { if (D_80B7E0B6 == 2) { D_80B7E122 = 30; D_80B7E0A4 = 100; - func_800A9F6C(0.0f, 60, 90, 10); + Rumble_Override(0.0f, 60, 90, 10); } else { D_80B7E122 = 30; D_80B7E0A4 = 40; - func_800A9F6C(0.0f, 180, 90, 10); + Rumble_Override(0.0f, 180, 90, 10); } D_80B7E124 = 0; @@ -3598,7 +3598,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { spA4 = 255.0f; } - func_800A9F6C(0.0f, spA4, 120, 5); + Rumble_Override(0.0f, spA4, 120, 5); D_80B7E0A4 = 40; D_80B7FDA8 = 10; func_80078884(NA_SE_IT_FISHING_HIT); @@ -3629,7 +3629,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { spA4 *= 3.0f / 4.0f; } - func_800A9F6C(0.0f, spA4, (s16)Rand_ZeroFloat(5.0f) + 10, 5); + Rumble_Override(0.0f, spA4, (s16)Rand_ZeroFloat(5.0f) + 10, 5); } if (this->unk_17A[1] > 30) { @@ -3660,7 +3660,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } else { phi_a1 = 180; } - func_800A9F6C(0.0f, phi_a1, 90, 2); + Rumble_Override(0.0f, phi_a1, 90, 2); this->unk_17A[0] = 20; this->unk_17A[1] = 100; this->unk_17A[2] = 20; @@ -3790,7 +3790,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } } else { D_80B7E086 = 0x4082; - func_800A9F6C(0.0f, 1, 3, 1); + Rumble_Override(0.0f, 1, 3, 1); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x0A00FF); } @@ -3813,7 +3813,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_158 = 6; this->unk_17A[0] = 100; player->unk_860 = 3; - func_800A9F6C(0.0f, 1, 3, 1); + Rumble_Override(0.0f, 1, 3, 1); D_80B7E084++; func_80064520(play, &play->csCtx); D_80B7A6CC = 100; @@ -4761,7 +4761,7 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { case 0: if (gSaveContext.rupees >= 20) { Rupees_ChangeBy(-20); - if (func_800AA148() == 0) { + if (!Rumble_Controller1HasRumblePak()) { this->actor.textId = 0x407C; } else { this->actor.textId = 0x407D; @@ -5204,7 +5204,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { (fabsf(player->actor.world.pos.z - sSinkingLureLocationPos[sSinkingLureLocation - 1].z) < 25.0f)) { sSinkingLureLocation = 0; D_80B7A6CC = 20; - func_800A9F6C(0.0f, 150, 10, 10); + Rumble_Override(0.0f, 150, 10, 10); func_80078884(NA_SE_SY_TRE_BOX_APPEAR); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x1400FF); } @@ -5213,7 +5213,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { KREG(0) = 0; D_80B7E0B6 = 0; D_80B7A6CC = 20; - func_800A9F6C(0.0f, 150, 10, 10); + Rumble_Override(0.0f, 150, 10, 10); func_80078884(NA_SE_SY_TRE_BOX_APPEAR); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x1400FF); } @@ -5373,7 +5373,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamAt.z = mainCam->at.z; Message_StartTextbox(play, 0x409E, NULL); D_80B7A6CC = 11; - func_800A9F6C(0.0f, 150, 10, 10); + Rumble_Override(0.0f, 150, 10, 10); FALLTHROUGH; } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 43d4c81ae2..9350abd773 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -426,7 +426,7 @@ void ObjSwitch_FloorPress(ObjSwitch* this, PlayState* play) { if (this->dyna.actor.scale.y <= 33.0f / 2000.0f) { ObjSwitch_FloorDownInit(this); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH); - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } } } @@ -484,7 +484,7 @@ void ObjSwitch_FloorRelease(ObjSwitch* this, PlayState* play) { ObjSwitch_FloorUpInit(this); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH); if (subType == OBJSWITCH_SUBTYPE_TOGGLE) { - func_800AA000(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 7551c0f68c..0b1fb20fd8 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -58,9 +58,9 @@ typedef struct { typedef struct { /* 0x00 */ s8 damage; - /* 0x01 */ u8 unk_01; - /* 0x02 */ u8 unk_02; - /* 0x03 */ u8 unk_03; + /* 0x01 */ u8 rumbleStrength; + /* 0x02 */ u8 rumbleDuration; + /* 0x03 */ u8 rumbleDecreaseRate; /* 0x04 */ u16 sfxId; } FallImpactInfo; // size = 0x06 @@ -1467,9 +1467,9 @@ void func_80832630(PlayState* play) { } } -void func_8083264C(Player* this, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { +void Player_RequestRumble(Player* this, s32 sourceStrength, s32 duration, s32 decreaseRate, s32 distSq) { if (this->actor.category == ACTORCAT_PLAYER) { - func_800AA000(arg4, arg1, arg2, arg3); + Rumble_Request(distSq, sourceStrength, duration, decreaseRate); } } @@ -2485,7 +2485,7 @@ s32 func_80834FBC(Player* this) { if (this->actor.child != NULL) { if (this->heldActor == NULL) { this->heldActor = this->actor.child; - func_8083264C(this, 255, 10, 250, 0); + Player_RequestRumble(this, 255, 10, 250, 0); func_8002F7DC(&this->actor, NA_SE_IT_HOOKSHOT_RECEIVE); } @@ -2528,9 +2528,9 @@ s32 func_808350A4(PlayState* play, Player* this) { play->shootingGalleryStatus = -10; } - func_8083264C(this, 150, 10, 150, 0); + Player_RequestRumble(this, 150, 10, 150, 0); } else { - func_8083264C(this, 255, 20, 150, 0); + Player_RequestRumble(this, 255, 20, 150, 0); } this->unk_A73 = 4; @@ -3640,14 +3640,14 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, sp2C = &gPlayerAnim_link_normal_ice_down; func_80832224(this); - func_8083264C(this, 255, 10, 40, 0); + Player_RequestRumble(this, 255, 10, 40, 0); func_8002F7DC(&this->actor, NA_SE_PL_FREEZE_S); func_80832698(this, NA_SE_VO_LI_FREEZE); } else if (arg2 == 4) { func_80835C58(play, this, func_8084FBF4, 0); - func_8083264C(this, 255, 80, 150, 0); + Player_RequestRumble(this, 255, 80, 150, 0); func_808322A4(play, this, &gPlayerAnim_link_normal_electric_shock); func_80832224(this); @@ -3657,7 +3657,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, arg5 -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_27) { func_80835C58(play, this, func_8084E30C, 0); - func_8083264C(this, 180, 20, 50, 0); + Player_RequestRumble(this, 180, 20, 50, 0); this->linearVelocity = 4.0f; this->actor.velocity.y = 0.0f; @@ -3671,7 +3671,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->stateFlags3 |= PLAYER_STATE3_1; - func_8083264C(this, 255, 20, 150, 0); + Player_RequestRumble(this, 255, 20, 150, 0); func_80832224(this); if (arg2 == 2) { @@ -3706,7 +3706,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, } else { if ((this->linearVelocity > 4.0f) && !func_8008E9C4(this)) { this->unk_890 = 20; - func_8083264C(this, 120, 20, 10, 0); + Player_RequestRumble(this, 120, 20, 10, 0); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); return; } @@ -3717,9 +3717,9 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80833C3C(this); if (this->actor.colChkInfo.damage < 5) { - func_8083264C(this, 120, 20, 10, 0); + Player_RequestRumble(this, 120, 20, 10, 0); } else { - func_8083264C(this, 180, 20, 100, 0); + Player_RequestRumble(this, 180, 20, 100, 0); this->linearVelocity = 23.0f; sp28 += 4; } @@ -3867,7 +3867,7 @@ s32 func_808382DC(Player* this, PlayState* play) { if (sp64 || ((this->invincibilityTimer < 0) && (this->cylinder.base.acFlags & AC_HIT) && (this->cylinder.info.atHit != NULL) && (this->cylinder.info.atHit->atFlags & 0x20000000))) { - func_8083264C(this, 180, 20, 100, 0); + Player_RequestRumble(this, 180, 20, 100, 0); if (!Player_IsChildWithHylianShield(this)) { if (this->invincibilityTimer >= 0) { @@ -7704,7 +7704,7 @@ void func_808429B4(PlayState* play, s32 speed, s32 y, s32 countdown) { void func_80842A28(PlayState* play, Player* this) { func_808429B4(play, 27767, 7, 20); play->actorCtx.unk_02 = 4; - func_8083264C(this, 255, 20, 150, 0); + Player_RequestRumble(this, 255, 20, 150, 0); func_8002F7DC(&this->actor, NA_SE_IT_HAMMER_HIT); } @@ -7774,7 +7774,7 @@ void func_80842D20(PlayState* play, Player* this) { func_808322D0(play, this, D_808545CC[Player_HoldsTwoHandedWeapon(this) + sp28]); } - func_8083264C(this, 180, 20, 100, 0); + Player_RequestRumble(this, 180, 20, 100, 0); this->linearVelocity = -18.0f; func_80842CF0(play, this); } @@ -7834,7 +7834,7 @@ s32 func_80842DF4(PlayState* play, Player* this) { func_80842CF0(play, this); this->linearVelocity = -14.0f; - func_8083264C(this, 180, 20, 100, 0); + Player_RequestRumble(this, 180, 20, 100, 0); } } } @@ -8213,7 +8213,7 @@ s32 func_80843E64(PlayState* play, Player* this) { func_80837AE0(this, 40); func_808429B4(play, 32967, 2, 30); - func_8083264C(this, impactInfo->unk_01, impactInfo->unk_02, impactInfo->unk_03, 0); + Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration, impactInfo->rumbleDecreaseRate, 0); func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT); func_80832698(this, impactInfo->sfxId); @@ -8227,7 +8227,7 @@ s32 func_80843E64(PlayState* play, Player* this) { sp34 = 255; } - func_8083264C(this, (u8)sp34, (u8)(sp34 * 0.1f), (u8)sp34, 0); + Player_RequestRumble(this, (u8)sp34, (u8)(sp34 * 0.1f), (u8)sp34, 0); if (D_808535E4 == FLOOR_TYPE_6) { func_80832698(this, NA_SE_VO_LI_CLIMB_END); @@ -8418,7 +8418,7 @@ void func_80844708(Player* this, PlayState* play) { func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_17, this->modelAnimType)); this->linearVelocity = -this->linearVelocity; func_808429B4(play, 33267, 3, 12); - func_8083264C(this, 255, 20, 150, 0); + Player_RequestRumble(this, 255, 20, 150, 0); func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT); func_80832698(this, NA_SE_VO_LI_CLIMB_END); this->unk_850 = 1; @@ -10155,7 +10155,7 @@ void func_80848EF8(Player* this) { this->unk_6A0 += temp; if (this->unk_6A0 > 4000000.0f) { this->unk_6A0 = 0.0f; - func_8083264C(this, 120, 20, 10, 0); + Player_RequestRumble(this, 120, 20, 10, 0); } } } @@ -13277,7 +13277,7 @@ void func_80850AEC(Player* this, PlayState* play) { if ((this->skelAnime.animation != &gPlayerAnim_link_hook_fly_start) || (4.0f <= this->skelAnime.curFrame)) { this->actor.gravity = 0.0f; Math_ScaledStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x, 0x800); - func_8083264C(this, 100, 2, 100, 0); + Player_RequestRumble(this, 100, 2, 100, 0); } } diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index c7a90b0c50..0517ee4b29 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1320,7 +1320,7 @@ void FileSelect_ConfirmFile(GameState* thisx) { if (CHECK_BTN_ALL(input->press.button, BTN_START) || (CHECK_BTN_ALL(input->press.button, BTN_A))) { if (this->confirmButtonIndex == FS_BTN_CONFIRM_YES) { - func_800AA000(300.0f, 180, 20, 100); + Rumble_Request(300.0f, 180, 20, 100); Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->selectMode = SM_FADE_OUT; diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index 130340cf52..b8fdbb1d7c 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -384,7 +384,7 @@ void FileSelect_CopyConfirm(GameState* thisx) { this->nextTitleLabel = FS_TITLE_COPY_COMPLETE; this->actionTimer = 8; this->configMode = CM_COPY_ANIM_1; - func_800AA000(300.0f, 0xB4, 0x14, 0x64); + Rumble_Request(300.0f, 180, 20, 100); Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else if (ABS(this->stickAdjY) >= 30) { @@ -850,7 +850,7 @@ void FileSelect_EraseConfirm(GameState* thisx) { this->actionTimer = 8; this->configMode = CM_ERASE_ANIM_1; this->nextTitleLabel = FS_TITLE_ERASE_COMPLETE; - func_800AA000(200.0f, 0xFF, 0x14, 0x96); + Rumble_Request(200.0f, 255, 20, 150); sEraseDelayTimer = 15; } else if (ABS(this->stickAdjY) >= 30) { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c index 360c00175b..e951eddf70 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c @@ -446,7 +446,7 @@ void FileSelect_DrawNameEntry(GameState* thisx) { this->configMode = CM_NAME_ENTRY_TO_MAIN; this->nameBoxAlpha[this->buttonIndex] = this->nameAlpha[this->buttonIndex] = 200; this->connectorAlpha[this->buttonIndex] = 255; - func_800AA000(300.0f, 0xB4, 0x14, 0x64); + Rumble_Request(300.0f, 180, 20, 100); } else { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);