Lunatic translator: music 0, add two userdefs members.

git-svn-id: https://svn.eduke32.com/eduke32@3567 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-03-17 18:11:27 +00:00
parent 4601b2d203
commit 92e85fa0d3
3 changed files with 26 additions and 16 deletions

View file

@ -2138,15 +2138,25 @@ void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5])
void C_DefineMusic(int32_t vol, int32_t lev, const char *fn) void C_DefineMusic(int32_t vol, int32_t lev, const char *fn)
{ {
Bassert((unsigned)vol < MAXVOLUMES+1); if (vol==-1)
Bassert((unsigned)lev < MAXLEVELS);
{ {
map_t *const map = &MapInfo[(MAXLEVELS*vol)+lev]; Bassert((unsigned)lev < MAXVOLUMES);
Bfree(map->musicfn); Bstrncpyz(EnvMusicFilename[lev], fn, BMAX_PATH);
map->musicfn = dup_filename(fn); check_filename_case(EnvMusicFilename[lev]);
check_filename_case(map->musicfn); }
else
{
Bassert((unsigned)vol < MAXVOLUMES+1);
Bassert((unsigned)lev < MAXLEVELS);
{
map_t *const map = &MapInfo[(MAXLEVELS*vol)+lev];
Bfree(map->musicfn);
map->musicfn = dup_filename(fn);
check_filename_case(map->musicfn);
}
} }
} }

View file

@ -821,7 +821,9 @@ local UserdefLabels = {
screen_tilting = UD".screen_tilting", screen_tilting = UD".screen_tilting",
showallmap = UDRO".showallmap", showallmap = UDRO".showallmap",
showweapons = UDRO".showweapons", showweapons = UDRO".showweapons",
statusbarscale = UDRO".statusbarscale",
volume_number = { UD".volume_number", UD":set_volume_number(%%s)" }, volume_number = { UD".volume_number", UD":set_volume_number(%%s)" },
weaponscale = UDRO".weaponscale",
weaponswitch = UD".weaponswitch", weaponswitch = UD".weaponswitch",
} }

View file

@ -955,22 +955,20 @@ function Cmd.definesound(sndnum, fn, ...)
end end
function Cmd.music(volnum, ...) function Cmd.music(volnum, ...)
if (volnum==0) then local envmusicp = (volnum==0)
warnprintf("`music' for volume 0 not yet implemented")
return
end
if (not (volnum >= 1 and volnum <= conl.MAXVOLUMES)) then if (not (volnum >= 0 and volnum <= conl.MAXVOLUMES)) then
-- NOTE: Don't allow MAXVOLUMES+1 for now. -- NOTE: Don't allow MAXVOLUMES+1 for now.
errprintf("volume number must be between 1 and MAXVOLUMES=%d", conl.MAXVOLUMES) errprintf("volume number must be between 0 and MAXVOLUMES=%d", conl.MAXVOLUMES)
return return
end end
local filenames = {...} local filenames = {...}
local MAXFNS = envmusicp and conl.MAXVOLUMES or conl.MAXLEVELS
if (#filenames > conl.MAXLEVELS) then if (#filenames > MAXFNS) then
warnprintf("ignoring extraneous %d music file names", #filenames-conl.MAXLEVELS) warnprintf("ignoring extraneous %d music file names", #filenames-MAXFNS)
for i=conl.MAXLEVELS+1,#filenames do for i=MAXFNS+1,#filenames do
filenames[i] = nil filenames[i] = nil
end end
end end