Modder Application

mario_classic

Member
Feb 19, 2026
3
0
180
Pronouns
classic_mario
This mod only changes the music in SM64 for a more modern or remastered version. This is my first time making a mod

mod:
-- name: SM64 OST REMAKE
-- description: REMAKE OST!!! by mario_classic
-- pausable: false


-- AUDIO FILES
GRASS = audio_stream_load("grass.ogg")
SNOW = audio_stream_load("snow.ogg")
SLIDER = audio_stream_load("slider.ogg")
CASTLE = audio_stream_load("castle.ogg")
KOOPA = audio_stream_load("koopa_road.ogg")
WATER = audio_stream_load("water.ogg")
UNDERGROUN = audio_stream_load("NADA.ogg")
outside = audio_stream_load("outside.ogg")

smlua_audio_utils_replace_sequence(SEQ_LEVEL_GRASS, 0, 0.00000001, "_silent")
smlua_audio_utils_replace_sequence(SEQ_LEVEL_SNOW, 0, 0.00000001, "_silent")
smlua_audio_utils_replace_sequence(SEQ_LEVEL_WATER, 0, 0.00000001, "_silent")
smlua_audio_utils_replace_sequence(SEQ_LEVEL_SLIDE, 0, 0.00000001, "_silent")
smlua_audio_utils_replace_sequence(SEQ_LEVEL_INSIDE_CASTLE, 0, 0.00000001, "_silent")
smlua_audio_utils_replace_sequence(SEQ_LEVEL_KOOPA_ROAD, 0, 0.00000001, "_silent")

-- VARIABLES
currentSong = nil
nextSong = nil

volume = 0
targetVolume = 0.5
fadeSpeed = 0.02


wing = false
vanish = false


function set_music(song, instant)
if currentSong ~= song and nextSong ~= song then
nextSong = song
end
end

function update_music()

if currentSong == nil and nextSong == nil then return end

if nextSong ~= nil then

volume = volume - fadeSpeed
if volume <= 0 then
volume = 0
if currentSong ~= nil then
audio_stream_stop(currentSong)
end

currentSong = nextSong
nextSong = nil

if currentSong ~= nil then

audio_stream_play(currentSong, true, 0)
end
end
else

if currentSong ~= nil and volume < targetVolume then
volume = volume + fadeSpeed
if volume > targetVolume then volume = targetVolume end
end
end


if currentSong ~= nil then
audio_stream_set_volume(currentSong, volume)


if not audio_stream_get_looping(currentSong) then
audio_stream_set_looping(currentSong, true)
end
end
end

hook_event(HOOK_UPDATE, update_music)

function cap_music(m)
vanish = (m.flags & MARIO_VANISH_CAP) ~= 0
wing = (m.flags & MARIO_WING_CAP) ~= 0
metal = (m.flags & MARIO_METAL_CAP) ~= 0
end

hook_event(HOOK_MARIO_UPDATE, cap_music)

function levels()
local p = gNetworkPlayers[0]
local m = gMarioStates[0]

if p.currLevelNum == LEVEL_CASTLE_GROUNDS then
set_music(outside)
return
end

if p.currLevelNum == LEVEL_HMC
or p.currLevelNum == LEVEL_SSL
or p.currLevelNum == LEVEL_LLL
or p.currLevelNum == LEVEL_WDW
or p.currLevelNum == LEVEL_BBH
or p.currLevelNum == 34
or p.currLevelNum == 33
or p.currLevelNum == 30
or current_seq == SEQ_EVENT_CUTSCENE_STAR_SPAWN
or current_seq == SEQ_EVENT_CUTSCENE_COLLECT_STAR
or current_seq == SEQ_EVENT_POWERUP
or (m.flags & MARIO_WING_CAP) ~= 0
or (m.flags & MARIO_VANISH_CAP) ~= 0
or (m.flags & MARIO_METAL_CAP) ~= 0 then
set_music(UNDERGROUN)
return
end
-- GRASS
if p.currLevelNum == LEVEL_BOB
or p.currLevelNum == LEVEL_WF
or p.currLevelNum == LEVEL_THI
or p.currLevelNum == LEVEL_TTM then

set_music(GRASS)
return
end

-- KOOPA ROAD
if p.currLevelNum == LEVEL_BITDW
or p.currLevelNum == LEVEL_BITFS
or p.currLevelNum == LEVEL_BITS then
set_music(KOOPA)
return
end
--castle
if p.currLevelNum == LEVEL_CASTLE
or p.currLevelNum == LEVEL_CASTLE_COURTYARD then
set_music(CASTLE)
return
end

-- SNOW
if p.currLevelNum == LEVEL_CCM
or p.currLevelNum == LEVEL_SL then
set_music(SNOW)
return
end

-- SLIDER
if p.currLevelNum == LEVEL_PSS
or p.currLevelNum == LEVEL_RR
or p.currLevelNum == LEVEL_TTC
or p.currLevelNum == LEVEL_TOTWC
or p.currLevelNum == LEVEL_VCUTM
or p.currLevelNum == LEVEL_WMOTR
or (p.currLevelNum == LEVEL_CCM and p.currAreaIndex == 2)
or (p.currLevelNum == LEVEL_TTM and p.currAreaIndex == 2) then
set_music(SLIDER)
return
end

-- WATER
if p.currLevelNum == LEVEL_DDD
or p.currLevelNum == LEVEL_JRB
or p.currLevelNum == LEVEL_SA then

set_music(WATER)
return
end

set_music(nil)
end




hook_event(HOOK_UPDATE, levels)
 

Users who are viewing this thread