mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 20:11:47 +00:00
Remove music slot compatibility
# Conflicts: # src/deh_lua.c # src/lua_baselib.c
This commit is contained in:
parent
babf630587
commit
bf6b9c6fed
9 changed files with 23 additions and 263 deletions
|
|
@ -25,10 +25,6 @@
|
||||||
#include "deh_lua.h"
|
#include "deh_lua.h"
|
||||||
#include "deh_tables.h"
|
#include "deh_tables.h"
|
||||||
|
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
#include "deh_soc.h" // for get_mus
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// freeslot takes a name (string only!)
|
// freeslot takes a name (string only!)
|
||||||
// and allocates it to the appropriate free slot.
|
// and allocates it to the appropriate free slot.
|
||||||
// Returns the slot number allocated for it or nil if failed.
|
// Returns the slot number allocated for it or nil if failed.
|
||||||
|
|
@ -422,29 +418,6 @@ static inline int lib_getenum(lua_State *L)
|
||||||
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
|
if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
else if (!mathlib && fastncmp("mus_",word,4)) {
|
|
||||||
p = word+4;
|
|
||||||
if ((i = get_mus(p, false)) == 0)
|
|
||||||
return 0;
|
|
||||||
lua_pushinteger(L, i);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS!
|
|
||||||
p = word+4;
|
|
||||||
if ((i = get_mus(p, false)) == 0)
|
|
||||||
return luaL_error(L, "music '%s' could not be found.\n", word);
|
|
||||||
lua_pushinteger(L, i);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) {
|
|
||||||
p = word+2;
|
|
||||||
if ((i = get_mus(p, false)) == 0)
|
|
||||||
return luaL_error(L, "music '%s' could not be found.\n", word);
|
|
||||||
lua_pushinteger(L, i);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (!mathlib && fastncmp("khud_",word,5)) {
|
else if (!mathlib && fastncmp("khud_",word,5)) {
|
||||||
p = word+5;
|
p = word+5;
|
||||||
for (i = 0; i < NUMKARTHUD; i++)
|
for (i = 0; i < NUMKARTHUD; i++)
|
||||||
|
|
|
||||||
107
src/deh_soc.c
107
src/deh_soc.c
|
|
@ -50,13 +50,6 @@
|
||||||
// SRB2Kart
|
// SRB2Kart
|
||||||
#include "filesrch.h" // refreshdirmenu
|
#include "filesrch.h" // refreshdirmenu
|
||||||
|
|
||||||
int freeslotusage[2][2] = {{0, 0}, {0, 0}}; // [S_, MT_][max, previous .wad's max]
|
|
||||||
void DEH_UpdateMaxFreeslots(void)
|
|
||||||
{
|
|
||||||
freeslotusage[0][1] = freeslotusage[0][0];
|
|
||||||
freeslotusage[1][1] = freeslotusage[1][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loops through every constant and operation in word and performs its calculations, returning the final value.
|
// Loops through every constant and operation in word and performs its calculations, returning the final value.
|
||||||
fixed_t get_number(const char *word)
|
fixed_t get_number(const char *word)
|
||||||
{
|
{
|
||||||
|
|
@ -1522,19 +1515,6 @@ void readlevelheader(MYFILE *f, INT32 num)
|
||||||
sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num));
|
sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
else if (fastcmp(word, "MUSICSLOT"))
|
|
||||||
{
|
|
||||||
i = get_mus(word2, true);
|
|
||||||
if (i && i <= 1035)
|
|
||||||
snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i));
|
|
||||||
else if (i && i <= 1050)
|
|
||||||
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7);
|
|
||||||
else
|
|
||||||
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
|
|
||||||
mapheaderinfo[num-1]->musname[6] = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (fastcmp(word, "MUSICTRACK"))
|
else if (fastcmp(word, "MUSICTRACK"))
|
||||||
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
|
mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1);
|
||||||
else if (fastcmp(word, "MUSICPOS"))
|
else if (fastcmp(word, "MUSICPOS"))
|
||||||
|
|
@ -1777,19 +1757,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
||||||
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
|
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
|
||||||
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
|
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
|
||||||
}
|
}
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
else if (fastcmp(word, "MUSICSLOT"))
|
|
||||||
{
|
|
||||||
i = get_mus(word2, true);
|
|
||||||
if (i && i <= 1035)
|
|
||||||
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
|
|
||||||
else if (i && i <= 1050)
|
|
||||||
strncpy(cutscenes[num]->scene[scenenum].musswitch, compat_special_music_slots[i - 1036], 7);
|
|
||||||
else
|
|
||||||
cutscenes[num]->scene[scenenum].musswitch[0] = 0; // becomes empty string
|
|
||||||
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (fastcmp(word, "MUSICTRACK"))
|
else if (fastcmp(word, "MUSICTRACK"))
|
||||||
{
|
{
|
||||||
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
|
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
|
||||||
|
|
@ -2052,19 +2019,6 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
|
||||||
strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7);
|
strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7);
|
||||||
textprompts[num]->page[pagenum].musswitch[6] = 0;
|
textprompts[num]->page[pagenum].musswitch[6] = 0;
|
||||||
}
|
}
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
else if (fastcmp(word, "MUSICSLOT"))
|
|
||||||
{
|
|
||||||
i = get_mus(word2, true);
|
|
||||||
if (i && i <= 1035)
|
|
||||||
snprintf(textprompts[num]->page[pagenum].musswitch, 7, "%sM", G_BuildMapName(i));
|
|
||||||
else if (i && i <= 1050)
|
|
||||||
strncpy(textprompts[num]->page[pagenum].musswitch, compat_special_music_slots[i - 1036], 7);
|
|
||||||
else
|
|
||||||
textprompts[num]->page[pagenum].musswitch[0] = 0; // becomes empty string
|
|
||||||
textprompts[num]->page[pagenum].musswitch[6] = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (fastcmp(word, "MUSICTRACK"))
|
else if (fastcmp(word, "MUSICTRACK"))
|
||||||
{
|
{
|
||||||
textprompts[num]->page[pagenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
|
textprompts[num]->page[pagenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
|
||||||
|
|
@ -2388,20 +2342,6 @@ void readmenu(MYFILE *f, INT32 num)
|
||||||
menupres[num].musname[6] = 0;
|
menupres[num].musname[6] = 0;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
else if (fastcmp(word, "MUSICSLOT"))
|
|
||||||
{
|
|
||||||
value = get_mus(word2, true);
|
|
||||||
if (value && value <= 1035)
|
|
||||||
snprintf(menupres[num].musname, 7, "%sM", G_BuildMapName(value));
|
|
||||||
else if (value && value <= 1050)
|
|
||||||
strncpy(menupres[num].musname, compat_special_music_slots[value - 1036], 7);
|
|
||||||
else
|
|
||||||
menupres[num].musname[0] = 0; // becomes empty string
|
|
||||||
menupres[num].musname[6] = 0;
|
|
||||||
titlechanged = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (fastcmp(word, "MUSICTRACK"))
|
else if (fastcmp(word, "MUSICTRACK"))
|
||||||
{
|
{
|
||||||
menupres[num].mustrack = ((UINT16)value - 1);
|
menupres[num].mustrack = ((UINT16)value - 1);
|
||||||
|
|
@ -4262,46 +4202,6 @@ sfxenum_t get_sfx(const char *word)
|
||||||
return sfx_None;
|
return sfx_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
UINT16 get_mus(const char *word, UINT8 dehacked_mode)
|
|
||||||
{ // Returns the value of MUS_ enumerations
|
|
||||||
UINT16 i;
|
|
||||||
char lumptmp[4];
|
|
||||||
|
|
||||||
if (*word >= '0' && *word <= '9')
|
|
||||||
return atoi(word);
|
|
||||||
if (!word[2] && toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
|
|
||||||
return (UINT16)M_MapNumber(word[0], word[1]);
|
|
||||||
|
|
||||||
if (fastncmp("MUS_",word,4))
|
|
||||||
word += 4; // take off the MUS_
|
|
||||||
else if (fastncmp("O_",word,2) || fastncmp("D_",word,2))
|
|
||||||
word += 2; // take off the O_ or D_
|
|
||||||
|
|
||||||
strncpy(lumptmp, word, 4);
|
|
||||||
lumptmp[3] = 0;
|
|
||||||
if (fasticmp("MAP",lumptmp))
|
|
||||||
{
|
|
||||||
word += 3;
|
|
||||||
if (toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z')
|
|
||||||
return (UINT16)M_MapNumber(word[0], word[1]);
|
|
||||||
else if ((i = atoi(word)))
|
|
||||||
return i;
|
|
||||||
|
|
||||||
word -= 3;
|
|
||||||
if (dehacked_mode)
|
|
||||||
deh_warning("Couldn't find music named 'MUS_%s'",word);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
for (i = 0; compat_special_music_slots[i][0]; ++i)
|
|
||||||
if (fasticmp(word, compat_special_music_slots[i]))
|
|
||||||
return i + 1036;
|
|
||||||
if (dehacked_mode)
|
|
||||||
deh_warning("Couldn't find music named 'MUS_%s'",word);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hudnum_t get_huditem(const char *word)
|
hudnum_t get_huditem(const char *word)
|
||||||
{ // Returns the value of HUD_ enumerations
|
{ // Returns the value of HUD_ enumerations
|
||||||
hudnum_t i;
|
hudnum_t i;
|
||||||
|
|
@ -4518,13 +4418,6 @@ static fixed_t find_const(const char **rword)
|
||||||
free(word);
|
free(word);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) {
|
|
||||||
r = get_mus(word, true);
|
|
||||||
free(word);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (fastncmp("PW_",word,3)) {
|
else if (fastncmp("PW_",word,3)) {
|
||||||
r = get_power(word);
|
r = get_power(word);
|
||||||
free(word);
|
free(word);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "dehacked.h"
|
#include "dehacked.h"
|
||||||
#include "doomdef.h" // MUSICSLOT_COMPATIBILITY, HWRENDER
|
#include "doomdef.h" // HWRENDER
|
||||||
|
|
||||||
// Crazy word-reading stuff
|
// Crazy word-reading stuff
|
||||||
/// \todo Put these in a seperate file or something.
|
/// \todo Put these in a seperate file or something.
|
||||||
|
|
@ -52,9 +52,6 @@ statenum_t get_state(const char *word);
|
||||||
spritenum_t get_sprite(const char *word);
|
spritenum_t get_sprite(const char *word);
|
||||||
playersprite_t get_sprite2(const char *word);
|
playersprite_t get_sprite2(const char *word);
|
||||||
sfxenum_t get_sfx(const char *word);
|
sfxenum_t get_sfx(const char *word);
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
UINT16 get_mus(const char *word, UINT8 dehacked_mode);
|
|
||||||
#endif
|
|
||||||
hudnum_t get_huditem(const char *word);
|
hudnum_t get_huditem(const char *word);
|
||||||
menutype_t get_menutype(const char *word);
|
menutype_t get_menutype(const char *word);
|
||||||
//INT16 get_gametype(const char *word);
|
//INT16 get_gametype(const char *word);
|
||||||
|
|
@ -87,10 +84,6 @@ void readPlayer(MYFILE *f, INT32 num);
|
||||||
void clear_levels(void);
|
void clear_levels(void);
|
||||||
void clear_conditionsets(void);
|
void clear_conditionsets(void);
|
||||||
|
|
||||||
// SRB2Kart
|
|
||||||
extern int freeslotusage[2][2];
|
|
||||||
void DEH_UpdateMaxFreeslots(void);
|
|
||||||
|
|
||||||
void readcupheader(MYFILE *f, cupheader_t *cup);
|
void readcupheader(MYFILE *f, cupheader_t *cup);
|
||||||
void readfollower(MYFILE *f);
|
void readfollower(MYFILE *f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,13 @@ void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext)
|
||||||
strlcpy(dst, src, size);
|
strlcpy(dst, src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int freeslotusage[2][2] = {{0, 0}, {0, 0}}; // [S_, MT_][max, previous .wad's max]
|
||||||
|
void DEH_UpdateMaxFreeslots(void)
|
||||||
|
{
|
||||||
|
freeslotusage[0][1] = freeslotusage[0][0];
|
||||||
|
freeslotusage[1][1] = freeslotusage[1][0];
|
||||||
|
}
|
||||||
|
|
||||||
ATTRINLINE static FUNCINLINE unsigned char myfget_color(MYFILE *f)
|
ATTRINLINE static FUNCINLINE unsigned char myfget_color(MYFILE *f)
|
||||||
{
|
{
|
||||||
char c = *f->curpos++;
|
char c = *f->curpos++;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ typedef enum
|
||||||
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
||||||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile);
|
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile);
|
||||||
|
|
||||||
|
// SRB2Kart
|
||||||
|
extern int freeslotusage[2][2];
|
||||||
|
void DEH_UpdateMaxFreeslots(void);
|
||||||
|
|
||||||
void DEH_Check(void);
|
void DEH_Check(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -647,10 +647,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
|
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
|
||||||
//#define REDSANALOG
|
//#define REDSANALOG
|
||||||
|
|
||||||
/// Backwards compatibility with musicslots.
|
|
||||||
/// \note You should leave this enabled unless you're working with a future SRB2 version.
|
|
||||||
#define MUSICSLOT_COMPATIBILITY
|
|
||||||
|
|
||||||
/// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls.
|
/// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls.
|
||||||
//#define PAPER_COLLISIONCORRECTION
|
//#define PAPER_COLLISIONCORRECTION
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2485,46 +2485,13 @@ static int lib_sStopSoundByID(lua_State *L)
|
||||||
|
|
||||||
static int lib_sChangeMusic(lua_State *L)
|
static int lib_sChangeMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
UINT32 position, prefadems, fadeinms;
|
||||||
const char *music_name;
|
|
||||||
UINT32 music_num, position, prefadems, fadeinms;
|
|
||||||
char music_compat_name[7];
|
|
||||||
|
|
||||||
boolean looping;
|
|
||||||
player_t *player = NULL;
|
|
||||||
UINT16 music_flags = 0;
|
|
||||||
//NOHUD
|
|
||||||
|
|
||||||
if (lua_isnumber(L, 1))
|
|
||||||
{
|
|
||||||
music_num = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
music_flags = (UINT16)(music_num & 0x0000FFFF);
|
|
||||||
if (music_flags && music_flags <= 1035)
|
|
||||||
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
|
|
||||||
else if (music_flags && music_flags <= 1050)
|
|
||||||
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
|
|
||||||
else
|
|
||||||
music_compat_name[0] = 0; // becomes empty string
|
|
||||||
music_compat_name[6] = 0;
|
|
||||||
music_name = (const char *)&music_compat_name;
|
|
||||||
music_flags = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
music_num = 0;
|
|
||||||
music_name = luaL_checkstring(L, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
looping = (boolean)lua_opttrueboolean(L, 2);
|
|
||||||
|
|
||||||
#else
|
|
||||||
const char *music_name = luaL_checkstring(L, 1);
|
const char *music_name = luaL_checkstring(L, 1);
|
||||||
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
UINT16 music_flags = 0;
|
UINT16 music_flags = 0;
|
||||||
//NOHUD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
||||||
|
|
@ -2532,13 +2499,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
if (music_num)
|
|
||||||
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||||
|
|
||||||
position = (UINT32)luaL_optinteger(L, 5, 0);
|
position = (UINT32)luaL_optinteger(L, 5, 0);
|
||||||
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
|
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
|
||||||
fadeinms = (UINT32)luaL_optinteger(L, 7, 0);
|
fadeinms = (UINT32)luaL_optinteger(L, 7, 0);
|
||||||
|
|
@ -2640,40 +2601,6 @@ static int lib_sMusicName(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_sMusicExists(lua_State *L)
|
|
||||||
{
|
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
const char *music_name;
|
|
||||||
UINT32 music_num;
|
|
||||||
char music_compat_name[7];
|
|
||||||
UINT16 music_flags = 0;
|
|
||||||
NOHUD
|
|
||||||
if (lua_isnumber(L, 1))
|
|
||||||
{
|
|
||||||
music_num = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
music_flags = (UINT16)(music_num & 0x0000FFFF);
|
|
||||||
if (music_flags && music_flags <= 1035)
|
|
||||||
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
|
|
||||||
else if (music_flags && music_flags <= 1050)
|
|
||||||
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
|
|
||||||
else
|
|
||||||
music_compat_name[0] = 0; // becomes empty string
|
|
||||||
music_compat_name[6] = 0;
|
|
||||||
music_name = (const char *)&music_compat_name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
music_num = 0;
|
|
||||||
music_name = luaL_checkstring(L, 1);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
const char *music_name = luaL_checkstring(L, 1);
|
|
||||||
#endif
|
|
||||||
NOHUD
|
|
||||||
lua_pushboolean(L, S_MusicExists(music_name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sSetMusicLoopPoint(lua_State *L)
|
static int lib_sSetMusicLoopPoint(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT32 looppoint = (UINT32)luaL_checkinteger(L, 1);
|
UINT32 looppoint = (UINT32)luaL_checkinteger(L, 1);
|
||||||
|
|
@ -2788,6 +2715,14 @@ static int lib_sResumeMusic(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_sMusicExists(lua_State *L)
|
||||||
|
{
|
||||||
|
const char *music_name = luaL_checkstring(L, 1);
|
||||||
|
NOHUD
|
||||||
|
lua_pushboolean(L, S_MusicExists(music_name));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_sSetInternalMusicVolume(lua_State *L)
|
static int lib_sSetInternalMusicVolume(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT32 volume = (UINT32)luaL_checkinteger(L, 1);
|
UINT32 volume = (UINT32)luaL_checkinteger(L, 1);
|
||||||
|
|
|
||||||
|
|
@ -1292,28 +1292,6 @@ void S_InitSfxChannels(INT32 sfxVolume)
|
||||||
/// Music
|
/// Music
|
||||||
/// ------------------------
|
/// ------------------------
|
||||||
|
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
const char *compat_special_music_slots[16] =
|
|
||||||
{
|
|
||||||
"_title", // 1036 title screen
|
|
||||||
"_intro", // 1037 intro
|
|
||||||
"_clear", // 1038 level clear
|
|
||||||
"_inv", // 1039 invincibility
|
|
||||||
"_shoes", // 1040 super sneakers
|
|
||||||
"_minv", // 1041 Mario invincibility
|
|
||||||
"_drown", // 1042 drowning
|
|
||||||
"_gover", // 1043 game over
|
|
||||||
"_1up", // 1044 extra life
|
|
||||||
"_conti", // 1045 continue screen
|
|
||||||
"_super", // 1046 Super Sonic
|
|
||||||
"_chsel", // 1047 character select
|
|
||||||
"_creds", // 1048 credits
|
|
||||||
"_inter", // 1049 Race Results
|
|
||||||
"_stjr", // 1050 Sonic Team Jr. Presents
|
|
||||||
""
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char music_name[7]; // up to 6-character name
|
static char music_name[7]; // up to 6-character name
|
||||||
static void *music_data;
|
static void *music_data;
|
||||||
static UINT16 music_flags;
|
static UINT16 music_flags;
|
||||||
|
|
@ -2367,7 +2345,7 @@ void S_StartEx(boolean reset)
|
||||||
static void Command_Tunes_f(void)
|
static void Command_Tunes_f(void)
|
||||||
{
|
{
|
||||||
const char *tunearg;
|
const char *tunearg;
|
||||||
UINT16 tunenum, track = 0;
|
UINT16 track = 0;
|
||||||
UINT32 position = 0;
|
UINT32 position = 0;
|
||||||
const size_t argc = COM_Argc();
|
const size_t argc = COM_Argc();
|
||||||
|
|
||||||
|
|
@ -2383,7 +2361,6 @@ static void Command_Tunes_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
tunearg = COM_Argv(1);
|
tunearg = COM_Argv(1);
|
||||||
tunenum = (UINT16)atoi(tunearg);
|
|
||||||
track = 0;
|
track = 0;
|
||||||
|
|
||||||
if (!strcasecmp(tunearg, "-show"))
|
if (!strcasecmp(tunearg, "-show"))
|
||||||
|
|
@ -2402,24 +2379,14 @@ static void Command_Tunes_f(void)
|
||||||
tunearg = mapheaderinfo[gamemap-1]->musname;
|
tunearg = mapheaderinfo[gamemap-1]->musname;
|
||||||
track = mapheaderinfo[gamemap-1]->mustrack;
|
track = mapheaderinfo[gamemap-1]->mustrack;
|
||||||
}
|
}
|
||||||
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
|
|
||||||
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
|
|
||||||
|
|
||||||
if (tunenum && tunenum >= 1036)
|
if (strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
||||||
|
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
track = (UINT16)atoi(COM_Argv(2))-1;
|
track = (UINT16)atoi(COM_Argv(2))-1;
|
||||||
|
|
||||||
if (tunenum)
|
strncpy(mapmusname, tunearg, 7);
|
||||||
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
|
|
||||||
else
|
|
||||||
strncpy(mapmusname, tunearg, 7);
|
|
||||||
|
|
||||||
if (argc > 4)
|
if (argc > 4)
|
||||||
position = (UINT32)atoi(COM_Argv(4));
|
position = (UINT32)atoi(COM_Argv(4));
|
||||||
|
|
|
||||||
|
|
@ -317,10 +317,4 @@ void S_StopSoundByNum(sfxenum_t sfxnum);
|
||||||
#define S_StartScreamSound S_StartSound
|
#define S_StartScreamSound S_StartSound
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
// For compatibility with code/scripts relying on older versions
|
|
||||||
// This is a list of all the "special" slot names and their associated numbers
|
|
||||||
extern const char *compat_special_music_slots[16];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue