SkinTunes: Per-Racer Tune.Song Swapping Defined By S_SKIN Data
ringracers_user-defined-skintunes_cTRR1W3Q1v
For every racer WAD in the game, mod developers may now optionally specify a variety of new key-value pairs in the S_SKIN
lumps for said racer to personalize "event" Tune
s to the design of the racer so long as the Tune
in question has its name specified in the global array skins_skintunenames
. The existence of skins_skintunenames
is by-design to filter what Tune
s are and are not allowed to be altered by this MR for artistic purposes.
When an aforementioned key-value pair is specified, the key represents the Tune
that will be interacted with (prefixed by MUS
) and the value represents the loaded OGG lump for the .song
it will play instead of the usual .song
. Whilst the intent is to let racers use their own custom OGG lumps, existing loaded OGG lumps work all the same. Interaction with any Tune
involved prior to this MR will remain unaffected as the .song
adjusted is actually on a deep copy of affected Tune
instances cached in-advance during Music_Init()
.
Expanding the system to include more tunes is specifically engineered to be as easy as adding a new tune name to skins_skintunenames
. After doing so, S_SKIN
will gain access to replacing the .song
of that Tune
at runtime (so long as the Tune
added to skins_skintunenames
was present during Music_Init()
at least at the time of submitting this MR).
As I submit this MR prior to any editing that may occur, skins_skintunenames
only has 2 entries:
char skins_skintunenames[NUMSKINTUNES][MAXSKINTUNENAMELEN + 1] = {
"invinc",
"grow"
};
Although heavily implied already, I will directly state now that any existing racers are 100% un affected by this MR, no assets will need to update to accommodate it.
This MR went through several iterations and at first was a little out of my scope in terms of my understanding of the codebase, so hopefully it is acceptable even so!
As for the future of the MR, I'm willing to expand the scope into engineering a solution for things like the sound effect versions of the invinc
and grow
music used as a warning to nearby racers but I also feel that starts to drift from the goal of this MR as an all-purpose solution to per-skin Tune
manipulation and may want to take an idea like that into a sibling MR.