Skip to content

Commit

Permalink
Player: Implement PlayerCounterAfterUpperPunch (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsterDruide1 authored Jun 10, 2024
1 parent 560c85b commit 307f18a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/odyssey_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -27262,8 +27262,8 @@ Address,Quality,Size,Name
0x000000710043e908,O,000016,_ZN26PlayerCounterAfterCapCatchC2EPK11PlayerConstPK13PlayerTrigger
0x000000710043e918,O,000072,_ZN26PlayerCounterAfterCapCatch6updateEPK13PlayerTrigger
0x000000710043e960,O,000080,_ZNK26PlayerCounterAfterCapCatch10isCapCatchEv
0x000000710043e9b0,U,000012,_ZN28PlayerCounterAfterUpperPunchC2Ev
0x000000710043e9bc,U,000068,_ZN28PlayerCounterAfterUpperPunch6updateEPK13PlayerTrigger
0x000000710043e9b0,O,000012,_ZN28PlayerCounterAfterUpperPunchC2Ev
0x000000710043e9bc,O,000068,_ZN28PlayerCounterAfterUpperPunch6updateEPK13PlayerTrigger
0x000000710043ea00,O,000008,_ZN21PlayerCounterForceRunC2Ev
0x000000710043ea08,O,000012,_ZN21PlayerCounterForceRun13setupForceRunEif
0x000000710043ea14,O,000048,_ZN21PlayerCounterForceRun6updateEv
Expand Down
13 changes: 13 additions & 0 deletions src/Player/PlayerCounterAfterUpperPunch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "Player/PlayerCounterAfterUpperPunch.h"

#include "Player/PlayerTrigger.h"

PlayerCounterAfterUpperPunch::PlayerCounterAfterUpperPunch() {}

void PlayerCounterAfterUpperPunch::update(const PlayerTrigger* trigger) {
if (mCounter <= sead::Mathi::maxNumber() - 1)
mCounter++;

if (trigger->isOnUpperPunchHit())
mCounter = 0;
}
16 changes: 16 additions & 0 deletions src/Player/PlayerCounterAfterUpperPunch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <math/seadMathCalcCommon.h>

class PlayerTrigger;

class PlayerCounterAfterUpperPunch {
public:
PlayerCounterAfterUpperPunch();
void update(const PlayerTrigger* trigger);

private:
// yes, this is an u32, bounded by a signed s32
u32 mCounter = sead::Mathi::maxNumber();
};
static_assert(sizeof(PlayerCounterAfterUpperPunch) == 0x4);

0 comments on commit 307f18a

Please sign in to comment.