mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-21 14:55:27 -04:00
Restoration, hover fishing condition + XZ speed (#7031)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
extern "C" {
|
||||
#include <variables.h>
|
||||
#include <functions.h>
|
||||
extern PlayState* gPlayState;
|
||||
extern SaveContext gSaveContext;
|
||||
f32 Fishing_GetMinimumRequiredScore();
|
||||
@@ -19,6 +20,21 @@ void RegisterFishingMessages() {
|
||||
COND_ID_HOOK(OnOpenText, 0x4080, CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0), BuildFishingMessage);
|
||||
}
|
||||
|
||||
void RegisterHoverFishing() {
|
||||
COND_VB_SHOULD(VB_NOT_CAST_FISHING, (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), false)), {
|
||||
Vec3f* rodCheckPos = va_arg(args, Vec3f*);
|
||||
*should = false;
|
||||
// Run only original NTSC 1.0 check before cast
|
||||
if (BgCheck_SphVsFirstPoly(&gPlayState->colCtx, rodCheckPos, 20.0f)) {
|
||||
*should = true;
|
||||
}
|
||||
});
|
||||
|
||||
COND_VB_SHOULD(VB_FISHING_ZERO_XZ, (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), false)), {
|
||||
*should = false; // NTSC 1.0
|
||||
});
|
||||
}
|
||||
|
||||
// Vanilla bug: Not possible to fish with blank B because blank B item value 0xFF is saved
|
||||
// as temp B = disabled B -> fishing pole is unequipped.
|
||||
// Fix: If fishing, disregard disabled B and on B press set used item to fishing pole.
|
||||
@@ -43,5 +59,6 @@ void RegisterAllowFishingBlankB() {
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterFishingMessages, { CVAR_ENHANCEMENT("CustomizeFishing") });
|
||||
static RegisterShipInitFunc initHoverFishing(RegisterHoverFishing, { CVAR_ENHANCEMENT("HoverFishing") });
|
||||
static RegisterShipInitFunc initAllowFishingBlankB(RegisterAllowFishingBlankB,
|
||||
{ CVAR_ENHANCEMENT("FishingBlankB"), "IS_RANDO" });
|
||||
|
||||
@@ -2573,6 +2573,23 @@ typedef enum {
|
||||
// - `*VBFishingData`
|
||||
VB_SHOULD_SET_FISHING_RECORD,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) ||
|
||||
// BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*f32`
|
||||
VB_NOT_CAST_FISHING,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
// ```
|
||||
// #### `args`
|
||||
// - None
|
||||
VB_FISHING_ZERO_XZ,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// false
|
||||
|
||||
@@ -6598,17 +6598,20 @@ s32 func_8083C6B8(PlayState* play, Player* this) {
|
||||
|
||||
rodCheckPos.y += 50.0f;
|
||||
|
||||
if (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), 0)
|
||||
? 0
|
||||
: !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) ||
|
||||
BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)) {
|
||||
if (GameInteractor_Should(VB_NOT_CAST_FISHING,
|
||||
(!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ||
|
||||
(this->actor.world.pos.z > 1300.0f) ||
|
||||
BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)),
|
||||
&rodCheckPos)) {
|
||||
Sfx_PlaySfxCentered(NA_SE_SY_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Player_SetupAction(play, this, Player_Action_80850C68, 0);
|
||||
this->unk_860 = 1;
|
||||
Player_ZeroSpeedXZ(this);
|
||||
if (GameInteractor_Should(VB_FISHING_ZERO_XZ, true)) {
|
||||
Player_ZeroSpeedXZ(this);
|
||||
}
|
||||
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_fishing_throw);
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user