1
0
mirror of https://github.com/blawar/ooot.git synced 2024-06-25 22:09:34 +00:00

This commit contains all changes made in the rumble branch.

This commit is contained in:
DaMarkov 2022-02-17 14:40:45 +01:00
parent 585f914941
commit 25b04b02ca
60 changed files with 512 additions and 274 deletions

View File

@ -1,12 +1,12 @@
#pragma once
struct PadMgr;
void func_800A9F30(PadMgr*, s32);
void func_800A9F6C(f32, u8, u8, u8);
void func_800AA000(f32, u8, u8, u8);
void func_800AA0B4();
void func_800AA0F0(void);
u32 func_800AA148();
void func_800AA15C();
void func_800AA16C();
void func_800AA178(u32);
void Rumble_Init(PadMgr*, s32);
void Rumble_Shake2(f32, u8, u8, u8);
void Rumble_Shake(f32, u8, u8, u8);
void Rumble_Reset();
void Rumble_Destroy(void);
u32 Rumble_IsEnabled();
void Rumble_Stop();
void Rumble_Clear();
void Rumble_Enable(u32);

View File

@ -1,6 +1,6 @@
#pragma once
struct UnkRumbleStruct;
struct RumbleStruct;
void func_800D2E30(UnkRumbleStruct* arg0);
void func_800D3140(UnkRumbleStruct* arg0);
void func_800D3178(UnkRumbleStruct* arg0);
void Rumble_Update(RumbleStruct* arg0);
void func_800D3140(RumbleStruct* arg0);
void func_800D3178(RumbleStruct* arg0);

View File

