mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-02 17:31:07 +00:00
Remove musictype_t, S_MusicType and I_SongType return implementation string
Lua API change: S_MusicType now returns string instead of number
This commit is contained in:
parent
78f04f8c71
commit
49c5c785bf
7 changed files with 12 additions and 39 deletions
|
|
@ -20,7 +20,6 @@
|
|||
#include "lua_script.h" // Lua stuff
|
||||
#include "m_cond.h" // Emblem constants
|
||||
#include "v_video.h" // video flags (for lua)
|
||||
#include "i_sound.h" // musictype_t (for lua)
|
||||
#include "g_state.h" // gamestate_t (for lua)
|
||||
#include "r_data.h" // patchalphastyle_t
|
||||
#include "k_boss.h" // spottype_t (for lua)
|
||||
|
|
@ -6776,18 +6775,6 @@ struct int_const_s const INT_CONST[] = {
|
|||
{"MA_NOCUTSCENES",MA_NOCUTSCENES},
|
||||
{"MA_INGAME",MA_INGAME},
|
||||
|
||||
// music types
|
||||
{"MU_NONE", MU_NONE},
|
||||
{"MU_WAV", MU_WAV},
|
||||
{"MU_MOD", MU_MOD},
|
||||
{"MU_MID", MU_MID},
|
||||
{"MU_OGG", MU_OGG},
|
||||
{"MU_MP3", MU_MP3},
|
||||
{"MU_FLAC", MU_FLAC},
|
||||
{"MU_GME", MU_GME},
|
||||
{"MU_MOD_EX", MU_MOD_EX},
|
||||
{"MU_MID_EX", MU_MID_EX},
|
||||
|
||||
// gamestates
|
||||
{"GS_NULL",GS_NULL},
|
||||
{"GS_LEVEL",GS_LEVEL},
|
||||
|
|
|
|||
|
|
@ -22,20 +22,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
// copied from SDL mixer, plus GME
|
||||
typedef enum {
|
||||
MU_NONE,
|
||||
MU_WAV,
|
||||
MU_MOD,
|
||||
MU_MID,
|
||||
MU_OGG,
|
||||
MU_MP3,
|
||||
MU_FLAC,
|
||||
MU_GME,
|
||||
MU_MOD_EX, // libopenmpt
|
||||
MU_MID_EX // Non-native MIDI
|
||||
} musictype_t;
|
||||
|
||||
/** \brief Sound subsystem runing and waiting
|
||||
*/
|
||||
extern UINT8 sound_started;
|
||||
|
|
@ -139,7 +125,7 @@ void I_ShutdownMusic(void);
|
|||
// MUSIC PROPERTIES
|
||||
/// ------------------------
|
||||
|
||||
musictype_t I_SongType(void);
|
||||
const char *I_SongType(void);
|
||||
boolean I_SongPlaying(void);
|
||||
boolean I_SongPaused(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -2603,7 +2603,7 @@ static int lib_sMusicType(lua_State *L)
|
|||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushinteger(L, S_MusicType());
|
||||
lua_pushstring(L, S_MusicType());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "r_fps.h" // R_ResetViewInterpolation in level load
|
||||
|
||||
#include "s_sound.h"
|
||||
#include "i_sound.h" // I_FreeSfx
|
||||
#include "st_stuff.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
|
|
|||
|
|
@ -1701,7 +1701,7 @@ boolean S_MusicNotInFocus(void)
|
|||
);
|
||||
}
|
||||
|
||||
musictype_t S_MusicType(void)
|
||||
const char *S_MusicType(void)
|
||||
{
|
||||
return I_SongType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef __S_SOUND__
|
||||
#define __S_SOUND__
|
||||
|
||||
#include "i_sound.h" // musictype_t
|
||||
#include "sounds.h"
|
||||
#include "m_fixed.h"
|
||||
#include "command.h"
|
||||
|
|
@ -162,7 +161,7 @@ boolean S_MusicDisabled(void);
|
|||
boolean S_MusicPlaying(void);
|
||||
boolean S_MusicPaused(void);
|
||||
boolean S_MusicNotInFocus(void);
|
||||
musictype_t S_MusicType(void);
|
||||
const char *S_MusicType(void);
|
||||
const char *S_MusicName(void);
|
||||
|
||||
boolean S_MusicExists(const char *mname);
|
||||
|
|
|
|||
|
|
@ -338,27 +338,27 @@ void I_ShutdownMusic(void) {
|
|||
// MUSIC PROPERTIES
|
||||
/// ------------------------
|
||||
|
||||
musictype_t I_SongType(void) {
|
||||
const char* I_SongType(void) {
|
||||
if (!music_player)
|
||||
return MU_NONE;
|
||||
return nullptr;
|
||||
|
||||
SdlAudioLockHandle _;
|
||||
|
||||
std::optional<audio::MusicType> music_type = music_player->music_type();
|
||||
|
||||
if (music_type == std::nullopt) {
|
||||
return MU_NONE;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (*music_type) {
|
||||
case audio::MusicType::kOgg:
|
||||
return MU_OGG;
|
||||
return "OGG";
|
||||
case audio::MusicType::kGme:
|
||||
return MU_GME;
|
||||
return "GME";
|
||||
case audio::MusicType::kMod:
|
||||
return MU_MOD;
|
||||
return "Mod";
|
||||
default:
|
||||
return MU_NONE;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue