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

Quake Documentation Pass (#1402)

* begin quake docs

* continue cleanup

* quake offset

* many more docs

* cleanup

* more cleanup

* cleanup headers

* move quake value to internal

* update, still need to test shake zoom/yaw

* more docs

* better docs

* add file descriptions

* fix comment

* explain random index

* cleanup comments

* better type 6 docs

* expand orientation comment

* fix old names, add comment

* remove comment, twas a mistake

* easy PR feedback

* duration in dec

* rm offset, clear up roll

* oops

* merge shakeInfo and QuakeCamData

* match order that always appears in code

* more PR suggestions

* adjust comment

* zeroVec

* rm extra space

* roman PR suggestions
This commit is contained in:
engineer124 2022-10-15 02:16:37 -04:00 committed by GitHub
parent d1d946a197
commit 9675051377
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 737 additions and 620 deletions

View file

@ -488,9 +488,9 @@ s32 Actor_IsTargeted(PlayState* play, Actor* actor);
s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor);
f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5);
void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play);
void func_80033DB8(PlayState* play, s16 arg1, s16 arg2);
void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3);
void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3);
void Actor_RequestQuake(PlayState* play, s16 y, s16 duration);
void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed);
void Actor_RequestQuakeAndRumble(Actor* actor, PlayState* play, s16 quakeY, s16 quakeDuration);
f32 Rand_ZeroFloat(f32 f);
f32 Rand_CenteredFloat(f32 f);
void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type);
@ -666,7 +666,7 @@ s16 Camera_GetInputDirYaw(Camera* camera);
Vec3s* Camera_GetCamDir(Vec3s* dst, Camera* camera);
s16 Camera_GetCamDirPitch(Camera* camera);
s16 Camera_GetCamDirYaw(Camera* camera);
s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown);
s32 Camera_RequestQuake(Camera* camera, s32 unused, s16 y, s32 duration);
s32 Camera_SetParam(Camera* camera, s32 param, void* value);
s32 func_8005AC48(Camera* camera, s16 arg1);
s16 func_8005ACFC(Camera* camera, s16 arg1);
@ -677,7 +677,7 @@ s32 Camera_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCa
s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 bgCamIndex, f32 arg3, s16 timer1, s16 timer2,
s16 timer3);
s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera);
Vec3f* Camera_GetSkyboxOffset(Vec3f* dst, Camera* camera);
Vec3f* Camera_GetQuakeOffset(Vec3f* quakeOffset, Camera* camera);
void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3,
UNK_TYPE arg6);
s32 func_8005B198(void);
@ -1059,28 +1059,6 @@ u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime);
void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots);
void PreNMI_Init(GameState* thisx);
Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2);
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x);
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_GetFreeIndex(void);
QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx);
void Quake_Remove(QuakeRequest* req);
QuakeRequest* Quake_GetRequest(s16 idx);
QuakeRequest* Quake_SetValue(s16 idx, s16 valueType, s16 value);
u32 Quake_SetSpeed(s16 idx, s16 value);
u32 Quake_SetCountdown(s16 idx, s16 value);
s16 Quake_GetCountdown(s16 idx);
u32 Quake_SetQuakeValues(s16 idx, s16 y, s16 x, s16 zoom, s16 rotZ);
u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2);
void Quake_Init(void);
s16 Quake_Add(Camera* camera, u32 callbackIdx);
u32 Quake_RemoveFromIdx(s16 idx);
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData);
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);

44
include/quake.h Normal file
View file

@ -0,0 +1,44 @@
#ifndef QUAKE_H
#define QUAKE_H
#include "z64camera.h"
#include "z64math.h"
typedef struct {
/* 0x00 */ Vec3f atOffset;
/* 0x0C */ Vec3f eyeOffset;
/* 0x18 */ s16 upPitchOffset; // gives a "roll" effect by offsetting the Up vector
/* 0x1A */ s16 upYawOffset; // gives a "roll" effect by offsetting the Up vector
/* 0x1C */ s16 fovOffset; // binary angle
/* 0x20 */ f32 maxOffset;
} ShakeInfo; // size = 0x24
typedef enum {
/* 0 */ QUAKE_TYPE_NONE,
/* 1 */ QUAKE_TYPE_1, // Periodic, sustaining, random X perturbations
/* 2 */ QUAKE_TYPE_2, // Aperiodic, sustaining, random X perturbations
/* 3 */ QUAKE_TYPE_3, // Periodic, decaying
/* 4 */ QUAKE_TYPE_4, // Aperiodic, decaying, random X perturbations
/* 5 */ QUAKE_TYPE_5, // Periodic, sustaining
/* 6 */ QUAKE_TYPE_6 // See below
} QuakeType;
// Quake type 6 is Jump-Periodic, sustaining, random X perturbations,
// resets period every 16 frames (jumps, similar to sawtooth),
// continues indefinitely i.e. does not terminate when the timer reaches 0
// must be manually removed
s16 Quake_Request(Camera* camera, u32 type);
u32 Quake_SetSpeed(s16 index, s16 speed);
u32 Quake_SetPerturbations(s16 index, s16 y, s16 x, s16 fov, s16 roll);
u32 Quake_SetDuration(s16 index, s16 duration);
u32 Quake_SetOrientation(s16 index, s16 isRelativeToScreen, Vec3s orientation);
s16 Quake_GetTimeLeft(s16 index);
u32 Quake_RemoveRequest(s16 index);
void Quake_Init(void);
s16 Quake_Update(Camera* camera, ShakeInfo* camShake);
#endif

View file

@ -1617,46 +1617,6 @@ typedef struct {
/* 0x10 */ OSTime resetTime;
} PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused)
typedef struct {
/* 0x00 */ s16 unk_00;
/* 0x02 */ s16 unk_02;
/* 0x04 */ s16 unk_04;
} SubQuakeRequest14;
typedef struct {
/* 0x00 */ s16 randIdx;
/* 0x02 */ s16 countdownMax;
/* 0x04 */ Camera* cam;
/* 0x08 */ u32 callbackIdx;
/* 0x0C */ s16 y;
/* 0x0E */ s16 x;
/* 0x10 */ s16 zoom;
/* 0x12 */ s16 rotZ;
/* 0x14 */ SubQuakeRequest14 unk_14;
/* 0x1A */ s16 speed;
/* 0x1C */ s16 unk_1C;
/* 0x1E */ s16 countdown;
/* 0x20 */ s16 camPtrIdx;
} QuakeRequest; // size = 0x24
typedef struct {
/* 0x00 */ Vec3f vec1;
/* 0x0C */ Vec3f vec2;
/* 0x18 */ s16 rotZ;
/* 0x1A */ s16 unk_1A;
/* 0x1C */ s16 zoom;
} ShakeInfo; // size = 0x1E
typedef struct {
/* 0x00 */ Vec3f atOffset;
/* 0x0C */ Vec3f eyeOffset;
/* 0x18 */ s16 rotZ;
/* 0x1A */ s16 unk_1A;
/* 0x1C */ s16 zoom;
/* 0x20 */ f32 unk_20;
} QuakeCamCalc; // size = 0x24
#define UCODE_NULL 0
#define UCODE_F3DZEX 1
#define UCODE_UNK 2

View file

@ -151,7 +151,7 @@ typedef struct {
#define ACTOR_FLAG_9 (1 << 9)
#define ACTOR_FLAG_10 (1 << 10)
#define ACTOR_FLAG_ENKUSA_CUT (1 << 11)
#define ACTOR_FLAG_12 (1 << 12)
#define ACTOR_FLAG_IGNORE_QUAKE (1 << 12) // actor will not shake when a quake occurs
#define ACTOR_FLAG_13 (1 << 13)
#define ACTOR_FLAG_14 (1 << 14)
#define ACTOR_FLAG_15 (1 << 15)

View file

@ -1348,13 +1348,13 @@ typedef struct {
/* 0x24 */ s32 bgId;
} CamColChk; // size = 0x28
typedef struct {
typedef struct Camera {
/* 0x000 */ CamParamData paramData;
/* 0x050 */ Vec3f at;
/* 0x05C */ Vec3f eye;
/* 0x068 */ Vec3f up;
/* 0x074 */ Vec3f eyeNext;
/* 0x080 */ Vec3f skyboxOffset;
/* 0x080 */ Vec3f quakeOffset;
/* 0x08C */ struct PlayState* play;
/* 0x090 */ struct Player* player;
/* 0x094 */ PosRot playerPosRot;
@ -1378,7 +1378,7 @@ typedef struct {
/* 0x114 */ f32 waterYPos;
/* 0x118 */ s32 bgCamIndexBeforeUnderwater;
/* 0x11C */ s32 waterCamSetting;
/* 0x120 */ s32 waterQuakeId;
/* 0x120 */ s32 waterQuakeIndex;
/* 0x124 */ void* data0;
/* 0x128 */ void* data1;
/* 0x12C */ s16 data2;

View file

@ -1,4 +1,5 @@
#include "global.h"
#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
@ -2179,11 +2180,11 @@ void Actor_Draw(PlayState* play, Actor* actor) {
Lights_BindAll(lights, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos);
Lights_Draw(lights, play->state.gfxCtx);
if (actor->flags & ACTOR_FLAG_12) {
Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.skyboxOffset.x,
if (actor->flags & ACTOR_FLAG_IGNORE_QUAKE) {
Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.quakeOffset.x,
actor->world.pos.y +
((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y),
actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot);
((actor->shape.yOffset * actor->scale.y) + play->mainCamera.quakeOffset.y),
actor->world.pos.z + play->mainCamera.quakeOffset.z, &actor->shape.rot);
} else {
Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
actor->world.pos.z, &actor->shape.rot);
@ -3505,30 +3506,29 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8155);
}
void func_80033DB8(PlayState* play, s16 arg1, s16 arg2) {
s16 var = Quake_Add(&play->mainCamera, 3);
void Actor_RequestQuake(PlayState* play, s16 y, s16 duration) {
s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3);
Quake_SetSpeed(var, 20000);
Quake_SetQuakeValues(var, arg1, 0, 0, 0);
Quake_SetCountdown(var, arg2);
Quake_SetSpeed(quakeIndex, 20000);
Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
Quake_SetDuration(quakeIndex, duration);
}
void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3) {
s16 var = Quake_Add(&play->mainCamera, 3);
void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed) {
s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3);
Quake_SetSpeed(var, arg3);
Quake_SetQuakeValues(var, arg1, 0, 0, 0);
Quake_SetCountdown(var, arg2);
Quake_SetSpeed(quakeIndex, speed);
Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
Quake_SetDuration(quakeIndex, duration);
}
void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3) {
if (arg2 >= 5) {
void Actor_RequestQuakeAndRumble(Actor* actor, PlayState* play, s16 quakeY, s16 quakeDuration) {
if (quakeY >= 5) {
Rumble_Request(actor->xyzDistToPlayerSq, 255, 20, 150);
} else {
Rumble_Request(actor->xyzDistToPlayerSq, 180, 20, 100);
}
func_80033DB8(play, arg2, arg3);
Actor_RequestQuake(play, quakeY, quakeDuration);
}
f32 Rand_ZeroFloat(f32 f) {

View file

@ -1,5 +1,6 @@
#include "ultra64.h"
#include "global.h"
#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
@ -6972,7 +6973,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState
camera->up.y = 1.0f;
camera->up.z = camera->up.x = 0.0f;
camera->skyboxOffset.x = camera->skyboxOffset.y = camera->skyboxOffset.z = 0;
camera->quakeOffset.x = camera->quakeOffset.y = camera->quakeOffset.z = 0;
camera->atLERPStepScale = 1;
sCameraInterfaceFlags = 0xFF00;
sDbgModeIdx = -1;
@ -7185,11 +7186,11 @@ void Camera_PrintSettings(Camera* camera) {
s32 Camera_UpdateWater(Camera* camera) {
f32 waterY;
s16 newQuakeId;
s16 quakeIndex;
s32 waterLightsIndex;
s32* waterCamSetting = &camera->waterCamSetting;
s16 waterBgCamIndex;
s16* quakeId = (s16*)&camera->waterQuakeId;
s16* waterQuakeIndex = (s16*)&camera->waterQuakeIndex;
Player* player = camera->player;
s16 prevBgId;
@ -7213,7 +7214,7 @@ s32 Camera_UpdateWater(Camera* camera) {
camera->unk_14C |= 0x200;
camera->waterYPos = waterY;
camera->bgCamIndexBeforeUnderwater = camera->bgCamIndex;
*quakeId = -1;
*waterQuakeIndex = -1;
}
if (camera->playerGroundY != camera->playerPosRot.pos.y) {
prevBgId = camera->bgId;
@ -7229,7 +7230,7 @@ s32 Camera_UpdateWater(Camera* camera) {
camera->unk_14C |= 0x200;
camera->waterYPos = waterY;
camera->bgCamIndexBeforeUnderwater = camera->bgCamIndex;
*quakeId = -1;
*waterQuakeIndex = -1;
}
if (camera->playerGroundY != camera->playerPosRot.pos.y) {
prevBgId = camera->bgId;
@ -7266,16 +7267,19 @@ s32 Camera_UpdateWater(Camera* camera) {
Audio_SetExtraFilter(0x20);
if (PREG(81)) {
Quake_RemoveFromIdx(*quakeId);
*quakeId = -1;
Quake_RemoveRequest(*waterQuakeIndex);
*waterQuakeIndex = -1;
PREG(81) = 0;
}
if ((*quakeId == -1) || (Quake_GetCountdown(*quakeId) == 0xA)) {
if (*quakeId = newQuakeId = Quake_Add(camera, 5U), newQuakeId != 0) {
Quake_SetSpeed(*quakeId, 550);
Quake_SetQuakeValues(*quakeId, 1, 1, 180, 0);
Quake_SetCountdown(*quakeId, 1000);
if ((*waterQuakeIndex == -1) || (Quake_GetTimeLeft(*waterQuakeIndex) == 10)) {
quakeIndex = Quake_Request(camera, QUAKE_TYPE_5);
*waterQuakeIndex = quakeIndex;
if (quakeIndex != 0) {
Quake_SetSpeed(*waterQuakeIndex, 550);
Quake_SetPerturbations(*waterQuakeIndex, 1, 1, 180, 0);
Quake_SetDuration(*waterQuakeIndex, 1000);
}
}
@ -7292,8 +7296,8 @@ s32 Camera_UpdateWater(Camera* camera) {
camera->unk_14C &= ~0x100;
osSyncPrintf("kankyo changed water off, sound off\n");
Environment_DisableUnderwaterLights(camera->play);
if (*quakeId != 0) {
Quake_RemoveFromIdx(*quakeId);
if (*waterQuakeIndex != 0) {
Quake_RemoveRequest(*waterQuakeIndex);
}
camera->waterDistortionTimer = 0;
camera->distortionFlags = 0;
@ -7438,8 +7442,9 @@ Vec3s Camera_Update(Camera* camera) {
f32 playerXZSpeed;
VecSph eyeAtAngle;
s16 bgCamIndex;
s16 numQuakesApplied;
PosRot curPlayerPosRot;
QuakeCamCalc quake;
ShakeInfo camShake;
Player* player;
player = camera->play->cameraPtrs[CAM_ID_MAIN]->player;
@ -7602,19 +7607,23 @@ Vec3s Camera_Update(Camera* camera) {
return camera->inputDir;
}
// setting bgId to the ret of Quake_Calc, and checking that
// is required, it doesn't make too much sense though.
if ((bgId = Quake_Calc(camera, &quake), bgId != 0) && (camera->setting != CAM_SET_TURN_AROUND)) {
viewAt.x = camera->at.x + quake.atOffset.x;
viewAt.y = camera->at.y + quake.atOffset.y;
viewAt.z = camera->at.z + quake.atOffset.z;
viewEye.x = camera->eye.x + quake.eyeOffset.x;
viewEye.y = camera->eye.y + quake.eyeOffset.y;
viewEye.z = camera->eye.z + quake.eyeOffset.z;
numQuakesApplied = Quake_Update(camera, &camShake);
bgId = numQuakesApplied; // required to match
if ((numQuakesApplied != 0) && (camera->setting != CAM_SET_TURN_AROUND)) {
viewAt.x = camera->at.x + camShake.atOffset.x;
viewAt.y = camera->at.y + camShake.atOffset.y;
viewAt.z = camera->at.z + camShake.atOffset.z;
viewEye.x = camera->eye.x + camShake.eyeOffset.x;
viewEye.y = camera->eye.y + camShake.eyeOffset.y;
viewEye.z = camera->eye.z + camShake.eyeOffset.z;
OLib_Vec3fDiffToVecSphGeo(&eyeAtAngle, &viewEye, &viewAt);
Camera_CalcUpFromPitchYawRoll(&viewUp, eyeAtAngle.pitch + quake.rotZ, eyeAtAngle.yaw + quake.unk_1A,
camera->roll);
viewFov = camera->fov + CAM_BINANG_TO_DEG(quake.zoom);
Camera_CalcUpFromPitchYawRoll(&viewUp, eyeAtAngle.pitch + camShake.upPitchOffset,
eyeAtAngle.yaw + camShake.upYawOffset, camera->roll);
viewFov = camera->fov + CAM_BINANG_TO_DEG(camShake.fovOffset);
} else {
viewAt = camera->at;
viewEye = camera->eye;
@ -7630,7 +7639,7 @@ Vec3s Camera_Update(Camera* camera) {
camera->up = viewUp;
}
camera->skyboxOffset = quake.eyeOffset;
camera->quakeOffset = camShake.eyeOffset;
Camera_UpdateDistortion(camera);
@ -8010,17 +8019,17 @@ s16 Camera_GetCamDirYaw(Camera* camera) {
return camDir.y;
}
s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown) {
s16 quakeIdx;
s32 Camera_RequestQuake(Camera* camera, s32 unused, s16 y, s32 duration) {
s16 quakeIndex;
quakeIdx = Quake_Add(camera, 3);
if (quakeIdx == 0) {
return 0;
quakeIndex = Quake_Request(camera, QUAKE_TYPE_3);
if (quakeIndex == 0) {
return false;
}
Quake_SetSpeed(quakeIdx, 0x61A8);
Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0);
Quake_SetCountdown(quakeIdx, countdown);
return 1;
Quake_SetSpeed(quakeIndex, 0x61A8);
Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
Quake_SetDuration(quakeIndex, duration);
return true;
}
s32 Camera_SetParam(Camera* camera, s32 param, void* value) {
@ -8187,9 +8196,9 @@ s32 Camera_GetDbgCamEnabled(void) {
return gDbgCamEnabled;
}
Vec3f* Camera_GetSkyboxOffset(Vec3f* dst, Camera* camera) {
*dst = camera->skyboxOffset;
return dst;
Vec3f* Camera_GetQuakeOffset(Vec3f* quakeOffset, Camera* camera) {
*quakeOffset = camera->quakeOffset;
return quakeOffset;
}
void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3,

View file

@ -1,4 +1,5 @@
#include "global.h"
#include "quake.h"
#include "z64camera.h"
#include "assets/scenes/indoors/tokinoma/tokinoma_scene.h"
@ -311,15 +312,15 @@ void func_80064824(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
break;
case 16:
if (sp3F != 0) {
sQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
sQuakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sQuakeIndex, 0x7FFF);
Quake_SetQuakeValues(sQuakeIndex, 4, 0, 1000, 0);
Quake_SetCountdown(sQuakeIndex, 800);
Quake_SetPerturbations(sQuakeIndex, 4, 0, 1000, 0);
Quake_SetDuration(sQuakeIndex, 800);
}
break;
case 17:
if (sp3F != 0) {
Quake_RemoveFromIdx(sQuakeIndex);
Quake_RemoveRequest(sQuakeIndex);
}
break;
case 18:

View file

@ -1,4 +1,5 @@
#include "global.h"
#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Sw/z_en_sw.h"
@ -156,10 +157,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne();
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 5);
i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
Quake_SetQuakeValues(i, 4, 5, 40, 0x3C);
Quake_SetCountdown(i, 1600);
Quake_SetPerturbations(i, 4, 5, 40, 0x3C);
Quake_SetDuration(i, 1600);
break;
case 2280:
csInfo->keyFrames = D_80120D4C;
@ -177,10 +178,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne();
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 5);
i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
Quake_SetQuakeValues(i, 2, 3, 200, 0x32);
Quake_SetCountdown(i, 9999);
Quake_SetPerturbations(i, 2, 3, 200, 0x32);
Quake_SetDuration(i, 9999);
break;
case 2220:
csInfo->keyFrames = D_80120E64;
@ -188,10 +189,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 5);
i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
Quake_SetQuakeValues(i, 2, 2, 50, 0);
Quake_SetCountdown(i, 280);
Quake_SetPerturbations(i, 2, 2, 50, 0);
Quake_SetDuration(i, 280);
break;
case 2230:
if (player->actor.world.pos.z < 1000.0f) {
@ -210,10 +211,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 5);
i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
Quake_SetQuakeValues(i, 2, 2, 50, 0);
Quake_SetCountdown(i, 60);
Quake_SetPerturbations(i, 2, 2, 50, 0);
Quake_SetDuration(i, 60);
break;
case 2350:
csInfo->keyFrames = D_8012110C;
@ -397,10 +398,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 3);
i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 22000);
Quake_SetQuakeValues(i, 2, 0, 200, 0);
Quake_SetCountdown(i, 10);
Quake_SetPerturbations(i, 2, 0, 200, 0);
Quake_SetDuration(i, 10);
break;
case 3080:
csInfo->keyFrames = D_80121774;
@ -435,10 +436,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 24000);
Quake_SetQuakeValues(i, 2, 0, 0, 0);
Quake_SetCountdown(i, 160);
Quake_SetPerturbations(i, 2, 0, 0, 0);
Quake_SetDuration(i, 160);
break;
case 3060:
csInfo->keyFrames = D_80121904;
@ -467,10 +468,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
D_8012021C[D_801202FC - 3].pos.z +=
(D_8012021C[D_801202FC - 2].pos.z - D_8012021C[D_801202FC - 3].pos.z) / 2;
i = Quake_Add(mainCam, 3);
i = Quake_Request(mainCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 30000);
Quake_SetQuakeValues(i, 2, 1, 1, 0);
Quake_SetCountdown(i, 200);
Quake_SetPerturbations(i, 2, 1, 1, 0);
Quake_SetDuration(i, 200);
break;
case 3120:
csInfo->keyFrames = D_80121954[-(timer + 101)];
@ -583,10 +584,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
Play_CameraSetAtEye(play, CAM_ID_MAIN, &spC0, &spB4);
i = Quake_Add(subCam, 3);
i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 22000);
Quake_SetQuakeValues(i, 1, 0, 0, 0);
Quake_SetCountdown(i, 90);
Quake_SetPerturbations(i, 1, 0, 0, 0);
Quake_SetDuration(i, 90);
break;
case 6010:
Actor_GetWorld(&spA0, actor);
@ -637,10 +638,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
OnePointCutscene_SetCsCamPoints(subCam, D_801208E8, D_801208E4, D_801206A0, D_80120760);
}
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
Quake_SetQuakeValues(i, 0, 0, 20, 0);
Quake_SetCountdown(i, D_801208E4 - 10);
Quake_SetPerturbations(i, 0, 0, 20, 0);
Quake_SetDuration(i, D_801208E4 - 10);
break;
case 3400:
Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3);
@ -649,10 +650,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos);
OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_801204D4[D_80120694 - 2].pos);
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 0x4E20);
Quake_SetQuakeValues(i, 1, 0, 50, 0);
Quake_SetCountdown(i, D_80120698 - 20);
Quake_SetPerturbations(i, 1, 0, 50, 0);
Quake_SetDuration(i, D_80120698 - 20);
break;
case 3390:
player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = -0x3FD9;
@ -668,10 +669,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
Play_CopyCamera(play, subCamId, CAM_ID_MAIN);
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
Quake_SetQuakeValues(i, 2, 0, 0, 0);
Quake_SetCountdown(i, timer);
Quake_SetPerturbations(i, 2, 0, 0, 0);
Quake_SetDuration(i, timer);
break;
case 3290:
D_80121F1C[0].atTargetInit = play->view.at;
@ -685,10 +686,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 3);
i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
Quake_SetQuakeValues(i, 0, 0, 1000, 0);
Quake_SetCountdown(i, 5);
Quake_SetPerturbations(i, 0, 0, 1000, 0);
Quake_SetDuration(i, 5);
break;
case 3340:
D_80121FBC[0].atTargetInit = play->view.at;
@ -701,10 +702,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 3);
i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
Quake_SetQuakeValues(i, 0, 0, 1000, 0);
Quake_SetCountdown(i, 5);
Quake_SetPerturbations(i, 0, 0, 1000, 0);
Quake_SetDuration(i, 5);
break;
case 3360:
csInfo->keyFrames = D_8012205C;
@ -746,10 +747,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
Quake_SetQuakeValues(i, 4, 0, 0, 0);
Quake_SetCountdown(i, 20);
Quake_SetPerturbations(i, 4, 0, 0, 0);
Quake_SetDuration(i, 20);
break;
case 3450:
csInfo->keyFrames = D_8012237C;
@ -758,10 +759,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF38(play, &player->actor, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
Quake_SetQuakeValues(i, 2, 0, 0, 0);
Quake_SetCountdown(i, 10);
Quake_SetPerturbations(i, 2, 0, 0, 0);
Quake_SetDuration(i, 10);
break;
case 3440:
csInfo->keyFrames = D_801223CC;
@ -772,10 +773,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
player->stateFlags1 |= PLAYER_STATE1_29;
player->actor.freezeTimer = 90;
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
Quake_SetQuakeValues(i, 2, 0, 0, 0);
Quake_SetCountdown(i, 10);
Quake_SetPerturbations(i, 2, 0, 0, 0);
Quake_SetDuration(i, 10);
break;
case 3430:
csInfo->keyFrames = D_801224BC;
@ -784,10 +785,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 1);
i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
Quake_SetQuakeValues(i, 1, 0, 10, 0);
Quake_SetCountdown(i, 20);
Quake_SetPerturbations(i, 1, 0, 10, 0);
Quake_SetDuration(i, 20);
break;
case 4100:
csInfo->keyFrames = D_801225D4;
@ -867,10 +868,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
i = Quake_Add(subCam, 3);
i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
Quake_SetQuakeValues(i, 0, 1, 100, 0);
Quake_SetCountdown(i, timer - 80);
Quake_SetPerturbations(i, 0, 1, 100, 0);
Quake_SetDuration(i, timer - 80);
break;
case 4220:
csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64;
@ -879,10 +880,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
func_8002DF38(play, &player->actor, 1);
i = Quake_Add(subCam, 3);
i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
Quake_SetQuakeValues(i, 0, 1, 10, 0);
Quake_SetCountdown(i, timer - 10);
Quake_SetPerturbations(i, 0, 1, 10, 0);
Quake_SetDuration(i, timer - 10);
break;
case 4221:
csInfo->keyFrames = D_80122C8C;

View file

@ -1,4 +1,5 @@
#include "global.h"
#include "quake.h"
#include "vt.h"
void* D_8012D1F0 = NULL;
@ -1176,11 +1177,11 @@ void Play_Draw(PlayState* this) {
if ((HREG(80) != 10) || (HREG(83) != 0)) {
if ((this->skyboxCtx.unk_140 != 0) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) {
Vec3f sp74;
Vec3f quakeOffset;
Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(this));
SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp74.x,
this->view.eye.y + sp74.y, this->view.eye.z + sp74.z);
Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(this));
SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + quakeOffset.x,
this->view.eye.y + quakeOffset.y, this->view.eye.z + quakeOffset.z);
}
}

View file

@ -1,280 +1,362 @@
#include "global.h"
#include "quake.h"
#include "vt.h"
QuakeRequest sQuakeRequest[4];
s16 D_80126250 = 1;
typedef struct {
/* 0x00 */ s16 index;
/* 0x02 */ s16 duration;
/* 0x04 */ Camera* cam;
/* 0x08 */ u32 type;
/* 0x0C */ s16 y;
/* 0x0E */ s16 x;
/* 0x10 */ s16 fov;
/* 0x12 */ s16 upPitchOffset;
/* 0x14 */ Vec3s orientation; // alters the orientation of the xy perturbation. Only x (pitch) and y (yaw) are used
/* 0x1A */ s16 speed;
/* 0x1C */ s16 isRelativeToScreen; // is the quake relative to the screen or on world coordinates
/* 0x1E */ s16 timer;
/* 0x20 */ s16 camId;
} QuakeRequest; // size = 0x24
QuakeRequest sQuakeRequests[4];
s16 sQuakeUnused = 1;
s16 sQuakeRequestCount = 0;
s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6,
};
Vec3f* Quake_VecSphGeoAddToVec3f(Vec3f* dst, Vec3f* a, VecSph* sph) {
Vec3f vec;
Vec3f b;
Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2) {
Vec3f vec1;
Vec3f vec2;
OLib_VecSphGeoToVec3f(&b, sph);
vec.x = a->x + b.x;
vec.y = a->y + b.y;
vec.z = a->z + b.z;
*dst = vec;
OLib_VecSphGeoToVec3f(&vec2, arg2);
vec1.x = arg1->x + vec2.x;
vec1.y = arg1->y + vec2.y;
vec1.z = arg1->z + vec2.z;
*dst = vec1;
return dst;
}
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x) {
Vec3f* unk50 = &req->cam->at;
Vec3f* unk5C = &req->cam->eye;
Vec3f* at = &req->cam->at;
Vec3f* eye = &req->cam->eye;
Vec3f offset;
VecSph sph;
VecSph eyeToAtSph;
Vec3f vec;
VecSph struc2;
VecSph struc1;
Vec3f vec2;
if (req->isRelativeToScreen) {
offset.x = 0;
offset.y = 0;
offset.z = 0;
OLib_Vec3fDiffToVecSphGeo(&eyeToAtSph, eye, at);
if (req->unk_1C) {
vec.x = 0;
vec.y = 0;
vec.z = 0;
OLib_Vec3fDiffToVecSphGeo(&struc1, unk5C, unk50);
struc2.r = req->y * y;
struc2.pitch = struc1.pitch + req->unk_14.unk_00 + 0x4000;
struc2.yaw = struc1.yaw + req->unk_14.unk_02;
Quake_AddVec(&vec, &vec, &struc2);
struc2.r = req->x * x;
struc2.pitch = struc1.pitch + req->unk_14.unk_00;
struc2.yaw = struc1.yaw + req->unk_14.unk_02 + 0x4000;
Quake_AddVec(&vec, &vec, &struc2);
// y shake
sph.r = req->y * y;
// point unit vector up, then add on `req->orientation`
sph.pitch = eyeToAtSph.pitch + req->orientation.x + 0x4000;
sph.yaw = eyeToAtSph.yaw + req->orientation.y;
// apply y shake
Quake_VecSphGeoAddToVec3f(&offset, &offset, &sph);
// x shake
sph.r = req->x * x;
// point unit vector left, then add on `req->orientation`
sph.pitch = eyeToAtSph.pitch + req->orientation.x;
sph.yaw = eyeToAtSph.yaw + req->orientation.y + 0x4000;
// apply x shake
Quake_VecSphGeoAddToVec3f(&offset, &offset, &sph);
} else {
vec.x = 0;
vec.y = req->y * y;
vec.z = 0;
struc2.r = req->x * x;
struc2.pitch = req->unk_14.unk_00;
struc2.yaw = req->unk_14.unk_02;
Quake_AddVec(&vec, &vec, &struc2);
offset.x = 0;
offset.y = req->y * y;
offset.z = 0;
sph.r = req->x * x;
sph.pitch = req->orientation.x;
sph.yaw = req->orientation.y;
Quake_VecSphGeoAddToVec3f(&offset, &offset, &sph);
}
vec2 = vec;
shake->vec2 = vec2;
shake->vec1 = vec2;
shake->unk_1A = (f32)0x8000 * y;
shake->rotZ = req->rotZ * y;
shake->zoom = req->zoom * y;
shake->atOffset = shake->eyeOffset = offset;
shake->upYawOffset = 0x8000 * y;
shake->upPitchOffset = req->upPitchOffset * y;
shake->fovOffset = req->fov * y;
}
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType1(QuakeRequest* req, ShakeInfo* shake) {
s32 pad;
if (req->countdown > 0) {
f32 a = Math_SinS(req->speed * req->countdown);
if (req->timer > 0) {
f32 xyOffset = Math_SinS(req->speed * req->timer);
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
req->countdown--;
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
req->timer--;
}
return req->countdown;
return req->timer;
}
s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 a = Math_SinS(req->speed * req->countdown);
s16 Quake_CallbackType5(QuakeRequest* req, ShakeInfo* shake) {
if (req->timer > 0) {
f32 xyOffset = Math_SinS(req->speed * req->timer);
Quake_UpdateShakeInfo(req, shake, a, a);
req->countdown--;
Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset);
req->timer--;
}
return req->countdown;
return req->timer;
}
s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType6(QuakeRequest* req, ShakeInfo* shake) {
s32 pad;
f32 a;
f32 xyOffset;
req->countdown--;
a = Math_SinS(req->speed * ((req->countdown & 0xF) + 500));
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
req->timer--;
xyOffset = Math_SinS(req->speed * ((req->timer & 0xF) + 500));
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
// Not returning the timer ensures quake type 6 continues indefinitely until manually removed
return 1;
}
s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 a = Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax);
s16 Quake_CallbackType3(QuakeRequest* req, ShakeInfo* shake) {
if (req->timer > 0) {
f32 xyOffset = Math_SinS(req->speed * req->timer) * ((f32)req->timer / req->duration);
Quake_UpdateShakeInfo(req, shake, a, a);
req->countdown--;
Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset);
req->timer--;
}
return req->countdown;
return req->timer;
}
s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 a = Rand_ZeroOne();
s16 Quake_CallbackType2(QuakeRequest* req, ShakeInfo* shake) {
if (req->timer > 0) {
f32 xyOffset = Rand_ZeroOne();
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
req->countdown--;
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
req->timer--;
}
return req->countdown;
return req->timer;
}
s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 a = Rand_ZeroOne() * ((f32)req->countdown / (f32)req->countdownMax);
s16 Quake_CallbackType4(QuakeRequest* req, ShakeInfo* shake) {
if (req->timer > 0) {
f32 xyOffset = Rand_ZeroOne() * ((f32)req->timer / req->duration);
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
req->countdown--;
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
req->timer--;
}
return req->countdown;
return req->timer;
}
s16 Quake_GetFreeIndex(void) {
s32 i;
s32 ret;
s32 min = 0x10000;
s32 index;
s32 timerMin = 0x10000; // UINT16_MAX + 1
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
if (sQuakeRequest[i].callbackIdx == 0) {
ret = i;
min = 0x20000;
for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) {
if (sQuakeRequests[i].type == QUAKE_TYPE_NONE) {
index = i;
timerMin = 0x20000; // Magic Number to indicate there was an unused quake index
break;
}
if (sQuakeRequest[i].countdown < min) {
min = sQuakeRequest[i].countdown;
ret = i;
if (timerMin > sQuakeRequests[i].timer) {
timerMin = sQuakeRequests[i].timer;
index = i;
}
}
if (min != 0x20000) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: too many request %d is changed new one !!\n" VT_RST, ret);
if (timerMin != 0x20000) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: too many request %d is changed new one !!\n" VT_RST, index);
}
return ret;
return index;
}
QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) {
s16 idx = Quake_GetFreeIndex();
QuakeRequest* req = &sQuakeRequest[idx];
QuakeRequest* Quake_RequestImpl(Camera* camera, u32 type) {
s16 index = Quake_GetFreeIndex();
QuakeRequest* req = &sQuakeRequests[index];
__osMemset(req, 0, sizeof(QuakeRequest));
req->cam = camera;
req->camPtrIdx = camera->camId;
req->callbackIdx = callbackIdx;
req->unk_1C = 1;
req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
req->camId = camera->camId;
req->type = type;
req->isRelativeToScreen = true;
// Add a unique random identifier to the upper bits of the index
// The `~3` assumes there are only 4 requests
req->index = index + ((s16)(Rand_ZeroOne() * 0x10000) & ~3);
sQuakeRequestCount++;
return req;
}
void Quake_Remove(QuakeRequest* req) {
req->callbackIdx = 0;
req->countdown = -1;
req->type = QUAKE_TYPE_NONE;
req->timer = -1;
sQuakeRequestCount--;
}
QuakeRequest* Quake_GetRequest(s16 idx) {
QuakeRequest* req = &sQuakeRequest[idx & 3];
QuakeRequest* Quake_GetRequest(s16 index) {
QuakeRequest* req = &sQuakeRequests[index & 3];
if (req->callbackIdx == 0) {
if (req->type == QUAKE_TYPE_NONE) {
return NULL;
}
if (idx != req->randIdx) {
if (index != req->index) {
return NULL;
}
return req;
}
QuakeRequest* Quake_SetValue(s16 idx, s16 valueType, s16 value) {
QuakeRequest* req = Quake_GetRequest(idx);
#define QUAKE_SPEED (1 << 0)
#define QUAKE_Y_OFFSET (1 << 1)
#define QUAKE_X_OFFSET (1 << 2)
#define QUAKE_FOV (1 << 3)
#define QUAKE_ROLL (1 << 4)
#define QUAKE_ORIENTATION_PITCH (1 << 5)
#define QUAKE_ORIENTATION_YAW (1 << 6)
#define QUAKE_ORIENTATION_ROLL (1 << 7)
#define QUAKE_DURATION (1 << 8)
#define QUAKE_IS_RELATIVE_TO_SCREEN (1 << 9)
QuakeRequest* Quake_SetValue(s16 index, s16 valueType, s16 value) {
QuakeRequest* req = Quake_GetRequest(index);
if (req == NULL) {
return NULL;
} else {
switch (valueType) {
case 1:
req->speed = value;
break;
case 2:
req->y = value;
break;
case 4:
req->x = value;
break;
case 8:
req->zoom = value;
break;
case 0x10:
req->rotZ = value;
break;
case 0x20:
req->unk_14.unk_00 = value;
break;
case 0x40:
req->unk_14.unk_02 = value;
break;
case 0x80:
req->unk_14.unk_04 = value;
break;
case 0x100:
req->countdown = value;
req->countdownMax = req->countdown;
break;
case 0x200:
req->unk_1C = value;
break;
}
}
switch (valueType) {
case QUAKE_SPEED:
req->speed = value;
break;
case QUAKE_Y_OFFSET:
req->y = value;
break;
case QUAKE_X_OFFSET:
req->x = value;
break;
case QUAKE_FOV:
req->fov = value;
break;
case QUAKE_ROLL:
req->upPitchOffset = value;
break;
case QUAKE_ORIENTATION_PITCH:
req->orientation.x = value;
break;
case QUAKE_ORIENTATION_YAW:
req->orientation.y = value;
break;
case QUAKE_ORIENTATION_ROLL:
req->orientation.z = value;
break;
case QUAKE_DURATION:
req->timer = value;
req->duration = req->timer;
break;
case QUAKE_IS_RELATIVE_TO_SCREEN:
req->isRelativeToScreen = value;
break;
default:
break;
}
//! @bug UB: missing return. "req" is in v0 at this point, but doing an
//! explicit return uses an additional register.
#ifdef AVOID_UB
return req;
#endif
}
u32 Quake_SetSpeed(s16 idx, s16 value) {
QuakeRequest* req = Quake_GetRequest(idx);
/**
* @param index
* @param speed For periodic types only, the angular frequency of the sine wave (binang / frame)
* @return true if successfully applied, false if the request does not exist
*/
u32 Quake_SetSpeed(s16 index, s16 speed) {
QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
req->speed = value;
req->speed = speed;
return true;
}
return false;
}
u32 Quake_SetCountdown(s16 idx, s16 value) {
QuakeRequest* req = Quake_GetRequest(idx);
/**
* @param index quake request index to apply
* @param duration Number of frames to apply the quake
* @return true if successfully applied, false if the request does not exist
*/
u32 Quake_SetDuration(s16 index, s16 duration) {
QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
req->countdown = value;
req->countdownMax = req->countdown;
req->duration = req->timer = duration;
return true;
}
return false;
}
s16 Quake_GetCountdown(s16 idx) {
QuakeRequest* req = Quake_GetRequest(idx);
/**
* @param index quake request index to get
* @return Number of frames until the quake is finished
*/
s16 Quake_GetTimeLeft(s16 index) {
QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
return req->countdown;
return req->timer;
}
return 0;
}
u32 Quake_SetQuakeValues(s16 idx, s16 y, s16 x, s16 zoom, s16 rotZ) {
QuakeRequest* req = Quake_GetRequest(idx);
/**
* @param index quake request index to apply
* @param y Apply up/down shake
* @param x Apply left/right shake
* @param fov Apply zooming in/out shake (binang)
* @param roll Apply rolling shake (binang)
* @return true if successfully applied, false if the request does not exist
*/
u32 Quake_SetPerturbations(s16 index, s16 y, s16 x, s16 fov, s16 roll) {
QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
req->y = y;
req->x = x;
req->zoom = zoom;
req->rotZ = rotZ;
req->fov = fov;
// Visual roll is indirectly achieved by offsetting the pitch in calculating the camera "Up" vector
req->upPitchOffset = roll;
return true;
}
return false;
}
u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2) {
QuakeRequest* req = Quake_GetRequest(idx);
/**
* @param index quake request index to apply
* @param isRelativeToScreen Is the quake applied relative to the screen or in absolute world coordinates
* @param orientation orient the x/y shake to a different direction
* @return true if successfully applied, false if the request does not exist
*/
u32 Quake_SetOrientation(s16 index, s16 isRelativeToScreen, Vec3s orientation) {
QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
req->unk_1C = arg1;
req->unk_14 = arg2;
req->isRelativeToScreen = isRelativeToScreen;
req->orientation = orientation;
return true;
}
return false;
@ -283,20 +365,20 @@ u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2) {
void Quake_Init(void) {
s16 i;
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
sQuakeRequest[i].callbackIdx = 0;
sQuakeRequest[i].countdown = 0;
for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) {
sQuakeRequests[i].type = QUAKE_TYPE_NONE;
sQuakeRequests[i].timer = 0;
}
D_80126250 = 1;
sQuakeUnused = 1;
sQuakeRequestCount = 0;
}
s16 Quake_Add(Camera* camera, u32 callbackIdx) {
return Quake_AddImpl(camera, callbackIdx)->randIdx;
s16 Quake_Request(Camera* camera, u32 type) {
return Quake_RequestImpl(camera, type)->index;
}
u32 Quake_RemoveFromIdx(s16 idx) {
QuakeRequest* req = Quake_GetRequest(idx);
u32 Quake_RemoveRequest(s16 index) {
QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
Quake_Remove(req);
@ -305,101 +387,120 @@ u32 Quake_RemoveFromIdx(s16 idx) {
return false;
}
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
f32 max;
f32 max2;
QuakeRequest* req;
ShakeInfo shake;
f32 absSpeedDiv;
s16* temp;
u32 pad2;
s32 idx;
s32 ret;
u32 eq;
Vec3f vec;
PlayState* play;
s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
NULL, // QUAKE_TYPE_NONE
Quake_CallbackType1, // QUAKE_TYPE_1
Quake_CallbackType2, // QUAKE_TYPE_2
Quake_CallbackType3, // QUAKE_TYPE_3
Quake_CallbackType4, // QUAKE_TYPE_4
Quake_CallbackType5, // QUAKE_TYPE_5
Quake_CallbackType6, // QUAKE_TYPE_6
};
play = camera->play;
vec.x = 0.0f;
vec.y = 0.0f;
vec.z = 0.0f;
camData->rotZ = 0;
camData->unk_1A = 0;
camData->zoom = 0;
camData->atOffset.x = 0.0f;
camData->atOffset.y = 0.0f;
camData->atOffset.z = 0.0f;
camData->eyeOffset.x = 0.0f;
camData->eyeOffset.y = 0.0f;
camData->eyeOffset.z = 0.0f;
camData->unk_20 = 0.0f;
s16 Quake_Update(Camera* camera, ShakeInfo* camShake) {
f32 maxCurr;
f32 maxNext;
ShakeInfo shake;
QuakeRequest* req;
f32 absSpeedDiv;
s16* camId;
s32 index;
s32 numQuakesApplied;
u32 isDifferentCamId;
Vec3f zeroVec;
PlayState* play = camera->play;
zeroVec.x = 0.0f;
zeroVec.y = 0.0f;
zeroVec.z = 0.0f;
camShake->upPitchOffset = 0;
camShake->upYawOffset = 0;
camShake->fovOffset = 0;
camShake->atOffset.x = 0.0f;
camShake->atOffset.y = 0.0f;
camShake->atOffset.z = 0.0f;
camShake->eyeOffset.x = 0.0f;
camShake->eyeOffset.y = 0.0f;
camShake->eyeOffset.z = 0.0f;
camShake->maxOffset = 0.0f;
if (sQuakeRequestCount == 0) {
return 0;
}
ret = 0;
for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
req = &sQuakeRequest[idx];
if (req->callbackIdx != 0) {
if (play->cameraPtrs[req->camPtrIdx] == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST,
req->camPtrIdx);
Quake_Remove(req);
} else {
temp = &camera->camId;
eq = req->cam->camId != *temp;
absSpeedDiv = ABS(req->speed) / (f32)0x8000;
if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
Quake_Remove(req);
} else if (eq == 0) {
if (fabsf(camData->atOffset.x) < fabsf(shake.vec1.x)) {
camData->atOffset.x = shake.vec1.x;
}
if (fabsf(camData->atOffset.y) < fabsf(shake.vec1.y)) {
camData->atOffset.y = shake.vec1.y;
}
if (fabsf(camData->atOffset.z) < fabsf(shake.vec1.z)) {
camData->atOffset.z = shake.vec1.z;
}
if (fabsf(camData->eyeOffset.x) < fabsf(shake.vec2.x)) {
camData->eyeOffset.x = shake.vec2.x;
}
if (fabsf(camData->eyeOffset.y) < fabsf(shake.vec2.y)) {
camData->eyeOffset.y = shake.vec2.y;
}
if (fabsf(camData->eyeOffset.z) < fabsf(shake.vec2.z)) {
camData->eyeOffset.z = shake.vec2.z;
}
if (camData->rotZ < shake.rotZ) {
camData->rotZ = shake.rotZ;
camData->unk_1A = shake.unk_1A;
}
if (camData->zoom < shake.zoom) {
camData->zoom = shake.zoom;
}
max = OLib_Vec3fDist(&shake.vec1, &vec) * absSpeedDiv;
max2 = OLib_Vec3fDist(&shake.vec2, &vec) * absSpeedDiv;
if (max < max2) {
max = max2;
}
max2 = (camData->rotZ * 0.005f) * absSpeedDiv;
if (max < max2) {
max = max2;
}
max2 = (camData->zoom * 0.005f) * absSpeedDiv;
if (max < max2) {
max = max2;
}
if (camData->unk_20 < max) {
camData->unk_20 = max;
}
ret++;
}
}
numQuakesApplied = 0;
for (index = 0; index < ARRAY_COUNT(sQuakeRequests); index++) {
req = &sQuakeRequests[index];
if (req->type == QUAKE_TYPE_NONE) {
continue;
}
if (play->cameraPtrs[req->camId] == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST, req->camId);
Quake_Remove(req);
continue;
}
camId = &camera->camId;
isDifferentCamId = req->cam->camId != *camId;
absSpeedDiv = (f32)ABS(req->speed) / 0x8000;
if (sQuakeCallbacks[req->type](req, &shake) == 0) {
// Quake has reached the end of its timer.
Quake_Remove(req);
continue;
}
if (isDifferentCamId) {
// Quake is attached to a different camId
continue;
}
if (fabsf(camShake->atOffset.x) < fabsf(shake.atOffset.x)) {
camShake->atOffset.x = shake.atOffset.x;
}
if (fabsf(camShake->atOffset.y) < fabsf(shake.atOffset.y)) {
camShake->atOffset.y = shake.atOffset.y;
}
if (fabsf(camShake->atOffset.z) < fabsf(shake.atOffset.z)) {
camShake->atOffset.z = shake.atOffset.z;
}
if (fabsf(camShake->eyeOffset.x) < fabsf(shake.eyeOffset.x)) {
camShake->eyeOffset.x = shake.eyeOffset.x;
}
if (fabsf(camShake->eyeOffset.y) < fabsf(shake.eyeOffset.y)) {
camShake->eyeOffset.y = shake.eyeOffset.y;
}
if (fabsf(camShake->eyeOffset.z) < fabsf(shake.eyeOffset.z)) {
camShake->eyeOffset.z = shake.eyeOffset.z;
}
if (camShake->upPitchOffset < shake.upPitchOffset) {
camShake->upPitchOffset = shake.upPitchOffset;
camShake->upYawOffset = shake.upYawOffset;
}
if (camShake->fovOffset < shake.fovOffset) {
camShake->fovOffset = shake.fovOffset;
}
maxCurr = OLib_Vec3fDist(&shake.atOffset, &zeroVec) * absSpeedDiv;
maxNext = OLib_Vec3fDist(&shake.eyeOffset, &zeroVec) * absSpeedDiv;
maxCurr = CLAMP_MIN(maxCurr, maxNext);
maxNext = camShake->upPitchOffset * (1.0f / 200.0f) * absSpeedDiv;
maxCurr = CLAMP_MIN(maxCurr, maxNext);
maxNext = camShake->fovOffset * (1.0f / 200.0f) * absSpeedDiv;
maxCurr = CLAMP_MIN(maxCurr, maxNext);
if (camShake->maxOffset < maxCurr) {
camShake->maxOffset = maxCurr;
}
numQuakesApplied++;
}
return ret;
return numQuakesApplied;
}

View file

@ -389,7 +389,7 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) {
Vec3f quakeOffset;
gfx = POLY_OPA_DISP;
Camera_GetSkyboxOffset(&quakeOffset, activeCam);
Camera_GetQuakeOffset(&quakeOffset, activeCam);
Room_DrawBackground2D(&gfx, roomShape->source, roomShape->tlut, roomShape->width, roomShape->height,
roomShape->fmt, roomShape->siz, roomShape->tlutMode, roomShape->tlutCount,
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,
@ -487,7 +487,7 @@ void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) {
Vec3f quakeOffset;
gfx = POLY_OPA_DISP;
Camera_GetSkyboxOffset(&quakeOffset, activeCam);
Camera_GetQuakeOffset(&quakeOffset, activeCam);
Room_DrawBackground2D(&gfx, bgEntry->source, bgEntry->tlut, bgEntry->width, bgEntry->height,
bgEntry->fmt, bgEntry->siz, bgEntry->tlutMode, bgEntry->tlutCount,
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,

View file

@ -1,4 +1,5 @@
#include "global.h"
#include "quake.h"
#include "assets/scenes/overworld/spot00/spot00_scene.h"
#include "assets/scenes/overworld/spot00/spot00_room_0.h"
@ -585,20 +586,20 @@ void Scene_DrawConfigGanonCastleExterior(PlayState* play) {
// Screen Shake for Ganon's Tower Collapse
void func_8009BEEC(PlayState* play) {
s32 var;
s32 quakeIndex;
if (play->gameplayFrames % 128 == 13) {
var = Quake_Add(GET_ACTIVE_CAM(play), 2);
Quake_SetSpeed(var, 10000);
Quake_SetQuakeValues(var, 4, 0, 0, 0);
Quake_SetCountdown(var, 127);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_2);
Quake_SetSpeed(quakeIndex, 10000);
Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0);
Quake_SetDuration(quakeIndex, 127);
}
if ((play->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) {
var = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(var, 32000.0f + (Rand_ZeroOne() * 3000.0f));
Quake_SetQuakeValues(var, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0);
Quake_SetCountdown(var, 48.0f - (Rand_ZeroOne() * 15.0f));
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 32000.0f + (Rand_ZeroOne() * 3000.0f));
Quake_SetPerturbations(quakeIndex, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0);
Quake_SetDuration(quakeIndex, 48.0f - (Rand_ZeroOne() * 15.0f));
}
}

View file

@ -5,6 +5,7 @@
*/
#include "z_bg_bdan_objects.h"
#include "quake.h"
#include "assets/objects/object_bdan_objects/object_bdan_objects.h"
#define FLAGS ACTOR_FLAG_4
@ -221,15 +222,15 @@ void func_8086C1A0(BgBdanObjects* this, PlayState* play) {
}
void func_8086C29C(BgBdanObjects* this, PlayState* play) {
s32 temp;
s32 quakeIndex;
if (this->timer != 0) {
this->timer--;
if (this->timer == 0) {
temp = Quake_Add(GET_ACTIVE_CAM(play), 1);
Quake_SetSpeed(temp, 0x3A98);
Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1);
Quake_SetCountdown(temp, 0xA);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 0x3A98);
Quake_SetPerturbations(quakeIndex, 0, 1, 250, 1);
Quake_SetDuration(quakeIndex, 10);
}
}

View file

@ -8,6 +8,7 @@
#include "overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "assets/objects/object_bowl/object_bowl.h"
#include "quake.h"
#include "vt.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
@ -151,10 +152,10 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play) {
EffectSsHahen_SpawnBurst(play, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION);
}
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 0x7FFF);
Quake_SetQuakeValues(quakeIndex, 300, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 30);
Quake_SetPerturbations(quakeIndex, 300, 0, 0, 0);
Quake_SetDuration(quakeIndex, 30);
this->timer = 20;
this->actionFunc = BgBowlWall_FinishFall;
}

View file

@ -169,7 +169,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) {
func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_8003555C(play, &pos1, &velocity, &accel);
}
Camera_AddQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3);
Camera_RequestQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3);
Audio_PlaySfxGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}

