Resource icon

[Open Assets] Encore Mode Music

NO LONGER SUPPORTED

Still gonna be here for historical purposes thiugh.

Original post:
So I bet you're wondering... "What the heck is this? How do I use it?" well I'm going to tell you now

It's a framework which lets you use per-map encore specific level theme. In order to keep the file size to a reasonable size, only two tracks are supported, Daytona Speedwway and Plesure Castle, but you can support for other maps if you want.

Original post:
Lua Functions:
EMM_MapIsSupported(int mapnum) - Checks if the map specified already exists within the table containing all the supported maps.
EMM_AddMusic(int mapnum) - Adds the specified map number to the table containing all the supported maps. It's important you know the extended map number of your map before using this. So you'd use 183 instead of CB. For a list of extended map numbers, see https://wiki.srb2.org/wiki/List_of_extended_map_numbers.

===Adding support for your map===
This framework was designed so adding support for your map is easy to understand. For both of the example songs in the wad, I used Audacity to lower the speed by -10%. But you can use a different song entirely if you want.

Prerequisites:
Make sure your music lump is named correctly and imported to your WAD file. The music lump should be named O_KR**EM, ** being your map number.

Coding support for the map:
Code:
if emm_maps // first check to see if its added at the time of this wads addition
 end
 addHook("MapLoad", function() // else check whenever the map loads
     if not emm_maps then return end
 end)
From there it's as simple as using the function listed above to add your map to the list of supported maps.

Code:
// Support for KL_EncoreModeMusic
 if emm_maps // First check to see if its added at the time of this wads addition
     EMM_AddMusic(gamemap)
 end

 addHook("MapLoad", function() // Else check whenever the map loads
     if not emm_maps then return end
     EMM_AddMusic(gamemap)
 end)
But for map packs you could use a for loop and add maps in a range:
Code:
// support for KL_EncoreModeMusic
 if emm_maps // first check to see if its added at the time of this wads addition
     for i = 1, 5
         EMM_AddMusic(i)
     end
 end

 addHook("MapLoad", function() //else check whenever the map loads
     if not emm_maps then return end

     for i = 1, 5
         EMM_AddMusic(i)
     end
 end)
Just be sure to remember to use map numbers for the function, this is important or things will go horribly wrong.
Also there should be the first code block example included as a Lua file below as well, if you cant copypaste for whatever reason.

Once that's done, give yourself a pat on the back, as your map is now supported. If there's any questions you are free to contact me here on the MB or Discord.
Author
SteelT
Views
1,153
First release
Last update

More resources from SteelT

Share this resource

Back
Top