mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Player: Implement PlayerHitPush (#875)
This commit is contained in:
parent
409bf2f3d7
commit
f37428ad86
|
|
@ -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
|
||||
|
|
|
|||
36
src/Player/PlayerHitPush.cpp
Normal file
36
src/Player/PlayerHitPush.cpp
Normal 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;
|
||||
}
|
||||
29
src/Player/PlayerHitPush.h
Normal file
29
src/Player/PlayerHitPush.h
Normal 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);
|
||||
Loading…
Reference in a new issue