mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro.
This commit is contained in:
parent
378a933894
commit
acb192e2a5
133 changed files with 1716 additions and 2087 deletions
|
|
@ -1345,7 +1345,7 @@ void SFXSource::_scatterTransform()
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( SFXSource, play, void, ( F32 fadeInTime ), ( -1.f ),
|
||||
DefineEngineMethod( SFXSource, play, void, ( F32 fadeInTime ), ( -1.0f ),
|
||||
"Start playback of the source.\n"
|
||||
"If the sound data for the source has not yet been fully loaded, there will be a delay after calling "
|
||||
"play and playback will start after the data has become available.\n\n"
|
||||
|
|
@ -1358,7 +1358,7 @@ DefineEngineMethod( SFXSource, play, void, ( F32 fadeInTime ), ( -1.f ),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( SFXSource, stop, void, ( F32 fadeOutTime ), ( -1.f ),
|
||||
DefineEngineMethod( SFXSource, stop, void, ( F32 fadeOutTime ), ( -1.0f ),
|
||||
"Stop playback of the source.\n"
|
||||
"@param fadeOutTime Seconds for the sound to fade down to zero volume. If -1, the SFXDescription::fadeOutTime "
|
||||
"set in the source's associated description is used. Pass 0 to disable a fade-out effect that may be "
|
||||
|
|
@ -1371,7 +1371,7 @@ DefineEngineMethod( SFXSource, stop, void, ( F32 fadeOutTime ), ( -1.f ),
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( SFXSource, pause, void, ( F32 fadeOutTime ), ( -1.f ),
|
||||
DefineEngineMethod( SFXSource, pause, void, ( F32 fadeOutTime ), ( -1.0f ),
|
||||
"Pause playback of the source.\n"
|
||||
"@param fadeOutTime Seconds for the sound to fade down to zero volume. If -1, the SFXDescription::fadeOutTime "
|
||||
"set in the source's associated description is used. Pass 0 to disable a fade-out effect that may be "
|
||||
|
|
@ -1569,21 +1569,24 @@ static ConsoleDocFragment _sSetTransform2(
|
|||
"void setTransform( Point3F position, Point3F direction )"
|
||||
);
|
||||
|
||||
ConsoleMethod( SFXSource, setTransform, void, 3, 4,
|
||||
DefineConsoleMethod( SFXSource, setTransform, void, ( const char * position, const char * direction ), ( "" ),
|
||||
"( vector position [, vector direction ] ) "
|
||||
"Set the position and orientation of a 3D sound source.\n"
|
||||
"@hide" )
|
||||
{
|
||||
MatrixF mat = object->getTransform();
|
||||
|
||||
Point3F pos;
|
||||
dSscanf( argv[2], "%g %g %g", &pos.x, &pos.y, &pos.z );
|
||||
mat.setPosition( pos );
|
||||
if(dStrcmp( position , "")!=0 )
|
||||
{
|
||||
Point3F pos;
|
||||
dSscanf( position, "%g %g %g", &pos.x, &pos.y, &pos.z );
|
||||
mat.setPosition( pos );
|
||||
}
|
||||
|
||||
if( argc > 3 )
|
||||
if(dStrcmp( direction ,"")!=0 )
|
||||
{
|
||||
Point3F dir;
|
||||
dSscanf( argv[ 3 ], "%g %g %g", &dir.x, &dir.y, &dir.z );
|
||||
dSscanf( direction, "%g %g %g", &dir.x, &dir.y, &dir.z );
|
||||
mat.setColumn( 1, dir );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1441,7 +1441,7 @@ static ConsoleDocFragment _sfxCreateSource4(
|
|||
NULL,
|
||||
"SFXSound sfxCreateSource( SFXDescription description, string filename, float x, float y, float z );" );
|
||||
|
||||
ConsoleFunction( sfxCreateSource, S32, 2, 6,
|
||||
DefineConsoleFunction( sfxCreateSource, S32, ( const char * SFXType, const char * filename, const char * x, const char * y, const char * z ), ("", "", "", ""),
|
||||
"( SFXTrack track | ( SFXDescription description, string filename ) [, float x, float y, float z ] ) "
|
||||
"Creates a new paused sound source using a profile or a description "
|
||||
"and filename. The return value is the source which must be "
|
||||
|
|
@ -1449,13 +1449,13 @@ ConsoleFunction( sfxCreateSource, S32, 2, 6,
|
|||
"@hide" )
|
||||
{
|
||||
SFXDescription* description = NULL;
|
||||
SFXTrack* track = dynamic_cast< SFXTrack* >( Sim::findObject( argv[1] ) );
|
||||
SFXTrack* track = dynamic_cast< SFXTrack* >( Sim::findObject( SFXType ) );
|
||||
if ( !track )
|
||||
{
|
||||
description = dynamic_cast< SFXDescription* >( Sim::findObject( argv[1] ) );
|
||||
description = dynamic_cast< SFXDescription* >( Sim::findObject( SFXType ) );
|
||||
if ( !description )
|
||||
{
|
||||
Con::printf( "Unable to locate sound track/description '%s'", (const char*)argv[1] );
|
||||
Con::printf( "Unable to locate sound track/description '%s'", SFXType );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1464,20 +1464,20 @@ ConsoleFunction( sfxCreateSource, S32, 2, 6,
|
|||
|
||||
if ( track )
|
||||
{
|
||||
if ( argc == 2 )
|
||||
if ( x == "" )
|
||||
{
|
||||
source = SFX->createSource( track );
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixF transform;
|
||||
transform.set( EulerF(0,0,0), Point3F( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4])) );
|
||||
transform.set( EulerF(0,0,0), Point3F( dAtof(x), dAtof(y), dAtof(z)) );
|
||||
source = SFX->createSource( track, &transform );
|
||||
}
|
||||
}
|
||||
else if ( description )
|
||||
{
|
||||
SFXProfile* tempProfile = new SFXProfile( description, StringTable->insert( argv[2] ), true );
|
||||
SFXProfile* tempProfile = new SFXProfile( description, StringTable->insert( filename ), true );
|
||||
if( !tempProfile->registerObject() )
|
||||
{
|
||||
Con::errorf( "sfxCreateSource - unable to create profile" );
|
||||
|
|
@ -1485,14 +1485,14 @@ ConsoleFunction( sfxCreateSource, S32, 2, 6,
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( argc == 3 )
|
||||
if ( dStrcmp(x , "")==0 )
|
||||
{
|
||||
source = SFX->createSource( tempProfile );
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixF transform;
|
||||
transform.set(EulerF(0,0,0), Point3F( dAtof(argv[3]),dAtof(argv[4]),dAtof(argv[5]) ));
|
||||
transform.set(EulerF(0,0,0), Point3F( dAtof(x),dAtof(y),dAtof(z) ));
|
||||
source = SFX->createSource( tempProfile, &transform );
|
||||
}
|
||||
|
||||
|
|
@ -1544,13 +1544,13 @@ static ConsoleDocFragment _sfxPlay3(
|
|||
NULL,
|
||||
"void sfxPlay( SFXTrack track, float x, float y, float z );" );
|
||||
|
||||
ConsoleFunction( sfxPlay, S32, 2, 5, "( SFXSource source | ( SFXTrack track [, float x, float y, float z ] ) ) "
|
||||
DefineConsoleFunction( sfxPlay, S32, ( const char * trackName, const char * pointOrX, const char * y, const char * z ), ( "", "", ""),
|
||||
"Start playing the given source or create a new source for the given track and play it.\n"
|
||||
"@hide" )
|
||||
{
|
||||
if ( argc == 2 )
|
||||
if ( dStrcmp(pointOrX , "")==0 )
|
||||
{
|
||||
SFXSource* source = dynamic_cast<SFXSource*>( Sim::findObject( argv[1] ) );
|
||||
SFXSource* source = dynamic_cast<SFXSource*>( Sim::findObject( trackName ) );
|
||||
if ( source )
|
||||
{
|
||||
source->play();
|
||||
|
|
@ -1558,18 +1558,20 @@ ConsoleFunction( sfxPlay, S32, 2, 5, "( SFXSource source | ( SFXTrack track [, f
|
|||
}
|
||||
}
|
||||
|
||||
SFXTrack* track = dynamic_cast<SFXTrack*>( Sim::findObject( argv[1] ) );
|
||||
SFXTrack* track = dynamic_cast<SFXTrack*>( Sim::findObject( trackName ) );
|
||||
if ( !track )
|
||||
{
|
||||
Con::printf( "Unable to locate sfx track '%s'", (const char*)argv[1] );
|
||||
Con::printf( "Unable to locate sfx track '%s'", trackName );
|
||||
return 0;
|
||||
}
|
||||
|
||||
Point3F pos(0.f, 0.f, 0.f);
|
||||
if ( argc == 3 )
|
||||
dSscanf( argv[2], "%g %g %g", &pos.x, &pos.y, &pos.z );
|
||||
else if(argc == 5)
|
||||
pos.set( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4]) );
|
||||
if ( pointOrX != "" && y == ""&& z == "" )
|
||||
{
|
||||
dSscanf( pointOrX, "%g %g %g", &pos.x, &pos.y, &pos.z );
|
||||
}
|
||||
else if( pointOrX != "" && y != "" && z != "" )
|
||||
pos.set( dAtof(pointOrX), dAtof(y), dAtof(z) );
|
||||
|
||||
MatrixF transform;
|
||||
transform.set( EulerF(0,0,0), pos );
|
||||
|
|
@ -1652,19 +1654,19 @@ static ConsoleDocFragment _sPlayOnce4(
|
|||
"SFXSource sfxPlayOnce( SFXDescription description, string filename, float x, float y, float z, float fadeInTime=-1 );"
|
||||
);
|
||||
|
||||
ConsoleFunction( sfxPlayOnce, S32, 2, 6,
|
||||
DefineConsoleFunction( sfxPlayOnce, S32, ( const char * SFXType, const char * filename, const char * x, const char * y, const char * z, F32 fadeInTime ), ("", "", "", -1.0f),
|
||||
"SFXSource sfxPlayOnce( ( SFXTrack track | SFXDescription description, string filename ) [, float x, float y, float z, float fadeInTime=-1 ] ) "
|
||||
"Create a new play-once source for the given profile or description+filename and start playback of the source.\n"
|
||||
"@hide" )
|
||||
{
|
||||
SFXDescription* description = NULL;
|
||||
SFXTrack* track = dynamic_cast< SFXTrack* >( Sim::findObject( argv[1] ) );
|
||||
SFXTrack* track = dynamic_cast< SFXTrack* >( Sim::findObject( SFXType ) );
|
||||
if( !track )
|
||||
{
|
||||
description = dynamic_cast< SFXDescription* >( Sim::findObject( argv[1] ) );
|
||||
description = dynamic_cast< SFXDescription* >( Sim::findObject( SFXType ) );
|
||||
if( !description )
|
||||
{
|
||||
Con::errorf( "sfxPlayOnce - Unable to locate sound track/description '%s'", (const char*)argv[1] );
|
||||
Con::errorf( "sfxPlayOnce - Unable to locate sound track/description '%s'", SFXType );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1672,21 +1674,20 @@ ConsoleFunction( sfxPlayOnce, S32, 2, 6,
|
|||
SFXSource* source = NULL;
|
||||
if( track )
|
||||
{
|
||||
if( argc == 2 )
|
||||
if( x == "" )
|
||||
{
|
||||
source = SFX->playOnce( track );
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixF transform;
|
||||
transform.set( EulerF( 0, 0, 0 ), Point3F( dAtof( argv[ 2 ] ), dAtof( argv[ 3 ] ),dAtof( argv[ 4 ] ) ) );
|
||||
F32 fadeInTime = -1.f;
|
||||
if( argc > 5 )
|
||||
fadeInTime = dAtof( argv[ 5 ] );
|
||||
transform.set( EulerF( 0, 0, 0 ), Point3F( dAtof( x ), dAtof( y ),dAtof( z ) ) );
|
||||
source = SFX->playOnce( track, &transform, NULL, fadeInTime );
|
||||
}
|
||||
}
|
||||
else if( description )
|
||||
{
|
||||
SFXProfile* tempProfile = new SFXProfile( description, StringTable->insert( argv[2] ), true );
|
||||
SFXProfile* tempProfile = new SFXProfile( description, StringTable->insert( filename ), true );
|
||||
if( !tempProfile->registerObject() )
|
||||
{
|
||||
Con::errorf( "sfxPlayOnce - unable to create profile" );
|
||||
|
|
@ -1694,15 +1695,12 @@ ConsoleFunction( sfxPlayOnce, S32, 2, 6,
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( argc == 3 )
|
||||
if( x == "" )
|
||||
source = SFX->playOnce( tempProfile );
|
||||
else
|
||||
{
|
||||
MatrixF transform;
|
||||
transform.set(EulerF(0,0,0), Point3F( dAtof(argv[3]),dAtof(argv[4]),dAtof(argv[5]) ));
|
||||
F32 fadeInTime = -1.f;
|
||||
if( argc > 6 )
|
||||
fadeInTime = dAtof( argv[ 6 ] );
|
||||
transform.set( EulerF( 0, 0, 0 ), Point3F( dAtof( x ), dAtof( y ),dAtof( z ) ) );
|
||||
source = SFX->playOnce( tempProfile, &transform, NULL, fadeInTime );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue