1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-12 01:40:47 +00:00

[PAL N64] Create macros for 50-Hz-related values (#2206)

* [PAL N64] Create macros for 50-Hz-related values

* Use FRAME_RATE_DEPENDENT for player speeds and boot data too

* FRAME_RATE_DEPENDENT -> FRAMERATE_CONST
This commit is contained in:
cadmic 2024-09-18 12:14:47 -07:00 committed by GitHub
parent 2122a4345b
commit 8348132511
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 258 additions and 130 deletions

View file

@ -1,5 +1,6 @@
#include "z_demo_effect.h"
#include "terminal.h"
#include "versions.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_efc_crystal_light/object_efc_crystal_light.h"
#include "assets/objects/object_efc_fire_ball/object_efc_fire_ball.h"
@ -357,16 +358,16 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
case DEMO_EFFECT_LIGHTRING_EXPANDING:
this->initDrawFunc = DemoEffect_DrawLightRing;
this->initUpdateFunc = DemoEffect_UpdateLightRingExpanding;
this->lightRing.timer = 20;
this->lightRing.timerIncrement = 4;
this->lightRing.timer = FRAMERATE_CONST(20, 6);
this->lightRing.timerIncrement = FRAMERATE_CONST(4, 5);
this->lightRing.alpha = 255;
break;
case DEMO_EFFECT_LIGHTRING_TRIFORCE:
this->initDrawFunc = DemoEffect_DrawLightRing;
this->initUpdateFunc = DemoEffect_UpdateLightRingTriforce;
this->lightRing.timer = 20;
this->lightRing.timerIncrement = 4;
this->lightRing.timer = FRAMERATE_CONST(20, 6);
this->lightRing.timerIncrement = FRAMERATE_CONST(4, 5);
this->lightRing.alpha = 0;
this->cueChannel = 4;
break;
@ -374,8 +375,8 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
case DEMO_EFFECT_LIGHTRING_SHRINKING:
this->initDrawFunc = DemoEffect_DrawLightRing;
this->initUpdateFunc = DemoEffect_UpdateLightRingShrinking;
this->lightRing.timer = 351;
this->lightRing.timerIncrement = 2;
this->lightRing.timer = FRAMERATE_CONST(351, 405);
this->lightRing.timerIncrement = FRAMERATE_CONST(2, 3);
this->lightRing.alpha = 0;
break;
@ -834,7 +835,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play) {
}
if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0 && gSaveContext.sceneLayer == 6 &&
play->csCtx.curFrame == 143) {
play->csCtx.curFrame == FRAMERATE_CONST(143, 120)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_RING_EXPLOSION);
}
}
@ -959,10 +960,10 @@ void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play) {
Actor* parent = this->actor.parent;
this->actor.world.rot.y = parent->shape.rot.y;
this->fireBall.timer = 50;
this->actor.speed = 1.5f;
this->actor.minVelocityY = -1.5f;
this->actor.gravity = -0.03f;
this->fireBall.timer = FRAMERATE_CONST(50, 42);
this->actor.speed = FRAMERATE_CONST(1.5f, 1.8f);
this->actor.minVelocityY = FRAMERATE_CONST(-1.5f, -2.5f);
this->actor.gravity = FRAMERATE_CONST(-0.03f, -0.05f);
this->updateFunc = DemoEffect_UpdateCreationFireball;
}
@ -1134,22 +1135,22 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) {
if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) {
switch (gSaveContext.sceneLayer) {
case 4:
if (play->csCtx.curFrame == 288) {
if (play->csCtx.curFrame == FRAMERATE_CONST(288, 240)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS);
}
if (play->csCtx.curFrame == 635) {
if (play->csCtx.curFrame == FRAMERATE_CONST(635, 535)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS);
}
break;
case 6:
if (play->csCtx.curFrame == 55) {
if (play->csCtx.curFrame == FRAMERATE_CONST(55, 25)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
break;
case 11:
if (play->csCtx.curFrame == 350) {
if (play->csCtx.curFrame == FRAMERATE_CONST(350, 353)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
break;
@ -1189,19 +1190,18 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) {
if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) {
switch (gSaveContext.sceneLayer) {
case 4:
if (play->csCtx.curFrame == 298) {
if (play->csCtx.curFrame == FRAMERATE_CONST(298, 248)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS);
}
break;
case 6:
if (play->csCtx.curFrame == 105) {
if (play->csCtx.curFrame == FRAMERATE_CONST(105, 88)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
break;
case 11:
if (play->csCtx.curFrame == 360) {
if (play->csCtx.curFrame == FRAMERATE_CONST(360, 362)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
break;
@ -1209,10 +1209,10 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) {
}
if (gSaveContext.save.entranceIndex == ENTR_DEATH_MOUNTAIN_TRAIL_0 && gSaveContext.sceneLayer == 4) {
if (play->csCtx.curFrame == 72) {
if (play->csCtx.curFrame == FRAMERATE_CONST(72, 57)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
if (play->csCtx.curFrame == 80) {
if (play->csCtx.curFrame == FRAMERATE_CONST(80, 72)) {
Audio_PlayCutsceneEffectsSequence(SEQ_CS_EFFECTS_NAYRU_MAGIC);
}
}
@ -1249,19 +1249,19 @@ void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play) {
if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) {
switch (gSaveContext.sceneLayer) {
case 4:
if (play->csCtx.curFrame == 315) {
if (play->csCtx.curFrame == FRAMERATE_CONST(315, 265)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS);
}
break;
case 6:
if (play->csCtx.curFrame == 80) {
if (play->csCtx.curFrame == FRAMERATE_CONST(80, 60)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
break;
case 11:
if (play->csCtx.curFrame == 370) {
if (play->csCtx.curFrame == FRAMERATE_CONST(370, 371)) {
Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
break;

View file

@ -5,6 +5,7 @@
*/
#include "z_end_title.h"
#include "versions.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
@ -70,14 +71,14 @@ void EndTitle_DrawFull(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_end_title.c", 419);
// Draw title cards on the screen
if ((csCurFrame > 890) && (this->endAlpha < 200)) {
this->endAlpha += 7;
if ((csCurFrame > FRAMERATE_CONST(890, 740)) && (this->endAlpha < 200)) {
this->endAlpha += FRAMERATE_CONST(7, 8);
}
if ((csCurFrame > 810) && (this->tlozAlpha < 200)) {
this->tlozAlpha += 15;
if ((csCurFrame > FRAMERATE_CONST(810, 675)) && (this->tlozAlpha < 200)) {
this->tlozAlpha += FRAMERATE_CONST(15, 18);
}
if ((csCurFrame > 850) && (this->ootAlpha < 200)) {
this->ootAlpha += 15;
if ((csCurFrame > FRAMERATE_CONST(850, 710)) && (this->ootAlpha < 200)) {
this->ootAlpha += FRAMERATE_CONST(15, 18);
}
OVERLAY_DISP = Gfx_SetupDL_64(OVERLAY_DISP);
@ -114,7 +115,7 @@ void EndTitle_DrawNintendoLogo(Actor* thisx, PlayState* play) {
s32 pad;
s32 csCurFrame = play->csCtx.curFrame;
if ((csCurFrame >= 1101) && (this->endAlpha < 255)) {
if ((csCurFrame > FRAMERATE_CONST(1100, 950)) && (this->endAlpha < 255)) {
this->endAlpha += 3;
}

View file

@ -7,6 +7,7 @@
#include "ultra64.h"
#include "global.h"
#include "quake.h"
#include "versions.h"
#include "overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h"
#include "overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h"
@ -5980,7 +5981,7 @@ void func_8083BC04(Player* this, PlayState* play) {
Player_SetupAction(play, this, Player_Action_80844708, 0);
LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime,
GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing_roll, this->modelAnimType),
1.25f * D_808535E8);
FRAMERATE_CONST(1.25f, 1.5f) * D_808535E8);
}
s32 func_8083BC7C(Player* this, PlayState* play) {
@ -6583,7 +6584,7 @@ void func_8083D53C(PlayState* play, Player* this) {
void func_8083D6EC(PlayState* play, Player* this) {
Vec3f ripplePos;
this->actor.minVelocityY = -20.0f;
this->actor.minVelocityY = FRAMERATE_CONST(-20.0f, -24.0f);
this->actor.gravity = REG(68) / 100.0f;
if (func_8083816C(sFloorType)) {
@ -9214,7 +9215,7 @@ void Player_Action_80844708(Player* this, PlayState* play) {
sp44 = LinkAnimation_Update(play, &this->skelAnime);
if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) {
func_80837AFC(this, -10);
func_80837AFC(this, FRAMERATE_CONST(-10, -8));
}
if (func_80842964(this, play) == 0) {
@ -11882,7 +11883,7 @@ void func_8084B000(Player* this) {
f32 phi_f14;
f32 depthInWater;
phi_f14 = -5.0f;
phi_f14 = FRAMERATE_CONST(-5.0f, -6.0f);
phi_f16 = this->ageProperties->unk_28;
if (this->actor.velocity.y < 0.0f) {
@ -11898,10 +11899,10 @@ void func_8084B000(Player* this) {
phi_f18 = -0.1f - phi_f16;
} else {
if (!(this->stateFlags1 & PLAYER_STATE1_DEAD) && (this->currentBoots == PLAYER_BOOTS_IRON) &&
(this->actor.velocity.y >= -3.0f)) {
(this->actor.velocity.y >= FRAMERATE_CONST(-3.0f, -3.6f))) {
phi_f18 = -0.2f;
} else {
phi_f14 = 2.0f;
phi_f14 = FRAMERATE_CONST(2.0f, 2.4f);
if (this->actor.velocity.y >= 0.0f) {
phi_f16 = 0.0f;
} else {
@ -11927,17 +11928,19 @@ void func_8084B000(Player* this) {
void func_8084B158(PlayState* play, Player* this, Input* input, f32 arg3) {
f32 temp;
f32 limit;
if ((input != NULL) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_B)) {
temp = 1.0f;
temp = limit = FRAMERATE_CONST(1.0f, 1.2f);
} else {
temp = 0.5f;
temp = FRAMERATE_CONST(0.5f, 0.6f);
limit = FRAMERATE_CONST(1.0f, 1.2f);
}
temp *= arg3;
if (temp < 1.0f) {
temp = 1.0f;
if (temp < limit) {
temp = limit;
}
this->skelAnime.playSpeed = temp;