-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom file playback to playef() #902
base: master
Are you sure you want to change the base?
Conversation
Worth noting: if you run this version right now, |
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string> (that was my idea, it's also how FILESYSTEM_getLanguageCodes works, until the next commit...)
I just needed std::vector<std::string> customSounds = FILESYSTEM_enumerateAssets("sounds/");
for (int i = 0; i < customSounds.size(); i++)
{
// use customSounds[i]
} by something like this: EnumHandle* handle = {};
const char* item;
while ((item = FILESYSTEM_enumerateAssets("sounds/", &handle)) != NULL)
{
// use item
}
FILESYSTEM_freeEnumerate(&handle); |
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string> (that was my idea, it's also how FILESYSTEM_getLanguageCodes works, until the next commit...)
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which TerryCavanagh#902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
All global fonts and all custom fonts in a level are now loaded, and added to their respective "vectors". The selected font is still always as the global font.png, and the custom level font also isn't selected yet, but it's now easier to implement that. Also, I added FILESYSTEM_enumerateAssets, which #902 already has but I needed it now. I also rewrote it to not use std::vector<std::string>. That was my idea, it's also how FILESYSTEM_getLanguageCodes worked, so for symmetry, that function is getting changed as well.
Everything here should be in order now; I've squashed it all to one commit and made sure it's building and functional. @InfoTeddy could you look at this? |
Yes. |
Previously, any number would be interpreted as a stock sound effect ID, causing the side effect of being able to call custom sound effects using numbers over 27 (which is unreliable). Now only numbers that correspond to a stock sound effect ID will be considered (leading zeroes work as well), and everything else will be interpreted as a custom sound effect file name.
So apparently OGG files don't work here after all, even though OGG playback was fixed. Will have to look into this before it can be merged... |
When OGG files got loaded, they weren't given a name in the function LoadOGG(). This caused playef_name() to fail since it couldn't match any of the custom pushed OGGs' filenames with what the user called using playef. This was fixed by copying the name definition from LoadWAV().
Changes:
This PR allows users to call custom filenames via the
playef()
command. For example,playef(mysfx)
will play back eithersounds/mysfx.ogg
orsounds/mysfx.wav
. Custom sounds are loaded with the level, and (for now) only the level's ownsounds/
folder is read from.This uses a new function called
FILESYSTEM_enumerateAssets()
which gets all the files from a specific folder of a custom level's assets folder. This could allow other possibilities for loading custom files (such as graphics) in the future.Big thanks to @Dav999-v for helping me write this!
Legal Stuff:
By submitting this pull request, I confirm that...
CONTRIBUTORS
file and the "GitHub Friends"section of the credits for all of said releases, but will NOT be compensated
for these changes