Refactor of sound asset

Refactored to match image asset.
This commit is contained in:
marauder2k7 2026-04-05 14:17:17 +01:00
parent 5796f0ea07
commit 71273e63c9
46 changed files with 639 additions and 775 deletions

View file

@ -244,8 +244,6 @@ GuiControlProfile::GuiControlProfile(void) :
mTextOffset(0,0),
mBitmapArrayRects(0)
{
INIT_ASSET(SoundButtonDown);
INIT_ASSET(SoundButtonOver);
mLoadCount = 0;
mUseCount = 0;
@ -322,19 +320,8 @@ GuiControlProfile::GuiControlProfile(void) :
mTextOffset = def->mTextOffset;
// default sound
_setSoundButtonDown(def->getSoundButtonDown());
if (getSoundButtonDown() != StringTable->EmptyString())
{
if (!getSoundButtonDownProfile())
Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button pressed sound asset.");
}
_setSoundButtonOver(def->getSoundButtonOver());
if (getSoundButtonOver() != StringTable->EmptyString())
{
if (!getSoundButtonOverProfile())
Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button hover sound asset.");
}
_setSoundButtonDown(def->getSoundButtonDownFile());
_setSoundButtonOver(def->getSoundButtonOverFile());
//used by GuiTextCtrl
mModal = def->mModal;

View file

@ -466,11 +466,8 @@ public:
bool mUseBitmapArray; ///< Flag to use the bitmap array or to fallback to non-array rendering
Vector<RectI> mBitmapArrayRects; ///< Used for controls which use an array of bitmaps such as checkboxes
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonDown); ///< Sound played when a button is pressed.
DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonDown);
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonOver); ///< Sound played when a button is hovered.
DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonOver);
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonDown) ///< Sound played when a button is pressed.
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonOver) ///< Sound played when a button is hovered.
StringTableEntry mChildrenProfileName; ///< The name of the profile to use for the children controls