View file

@ -211,7 +211,7 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, PlayState* play) {
(s16)Rand_ZeroFloat(100.0f) + 250, 5, (s16)Rand_ZeroFloat(5.0f) + 15);
}
func_80033DB8(play, 10, 15);
Actor_RequestQuake(play, 10, 15);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_BOX_BREAK);
}
Actor_Kill(&this->dyna.actor);

View file

@ -7,6 +7,7 @@
#include "z_bg_haka_huta.h"
#include "assets/objects/object_hakach_objects/object_hakach_objects.h"
#include "overlays/actors/ovl_En_Rd/z_en_rd.h"
#include "quake.h"
#define FLAGS ACTOR_FLAG_4
@ -179,10 +180,10 @@ void func_8087D720(BgHakaHuta* this, PlayState* play) {
this->counter++;
if (this->counter == 6) {
this->actionFunc = BgHakaHuta_DoNothing;
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 0x7530);
Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 2);
Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0);
Quake_SetDuration(quakeIndex, 2);
} else if (this->counter == 0) {
this->counter = 6;
this->actionFunc = BgHakaHuta_DoNothing;

View file

@ -6,6 +6,7 @@
#include "z_bg_heavy_block.h"
#include "assets/objects/object_heavy_object/object_heavy_object.h"
#include "quake.h"
#include "vt.h"
#define FLAGS 0
@ -331,10 +332,10 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play) {
break;
}
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 25000);
Quake_SetQuakeValues(quakeIndex, 1, 1, 5, 0);
Quake_SetCountdown(quakeIndex, 10);
Quake_SetPerturbations(quakeIndex, 1, 1, 5, 0);
Quake_SetDuration(quakeIndex, 10);
this->actionFunc = BgHeavyBlock_LiftedUp;
}
}
@ -398,25 +399,25 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) {
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Actor_Kill(&this->dyna.actor);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
Quake_SetCountdown(quakeIndex, 30);
Quake_SetPerturbations(quakeIndex, 14, 2, 100, 0);
Quake_SetDuration(quakeIndex, 30);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 2);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_2);
Quake_SetSpeed(quakeIndex, 12000);
Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 999);
Quake_SetPerturbations(quakeIndex, 5, 0, 0, 0);
Quake_SetDuration(quakeIndex, 999);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_ELECTRIC_EXPLOSION);
return;
case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
Quake_SetQuakeValues(quakeIndex, 16, 2, 120, 0);
Quake_SetCountdown(quakeIndex, 40);
Quake_SetPerturbations(quakeIndex, 16, 2, 120, 0);
Quake_SetDuration(quakeIndex, 40);
this->actionFunc = BgHeavyBlock_Land;
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
@ -424,18 +425,18 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) {
case HEAVYBLOCK_UNBREAKABLE:
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
Quake_SetCountdown(quakeIndex, 40);
Quake_SetPerturbations(quakeIndex, 14, 2, 100, 0);
Quake_SetDuration(quakeIndex, 40);
this->actionFunc = BgHeavyBlock_Land;
break;
default:
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
Quake_SetCountdown(quakeIndex, 40);
Quake_SetPerturbations(quakeIndex, 14, 2, 100, 0);
Quake_SetDuration(quakeIndex, 40);
this->actionFunc = BgHeavyBlock_Land;
}

