Skip to content

Commit 94d1e4c

Browse files
committed
Fix Tails Gauge
1 parent 8ddf560 commit 94d1e4c

6 files changed

Lines changed: 31 additions & 20 deletions

File tree

MarathonRecomp/api/Marathon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
#include "Sonicteam/Player/State/Object2.h"
6464
#include "Sonicteam/Player/State/SonicContext.h"
6565
#include "Sonicteam/Player/State/SonicObject.h"
66-
#include "Sonicteam/Player/State/SonicSpinDash.h"
6766
#include "Sonicteam/Player/State/TailsContext.h"
67+
#include "Sonicteam/Player/State/TailsFlight.h"
6868
#include "Sonicteam/Player/Zock.h"
6969
#include "Sonicteam/SaveDataTask.h"
7070
#include "Sonicteam/SaveDataTaskXENON.h"

MarathonRecomp/api/Sonicteam/Player/State/CommonFall.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@
55

66
namespace Sonicteam::Player::State
77
{
8-
class CommonFall : public CommonObject {};
8+
class CommonFall : public CommonObject
9+
{
10+
public:
11+
MARATHON_INSERT_PADDING(8);
12+
};
913
}

MarathonRecomp/api/Sonicteam/Player/State/SonicSpinDash.h

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
5+
namespace Sonicteam::Player::State
6+
{
7+
class TailsFlight : public CommonFall
8+
{
9+
public:
10+
MARATHON_INSERT_PADDING(4);
11+
be<float> m_FlightTime;
12+
};
13+
}

MarathonRecomp/api/Sonicteam/SoX/AI/StateMachine.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44

55
namespace Sonicteam::SoX::AI
66
{
7-
template <typename TState>
7+
template <typename TContext>
88
class StateMachine
99
{
1010
public:
1111
xpointer<void> m_pVftable;
12-
xpointer<StateMachine<TState>> m_pState;
13-
MARATHON_INSERT_PADDING(4);
14-
xpointer<Player::State::IContext> m_pContext;
15-
MARATHON_INSERT_PADDING(4);
16-
be<float> m_Time;
12+
xpointer<StateMachine<TContext>> m_pState;
13+
xpointer<TContext> m_pContext;
14+
15+
template <typename TState>
16+
TState* GetState()
17+
{
18+
return (TState*)m_pState.get();
19+
}
1720

18-
template <typename TContext = Player::State::IContext>
1921
TContext* GetContext()
2022
{
2123
return (TContext*)m_pContext.get();

MarathonRecomp/patches/player_patches.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ PPC_FUNC(sub_8221A7D8)
2323
pGauge->m_Value = (100.0f / pTailsContext->m_FlightDuration) * pTailsContext->m_FlightTime;
2424
}
2525

26-
auto pState = pPlayer->m_spStateMachine->GetBase()->m_pState;
26+
auto pTailsFlight = pPlayer->m_spStateMachine->GetBase()->GetState<Sonicteam::Player::State::TailsFlight>();
2727
auto pGameImp = App::s_pApp->m_pDoc->GetDocMode<Sonicteam::GameMode>()->m_pGameImp;
2828

2929
auto maturityValue = 1.0f;
3030

3131
// Set maturity value if the current state is Sonicteam::Player::State::TailsFlight.
32-
if (pState->m_pVftable.ptr == 0x82005404)
33-
maturityValue = (1.0f / pTailsContext->m_FlightLimit) * pState->m_Time;
32+
if (pTailsFlight->m_pVftable.ptr == 0x82005404)
33+
maturityValue = (1.0f / pTailsContext->m_FlightLimit) * pTailsFlight->m_FlightTime;
3434

3535
for (int i = 0; i < 4; i++)
3636
{

0 commit comments

Comments
 (0)