Converts all game, gui editor, and system classes to utilize assets

Processed core, tools and default modules to utilize assets
Converted all console types that were string based, such as TypeImageFilename to utilize const char*/the string table, which avoids a lot of type swapping shenanigans and avoids string corruption
Removed unneeded MainEditor mockup module
Removed some unused/duplicate image assets from the tools
This commit is contained in:
Areloch 2021-07-19 01:07:08 -05:00
parent 83b0432283
commit 5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions

View file

@ -140,8 +140,8 @@ SFXDevice *SFXALProvider::createDevice( const String& deviceName, bool useHardwa
( _findDeviceInfo( deviceName) );
// Do we find one to create?
if ( info )
return new SFXALDevice( this, mOpenAL, info->name, useHardware, maxBuffers );
if (info)
return new SFXALDevice(this, mOpenAL, info->name, useHardware, maxBuffers);
return NULL;
}

View file

@ -167,7 +167,7 @@ bool SFXProfile::preload( bool server, String &errorStr )
// Validate the datablock... has nothing to do with mPreload.
if( !server &&
NetConnection::filesWereDownloaded() &&
( mFilename.isEmpty() || !SFXResource::exists( mFilename ) ) )
( mFilename == StringTable->EmptyString() || !SFXResource::exists( mFilename ) ) )
return false;
return true;
@ -180,10 +180,10 @@ void SFXProfile::packData(BitStream* stream)
Parent::packData( stream );
char buffer[256];
if ( mFilename.isEmpty() )
if ( mFilename == StringTable->EmptyString())
buffer[0] = 0;
else
dStrncpy( buffer, mFilename.c_str(), 256 );
dStrncpy( buffer, mFilename, 256 );
stream->writeString( buffer );
stream->writeFlag( mPreload );
@ -263,7 +263,7 @@ void SFXProfile::_onResourceChanged( const Torque::Path& path )
if( mPreload && !mDescription->mIsStreaming )
{
if( !_preloadBuffer() )
Con::errorf( "SFXProfile::_onResourceChanged() - failed to preload '%s'", mFilename.c_str() );
Con::errorf( "SFXProfile::_onResourceChanged() - failed to preload '%s'", mFilename );
}
mChangedSignal.trigger( this );
@ -283,7 +283,7 @@ bool SFXProfile::_preloadBuffer()
Resource<SFXResource>& SFXProfile::getResource()
{
if( !mResource && !mFilename.isEmpty() )
if( !mResource && mFilename != StringTable->EmptyString())
mResource = SFXResource::load( mFilename );
return mResource;
@ -317,7 +317,7 @@ SFXBuffer* SFXProfile::_createBuffer()
// Try to create through SFXDevie.
if( !mFilename.isEmpty() && SFX )
if( mFilename != StringTable->EmptyString() && SFX )
{
buffer = SFX->_createBuffer( mFilename, mDescription );
if( buffer )
@ -325,7 +325,7 @@ SFXBuffer* SFXProfile::_createBuffer()
#ifdef TORQUE_DEBUG
const SFXFormat& format = buffer->getFormat();
Con::printf( "%s SFX: %s (%i channels, %i kHz, %.02f sec, %i kb)",
mDescription->mIsStreaming ? "Streaming" : "Loaded", mFilename.c_str(),
mDescription->mIsStreaming ? "Streaming" : "Loaded", mFilename,
format.getChannels(),
format.getSamplesPerSecond() / 1000,
F32( buffer->getDuration() ) / 1000.0f,

View file

@ -93,7 +93,7 @@ class SFXProfile : public SFXTrack
/// The sound filename. If no extension is specified
/// the system will try .wav first then other formats.
String mFilename;
StringTableEntry mFilename;
/// If true the sound data will be loaded from
/// disk and possibly cached with the active
@ -155,6 +155,10 @@ class SFXProfile : public SFXTrack
/// Returns the sound filename.
const String& getSoundFileName() const { return mFilename; }
void setSoundFileName(StringTableEntry filename) { mFilename = filename; }
bool getPreload() const { return mPreload; }
void setPreload(bool preload) { mPreload = preload; }
/// @note This has nothing to do with mPreload.
/// @see SimDataBlock::preload

View file

@ -73,6 +73,7 @@ class SFXTrack : public SimDataBlock
/// Returns the description object for this sound profile.
SFXDescription* getDescription() const { return mDescription; }
void setDescription(SFXDescription* desc) { mDescription = desc; }
///
StringTableEntry getParameter( U32 index ) const