View file

@ -6,6 +6,7 @@
#include "z_bg_hidan_hamstep.h"
#include "assets/objects/object_hidan_objects/object_hidan_objects.h"
#include "quake.h"
#define FLAGS 0
@ -308,10 +309,10 @@ void func_80888860(BgHidanHamstep* this, PlayState* play) {
if (1) {}
if (this->unk_244 == 1) {
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -15536);
Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0);
Quake_SetCountdown(quakeIndex, 20);
Quake_SetPerturbations(quakeIndex, 0, 0, 500, 0);
Quake_SetDuration(quakeIndex, 20);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 255, 20, 150);
func_80888638(this, play);
@ -367,10 +368,10 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) {
if (1) {}
if (this->unk_244 == 1) {
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -15536);
Quake_SetQuakeValues(quakeIndex, 20, 1, 0, 0);
Quake_SetCountdown(quakeIndex, 7);
Quake_SetPerturbations(quakeIndex, 20, 1, 0, 0);
Quake_SetDuration(quakeIndex, 7);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Rumble_Request(SQ(100.0f), 255, 20, 150);

View file

@ -6,6 +6,7 @@
#include "z_bg_jya_kanaami.h"
#include "assets/objects/object_jya_obj/object_jya_obj.h"
#include "quake.h"
#define FLAGS 0
@ -96,16 +97,17 @@ void func_8089993C(BgJyaKanaami* this) {
void func_80899950(BgJyaKanaami* this, PlayState* play) {
s32 pad[2];
s32 quakeId;
s32 quakeIndex;
this->unk_168 += 0x20;
if (Math_ScaledStepToS(&this->dyna.actor.world.rot.x, 0x4000, this->unk_168)) {
func_80899A08(this);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_TRAP_BOUND);
quakeId = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quakeId, 25000);
Quake_SetQuakeValues(quakeId, 2, 0, 0, 0);
Quake_SetCountdown(quakeId, 16);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 25000);
Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0);
Quake_SetDuration(quakeIndex, 16);
}
}

