Player: Implement PlayerHitPush (#875)

This commit is contained in:
Naii-the-Baf 2026-01-16 09:32:13 -06:00 committed by GitHub
parent 409bf2f3d7
commit f37428ad86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 72 additions and 7 deletions

View file

@ -122157,31 +122157,31 @@ Player/PlayerHitPush.o:
label:
- _ZN13PlayerHitPushC1EPKN2al9LiveActorEPK11PlayerConst
- _ZN13PlayerHitPushC2EPKN2al9LiveActorEPK11PlayerConst
status: NotDecompiled
status: Matching
- offset: 0x44a698
size: 40
label: _ZN13PlayerHitPush12clearHitFlagEv
status: NotDecompiled
status: Matching
- offset: 0x44a6c0
size: 168
label: _ZN13PlayerHitPush10setHitPushERKN4sead7Vector3IfEE
status: NotDecompiled
status: Matching
- offset: 0x44a768
size: 132
label: _ZN13PlayerHitPush10setHitInfoERKN4sead7Vector3IfEEff
status: NotDecompiled
status: Matching
- offset: 0x44a7ec
size: 128
label: _ZN13PlayerHitPush16setHitPushStrongERKN4sead7Vector3IfEE
status: NotDecompiled
status: Matching
- offset: 0x44a86c
size: 128
label: _ZN13PlayerHitPush20setHitPushVeryStrongERKN4sead7Vector3IfEE
status: NotDecompiled
status: Matching
- offset: 0x44a8ec
size: 132
label: _ZN13PlayerHitPush18setHitPushBlowDownERKN4sead7Vector3IfEE
status: NotDecompiled
status: Matching
Player/PlayerInfo.o:
'.text':
- offset: 0x44a970

View file

@ -0,0 +1,36 @@
#include "Player/PlayerHitPush.h"
#include "Library/LiveActor/ActorPoseUtil.h"
#include "Player/PlayerConst.h"
PlayerHitPush::PlayerHitPush(const al::LiveActor* player, const PlayerConst* playerConst)
: mPlayer(player), mPlayerConst(playerConst) {}
void PlayerHitPush::clearHitFlag() {
mIsHit = false;
mIsBlowDown = false;
mPush = sead::Vector3f::zero;
}
void PlayerHitPush::setHitPush(const sead::Vector3f& dir) {
setHitInfo(dir, mPlayerConst->getPushPowerDamage(), mPlayerConst->getHopPowerDamage());
}
void PlayerHitPush::setHitInfo(const sead::Vector3f& dir, f32 pushPower, f32 hopPower) {
mIsHit = true;
mPush.setAdd(dir * -pushPower, al::getGravity(mPlayer) * -hopPower);
}
void PlayerHitPush::setHitPushStrong(const sead::Vector3f& dir) {
setHitInfo(dir, 5.0f, 20.0f);
}
void PlayerHitPush::setHitPushVeryStrong(const sead::Vector3f& dir) {
setHitInfo(dir, 15.0f, 10.0f);
}
void PlayerHitPush::setHitPushBlowDown(const sead::Vector3f& dir) {
setHitPushVeryStrong(dir);
mIsBlowDown = true;
}

View file

@ -0,0 +1,29 @@
#pragma once
#include <basis/seadTypes.h>
#include <math/seadVector.h>
namespace al {
class LiveActor;
}
class PlayerConst;
class PlayerHitPush {
public:
PlayerHitPush(const al::LiveActor* player, const PlayerConst* playerConst);
void clearHitFlag();
void setHitPush(const sead::Vector3f& dir);
void setHitInfo(const sead::Vector3f& dir, f32 pushPower, f32 hopPower);
void setHitPushStrong(const sead::Vector3f& dir);
void setHitPushVeryStrong(const sead::Vector3f& dir);
void setHitPushBlowDown(const sead::Vector3f& dir);
private:
const al::LiveActor* mPlayer = nullptr;
const PlayerConst* mPlayerConst = nullptr;
bool mIsHit = false;
bool mIsBlowDown = false;
sead::Vector3f mPush = {0.0f, 0.0f, 0.0f};
};
static_assert(sizeof(PlayerHitPush) == 0x20);