From 92e85fa0d3bab0c6177d87f6bec395da04cbdfee Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 17 Mar 2013 18:11:27 +0000 Subject: [PATCH] Lunatic translator: music 0, add two userdefs members. git-svn-id: https://svn.eduke32.com/eduke32@3567 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 24 +++++++++++++++------ polymer/eduke32/source/lunatic/con_lang.lua | 2 ++ polymer/eduke32/source/lunatic/lunacon.lua | 16 ++++++-------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index c38c140e6..d7712b371 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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) { - Bassert((unsigned)vol < MAXVOLUMES+1); - Bassert((unsigned)lev < MAXLEVELS); - + if (vol==-1) { - map_t *const map = &MapInfo[(MAXLEVELS*vol)+lev]; + Bassert((unsigned)lev < MAXVOLUMES); - Bfree(map->musicfn); - map->musicfn = dup_filename(fn); - check_filename_case(map->musicfn); + Bstrncpyz(EnvMusicFilename[lev], fn, BMAX_PATH); + check_filename_case(EnvMusicFilename[lev]); + } + 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); + } } } diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index 2cd9169f9..462b4286a 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -821,7 +821,9 @@ local UserdefLabels = { screen_tilting = UD".screen_tilting", showallmap = UDRO".showallmap", showweapons = UDRO".showweapons", + statusbarscale = UDRO".statusbarscale", volume_number = { UD".volume_number", UD":set_volume_number(%%s)" }, + weaponscale = UDRO".weaponscale", weaponswitch = UD".weaponswitch", } diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index f8a428348..cd6c59762 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -955,22 +955,20 @@ function Cmd.definesound(sndnum, fn, ...) end function Cmd.music(volnum, ...) - if (volnum==0) then - warnprintf("`music' for volume 0 not yet implemented") - return - end + local envmusicp = (volnum==0) - 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. - 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 end local filenames = {...} + local MAXFNS = envmusicp and conl.MAXVOLUMES or conl.MAXLEVELS - if (#filenames > conl.MAXLEVELS) then - warnprintf("ignoring extraneous %d music file names", #filenames-conl.MAXLEVELS) - for i=conl.MAXLEVELS+1,#filenames do + if (#filenames > MAXFNS) then + warnprintf("ignoring extraneous %d music file names", #filenames-MAXFNS) + for i=MAXFNS+1,#filenames do filenames[i] = nil end end