View file

@ -6,6 +6,7 @@
#include "z_bg_mori_bigst.h"
#include "assets/objects/object_mori_objects/object_mori_objects.h"
#include "quake.h"
#define FLAGS ACTOR_FLAG_4
@ -169,14 +170,15 @@ void BgMoriBigst_Fall(BgMoriBigst* this, PlayState* play) {
void BgMoriBigst_SetupLanding(BgMoriBigst* this, PlayState* play) {
s32 pad;
s32 quake;
s32 quakeIndex;
BgMoriBigst_SetupAction(this, BgMoriBigst_Landing);
this->waitTimer = 18;
quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quake, 25000);
Quake_SetQuakeValues(quake, 5, 0, 0, 0);
Quake_SetCountdown(quake, 16);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 25000);
Quake_SetPerturbations(quakeIndex, 5, 0, 0, 0);
Quake_SetDuration(quakeIndex, 16);
}
void BgMoriBigst_Landing(BgMoriBigst* this, PlayState* play) {

View file

@ -6,6 +6,7 @@
#include "z_bg_mori_rakkatenjo.h"
#include "assets/objects/object_mori_objects/object_mori_objects.h"
#include "quake.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
@ -146,7 +147,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play) {
static f32 bounceVel[] = { 4.0f, 1.5f, 0.4f, 0.1f };
s32 pad;
Actor* thisx = &this->dyna.actor;
s32 quake;
s32 quakeIndex;
Actor_MoveForward(thisx);
if ((thisx->velocity.y < 0.0f) && (thisx->world.pos.y <= 403.0f)) {
@ -162,10 +163,11 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play) {
403.0f - (thisx->world.pos.y - 403.0f) * bounceVel[this->bounceCount] / fabsf(thisx->velocity.y);
thisx->velocity.y = bounceVel[this->bounceCount];
this->bounceCount++;
quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quake, 50000);
Quake_SetQuakeValues(quake, 5, 0, 0, 0);
Quake_SetCountdown(quake, 5);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 50000);
Quake_SetPerturbations(quakeIndex, 5, 0, 0, 0);
Quake_SetDuration(quakeIndex, 5);
}
}
}

View file

@ -315,7 +315,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play) {
BgPoEvent_CheckBlock(this);
} else {
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
func_80033E88(&this->dyna.actor, play, 5, 5);
Actor_RequestQuakeAndRumble(&this->dyna.actor, play, 5, 5);
func_80088B34(this->timer);
if (firstFall == 0) {
firstFall = 1;

View file

@ -6,6 +6,7 @@
#include "z_bg_spot12_gate.h"
#include "assets/objects/object_spot12_obj/object_spot12_obj.h"
#include "quake.h"
#define FLAGS 0
@ -104,16 +105,18 @@ void func_808B317C(BgSpot12Gate* this) {
void func_808B318C(BgSpot12Gate* this, PlayState* play) {
s32 pad;
s32 var;
s32 quakeIndex;
Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f);
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f,
this->dyna.actor.velocity.y)) {
func_808B3274(this);
var = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(var, -0x3CB0);
Quake_SetQuakeValues(var, 3, 0, 0, 0);
Quake_SetCountdown(var, 0xC);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -0x3CB0);
Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0);
Quake_SetDuration(quakeIndex, 12);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP);
} else {
func_8002F974(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG);

View file

@ -552,7 +552,7 @@ void BossDodongo_Explode(BossDodongo* this, PlayState* play) {
this->actionFunc = BossDodongo_LayDown;
Audio_PlayActorSfx2(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_DAMAGE);
func_80033E88(&this->actor, play, 4, 10);
Actor_RequestQuakeAndRumble(&this->actor, play, 4, 10);
this->health -= 2;
// make sure not to die from the bomb explosion
@ -677,7 +677,7 @@ void BossDodongo_Walk(BossDodongo* this, PlayState* play) {
}
if (this->subCamId == SUB_CAM_ID_DONE) {
func_80033E88(&this->actor, play, 4, 10);
Actor_RequestQuakeAndRumble(&this->actor, play, 4, 10);
} else {
this->unk_1B6 = 10;
Rumble_Override(0.0f, 180, 20, 100);
@ -758,7 +758,7 @@ void BossDodongo_Roll(BossDodongo* this, PlayState* play) {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG);
if ((this->unk_19E & 7) == 0) {
Camera_AddQuake(&play->mainCamera, 2, 1, 8);
Camera_RequestQuake(&play->mainCamera, 2, 1, 8);
}
if (!(this->unk_19E & 1)) {
@ -787,12 +787,12 @@ void BossDodongo_Roll(BossDodongo* this, PlayState* play) {
this->unk_228 = 9200.0f;
this->actor.velocity.y = 20.0f;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_COLI);
Camera_AddQuake(&play->mainCamera, 2, 6, 8);
Camera_RequestQuake(&play->mainCamera, 2, 6, 8);
sp50.x = this->actor.world.pos.x;
sp50.y = this->actor.world.pos.y + 60.0f;
sp50.z = this->actor.world.pos.z;
func_80033480(play, &sp50, 250.0f, 40, 800, 10, 0);
func_80033E88(&this->actor, play, 6, 15);
Actor_RequestQuakeAndRumble(&this->actor, play, 6, 15);
} else {
this->actor.velocity.y = 15.0f;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_COLI2);
@ -1395,7 +1395,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) {
Math_SmoothStepToF(&this->actor.world.pos.z, cornerPos->z + sp184.z, 1.0f, this->unk_1E4, 0.0f);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG);
if ((this->unk_19E & 7) == 0) {
Camera_AddQuake(&play->mainCamera, 2, 1, 8);
Camera_RequestQuake(&play->mainCamera, 2, 1, 8);
}
if (!(this->unk_19E & 1)) {
Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10,

View file

@ -629,7 +629,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
this->holePosition.x = this->targetPosition.x;
this->holePosition.z = this->targetPosition.z;
func_80033E1C(play, 1, 0x50, 0x5000);
Actor_RequestQuakeWithSpeed(play, 1, 80, 0x5000);
if (this->introState != BFD_CS_NONE) {
this->timers[0] = 50;
} else {
@ -673,7 +673,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
this->timers[1] = 10;
Audio_PlaySfxGeneral(NA_SE_EV_EXPLOSION, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
func_80033E1C(play, 3, 0xA, 0x7530);
Actor_RequestQuakeWithSpeed(play, 3, 10, 0x7530);
this->work[BFD_ROCK_TIMER] = 300;
}
} else {
@ -979,14 +979,14 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
if (this->work[BFD_ACTION_STATE] < BOSSFD_SKULL_FALL) {
if ((this->actor.prevPos.y < 90.0f) && (90.0f <= this->actor.world.pos.y)) {
this->timers[4] = 80;
func_80033E1C(play, 1, 80, 0x5000);
Actor_RequestQuakeWithSpeed(play, 1, 80, 0x5000);
this->work[BFD_ROAR_TIMER] = 40;
this->work[BFD_MANE_EMBERS_TIMER] = 30;
this->work[BFD_SPLASH_TIMER] = 10;
}
if ((this->actor.prevPos.y > 90.0f) && (90.0f >= this->actor.world.pos.y)) {
this->timers[4] = 80;
func_80033E1C(play, 1, 80, 0x5000);
Actor_RequestQuakeWithSpeed(play, 1, 80, 0x5000);
this->work[BFD_MANE_EMBERS_TIMER] = 30;
this->work[BFD_SPLASH_TIMER] = 10;
}

View file

@ -243,7 +243,7 @@ void BossFd2_Emerge(BossFd2* this, PlayState* play) {
bossFd->faceExposed = 0;
bossFd->holePosition.x = this->actor.world.pos.x;
bossFd->holePosition.z = this->actor.world.pos.z;
func_80033E1C(play, 1, 0x32, 0x5000);
Actor_RequestQuakeWithSpeed(play, 1, 50, 0x5000);
this->work[FD2_ACTION_STATE] = 1;
this->work[FD2_HOLE_COUNTER]++;
this->actor.world.pos.y = -200.0f;

View file

@ -1897,7 +1897,7 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) {
this->actor.world.pos.y = 60.0f;
this->unk_1C2 = 2;
this->timers[0] = 10;
func_80033E88(&this->actor, play, 0xA, 0x14); // rumble
Actor_RequestQuakeAndRumble(&this->actor, play, 10, 20);
this->unk_19C = 35;
this->unk_19E = 0;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GANON_HIT_GND_IMP);

View file

@ -170,7 +170,7 @@ void func_808FD4D4(BossGanon2* this, PlayState* play, s16 arg2, s16 arg3) {
}
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_MGANON_WALK);
func_80033E88(&this->actor, play, 2, 0xA);
Actor_RequestQuakeAndRumble(&this->actor, play, 2, 10);
}
void func_808FD5C4(BossGanon2* this, PlayState* play) {
@ -2004,7 +2004,7 @@ void BossGanon2_Update(Actor* thisx, PlayState* play) {
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (this->actor.velocity.y < -5.0f) {
func_80033E88(&this->actor, play, 5, 20);
Actor_RequestQuakeAndRumble(&this->actor, play, 5, 20);
func_80078884(NA_SE_IT_BOMB_EXPLOSION);
}
this->actor.velocity.y = 0.0f;

View file

@ -1309,7 +1309,7 @@ void BossGoma_FloorAttack(BossGoma* this, PlayState* play) {
if (Animation_OnFrame(&this->skelanime, 10.0f)) {
BossGoma_PlayEffectsAndSfx(this, play, 3, 5);
func_80033E88(&this->actor, play, 5, 15);
Actor_RequestQuakeAndRumble(&this->actor, play, 5, 15);
}
if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaAttackAnim))) {
@ -1434,7 +1434,7 @@ void BossGoma_FallJump(BossGoma* this, PlayState* play) {
BossGoma_SetupFloorLand(this);
this->actor.velocity.y = 0.0f;
BossGoma_PlayEffectsAndSfx(this, play, 0, 8);
func_80033E88(&this->actor, play, 5, 0xF);
Actor_RequestQuakeAndRumble(&this->actor, play, 5, 15);
}
}
@ -1451,7 +1451,7 @@ void BossGoma_FallStruckDown(BossGoma* this, PlayState* play) {
BossGoma_SetupFloorLandStruckDown(this);
this->actor.velocity.y = 0.0f;
BossGoma_PlayEffectsAndSfx(this, play, 0, 8);
func_80033E88(&this->actor, play, 0xA, 0xF);
Actor_RequestQuakeAndRumble(&this->actor, play, 10, 15);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GOMA_DAM1);
}
}
@ -1847,7 +1847,7 @@ void BossGoma_UpdateHit(BossGoma* this, PlayState* play) {
}
this->timer = 4;
func_80033E88(&this->actor, play, 4, 0xC);
Actor_RequestQuakeAndRumble(&this->actor, play, 4, 12);
}
}
}

