Обратная совместимость

This commit is contained in:
Dmitry Korolev 2014-10-18 00:40:03 +04:00
parent 7276f74774
commit e869ba8fbc
10 changed files with 1075 additions and 480 deletions

View File

@ -14,6 +14,7 @@
<ClCompile Include="src\CMonoClass.cpp" />
<ClCompile Include="src\CMonoFunctions.cpp" />
<ClCompile Include="src\CMonoObject.cpp" />
<ClCompile Include="src\Common.cpp" />
<ClCompile Include="src\CResource.cpp" />
<ClCompile Include="src\mta-mono.cpp" />
<ClCompile Include="src\CFunctions.cpp" />

View File

@ -26,6 +26,13 @@ CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain )
return new CMonoObject( pObject );
}
CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain, Vector3& vecVector )
{
void *args[] = { &vecVector.fX, &vecVector.fY, &vecVector.fZ };
return this->New( mono_domain_get(), args, 3 );
}
CMonoObject* CMonoClass::New( MonoDomain* pMonoDomain, void** args, int argc )
{
MonoObject* pObject = mono_object_new( pMonoDomain, this->m_pMonoClass );

View File

@ -18,6 +18,7 @@ public:
~CMonoClass();
CMonoObject* New( MonoDomain* pMonoDomain );
CMonoObject* New( MonoDomain* pMonoDomain, Vector3& vecVector );
CMonoObject* New( MonoDomain* pMonoDomain, void** args, int argc );
const char* GetName();

View File

@ -30,6 +30,20 @@ void CMonoFunctions::AddInternals( void )
mono_add_internal_call( "MultiTheftAuto.Native.Config::Get", CMonoFunctions::Config::Get );
mono_add_internal_call( "MultiTheftAuto.Native.Config::Set", CMonoFunctions::Config::Set );
// Element create/destroy
mono_add_internal_call( "MultiTheftAuto.Native.Element::Create", CMonoFunctions::Element::Create );
mono_add_internal_call( "MultiTheftAuto.Native.Element::Destroy", CMonoFunctions::Element::Destroy );
mono_add_internal_call( "MultiTheftAuto.Native.Element::Clone", CMonoFunctions::Element::Clone );
// Element get funcs
mono_add_internal_call( "MultiTheftAuto.Native.Element::IsElement", CMonoFunctions::Element::IsElement );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetType", CMonoFunctions::Element::GetType );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetByID", CMonoFunctions::Element::GetByID );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetByIndex", CMonoFunctions::Element::GetByIndex );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetChild", CMonoFunctions::Element::GetChild );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetChildrenCount", CMonoFunctions::Element::GetChildrenCount );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetID", CMonoFunctions::Element::GetID );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetParent", CMonoFunctions::Element::GetParent );
mono_add_internal_call( "MultiTheftAuto.Native.Element::GetPosition", CMonoFunctions::Element::GetPosition );
mono_add_internal_call( "MultiTheftAuto.Native.Vehicle::Create", CMonoFunctions::Vehicle::Create );
@ -86,21 +100,148 @@ bool CMonoFunctions::Config::Set( MonoString *msKey, MonoString *msValue )
return false;
}
MonoObject* CMonoFunctions::Element::GetPosition( unsigned int element )
// Element create/destroy
unsigned int CMonoFunctions::Element::Create( MonoString* msTypeName, MonoString* msID )
{
if( RESOURCE )
{
const char* szTypeName = mono_string_to_utf8( msTypeName );
const char* szID = mono_string_to_utf8( msID );
return (unsigned int)CLuaFunctionDefinitions::CreateElement( RESOURCE->GetLua(), szTypeName, szID );
}
return NULL;
}
bool CMonoFunctions::Element::Destroy( unsigned int pElement )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::DestroyElement( RESOURCE->GetLua(), (void*)pElement );
}
return false;
}
unsigned int CMonoFunctions::Element::Clone( unsigned int pUserData, MonoObject* vecPosition, bool bCloneElement )
{
if( RESOURCE )
{
CMonoObject pPosition( vecPosition );
float fX = pPosition.GetPropertyValue<float>( "X" );
float fY = pPosition.GetPropertyValue<float>( "Y" );
float fZ = pPosition.GetPropertyValue<float>( "Z" );
return (unsigned int)CLuaFunctionDefinitions::CloneElement( RESOURCE->GetLua(), (void*)pUserData, Vector3( fX, fY, fZ ), bCloneElement );
}
return false;
}
// Element get funcs
bool CMonoFunctions::Element::IsElement( unsigned int pUserData )
{
if( RESOURCE )
{
return (unsigned int)CLuaFunctionDefinitions::IsElement( RESOURCE->GetLua(), (void*)pUserData );
}
return false;
}
MonoString* CMonoFunctions::Element::GetType( unsigned int pUserData )
{
if( RESOURCE )
{
const string strType = CLuaFunctionDefinitions::GetElementType( RESOURCE->GetLua(), (void*)pUserData );
return mono_string_new( mono_domain_get(), strType.c_str() );
}
return mono_string_new( mono_domain_get(), "" );
}
unsigned int CMonoFunctions::Element::GetByID( MonoString* msID, unsigned int uiIndex )
{
if( RESOURCE )
{
const char* szID = mono_string_to_utf8( msID );
return (unsigned int)CLuaFunctionDefinitions::GetElementByID( RESOURCE->GetLua(), szID, uiIndex );
}
return NULL;
}
unsigned int CMonoFunctions::Element::GetByIndex( int iIndex )
{
if( RESOURCE )
{
return (unsigned int)CLuaFunctionDefinitions::GetElementByIndex( RESOURCE->GetLua(), iIndex );
}
return NULL;
}
unsigned int CMonoFunctions::Element::GetChild( unsigned int pUserData, int iIndex )
{
if( RESOURCE )
{
return (unsigned int)CLuaFunctionDefinitions::GetElementChild( RESOURCE->GetLua(), (void*)pUserData, iIndex );
}
return NULL;
}
int CMonoFunctions::Element::GetChildrenCount( unsigned int pUserData )
{
if( RESOURCE )
{
return CLuaFunctionDefinitions::GetElementChildrenCount( RESOURCE->GetLua(), (void*)pUserData );
}
return 0;
}
MonoString* CMonoFunctions::Element::GetID( unsigned int pUserData )
{
if( RESOURCE )
{
const string strID = CLuaFunctionDefinitions::GetElementID( RESOURCE->GetLua(), (void*)pUserData );
return mono_string_new( mono_domain_get(), strID.c_str() );
}
return mono_string_new( mono_domain_get(), "" );
}
unsigned int CMonoFunctions::Element::GetParent( unsigned int pUserData )
{
if( RESOURCE )
{
return (unsigned int)CLuaFunctionDefinitions::GetElementParent( RESOURCE->GetLua(), (void*)pUserData );
}
return NULL;
}
MonoObject* CMonoFunctions::Element::GetPosition( unsigned int pUserData )
{
if( RESOURCE )
{
Vector3 vecPosition;
if( CLuaFunctionDefinitions::GetElementPosition( RESOURCE->GetLua(), (void*)element, vecPosition ) )
if( CLuaFunctionDefinitions::GetElementPosition( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoClass* pClass = RESOURCE->GetClassFromName( "MultiTheftAuto", "Vector3" );
if( pClass )
{
void *args[] = { &vecPosition.fX, &vecPosition.fY, &vecPosition.fZ };
CMonoObject* pObject = pClass->New( mono_domain_get(), args, 3 );
CMonoObject* pObject = pClass->New( mono_domain_get(), vecPosition );
if( pObject )
{
@ -121,6 +262,73 @@ MonoObject* CMonoFunctions::Element::GetPosition( unsigned int element )
return NULL;
}
MonoObject* CMonoFunctions::Element::GetRotation( unsigned int pUserData )
{
if( RESOURCE )
{
Vector3 vecPosition;
if( CLuaFunctionDefinitions::GetElementRotation( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoClass* pClass = RESOURCE->GetClassFromName( "MultiTheftAuto", "Vector3" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), vecPosition );
if( pObject )
{
return pObject->GetObject();
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector3'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector3' not found\n", __FILE__, __LINE__ );
}
}
}
return NULL;
}
MonoObject* CMonoFunctions::Element::GetVelocity( unsigned int pUserData )
{
if( RESOURCE )
{
Vector3 vecPosition;
if( CLuaFunctionDefinitions::GetElementVelocity( RESOURCE->GetLua(), (void*)pUserData, vecPosition ) )
{
CMonoClass* pClass = RESOURCE->GetClassFromName( "MultiTheftAuto", "Vector3" );
if( pClass )
{
CMonoObject* pObject = pClass->New( mono_domain_get(), vecPosition );
if( pObject )
{
return pObject->GetObject();
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: failed to create instance of 'MultiTheftAuto::Vector3'\n", __FILE__, __LINE__ );
}
}
else
{
g_pModuleManager->ErrorPrintf( "%s:%d: class 'MultiTheftAuto::Vector3' not found\n", __FILE__, __LINE__ );
}
}
}
return NULL;
}
unsigned int CMonoFunctions::Vehicle::Create( int model, MonoObject* position, MonoObject* rotation, MonoString* numberplate, bool direction, int variant1, int variant2 )
{
if( RESOURCE )
@ -155,3 +363,4 @@ unsigned int CMonoFunctions::Vehicle::Create( int model, MonoObject* position, M
return NULL;
}

View File

@ -41,7 +41,25 @@ public:
class Element
{
public:
static MonoObject* GetPosition ( unsigned int element );
// Element create/destroy
static unsigned int Create ( MonoString* msTypeName, MonoString* msID );
static bool Destroy ( unsigned int pUserData );
static unsigned int Clone ( unsigned int pUserData, MonoObject* vecPosition, bool bCloneElement );
// Element get funcs
static bool IsElement ( unsigned int pUserData );
static MonoString* GetType ( unsigned int pUserData );
static unsigned int GetByID ( MonoString* msID, unsigned int uiIndex );
static unsigned int GetByIndex ( int iIndex );
static unsigned int GetChild ( unsigned int pUserData, int iIndex );
static int GetChildrenCount ( unsigned int pUserData );
static MonoString* GetID ( unsigned int pUserData );
// static MonoObject* GetData ( unsigned int pUserData, MonoString* sKey, bool bInherit = true );
// static ?* GetAllData ( unsigned int pUserData );
static unsigned int GetParent ( unsigned int pUserData );
static MonoObject* GetPosition ( unsigned int pUserData );
static MonoObject* GetRotation ( unsigned int pUserData );
static MonoObject* GetVelocity ( unsigned int pUserData );
};
class Vehicle

202
mta-mono/src/Common.cpp Normal file
View File

@ -0,0 +1,202 @@
#include "Common.h"
CVehicleColor::CVehicleColor ( void )
{
// Init
m_ucPaletteColors[0] = 0; // Palette color 0 is black
m_ucPaletteColors[1] = 0;
m_ucPaletteColors[2] = 0;
m_ucPaletteColors[3] = 0;
m_RGBColors[0] = 0;
m_RGBColors[1] = 0;
m_RGBColors[2] = 0;
m_RGBColors[3] = 0;
m_bPaletteColorsWrong = false;
m_bRGBColorsWrong = false;
}
// Use black for colours that are not used (bandwidth saving)
void CVehicleColor::SetRGBColors ( SColor color1, SColor color2, SColor color3, SColor color4 )
{
if (
m_RGBColors[0] != color1 ||
m_RGBColors[1] != color2 ||
m_RGBColors[2] != color3 ||
m_RGBColors[3] != color4
)
{
m_RGBColors[0] = color1;
m_RGBColors[1] = color2;
m_RGBColors[2] = color3;
m_RGBColors[3] = color4;
InvalidatePaletteColors ();
}
}
void CVehicleColor::SetPaletteColors ( unsigned char ucColor1, unsigned char ucColor2, unsigned char ucColor3, unsigned char ucColor4 )
{
if ( m_ucPaletteColors[0] != ucColor1 ||
m_ucPaletteColors[1] != ucColor2 ||
m_ucPaletteColors[2] != ucColor3 ||
m_ucPaletteColors[3] != ucColor4 )
{
m_ucPaletteColors[0] = ucColor1;
m_ucPaletteColors[1] = ucColor2;
m_ucPaletteColors[2] = ucColor3;
m_ucPaletteColors[3] = ucColor4;
InvalidateRGBColors ();
}
}
void CVehicleColor::SetRGBColor ( uint uiSlot, SColor color )
{
ValidateRGBColors ();
uiSlot = Min ( uiSlot, static_cast < uint > ( NUMELMS( m_RGBColors ) ) );
if ( m_RGBColors [ uiSlot ] != color )
{
m_RGBColors [ uiSlot ] = color;
InvalidatePaletteColors ();
}
}
void CVehicleColor::SetPaletteColor ( uint uiSlot, uchar ucColor )
{
ValidatePaletteColors ();
uiSlot = Min ( uiSlot, static_cast < uint > ( NUMELMS( m_ucPaletteColors ) ) );
if ( m_ucPaletteColors [ uiSlot ] != ucColor )
{
m_ucPaletteColors [ uiSlot ] = ucColor;
InvalidateRGBColors ();
}
}
// Get a slot colour as a palette index
uchar CVehicleColor::GetPaletteColor ( uint uiSlot )
{
ValidatePaletteColors ();
uiSlot = Min ( uiSlot, static_cast < uint > ( NUMELMS( m_ucPaletteColors ) ) );
return m_ucPaletteColors [ uiSlot ];
}
// Get a slot colour as an RGB colour
SColor CVehicleColor::GetRGBColor ( uint uiSlot )
{
ValidateRGBColors ();
uiSlot = Min ( uiSlot, static_cast < uint > ( NUMELMS( m_RGBColors ) ) );
return m_RGBColors [ uiSlot ];
}
// Can return: 1,2,3, or 4
int CVehicleColor::GetNumColorsUsed ( void )
{
// Find last unblack
int i;
for ( i = NUMELMS( m_RGBColors ) ; i > 1 ; i-- )
{
if ( GetRGBColor ( i - 1 ) )
break;
}
assert ( i >= 1 && i <= 4 );
return i;
}
// Switching to RGB mode
void CVehicleColor::InvalidatePaletteColors ( void )
{
m_bRGBColorsWrong = false;
m_bPaletteColorsWrong = true;
}
// Switching to palette mode
void CVehicleColor::InvalidateRGBColors ( void )
{
m_bPaletteColorsWrong = false;
m_bRGBColorsWrong = true;
}
// Ensure switched
void CVehicleColor::ValidateRGBColors ( void )
{
if ( m_bRGBColorsWrong )
{
m_bRGBColorsWrong = false;
for ( uint i = 0 ; i < NUMELMS( m_RGBColors ) ; i++ )
m_RGBColors[i] = GetRGBFromPaletteIndex ( m_ucPaletteColors[i] );
}
}
// Ensure switched
void CVehicleColor::ValidatePaletteColors ( void )
{
if ( m_bPaletteColorsWrong )
{
m_bPaletteColorsWrong = false;
for ( uint i = 0 ; i < NUMELMS( m_ucPaletteColors ) ; i++ )
m_ucPaletteColors[i] = GetPaletteIndexFromRGB ( m_RGBColors[i] );
}
}
static const uchar paletteColorTable8[] = {
0x00, 0x00, 0x00, 0xff, 0xf5, 0xf5, 0xf5, 0xff, 0x2a, 0x77, 0xa1, 0xff, 0x84, 0x04, 0x10, 0xff,
0x26, 0x37, 0x39, 0xff, 0x86, 0x44, 0x6e, 0xff, 0xd7, 0x8e, 0x10, 0xff, 0x4c, 0x75, 0xb7, 0xff,
0xbd, 0xbe, 0xc6, 0xff, 0x5e, 0x70, 0x72, 0xff, 0x46, 0x59, 0x7a, 0xff, 0x65, 0x6a, 0x79, 0xff,
0x5d, 0x7e, 0x8d, 0xff, 0x58, 0x59, 0x5a, 0xff, 0xd6, 0xda, 0xd6, 0xff, 0x9c, 0xa1, 0xa3, 0xff,
0x33, 0x5f, 0x3f, 0xff, 0x73, 0x0e, 0x1a, 0xff, 0x7b, 0x0a, 0x2a, 0xff, 0x9f, 0x9d, 0x94, 0xff,
0x3b, 0x4e, 0x78, 0xff, 0x73, 0x2e, 0x3e, 0xff, 0x69, 0x1e, 0x3b, 0xff, 0x96, 0x91, 0x8c, 0xff,
0x51, 0x54, 0x59, 0xff, 0x3f, 0x3e, 0x45, 0xff, 0xa5, 0xa9, 0xa7, 0xff, 0x63, 0x5c, 0x5a, 0xff,
0x3d, 0x4a, 0x68, 0xff, 0x97, 0x95, 0x92, 0xff, 0x42, 0x1f, 0x21, 0xff, 0x5f, 0x27, 0x2b, 0xff,
0x84, 0x94, 0xab, 0xff, 0x76, 0x7b, 0x7c, 0xff, 0x64, 0x64, 0x64, 0xff, 0x5a, 0x57, 0x52, 0xff,
0x25, 0x25, 0x27, 0xff, 0x2d, 0x3a, 0x35, 0xff, 0x93, 0xa3, 0x96, 0xff, 0x6d, 0x7a, 0x88, 0xff,
0x22, 0x19, 0x18, 0xff, 0x6f, 0x67, 0x5f, 0xff, 0x7c, 0x1c, 0x2a, 0xff, 0x5f, 0x0a, 0x15, 0xff,
0x19, 0x38, 0x26, 0xff, 0x5d, 0x1b, 0x20, 0xff, 0x9d, 0x98, 0x72, 0xff, 0x7a, 0x75, 0x60, 0xff,
0x98, 0x95, 0x86, 0xff, 0xad, 0xb0, 0xb0, 0xff, 0x84, 0x89, 0x88, 0xff, 0x30, 0x4f, 0x45, 0xff,
0x4d, 0x62, 0x68, 0xff, 0x16, 0x22, 0x48, 0xff, 0x27, 0x2f, 0x4b, 0xff, 0x7d, 0x62, 0x56, 0xff,
0x9e, 0xa4, 0xab, 0xff, 0x9c, 0x8d, 0x71, 0xff, 0x6d, 0x18, 0x22, 0xff, 0x4e, 0x68, 0x81, 0xff,
0x9c, 0x9c, 0x98, 0xff, 0x91, 0x73, 0x47, 0xff, 0x66, 0x1c, 0x26, 0xff, 0x94, 0x9d, 0x9f, 0xff,
0xa4, 0xa7, 0xa5, 0xff, 0x8e, 0x8c, 0x46, 0xff, 0x34, 0x1a, 0x1e, 0xff, 0x6a, 0x7a, 0x8c, 0xff,
0xaa, 0xad, 0x8e, 0xff, 0xab, 0x98, 0x8f, 0xff, 0x85, 0x1f, 0x2e, 0xff, 0x6f, 0x82, 0x97, 0xff,
0x58, 0x58, 0x53, 0xff, 0x9a, 0xa7, 0x90, 0xff, 0x60, 0x1a, 0x23, 0xff, 0x20, 0x20, 0x2c, 0xff,
0xa4, 0xa0, 0x96, 0xff, 0xaa, 0x9d, 0x84, 0xff, 0x78, 0x22, 0x2b, 0xff, 0x0e, 0x31, 0x6d, 0xff,
0x72, 0x2a, 0x3f, 0xff, 0x7b, 0x71, 0x5e, 0xff, 0x74, 0x1d, 0x28, 0xff, 0x1e, 0x2e, 0x32, 0xff,
0x4d, 0x32, 0x2f, 0xff, 0x7c, 0x1b, 0x44, 0xff, 0x2e, 0x5b, 0x20, 0xff, 0x39, 0x5a, 0x83, 0xff,
0x6d, 0x28, 0x37, 0xff, 0xa7, 0xa2, 0x8f, 0xff, 0xaf, 0xb1, 0xb1, 0xff, 0x36, 0x41, 0x55, 0xff,
0x6d, 0x6c, 0x6e, 0xff, 0x0f, 0x6a, 0x89, 0xff, 0x20, 0x4b, 0x6b, 0xff, 0x2b, 0x3e, 0x57, 0xff,
0x9b, 0x9f, 0x9d, 0xff, 0x6c, 0x84, 0x95, 0xff, 0x4d, 0x84, 0x95, 0xff, 0xae, 0x9b, 0x7f, 0xff,
0x40, 0x6c, 0x8f, 0xff, 0x1f, 0x25, 0x3b, 0xff, 0xab, 0x92, 0x76, 0xff, 0x13, 0x45, 0x73, 0xff,
0x96, 0x81, 0x6c, 0xff, 0x64, 0x68, 0x6a, 0xff, 0x10, 0x50, 0x82, 0xff, 0xa1, 0x99, 0x83, 0xff,
0x38, 0x56, 0x94, 0xff, 0x52, 0x56, 0x61, 0xff, 0x7f, 0x69, 0x56, 0xff, 0x8c, 0x92, 0x9a, 0xff,
0x59, 0x6e, 0x87, 0xff, 0x47, 0x35, 0x32, 0xff, 0x44, 0x62, 0x4f, 0xff, 0x73, 0x0a, 0x27, 0xff,
0x22, 0x34, 0x57, 0xff, 0x64, 0x0d, 0x1b, 0xff, 0xa3, 0xad, 0xc6, 0xff, 0x69, 0x58, 0x53, 0xff,
0x9b, 0x8b, 0x80, 0xff, 0x62, 0x0b, 0x1c, 0xff, 0x5b, 0x5d, 0x5e, 0xff, 0x62, 0x44, 0x28, 0xff,
0x73, 0x18, 0x27, 0xff, 0x1b, 0x37, 0x6d, 0xff, 0xec, 0x6a, 0xae, 0xff,
};
uchar CVehicleColor::GetPaletteIndexFromRGB ( SColor color )
{
ulong ulBestDist = 0xFFFFFFFF;
uchar ucBestMatch = 0;
for ( uint i = 0 ; i < NUMELMS( paletteColorTable8 ) / 4 ; i++ )
{
int r = paletteColorTable8[ i * 4 + 0 ] - color.R;
int g = paletteColorTable8[ i * 4 + 1 ] - color.G;
int b = paletteColorTable8[ i * 4 + 2 ] - color.B;
ulong ulDist = r * r + g * g + b * b;
if ( ulDist < ulBestDist )
{
ulBestDist = ulDist;
ucBestMatch = i;
}
}
return ucBestMatch;
}
SColor CVehicleColor::GetRGBFromPaletteIndex ( uchar ucColor )
{
ucColor = Min < uchar > ( ucColor, static_cast < uint > ( NUMELMS( paletteColorTable8 ) / 4 ) );
uchar r = paletteColorTable8[ ucColor * 4 ];
uchar g = paletteColorTable8[ ucColor * 4 + 1 ];
uchar b = paletteColorTable8[ ucColor * 4 + 2 ];
return SColorRGBA ( r, g, b, 0 );
}

View File

@ -47,6 +47,9 @@ extern "C"
#include <mono/metadata/environment.h>
#include "include/ILuaModuleManager.h"
#include "extra/Vector2.h"
#include "extra/Vector3.h"
// Obviously i can't get us this so other includes will most likely be needed later on
using namespace std;
@ -54,6 +57,32 @@ using namespace std;
#ifndef __COMMON_H
#define __COMMON_H
typedef unsigned long ulong; // 32 32 64
typedef unsigned int uint; // 32
typedef unsigned short ushort; // 16
typedef unsigned char uchar; // 8
typedef unsigned long long uint64; // 64
typedef unsigned int uint32; // 32
typedef unsigned short uint16; // 16
typedef unsigned char uint8; // 8
// signed types
typedef signed long long int64; // 64
typedef signed int int32; // 32
typedef signed short int16; // 16
typedef signed char int8; // 8
// Windowsesq types
typedef unsigned char BYTE; // 8
typedef unsigned short WORD; // 16
typedef unsigned long DWORD; // 32 32 64
typedef float FLOAT; // 32
#ifndef NUMELMS // from DShow.h
#define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
#endif
// used in the function argument vector
#define MAX_ARGUMENTS 10
struct FunctionArguments
@ -77,31 +106,6 @@ namespace FunctionArgumentType
};
}
struct SHeatHazeSettings
{
SHeatHazeSettings( void )
: ucIntensity( 0 )
, ucRandomShift( 0 )
, usSpeedMin( 1 )
, usSpeedMax( 1 )
, sScanSizeX( 1 )
, sScanSizeY( 1 )
, usRenderSizeX( 1 )
, usRenderSizeY( 1 )
, bInsideBuilding( false )
{}
unsigned char ucIntensity; // 0 to 255
unsigned char ucRandomShift; // 0 to 255
unsigned short usSpeedMin; // 0 to 1000
unsigned short usSpeedMax; // 0 to 1000
short sScanSizeX; // -1000 to 1000
short sScanSizeY; // -1000 to 1000
unsigned short usRenderSizeX; // 0 to 1000
unsigned short usRenderSizeY; // 0 to 1000
bool bInsideBuilding;
};
//
// SColor
//
@ -206,6 +210,120 @@ inline SColor COLOR_RGBA ( unsigned char R, unsigned char G, unsigned char B, un
inline SColor COLOR_ARGB ( unsigned char A, unsigned char R, unsigned char G, unsigned char B ) { return SColorRGBA ( R, G, B, A ); }
inline SColor COLOR_ABGR ( unsigned char A, unsigned char B, unsigned char G, unsigned char R ) { return SColorRGBA ( R, G, B, A ); }
//
// Some templates
//
template < class T >
T Min ( const T& a, const T& b )
{
return a < b ? a : b;
}
template < class T >
T Max ( const T& a, const T& b )
{
return a > b ? a : b;
}
// Clamps a value between two other values ( min < a < max )
template < class T >
T Clamp ( const T& min, const T& a, const T& max )
{
return a < min ? min : a > max ? max : a;
}
// Lerps between two values depending on the weight
template< class T >
T Lerp ( const T& from, float fAlpha, const T& to )
{
return (T)( ( to - from ) * fAlpha + from );
}
// Find the relative position of Pos between From and To
inline const float Unlerp ( const double dFrom, const double dPos, const double dTo )
{
// Avoid dividing by 0 (results in INF values)
if ( dFrom == dTo ) return 1.0f;
return static_cast < float > ( ( dPos - dFrom ) / ( dTo - dFrom ) );
}
// Unlerp avoiding extrapolation
inline const float UnlerpClamped ( const double dFrom, const double dPos, const double dTo )
{
return Clamp ( 0.0f, Unlerp( dFrom, dPos, dTo ), 1.0f );
}
template < class T >
int Round ( T value )
{
return static_cast < int > ( std::floor ( value + 0.5f ) );
}
template < class T >
T WrapAround ( T fLow, T fValue, T fHigh )
{
const T fSize = fHigh - fLow;
return fValue - ( fSize * std::floor ( ( fValue - fLow ) / fSize ) );
}
class CVehicleColor
{
public:
CVehicleColor ( void );
void SetRGBColors ( SColor color1, SColor color2, SColor color3, SColor color4 );
void SetPaletteColors ( uchar ucColor1, uchar ucColor2, uchar ucColor3, uchar ucColor4 );
void SetRGBColor ( uint uiSlot, SColor color );
void SetPaletteColor ( uint uiSlot, uchar ucColor );
SColor GetRGBColor ( uint uiSlot );
uchar GetPaletteColor ( uint uiSlot );
int GetNumColorsUsed ( void );
static uchar GetPaletteIndexFromRGB ( SColor color );
static SColor GetRGBFromPaletteIndex ( uchar ucColor );
protected:
void InvalidatePaletteColors ( void );
void ValidatePaletteColors ( void );
void InvalidateRGBColors ( void );
void ValidateRGBColors ( void );
SColor m_RGBColors[4];
uchar m_ucPaletteColors[4];
bool m_bPaletteColorsWrong;
bool m_bRGBColorsWrong;
};
struct SHeatHazeSettings
{
SHeatHazeSettings( void )
: ucIntensity( 0 )
, ucRandomShift( 0 )
, usSpeedMin( 1 )
, usSpeedMax( 1 )
, sScanSizeX( 1 )
, sScanSizeY( 1 )
, usRenderSizeX( 1 )
, usRenderSizeY( 1 )
, bInsideBuilding( false )
{}
unsigned char ucIntensity; // 0 to 255
unsigned char ucRandomShift; // 0 to 255
unsigned short usSpeedMin; // 0 to 1000
unsigned short usSpeedMax; // 0 to 1000
short sScanSizeX; // -1000 to 1000
short sScanSizeY; // -1000 to 1000
unsigned short usRenderSizeX; // 0 to 1000
unsigned short usRenderSizeY; // 0 to 1000
bool bInsideBuilding;
};
enum eWeaponType
{
WEAPONTYPE_UNARMED=0,

View File

@ -51,6 +51,11 @@ public:
inline const char* GetString ( void ) const { return m_szString; };
inline void* GetLightUserData ( void ) const { return m_pLightUserData; };
template <class T> T GetNumber()
{
return static_cast< T >( m_Number );
}
private:
int m_iType;
bool m_bBoolean;

File diff suppressed because it is too large Load Diff

View File

@ -18,9 +18,6 @@ class CLuaFunctionDefinitions;
#include "../Common.h"
#include "../extra/CLuaArguments.h"
#include "../extra/Vector2.h"
#include "../extra/Vector3.h"
class CLuaFunctionDefinitions
{
public:
@ -75,25 +72,25 @@ public:
static bool GetElementPosition ( lua_State* pLuaVM, void* pUserData, Vector3& vecPosition );
static bool GetElementRotation ( lua_State* pLuaVM, void* pUserData, Vector3& vecRotation );
static bool GetElementVelocity ( lua_State* pLuaVM, void* pUserData, Vector3& vecVelocity );
static int GetElementInterior ( lua_State* pLuaVM, void* pUserData );
static bool IsElementWithinColShape ( lua_State* pLuaVM, void* pUserData );
static bool IsElementWithinMarker ( lua_State* pLuaVM, void* pUserData );
static int GetElementDimension ( lua_State* pLuaVM, void* pUserData );
static string GetElementZoneName ( lua_State* pLuaVM, void* pUserData );
static bool GetElementInterior ( lua_State* pLuaVM, void* pUserData, unsigned char& ucInterior );
static bool IsElementWithinColShape ( lua_State* pLuaVM, void* pUserData, bool& bWithin );
static bool IsElementWithinMarker ( lua_State* pLuaVM, void* pUserData, bool& bWithin );
static bool GetElementDimension ( lua_State* pLuaVM, void* pUserData, unsigned short& usDimension );
static bool GetElementZoneName ( lua_State* pLuaVM, void* pUserData, string& strOutName, bool bCitiesOnly = false );
static bool IsElementAttached ( lua_State* pLuaVM, void* pUserData );
static void* GetElementAttachedTo ( lua_State* pLuaVM, void* pUserData );
static void* GetElementColShape ( lua_State* pLuaVM, void* pUserData );
static int GetElementAlpha ( lua_State* pLuaVM, void* pUserData );
static bool IsElementDoubleSided ( lua_State* pLuaVM, void* pUserData );
static float GetElementHealth ( lua_State* pLuaVM, void* pUserData );
static int GetElementModel ( lua_State* pLuaVM, void* pUserData );
static bool IsElementInWater ( lua_State* pLuaVM, void* pUserData );
static bool GetElementAlpha ( lua_State* pLuaVM, void* pUserData, unsigned char& ucAlpha );
static bool IsElementDoubleSided ( lua_State* pLuaVM, void* pUserData, bool& bDoubleSided );
static bool GetElementHealth ( lua_State* pLuaVM, void* pUserData, float& fHealth );
static bool GetElementModel ( lua_State* pLuaVM, void* pUserData, unsigned short& usModel );
static bool IsElementInWater ( lua_State* pLuaVM, void* pUserData, bool& bInWater );
static bool GetElementAttachedOffsets ( lua_State* pLuaVM, void* pUserData, Vector3& vecPosition, Vector3& vecRotation );
static void* GetElementSyncer ( lua_State* pLuaVM, void* pUserData );
static bool GetElementCollisionsEnabled ( lua_State* pLuaVM, void* pUserData );
static bool IsElementFrozen ( lua_State* pLuaVM, void* pUserData );
static bool GetLowLodElement ( lua_State* pLuaVM, void* pUserData );
static bool IsElementLowLod ( lua_State* pLuaVM, void* pUserData );
static bool IsElementFrozen ( lua_State* pLuaVM, void* pUserData, bool& bFrozen );
static bool GetLowLodElement ( lua_State* pLuaVM, void* pUserData, void*& pOutLowLodElement );
static bool IsElementLowLod ( lua_State* pLuaVM, void* pUserData, bool& bOutLowLod );
// Element set funcs
static bool ClearElementVisibleTo ( lua_State* pLuaVM, void* pUserData );
@ -120,26 +117,26 @@ public:
static bool SetLowLodElement ( lua_State* pLuaVM, void* pUserData, bool bEnabled );
// Player get functions
static int GetPlayerCount ( lua_State* pLuaVM );
static void* GetPlayerFromName ( lua_State* pLuaVM, string sName );
static int GetPlayerMoney ( lua_State* pLuaVM, void* pUserData );
static int GetPlayerPing ( lua_State* pLuaVM, void* pUserData );
static unsigned int GetPlayerCount ( lua_State* pLuaVM );
static void* GetPlayerFromName ( lua_State* pLuaVM, const char* szNick );
static bool GetPlayerPing ( lua_State* pLuaVM, void* pUserData, unsigned int& uiPing );
static bool GetPlayerMoney ( lua_State* pLuaVM, void* pUserData, long& lMoney );
static void* GetRandomPlayer ( lua_State* pLuaVM );
static bool IsPlayerMuted ( lua_State* pLuaVM, void* pUserData );
static bool IsPlayerMuted ( lua_State* pLuaVM, void* pUserData, bool& bMuted );
static void* GetPlayerTeam ( lua_State* pLuaVM, void* pUserData );
static int GetPlayerWantedLevel ( lua_State* pLuaVM, void* pUserData );
static int GetAlivePlayers ( lua_State* pLuaVM );
static int GetDeadPlayers ( lua_State* pLuaVM );
static int GetPlayerIdleTime ( lua_State* pLuaVM, void* pUserData );
static bool IsPlayerMapForced ( lua_State* pLuaVM, void* pUserData );
static string GetPlayerNametagText ( lua_State* pLuaVM, void* pUserData );
static bool GetPlayerNametagColor ( lua_State* pLuaVM, void* pUserData, int &iRed, int &iGreen, int &iBlue );
static bool IsPlayerNametagShowing ( lua_State* pLuaVM, void* pUserData );
static bool GetPlayerWantedLevel ( lua_State* pLuaVM, void* pUserData, unsigned int& uiWantedLevel );
static bool GetAlivePlayers ( lua_State* pLuaVM );
static bool GetDeadPlayers ( lua_State* pLuaVM );
static bool GetPlayerIdleTime ( lua_State* pLuaVM, void* pUserData, unsigned int& uiIdleTime );
static bool IsPlayerMapForced ( lua_State* pLuaVM, void* pUserData, bool& bForced );
static bool GetPlayerNametagText ( lua_State* pLuaVM, void* pUserData, string& strOutText );
static bool GetPlayerNametagColor ( lua_State* pLuaVM, void* pUserData, unsigned char& ucR, unsigned char& ucG, unsigned char& ucB );
static bool IsPlayerNametagShowing ( lua_State* pLuaVM, void* pUserData, bool& bShowing );
static string GetPlayerSerial ( lua_State* pLuaVM, void* pUserData );
static string GetPlayerUserName ( lua_State* pLuaVM, void* pUserData );
static int GetPlayerBlurLevel ( lua_State* pLuaVM, void* pUserData );
static string GetPlayerName ( lua_State* pLuaVM, void* pUserData );
static string GetPlayerIP ( lua_State* pLuaVM, void* pUserData );
static bool GetPlayerBlurLevel ( lua_State* pLuaVM, void* pUserData, unsigned char& ucLevel );
static bool GetPlayerName ( lua_State* pLuaVM, void* pUserData, string& strOutName );
static bool GetPlayerIP ( lua_State* pLuaVM, void* pUserData, string& strOutIP );
static void* GetPlayerAccount ( lua_State* pLuaVM, void* pUserData );
static string GetPlayerVersion ( lua_State* pLuaVM, void* pUserData );
static int GetPlayerACInfo ( lua_State* pLuaVM, void* pUserData );
@ -164,30 +161,30 @@ public:
// Ped get functions
static void* CreatePed ( lua_State* pLuaVM, int iModelid, const Vector3& vecPosition, float fRot = 0.0, bool bSynced = true );
static float GetPedArmor ( lua_State* pLuaVM, void* pUserData );
static bool IsPedChoking ( lua_State* pLuaVM, void* pUserData );
static bool IsPedDead ( lua_State* pLuaVM, void* pUserData );
static bool IsPedDucked ( lua_State* pLuaVM, void* pUserData );
static float GetPedStat ( lua_State* pLuaVM, void* pUserData, int iStat );
static bool GetPedArmor ( lua_State* pLuaVM, void* pUserData, float& fArmor );
static bool IsPedChoking ( lua_State* pLuaVM, void* pUserData, bool& bIsChoking );
static bool IsPedDead ( lua_State* pLuaVM, void* pUserData, bool& bDead );
static bool IsPedDucked ( lua_State* pLuaVM, void* pUserData, bool& bDucked );
static bool GetPedStat ( lua_State* pLuaVM, void* pUserData, unsigned short usStat, float& fValue );
static void* GetPedTarget ( lua_State* pLuaVM, void* pUserData );
static int GetPedWeapon ( lua_State* pLuaVM, void* pUserData, int iWeaponSlot = -1 );
static bool GetPedClothes ( lua_State* pLuaVM, void* pUserData, unsigned char ucType, string& strOutTexture, string& strOutModel );
static bool DoesPedHaveJetPack ( lua_State* pLuaVM, void* pUserData );
static bool IsPedOnGround ( lua_State* pLuaVM, void* pUserData );
static int GetPedFightingStyle ( lua_State* pLuaVM, void* pUserData );
static int GetPedMoveAnim ( lua_State* pLuaVM, void* pUserData );
static float GetPedGravity ( lua_State* pLuaVM, void* pUserData );
static bool DoesPedHaveJetPack ( lua_State* pLuaVM, void* pUserData, bool& bHasJetPack );
static bool IsPedOnGround ( lua_State* pLuaVM, void* pUserData, bool& bOnGround );
static bool GetPedFightingStyle ( lua_State* pLuaVM, void* pUserData, unsigned char& ucStyle );
static bool GetPedMoveAnim ( lua_State* pLuaVM, void* pUserData, unsigned int& iMoveAnim );
static bool GetPedGravity ( lua_State* pLuaVM, void* pUserData, float& fGravity );
static void* GetPedContactElement ( lua_State* pLuaVM, void* pUserData );
static int GetPedWeaponSlot ( lua_State* pLuaVM, void* pUserData );
static bool IsPedDoingGangDriveby ( lua_State* pLuaVM, void* pUserData );
static bool IsPedOnFire ( lua_State* pLuaVM, void* pUserData );
static bool IsPedHeadless ( lua_State* pLuaVM, void* pUserData );
static bool IsPedFrozen ( lua_State* pLuaVM, void* pUserData );
static bool GetPedWeaponSlot ( lua_State* pLuaVM, void* pUserData, unsigned char& ucWeaponSlot );
static bool IsPedDoingGangDriveby ( lua_State* pLuaVM, void* pUserData, bool & bDoingGangDriveby );
static bool IsPedOnFire ( lua_State* pLuaVM, void* pUserData, bool & bIsOnFire );
static bool IsPedHeadless ( lua_State* pLuaVM, void* pUserData, bool & bIsHeadless );
static bool IsPedFrozen ( lua_State* pLuaVM, void* pUserData, bool & bIsFrozen );
static void* GetPedOccupiedVehicle ( lua_State* pLuaVM, void* pUserData );
static int GetPedOccupiedVehicleSeat ( lua_State* pLuaVM, void* pUserData );
static bool IsPedInVehicle ( lua_State* pLuaVM, void* pUserData, void* pPed );
// static int GetWeaponProperty ( lua_State* pLuaVM, void* pUserData );
// static int GetOriginalWeaponProperty ( lua_State* pLuaVM, void* pUserData );
static bool GetPedOccupiedVehicleSeat ( lua_State* pLuaVM, void* pUserData, unsigned int& uiSeat );
static bool IsPedInVehicle ( lua_State* pLuaVM, void* pUserData, bool & bIsInVehicle );
// static bool GetWeaponProperty ( lua_State* pLuaVM, void* pUserData );
// static bool GetOriginalWeaponProperty ( lua_State* pLuaVM, void* pUserData );
// Ped set functions
static bool SetPedArmor ( lua_State* pLuaVM, void* pUserData, float fArmor );
@ -224,49 +221,49 @@ public:
static void* CreateVehicle ( lua_State* pLuaVM, int model, float fX, float fY, float fZ, float fRX, float fRY, float fRZ, string numberplate, bool direction = false, int variant1 = 255, int variant2 = 255 );
// Vehicle get functions
static string GetVehicleType ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleType ( lua_State* pLuaVM, void* pUserData, string& strType );
static bool GetVehicleVariant ( lua_State* pLuaVM, void* pUserData, unsigned char& ucVariant, unsigned char& ucVariant2 );
static bool GetVehicleColor ( lua_State* pLuaVM, void* pUserData, unsigned char& ucR1, unsigned char& ucG1, unsigned char& ucB1, unsigned char& ucR2, unsigned char& ucG2, unsigned char& ucB2, unsigned char& ucR3, unsigned char& ucG3, unsigned char& ucB3, unsigned char& ucR4, unsigned char& ucG4, unsigned char& ucB4 );
static unsigned short GetVehicleModelFromName ( lua_State* pLuaVM, const char* szName );
static bool GetVehicleLandingGearDown ( lua_State* pLuaVM, void* pUserData );
static int GetVehicleMaxPassengers ( lua_State* pLuaVM, void* pUserData );
static string GetVehicleName ( lua_State* pLuaVM, void* pUserData );
static string GetVehicleNameFromModel ( lua_State* pLuaVM, void* pUserData, unsigned short usModel );
static bool GetVehicleColor ( lua_State* pLuaVM, void* pUserData, CVehicleColor& color );
static bool GetVehicleModelFromName ( lua_State* pLuaVM, const char* szName, unsigned short& usID );
static bool GetVehicleLandingGearDown ( lua_State* pLuaVM, void* pUserData, bool& bGearDown );
static bool GetVehicleMaxPassengers ( lua_State* pLuaVM, void* pUserData, unsigned char& ucMaxPassengers );
static bool GetVehicleName ( lua_State* pLuaVM, void* pUserData, string& strOutName );
static bool GetVehicleNameFromModel ( lua_State* pLuaVM, void* pUserData, unsigned short usModel, string& strOutName );
static void* GetVehicleOccupant ( lua_State* pLuaVM, void* pUserData, unsigned int uiSeat );
static CLuaArguments* GetVehicleOccupants ( lua_State* pLuaVM, void* pUserData );
static void* GetVehicleController ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleSirensOn ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleTurnVelocity ( lua_State* pLuaVM, void* pUserData, float &fX, float& fY, float& fZ );
static bool GetVehicleTurretPosition ( lua_State* pLuaVM, void* pUserData, float &fX, float& fY );
static bool IsVehicleLocked ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleSirensOn ( lua_State* pLuaVM, void* pUserData, bool& bSirensOn );
static bool GetVehicleTurnVelocity ( lua_State* pLuaVM, void* pUserData, Vector3& vecTurnVelocity );
static bool GetVehicleTurretPosition ( lua_State* pLuaVM, void* pUserData, Vector2& vecPosition );
static bool IsVehicleLocked ( lua_State* pLuaVM, void* pUserData, bool& bLocked );
static CLuaArguments* GetVehiclesOfType ( lua_State* pLuaVM, void* pUserData );
static unsigned short GetVehicleUpgradeOnSlot ( lua_State* pLuaVM, void* pUserData, unsigned char ucSlot );
static bool GetVehicleUpgradeOnSlot ( lua_State* pLuaVM, void* pUserData, unsigned char ucSlot, unsigned short& usUpgrade );
static CLuaArguments* GetVehicleUpgrades ( lua_State* pLuaVM, void* pUserData );
static string GetVehicleUpgradeSlotName ( lua_State* pLuaVM, unsigned char ucSlot );
static string GetVehicleUpgradeSlotName ( lua_State* pLuaVM, unsigned short usUpgrade );
static bool GetVehicleUpgradeSlotName ( lua_State* pLuaVM, unsigned char ucSlot, string& strOutName );
static bool GetVehicleUpgradeSlotName ( lua_State* pLuaVM, unsigned short usUpgrade, string& strOutName );
static CLuaArguments* GetVehicleCompatibleUpgrades ( lua_State* pLuaVM, void* pUserData );
static unsigned char GetVehicleDoorState ( lua_State* pLuaVM, void* pUserData, unsigned char ucDoor );
static bool GetVehicleDoorState ( lua_State* pLuaVM, void* pUserData, unsigned char ucDoor, unsigned char& ucState );
static bool GetVehicleWheelStates ( lua_State* pLuaVM, void* pUserData, unsigned char& ucFrontLeft, unsigned char& ucRearLeft, unsigned char& ucFrontRight, unsigned char& ucRearRight );
static unsigned char GetVehicleLightState ( lua_State* pLuaVM, void* pUserData, unsigned char ucLight );
static unsigned char GetVehiclePanelState ( lua_State* pLuaVM, void* pUserData, unsigned char ucPanel );
static unsigned char GetVehicleOverrideLights ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleLightState ( lua_State* pLuaVM, void* pUserData, unsigned char ucLight, unsigned char& ucState );
static bool GetVehiclePanelState ( lua_State* pLuaVM, void* pUserData, unsigned char ucPanel, unsigned char& ucState );
static bool GetVehicleOverrideLights ( lua_State* pLuaVM, void* pUserData, unsigned char& ucLights );
static void* GetVehicleTowedByVehicle ( lua_State* pLuaVM, void* pUserData );
static void* GetVehicleTowingVehicle ( lua_State* pLuaVM, void* pUserData );
static unsigned char GetVehiclePaintjob ( lua_State* pLuaVM, void* pUserData );
static const char* GetVehiclePlateText ( lua_State* pLuaVM, void* pUserData );
static bool IsVehicleDamageProof ( lua_State* pLuaVM, void* pUserData );
static bool IsVehicleFuelTankExplodable ( lua_State* pLuaVM, void* pUserData );
static bool IsVehicleFrozen ( lua_State* pLuaVM, void* pUserData );
static bool IsVehicleOnGround ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleEngineState ( lua_State* pLuaVM, void* pUserData );
static bool IsTrainDerailed ( lua_State* pLuaVM, void* pUserData );
static bool IsTrainDerailable ( lua_State* pLuaVM, void* pUserData );
static bool GetTrainDirection ( lua_State* pLuaVM, void* pUserData );
static float GetTrainSpeed ( lua_State* pLuaVM, void* pUserData );
static bool GetVehiclePaintjob ( lua_State* pLuaVM, void* pUserData, unsigned char& ucPaintjob );
static bool GetVehiclePlateText ( lua_State* pLuaVM, void* pUserData, char* szPlateText );
static bool IsVehicleDamageProof ( lua_State* pLuaVM, void* pUserData, bool& bDamageProof );
static bool IsVehicleFuelTankExplodable ( lua_State* pLuaVM, void* pUserData, bool& bExplodable );
static bool IsVehicleFrozen ( lua_State* pLuaVM, void* pUserData, bool& bFrozen );
static bool IsVehicleOnGround ( lua_State* pLuaVM, void* pUserData, bool& bOnGround );
static bool GetVehicleEngineState ( lua_State* pLuaVM, void* pUserData, bool& bState );
static bool IsTrainDerailed ( lua_State* pLuaVM, void* pUserData, bool& bDerailed );
static bool IsTrainDerailable ( lua_State* pLuaVM, void* pUserData, bool& bDerailable );
static bool GetTrainDirection ( lua_State* pLuaVM, void* pUserData, bool& bDirection );
static bool GetTrainSpeed ( lua_State* pLuaVM, void* pUserData, float& fSpeed );
static bool IsVehicleBlown ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleHeadLightColor ( lua_State* pLuaVM, void* pUserData, unsigned char& ucRed, unsigned char& ucGreen, unsigned char& ucBlue );
static float GetVehicleDoorOpenRatio ( lua_State* pLuaVM, void* pUserData, unsigned char ucDoor );
static bool IsVehicleTaxiLightOn ( lua_State* pLuaVM, void* pUserData );
static bool GetVehicleHeadLightColor ( lua_State* pLuaVM, void* pUserData, SColor& outColor );
static bool GetVehicleDoorOpenRatio ( lua_State* pLuaVM, void* pUserData, unsigned char ucDoor, float& fRatio );
static bool IsVehicleTaxiLightOn ( lua_State* pLuaVM, void* pUserData, bool& bLightOn );
// Vehicle set functions
static bool FixVehicle ( lua_State* pLuaVM, void* pUserData );