Skip to content

Commit e1fc8cb

Browse files
committed
added custom speed boost
1 parent 2cd94fe commit e1fc8cb

1 file changed

Lines changed: 74 additions & 30 deletions

File tree

  • soh/src/overlays/actors/ovl_player_actor

soh/src/overlays/actors/ovl_player_actor/z_player.c

Lines changed: 74 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,7 @@ void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction) {
23552355
this->modelGroup = this->nextModelGroup;
23562356

23572357
this->stateFlags1 &= ~(PLAYER_STATE1_ITEM_IN_HAND | PLAYER_STATE1_USING_BOOMERANG);
2358-
osSyncPrintf("ItemAction: %d\n", this->heldItemAction);
2358+
lusprintf(__FILE__, __LINE__, 2, "ItemAction: %d\n", this->heldItemAction);
23592359
// CUSTOM
23602360
if (this->heldItemAction == PLAYER_IA_GLIDER) {
23612361
ItemSpawnGlider(play, this);
@@ -3207,27 +3207,27 @@ s32 Player_UpperAction_CarryActor(Player* this, PlayState* play) {
32073207
this->actor.gravity = -0.5f;
32083208
this->fallStartHeight = this->actor.world.pos.y;
32093209
}
3210-
3210+
lusprintf(__FILE__, __LINE__, 2, "Held actor ID: %d", heldActor->id);
32113211
if (heldActor->id == ACTOR_EN_GLIDER) {
32123212

3213-
// osSyncPrintf("Glider detected\n");
3214-
// EnGlider* glider = (EnGlider*)heldActor;
3215-
// if (glider->inWindZone == false) {
3216-
// this->actor.minVelocityY = -2.0f;
3217-
// this->actor.gravity = -0.25f;
3218-
// this->fallStartHeight = this->actor.world.pos.y;
3219-
// } else {
3220-
// float max = 8.0f;
3221-
// this->actor.minVelocityY = -2.0f;
3222-
// float g = 10.0f * (1.0f / glider->wzDistY);
3223-
// if (g > max)
3224-
// g = max;
3225-
// if ((this->actor.velocity.y + g) > max) {
3226-
// g = max - this->actor.velocity.y;
3227-
// }
3228-
// this->actor.gravity = g;
3229-
// this->fallStartHeight = this->actor.world.pos.y;
3230-
// }
3213+
lusprintf(__FILE__, __LINE__, 2, "Glider detected\n");
3214+
EnGlider* glider = (EnGlider*)heldActor;
3215+
if (glider->inWindZone == false) {
3216+
this->actor.minVelocityY = -2.0f;
3217+
this->actor.gravity = -0.25f;
3218+
this->fallStartHeight = this->actor.world.pos.y;
3219+
} else {
3220+
float max = 8.0f;
3221+
this->actor.minVelocityY = -2.0f;
3222+
float g = 10.0f * (1.0f / glider->wzDistY);
3223+
if (g > max)
3224+
g = max;
3225+
if ((this->actor.velocity.y + g) > max) {
3226+
g = max - this->actor.velocity.y;
3227+
}
3228+
this->actor.gravity = g;
3229+
this->fallStartHeight = this->actor.world.pos.y;
3230+
}
32313231
}
32323232

32333233
return true;
@@ -3470,7 +3470,14 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) {
34703470
s32 temp;
34713471
s32 nextAnimType;
34723472

3473+
lusprintf(__FILE__, __LINE__, 2, "Using item %d", item);
3474+
3475+
if(item == 161) {
3476+
lusprintf(__FILE__, __LINE__, 2, "GLIDER");
3477+
itemAction = PLAYER_IA_GLIDER;
3478+
}else{
34733479
itemAction = Player_ItemToItemAction(item);
3480+
}
34743481

34753482
osSyncPrintf("3 ItemAction: %d\n", itemAction);
34763483
LOG_STRING("4 ItemAction");
@@ -3509,11 +3516,10 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) {
35093516
} else {
35103517
Sfx_PlaySfxCentered(NA_SE_SY_ERROR);
35113518
}
3512-
} else if (itemAction == 72 || itemAction == 73 || itemAction == -120 || itemAction == -56) {
3519+
} else if (itemAction == 73) {
35133520
// Handle Deku Nuts
35143521
lusprintf(__FILE__, __LINE__, 2, "GLIDER");
35153522
Glide(play, this);
3516-
lusprintf(__FILE__, __LINE__, 2, "Glide");
35173523
} else if (itemAction == PLAYER_IA_DEKU_NUT) {
35183524
if (AMMO(ITEM_NUT) != 0) {
35193525
func_8083C61C(play, this);
@@ -3580,6 +3586,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) {
35803586
}
35813587
}
35823588
}
3589+
35833590
}
35843591

