示例#1
0
CVehicle::CVehicle ( CVehicleManager* pVehicleManager, CElement* pParent, CXMLNode* pNode, unsigned short usModel ) : CElement ( pParent, pNode )
{
    // Init
    m_pVehicleManager = pVehicleManager;
    m_usModel = usModel;
    m_pUpgrades = new CVehicleUpgrades ( this );

    m_iType = CElement::VEHICLE;
    SetTypeName ( "vehicle" );
    m_eVehicleType = CVehicleManager::GetVehicleType ( m_usModel );
    m_fHealth = DEFAULT_VEHICLE_HEALTH;
    m_ulHealthChangeTime = 0;
    m_ulBlowTime = 0;
    m_ulIdleTime = GetTickCount ();
    m_fTurretPositionX = 0;
    m_fTurretPositionY = 0;
    m_bSirenActive = false;
    m_bLandingGearDown = true;
    m_usAdjustableProperty = 0;
    m_bIsFrozen = false;
    m_bUnoccupiedSyncable = true;
    m_pSyncer = NULL;
    GetInitialDoorStates ( m_ucDoorStates );
    memset ( m_ucWheelStates, 0, sizeof ( m_ucWheelStates ) );
    memset ( m_ucPanelStates, 0, sizeof ( m_ucPanelStates ) );
    memset ( m_ucLightStates, 0, sizeof ( m_ucLightStates ) );
    m_ucOverrideLights = 0;
    m_pTowedVehicle = NULL;
    m_pTowedByVehicle = NULL;
    m_ucPaintjob = 3;
    m_ucMaxPassengersOverride = VEHICLE_PASSENGERS_UNDEFINED;

    m_bRespawnInfoChanged = false;
    m_fRespawnHealth = DEFAULT_VEHICLE_HEALTH;
    m_bRespawnEnabled = false;
    m_ulRespawnTime = 10000;
    m_ulIdleRespawnTime = 60000;

    m_bEngineOn = false;
    m_bLocked = false;
    m_bDoorsUndamageable = false;
    m_bDamageProof = false;
    m_bGunsEnabled = false;
    m_bFuelTankExplodable = false;
    m_bOnGround = true;
    m_bSmokeTrail = false;
    m_ucAlpha = 255;
    m_pJackingPlayer = NULL;
    m_bInWater = false;
    m_bDerailed = false;
    m_bIsDerailable = true;
    m_bTaxiLightState = false;
    m_bTrainDirection = true;
    m_HeadLightColor = SColorRGBA ( 255, 255, 255, 255 );
    m_bHeliSearchLightVisible = false;

    // Initialize the occupied Players
    for ( int i = 0; i < MAX_VEHICLE_SEATS; i++ )
    {
        m_pOccupants [i] = NULL;
    }

    // Add us to the vehicle manager
    pVehicleManager->AddToList ( this );

    // Randomize our color
    RandomizeColor ();

    // Generate a random reg plate
    GenerateRegPlate ();
}
示例#2
0
CVehicle::CVehicle ( CVehicleManager* pVehicleManager, CElement* pParent, CXMLNode* pNode, unsigned short usModel, unsigned char ucVariant, unsigned char ucVariant2 ) : CElement ( pParent, pNode )
{
    CElementRefManager::AddElementRefs ( ELEMENT_REF_DEBUG ( this, "CVehicle" ), &m_pTowedVehicle, &m_pTowedByVehicle, &m_pSyncer, &m_pJackingPlayer, NULL );

    // Init
    m_pVehicleManager = pVehicleManager;
    m_usModel = usModel;
    m_pUpgrades = new CVehicleUpgrades ( this );

    m_iType = CElement::VEHICLE;
    SetTypeName ( "vehicle" );
    m_eVehicleType = CVehicleManager::GetVehicleType ( m_usModel );
    m_fHealth = DEFAULT_VEHICLE_HEALTH;
    m_fLastSyncedHealthHealth = DEFAULT_VEHICLE_HEALTH;
    m_ulHealthChangeTime = 0;
    m_llIdleTime = CTickCount::Now ();
    m_fTurretPositionX = 0;
    m_fTurretPositionY = 0;
    m_bSirenActive = false;
    m_bLandingGearDown = true;
    m_usAdjustableProperty = 0;
    m_bIsFrozen = false;
    m_bUnoccupiedSyncable = true;
    m_pSyncer = NULL;
    GetInitialDoorStates ( m_ucDoorStates );
    memset ( &m_ucWheelStates[0], 0, sizeof ( m_ucWheelStates ) );
    memset ( &m_ucPanelStates[0], 0, sizeof ( m_ucPanelStates ) );
    memset ( &m_ucLightStates[0], 0, sizeof ( m_ucLightStates ) );
    m_ucOverrideLights = 0;
    m_pTowedVehicle = NULL;
    m_pTowedByVehicle = NULL;
    m_ucPaintjob = 3;
    m_ucMaxPassengersOverride = VEHICLE_PASSENGERS_UNDEFINED;
    m_pHandlingEntry = NULL;

    m_fRespawnHealth = DEFAULT_VEHICLE_HEALTH;
    m_bRespawnEnabled = false;
    m_ulBlowRespawnInterval = 10000;
    m_ulIdleRespawnInterval = 60000;

    m_bEngineOn = false;
    for ( unsigned int i = 0; i < 6; ++i )
        m_fDoorOpenRatio [ i ] = 0.0f;
    m_bLocked = false;
    m_bDoorsUndamageable = false;
    m_bDamageProof = false;
    m_bGunsEnabled = false;
    m_bFuelTankExplodable = false;
    m_bOnGround = true;
    m_bSmokeTrail = false;
    m_ucAlpha = 255;
    m_pJackingPlayer = NULL;
    m_bInWater = false;
    m_bDerailed = false;
    m_bIsDerailable = true;
    m_fTrainSpeed = 0.0f;
    m_fTrainPosition = 0.0f;
    m_ucTrackID = 0;
    m_bTaxiLightState = false;
    m_bTrainDirection = false;
    m_HeadLightColor = SColorRGBA ( 255, 255, 255, 255 );
    m_bHeliSearchLightVisible = false;
    m_bCollisionsEnabled = true;
    m_bHandlingChanged = false;
    m_ucVariant = ucVariant;
    m_ucVariant2 = ucVariant2;

    // Initialize the occupied Players
    for ( int i = 0; i < MAX_VEHICLE_SEATS; i++ )
    {
        m_pOccupants [i] = NULL;
    }

    // Add us to the vehicle manager
    pVehicleManager->AddToList ( this );

    // Randomize our color
    RandomizeColor ();

    // Generate a random reg plate
    GenerateRegPlate ();

    // Generate the handling data
    GenerateHandlingData ();

    // Prepare the sirens
    RemoveVehicleSirens();
    m_tSirenBeaconInfo.m_bOverrideSirens = false;
}