1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-13 04:39:36 +00:00

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
This commit is contained in:
Tharo 2022-09-27 17:40:26 +01:00 committed by GitHub
parent 82e04ede5f
commit 4f65d08eb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 533 additions and 393 deletions

View file

@ -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);

View file

@ -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

View file

@ -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)

51
include/rumble.h Normal file
View file

@ -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

View file

@ -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;

4
spec
View file

@ -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"

View file

@ -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;
}

View file

@ -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));
}

View file

@ -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);

View file

@ -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

151
src/code/sys_rumble.c Normal file
View file

@ -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));
}

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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:

View file

@ -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) {

View file

@ -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);

135
src/code/z_rumble.c Normal file
View file

@ -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;
}

View file

@ -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) {

View file

@ -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);
}
}
}

View file

@ -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) {

View file

@ -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);

View file

@ -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:

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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);

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);
}

View file

@ -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;

View file

@ -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) {

View file

@ -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);

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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,

View file

@ -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);