Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,11 @@ void Actor_SetClosestSecretDistance(Actor* actor, struct PlayState* play);
s32 Actor_IsMounted(struct PlayState* play, Actor* horse);
u32 Actor_SetRideActor(struct PlayState* play, Actor* horse, s32 mountSide);
s32 Actor_NotMounted(struct PlayState* play, Actor* horse);
void Actor_SetPlayerKnockback(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 type, u32 damage);
void Actor_SetPlayerKnockbackLarge(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage);
void Actor_SetPlayerKnockbackLargeNoDamage(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity);
void Actor_SetPlayerKnockbackSmall(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage);
void Actor_SetPlayerKnockbackSmallNoDamage(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity);
void Actor_SetPlayerBump(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 type, u32 damage);
void Actor_SetPlayerBumpKnockdown(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage);
void Actor_SetPlayerBumpKnockdownNoDamage(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity);
void Actor_SetPlayerBumpKnockback(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage);
void Actor_SetPlayerBumpKnockbackNoDamage(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity);
void Player_PlaySfx(struct Player* player, u16 sfxId);
void Actor_PlaySfx(Actor* actor, u16 sfxId);
void Actor_PlaySfx_SurfaceBomb(struct PlayState* play, Actor* actor);
Expand Down
26 changes: 13 additions & 13 deletions include/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,17 +643,17 @@ typedef enum PlayerStickDirection {
/* 3 */ PLAYER_STICK_DIR_RIGHT
} PlayerStickDirection;

typedef enum PlayerKnockbackType {
/* 0 */ PLAYER_KNOCKBACK_NONE, // No knockback
/* 1 */ PLAYER_KNOCKBACK_SMALL, // A small hop, remains standing up
/* 2 */ PLAYER_KNOCKBACK_LARGE, // Sent flying in the air and lands laying down on the floor
/* 3 */ PLAYER_KNOCKBACK_LARGE_ELECTRIFIED // Same as`PLAYER_KNOCKBACK_LARGE` with a shock effect
} PlayerKnockbackType;
typedef enum PlayerBumpType {
/* 0 */ PLAYER_BUMP_NONE, // No knockback
/* 1 */ PLAYER_BUMP_KNOCKBACK, // A small hop, remains standing up
/* 2 */ PLAYER_BUMP_KNOCKDOWN, // Sent flying in the air and lands laying down on the floor
/* 3 */ PLAYER_BUMP_KNOCKDOWN_ELECTRIFIED // Same as`PLAYER_BUMP_KNOCKDOWN` with an electric shock effect
} PlayerBumpType;

