本文整理汇总了C++中CVehicle::GetSpawnInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::GetSpawnInfo方法的具体用法?C++ CVehicle::GetSpawnInfo怎么用?C++ CVehicle::GetSpawnInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVehicle
的用法示例。
在下文中一共展示了CVehicle::GetSpawnInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showVehicleForPlayer
void CVehiclePool::showVehicleForPlayer( _VehicleID vehicleid, _PlayerID playerid )
{
RakNet::BitStream bStream;
CVehicle* vehicle = GetVehicle( vehicleid );
if( vehicle == 0 ) return;
float angle = 0.0f;
if( vehicle->vehMatrix.up.X == 0.0f && vehicle->vehMatrix.up.Y == 0.0f || vehicle->GetSpawnInfo()->vehType == 0x219 || vehicle->GetSpawnInfo()->vehType == 0x21A )
{
angle = vehicle->GetSpawnInfo()->vehRot;
}
else
{
angle = atan2( -vehicle->vehMatrix.up.X, vehicle->vehMatrix.up.Y ) * 57.2957763671875f;
if( angle >= 360.0 ) angle -= 360.0f;
else if( angle < 0.0f ) angle += 360.0f;
}
bStream.Write( ( _VehicleID ) vehicleid );
bStream.Write( ( uint32_t ) vehicle->GetSpawnInfo( )->vehType );
#ifdef _BIG_ENDIAN_SYSTEM
bStream.Write(vehicle->vehMatrix.pos.X);
bStream.Write(vehicle->vehMatrix.pos.Y);
bStream.Write(vehicle->vehMatrix.pos.Z);
#else
bStream.Write( (char*)&vehicle->vehMatrix.pos, sizeof( tVector ) );
#endif
bStream.Write( ( float ) angle );
bStream.Write( ( uint8_t )vehicle->GetSpawnInfo()->vehColor1 );
bStream.Write( ( uint8_t )vehicle->GetSpawnInfo()->vehColor2 );
bStream.Write( ( float ) vehicle->vehHealth );
bStream.Write( ( uint8_t ) vehicle->GetSpawnInfo()->vehInterior );
bStream.Write( ( uint32_t ) vehicle->vehDoorStatus );
bStream.Write( ( uint32_t ) vehicle->vehPanelStatus );
bStream.Write( ( uint8_t ) vehicle->vehLightStatus );
bStream.Write( ( uint8_t ) vehicle->vehTireStatus );
#ifdef _BIG_ENDIAN_SYSTEM
bStream.Write( (char*)&vehicle->vehModInfo.vehModSlots, sizeof(vehicle->vehModInfo.vehModSlots));
bStream.Write(vehicle->vehModInfo.vehPaintJob);
bStream.Write(vehicle->vehModInfo.vehColor1);
bStream.Write(vehicle->vehModInfo.vehColor2);
#else
bStream.Write( (char*)&vehicle->vehModInfo, sizeof( VEHMOD_INFO ) );
#endif
__NetGame->PlayerRPC( RPC_ShowVehicleToPlayer, &bStream, playerid, 2 );
if( strlen( vehicle->vehNumberPlate ) > 0 )
{
bStream.Reset( );
bStream.Write( ( _VehicleID ) vehicleid );
bStream.Write( ( uint8_t )strlen( vehicle->vehNumberPlate ) );
bStream.Write( (char*)vehicle->vehNumberPlate, strlen( vehicle->vehNumberPlate ) );
char* RPC_SetVehicleNumberPlate = 0;
__NetGame->PlayerRPC( RPC_SetVehicleNumberPlate, &bStream, playerid, 2);
}
if ( vehicle->hasParamExModified() )
{
bStream.Reset( );
VEHPARAM_EX* params = vehicle->GetParamsEx();
bStream.Write( vehicleid );
bStream.Write( (char*)params, sizeof( VEHPARAM_EX ) );
__NetGame->PlayerRPC( RPC_SetVehicleParamsEx, &bStream, playerid, 2 );
}
uint8_t paramsFlags = vehicle->GetParamsForPlayer( playerid );
vehicle->SetParamsForPlayer( playerid, paramsFlags & 1, ( paramsFlags & 2 ) ? 1 : 0 ); // Prevent lock/unlocking bug
vehicle->UpdateVehicleColorForPlayer( playerid ); // prevent unsynced color
}