Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset from a successful stunt jump properly #786

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yukani
Copy link
Collaborator

@yukani yukani commented Oct 12, 2024

Fixes #785

@yukani yukani requested a review from Pirulax October 12, 2024 15:04
@Pirulax
Copy link
Collaborator

Pirulax commented Oct 12, 2024

The code is still wrong in one place (and I also refactored it). Just copy paste the whole switch case.

        case eJumpState::IN_FLIGHT: { // 0x49C665
            bool failed = false;
            if (playerVehicle->m_nNumEntitiesCollided != 0 && m_iTimer >= 100) {
                failed = playerInfo->m_nPlayerState == PLAYERSTATE_HAS_DIED
                    | !playerPed->bInVehicle
                    | playerVehicle->m_nStatus == STATUS_WRECKED || playerVehicle->vehicleFlags.bIsDrowning || playerVehicle->physicalFlags.bSubmergedInWater;

                if (mp_Active->end.IsPointWithin(playerVehicle->GetPosition())) {
                    m_bHitReward = true;
                }
            }

            if (failed) {
                m_jumpState = eJumpState::END_POINT_INTERSECTED;
            }

            m_iTimer = (uint32)CTimer::GetTimeStepInMS() + (failed ? 0 : m_iTimer);
            if (m_iTimer > 1'000 && time <= 1'000) {
                if (const auto veh = FindPlayerVehicle()) {
                    if (const auto p = veh->PickRandomPassenger()) {
                        p->Say(CTX_GLOBAL_CAR_JUMP);
                    }
                }
            }

            break;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect code / logic for StuntJumpManager#update
2 participants