typedef enum PlayerHitResponseType {
/* 0 */ PLAYER_HIT_RESPONSE_NONE,
/* 1 */ PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE,
/* 2 */ PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL,
/* 1 */ PLAYER_HIT_RESPONSE_KNOCKDOWN,
/* 2 */ PLAYER_HIT_RESPONSE_KNOCKBACK,
/* 3 */ PLAYER_HIT_RESPONSE_FROZEN,
/* 4 */ PLAYER_HIT_RESPONSE_ELECTRIFIED
} PlayerHitResponseType;
Expand Down Expand Up @@ -961,11 +961,11 @@ typedef struct Player {
/* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful
/* 0x089C */ s16 unk_89C;
/* 0x089E */ u16 floorSfxOffset;
/* 0x08A0 */ u8 knockbackDamage;
/* 0x08A1 */ u8 knockbackType;
/* 0x08A2 */ s16 knockbackRot;
/* 0x08A4 */ f32 knockbackSpeed;
/* 0x08A8 */ f32 knockbackYVelocity;
/* 0x08A0 */ u8 bumpDamage;
/* 0x08A1 */ u8 bumpType;
/* 0x08A2 */ s16 bumpRot;
/* 0x08A4 */ f32 bumpSpeed;
/* 0x08A8 */ f32 bumpYVelocity;
/* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces
/* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed
/* 0x08B4 */ WeaponInfo meleeWeaponInfo[3];
Expand Down
73 changes: 29 additions & 44 deletions src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1952,78 +1952,63 @@ s32 Actor_NotMounted(PlayState* play, Actor* horse) {
}

/**
* Sets the player's knockback properties
* Sets the player's bump (knockback/knockdown) properties.
*
* @param play
* @param actor source actor applying knockback damage
* @param speed
* @param rot the direction the player will be pushed
* @param yVelocity
* @param type PlayerKnockbackType
* @param actor source actor applying bump
* @param rot the direction the player will be pushed in
* @param type see `PlayerBumpType`
* @param damage additional amount of damage to deal to the player
*/
void Actor_SetPlayerKnockback(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 type, u32 damage) {
void Actor_SetPlayerBump(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 type, u32 damage) {
Player* player = GET_PLAYER(play);

player->knockbackDamage = damage;
player->knockbackType = type;
player->knockbackSpeed = speed;
player->knockbackRot = rot;
player->knockbackYVelocity = yVelocity;
player->bumpDamage = damage;
player->bumpType = type;
player->bumpSpeed = speed;
player->bumpRot = rot;
player->bumpYVelocity = yVelocity;
}

/**
* Knocks the player to the ground
* Knocks the player down to the ground.
*
* @param play
* @param actor source actor applying knockback damage
* @param speed
* @param rot the direction the player will be pushed
* @param yVelocity
* @param actor source actor applying bump
* @param rot the direction the player will be pushed in
* @param damage additional amount of damage to deal to the player
*/
void Actor_SetPlayerKnockbackLarge(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage) {
Actor_SetPlayerKnockback(play, actor, speed, rot, yVelocity, PLAYER_KNOCKBACK_LARGE, damage);
void Actor_SetPlayerBumpKnockdown(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage) {
Actor_SetPlayerBump(play, actor, speed, rot, yVelocity, PLAYER_BUMP_KNOCKDOWN, damage);
}

/**
* Knocks the player to the ground, without applying additional damage
* Knocks the player down to the ground, without applying additional damage.
*
* @param play
* @param actor source actor applying knockback damage
* @param speed
* @param rot the direction the player will be pushed
* @param yVelocity
* @param actor source actor applying bump
* @param rot the direction the player will be pushed in
*/
void Actor_SetPlayerKnockbackLargeNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity) {
Actor_SetPlayerKnockbackLarge(play, actor, speed, rot, yVelocity, 0);
void Actor_SetPlayerBumpKnockdownNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity) {
Actor_SetPlayerBumpKnockdown(play, actor, speed, rot, yVelocity, 0);
}

/**
* Knocks the player back while keeping them on their feet
* Knocks the player back while keeping them on their feet.
*
* @param play
* @param actor
* @param speed overridden
* @param rot the direction the player will be pushed
* @param yVelocity overridden
* @param actor source actor applying bump
* @param rot the direction the player will be pushed in
* @param damage additional amount of damage to deal to the player
*/
void Actor_SetPlayerKnockbackSmall(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage) {
Actor_SetPlayerKnockback(play, actor, speed, rot, yVelocity, PLAYER_KNOCKBACK_SMALL, damage);
void Actor_SetPlayerBumpKnockback(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage) {
Actor_SetPlayerBump(play, actor, speed, rot, yVelocity, PLAYER_BUMP_KNOCKBACK, damage);
}

/**
* Knocks the player back while keeping them on their feet, without applying additional damage
* Knocks the player back while keeping them on their feet, without applying additional damage.
*
* @param play
* @param actor
* @param speed overridden
* @param actor source actor applying bump
* @param rot the direction the player will be pushed
* @param yVelocity overridden
*/
void Actor_SetPlayerKnockbackSmallNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity) {
Actor_SetPlayerKnockbackSmall(play, actor, speed, rot, yVelocity, 0);
void Actor_SetPlayerBumpKnockbackNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity) {
Actor_SetPlayerBumpKnockback(play, actor, speed, rot, yVelocity, 0);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void BgHakaTubo_Idle(BgHakaTubo* this, PlayState* play) {
// Colliding with flame circle
if (this->flamesCollider.base.atFlags & AT_HIT) {
this->flamesCollider.base.atFlags &= ~AT_HIT;
Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f);
Actor_SetPlayerBumpKnockdownNoDamage(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f);
}
// Colliding with collider inside the pot
if (this->potCollider.base.acFlags & AC_HIT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void BgHidanCurtain_Update(Actor* thisx, PlayState* play2) {
} else {
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT;
Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f);
Actor_SetPlayerBumpKnockdownNoDamage(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f);
}
if ((this->type == 4) || (this->type == 5)) {
this->actor.world.pos.y = (2.0f * this->actor.home.pos.y) - hcParams->riseDist - this->actor.world.pos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void BgHidanFirewall_Collide(BgHidanFirewall* this, PlayState* play) {
phi_a3 = this->actor.shape.rot.y + 0x8000;
}

Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, phi_a3, 1.0f);
Actor_SetPlayerBumpKnockdownNoDamage(play, &this->actor, 5.0f, phi_a3, 1.0f);
}

void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, PlayState* play) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void BgHidanFwbig_Update(Actor* thisx, PlayState* play) {

if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT;
Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f);
Actor_SetPlayerBumpKnockdownNoDamage(play, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f);
if (this->direction != 0) {
this->actionFunc = BgHidanFwbig_Lower;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void func_8088D750(BgHidanSekizou* this, PlayState* play) {
phi_a3 = -0x4000;
}
}
Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 5.0f, phi_a3, 1.0f);
Actor_SetPlayerBumpKnockdownNoDamage(play, &this->dyna.actor, 5.0f, phi_a3, 1.0f);
}

void BgHidanSekizou_Update(Actor* thisx, PlayState* play2) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play) {
thisx->world.rot.y += 0x8000;
}

Actor_SetPlayerKnockbackLarge(play, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0);
Actor_SetPlayerBumpKnockdown(play, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0);
Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT);

this->yOffsetSpeed = 10.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) {
case 3:
case 5:
if (fabsf(D_8089B9C0[D_8089BA30[i]]) > 1.0f) {
Actor_SetPlayerKnockbackLarge(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0);
Actor_SetPlayerBumpKnockdown(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0);
}
break;
case 1:
case 4:
if (fabsf(D_8089B9C0[D_8089BA30[i]] - D_8089B9C0[D_8089BA30[i + 1]]) > 1.0f) {
Actor_SetPlayerKnockbackLarge(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0);
Actor_SetPlayerBumpKnockdown(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0);
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void BgYdanMaruta_Destroy(Actor* thisx, PlayState* play) {

void func_808BEFF4(BgYdanMaruta* this, PlayState* play) {
if (this->collider.base.atFlags & AT_HIT) {
Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f);
Actor_SetPlayerBumpKnockdownNoDamage(play, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f);
}
this->dyna.actor.shape.rot.x += 0x360;
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) {
diff.z = player->actor.world.pos.z - effect->pos.z;
if ((this->timers[3] == 0) && (sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z)) < 20.0f)) {
this->timers[3] = 50;
Actor_SetPlayerKnockbackLarge(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30);
Actor_SetPlayerBumpKnockdown(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30);
if (!player->bodyIsBurning) {
s16 i2;

Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void BossFd2_Emerge(BossFd2* this, PlayState* play) {
case 2:
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0);
if ((this->timers[0] == 1) && (this->actor.xzDistToPlayer < 120.0f)) {
Actor_SetPlayerKnockbackLarge(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20);
Actor_SetPlayerBumpKnockdown(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20);
Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT);
}
if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) {
Expand Down
8 changes: 4 additions & 4 deletions src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
Original file line number Diff line number Diff line change
Expand Up @@ -4009,7 +4009,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) {
} else {
if (sqrtf(SQ(xDistFromLink) + SQ(yDistFromLink) + SQ(zDistFromLink)) <= 25.0f) {
spBA = 5;
Actor_SetPlayerKnockbackLarge(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30);
Actor_SetPlayerBumpKnockdown(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER);
ganondorf->timers[2] = 20;

Expand Down Expand Up @@ -4481,7 +4481,7 @@ void func_808E2544(Actor* thisx, PlayState* play) {
this->actor.speed = 0.0f;

if (dorf->timers[2] == 0) {
Actor_SetPlayerKnockbackLarge(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50);
Actor_SetPlayerBumpKnockdown(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER);
dorf->timers[2] = 20;

Expand Down Expand Up @@ -4803,8 +4803,8 @@ void BossGanon_UpdateEffects(PlayState* play) {

if (((eff->scale * 150.0f) < distToPlayer) && (distToPlayer < (eff->scale * 300.0f))) {
eff->timer = 150;
Actor_SetPlayerKnockbackLarge(play, &sGanondorf->actor, 7.0f,
sGanondorf->actor.yawTowardsPlayer, 0.0f, 0x20);
Actor_SetPlayerBumpKnockdown(play, &sGanondorf->actor, 7.0f, sGanondorf->actor.yawTowardsPlayer,
0.0f, 0x20);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2191,8 +2191,8 @@ void func_80902348(BossGanon2* this, PlayState* play) {
phi_v0_2 = 0;
}

Actor_SetPlayerKnockbackLarge(play, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f,
0);
Actor_SetPlayerBumpKnockdown(play, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f,
0);
sZelda->unk_3C8 = 8;
this->unk_316 = 10;
break;
Expand All @@ -2218,7 +2218,7 @@ void func_80902348(BossGanon2* this, PlayState* play) {
}

player->bodyIsBurning = true;
Actor_SetPlayerKnockbackLarge(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10);
Actor_SetPlayerBumpKnockdown(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10);
sZelda->unk_3C8 = 8;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
player->actor.parent = NULL;
player->csAction = PLAYER_CSACTION_NONE;
if (this->timers[0] == 0) {
Actor_SetPlayerKnockbackLarge(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000,
10.0f, 0);
Actor_SetPlayerBumpKnockdown(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000,
10.0f, 0);
}
}
this->timers[0] = 75;
Expand Down
Loading