35853592
void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) {
@@ -4955,6 +4962,7 @@ s32 func_808382DC(Player* this, PlayState* play) {
49554962
}
49564963

49574964
void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play, u16 sfxId) {
4965+
this->numJumps++; // Autojump counts as first manual jump
49584966
Player_SetupAction(play, this, Player_Action_8084411C, 1);
49594967

49604968
if (anim != NULL) {
@@ -5984,11 +5992,13 @@ void ItemSpawnGlider(PlayState* play, Player* this) {
59845992
}
59855993

59865994
void DespawnHeldGlider(PlayState* play, Player* this) {
5995+
lusprintf(__FILE__, __LINE__, 2, "Despawning glider: %d", this->heldActor->id);
59875996
Actor* heldActor = this->heldActor;
59885997
if (heldActor->id == ACTOR_EN_GLIDER) {
5989-
osSyncPrintf("Despawning Glider\n");
5990-
heldActor->scale = (Vec3f){ 0.0f, 0.0f, 0.0f };
5991-
func_80834644(play, this);
5998+
lusprintf(__FILE__, __LINE__, 2, "Despawning Glider");
5999+
// heldActor->scale = (Vec3f){ 0.0f, 0.0f, 0.0f };
6000+
// func_80834644(play, this);
6001+
Player_FinishItemChange(play, this);
59926002
this->glideResetTimer = 5;
59936003
this->isGliding = false;
59946004
}
@@ -5997,32 +6007,41 @@ void DespawnHeldGlider(PlayState* play, Player* this) {
59976007
s32 Glide(PlayState* play, Player* this) {
59986008
s32 nextAnimType;
59996009
this->personalUpdraftTimer = 0;
6000-
if (this->numJumps == 0)
6010+
lusprintf(__FILE__, __LINE__, 2, "Glide");
6011+
6012+
if (this->numJumps == 0) {
6013+
lusprintf(__FILE__, __LINE__, 2, "First Jump");
60016014
func_80838940(this, gPlayerAnim_link_normal_run_jump, 6.7f, play, NA_SE_VO_LI_AUTO_JUMP); // First Jump
6002-
else if ((this->numJumps >= 1) & (this->glideResetTimer == 0)) {
6015+
} else if ((this->numJumps >= 1) & (this->glideResetTimer == 0)) {
6016+
lusprintf(__FILE__, __LINE__, 2, "Second Jump");
60036017
this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_GLIDER);
60046018
nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM];
6019+
lusprintf(__FILE__, __LINE__, 2, "heldItemId %d", this->heldItemId);
6020+
lusprintf(__FILE__, __LINE__, 2, "heldItemAction %d", this->heldItemAction);
60056021

60066022
if ((this->heldItemAction >= 0) && (ITEM_GLIDER != this->heldItemId) &&
60076023
(sItemChangeTypes[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType] !=
60086024
PLAYER_ITEM_CHG_0)) {
6025+
lusprintf(__FILE__, __LINE__, 2, "Changing to glider");
60096026
this->heldItemId = ITEM_GLIDER;
60106027
this->stateFlags1 |= PLAYER_STATE1_START_CHANGING_HELD_ITEM;
60116028
} else {
6012-
// Init new held item for use
60136029
Player_DestroyHookshot(this);
60146030
Player_DetachHeldActor(play, this);
6031+
lusprintf(__FILE__, __LINE__, 2, "Play should now hold the glider");
60156032
Player_InitItemActionWithAnim(play, this, PLAYER_IA_GLIDER);
60166033
this->isGliding = true;
60176034
}
60186035

60196036
if (this->landedAfterGliding) {
6037+
lusprintf(__FILE__, __LINE__, 2, "Landed after gliding");
60206038
this->landedAfterGliding = false;
60216039
this->actor.velocity.y += 8.0f;
60226040
if (this->actor.velocity.y >= 4.0f)
60236041
this->actor.velocity.y = 4.0f;
60246042
} else {
6025-
this->actor.velocity.y += 4.0f;
6043+
lusprintf(__FILE__, __LINE__, 2, "Not landed after gliding");
6044+
this->actor.velocity.y += 2.0f;
60266045
if (this->actor.velocity.y >= 0.0f)
60276046
this->actor.velocity.y = 0.0f;
60286047
}
@@ -7252,6 +7271,10 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) {
72527271
}
72537272
}
72547273

7274+
maxSpeed *= 4.0f;
7275+
7276+
lusprintf(__FILE__, __LINE__, 2, "Velocity: %f", this->actor.velocity.x);
7277+
72557278
if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) == BUNNY_HOOD_FAST_AND_JUMP &&
72567279
this->currentMask == PLAYER_MASK_BUNNY) {
72577280
maxSpeed *= 1.5f;
@@ -9030,6 +9053,11 @@ void Player_Action_80842180(Player* this, PlayState* play) {
90309053
}
90319054
}
90329055

9056+
// CUSTOM speed boost
9057+
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L)) {
9058+
sp2C *= 2.0f;
9059+
}
9060+
90339061
if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA &&
90349062
this->currentMask == PLAYER_MASK_BUNNY) {
90359063
sp2C *= 1.5f;
@@ -9835,7 +9863,7 @@ void Player_Action_8084411C(Player* this, PlayState* play) {
98359863
// CUSTOM
98369864
if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_GLIDER) &&
98379865
CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)) {
9838-
osSyncPrintf("Despawning Glider\n");
9866+
lusprintf(__FILE__, __LINE__, 2, "Despawning Glider");
98399867
DespawnHeldGlider(play, this);
98409868
}
98419869
}
@@ -12119,6 +12147,20 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
1211912147
}
1212012148
}
1212112149

12150+
if (this->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) { //1_21 //When climbing somthing - set to already jumped once
12151+
this->meleeWeaponState = 0;
12152+
this->numJumps = 1;
12153+
}
12154+
12155+
if (this->stateFlags2 & PLAYER_STATE2_DISABLE_ROTATION_ALWAYS) { //2_6 //When hanging from a ledge- set to already jumped once
12156+
this->meleeWeaponState = 0;
12157+
this->numJumps = 1;
12158+
}
12159+
if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) {
12160+
this->meleeWeaponState = 0;
12161+
this->numJumps = 1;
12162+
}
12163+
1212212164
if (this->unk_A86 < 0) {
1212312165
this->unk_A86++;
1212412166
if (this->unk_A86 == 0) {
@@ -12995,6 +13037,8 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
1299513037

1299613038
if (CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0)) {
1299713039
f32 movementSpeed = LINK_IS_ADULT ? 9.0f : 8.25f;
13040+
13041+
lusprintf(__FILE__, __LINE__, 2, "Movement Speed: %f", movementSpeed);
1299813042
if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA &&
1299913043
this->currentMask == PLAYER_MASK_BUNNY) {
1300013044
movementSpeed *= 1.5f;

0 commit comments

Comments
 (0)