Изменён метод работы с библиотеками. Исправлены ошибки

This commit is contained in:
Kernell 2015-11-28 04:41:37 +03:00
parent 9b0242c67b
commit 31a0c20137
18 changed files with 4118 additions and 4443 deletions

View File

@ -683,11 +683,9 @@ bool CMonoFunctions::Server::OutputChatBox( MonoString* msText, DWORD pElement,
{
const char* szText = mono_string_to_utf8( msText );
CMonoObject pColor( mpColor );
unsigned char ucRed = pColor.GetPropertyValue< unsigned char >( "R" );
unsigned char ucGreen = pColor.GetPropertyValue< unsigned char >( "G" );
unsigned char ucBlue = pColor.GetPropertyValue< unsigned char >( "B" );
unsigned char ucRed = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "R" );
unsigned char ucGreen = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "G" );
unsigned char ucBlue = CMonoObject::GetPropertyValue< unsigned char >( mpColor, "B" );
return CLuaFunctionDefinitions::OutputChatBox( RESOURCE->GetLua(), szText, (void*)pElement, ucRed, ucGreen, ucBlue, bColorCoded );
}
@ -748,12 +746,7 @@ MonoObject* CMonoFunctions::Server::GetVersion( void )
&szSortable
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "ServerVersion", args, 8 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto", "ServerVersion", args, 8 );
}
}

View File

@ -27,9 +27,7 @@ bool CMonoFunctions::Audio::PlayMission( DWORD pUserData, MonoObject* pPosition,
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
return CLuaFunctionDefinitions::PlayMissionAudio( RESOURCE->GetLua(), (void*)pUserData, vecPosition, usSlot );
return CLuaFunctionDefinitions::PlayMissionAudio( RESOURCE->GetLua(), (void*)pUserData, Vector3( pPosition ), usSlot );
}
return false;

View File

