You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a custom MTA stunt jump gamemode where players can create their own jumps, but it also includes the ones from the base game (converted).
I wanted to get the jump logic as close as possible to the original game, so I'm very thankful that this class was reverse engineered.
However, looking at the original code in a disassembler (IDA) I've noticed the logic is wrong
elseif ( CurrentUJStatus == 2 )
{
CurentUJTimeInFly += (CTimer::ms_fTimeStep * 0.02 * 1000.0);
if ( CurentUJTimeInFly >= 300 )
{
CTimer::ms_fTimeScale = 1.0;
CCamera::RestoreWithJumpCut(&TheCamera);
// Check if the end area was hit (m_bHitReward) and if the jump wasn't completed previously (mp_Active->done)if ( IsCurrentUJDone && !*(pCurrentUJData + 64) )
{
*(pCurrentUJData + 64) = 1;
++nUJs_done;
CStats::IncrementStat(145, 1.0);
if ( nUJs_done == nUniqueJumps )
v3 = 10000;
else
v3 = *(pCurrentUJData + 60);
v2->m_nScore += v3;
CAudioEngine::ReportFrontendAudioEvent(&AudioEngine, 43, 0.0, 1.0);
v4 = CText::Get(&TheText, "USJ");
if ( v4 )
CMessages::AddBigMessageQ(v4, 5000, 4u);
if ( nUJs_done == nUniqueJumps )
{
v5 = CText::Get(&TheText, "USJ_ALL");
if ( v5 )
CHud::SetHelpMessage(v5, 0, 0, 0);
}
v6 = CText::Get(&TheText, "REWARD");
if ( v6 )
CMessages::AddBigMessageWithNumber(v6, 6000, 5u, v3, -1, -1, -1, -1, -1);
}
// Afterwards, reset the CurrentUJStatus (m_jumpState) and currently active jump (mp_Active)
CurrentUJStatus = 0;
pCurrentUJData = 0;
}
}
}
Looking at the currently reverse engineered code on this repository I was wondering why it wasn't properly resetting it back to START_POINT_INTERSECTED when the player successfully completes a stunt jump
Turns out that it does an early break;, probably to simplify the code readability, at the cost of the function not being correctly implemented
The text was updated successfully, but these errors were encountered:
Lordmau5
changed the title
Incorrect code for StuntJumpManager#update
Incorrect code / logic for StuntJumpManager#update
Oct 12, 2024
Reading through the code with a clearer mind, it seems like it is working correctly after all
(Landed, check if the player hit the area, set it to done, the switch case will run into the check again and then detect the jump is done and reset the jump state)
However, it is still calling the timescale and camera restore twice - not sure if that's intentional
I'm working on a custom MTA stunt jump gamemode where players can create their own jumps, but it also includes the ones from the base game (converted).
I wanted to get the jump logic as close as possible to the original game, so I'm very thankful that this class was reverse engineered.
However, looking at the original code in a disassembler (IDA) I've noticed the logic is wrong
Reversed engineered code in question:
gta-reversed-modern/source/game_sa/StuntJumpManager.cpp
Lines 186 to 224 in c80350b
Decompiled through IDA:
Looking at the currently reverse engineered code on this repository I was wondering why it wasn't properly resetting it back to
START_POINT_INTERSECTED
when the player successfully completes a stunt jumpTurns out that it does an early
break;
, probably to simplify the code readability, at the cost of the function not being correctly implementedThe text was updated successfully, but these errors were encountered: