-
Notifications
You must be signed in to change notification settings - Fork 7
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
Rework sounds management #187
base: master
Are you sure you want to change the base?
Conversation
This fixes the code inspection in some IDEs, and is generally good style, as CMake can then react to changes in these files better.
This allows for including them properly in other code files, and allows for using those in template-based code.
This commit fixes compatibility with STL collection classes (e.g., std::map). The default generated one doesn't work very well, as it doesn't copy the string properly.
Why do you use a map for |
We don't fill every slot with a sound, there are many gaps, so using a vector would either require implementing the null object pattern properly, or using pointers to be able to use Edit: of course, there is |
Should probably be removed entirely, as the samples are cached already and recreating the struct instance is not very expensive.
This PR attempts to rewrite most of the sounds management code. It provides a new template class
soundslot_collection
, which supports both a map and vector based storage implementation, to efficiently manage map and game sounds. Also, game sounds are now registered in the C++ code so that their registration does no longer rely on matching the order of the registration calls in CubeScript with theenum
in the code.