@ -367,15 +367,15 @@ void SsSram_Init(uintptr_t addr, u8 handleType, u8 handleDomain, u8 handleLatenc
u8 handlePulse, u32 handleSpeed);
void SsSram_Dma(void* dramAddr, size_t size, s32 direction);
void SsSram_ReadWrite(uintptr_t 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 func_800AA0F0(void);
u32 func_800AA148();
void func_800AA15C();
void func_800AA16C();
void func_800AA178(u32);
void Rumble_Init(PadMgr*, s32);
void Rumble_Shake2(f32, u8, u8, u8);
void Rumble_Shake(f32, u8, u8, u8);
void Rumble_Reset();
void Rumble_Destroy(void);
u32 Rumble_IsEnabled();
void Rumble_Stop();
void Rumble_Clear();
void Rumble_Enable(u32);
@ -581,9 +581,9 @@ u64* SysUcode_GetUCodeBoot(void);
u64 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 Rumble_Update(RumbleStruct* arg0);
void func_800D3140(RumbleStruct* arg0);
void func_800D3178(RumbleStruct* arg0);
void func_800D31A0(void);
void func_800D31F0(void);
void func_800D3210(void);

View File

@ -1,4 +1,5 @@
#pragma once
#include <functional>
#include "sched.h"
#include "ultra64/controller.h"
#include "ultra64/pfs.h"
@ -27,7 +28,7 @@ struct PadMgr {
/* 0x02A9 */ u8 nControllers;
/* 0x02AA */ u8 ctrlrIsConnected[4]; // "Key_switch" originally
/* 0x02AE */ u8 pakType[4]; // 1 if rumble pack, 2 if mempak?
/* 0x02B2 */ vu8 rumbleEnable[4];
/* 0x02B2 */ vu8 rumbleOn[4];
/* 0x02B6 */ u8 rumbleCounter[4]; // not clear exact meaning
/* 0x02BC */ OSPfs pfs[4];
/* 0x045C */ vu8 rumbleOffFrames;
@ -37,22 +38,25 @@ struct PadMgr {
/* 0x0464 */ u32 retraceCallbackValue;
}; // size = 0x468
struct UnkRumbleStruct {
/* 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;
struct RumbleStruct {
std::function<void(uint8_t, uint8_t, uint8_t)> onVibrate;//Callback, takes strength, length, decay
/* 0x000 */ u8 rumbleOn[4];//0 or 1 depending if rumble is happening right now
/* 0x004 */ u8 strengthList[0x40];//rumble pattern
/* 0x044 */ u8 lengthList[0x40];//rumble pattern
/* 0x084 */ u8 decayList[0x40];//rumble pattern
/* 0x0C4 */ u8 strengthList_easing[0x40];//Used internally to make the decay in more quadratic instead of linear
/* 0x104 */ u8 state;//set to 0 for a clear of all rumble data (rumble stops), set to 1 to continue operation, set to 2 for a full rumble device clear
/* 0x105 */ u8 reset;//set to zero to reset pakType of pad manager
/* 0x106 */ u16 timer1;//Counts up for each frame there is rumble, after 7200 frames ~ 6 minutes clears the rumble data
/* 0x108 */ u16 timer2;//Resets timer1 when there is no rumble
/* 0x10A */ u8 strength;
/* 0x10B */ u8 length;
/* 0x10C */ u8 decay;
/* 0x10D */ u8 strength_easing;
}; // size = 0x10E
extern PadMgr gPadMgr;
extern u32 gIsCtrlr2Valid;
extern u32 gIsCtrlr2Valid;

View File

@ -6,53 +6,65 @@
#include "def/code_800D2E30.h"
#include "def/padmgr.h"
UnkRumbleStruct D_80160FD0;
RumbleStruct g_Rumble;
void func_800A9F30(PadMgr* a, s32 b) {
func_800D2E30(&D_80160FD0);
PadMgr_RumbleSet(a, D_80160FD0.rumbleEnable);
void Rumble_Init(PadMgr* a, s32 b) {
Rumble_Update(&g_Rumble);
PadMgr_RumbleSet(a, g_Rumble.rumbleOn);
}
void func_800A9F6C(f32 a, u8 b, u8 c, u8 d) {
s32 temp1;
s32 temp2;
//Used for bosses and fishing
//distance to player (unused), strength, time, decay
void Rumble_Shake2(f32 playerDistance, u8 baseStrength, u8 length, u8 decay) {
s32 distance_decay;//By how much should the rumble effect be lowered, based on the distance
s32 strength;
if (1000000.0f < a) {
temp1 = 1000;
} else {
temp1 = sqrtf(a);
if (1000000.0f < playerDistance) {
distance_decay = 1000;
}
else {
distance_decay = sqrtf(playerDistance);
}
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;
if ((distance_decay < 1000) && (baseStrength != 0) && (decay != 0)) {
strength = baseStrength - (distance_decay * 255) / 1000;
if (strength > 0) {
if (g_Rumble.onVibrate)
g_Rumble.onVibrate(strength, length, decay);
g_Rumble.strength = strength;
g_Rumble.length = length;
g_Rumble.decay = decay;
}
}
}
void func_800AA000(f32 a, u8 b, u8 c, u8 d) {
s32 temp1;
s32 temp2;
//distance to player, strength, time, decay?
void Rumble_Shake(f32 playerDistance, u8 baseStrength, u8 length, u8 decay) {
s32 distance_decay;//By how much should the rumble effect be lowered, based on the distance
s32 strength;
s32 i;
if (1000000.0f < a) {
temp1 = 1000;
} else {
temp1 = sqrtf(a);
if (1000000.0f < playerDistance) {
distance_decay = 1000;
}
else {
distance_decay = sqrtf(playerDistance);
}
if (temp1 < 1000 && b != 0 && d != 0) {
temp2 = b - (temp1 * 255) / 1000;
if (distance_decay < 1000 && baseStrength != 0 && decay != 0) {
strength = baseStrength - (distance_decay * 255) / 1000;
if (g_Rumble.onVibrate)
g_Rumble.onVibrate(strength, length, decay);
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;
if (g_Rumble.strengthList[i] == 0) {
if (strength > 0) {
g_Rumble.strengthList[i] = strength;
g_Rumble.lengthList[i] = length;
g_Rumble.decayList[i] = decay;
}
break;
}
@ -60,38 +72,45 @@ void func_800AA000(f32 a, u8 b, u8 c, u8 d) {
}
}
void func_800AA0B4(void) {
func_800D3140(&D_80160FD0);
void Rumble_Reset(void) {//called on GameState_Init
#ifdef N64_VERSION//Don't clear our callback function
bzero(&g_Rumble, sizeof(UnkRumbleStruct));
#endif
gPadMgr.retraceCallback = func_800A9F30;
g_Rumble.state = 2;
g_Rumble.reset = 1;
gPadMgr.retraceCallback = Rumble_Init;
gPadMgr.retraceCallbackValue = 0;
if (1) {}
}
void func_800AA0F0(void) {
void Rumble_Destroy(void) {//called on GameState_Destroy
PadMgr* padmgr = &gPadMgr;
if ((padmgr->retraceCallback == func_800A9F30) && (padmgr->retraceCallbackValue == 0)) {
if ((padmgr->retraceCallback == Rumble_Init) && (padmgr->retraceCallbackValue == 0)) {
padmgr->retraceCallback = NULL;
padmgr->retraceCallbackValue = 0;
}
func_800D3178(&D_80160FD0);
#ifdef N64_VERSION
bzero(&g_Rumble, sizeof(UnkRumbleStruct));
#endif
}
u32 func_800AA148(void) {
u32 Rumble_IsEnabled(void) {
return gPadMgr.pakType[0] == 1;
}
void func_800AA15C(void) {
D_80160FD0.unk_104 = 2;
void Rumble_Stop(void) {//called on Environment_Init and game over
g_Rumble.state = 2;
}
void func_800AA16C(void) {
D_80160FD0.unk_104 = 0;
void Rumble_Clear(void) {//called per frame specific gSaveContext.gameMode
g_Rumble.state = 0;
}
void func_800AA178(u32 a) {
D_80160FD0.unk_105 = !!a;
}
void Rumble_Enable(u32 a) {
g_Rumble.reset = !!a;
}

View File

@ -4,120 +4,120 @@
#include <string.h>
#include "def/code_800D2E30.h"
void func_800D2E30(UnkRumbleStruct* arg0) {
static u8 D_8012DBB0 = 1;
void Rumble_Update(RumbleStruct* rumbleCtx) {
static u8 reset_needed = 1;
s32 i;
s32 unk_a3;
s32 index = -1;
s32 temp;
s32 index = -1;//Index into the list with the most rumble
for (i = 0; i < 4; i++) {
arg0->rumbleEnable[i] = 0;
rumbleCtx->rumbleOn[i] = 0;
}
if (arg0->unk_105 == 0) {
if (D_8012DBB0 != 0) {
if (rumbleCtx->reset == 0) {
if (reset_needed != 0) {
for (i = 0; i < 4; i++) {
gPadMgr.pakType[i] = 0;
}
}
D_8012DBB0 = arg0->unk_105;
reset_needed = rumbleCtx->reset;//Don't reset again next frame
return;
}
D_8012DBB0 = arg0->unk_105;
reset_needed = rumbleCtx->reset;//Allow resetting
if (arg0->unk_104 == 2) {
if (rumbleCtx->state == 2) {//Perform full clear of all data
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;
rumbleCtx->strengthList_easing[i] = 0;
rumbleCtx->decayList[i] = 0;
rumbleCtx->lengthList[i] = 0;
rumbleCtx->strengthList[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;
rumbleCtx->timer1 = rumbleCtx->timer2 = rumbleCtx->strength = rumbleCtx->length = rumbleCtx->decay = rumbleCtx->strength_easing = 0;
rumbleCtx->state = 1;//Normal operation mode
}
if (arg0->unk_104 != 0) {
if (rumbleCtx->state != 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;
if (rumbleCtx->strengthList[i] != 0) {
if (rumbleCtx->lengthList[i] > 0) {
rumbleCtx->lengthList[i]--;
}
else {
temp = rumbleCtx->strengthList[i] - rumbleCtx->decayList[i];
if (temp > 0) {
rumbleCtx->strengthList[i] = temp;
}
else {
rumbleCtx->strengthList[i] = 0;
}
}
unk_a3 = arg0->unk_C4[i] + arg0->unk_04[i];
arg0->unk_C4[i] = unk_a3;
temp = rumbleCtx->strengthList_easing[i] + rumbleCtx->strengthList[i];
rumbleCtx->strengthList_easing[i] = temp;
if (index == -1) {
index = i;
arg0->rumbleEnable[0] = (unk_a3 >= 0x100);
} else if (arg0->unk_04[index] < arg0->unk_04[i]) {
rumbleCtx->rumbleOn[0] = (temp >= 0x100);
}
else if (rumbleCtx->strengthList[index] < rumbleCtx->strengthList[i]) {
index = i;
arg0->rumbleEnable[0] = (unk_a3 >= 0x100);
rumbleCtx->rumbleOn[0] = (temp >= 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;
if (rumbleCtx->strength != 0) {
if (rumbleCtx->length > 0) {
rumbleCtx->length--;
}
else {
temp = rumbleCtx->strength - rumbleCtx->decay;
if (temp > 0) {
rumbleCtx->strength = temp;
}
else {
rumbleCtx->strength = 0;
}
}
unk_a3 = arg0->unk_10D + arg0->unk_10A;
arg0->unk_10D = unk_a3;
arg0->rumbleEnable[0] = (unk_a3 >= 0x100);
temp = rumbleCtx->strength_easing + rumbleCtx->strength;
rumbleCtx->strength_easing = temp;
rumbleCtx->rumbleOn[0] = (temp >= 0x100);
}
if (arg0->unk_10A != 0) {
unk_a3 = arg0->unk_10A;
} else {
if (rumbleCtx->strength != 0) {
temp = rumbleCtx->strength;
}
else {
//Write the largest rumble value in temp
if (index == -1) {
unk_a3 = 0;
} else {
unk_a3 = arg0->unk_04[index];
temp = 0;
}
else {
temp = rumbleCtx->strengthList[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;
if (temp == 0) {//No rumble
if ((++rumbleCtx->timer2) >= 6) {
rumbleCtx->timer1 = 0;//Clear emergency timer
rumbleCtx->timer2 = 5;
}
}
} 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;
else {
rumbleCtx->timer2 = 0;
if ((++rumbleCtx->timer1) >= 0x1C21) {//Has been rumbling for a very long time?
rumbleCtx->state = 0;//Clear rumble data
}
}
arg0->unk_106 = arg0->unk_108 = arg0->unk_10A = arg0->unk_10B = arg0->unk_10C = arg0->unk_10D = 0;
}
}
else {//Clear rumble data
for (i = 0; i < 0x40; i++) {
rumbleCtx->strengthList_easing[i] = 0;
rumbleCtx->strengthList[i] = 0;
rumbleCtx->lengthList[i] = 0;
rumbleCtx->decayList[i] = 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));
}
rumbleCtx->timer1 = rumbleCtx->timer2 = rumbleCtx->strength = rumbleCtx->length = rumbleCtx->decay = rumbleCtx->strength_easing = 0;
}
}

View File

@ -480,7 +480,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
ViMode_Init(&sViMode);
}
SpeedMeter_Init(&D_801664D0);
func_800AA0B4();
Rumble_Reset();
osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
endTime = osGetTime();
@ -501,7 +501,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

@ -3526,9 +3526,9 @@ void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) {
void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
if (arg2 >= 5) {
func_800AA000(actor->xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Rumble_Shake(actor->xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
} else {
func_800AA000(actor->xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
Rumble_Shake(actor->xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
}
func_80033DB8(globalCtx, arg2, arg3);

View File

@ -184,7 +184,7 @@ void func_8006390C(Input* input) {
}
if (iREG(0)) {
iREG(0) = 0;
func_800AA000(0, iREG(1), iREG(2), iREG(3));
Rumble_Shake(0, iREG(1), iREG(2), iREG(3));
}
}
}

View File

@ -502,7 +502,7 @@ void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx,
// Command 9: ?
void Cutscene_Command_09(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdUnknown9* cmd) {
if (csCtx->frames == cmd->startFrame) {
func_800AA000(0.0f, cmd->unk_06, cmd->unk_07, cmd->unk_08);
Rumble_Shake(0.0f, cmd->unk_06, cmd->unk_07, cmd->unk_08);
}
}

View File

@ -91,7 +91,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
v91 = VREG(91);
v92 = VREG(92);
func_800AA000(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)),
Rumble_Shake(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)),
((v92 > 0x64) ? 0xFF : (v92 * 0xFF) / 0x64));
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
@ -106,7 +106,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
if (gGameOverTimer == 0) {
globalCtx->pauseCtx.state = 8;
gameOverCtx->state++;
func_800AA15C();
Rumble_Stop();
}
break;
@ -126,7 +126,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
v91 = VREG(91);
v92 = VREG(92);
func_800AA000(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)),
Rumble_Shake(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)),
((v92 > 0x64) ? 0xFF : (v92 * 0xFF) / 0x64));
break;

View File

@ -458,7 +458,7 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32
}
gCustomLensFlareOn = false;
func_800AA15C();
Rumble_Stop();
}
u8 Environment_SmoothStepToU8(u8* pvalue, u8 target, u8 scale, u8 step, u8 minStep) {
@ -910,7 +910,7 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li
s32 adjustment;
if ((((void)0, gSaveContext.gameMode) != 0) && (((void)0, gSaveContext.gameMode) != 3)) {
func_800AA16C();
Rumble_Clear();
}
if (pauseCtx->state == 0) {

View File

@ -908,7 +908,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
globalCtx->gameplayFrames++;
func_800AA178(1);
Rumble_Enable(1);
if (globalCtx->actorCtx.freezeFlashTimer && (globalCtx->actorCtx.freezeFlashTimer-- < 5)) {
osSyncPrintf("FINISH=%d\n", globalCtx->actorCtx.freezeFlashTimer);
@ -989,7 +989,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
}
} else {
func_800AA178(0);
Rumble_Enable(0);
}
if (1 && HREG(63)) {

View File

@ -200,7 +200,7 @@ void func_8086C054(BgBdanObjects* pthis, GlobalContext* globalCtx) {
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_Shake(0.0f, 0xFF, 0x14, 0x96);
}
} else if (pthis->timer != 0) {
if (pthis->timer != 0) {
@ -225,13 +225,13 @@ void func_8086C1A0(BgBdanObjects* pthis, GlobalContext* globalCtx) {
pthis->actionFunc = func_8086C29C;
pthis->timer = 30;
BgBdanObjects_SetContactRu1(pthis, 2);
func_800AA000(0.0f, 0xFF, 0x14, 0x96);
Rumble_Shake(0.0f, 0xFF, 0x14, 0x96);
} else {
if (pthis->timer != 0) {
pthis->timer--;
}
if (pthis->timer == 0) {
func_800AA000(0.0f, 0x78, 0x14, 0xA);
Rumble_Shake(0.0f, 0x78, 0x14, 0xA);
pthis->timer = 11;
}
func_8002F974(&pthis->dyna.actor, NA_SE_EV_BUYOSTAND_RISING - SFX_FLAG);
@ -279,14 +279,14 @@ void func_8086C3D8(BgBdanObjects* pthis, GlobalContext* globalCtx) {
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_Shake(0.0f, 0xFF, 0x1E, 0x96);
} else {
func_8002F974(&pthis->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG);
if (pthis->timer != 0) {
pthis->timer--;
}
if (pthis->timer == 0) {
func_800AA000(0.0f, 0x78, 0x14, 0xA);
Rumble_Shake(0.0f, 0x78, 0x14, 0xA);
pthis->timer = 11;
}
if (pthis->dyna.actor.child != NULL) {

View File

@ -288,7 +288,7 @@ void func_8086D694(BgBdanSwitch* pthis, GlobalContext* globalCtx) {
if (pthis->unk_1C8 <= 0.1f) {
func_8086D730(pthis);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_FOOT_SWITCH);
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
}
}
}
@ -351,7 +351,7 @@ void func_8086D8CC(BgBdanSwitch* pthis, GlobalContext* globalCtx) {
if (pthis->unk_1C8 <= 0.6f) {
func_8086D9F8(pthis);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_FOOT_SWITCH);
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
}
}
@ -366,7 +366,7 @@ void func_8086D95C(BgBdanSwitch* pthis, GlobalContext* globalCtx) {
if (pthis->unk_1C8 <= 0.1f) {
func_8086DB24(pthis);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_FOOT_SWITCH);
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
}
}
}

View File

@ -143,7 +143,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* pthis, GlobalContext* globalCtx) {
f32 effectStrength;
Math_SmoothStepToF(&pthis->dyna.actor.speedXZ, 4.0f, 0.5f, 0.025f, 0.0f);
func_800AA000(500.0f, 0x78, 0x14, 0xA);
Rumble_Shake(500.0f, 0x78, 0x14, 0xA);
if (Math_SmoothStepToF(&pthis->dyna.actor.world.pos.y, pthis->dyna.actor.home.pos.y - 200.0f - 20.0f, 0.075f,
pthis->dyna.actor.speedXZ, 0.0075f) == 0.0f) {

View File

@ -257,7 +257,7 @@ void BgDodoago_OpenJaw(BgDodoago* pthis, GlobalContext* globalCtx) {
BgDodoago_SpawnSparkles(&pos, globalCtx);
Math_StepToS(&pthis->state, 100, 3);
func_800AA000(500.0f, 0x78, 0x14, 0xA);
Rumble_Shake(500.0f, 0x78, 0x14, 0xA);
if (Math_SmoothStepToS(&pthis->dyna.actor.shape.rot.x, 0x1333, 110 - pthis->state, 0x3E8, 0x32) == 0) {
BgDodoago_SetupAction(pthis, BgDodoago_DoNothing);

View File

@ -211,7 +211,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* pthis, GlobalContext* globalCtx) {
thisx->velocity.z = Rand_CenteredFloat(8.0f);
BgHeavyBlock_SetPieceRandRot(pthis, 1.0f);
Audio_PlayActorSound2(thisx, NA_SE_EV_ROCK_BROKEN);
func_800AA000(thisx->xzDistToPlayer, 0x96, 0xA, 8);
Rumble_Shake(thisx->xzDistToPlayer, 0x96, 0xA, 8);
}
}
@ -370,7 +370,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* pthis, GlobalContext* globalCtx) {
f32 xOffset;
if (pthis->timer == 11) {
func_800AA000(0.0f, 0xFF, 0x14, 0x14);
Rumble_Shake(0.0f, 0xFF, 0x14, 0x14);
func_8002F7DC(&player->actor, NA_SE_PL_PULL_UP_BIGROCK);
LOG_STRING("NA_SE_PL_PULL_UP_BIGROCK", "../z_bg_heavy_block.c", 691);
}
@ -412,7 +412,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* pthis, GlobalContext* globalCtx) {
pthis->dyna.actor.floorHeight = raycastResult;
if (pthis->dyna.actor.home.pos.y <= raycastResult) {
func_800AA000(0.0f, 0xFF, 0x3C, 4);
Rumble_Shake(0.0f, 0xFF, 0x3C, 4);
switch (pthis->dyna.actor.params & 0xFF) {
case HEAVYBLOCK_BREAKABLE:

View File

@ -327,7 +327,7 @@ void func_80888860(BgHidanHamstep* pthis, GlobalContext* globalCtx) {
Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0);
Quake_SetCountdown(quakeIndex, 20);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_BLOCK_BOUND);
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 255, 20, 150);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 255, 20, 150);
func_80888638(pthis, globalCtx);
osSyncPrintf("A(%d)\n", pthis->dyna.actor.params);
}
@ -387,7 +387,7 @@ void func_80888A58(BgHidanHamstep* pthis, GlobalContext* globalCtx) {
Quake_SetCountdown(quakeIndex, 7);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_BLOCK_BOUND);
func_800AA000(10000.0f, 255, 20, 150);
Rumble_Shake(10000.0f, 255, 20, 150);
func_808884C8(pthis, globalCtx);
if ((pthis->dyna.actor.params & 0xFF) == 5) {

View File

@ -179,7 +179,7 @@ void func_808894B0(BgHidanHrock* pthis, GlobalContext* globalCtx) {
(Math_CosS(pthis->dyna.actor.world.rot.y + (pthis->unk_168 << 0xE)) * 5.0f) + pthis->dyna.actor.home.pos.z;
if (!(pthis->unk_168 % 4)) {
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 180, 10, 100);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 180, 10, 100);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_BLOCK_SHAKE);
}

View File

@ -252,7 +252,7 @@ void func_8088B69C(BgHidanRock* pthis, GlobalContext* globalCtx) {
}
if (!(pthis->timer % 4)) {
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x0A, 0x64);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x0A, 0x64);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_BLOCK_SHAKE);
}
}

View File

@ -159,7 +159,7 @@ void func_8088E5D0(BgHidanSima* pthis, GlobalContext* globalCtx) {
pthis->dyna.actor.world.pos.z = pthis->dyna.actor.home.pos.z;
}
if (!(pthis->timer % 4)) {
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 180, 10, 100);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 180, 10, 100);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_BLOCK_SHAKE);
}
}

View File

@ -139,7 +139,7 @@ void BgMizuShutter_Move(BgMizuShutter* pthis, GlobalContext* globalCtx) {
if ((pthis->dyna.actor.world.pos.x == pthis->closedPos.x) &&
(pthis->dyna.actor.world.pos.y == pthis->closedPos.y) &&
(pthis->dyna.actor.world.pos.z == pthis->closedPos.z)) {
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 0x78, 0x14, 0xA);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_STONE_BOUND);
pthis->actionFunc = BgMizuShutter_WaitForSwitch;
}

View File

@ -288,10 +288,10 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* pthis, GlobalContext* globalCtx)
}
if (pthis->targetY < pthis->actor.world.pos.y) {
func_800AA000(0.0f, 0x78, 0x14, 0xA);
Rumble_Shake(0.0f, 0x78, 0x14, 0xA);
func_8002F948(&pthis->actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
} else if (pthis->targetY > pthis->actor.world.pos.y) {
func_800AA000(0.0f, 0x78, 0x14, 0xA);
Rumble_Shake(0.0f, 0x78, 0x14, 0xA);
func_8002F948(&pthis->actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
}
}

View File

@ -172,7 +172,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* pthis, GlobalContext* globalCtx) {
if (pthis->bounceCount == 0) {
pthis->fallCount++;
func_800788CC(NA_SE_EV_STONE_BOUND);
func_800AA000(SQ(thisx->yDistToPlayer), 0xFF, 0x14, 0x96);
Rumble_Shake(SQ(thisx->yDistToPlayer), 0xFF, 0x14, 0x96);
}
thisx->world.pos.y =
403.0f - (thisx->world.pos.y - 403.0f) * bounceVel_44[pthis->bounceCount] / fabsf(thisx->velocity.y);

View File

@ -157,7 +157,7 @@ void func_808A91AC(BgRelayObjects* pthis, GlobalContext* globalCtx) {
void func_808A9234(BgRelayObjects* pthis, GlobalContext* globalCtx) {
pthis->dyna.actor.velocity.y += pthis->dyna.actor.gravity;
if (Math_StepToF(&pthis->dyna.actor.world.pos.y, pthis->dyna.actor.home.pos.y, pthis->dyna.actor.velocity.y)) {
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 180, 20, 100);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 180, 20, 100);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_STONE_BOUND);
if (pthis->unk_169 != globalCtx->roomCtx.curRoom.num) {
func_800788CC(NA_SE_EN_PO_LAUGH);

View File

@ -728,7 +728,7 @@ void BossDodongo_Walk(BossDodongo* pthis, GlobalContext* globalCtx) {
func_80033E88(&pthis->actor, globalCtx, 4, 10);
} else {
pthis->unk_1B6 = 10;
func_800A9F6C(0.0f, 180, 20, 100);
Rumble_Shake2(0.0f, 180, 20, 100);
}
}
}

View File

@ -3972,7 +3972,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) {
spBA = 2;
Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_MG, &player->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
} else {
spBA = 1;
pthis->actor.world.rot.y = Math_Atan2S(zDistFromGanondorf, xDistFromGanondorf);
@ -3982,7 +3982,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) {
pthis->timers[1] = 2;
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
if (hitWithBottle == false) {
// if ganondorf is 250 units away from link, at least 3 volleys are required
@ -4451,7 +4451,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
pthis->collider.base.acFlags &= ~2;
if (!(acHitInfo->toucher.dmgFlags & 0x100000) || Player_HasMirrorShieldEquipped(globalCtx)) {
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
pthis->unk_1C2 = 0xC;
pthis->actor.speedXZ = -30.0f;

View File

@ -450,7 +450,7 @@ void func_808FD5F4(BossGanon2* pthis, GlobalContext* globalCtx) {
if (pthis->unk_398 == 30) {
D_80906D78 = 1;
pthis->unk_314 = 1;
func_800A9F6C(0.0f, 0xC8, 0x14, 0x14);
Rumble_Shake2(0.0f, 0xC8, 0x14, 0x14);
}
if (pthis->unk_398 == 30) {
func_80078884(NA_SE_EV_GRAVE_EXPLOSION);
@ -660,7 +660,7 @@ void func_808FD5F4(BossGanon2* pthis, GlobalContext* globalCtx) {
pthis->actor.velocity.y = 0.0f;
Animation_MorphToPlayOnce(&pthis->skelAnime, &object_ganon_anime3_Anim_010380, 0.0f);
func_808FD4D4(pthis, globalCtx, 0, 3);
func_800A9F6C(0.0f, 0xC8, 0x14, 0x14);
Rumble_Shake2(0.0f, 0xC8, 0x14, 0x14);
}
break;
case 21:
@ -736,7 +736,7 @@ void func_808FD5F4(BossGanon2* pthis, GlobalContext* globalCtx) {
if (pthis->unk_398 == 228) {
func_80078884(NA_SE_IT_SHIELD_REFLECT_SW);
func_8002DF54(globalCtx, &pthis->actor, 0x56);
func_800A9F6C(0.0f, 0xFF, 0xA, 0x32);
Rumble_Shake2(0.0f, 0xFF, 0xA, 0x32);
}
if (pthis->unk_398 >= 229) {
globalCtx->envCtx.fillScreen = true;
@ -938,7 +938,7 @@ void func_808FF898(BossGanon2* pthis, GlobalContext* globalCtx) {
sp28.z = 1.0f;
Matrix_MultVec3f(&sp28, &gj->unk_26C);
gj->killFlag = true;
func_800A9F6C(0.0f, 0x96, 0x14, 0x32);
Rumble_Shake2(0.0f, 0x96, 0x14, 0x32);
pthis->unk_392 = 6;
return;
}

View File

@ -929,7 +929,7 @@ void BossGoma_Encounter(BossGoma* pthis, GlobalContext* globalCtx) {
pthis->currentAnimFrameCount = Animation_GetLastFrame(&gGohmaInitialLandingAnim);
BossGoma_PlayEffectsAndSfx(pthis, globalCtx, 0, 5);
pthis->framesUntilNextAction = 15;
func_800A9F6C(0.0f, 0xC8, 0x14, 0x14);
Rumble_Shake2(0.0f, 0xC8, 0x14, 0x14);
}
break;
@ -1038,7 +1038,7 @@ void BossGoma_Defeated(BossGoma* pthis, GlobalContext* globalCtx) {
if (Animation_OnFrame(&pthis->skelanime, 107.0f)) {
BossGoma_PlayEffectsAndSfx(pthis, globalCtx, 0, 8);
func_800A9F6C(0.0f, 0x96, 0x14, 0x14);
Rumble_Shake2(0.0f, 0x96, 0x14, 0x14);
}
pthis->visualState = VISUALSTATE_DEFEATED;

View File

@ -1006,7 +1006,7 @@ void BossMo_Tentacle(BossMo* pthis, GlobalContext* globalCtx) {
if ((pthis->sfxTimer % 32) == 0) {
Audio_PlaySoundIncreasinglyTransposed(&pthis->tentTipPos, NA_SE_EN_MOFER_WAVE,
gMorphaTransposeTable);
func_800AA000(0, 100, 5, 2);
Rumble_Shake(0, 100, 5, 2);
func_8002F7DC(&player->actor, NA_SE_VO_LI_FREEZE + player->ageProperties->unk_92);
}
} else {
@ -1021,7 +1021,7 @@ void BossMo_Tentacle(BossMo* pthis, GlobalContext* globalCtx) {
if ((pthis->sfxTimer % 16) == 0) {
Audio_PlaySoundIncreasinglyTransposed(&pthis->tentTipPos, NA_SE_EN_MOFER_WAVE,
gMorphaTransposeTable);
func_800AA000(0, 160, 5, 4);
Rumble_Shake(0, 160, 5, 4);
func_8002F7DC(&player->actor, NA_SE_VO_LI_FREEZE + player->ageProperties->unk_92);
}
}

View File

@ -458,7 +458,7 @@ void BossSst_HeadIntro(BossSst* pthis, GlobalContext* globalCtx) {
if (!pthis->ready) {
sFloor->dyna.actor.params = BONGOFLOOR_HIT;
pthis->ready = true;
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Audio_PlayActorSound2(&sFloor->dyna.actor, NA_SE_EN_SHADEST_TAIKO_HIGH);
} else if (gSaveContext.eventChkInf[7] & 0x80) {
sHands[RIGHT]->actor.draw = BossSst_DrawHand;
@ -1299,7 +1299,7 @@ void BossSst_HandDownbeat(BossSst* pthis, GlobalContext* globalCtx) {
} else {
BossSst_HandSetupDownbeatEnd(pthis);
}
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_SHADEST_TAIKO_HIGH);
}
}

View File

@ -1140,7 +1140,7 @@ void BossTw_ShootBeam(BossTw* pthis, GlobalContext* globalCtx) {
pthis->groundBlastPos.y = 0.0f;
pthis->groundBlastPos.z = 0.0f;
globalCtx->envCtx.unk_D8 = 1.0f;
func_800AA000(0.0f, 0x64, 5, 4);
Rumble_Shake(0.0f, 0x64, 5, 4);
} else if (beamReflection == 0) {
BossTw_BeamHitPlayerCheck(pthis, globalCtx);
@ -4333,7 +4333,7 @@ s32 BossTw_BlastShieldCheck(BossTw* pthis, GlobalContext* globalCtx) {
if (info->toucher.dmgFlags & DMG_SHIELD) {
pthis->work[INVINC_TIMER] = 7;
globalCtx->envCtx.unk_D8 = 1.0f;
func_800AA000(0.0f, 100, 5, 4);
Rumble_Shake(0.0f, 100, 5, 4);
if (Player_HasMirrorShieldEquipped(globalCtx)) {
if (pthis->blastType == 1) {

View File

@ -75,7 +75,7 @@ void DemoGt_PlayExplosion2Sfx(GlobalContext* globalCtx, Vec3f* pos) {
}
void DemoGt_Rumble(GlobalContext* globalCtx) {
func_800AA000(0.0f, 0x32, 0xA, 5);
Rumble_Shake(0.0f, 0x32, 0xA, 5);
}
void DemoGt_SpawnDust(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 scaleStep,

View File

@ -570,7 +570,7 @@ void func_809973E8(DoorShutter* pthis, GlobalContext* globalCtx) {
Quake_SetSpeed(quakeId, -32536);
Quake_SetQuakeValues(quakeId, 2, 0, 0, 0);
Quake_SetCountdown(quakeId, 10);
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
func_80997220(pthis, globalCtx);
}
}
@ -762,7 +762,7 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) {
void func_8099803C(GlobalContext* globalCtx, s16 y, s16 countdown, s16 camId) {
s16 quakeId = Quake_Add(Gameplay_GetCamera(globalCtx, camId), 3);
func_800A9F6C(0.0f, 180, 20, 100);
Rumble_Shake2(0.0f, 180, 20, 100);
Quake_SetSpeed(quakeId, 20000);
Quake_SetQuakeValues(quakeId, y, 0, 0, 0);
Quake_SetCountdown(quakeId, countdown);

View File

@ -453,7 +453,7 @@ void func_809BD8DC(EnBigokuta* pthis, GlobalContext* globalCtx) {
EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 1, 2000);
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_DAIOCTA_LAND_WATER);
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_GOLON_LAND_BIG);
func_800AA000(0.0f, 0xFF, 0x14, 0x96);
Rumble_Shake(0.0f, 0xFF, 0x14, 0x96);
}
} else if (pthis->unk_196 < -1) {
pthis->actor.world.pos.y = pthis->actor.home.pos.y - (sinf((pthis->unk_196 + 1) * (M_PI / 10)) * 20.0f);

View File

@ -183,7 +183,7 @@ void EnBom_Explode(EnBom* pthis, GlobalContext* globalCtx) {
if (pthis->explosionCollider.elements[0].dim.modelSphere.radius == 0) {
pthis->actor.flags |= ACTOR_FLAG_5;
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
}
pthis->explosionCollider.elements[0].dim.worldSphere.radius += pthis->actor.shape.rot.z + 8;

View File

@ -277,7 +277,7 @@ void EnBombf_Explode(EnBombf* pthis, GlobalContext* globalCtx) {
if (pthis->explosionCollider.elements[0].dim.modelSphere.radius == 0) {
pthis->actor.flags |= ACTOR_FLAG_5;
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
}
pthis->explosionCollider.elements[0].dim.modelSphere.radius += 8;

View File

@ -497,7 +497,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* pthis, GlobalContext* globalCtx) {
killMode = BALL_IMPACT;
Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_MG, &player->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
} else {
if (bossGnd->flyMode == GND_FLY_NEUTRAL) {
angleModX = Rand_CenteredFloat(0x2000);
@ -526,7 +526,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* pthis, GlobalContext* globalCtx) {
pthis->work[FHGFIRE_FX_TIMER] = 2;
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_REFLECT_MG, &player->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);
}
} else if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) {
killMode = BALL_BURST;

View File

@ -1305,7 +1305,7 @@ void EnHorse_MountedTrot(EnHorse* pthis, GlobalContext* globalCtx) {
pthis->skin.skelAnime.playSpeed = pthis->actor.speedXZ * 0.375f;
if (SkelAnime_Update(&pthis->skin.skelAnime)) {
EnHorse_PlayTrottingSound(pthis);
func_800AA000(0.0f, 60, 8, 255);
Rumble_Shake(0.0f, 60, 8, 255);
if (pthis->actor.speedXZ >= 6.0f) {
EnHorse_StartGallopingInterruptable(pthis);
} else if (pthis->actor.speedXZ < 3.0f) {
@ -1373,7 +1373,7 @@ void EnHorse_MountedGallop(EnHorse* pthis, GlobalContext* globalCtx) {
pthis->skin.skelAnime.playSpeed = pthis->actor.speedXZ * 0.3f;
if (SkelAnime_Update(&pthis->skin.skelAnime)) {
EnHorse_PlayGallopingSound(pthis);
func_800AA000(0, 120, 8, 255);
Rumble_Shake(0, 120, 8, 255);
if (EnHorse_PlayerCanMove(pthis, globalCtx) == true) {
if (stickMag >= 10.0f && Math_CosS(stickAngle) <= -0.5f) {
EnHorse_StartBraking(pthis, globalCtx);
@ -1396,7 +1396,7 @@ void EnHorse_StartRearing(EnHorse* pthis) {
if (pthis->stateFlags & ENHORSE_DRAW) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &pthis->unk_21C, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
func_800AA000(0.0f, 180, 20, 100);
Rumble_Shake(0.0f, 180, 20, 100);
Animation_Change(&pthis->skin.skelAnime, sAnimationHeaders[pthis->type][pthis->animationIdx], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimationHeaders[pthis->type][pthis->animationIdx]), ANIMMODE_ONCE, -3.0f);
}
@ -1411,7 +1411,7 @@ void EnHorse_MountedRearing(EnHorse* pthis, GlobalContext* globalCtx) {
pthis->stateFlags |= ENHORSE_LAND2_SOUND;
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND2, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
func_800AA000(0, 180, 20, 100);
Rumble_Shake(0, 180, 20, 100);
}
}
@ -1466,7 +1466,7 @@ void EnHorse_Stopping(EnHorse* pthis, GlobalContext* globalCtx) {
if (pthis->stateFlags & ENHORSE_DRAW) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &pthis->unk_21C, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
func_800AA000(0.0f, 180, 20, 100);
Rumble_Shake(0.0f, 180, 20, 100);
pthis->stateFlags &= ~ENHORSE_STOPPING_NEIGH_SOUND;
} else {
EnHorse_StartMountedIdleResetAnim(pthis);
@ -1596,7 +1596,7 @@ void EnHorse_StartLowJump(EnHorse* pthis, GlobalContext* globalCtx) {
pthis->riderPos.y -= y * 0.01f;
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_JUMP, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
func_800AA000(0.0f, 170, 10, 10);
Rumble_Shake(0.0f, 170, 10, 10);
}
void EnHorse_Stub1(EnHorse* pthis) {
@ -1631,7 +1631,7 @@ void EnHorse_LowJump(EnHorse* pthis, GlobalContext* globalCtx) {
(curFrame > 17.0f && pthis->actor.world.pos.y < pthis->actor.floorHeight - pthis->actor.velocity.y + 80.0f)) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
func_800AA000(0.0f, 255, 10, 80);
Rumble_Shake(0.0f, 255, 10, 80);
pthis->stateFlags &= ~ENHORSE_JUMPING;
pthis->actor.gravity = -3.5f;
pthis->actor.world.pos.y = pthis->actor.floorHeight;
@ -1670,7 +1670,7 @@ void EnHorse_StartHighJump(EnHorse* pthis, GlobalContext* globalCtx) {
pthis->stateFlags |= ENHORSE_CALC_RIDER_POS;
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_JUMP, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
func_800AA000(0.0f, 170, 10, 10);
Rumble_Shake(0.0f, 170, 10, 10);
}
void EnHorse_Stub2(EnHorse* pthis) {
@ -1706,7 +1706,7 @@ void EnHorse_HighJump(EnHorse* pthis, GlobalContext* globalCtx) {
(curFrame > 23.0f && pthis->actor.world.pos.y < pthis->actor.floorHeight - pthis->actor.velocity.y + 80.0f)) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
func_800AA000(0.0f, 255, 10, 80);
Rumble_Shake(0.0f, 255, 10, 80);
pthis->stateFlags &= ~ENHORSE_JUMPING;
pthis->actor.gravity = -3.5f;
pthis->actor.world.pos.y = pthis->actor.floorHeight;
@ -2124,7 +2124,7 @@ void EnHorse_CsMoveToPoint(EnHorse* pthis, GlobalContext* globalCtx, CsCmdActorA
if (SkelAnime_Update(&pthis->skin.skelAnime)) {
EnHorse_PlayGallopingSound(pthis);
func_800AA000(0.0f, 120, 8, 255);
Rumble_Shake(0.0f, 120, 8, 255);
Animation_PlayOnceSetSpeed(&pthis->skin.skelAnime, sAnimationHeaders[pthis->type][pthis->animationIdx],
pthis->actor.speedXZ * 0.3f);
}
@ -2155,7 +2155,7 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* pthis, GlobalContext* globalCtx) {
pthis->stateFlags |= ENHORSE_CALC_RIDER_POS;
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_JUMP, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
func_800AA000(0.0f, 170, 10, 10);
Rumble_Shake(0.0f, 170, 10, 10);
}
void EnHorse_CsJumpInit(EnHorse* pthis, GlobalContext* globalCtx, CsCmdActorAction* action) {
@ -2200,7 +2200,7 @@ void EnHorse_CsJump(EnHorse* pthis, GlobalContext* globalCtx, CsCmdActorAction*
pthis->cutsceneFlags |= 1;
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
func_800AA000(0.0f, 255, 10, 80);
Rumble_Shake(0.0f, 255, 10, 80);
pthis->stateFlags &= ~ENHORSE_JUMPING;
pthis->actor.gravity = -3.5f;
pthis->actor.velocity.y = 0;
@ -2283,7 +2283,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* pthis, GlobalContext* globalCtx, CsCmdAc
if (SkelAnime_Update(&pthis->skin.skelAnime)) {
EnHorse_PlayGallopingSound(pthis);
func_800AA000(0.0f, 120, 8, 255);
Rumble_Shake(0.0f, 120, 8, 255);
Animation_PlayOnceSetSpeed(&pthis->skin.skelAnime, sAnimationHeaders[pthis->type][pthis->animationIdx],
pthis->actor.speedXZ * 0.3f);
}
@ -2466,11 +2466,11 @@ void EnHorse_UpdateHbaAnim(EnHorse* pthis) {
} else if (pthis->animationIdx == ENHORSE_ANIM_TROT) {
animSpeed = pthis->actor.speedXZ * 0.25f;
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_RUN, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
func_800AA000(0.0f, 60, 8, 255);
Rumble_Shake(0.0f, 60, 8, 255);
} else if (pthis->animationIdx == ENHORSE_ANIM_GALLOP) {
animSpeed = pthis->actor.speedXZ * 0.2f;
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_RUN, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
func_800AA000(0.0f, 120, 8, 255);
Rumble_Shake(0.0f, 120, 8, 255);
} else {
animSpeed = 1.0f;
}
@ -2742,7 +2742,7 @@ void EnHorse_BridgeJumpInit(EnHorse* pthis, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &pthis->unk_21C, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_JUMP, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
func_800AA000(0.0f, 170, 10, 10);
Rumble_Shake(0.0f, 170, 10, 10);
pthis->postDrawFunc = NULL;
}
@ -2792,7 +2792,7 @@ void EnHorse_CheckBridgeJumpLanding(EnHorse* pthis, GlobalContext* globalCtx) {
EnHorse_JumpLanding(pthis, globalCtx);
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_LAND, &pthis->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
func_800AA000(0.0f, 255, 10, 80);
Rumble_Shake(0.0f, 255, 10, 80);
}
}
@ -3311,7 +3311,7 @@ void EnHorse_CheckBoost(EnHorse* thisx, GlobalContext* globalCtx2) {
if (!(pthis->stateFlags & ENHORSE_BOOST) && !(pthis->stateFlags & ENHORSE_FLAG_8) &&
!(pthis->stateFlags & ENHORSE_FLAG_9)) {
if (pthis->numBoosts > 0) {
func_800AA000(0.0f, 180, 20, 100);
Rumble_Shake(0.0f, 180, 20, 100);
pthis->stateFlags |= ENHORSE_BOOST;
pthis->stateFlags |= ENHORSE_FIRST_BOOST_REGEN;
pthis->stateFlags |= ENHORSE_FLAG_8;

View File

@ -465,7 +465,7 @@ void func_80A74EBC(EnIk* pthis, GlobalContext* globalCtx) {
sp2C.y = pthis->actor.world.pos.y;
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_IRONNACK_HIT_GND);
Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5);
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
CollisionCheck_SpawnShieldParticles(globalCtx, &sp2C);
}

View File

@ -453,7 +453,7 @@ void EnIshi_Fly(EnIshi* pthis, GlobalContext* globalCtx) {
Quake_SetSpeed(quakeIdx, -0x3CB0);
Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
Quake_SetCountdown(quakeIdx, 7);
func_800AA000(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 0xFF, 0x14, 0x96);
}
Actor_Kill(&pthis->actor);
return;

View File

@ -192,7 +192,7 @@ void func_80A9F408(EnMThunder* pthis, GlobalContext* globalCtx) {
}
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_Shake(0.0f, (s32)(player->unk_858 * 150.0f) & 0xFF, 2, (s32)(player->unk_858 * 150.0f) & 0xFF);
}
if (player->stateFlags2 & 0x20000) {

View File

@ -868,7 +868,7 @@ void EnMb_ClubAttack(EnMb* pthis, GlobalContext* globalCtx) {
effSpawnPos = pthis->effSpawnPos;
effSpawnPos.y = pthis->actor.floorHeight;
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_MONBLIN_HAM_LAND);
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
EffectSsBlast_SpawnWhiteShockwave(globalCtx, &effSpawnPos, &effWhiteShockwaveDynamics,
&effWhiteShockwaveDynamics);
func_80033480(globalCtx, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1);
@ -1053,7 +1053,7 @@ void EnMb_ClubDamaged(EnMb* pthis, GlobalContext* globalCtx) {
if (pthis->timer3 != 0) {
Animation_PlayOnce(&pthis->skelAnime, &gEnMbClubStandUpAnim);
pthis->timer3 = 0;
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Camera_AddQuake(&globalCtx->mainCamera, 2, 25, 5);
} else {
EnMb_SetupClubWaitPlayerNear(pthis);
@ -1112,7 +1112,7 @@ void EnMb_ClubDead(EnMb* pthis, GlobalContext* globalCtx) {
Actor_Kill(&pthis->actor);
}
} else if ((s32)pthis->skelAnime.curFrame == 15 || (s32)pthis->skelAnime.curFrame == 22) {
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Actor_SpawnFloorDustRing(globalCtx, &pthis->actor, &effPos, 50.0f, 10, 3.0f, 400, 60, false);
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_RIZA_DOWN);
Camera_AddQuake(&globalCtx->mainCamera, 2, 25, 5);

View File

@ -344,7 +344,7 @@ void func_80AE2C1C(EnRd* pthis, GlobalContext* globalCtx) {
player->actor.freezeTimer = 40;
func_8008EEAC(globalCtx, &pthis->actor);
GET_PLAYER(globalCtx)->unk_684 = &pthis->actor;
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
}
pthis->unk_306 = 0x3C;
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_REDEAD_AIM);
@ -497,7 +497,7 @@ void func_80AE3454(EnRd* pthis, GlobalContext* globalCtx) {
Animation_PlayLoop(&pthis->skelAnime, &object_rd_Anim_004268);
pthis->unk_304++;
globalCtx->damagePlayer(globalCtx, -8);
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 1, 0xC);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 1, 0xC);
pthis->unk_319 = 20;
case 0:
Math_SmoothStepToS(&pthis->unk_30E, 0, 1, 0x5DC, 0);
@ -531,7 +531,7 @@ void func_80AE3454(EnRd* pthis, GlobalContext* globalCtx) {
if (pthis->unk_319 == 0) {
globalCtx->damagePlayer(globalCtx, -8);
func_800AA000(pthis->actor.xzDistToPlayer, 0xF0, 1, 0xC);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xF0, 1, 0xC);
pthis->unk_319 = 20;
func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92);
}
@ -571,7 +571,7 @@ void func_80AE3834(EnRd* pthis, GlobalContext* globalCtx) {
if (ABS(temp_v0) < 0x2008) {
if (!(pthis->unk_312 & 0x80)) {
player->actor.freezeTimer = 60;
func_800AA000(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Rumble_Shake(pthis->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
func_8008EEAC(globalCtx, &pthis->actor);
}
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_REDEAD_AIM);

View File

@ -605,7 +605,7 @@ void EnRr_Reach(EnRr* pthis, GlobalContext* globalCtx) {
void EnRr_GrabPlayer(EnRr* pthis, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
func_800AA000(pthis->actor.xyzDistToPlayerSq, 120, 2, 120);
Rumble_Shake(pthis->actor.xyzDistToPlayerSq, 120, 2, 120);
if ((pthis->frameCount % 8) == 0) {
Audio_PlayActorSound2(&pthis->actor, NA_SE_EN_LIKE_EAT);
}

View File

@ -854,7 +854,7 @@ s32 EnZl4_CsLookWindow(EnZl4* pthis, GlobalContext* globalCtx) {
globalCtx->csCtx.state = CS_STATE_UNSKIPPABLE_INIT;
}
} else {
func_800AA000(0.0f, 0xA0, 0xA, 0x28);
Rumble_Shake(0.0f, 0xA0, 0xA, 0x28);
func_8002DF54(globalCtx, &pthis->actor, 1);
func_80034EC0(&pthis->skelAnime, sAnimationEntries, ZL4_ANIM_30);
EnZl4_SetCsCameraAngle(globalCtx, 11);

View File

@ -3432,7 +3432,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
}
D_80B7E122 = phi_v0;
D_80B7E0A4 = phi_v0;
func_800A9F6C(0.0f, 60, phi_v0 * 3, 10);
Rumble_Shake2(0.0f, 60, phi_v0 * 3, 10);
} else {
if (pthis->unk_1AC > 70.0f) {
phi_v0 = (s16)Rand_ZeroFloat(5.0f) + 10;
@ -3445,7 +3445,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
}
D_80B7E122 = phi_v0;
D_80B7E0A4 = phi_v0;
func_800A9F6C(0.0f, 180, phi_v0 * 3, 10);
Rumble_Shake2(0.0f, 180, phi_v0 * 3, 10);
}
D_80B7E124 = 0;
@ -3487,11 +3487,11 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
if (D_80B7E0B6 == 2) {
D_80B7E122 = 30;
D_80B7E0A4 = 100;
func_800A9F6C(0.0f, 60, 90, 10);
Rumble_Shake2(0.0f, 60, 90, 10);
} else {
D_80B7E122 = 30;
D_80B7E0A4 = 40;
func_800A9F6C(0.0f, 180, 90, 10);
Rumble_Shake2(0.0f, 180, 90, 10);
}
D_80B7E124 = 0;
@ -3544,7 +3544,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
spA4 = 255.0f;
}
func_800A9F6C(0.0f, spA4, 120, 5);
Rumble_Shake2(0.0f, spA4, 120, 5);
D_80B7E0A4 = 40;
D_80B7FDA8 = 10;
func_80078884(NA_SE_IT_FISHING_HIT);
@ -3575,7 +3575,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
spA4 *= 3.0f / 4.0f;
}
func_800A9F6C(0.0f, spA4, (s16)Rand_ZeroFloat(5.0f) + 10, 5);
Rumble_Shake2(0.0f, spA4, (s16)Rand_ZeroFloat(5.0f) + 10, 5);
}
if (pthis->unk_17A[1] > 30) {
@ -3606,7 +3606,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
} else {
phi_a1 = 180;
}
func_800A9F6C(0.0f, phi_a1, 90, 2);
Rumble_Shake2(0.0f, phi_a1, 90, 2);
pthis->unk_17A[0] = 20;
pthis->unk_17A[1] = 100;
pthis->unk_17A[2] = 20;
@ -3736,7 +3736,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
}
} else {
D_80B7E086 = 0x4082;
func_800A9F6C(0.0f, 1, 3, 1);
Rumble_Shake2(0.0f, 1, 3, 1);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x0A00FF);
}
@ -3759,7 +3759,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) {
pthis->unk_158 = 6;
pthis->unk_17A[0] = 100;
player->unk_860 = 3;
func_800A9F6C(0.0f, 1, 3, 1);
Rumble_Shake2(0.0f, 1, 3, 1);
D_80B7E084++;
func_80064520(globalCtx, &globalCtx->csCtx);
D_80B7A6CC = 100;
@ -4707,7 +4707,7 @@ void Fishing_HandleOwnerDialog(Fishing* pthis, GlobalContext* globalCtx) {
case 0:
if (gSaveContext.rupees >= 20) {
Rupees_ChangeBy(-20);
if (func_800AA148() == 0) {
if (Rumble_IsEnabled() == 0) {
pthis->actor.textId = 0x407C;
} else {
pthis->actor.textId = 0x407D;
@ -5150,7 +5150,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) {
(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_Shake2(0.0f, 150, 10, 10);
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x1400FF);
}
@ -5159,7 +5159,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) {
KREG(0) = 0;
D_80B7E0B6 = 0;
D_80B7A6CC = 20;
func_800A9F6C(0.0f, 150, 10, 10);
Rumble_Shake2(0.0f, 150, 10, 10);
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x1400FF);
}
@ -5319,7 +5319,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) {
sCameraAt.z = camera->at.z;
Message_StartTextbox(globalCtx, 0x409E, NULL);
D_80B7A6CC = 11;
func_800A9F6C(0.0f, 150, 10, 10);
Rumble_Shake2(0.0f, 150, 10, 10);
// fallthrough
}

View File

@ -454,7 +454,7 @@ void ObjSwitch_FloorPress(ObjSwitch* pthis, GlobalContext* globalCtx) {
if (pthis->dyna.actor.scale.y <= 33.0f / 2000.0f) {
ObjSwitch_FloorDownInit(pthis);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_FOOT_SWITCH);
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 120, 20, 10);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 120, 20, 10);
}
}
}
@ -511,7 +511,7 @@ void ObjSwitch_FloorRelease(ObjSwitch* pthis, GlobalContext* globalCtx) {
ObjSwitch_FloorUpInit(pthis);
Audio_PlayActorSound2(&pthis->dyna.actor, NA_SE_EV_FOOT_SWITCH);
if (subType == OBJSWITCH_SUBTYPE_FLOOR_1) {
func_800AA000(pthis->dyna.actor.xyzDistToPlayerSq, 120, 20, 10);
Rumble_Shake(pthis->dyna.actor.xyzDistToPlayerSq, 120, 20, 10);
}
}
}

View File

@ -1246,7 +1246,7 @@ void func_80832630(GlobalContext* globalCtx) {
void func_8083264C(Player* pthis, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
if (pthis->actor.category == ACTORCAT_PLAYER) {
func_800AA000(arg4, arg1, arg2, arg3);
Rumble_Shake(arg4, arg1, arg2, arg3);
}
}

View File

@ -1353,7 +1353,7 @@ void FileChoose_ConfirmFile(GameState* pthisx) {
if (CHECK_BTN_ALL(input->press.button, BTN_START) || (CHECK_BTN_ALL(input->press.button, BTN_A))) {
if (pthis->confirmButtonIndex == FS_BTN_CONFIRM_YES) {
func_800AA000(300.0f, 180, 20, 100);
Rumble_Shake(300.0f, 180, 20, 100);
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pthis->selectMode = SM_FADE_OUT;
func_800F6964(0xF);

View File

@ -384,7 +384,7 @@ void FileChoose_CopyConfirm(GameState* thisx) {
pthis->nextTitleLabel = FS_TITLE_COPY_COMPLETE;
pthis->actionTimer = 8;
pthis->configMode = CM_COPY_ANIM_1;
func_800AA000(300.0f, 0xB4, 0x14, 0x64);
Rumble_Shake(300.0f, 0xB4, 0x14, 0x64);
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} else if (ABS(pthis->stickRelY) >= 30) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
@ -840,7 +840,7 @@ void FileChoose_EraseConfirm(GameState* thisx) {
pthis->actionTimer = 8;
pthis->configMode = CM_ERASE_ANIM_1;
pthis->nextTitleLabel = FS_TITLE_ERASE_COMPLETE;
func_800AA000(200.0f, 0xFF, 0x14, 0x96);
Rumble_Shake(200.0f, 0xFF, 0x14, 0x96);
sEraseDelayTimer = 15;
} else if (ABS(pthis->stickRelY) >= 30) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);

View File

@ -453,7 +453,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
pthis->configMode = CM_NAME_ENTRY_TO_MAIN;
pthis->nameBoxAlpha[pthis->buttonIndex] = pthis->nameAlpha[pthis->buttonIndex] = 200;
pthis->connectorAlpha[pthis->buttonIndex] = 255;
func_800AA000(300.0f, 0xB4, 0x14, 0x64);
Rumble_Shake(300.0f, 0xB4, 0x14, 0x64);
} else {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);

View File

@ -1,6 +1,7 @@
#if !defined(DISABLE_SDL_CONTROLLER)
#include <algorithm>
#include "ultra64/types.h"
#include "padmgr.h"
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
@ -43,6 +44,9 @@ using namespace oot::hid;
static bool g_haptics = false;
extern RumbleStruct g_Rumble;
OSTime osGetTime(void);
//const char* getInputName(int input);
//int getInputValue(const std::string& input);
@ -105,6 +109,9 @@ Joypad::Joypad() : N64Controller()
m_keyBindings[SDL_CONTROLLER_BUTTON_DPAD_UP] = Button::U_CBUTTONS;
m_keyBindings[SDL_CONTROLLER_BUTTON_DPAD_DOWN] = Button::D_CBUTTONS;
//Connect rumble pack callback
g_Rumble.onVibrate = [=](auto strength, auto time, auto decay) { onVibrate(strength, time, decay); };
#ifndef __SWITCH__
loadKeyBindings();
#endif
@ -375,6 +382,8 @@ void Joypad::update()
bool walk = false;
SDL_GameControllerUpdate();
updateVibration();
if (m_context != NULL && !SDL_GameControllerGetAttached(m_context))
{
SDL_GameControllerClose(m_context);
@ -493,4 +502,46 @@ void Joypad::update()
if (m_buttonState[SDL_CONTROLLER_BUTTON_BACK])
m_state.button |= (uint16_t)Button::U_JPAD | (uint16_t)Button::D_JPAD | (uint16_t)Button::L_JPAD | (uint16_t)Button::R_JPAD;
}
void Joypad::onVibrate(uint8_t strength, uint8_t vibtime, uint8_t decay)//Called from the game
{
if (strength <= 20)
return;
if (decay <= 0)
decay = 1;
uint32_t strengthScaled = strength * strength;
//uint32_t strengthScaled = strength * 257;
//uint32_t strengthScaled = strength * 150 + 27135;
if (strengthScaled < m_VibrationStrength)//The new one is weak
return;//Let's not play the new one
auto current_time = osGetTime();
m_VibrationEnds = current_time + (int)(vibtime * 0.04f);
m_VibrationStrength = strengthScaled;
m_VibrationDecay = decay * 15;
xinput.Vibrate(m_VibrationStrength, m_VibrationStrength);
}
//Called once per frame
//BUG: this should not depend on the framerate!
void Joypad::updateVibration()
{
if (m_VibrationStrength <= 0)
return;
auto current_time = osGetTime();
if (current_time >= m_VibrationEnds)//Ease off
{
//m_VibrationStrength -= 250;
m_VibrationStrength -= m_VibrationDecay;
m_VibrationStrength = std::max(m_VibrationStrength, 0);
}
xinput.Vibrate(m_VibrationStrength, m_VibrationStrength);
}
#endif

View File

@ -3,6 +3,7 @@
#include <unordered_map>
#include <SDL2/SDL.h>
#include "controllers.h"
#include "xcontroller.h"
@ -41,16 +42,27 @@ namespace oot
void update() override;
private:
//Old haptics
bool initHaptics();
void closeHaptics();
void SendMotorEvent(short time, short level) override;
void SendMotorDecay(short level) override {};
//New haptics
void onVibrate(uint8_t strength, uint8_t time, uint8_t decay);//Called from the game
void updateVibration();//Called every frame in update()
SDL_GameController* m_context = nullptr;
SDL_Haptic* m_haptic = nullptr;
std::unordered_map<SDL_GameControllerButton, Button> m_keyBindings;
u8 m_buttonState[SDL_CONTROLLER_BUTTON_MAX];
//Haptics
XController xinput;
uint32_t m_VibrationEnds = 0;//Timestamp when the current vibration should end
int32_t m_VibrationStrength = 0;//Strength of the last vibration
int32_t m_VibrationDecay = 0;
};
}
}

View File

@ -0,0 +1,63 @@
#include "xcontroller.h"
#ifdef _WIN32
#include <windows.h>
#include <xinput.h>
//#pragma comment(lib, "Xinput.lib")
#pragma comment(lib, "Xinput9_1_0.lib")
#endif
bool XController::IsConnected() const
{
#ifdef _WIN32
XINPUT_STATE state;
return XInputGetState(m_ID, &state) == ERROR_SUCCESS;
#else
return false;
#endif
}
bool XController::Update()
{
#ifdef _WIN32
XINPUT_STATE state;
XInputGetState(m_ID, &state);
if (m_LastPacketNum == state.dwPacketNumber)
return false;
m_State.wButtons_Previous = m_State.wButtons;
m_State.wButtons = state.Gamepad.wButtons;
m_State.bLeftTrigger = state.Gamepad.bLeftTrigger;
m_State.bRightTrigger = state.Gamepad.bRightTrigger;
m_State.sThumbLX = state.Gamepad.sThumbLX;
m_State.sThumbLY = state.Gamepad.sThumbLY;
m_State.sThumbRX = state.Gamepad.sThumbRX;
m_State.sThumbRY = state.Gamepad.sThumbRY;
return true;
#else
return false;
#endif
}
bool XController::Vibrate(uint16_t LowFreq, uint16_t HighFreq)
{
#ifdef _WIN32
XINPUT_VIBRATION vibration;
vibration.wLeftMotorSpeed = LowFreq;
vibration.wRightMotorSpeed = HighFreq;
return XInputSetState(m_ID, &vibration) == ERROR_SUCCESS;
#else
return false;
#endif
}

View File

@ -0,0 +1,80 @@
#pragma once
//XInput controller class written by DaMarkov
#include <stdint.h>
class XController
{
class State
{
friend class XController;
public:
bool DPad_Up() const { return wButtons & 0x0001; }
bool DPad_Down() const { return wButtons & 0x0002; }
bool DPad_Left() const { return wButtons & 0x0004; }
bool DPad_Right() const { return wButtons & 0x0008; }
bool Start() const { return wButtons & 0x0010; }
bool Back() const { return wButtons & 0x0020; }
bool Thumb_Left() const { return wButtons & 0x0040; }
bool Thumb_Right() const { return wButtons & 0x0080; }
bool Shoulder_Left() const { return wButtons & 0x0100; }
bool Shoulder_Right() const { return wButtons & 0x0200; }
bool Button_A() const { return wButtons & 0x1000; }
bool Button_B() const { return wButtons & 0x2000; }
bool Button_X() const { return wButtons & 0x4000; }
bool Button_Y() const { return wButtons & 0x8000; }
bool Button_A_Up() const { return wButtons_Previous & ~wButtons & 0x1000; }
bool Button_B_Up() const { return wButtons_Previous & ~wButtons & 0x2000; }
bool Button_X_Up() const { return wButtons_Previous & ~wButtons & 0x4000; }
bool Button_Y_Up() const { return wButtons_Previous & ~wButtons & 0x8000; }
bool Button_A_Down() const { return ~wButtons_Previous & wButtons & 0x1000; }
bool Button_B_Down() const { return ~wButtons_Previous & wButtons & 0x2000; }
bool Button_X_Down() const { return ~wButtons_Previous & wButtons & 0x4000; }
bool Button_Y_Down() const { return ~wButtons_Previous & wButtons & 0x8000; }
uint8_t Trigger_Left() const { return bLeftTrigger; }
uint8_t Trigger_Right() const { return bRightTrigger; }
int16_t Joystick_LeftX() const { return sThumbLX; }
int16_t Joystick_LeftY() const { return sThumbLY; }
int16_t Joystick_RightX() const { return sThumbRX; }
int16_t Joystick_RightY() const { return sThumbRY; }
private:
uint16_t wButtons_Previous;
uint16_t wButtons;
uint8_t bLeftTrigger;
uint8_t bRightTrigger;
int16_t sThumbLX;
int16_t sThumbLY;
int16_t sThumbRX;
int16_t sThumbRY;
};
public:
XController(uint32_t ControllerID = 0) : m_ID(ControllerID) { Update(); }
~XController() { Vibrate(0, 0); }
bool IsConnected() const;
bool Update();//Updates the Controller, returns true if a change has occured
const State& GetState() const { return m_State; }
bool Vibrate(uint16_t LowFreq, uint16_t HighFreq);
private:
State m_State;
uint32_t m_ID;
uint32_t m_LastPacketNum = 0;
};

View File

@ -77,6 +77,7 @@ OSTime osGetTime(void)
#else
OSTime osGetTime(void)
{
//Don't used (uint32_t)time(NULL), it's not accurate enough for rumble!
return 0;
}
#endif

View File

@ -1922,6 +1922,7 @@
<ClCompile Include="..\src\port\controller\keyboard.cpp" />
<ClCompile Include="..\src\port\controller\sdl.cpp" />
<ClCompile Include="..\src\port\controller\tas.cpp" />
<ClCompile Include="..\src\port\controller\xcontroller.cpp" />
<ClCompile Include="..\src\port\debug.cpp" />
<ClCompile Include="..\src\port\main.cpp" />
<ClCompile Include="..\src\port\mixer.cpp" />
@ -1984,6 +1985,7 @@
<ClInclude Include="..\src\port\controller\keyboard.h" />
<ClInclude Include="..\src\port\controller\sdl.h" />
<ClInclude Include="..\src\port\controller\tas.h" />
<ClInclude Include="..\src\port\controller\xcontroller.h" />
<ClInclude Include="..\src\port\player\player.h" />
<ClInclude Include="..\src\port\player\players.h" />
</ItemGroup>

View File

@ -5199,6 +5199,9 @@
<ClCompile Include="..\src\code\framerate.cpp">
<Filter>Source Files\code</Filter>
</ClCompile>
<ClCompile Include="..\src\port\controller\xcontroller.cpp">
<Filter>Source Files\port\controller</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\segment_symbols.h">
@ -5348,5 +5351,8 @@
<ClInclude Include="..\include\asset_common.h">
<Filter>Header Files\include</Filter>
</ClInclude>
<ClInclude Include="..\src\port\controller\xcontroller.h">
<Filter>Source Files\port\controller</Filter>
</ClInclude>
</ItemGroup>
</Project>