当前位置: 首页>>代码示例>>C++>>正文


C++ CVehicle::GetSirenRandomiser方法代码示例

本文整理汇总了C++中CVehicle::GetSirenRandomiser方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::GetSirenRandomiser方法的具体用法?C++ CVehicle::GetSirenRandomiser怎么用?C++ CVehicle::GetSirenRandomiser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CVehicle的用法示例。


在下文中一共展示了CVehicle::GetSirenRandomiser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProcessVehicleSirenPosition

bool ProcessVehicleSirenPosition ( )
{
    // Valid interface
    if ( pVehicleWithTheSiren )
    {
        // Grab our vehicle from the interface
        CVehicle * pVehicle = pGameInterface->GetPools ()->GetVehicle ( (DWORD *)pVehicleWithTheSiren );
        // Valid - Wait this seems familiar
        if ( pVehicle )
        {    
            // Disable our original siren based vehicles from this hook
            if ( DoesVehicleHaveSiren ( ) && pVehicle->DoesVehicleHaveSirens ( ) == false )
            {
                ucSirenCount = 0;
                // Set our time based alpha to 10% of the current time float
                fTime = *((float*)0xB7C4E4) * 0.1f;
                // Get our minimum alpha
                DWORD dwMinimumAlpha = pVehicle->GetVehicleSirenMinimumAlpha ( ucSirenCount );
                // Times the min alpha (255) by a multiplier to get it 0.0f-1.0f this multiplier was gained by doing 1.0 / 255.
                float fMinimumAlpha =  dwMinimumAlpha * 0.003921568627451f;
                // if our time is less than or equal to the minimum alpha
                if ( fTime <= dwMinimumAlpha )
                {
                    // Set it to the minimum
                    fTime = fMinimumAlpha;
                }
                // Set our red based on 255 and our blue based on 255 and green based on 0.. default SA values of course.
                /*if ( dwRed > 0 )
                    dwRed = (DWORD)( dwRed * fTime );
                if ( dwBlue > 0 )
                    dwBlue = (DWORD)( dwBlue * fTime );
                if ( dwGreen > 0 )
                    dwGreen = (DWORD)( dwGreen * fTime );*/
                bPointLights = false;
                // return false so our hook knows we decided not to edit anything
                return false;
            }
            // Does the vehicle have sirens and is the siren count greater than 0 
            if ( pVehicle->DoesVehicleHaveSirens ( ) && pVehicle->GetVehicleSirenCount ( ) > 0 )
            {
                // Get our siren count
                unsigned char ucVehicleSirenCount = pVehicle->GetVehicleSirenCount ( );
                // Get our current Siren ID
                ucSirenCount = pVehicle->GetVehicleCurrentSirenID ( );

                // Get our randomiser
                ucRandomiser = pVehicle->GetSirenRandomiser ( );

                if ( pVehicle->IsSirenRandomiserEnabled ( ) )
                {
                    // Make sure we aren't beyond our limit
                    if ( ucSirenCount > ucVehicleSirenCount )
                    {
                        // if we have more than 1 sirens
                        if ( ucVehicleSirenCount > 0 )
                            // Set our Randomiser
                            ucRandomiser = rand () % ucVehicleSirenCount;
                        else
                            // Set our Randomiser
                            ucRandomiser = 0;

                        if ( bPointLights == false )
                        {
                            // Update our stored Randomiser
                            pVehicle->SetSirenRandomiser ( ucRandomiser );
                        }
                    }
                    else
                    {
                        // Set our Randomiser
                        ucRandomiser = rand () % ucVehicleSirenCount;
                        if ( bPointLights == false )
                        {
                            // Update our stored Randomiser
                            pVehicle->SetSirenRandomiser ( ucRandomiser );
                        }
                    }
                }
                else
                {
                    ucRandomiser++;
                    if ( ucRandomiser >= ucVehicleSirenCount )
                    {
                        ucRandomiser = 0;
                    }
                    if ( bPointLights == false )
                    {
                        // Update our stored Randomiser
                        pVehicle->SetSirenRandomiser ( ucRandomiser );
                    }
                }
                ucSirenCount = ucRandomiser;

                if ( bPointLights == false )
                {
                    // Gete our siren position for this siren count
                    pVehicle->GetVehicleSirenPosition ( ucSirenCount, *vecRelativeSirenPosition );
                }

                if ( bPointLights == false )
//.........这里部分代码省略.........
开发者ID:Jusonex,项目名称:mtasa-awesomium,代码行数:101,代码来源:CMultiplayerSA_1.3.cpp


注:本文中的CVehicle::GetSirenRandomiser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。