示例#1
0
    private bool CheckJump()
    {
        if ((playerState.pmFlags & PMoveFlags.RESPAWNED) != PMoveFlags.RESPAWNED)
        {
            return(false);
        }

        if (cmd.upmove < 10)
        {
            return(false);
        }

        if ((playerState.pmFlags & PMoveFlags.JUMP_HELD) != PMoveFlags.NONE)
        {
            cmd.upmove = 0;
            return(false);
        }

        impl.groundPlane     = false;
        impl.walking         = false;
        playerState.pmFlags |= PMoveFlags.JUMP_HELD;

        playerState.groundEntityNum = CConstVar.ENTITYNUM_NONE;
        playerState.velocity[2]     = CConstVar.JUMP_VELOCITY;

        CUtils.BG_AddPredictableEventToPlayerstate((int)EntityEventType.JUMP, 0, playerState);
        if (cmd.forwardmove >= 0)
        {
            playerState.pmFlags &= ~PMoveFlags.BACKWARDS_JUMP;
        }
        else
        {
            playerState.pmFlags |= PMoveFlags.BACKWARDS_JUMP;
        }
        return(true);
    }