View file

@ -1758,7 +1758,7 @@ void BossVa_SetupSupportCut(BossVa* this, PlayState* play) {
sFightPhase++;
Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_VA, this->armTip.x, this->armTip.y + 20.0f, this->armTip.z, 0,
this->actor.shape.rot.y, 0, stumpParams);
Camera_AddQuake(&play->mainCamera, 2, 11, 8);
Camera_RequestQuake(&play->mainCamera, 2, 11, 8);
this->burst = false;
this->timer2 = 0;
BossVa_SetupAction(this, BossVa_SupportCut);

View file

@ -6,6 +6,7 @@
#include "z_door_shutter.h"
#include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h"
#include "quake.h"
#include "assets/objects/object_gnd/object_gnd.h"
#include "assets/objects/object_goma/object_goma.h"
@ -31,7 +32,7 @@ void DoorShutter_Destroy(Actor* thisx, PlayState* play);
void DoorShutter_Update(Actor* thisx, PlayState* play);
void DoorShutter_Draw(Actor* thisx, PlayState* play);
void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 camId);
void DoorShutter_RequestQuakeAndRumble(PlayState* play, s16 quakeY, s16 quakeDuration, s16 camId);
void DoorShutter_SetupType(DoorShutter* this, PlayState* play);
void func_80996A54(DoorShutter* this, PlayState* play);
void func_80996B00(DoorShutter* this, PlayState* play);
@ -560,7 +561,7 @@ void func_80997220(DoorShutter* this, PlayState* play) {
}
void func_809973E8(DoorShutter* this, PlayState* play) {
s32 quakeId;
s32 quakeIndex;
if (this->dyna.actor.velocity.y < 20.0f) {
Math_StepToF(&this->dyna.actor.velocity.y, 20.0f, 8.0f);
@ -572,10 +573,10 @@ void func_809973E8(DoorShutter* this, PlayState* play) {
false);
}
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
quakeId = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
Quake_SetSpeed(quakeId, -32536);
Quake_SetQuakeValues(quakeId, 2, 0, 0, 0);
Quake_SetCountdown(quakeId, 10);
quakeIndex = Quake_Request(Play_GetCamera(play, CAM_ID_MAIN), 3);
Quake_SetSpeed(quakeIndex, -32536);
Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0);
Quake_SetDuration(quakeIndex, 10);
Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100);
func_80997220(this, play);
}
@ -604,7 +605,7 @@ void func_809975C0(DoorShutter* this, PlayState* play) {
this->unk_164 = 10;
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
func_8099803C(play, 2, 10, parent->subCamId);
DoorShutter_RequestQuakeAndRumble(play, 2, 10, parent->subCamId);
Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, 10,
true);
}
@ -766,11 +767,11 @@ 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);
void DoorShutter_RequestQuakeAndRumble(PlayState* play, s16 quakeY, s16 quakeDuration, s16 camId) {
s16 quakeIndex = Quake_Request(Play_GetCamera(play, camId), QUAKE_TYPE_3);
Rumble_Override(0.0f, 180, 20, 100);
Quake_SetSpeed(quakeId, 20000);
Quake_SetQuakeValues(quakeId, y, 0, 0, 0);
Quake_SetCountdown(quakeId, countdown);
Quake_SetSpeed(quakeIndex, 20000);
Quake_SetPerturbations(quakeIndex, quakeY, 0, 0, 0);
Quake_SetDuration(quakeIndex, quakeDuration);
}

View file

@ -262,7 +262,7 @@ void func_809BD1C8(EnBigokuta* this, PlayState* play) {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DAIOCTA_LAND_WATER);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GOLON_LAND_BIG);
func_80033E88(&this->actor, play, 0xA, 8);
Actor_RequestQuakeAndRumble(&this->actor, play, 10, 8);
}
void func_809BD2E4(EnBigokuta* this) {

View file

@ -7,7 +7,7 @@
#include "z_en_bili.h"
#include "assets/objects/object_bl/object_bl.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnBili_Init(Actor* thisx, PlayState* play);
void EnBili_Destroy(Actor* thisx, PlayState* play);

View file

@ -319,7 +319,7 @@ void EnBom_Update(Actor* thisx, PlayState* play2) {
play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] = 250;
Camera_AddQuake(&play->mainCamera, 2, 0xB, 8);
Camera_RequestQuake(&play->mainCamera, 2, 11, 8);
thisx->params = BOMB_EXPLOSION;
this->timer = 10;
thisx->flags |= ACTOR_FLAG_5;

View file

@ -428,7 +428,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = 250;
play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] =
250;
Camera_AddQuake(&play->mainCamera, 2, 0xB, 8);
Camera_RequestQuake(&play->mainCamera, 2, 11, 8);
thisx->params = BOMBFLOWER_EXPLOSION;
this->timer = 10;
thisx->flags |= ACTOR_FLAG_5;

View file

@ -1,7 +1,7 @@
#include "z_en_crow.h"
#include "assets/objects/object_crow/object_crow.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnCrow_Init(Actor* thisx, PlayState* play);
void EnCrow_Destroy(Actor* thisx, PlayState* play);

View file

@ -200,7 +200,7 @@ void EnEiyer_SetupAppearFromGround(EnEiyer* this) {
this->collider.base.atFlags &= ~AT_ON;
this->collider.base.acFlags &= ~AC_ON;
this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_12);
this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_IGNORE_QUAKE);
this->actor.shape.shadowScale = 0.0f;
this->actor.shape.yOffset = 0.0f;
this->actionFunc = EnEiyer_AppearFromGround;
@ -231,7 +231,7 @@ void EnEiyer_SetupAmbush(EnEiyer* this, PlayState* play) {
this->collider.info.bumper.dmgFlags = DMG_DEFAULT;
this->basePos = this->actor.world.pos;
this->actor.world.rot.y = this->actor.shape.rot.y;
this->actor.flags |= ACTOR_FLAG_12;
this->actor.flags |= ACTOR_FLAG_IGNORE_QUAKE;
this->collider.base.acFlags &= ~AC_ON;
this->actor.shape.shadowScale = 65.0f;
this->actor.shape.yOffset = 600.0f;

View file

@ -1,5 +1,6 @@
#include "z_en_encount2.h"
#include "overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h"
#include "quake.h"
#include "vt.h"
#include "assets/objects/object_efc_star_field/object_efc_star_field.h"
@ -91,11 +92,11 @@ void EnEncount2_Wait(EnEncount2* this, PlayState* play) {
}
break;
case ENCOUNT2_ACTIVE_DEATH_MOUNTAIN:
if ((this->deathMountainSpawnerTimer == 1) || (!this->isQuaking)) {
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
if ((this->deathMountainSpawnerTimer == 1) || !this->isQuaking) {
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 0x7FFF);
Quake_SetQuakeValues(quakeIndex, 50, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 300);
Quake_SetPerturbations(quakeIndex, 50, 0, 0, 0);
Quake_SetDuration(quakeIndex, 300);
this->isQuaking = true;
}
FALLTHROUGH;

View file

@ -212,7 +212,7 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, PlayState* play) {
(s16)(Rand_ZeroOne() * 100.0f) + 240, FHGFLASH_LIGHTBALL_GREEN);
}
}
func_80033E88(&this->actor, play, 4, 10);
Actor_RequestQuakeAndRumble(&this->actor, play, 4, 10);
}
break;

View file