@ -17,9 +17,9 @@ DWORD CMonoFunctions::Blip::Create( MonoObject* pPosition, unsigned char ucIcon,
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
Vector3 vecPosition( pPosition );
SColor pColor = CMonoObject( color ).GetColor();
SColor pColor = CMonoObject::GetColor( color );
return (DWORD)CLuaFunctionDefinitions::CreateBlip( RESOURCE->GetLua(), vecPosition, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
}
@ -31,7 +31,7 @@ DWORD CMonoFunctions::Blip::CreateAttachedTo( DWORD pTarget, unsigned char ucIco
{
if( RESOURCE )
{
SColor pColor = CMonoObject( color ).GetColor();
SColor pColor = CMonoObject::GetColor( color );
return (DWORD)CLuaFunctionDefinitions::CreateBlipAttachedTo( RESOURCE->GetLua(), (void*)pTarget, ucIcon, ucSize, pColor, sOrdering, usVisibleDistance, (void*)pVisibleTo );
}
@ -79,12 +79,7 @@ MonoObject* CMonoFunctions::Blip::GetColor( DWORD pUserData )
if( CLuaFunctionDefinitions::GetBlipColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pObject = RESOURCE->NewObject( outColor );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( outColor );
}
}
@ -147,9 +142,7 @@ bool CMonoFunctions::Blip::SetColor( DWORD pUserData, MonoObject* color )
{
if( RESOURCE )
{
SColor pColor = CMonoObject( color ).GetColor();
return CLuaFunctionDefinitions::SetBlipColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
return CLuaFunctionDefinitions::SetBlipColor( RESOURCE->GetLua(), (void*)pUserData, CMonoObject::GetColor( color ) );
}
return false;

View File

@ -41,13 +41,7 @@ DWORD CMonoFunctions::Element::Clone( DWORD pUserData, MonoObject* vecPosition,
{
if( RESOURCE )
{
CMonoObject pPosition( vecPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
return (DWORD)CLuaFunctionDefinitions::CloneElement( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ), bCloneElement );
return (DWORD)CLuaFunctionDefinitions::CloneElement( RESOURCE->GetLua(), (void*)pUserData, Vector3( vecPosition ), bCloneElement );
}
return false;
@ -163,12 +157,7 @@ MonoObject* CMonoFunctions::Element::GetPosition( DWORD pUserData )
if( CLuaFunctionDefinitions::GetElementPosition( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecPosition );
}
}
@ -183,12 +172,7 @@ MonoObject* CMonoFunctions::Element::GetRotation( DWORD pUserData )
if( CLuaFunctionDefinitions::GetElementRotation( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecPosition );
}
}
@ -203,12 +187,7 @@ MonoObject* CMonoFunctions::Element::GetVelocity( DWORD pUserData )
if( CLuaFunctionDefinitions::GetElementVelocity( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecPosition );
}
}
@ -403,12 +382,7 @@ MonoObject* CMonoFunctions::Element::GetAttachedOffsetPosition( DWORD pUserData
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( RESOURCE->GetLua(), (void*)pUserData, vecPosition, vecRotation ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecPosition );
}
}
@ -423,12 +397,7 @@ MonoObject* CMonoFunctions::Element::GetAttachedOffsetRotation( DWORD pUserData
if( CLuaFunctionDefinitions::GetElementAttachedOffsets( RESOURCE->GetLua(), (void*)pUserData, vecPosition, vecRotation ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecRotation );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecRotation );
}
}
@ -560,13 +529,7 @@ bool CMonoFunctions::Element::SetPosition( DWORD pUserData, MonoObject* pPositio
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
return CLuaFunctionDefinitions::SetElementPosition( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ), bWarp );
return CLuaFunctionDefinitions::SetElementPosition( RESOURCE->GetLua(), (void*)pUserData, Vector3( pPosition ), bWarp );
}
return false;
@ -576,15 +539,9 @@ bool CMonoFunctions::Element::SetRotation( DWORD pUserData, MonoObject* pRotatio
{
if( RESOURCE )
{
CMonoObject pPosition( pRotation );
float fX = pPosition.GetPropertyValue<float>( "X" );
float fY = pPosition.GetPropertyValue<float>( "Y" );
float fZ = pPosition.GetPropertyValue<float>( "Z" );
const char* szRotationOrder = mono_string_to_utf8( msRotationOrder );
return CLuaFunctionDefinitions::SetElementRotation( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ), szRotationOrder, bNewWay );
return CLuaFunctionDefinitions::SetElementRotation( RESOURCE->GetLua(), (void*)pUserData, Vector3( pRotation ), szRotationOrder, bNewWay );
}
return false;
@ -594,13 +551,7 @@ bool CMonoFunctions::Element::SetVelocity( DWORD pUserData, MonoObject* pVelocit
{
if( RESOURCE )
{
CMonoObject pPosition( pVelocity );
float fX = pPosition.GetPropertyValue<float>( "X" );
float fY = pPosition.GetPropertyValue<float>( "Y" );
float fZ = pPosition.GetPropertyValue<float>( "Z" );
return CLuaFunctionDefinitions::SetElementVelocity( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ) );
return CLuaFunctionDefinitions::SetElementVelocity( RESOURCE->GetLua(), (void*)pUserData, Vector3( pVelocity ) );
}
return false;
@ -641,18 +592,8 @@ bool CMonoFunctions::Element::Attach( DWORD pUserData, DWORD pTarget, MonoObject
if( RESOURCE )
{
Vector3
vecPosition, vecRotation;
CMonoObject
pPosition( pMonoPosition ), pRotation( pMonoRotation );
vecPosition.fX = pPosition.GetPropertyValue<float>( "X" );
vecPosition.fY = pPosition.GetPropertyValue<float>( "Y" );
vecPosition.fZ = pPosition.GetPropertyValue<float>( "Z" );
vecRotation.fX = pRotation.GetPropertyValue<float>( "X" );
vecRotation.fY = pRotation.GetPropertyValue<float>( "Y" );
vecRotation.fZ = pRotation.GetPropertyValue<float>( "Z" );
vecPosition( pMonoPosition ),
vecRotation( pMonoRotation );
return CLuaFunctionDefinitions::AttachElements( RESOURCE->GetLua(), (void*)pUserData, (void*)pTarget, vecPosition, vecRotation );
}
@ -715,18 +656,8 @@ bool CMonoFunctions::Element::SetAttachedOffsets( DWORD pUserData, MonoObject* p
if( RESOURCE )
{
Vector3
vecPosition, vecRotation;
CMonoObject
pPosition( pMonoPosition ), pRotation( pMonoRotation );
vecPosition.fX = pPosition.GetPropertyValue<float>( "X" );
vecPosition.fY = pPosition.GetPropertyValue<float>( "Y" );
vecPosition.fZ = pPosition.GetPropertyValue<float>( "Z" );
vecRotation.fX = pRotation.GetPropertyValue<float>( "X" );
vecRotation.fY = pRotation.GetPropertyValue<float>( "Y" );
vecRotation.fZ = pRotation.GetPropertyValue<float>( "Z" );
vecPosition( pMonoPosition ),
vecRotation( pMonoRotation );
return CLuaFunctionDefinitions::SetElementAttachedOffsets( RESOURCE->GetLua(), (void*)pUserData, vecPosition, vecRotation );
}

View File

@ -17,9 +17,7 @@ bool CMonoFunctions::Explosion::Create( MonoObject* pPosition, unsigned char ucT
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
return (DWORD)CLuaFunctionDefinitions::CreateExplosion( RESOURCE->GetLua(), vecPosition, ucType, (void*)pCreator );
return (DWORD)CLuaFunctionDefinitions::CreateExplosion( RESOURCE->GetLua(), Vector3( pPosition ), ucType, (void*)pCreator );
}
return NULL;

View File

@ -17,26 +17,9 @@ DWORD CMonoFunctions::Marker::Create( MonoObject* pPosition, MonoString* msType,
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
const char* szType = mono_string_to_utf8( msType );
CMonoObject pMonoColor( pColor );
SColor pColor;
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
return (DWORD)CLuaFunctionDefinitions::CreateMarker( RESOURCE->GetLua(), vecPosition, szType, fSize, pColor, (void*)pVisibleTo );
return (DWORD)CLuaFunctionDefinitions::CreateMarker( RESOURCE->GetLua(), Vector3( pPosition ), szType, fSize, CMonoObject::GetColor( pColor ), (void*)pVisibleTo );
}
return NULL;
@ -97,12 +80,7 @@ MonoObject* CMonoFunctions::Marker::GetColor( DWORD pUserData )
if( CLuaFunctionDefinitions::GetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pObject = RESOURCE->NewObject( outColor );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( outColor );
}
}
@ -117,12 +95,7 @@ MonoObject* CMonoFunctions::Marker::GetTarget( DWORD pUserData )
if( CLuaFunctionDefinitions::GetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecPosition );
}
}
@ -168,20 +141,11 @@ bool CMonoFunctions::Marker::SetSize( DWORD pUserData, float fSize )
return false;
}
bool CMonoFunctions::Marker::SetColor( DWORD pUserData, MonoObject* color )
bool CMonoFunctions::Marker::SetColor( DWORD pUserData, MonoObject* pColor )
{
if( RESOURCE )
{
SColor pColor;
CMonoObject pMonoColor( color );
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
return CLuaFunctionDefinitions::SetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
return CLuaFunctionDefinitions::SetMarkerColor( RESOURCE->GetLua(), (void*)pUserData, CMonoObject::GetColor( pColor ) );
}
return false;
@ -191,15 +155,7 @@ bool CMonoFunctions::Marker::SetTarget( DWORD pUserData, MonoObject* pTarget )
{
if( RESOURCE )
{
Vector3* vecPosition = new Vector3;
CMonoObject pTarget( pTarget );
vecPosition->fX = pTarget.GetPropertyValue< float >( "X" );
vecPosition->fY = pTarget.GetPropertyValue< float >( "Y" );
vecPosition->fZ = pTarget.GetPropertyValue< float >( "Z" );
return CLuaFunctionDefinitions::SetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, vecPosition );
return CLuaFunctionDefinitions::SetMarkerTarget( RESOURCE->GetLua(), (void*)pUserData, Vector3( pTarget ) );
}
return false;

View File

@ -17,21 +17,8 @@ DWORD CMonoFunctions::Object::Create( unsigned short usModelID, MonoObject* pPos
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
CMonoObject pRotation( pRotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "Y" );
float fRZ = pRotation.GetPropertyValue< float >( "Z" );
Vector3 vecRotation( fRX, fRY, fRZ );
Vector3 vecPosition( pPosition );
Vector3 vecRotation( pRotation );
return (DWORD)CLuaFunctionDefinitions::CreateObject( RESOURCE->GetLua(), usModelID, vecPosition, vecRotation, bIsLowLod );
}
@ -49,12 +36,7 @@ MonoObject* CMonoFunctions::Object::GetScale( DWORD pUserData )
if( CLuaFunctionDefinitions::GetObjectScale( RESOURCE->GetLua(), (void*)pUserData, vecScale ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecScale );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecScale );
}
}
@ -67,15 +49,7 @@ bool CMonoFunctions::Object::SetScale( DWORD pUserData, MonoObject* pScale )
{
if( RESOURCE )
{
Vector3 vecScale;
CMonoObject pScale( pScale );
vecScale.fX = pScale.GetPropertyValue< float >( "X" );
vecScale.fY = pScale.GetPropertyValue< float >( "Y" );
vecScale.fZ = pScale.GetPropertyValue< float >( "Z" );
return CLuaFunctionDefinitions::SetObjectScale( RESOURCE->GetLua(), (void*)pUserData, vecScale );
return CLuaFunctionDefinitions::SetObjectScale( RESOURCE->GetLua(), (void*)pUserData, Vector3( pScale ) );
}
return false;
@ -85,19 +59,9 @@ bool CMonoFunctions::Object::Move( DWORD pUserData, unsigned long ulTime, MonoOb
{
if( RESOURCE )
{
Vector3 vecPosition, vecRotation;
CMonoObject pPosition( pPosition );
vecPosition.fX = pPosition.GetPropertyValue< float >( "X" );
vecPosition.fY = pPosition.GetPropertyValue< float >( "Y" );
vecPosition.fZ = pPosition.GetPropertyValue< float >( "Z" );
CMonoObject pRotation( pRotation );
vecRotation.fX = pRotation.GetPropertyValue< float >( "X" );
vecRotation.fY = pRotation.GetPropertyValue< float >( "Y" );
vecRotation.fZ = pRotation.GetPropertyValue< float >( "Z" );
Vector3
vecPosition( pPosition ),
vecRotation( pRotation );
const char* szEasingType = mono_string_to_utf8( msEasingType );

View File

@ -20,13 +20,7 @@ DWORD CMonoFunctions::Ped::Create( int iModelid, MonoObject* pMonoPosition, floa
{
if( RESOURCE )
{
CMonoObject pPosition( pMonoPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
Vector3 vecPosition( pMonoPosition );
return (DWORD)CLuaFunctionDefinitions::CreatePed( RESOURCE->GetLua(), iModelid, vecPosition, fRot, bSynced );
}

View File

@ -17,13 +17,7 @@ DWORD CMonoFunctions::Pickup::Create( MonoObject* pPosition, unsigned char ucTyp
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
Vector3 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreatePickup( RESOURCE->GetLua(), vecPosition, ucType, dFive, ulRespawnInterval, dSix );
}

View File

@ -224,12 +224,7 @@ MonoObject* CMonoFunctions::Player::GetNametagColor( DWORD pUserData )
&ucR, &ucG, &ucB
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "Color", args, 3 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto", "Color", args, 3 );
}
}
@ -358,12 +353,7 @@ MonoObject* CMonoFunctions::Player::GetACInfo( DWORD pUserData )
&msD3D9SHA256
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "PlayerACInfo", args, 4 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto", "PlayerACInfo", args, 4 );
}
}
return NULL;
@ -417,13 +407,7 @@ bool CMonoFunctions::Player::Spawn( DWORD pUserData, MonoObject* pPosition, int
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
Vector3 vecPosition( fX, fY, fZ );
Vector3 vecPosition( pPosition );
return CLuaFunctionDefinitions::SpawnPlayer( RESOURCE->GetLua(), (void*)pUserData, vecPosition, iRotation, iSkinID, iInterior, iDimension, (void*)pTeam );
}
@ -801,12 +785,7 @@ MonoObject* CMonoFunctions::Player::GetCameraMatrix( DWORD pPlayer )
&fFOV
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "CameraMatrix", args, 8 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto", "CameraMatrix", args, 8 );
}
}
@ -844,22 +823,20 @@ bool CMonoFunctions::Player::SetCameraMatrix( DWORD pPlayer, MonoObject* pCamera
{
if( RESOURCE )
{
CMonoObject pCameraMatrix( pCameraMatrix );
float fX = pCameraMatrix.GetPropertyValue< float >( "X" );
float fY = pCameraMatrix.GetPropertyValue< float >( "Y" );
float fZ = pCameraMatrix.GetPropertyValue< float >( "Z" );
float fX = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "Z" );
Vector3 vecPosition( fX, fY, fZ );
float fLookAtX = pCameraMatrix.GetPropertyValue< float >( "LookAtX" );
float fLookAtY = pCameraMatrix.GetPropertyValue< float >( "LookAtY" );
float fLookAtZ = pCameraMatrix.GetPropertyValue< float >( "LookAtZ" );
float fLookAtX = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "LookAtX" );
float fLookAtY = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "LookAtY" );
float fLookAtZ = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "LookAtZ" );
Vector3* vecLookAt = new Vector3( fLookAtX, fLookAtY, fLookAtZ );
Vector3 vecLookAt( fLookAtX, fLookAtY, fLookAtZ );
float fRoll = pCameraMatrix.GetPropertyValue< float >( "Roll" );
float fFOV = pCameraMatrix.GetPropertyValue< float >( "FOV" );
float fRoll = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "Roll" );
float fFOV = CMonoObject::GetPropertyValue< float >( pCameraMatrix, "FOV" );
return CLuaFunctionDefinitions::SetCameraMatrix( RESOURCE->GetLua(), (void*)pPlayer, vecPosition, vecLookAt, fRoll, fFOV );
}
@ -891,11 +868,9 @@ bool CMonoFunctions::Player::FadeCamera( DWORD pPlayer, bool bFadeIn, float fFad
{
if( RESOURCE )
{
CMonoObject pColor( pColor );
unsigned char ucReed = pColor.GetPropertyValue< unsigned char >( "R" );
unsigned char ucGreen = pColor.GetPropertyValue< unsigned char >( "G" );
unsigned char ucBlue = pColor.GetPropertyValue< unsigned char >( "B" );
unsigned char ucReed = CMonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucGreen = CMonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucBlue = CMonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
return CLuaFunctionDefinitions::FadeCamera( RESOURCE->GetLua(), (void*)pPlayer, bFadeIn, fFadeTime, ucReed, ucGreen, ucBlue );
}

View File

@ -17,26 +17,9 @@ DWORD CMonoFunctions::RadarArea::Create( MonoObject* pPosition, MonoObject* pSiz
{
if( RESOURCE )
{
Vector2 vecPosition, vecSize;
CMonoObject pPosition( pPosition );
vecPosition.fX = pPosition.GetPropertyValue< float >( "X" );
vecPosition.fY = pPosition.GetPropertyValue< float >( "Y" );
CMonoObject pSize( pSize );
vecSize.fX = pSize.GetPropertyValue< float >( "X" );
vecSize.fY = pSize.GetPropertyValue< float >( "Y" );
CMonoObject pMonoColor( color );
SColor pColor;
pColor.R = pMonoColor.GetPropertyValue< unsigned char >( "R" );
pColor.G = pMonoColor.GetPropertyValue< unsigned char >( "G" );
pColor.B = pMonoColor.GetPropertyValue< unsigned char >( "B" );
pColor.A = pMonoColor.GetPropertyValue< unsigned char >( "A" );
Vector2 vecPosition( pPosition );
Vector2 vecSize( pSize );
SColor pColor = CMonoObject::GetColor( color );
return (DWORD)CLuaFunctionDefinitions::CreateRadarArea( RESOURCE->GetLua(), vecPosition, vecSize, pColor, (void*)pVisibleTo );
}
@ -54,12 +37,7 @@ MonoObject* CMonoFunctions::RadarArea::GetSize( DWORD pUserData )
if( CLuaFunctionDefinitions::GetRadarAreaSize( RESOURCE->GetLua(), (void*)pUserData, vecSize ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecSize );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecSize );
}
}
@ -74,12 +52,7 @@ MonoObject* CMonoFunctions::RadarArea::GetColor( DWORD pUserData )
if( CLuaFunctionDefinitions::GetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pObject = RESOURCE->NewObject( outColor );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( outColor );
}
}
@ -102,10 +75,8 @@ bool CMonoFunctions::RadarArea::IsInside( DWORD pUserData, MonoObject* pPosition
{
bool bInside;
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
Vector2 vecPosition( fX, fY );
@ -124,10 +95,8 @@ bool CMonoFunctions::RadarArea::SetSize( DWORD pUserData, MonoObject* pSize )
{
if( RESOURCE )
{
CMonoObject pSize( pSize );
float fX = pSize.GetPropertyValue< float >( "X" );
float fY = pSize.GetPropertyValue< float >( "Y" );
float fX = CMonoObject::GetPropertyValue< float >( pSize, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pSize, "Y" );
Vector2 vecPosition( fX, fY );
@ -141,14 +110,7 @@ bool CMonoFunctions::RadarArea::SetColor( DWORD pUserData, MonoObject* color )
{
if( RESOURCE )
{
SColor pColor;
CMonoObject pObject( color );
pColor.R = pObject.GetPropertyValue< unsigned char >( "R" );
pColor.G = pObject.GetPropertyValue< unsigned char >( "G" );
pColor.B = pObject.GetPropertyValue< unsigned char >( "B" );
pColor.A = pObject.GetPropertyValue< unsigned char >( "A" );
SColor pColor = CMonoObject::GetColor( color );
return CLuaFunctionDefinitions::SetRadarAreaColor( RESOURCE->GetLua(), (void*)pUserData, pColor );
}

View File

@ -17,7 +17,7 @@ DWORD CMonoFunctions::Shape::CreateCircle( MonoObject* pPosition, float fRadius
{
if( RESOURCE )
{
Vector2 vecPosition = CMonoObject( pPosition ).GetVector2();
Vector2 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreateColCircle( RESOURCE->GetLua(), vecPosition, fRadius );
}
@ -29,8 +29,8 @@ DWORD CMonoFunctions::Shape::CreateCuboid( MonoObject* pPosition, MonoObject* pS
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
Vector3 vecSize = CMonoObject( pSize ).GetVector3();
Vector3 vecPosition( pPosition );
Vector3 vecSize( pSize );
return (DWORD)CLuaFunctionDefinitions::CreateColCuboid( RESOURCE->GetLua(), vecPosition, vecSize );
}
@ -42,7 +42,7 @@ DWORD CMonoFunctions::Shape::CreateSphere( MonoObject* pPosition, float fRadius
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
Vector3 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreateColSphere( RESOURCE->GetLua(), vecPosition, fRadius );
}
@ -54,8 +54,8 @@ DWORD CMonoFunctions::Shape::CreateRectangle( MonoObject* pPosition, MonoObject*
{
if( RESOURCE )
{
Vector2 vecPosition = CMonoObject( pPosition ).GetVector2();
Vector2 vecSize = CMonoObject( pSize ).GetVector2();
Vector2 vecPosition( pPosition );
Vector2 vecSize( pSize );
return (DWORD)CLuaFunctionDefinitions::CreateColRectangle( RESOURCE->GetLua(), vecPosition, vecSize );
}
@ -75,9 +75,7 @@ DWORD CMonoFunctions::Shape::CreatePolygon( MonoArray* pPointList )
if( pObject )
{
Vector2 vecPosition = CMonoObject( pObject ).GetVector2();
vecPointList.push_back( vecPosition );
vecPointList.push_back( Vector2( pObject ) );
}
}
@ -91,7 +89,7 @@ DWORD CMonoFunctions::Shape::CreateTube( MonoObject* pPosition, float fRadius, f
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
Vector3 vecPosition( pPosition );
return (DWORD)CLuaFunctionDefinitions::CreateColTube( RESOURCE->GetLua(), vecPosition, fRadius, fHeight );
}

View File

@ -18,7 +18,7 @@ DWORD CMonoFunctions::Team::Create( MonoString* msTeamName, MonoObject* mColor )
if( RESOURCE )
{
const char* szTeamName = mono_string_to_utf8( msTeamName );
SColor pColor = CMonoObject( mColor ).GetColor();
SColor pColor = CMonoObject::GetColor( mColor );
return (DWORD)CLuaFunctionDefinitions::CreateTeam( RESOURCE->GetLua(), szTeamName, pColor.R, pColor.G, pColor.B );
}
@ -61,12 +61,7 @@ MonoObject* CMonoFunctions::Team::GetColor( DWORD pUserData )
if( CLuaFunctionDefinitions::GetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B ) )
{
CMonoObject* pObject = RESOURCE->NewObject( pColor );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( pColor );
}
}
@ -121,7 +116,7 @@ bool CMonoFunctions::Team::SetColor( DWORD pUserData, MonoObject* mColor )
{
if( RESOURCE )
{
SColor pColor = CMonoObject( mColor ).GetColor();
SColor pColor = CMonoObject::GetColor( mColor );
return CLuaFunctionDefinitions::SetTeamColor( RESOURCE->GetLua(), (void*)pUserData, pColor.R, pColor.G, pColor.B );
}

View File

@ -17,17 +17,13 @@ DWORD CMonoFunctions::Vehicle::Create( int model, MonoObject* position, MonoObje
{
if( RESOURCE )
{
CMonoObject pPosition( position );
float fX = CMonoObject::GetPropertyValue< float >( position, "X" );
float fY = CMonoObject::GetPropertyValue< float >( position, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( position, "Z" );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
CMonoObject pRotation( rotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "Y" );
float fRZ = pRotation.GetPropertyValue< float >( "Z" );
float fRX = CMonoObject::GetPropertyValue< float >( rotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( rotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( rotation, "Z" );
string sNumberplate = "";
@ -103,12 +99,7 @@ MonoObject* CMonoFunctions::Vehicle::GetColor( DWORD pUserData )
&pColor4
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "VehicleColor", args, 4 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto", "VehicleColor", args, 4 );
}
}
@ -247,12 +238,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurnVelocity( DWORD pUserData )
if( CLuaFunctionDefinitions::GetVehicleTurnVelocity( RESOURCE->GetLua(), (void*)pUserData, vecVelocity ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecVelocity );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecVelocity );
}
}
@ -267,12 +253,7 @@ MonoObject* CMonoFunctions::Vehicle::GetTurretPosition( DWORD pUserData )
if( CLuaFunctionDefinitions::GetVehicleTurretPosition( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecPosition );
}
}
@ -388,12 +369,7 @@ MonoObject* CMonoFunctions::Vehicle::GetWheelStates( DWORD pUserData )
&ucFrontLeft, &ucRearLeft, &ucFrontRight, &ucRearRight
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto.Vehicle", "VehicleWheelsState", args, 4 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto.Vehicle", "VehicleWheelsState", args, 4 );
}
}
@ -648,12 +624,7 @@ MonoObject* CMonoFunctions::Vehicle::GetHeadLightColor( DWORD pUserData )
if( CLuaFunctionDefinitions::GetVehicleHeadLightColor( RESOURCE->GetLua(), (void*)pUserData, outColor ) )
{
CMonoObject* pMonoObject = RESOURCE->NewObject( outColor );
if( pMonoObject )
{
return pMonoObject->GetObject();
}
return RESOURCE->NewObject( outColor );
}
}
@ -716,11 +687,9 @@ bool CMonoFunctions::Vehicle::SetTurnVelocity( DWORD pUserData, MonoObject* pVel
{
if( RESOURCE )
{
CMonoObject pVelocity( pVelocity );
float fX = pVelocity.GetPropertyValue< float >( "X" );
float fY = pVelocity.GetPropertyValue< float >( "Y" );
float fZ = pVelocity.GetPropertyValue< float >( "Z" );
float fX = CMonoObject::GetPropertyValue< float >( pVelocity, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pVelocity, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pVelocity, "Z" );
return CLuaFunctionDefinitions::SetVehicleTurnVelocity( RESOURCE->GetLua(), (void*)pUserData, fX, fY, fZ );
}
@ -732,29 +701,21 @@ bool CMonoFunctions::Vehicle::SetColor( DWORD pUserData, MonoObject* pColor1, Mo
{
if( RESOURCE )
{
CMonoObject pColor1( pColor1 );
unsigned char ucR1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "R" );
unsigned char ucG1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "G" );
unsigned char ucB1 = CMonoObject::GetPropertyValue< unsigned char >( pColor1, "B" );
unsigned char ucR1 = pColor1.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG1 = pColor1.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB1 = pColor1.GetPropertyValue< unsigned char >( "B" );
unsigned char ucR2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "R" );
unsigned char ucG2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "G" );
unsigned char ucB2 = CMonoObject::GetPropertyValue< unsigned char >( pColor2, "B" );
CMonoObject pColor2( pColor2 );
unsigned char ucR3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "R" );
unsigned char ucG3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "G" );
unsigned char ucB3 = CMonoObject::GetPropertyValue< unsigned char >( pColor3, "B" );
unsigned char ucR2 = pColor2.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG2 = pColor2.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB2 = pColor2.GetPropertyValue< unsigned char >( "B" );
CMonoObject pColor3( pColor3 );
unsigned char ucR3 = pColor3.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG3 = pColor3.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB3 = pColor3.GetPropertyValue< unsigned char >( "B" );
CMonoObject pColor4( pColor4 );
unsigned char ucR4 = pColor4.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG4 = pColor4.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB4 = pColor4.GetPropertyValue< unsigned char >( "B" );
unsigned char ucR4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "R" );
unsigned char ucG4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "G" );
unsigned char ucB4 = CMonoObject::GetPropertyValue< unsigned char >( pColor4, "B" );
return CLuaFunctionDefinitions::SetVehicleColor( RESOURCE->GetLua(), (void*)pUserData, ucR1, ucG1, ucB1, ucR2, ucG2, ucB2, ucR3, ucG3, ucB3, ucR4, ucG4, ucB4 );
}
@ -896,17 +857,13 @@ bool CMonoFunctions::Vehicle::SetRespawnPosition( DWORD pUserData, MonoObject* p
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "X" );
float fZ = pPosition.GetPropertyValue< float >( "X" );
CMonoObject pRotation( pRotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "X" );
float fRZ = pRotation.GetPropertyValue< float >( "X" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" );
return CLuaFunctionDefinitions::SetVehicleRespawnPosition( RESOURCE->GetLua(), (void*)pUserData, fX, fY, fZ, fRX, fRY, fRZ );
}
@ -948,17 +905,13 @@ bool CMonoFunctions::Vehicle::Spawn( DWORD pUserData, MonoObject* pPosition, Mon
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "X" );
float fZ = pPosition.GetPropertyValue< float >( "X" );
CMonoObject pRotation( pRotation );
float fRX = pRotation.GetPropertyValue< float >( "X" );
float fRY = pRotation.GetPropertyValue< float >( "X" );
float fRZ = pRotation.GetPropertyValue< float >( "X" );
float fRX = CMonoObject::GetPropertyValue< float >( pRotation, "X" );
float fRY = CMonoObject::GetPropertyValue< float >( pRotation, "Y" );
float fRZ = CMonoObject::GetPropertyValue< float >( pRotation, "Z" );
return CLuaFunctionDefinitions::SpawnVehicle( RESOURCE->GetLua(), (void*)pUserData, fX, fY, fZ, fRX, fRY, fRZ );
}
@ -1100,11 +1053,9 @@ bool CMonoFunctions::Vehicle::SetHeadLightColor( DWORD pUserData, MonoObject* pC
{
if( RESOURCE )
{
CMonoObject pColor1( pColor );
unsigned char ucR1 = pColor1.GetPropertyValue< unsigned char >( "R" );
unsigned char ucG1 = pColor1.GetPropertyValue< unsigned char >( "G" );
unsigned char ucB1 = pColor1.GetPropertyValue< unsigned char >( "B" );
unsigned char ucR1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "R" );
unsigned char ucG1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "G" );
unsigned char ucB1 = CMonoObject::GetPropertyValue< unsigned char >( pColor, "B" );
return CLuaFunctionDefinitions::SetVehicleHeadLightColor( RESOURCE->GetLua(), (void*)pUserData, ucR1, ucG1, ucB1 );
}
@ -1116,10 +1067,8 @@ bool CMonoFunctions::Vehicle::SetTurretPosition( DWORD pUserData, MonoObject* pP
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
return CLuaFunctionDefinitions::SetVehicleTurretPosition( RESOURCE->GetLua(), (void*)pUserData, fX, fY );
}
@ -1171,18 +1120,14 @@ bool CMonoFunctions::Vehicle::SetSirens( DWORD pUserData, unsigned char ucSirenI
{
if( RESOURCE )
{
CMonoObject pPosition( pPosition );
float fX = CMonoObject::GetPropertyValue< float >( pPosition, "X" );
float fY = CMonoObject::GetPropertyValue< float >( pPosition, "Y" );
float fZ = CMonoObject::GetPropertyValue< float >( pPosition, "Z" );
float fX = pPosition.GetPropertyValue< float >( "X" );
float fY = pPosition.GetPropertyValue< float >( "Y" );
float fZ = pPosition.GetPropertyValue< float >( "Z" );
CMonoObject pColor( pColor );
float fRed = pColor.GetPropertyValue< float >( "R" );
float fGreen = pColor.GetPropertyValue< float >( "G" );
float fBlue = pColor.GetPropertyValue< float >( "B" );
float fAlpha = pColor.GetPropertyValue< float >( "A" );
float fRed = CMonoObject::GetPropertyValue< float >( pColor, "R" );
float fGreen = CMonoObject::GetPropertyValue< float >( pColor, "G" );
float fBlue = CMonoObject::GetPropertyValue< float >( pColor, "B" );
float fAlpha = CMonoObject::GetPropertyValue< float >( pColor, "A" );
return CLuaFunctionDefinitions::SetVehicleSirens( RESOURCE->GetLua(), (void*)pUserData, ucSirenID, fX, fY, fZ, fRed, fGreen, fBlue, fAlpha, fMinAlpha );
}

View File

@ -17,12 +17,12 @@ DWORD CMonoFunctions::Water::Create( MonoObject* pV1, MonoObject* pV2, MonoObjec
{
if( RESOURCE )
{
Vector3* vec1 = &CMonoObject( pV1 ).GetVector3();
Vector3* vec2 = &CMonoObject( pV2 ).GetVector3();
Vector3* vec3 = &CMonoObject( pV3 ).GetVector3();
Vector3* vec4 = pV4 ? &CMonoObject( pV4 ).GetVector3() : NULL;
Vector3 vec1( pV1 );
Vector3 vec2( pV2 );
Vector3 vec3( pV3 );
Vector3 vec4 = pV4 ? Vector3( pV4 ) : NULL;
return (DWORD)CLuaFunctionDefinitions::CreateWater( RESOURCE->GetLua(), vec1, vec2, vec3, vec4, bShallow );
return (DWORD)CLuaFunctionDefinitions::CreateWater( RESOURCE->GetLua(), &vec1, &vec2, &vec3, &vec4, bShallow );
}
return NULL;
@ -76,9 +76,7 @@ MonoObject* CMonoFunctions::Water::GetVertexPosition( DWORD pUserData, int iVert
if( CLuaFunctionDefinitions::GetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecPosition );
return pObject ? pObject->GetObject() : NULL;
return RESOURCE->NewObject( vecPosition );
}
}
@ -89,7 +87,7 @@ bool CMonoFunctions::Water::SetVertexPosition( DWORD pUserData, int iVertexIndex
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( mPosition ).GetVector3();
Vector3 vecPosition( mPosition );
return CLuaFunctionDefinitions::SetWaterVertexPosition( RESOURCE->GetLua(), (void*)pUserData, iVertexIndex, vecPosition );
}
@ -105,9 +103,7 @@ MonoObject* CMonoFunctions::Water::GetColor( void )
if( CLuaFunctionDefinitions::GetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A ) )
{
CMonoObject* pObject = RESOURCE->NewObject( pColor );
return pObject ? pObject->GetObject() : NULL;
return RESOURCE->NewObject( pColor );
}
}
@ -118,7 +114,7 @@ bool CMonoFunctions::Water::SetColor( MonoObject* mColor )
{
if( RESOURCE )
{
SColor pColor = CMonoObject( mColor ).GetColor();
SColor pColor = CMonoObject::GetColor( mColor );
return CLuaFunctionDefinitions::SetWaterColor( RESOURCE->GetLua(), pColor.R, pColor.G, pColor.B, pColor.A );
}

View File

@ -59,7 +59,7 @@ MonoString* CMonoFunctions::World::GetZoneName( MonoObject* mPosition, bool bCit
{
string strOutName;
Vector3 vecPosition = CMonoObject( mPosition ).GetVector3();
Vector3 vecPosition( mPosition );
if( CLuaFunctionDefinitions::GetZoneName( RESOURCE->GetLua(), vecPosition, strOutName, bCitiesOnly ) )
{
@ -275,15 +275,15 @@ MonoArray* CMonoFunctions::World::GetSunColor( void )
{
pCore.A = pCorona.A = 255;
CMonoObject* pCoreObject = RESOURCE->NewObject( pCore );
CMonoObject* pCoronaObject = RESOURCE->NewObject( pCorona );
MonoObject* pCoreObject = RESOURCE->NewObject( pCore );
MonoObject* pCoronaObject = RESOURCE->NewObject( pCorona );
if( pCoreObject && pCoronaObject )
{
MonoArray* pMonoArray = mono_array_new( RESOURCE->m_pMonoDomain, pCoreObject->GetClass()->GetClass(), 2 );
MonoArray* pMonoArray = mono_array_new( RESOURCE->m_pMonoDomain, CMonoObject::GetClass( pCoreObject ), 2 );
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject->GetObject() );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject->GetObject() );
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject );
return pMonoArray;
}
@ -301,12 +301,7 @@ MonoObject* CMonoFunctions::World::GetWindVelocity( void )
if( CLuaFunctionDefinitions::GetWindVelocity( RESOURCE->GetLua(), vecVelocity.fX, vecVelocity.fY, vecVelocity.fZ ) )
{
CMonoObject* pObject = RESOURCE->NewObject( vecVelocity );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( vecVelocity );
}
}
@ -398,15 +393,15 @@ MonoArray* CMonoFunctions::World::GetSkyGradient( void )
{
pCore.A = pCorona.A = 255;
CMonoObject* pCoreObject = RESOURCE->NewObject( pCore );
CMonoObject* pCoronaObject = RESOURCE->NewObject( pCorona );
MonoObject* pCoreObject = RESOURCE->NewObject( pCore );
MonoObject* pCoronaObject = RESOURCE->NewObject( pCorona );
if( pCoreObject && pCoronaObject )
{
MonoArray* pMonoArray = mono_array_new( RESOURCE->m_pMonoDomain, pCoreObject->GetClass()->GetClass(), 2 );
MonoArray* pMonoArray = mono_array_new( RESOURCE->m_pMonoDomain, CMonoObject::GetClass( pCoreObject ), 2 );
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject->GetObject() );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject->GetObject() );
mono_array_set( pMonoArray, MonoObject*, 0, pCoreObject );
mono_array_set( pMonoArray, MonoObject*, 1, pCoronaObject );
return pMonoArray;
}
@ -429,12 +424,7 @@ MonoObject* CMonoFunctions::World::GetHeatHaze( void )
&heatHazeSettings
};
CMonoObject* pObject = RESOURCE->NewObject( "MultiTheftAuto", "HeatHazeSettings", args, 1 );
if( pObject )
{
return pObject->GetObject();
}
return RESOURCE->NewObject( "MultiTheftAuto", "HeatHazeSettings", args, 1 );
}
}
@ -527,8 +517,8 @@ bool CMonoFunctions::World::SetSkyGradient( MonoObject* pTopColor, MonoObject* p
{
if( RESOURCE )
{
SColor pTop = CMonoObject( pTopColor ).GetColor();
SColor pBottom = CMonoObject( pBottomColor ).GetColor();
SColor pTop = CMonoObject::GetColor( pTopColor );
SColor pBottom = CMonoObject::GetColor( pBottomColor );
return CLuaFunctionDefinitions::SetSkyGradient( RESOURCE->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B );
}
@ -550,19 +540,17 @@ bool CMonoFunctions::World::SetHeatHaze( MonoObject* heatHazeSettings )
{
if( RESOURCE )
{
CMonoObject* pObject = new CMonoObject( heatHazeSettings );
SHeatHazeSettings pHeatHazeSettings;
pHeatHazeSettings.ucIntensity = pObject->GetPropertyValue< unsigned char >( "ucIntensity" );
pHeatHazeSettings.ucRandomShift = pObject->GetPropertyValue< unsigned char >( "ucRandomShift" );
pHeatHazeSettings.usSpeedMin = pObject->GetPropertyValue< unsigned short >( "usSpeedMin" );
pHeatHazeSettings.usSpeedMax = pObject->GetPropertyValue< unsigned short >( "usSpeedMax" );
pHeatHazeSettings.sScanSizeX = pObject->GetPropertyValue< short >( "sScanSizeX" );
pHeatHazeSettings.sScanSizeY = pObject->GetPropertyValue< short >( "sScanSizeY" );
pHeatHazeSettings.usRenderSizeX = pObject->GetPropertyValue< unsigned short >( "usRenderSizeX" );
pHeatHazeSettings.usRenderSizeY = pObject->GetPropertyValue< unsigned short >( "usRenderSizeY" );
pHeatHazeSettings.bInsideBuilding = pObject->GetPropertyValue< bool >( "bInsideBuilding" );
pHeatHazeSettings.ucIntensity = CMonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucIntensity" );
pHeatHazeSettings.ucRandomShift = CMonoObject::GetPropertyValue< unsigned char >( heatHazeSettings, "ucRandomShift" );
pHeatHazeSettings.usSpeedMin = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMin" );
pHeatHazeSettings.usSpeedMax = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usSpeedMax" );
pHeatHazeSettings.sScanSizeX = CMonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeX" );
pHeatHazeSettings.sScanSizeY = CMonoObject::GetPropertyValue< short >( heatHazeSettings, "sScanSizeY" );
pHeatHazeSettings.usRenderSizeX = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeX" );
pHeatHazeSettings.usRenderSizeY = CMonoObject::GetPropertyValue< unsigned short >( heatHazeSettings, "usRenderSizeY" );
pHeatHazeSettings.bInsideBuilding = CMonoObject::GetPropertyValue< bool >( heatHazeSettings, "bInsideBuilding" );
return CLuaFunctionDefinitions::SetHeatHaze( RESOURCE->GetLua(), pHeatHazeSettings );
}
@ -718,8 +706,8 @@ bool CMonoFunctions::World::SetSunColor( MonoObject* pCoreColor, MonoObject* pCo
{
if( RESOURCE )
{
SColor pTop = CMonoObject( pCoreColor ).GetColor();
SColor pBottom = CMonoObject( pCoronaColor ).GetColor();
SColor pTop = CMonoObject::GetColor( pCoreColor );
SColor pBottom = CMonoObject::GetColor( pCoronaColor );
return CLuaFunctionDefinitions::SetSunColor( RESOURCE->GetLua(), pTop.R, pTop.G, pTop.B, pBottom.R, pBottom.G, pBottom.B );
}
@ -731,7 +719,7 @@ bool CMonoFunctions::World::SetWindVelocity( MonoObject* pVelocity )
{
if( RESOURCE )
{
Vector3 vecVelocity = CMonoObject( pVelocity ).GetVector3();
Vector3 vecVelocity( pVelocity );
return CLuaFunctionDefinitions::SetWindVelocity( RESOURCE->GetLua(), vecVelocity.fX, vecVelocity.fY, vecVelocity.fZ );
}
@ -853,7 +841,7 @@ bool CMonoFunctions::World::RemoveWorldModel( unsigned short usModel, float fRad
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
Vector3 vecPosition( pPosition );
return CLuaFunctionDefinitions::RemoveWorldModel( RESOURCE->GetLua(), usModel, fRadius, vecPosition, cInterior );
}
@ -865,7 +853,7 @@ bool CMonoFunctions::World::RestoreWorldModel( unsigned short usModel, float fRa
{
if( RESOURCE )
{
Vector3 vecPosition = CMonoObject( pPosition ).GetVector3();
Vector3 vecPosition( pPosition );
return CLuaFunctionDefinitions::RestoreWorldModel( RESOURCE->GetLua(), usModel, fRadius, vecPosition, cInterior );
}

View File

@ -127,7 +127,7 @@ bool CResource::RegisterFunction( const char *szFunctionName, lua_CFunction Func
return true;
}
CMonoClass* CResource::GetClassFromName( const char* szNamespace, const char* szName )
MonoClass* CResource::GetClassFromName( const char* szNamespace, const char* szName )
{
MonoClass* pMonoClass = mono_class_from_name( this->m_pMonoImage, szNamespace, szName );
@ -136,21 +136,16 @@ CMonoClass* CResource::GetClassFromName( const char* szNamespace, const char* sz
pMonoClass = mono_class_from_name( this->m_pMonoImageLib, szNamespace, szName );
}
if( pMonoClass )
{
return new CMonoClass( pMonoClass );
}
return NULL;
return pMonoClass;
}
CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName )
MonoObject* CResource::NewObject( const char* szNamespace, const char* szName )
{
CMonoClass* pClass = this->GetClassFromName( szNamespace, szName );
MonoClass* pClass = this->GetClassFromName( szNamespace, szName );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get() );
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get() );
if( pObject )
{
@ -166,16 +161,41 @@ CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName )
g_pModuleManager->ErrorPrintf( "%s:%d: class '%s::%s' not found\n", __FILE__, __LINE__, szNamespace, szName );
}
return NULL;
return nullptr;
}
CMonoObject* CResource::NewObject( SColor& pColor )
MonoObject* CResource::NewObject( SColor& pColor )
{
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Color" );
MonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Color" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), pColor );
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), pColor );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Color'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Color' not found\n", __FILE__, __LINE__ );
}
return nullptr;
}
MonoObject* CResource::NewObject( Vector2& vecVector )
{
MonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector2" );
if( pClass )
{
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), vecVector );
if( pObject )
{
@ -191,41 +211,16 @@ CMonoObject* CResource::NewObject( SColor& pColor )
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector2' not found\n", __FILE__, __LINE__ );
}
return NULL;
return nullptr;
}
CMonoObject* CResource::NewObject( Vector2& vecVector )
MonoObject* CResource::NewObject( Vector3& vecVector )
{
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector2" );
MonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector3" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), vecVector );
if( pObject )
{
return pObject;
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector2'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector2' not found\n", __FILE__, __LINE__ );
}
return NULL;
}
CMonoObject* CResource::NewObject( Vector3& vecVector )
{
CMonoClass* pClass = this->GetClassFromName( "MultiTheftAuto", "Vector3" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), vecVector );
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), vecVector );
if( pObject )
{
@ -241,16 +236,16 @@ CMonoObject* CResource::NewObject( Vector3& vecVector )
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector3' not found\n", __FILE__, __LINE__ );
}
return NULL;
return nullptr;
}
CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName, void** args, int argc )
MonoObject* CResource::NewObject( const char* szNamespace, const char* szName, void** args, int argc )
{
CMonoClass* pClass = this->GetClassFromName( szNamespace, szName );
MonoClass* pClass = this->GetClassFromName( szNamespace, szName );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), args, argc );
MonoObject* pObject = CMonoClass::New( pClass, mono_domain_get(), args, argc );
if( pObject )
{
@ -266,5 +261,5 @@ CMonoObject* CResource::NewObject( const char* szNamespace, const char* szName,
g_pModuleManager->ErrorPrintf( "%s:%d: class '%s::%s' not found\n", __FILE__, __LINE__, szNamespace, szName );
}
return NULL;
return nullptr;
}

View File

@ -43,13 +43,13 @@ public:
void DoPulse ( void );
bool RegisterFunction ( const char *szFunctionName, lua_CFunction Func );
CMonoClass* GetClassFromName( const char* szNamespace, const char* szName );
MonoClass* GetClassFromName( const char* szNamespace, const char* szName );
CMonoObject* NewObject( const char* szNamespace, const char* szName );
CMonoObject* NewObject( SColor& pColor );
CMonoObject* NewObject( Vector2& vecVector );
CMonoObject* NewObject( Vector3& vecVector );
CMonoObject* NewObject( const char* szNamespace, const char* szName, void** args, int argc );
MonoObject* NewObject( const char* szNamespace, const char* szName );
MonoObject* NewObject( SColor& pColor );
MonoObject* NewObject( Vector2& vecVector );
MonoObject* NewObject( Vector3& vecVector );
MonoObject* NewObject( const char* szNamespace, const char* szName, void** args, int argc );
MonoString* NewString( const char* szText )
{