@ -198,7 +198,7 @@ void EnFireRock_Fall(EnFireRock* this, PlayState* play) {
switch (this->type) {
case FIRE_ROCK_SPAWNED_FALLING1:
case FIRE_ROCK_SPAWNED_FALLING2:
func_80033E88(&this->actor, play, 5, 2);
Actor_RequestQuakeAndRumble(&this->actor, play, 5, 2);
FALLTHROUGH;
case FIRE_ROCK_BROKEN_PIECE1:
Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1,

View file

@ -8,7 +8,7 @@
#include "assets/objects/object_firefly/object_firefly.h"
#include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnFirefly_Init(Actor* thisx, PlayState* play);
void EnFirefly_Destroy(Actor* thisx, PlayState* play);

View file

@ -2,6 +2,7 @@
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_oF1d_map/object_oF1d_map.h"
#include "quake.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5)
@ -1628,14 +1629,14 @@ void EnGo2_Destroy(Actor* thisx, PlayState* play) {
void EnGo2_CurledUp(EnGo2* this, PlayState* play) {
u8 index = this->actor.params & 0x1F;
s16 height;
s32 quake;
s32 quakeIndex;
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) {
quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quake, -0x3CB0);
Quake_SetQuakeValues(quake, 8, 0, 0, 0);
Quake_SetCountdown(quake, 16);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -0x3CB0);
Quake_SetPerturbations(quakeIndex, 8, 0, 0, 0);
Quake_SetDuration(quakeIndex, 16);
} else {
EnGo2_GetDustData(this, 1);
}

View file

@ -791,7 +791,7 @@ void EnGoma_Draw(Actor* thisx, PlayState* play) {
this->actor.naviEnemyId = NAVI_ENEMY_GOHMA_LARVA;
Matrix_Translate(this->actor.world.pos.x,
this->actor.world.pos.y +
((this->actor.shape.yOffset * this->actor.scale.y) + play->mainCamera.skyboxOffset.y),
((this->actor.shape.yOffset * this->actor.scale.y) + play->mainCamera.quakeOffset.y),
this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateX(BINANG_TO_RAD_ALT(this->slopePitch), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(this->slopeRoll), MTXMODE_APPLY);

View file

@ -8,6 +8,7 @@
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_goroiwa/object_goroiwa.h"
#include "quake.h"
#include "vt.h"
#define FLAGS ACTOR_FLAG_4
@ -358,7 +359,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, PlayState* play) {
f32 nextPointY;
f32 thisY;
f32 yDistToFloor;
s32 quakeIdx;
s32 quakeIndex;
CollisionPoly* floorPoly;
Vec3f checkPos;
f32 floorY;
@ -379,10 +380,10 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, PlayState* play) {
if (this->actor.velocity.y < 0.0f && this->actor.world.pos.y <= nextPointY) {
if (this->bounceCount == 0) {
if (this->actor.xzDistToPlayer < 600.0f) {
quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quakeIdx, -0x3CB0);
Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
Quake_SetCountdown(quakeIdx, 7);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -0x3CB0);
Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0);
Quake_SetDuration(quakeIndex, 7);
}
this->rollRotSpeed = 0.0f;
if (!(this->stateFlags & ENGOROIWA_IN_WATER)) {

View file

@ -427,7 +427,7 @@ void func_80A74EBC(EnIk* this, PlayState* play) {
sp2C.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y + 0x6A4) * 70.0f;
sp2C.y = this->actor.world.pos.y;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_IRONNACK_HIT_GND);
Camera_AddQuake(&play->mainCamera, 2, 0x19, 5);
Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150);
CollisionCheck_SpawnShieldParticles(play, &sp2C);
}

View file

@ -8,7 +8,7 @@
#include "overlays/actors/ovl_En_Insect/z_en_insect.h"
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h"
#include "quake.h"
#include "vt.h"
#define FLAGS ACTOR_FLAG_23
@ -420,7 +420,7 @@ void EnIshi_Fly(EnIshi* this, PlayState* play) {
s32 pad;
s16 type = this->actor.params & 1;
s32 pad2;
s32 quakeIdx;
s32 quakeIndex;
Vec3f contactPos;
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) {
@ -432,10 +432,10 @@ void EnIshi_Fly(EnIshi* this, PlayState* play) {
sDustSpawnFuncs[type](this, play);
}
if (type == ROCK_LARGE) {
quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quakeIdx, -0x3CB0);
Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
Quake_SetCountdown(quakeIdx, 7);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -0x3CB0);
Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0);
Quake_SetDuration(quakeIndex, 7);
Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150);
}
Actor_Kill(&this->actor);

View file

@ -862,7 +862,7 @@ void EnMb_ClubAttack(EnMb* this, PlayState* play) {
EffectSsBlast_SpawnWhiteShockwave(play, &effSpawnPos, &effWhiteShockwaveDynamics,
&effWhiteShockwaveDynamics);
func_80033480(play, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1);
Camera_AddQuake(&play->mainCamera, 2, 0x19, 5);
Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, play, -1,
NULL);
EnMb_SetupClubWaitAfterAttack(this);
@ -1044,7 +1044,7 @@ void EnMb_ClubDamaged(EnMb* this, PlayState* play) {
Animation_PlayOnce(&this->skelAnime, &gEnMbClubStandUpAnim);
this->timer3 = 0;
Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150);
Camera_AddQuake(&play->mainCamera, 2, 25, 5);
Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
} else {
EnMb_SetupClubWaitPlayerNear(this);
}
@ -1105,7 +1105,7 @@ void EnMb_ClubDead(EnMb* this, PlayState* play) {
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);
Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
}
}

View file

@ -7,7 +7,7 @@
#include "z_en_po_desert.h"
#include "assets/objects/object_po_field/object_po_field.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_7 | ACTOR_FLAG_12)
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_7 | ACTOR_FLAG_IGNORE_QUAKE)
void EnPoDesert_Init(Actor* thisx, PlayState* play);
void EnPoDesert_Destroy(Actor* thisx, PlayState* play);

View file

@ -8,7 +8,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_po_field/object_po_field.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_12)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_IGNORE_QUAKE)
void EnPoField_Init(Actor* thisx, PlayState* play);
void EnPoField_Destroy(Actor* thisx, PlayState* play);

View file

@ -8,7 +8,7 @@
#include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h"
#include "assets/objects/object_tk/object_tk.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_12 | ACTOR_FLAG_16)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_16)
void EnPoRelay_Init(Actor* thisx, PlayState* play);
void EnPoRelay_Destroy(Actor* thisx, PlayState* play);

View file

@ -8,7 +8,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_po_sisters/object_po_sisters.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnPoSisters_Init(Actor* thisx, PlayState* play);
void EnPoSisters_Destroy(Actor* thisx, PlayState* play);

View file

@ -8,7 +8,7 @@
#include "assets/objects/object_poh/object_poh.h"
#include "assets/objects/object_po_composer/object_po_composer.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE)
void EnPoh_Init(Actor* thisx, PlayState* play);
void EnPoh_Destroy(Actor* thisx, PlayState* play);

View file

@ -7,7 +7,7 @@
#include "z_en_vali.h"
#include "assets/objects/object_vali/object_vali.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12)
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE)
void EnVali_Init(Actor* thisx, PlayState* play);
void EnVali_Destroy(Actor* thisx, PlayState* play);

View file

@ -191,7 +191,7 @@ void EnVbBall_Update(Actor* thisx, PlayState* play2) {
if ((this->actor.params == 100) || (this->actor.params == 101)) {
Actor_Kill(&this->actor);
if (this->actor.params == 100) {
func_80033E88(&this->actor, play, 5, 0xA);
Actor_RequestQuakeAndRumble(&this->actor, play, 5, 10);
}
if (this->actor.params == 100) {
spawnNum = 2;

View file

@ -5,6 +5,7 @@
*/
#include "z_en_wall_tubo.h"
#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h"
#include "overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h"
@ -91,10 +92,10 @@ void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play) {
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
this->timer = 60;
EffectSsBomb2_SpawnLayered(play, &this->explosionCenter, &effVelocity, &effAccel, 200, 40);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 0x7FFF);
Quake_SetQuakeValues(quakeIndex, 100, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 100);
Quake_SetPerturbations(quakeIndex, 100, 0, 0, 0);
Quake_SetDuration(quakeIndex, 100);
this->actionFunc = EnWallTubo_SetWallFall;
break;
}

View file

@ -80,7 +80,7 @@ void func_80B43A94(EnYukabyun* this, PlayState* play) {
this->unk_150--;
}
if (this->unk_150 == 0) {
this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12;
this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE;
this->actionfunc = func_80B43AD4;
}
}

View file

@ -7,6 +7,7 @@
#include "z_obj_lift.h"
#include "assets/objects/object_d_lift/object_d_lift.h"
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
#include "quake.h"
#define FLAGS ACTOR_FLAG_4
@ -142,10 +143,10 @@ void func_80B96560(ObjLift* this, PlayState* play) {
if (((this->dyna.actor.params >> 8) & 7) == 7) {
func_80B967C0(this);
} else {
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 10000);
Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 20);
Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0);
Quake_SetDuration(quakeIndex, 20);
func_80B9664C(this);
}
}

View file

@ -72,10 +72,10 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) {
s32 i;
Vec3f eye;
Vtx* vtxPtr;
Vec3f vec;
Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
OPEN_DISPS(play->state.gfxCtx, "../z_oceff_wipe.c", 346);
@ -103,7 +103,7 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);

View file

@ -66,10 +66,10 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
s32 pad[2];
Vec3f eye;
Vtx* vtxPtr;
Vec3f vec;
Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
if (this->timer < 32) {
z = Math_SinS(this->timer << 9) * 1330;
} else {
@ -91,7 +91,7 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);

View file

@ -67,10 +67,10 @@ void OceffWipe3_Draw(Actor* thisx, PlayState* play) {
s32 pad[2];
Vec3f eye;
Vtx* vtxPtr;
Vec3f vec;
Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
if (this->counter < 32) {
z = Math_SinS(this->counter << 9) * 1330;
} else {
@ -92,7 +92,7 @@ void OceffWipe3_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);

View file

@ -65,10 +65,10 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
s32 pad[2];
Vec3f eye;
Vtx* vtxPtr;
Vec3f vec;
Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
if (this->timer < 16) {
z = Math_SinS(this->timer * 1024) * 1330.0f;
} else {
@ -90,7 +90,7 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);

View file

@ -6,6 +6,7 @@
#include "ultra64.h"
#include "global.h"
#include "quake.h"
#include "overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h"
#include "overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h"
@ -7690,16 +7691,16 @@ s32 func_80842964(Player* this, PlayState* play) {
return func_8083B040(this, play) || func_8083B644(this, play) || func_8083E5A8(this, play);
}
void func_808429B4(PlayState* play, s32 speed, s32 y, s32 countdown) {
s32 quakeIdx = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
void Player_RequestQuake(PlayState* play, s32 speed, s32 y, s32 duration) {
s32 quakeIndex = Quake_Request(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIdx, speed);
Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0);
Quake_SetCountdown(quakeIdx, countdown);
Quake_SetSpeed(quakeIndex, speed);
Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
Quake_SetDuration(quakeIndex, duration);
}
void func_80842A28(PlayState* play, Player* this) {
func_808429B4(play, 27767, 7, 20);
Player_RequestQuake(play, 27767, 7, 20);
play->actorCtx.unk_02 = 4;
Player_RequestRumble(this, 255, 20, 150, 0);
func_8002F7DC(&this->actor, NA_SE_IT_HAMMER_HIT);
@ -8209,7 +8210,7 @@ s32 func_80843E64(PlayState* play, Player* this) {
}
func_80837AE0(this, 40);
func_808429B4(play, 32967, 2, 30);
Player_RequestQuake(play, 32967, 2, 30);
Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration,
impactInfo->rumbleDecreaseRate, 0);
func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT);
@ -8415,7 +8416,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);
Player_RequestQuake(play, 33267, 3, 12);
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);