Merge branch 'master' into staff_names

This commit is contained in:
TehRealSalt 2018-11-08 14:47:38 -05:00
commit 69287984db
46 changed files with 1617 additions and 2281 deletions

View file

@ -56,90 +56,87 @@ void I_SetSfxVolume(INT32 volume)
(void)volume;
}
//
// MUSIC I/O
//
/// ------------------------
// MUSIC SYSTEM
/// ------------------------
UINT8 music_started = 0;
UINT8 digmusic_started = 0;
void I_InitMusic(void){}
void I_ShutdownMusic(void){}
void I_PauseSong(INT32 handle)
/// ------------------------
// MUSIC PROPERTIES
/// ------------------------
musictype_t I_SongType(void)
{
(void)handle;
return MU_NONE;
}
void I_ResumeSong(INT32 handle)
boolean I_SongPlaying(void)
{
(void)handle;
return false;
}
//
// MIDI I/O
//
UINT8 midimusic_started = 0;
void I_InitMIDIMusic(void){}
void I_ShutdownMIDIMusic(void){}
void I_SetMIDIMusicVolume(INT32 volume)
boolean I_SongPaused(void)
{
(void)volume;
return false;
}
INT32 I_RegisterSong(void *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
boolean I_PlaySong(INT32 handle, INT32 looping)
{
(void)handle;
(void)looping;
return false;
}
void I_StopSong(INT32 handle)
{
(void)handle;
}
void I_UnRegisterSong(INT32 handle)
{
(void)handle;
}
//
// DIGMUSIC I/O
//
UINT8 digmusic_started = 0;
void I_InitDigMusic(void){}
void I_ShutdownDigMusic(void){}
boolean I_StartDigSong(const char *musicname, INT32 looping)
{
(void)musicname;
(void)looping;
return false;
}
void I_StopDigSong(void){}
void I_SetDigMusicVolume(INT32 volume)
{
(void)volume;
}
/// ------------------------
// MUSIC EFFECTS
/// ------------------------
boolean I_SetSongSpeed(float speed)
{
(void)speed;
return false;
}
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
UINT8 midimusic_started = 0;
boolean I_LoadSong(char *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
void I_UnloadSong()
{
}
boolean I_PlaySong(boolean looping)
{
(void)handle;
(void)looping;
return false;
}
void I_StopSong(void)
{
(void)handle;
}
void I_PauseSong(void)
{
(void)handle;
}
void I_ResumeSong(void)
{
(void)handle;
}
void I_SetMusicVolume(INT32 volume)
{
(void)volume;
}

View file

@ -125,22 +125,23 @@ postimg_t postimgtype3 = postimg_none;
INT32 postimgparam3;
postimg_t postimgtype4 = postimg_none;
INT32 postimgparam4;
#ifdef _XBOX
//boolean nomidimusic = false;
boolean nosound = true;
boolean nodigimusic = true;
#else
//boolean nomidimusic = false;
boolean nosound = false;
boolean nodigimusic = false; // No fmod-based music
#endif
// These variables are only true if
// the respective sound system is initialized
// and active, but no sounds/music should play.
//boolean music_disabled = false;
// whether the respective sound system is disabled
// or they're init'ed, but the player just toggled them
#ifdef _XBOX
#ifndef NO_MIDI
boolean midi_disabled = true;
#endif
boolean sound_disabled = true;
boolean digital_disabled = true;
#else
#ifndef NO_MIDI
boolean midi_disabled = false;
#endif
boolean sound_disabled = false;
boolean digital_disabled = false;
#endif
boolean advancedemo;
#ifdef DEBUGFILE
@ -1329,27 +1330,37 @@ void D_SRB2Main(void)
// setting up sound
if (dedicated)
{
nosound = true;
/*nomidimusic = */nodigimusic = true;
sound_disabled = true;
digital_disabled = true;
#ifndef NO_MIDI
midi_disabled = true;
#endif
}
else
{
CONS_Printf("S_Init(): Setting up sound.\n");
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
}
if (M_CheckParm("-nosound"))
nosound = true;
sound_disabled = true;
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
/*nomidimusic = */nodigimusic = true;
{
digital_disabled = true;
#ifndef NO_MIDI
midi_disabled = true;
#endif
}
else
{
/*if (M_CheckParm("-nomidimusic"))
nomidimusic = true; ; // WARNING: DOS version initmusic in I_StartupSound*/
#ifndef NO_MIDI
if (M_CheckParm("-nomidimusic"))
midi_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
#endif
if (M_CheckParm("-nodigmusic"))
nodigimusic = true; // WARNING: DOS version initmusic in I_StartupSound
digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
}
I_StartupSound();
I_InitMusic();
S_Init(cv_soundvolume.value, cv_digmusicvolume.value);//, cv_midimusicvolume.value);
S_InitSfxChannels(cv_soundvolume.value);
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();

View file

@ -884,7 +884,9 @@ void D_RegisterClientCommands(void)
// s_sound.c
CV_RegisterVar(&cv_soundvolume);
CV_RegisterVar(&cv_digmusicvolume);
//CV_RegisterVar(&cv_midimusicvolume);
#ifndef NO_MIDI
CV_RegisterVar(&cv_midimusicvolume);
#endif
CV_RegisterVar(&cv_numChannels);
// i_cdmus.c
@ -4843,6 +4845,7 @@ static void Command_RestartAudio_f(void)
return;
S_StopMusic();
S_StopSounds();
I_ShutdownMusic();
I_ShutdownSound();
I_StartupSound();
@ -4851,8 +4854,11 @@ static void Command_RestartAudio_f(void)
// These must be called or no sound and music until manually set.
I_SetSfxVolume(cv_soundvolume.value);
I_SetDigMusicVolume(cv_digmusicvolume.value);
//I_SetMIDIMusicVolume(cv_midimusicvolume.value);
#ifdef NO_MIDI
S_SetMusicVolume(cv_digmusicvolume.value, -1);
#else
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
#endif
S_StartSound(NULL, sfx_strpst);

View file

@ -20,6 +20,20 @@
// console vars
extern consvar_t cv_playername;
extern consvar_t cv_playercolor;
extern consvar_t cv_skin;
// secondary splitscreen player
extern consvar_t cv_playername2;
extern consvar_t cv_playercolor2;
extern consvar_t cv_skin2;
// third splitscreen player
extern consvar_t cv_playername3;
extern consvar_t cv_playercolor3;
extern consvar_t cv_skin3;
// fourth splitscreen player
extern consvar_t cv_playername4;
extern consvar_t cv_playercolor4;
extern consvar_t cv_skin4;
#ifdef SEENAMES
extern consvar_t cv_seenames, cv_allowseenames;
#endif
@ -36,7 +50,6 @@ extern consvar_t cv_joyscale;
extern consvar_t cv_joyscale2;
extern consvar_t cv_joyscale3;
extern consvar_t cv_joyscale4;
extern consvar_t cv_controlperkey;
// splitscreen with second mouse
extern consvar_t cv_mouse2port;
@ -44,11 +57,6 @@ extern consvar_t cv_usemouse2;
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)
extern consvar_t cv_mouse2opt;
#endif
extern consvar_t cv_invertmouse2;
extern consvar_t cv_alwaysfreelook2;
extern consvar_t cv_mousemove2;
extern consvar_t cv_mousesens2;
extern consvar_t cv_mouseysens2;
// normally in p_mobj but the .h is not read
extern consvar_t cv_itemrespawntime;
@ -57,19 +65,6 @@ extern consvar_t cv_itemrespawn;
extern consvar_t cv_flagtime;
extern consvar_t cv_suddendeath;
extern consvar_t cv_skin;
// secondary splitscreen player
extern consvar_t cv_playername2;
extern consvar_t cv_playercolor2;
extern consvar_t cv_skin2;
extern consvar_t cv_playername3;
extern consvar_t cv_playercolor3;
extern consvar_t cv_skin3;
extern consvar_t cv_playername4;
extern consvar_t cv_playercolor4;
extern consvar_t cv_skin4;
extern consvar_t cv_touchtag;
extern consvar_t cv_hidetime;
@ -85,9 +80,6 @@ extern consvar_t cv_autobalance;
extern consvar_t cv_teamscramble;
extern consvar_t cv_scrambleonchange;
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
extern consvar_t cv_netstat;
#ifdef WALLSPLATS
extern consvar_t cv_splats;
@ -157,17 +149,7 @@ extern consvar_t cv_maxping;
extern consvar_t cv_skipmapcheck;
extern consvar_t cv_sleep, cv_screenshot_option, cv_screenshot_folder;
extern consvar_t cv_moviemode;
extern consvar_t cv_zlib_level, cv_zlib_memory, cv_zlib_strategy;
extern consvar_t cv_zlib_window_bits, cv_zlib_levela, cv_zlib_memorya;
extern consvar_t cv_zlib_strategya, cv_zlib_window_bitsa;
extern consvar_t cv_apng_delay;
extern consvar_t cv_sleep;
typedef enum
{

View file

@ -1038,7 +1038,10 @@ static void readlevelheader(MYFILE *f, INT32 num)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -1646,7 +1649,10 @@ static void readhuditem(MYFILE *f, INT32 num)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -2163,7 +2169,10 @@ static void reademblemdata(MYFILE *f, INT32 num)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -2303,7 +2312,10 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -2387,7 +2399,10 @@ static void readunlockable(MYFILE *f, INT32 num)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -2681,7 +2696,10 @@ static void readconditionset(MYFILE *f, UINT8 setnum)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -2926,7 +2944,10 @@ static void readmaincfg(MYFILE *f)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -3166,7 +3187,10 @@ static void readwipes(MYFILE *f)
// Get the part before the " = "
tmp = strchr(s, '=');
*(tmp-1) = '\0';
if (tmp)
*(tmp-1) = '\0';
else
break;
strupr(word);
// Now get the part after
@ -6553,17 +6577,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
// DEZ respawn laser
"S_DEZLASER",
// Pokey
"S_POKEY1",
"S_POKEY2",
"S_POKEY3",
"S_POKEY4",
"S_POKEY5",
"S_POKEY6",
"S_POKEY7",
"S_POKEY8",
"S_POKEYIDLE",
// Audience Members
"S_RANDOMAUDIENCE",
"S_AUDIENCE_CHAO_CHEER1",
@ -6572,15 +6585,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_AUDIENCE_CHAO_WIN2",
"S_AUDIENCE_CHAO_LOSE",
"S_FANCHAR_KOTE",
"S_FANCHAR_RYAN",
"S_FANCHAR_WENDY",
"S_FANCHAR_FREEZOR",
"S_FANCHAR_METALKO",
"S_FANCHAR_BLACKOUT",
"S_FANCHAR_BLADE",
"S_FANCHAR_HINOTE",
// 1.0 Kart Decoratives
"S_FLAYM1",
"S_FLAYM2",
@ -7671,20 +7675,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_DEZLASER",
"MT_POKEY", // Huh, thought this was a default asset for some reason, guess not.
"MT_ENEMYFLIP",
"MT_WAYPOINT",
"MT_RANDOMAUDIENCE",
"MT_FANCHAR_KOTE",
"MT_FANCHAR_RYAN",
"MT_FANCHAR_WENDY",
"MT_FANCHAR_FREEZOR",
"MT_FANCHAR_METALKO",
"MT_FANCHAR_BLACKOUT",
"MT_FANCHAR_BLADE",
"MT_FANCHAR_HINOTE",
"MT_FLAYM",
"MT_DEVIL",

View file

@ -134,21 +134,12 @@ FUNCINLINE static ATTRINLINE int Volset(int vol)
void I_SetSfxVolume(INT32 volume)
{
if (nosound)
if (sound_disabled)
return;
set_volume (Volset(volume),-1);
}
void I_SetMIDIMusicVolume(INT32 volume)
{
if (nomidimusic)
return;
// Now set volume on output device.
set_volume (-1, Volset(volume));
}
//
// Starting a sound means adding it
// to the current list of active sounds
@ -171,7 +162,7 @@ INT32 I_StartSound ( sfxenum_t id,
int voice;
(void)channel;
if (nosound)
if (sound_disabled)
return 0;
// UNUSED
@ -192,7 +183,7 @@ void I_StopSound (INT32 handle)
// an setting the channel to zero.
int voice=handle & (VIRTUAL_VOICES-1);
if (nosound)
if (sound_disabled)
return;
if (voice_check(voice)==S_sfx[handle>>VOICESSHIFT].data)
@ -201,7 +192,7 @@ void I_StopSound (INT32 handle)
INT32 I_SoundIsPlaying(INT32 handle)
{
if (nosound)
if (sound_disabled)
return FALSE;
if (voice_check(handle & (VIRTUAL_VOICES-1))==S_sfx[handle>>VOICESSHIFT].data)
@ -231,7 +222,7 @@ void I_UpdateSoundParams( INT32 handle,
int voice=handle & (VIRTUAL_VOICES-1);
int numsfx=handle>>VOICESSHIFT;
if (nosound)
if (sound_disabled)
return;
if (voice_check(voice)==S_sfx[numsfx].data)
@ -272,17 +263,17 @@ void I_StartupSound(void)
char err[255];
#endif
if (nosound)
if (sound_disabled)
sfxcard=DIGI_NONE;
else
sfxcard=DIGI_AUTODETECT;
if (nomidimusic)
if (midi_disabled)
midicard=MIDI_NONE;
else
midicard=MIDI_AUTODETECT; //DetectMusicCard();
nodigimusic=true; //Alam: No OGG/MP3/IT/MOD support
digital_disabled=true; //Alam: No OGG/MP3/IT/MOD support
// Secure and configure sound device first.
CONS_Printf("I_StartupSound: ");
@ -295,8 +286,8 @@ void I_StartupSound(void)
{
sprintf (err,"Sound init error : %s\n",allegro_error);
CONS_Error (err);
nosound=true;
nomidimusic=true;
sound_disabled=true;
midi_disabled=true;
}
else
{
@ -323,7 +314,11 @@ static MIDI* currsong; //im assuming only 1 song will be played at once
static int islooping=0;
static int musicdies=-1;
UINT8 music_started=0;
boolean songpaused=false;
/// ------------------------
// MUSIC SYSTEM
/// ------------------------
/* load_midi_mem:
* Loads a standard MIDI file from memory, returning a pointer to
@ -391,116 +386,66 @@ static MIDI *load_midi_mem(char *mempointer,int *e)
return midi;
}
void I_InitMIDIMusic(void)
void I_InitMusic(void)
{
if (nomidimusic)
if (midi_disabled)
return;
I_AddExitFunc(I_ShutdownMusic);
music_started = true;
}
void I_ShutdownMIDIMusic(void)
{
if ( !music_started )
return;
I_StopSong(1);
music_started=false;
}
void I_InitDigMusic(void)
{
// CONS_Printf("Digital music not yet supported under DOS.\n");
}
void I_ShutdownDigMusic(void)
{
// CONS_Printf("Digital music not yet supported under DOS.\n");
}
void I_InitMusic(void)
{
if (!nodigimusic)
I_InitDigMusic();
if (!nomidimusic)
I_InitMIDIMusic();
songpaused = false;
}
void I_ShutdownMusic(void)
{
I_ShutdownMIDIMusic();
I_ShutdownDigMusic();
if ( !music_started )
return;
I_StopSong();
music_started=false;
}
boolean I_PlaySong(INT32 handle, INT32 looping)
{
handle = 0;
if (nomidimusic)
return false;
/// ------------------------
// MUSIC PROPERTIES
/// ------------------------
islooping = looping;
musicdies = gametic + NEWTICRATE*30;
if (play_midi(currsong,looping)==0)
return true;
musictype_t I_SongType(void)
{
if (currsong)
return MU_MID;
else
return MU_NONE;
}
boolean I_SongPlaying()
{
return (boolean)currsong;
}
boolean I_SongPaused()
{
return songpaused;
}
/// ------------------------
// MUSIC EFFECTS
/// ------------------------
boolean I_SetSongSpeed(float speed)
{
(void)speed;
return false;
}
void I_PauseSong (INT32 handle)
{
handle = 0;
if (nomidimusic)
return;
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
midi_pause();
}
void I_ResumeSong (INT32 handle)
{
handle = 0;
if (nomidimusic)
return;
midi_resume();
}
void I_StopSong(INT32 handle)
{
handle = 0;
if (nomidimusic)
return;
islooping = 0;
musicdies = 0;
stop_midi();
}
// Is the song playing?
#if 0
int I_QrySongPlaying(int handle)
{
if (nomidimusic)
return 0;
//return islooping || musicdies > gametic;
return (midi_pos==-1);
}
#endif
void I_UnRegisterSong(INT32 handle)
{
handle = 0;
if (nomidimusic)
return;
//destroy_midi(currsong);
}
INT32 I_RegisterSong(void *data, size_t len)
boolean I_LoadSong(char *data, size_t len)
{
int e = len; //Alam: For error
if (nomidimusic)
if (midi_disabled)
return 0;
if (memcmp(data,"MThd",4)==0) // support mid file in WAD !!!
@ -522,32 +467,81 @@ INT32 I_RegisterSong(void *data, size_t len)
return 1;
}
/// \todo Add OGG/MP3 support for dos
boolean I_StartDigSong(const char *musicname, INT32 looping)
void I_UnloadSong(void)
{
musicname = NULL;
looping = 0;
//CONS_Printf("I_StartDigSong: Not yet supported under DOS.\n");
handle = 0;
if (midi_disabled)
return;
//destroy_midi(currsong);
}
boolean I_PlaySong(boolean looping)
{
handle = 0;
if (midi_disabled)
return false;
islooping = looping;
musicdies = gametic + NEWTICRATE*30;
if (play_midi(currsong,looping)==0)
return true;
return false;
}
void I_StopDigSong(void)
void I_StopSong(void)
{
// CONS_Printf("I_StopDigSong: Not yet supported under DOS.\n");
handle = 0;
if (midi_disabled)
return;
islooping = 0;
musicdies = 0;
stop_midi();
songpaused = false;
}
void I_SetDigMusicVolume(INT32 volume)
void I_PauseSong (INT32 handle)
{
volume = 0;
if (nodigimusic)
handle = 0;
if (midi_disabled)
return;
midi_pause();
songpaused = true;
}
void I_ResumeSong (INT32 handle)
{
handle = 0;
if (midi_disabled)
return;
midi_resume();
songpaused = false;
}
void I_SetMusicVolume(INT32 volume)
{
if (midi_disabled)
return;
// Now set volume on output device.
// CONS_Printf("Digital music not yet supported under DOS.\n");
set_volume (-1, Volset(volume));
}
boolean I_SetSongSpeed(float speed)
boolean I_SetSongTrack(INT32 track)
{
(void)speed;
(void)track;
return false;
}
// Is the song playing?
#if 0
int I_QrySongPlaying(int handle)
{
if (midi_disabled)
return 0;
//return islooping || musicdies > gametic;
return (midi_pos==-1);
}
#endif

View file

@ -548,4 +548,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// SRB2Kart: Camera always has noclip.
#define NOCLIPCAM
/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define
#define NO_MIDI
#endif // __DOOMDEF__

View file

@ -86,12 +86,11 @@ extern boolean forceresetplayers, deferencoremode;
// Internal parameters for sound rendering.
// ========================================
//extern boolean nomidimusic; // defined in d_main.c
#define nomidimusic true
extern boolean nosound;
extern boolean nodigimusic;
//extern boolean music_disabled;
#define music_disabled false
#ifdef NO_MIDI
#define midi_disabled true
#else
extern boolean midi_disabled;
#endif
extern boolean sound_disabled;
extern boolean digital_disabled;

View file

@ -58,82 +58,36 @@ void I_SetSfxVolume(UINT8 volume)
(void)volume;
}
//
// MUSIC I/O
//
/// ------------------------
// MUSIC SYSTEM
/// ------------------------
void I_InitMusic(void){}
void I_ShutdownMusic(void){}
void I_PauseSong(INT32 handle)
/// ------------------------
// MUSIC PROPERTIES
/// ------------------------
musictype_t I_SongType(void)
{
(void)handle;
return MU_NONE;
}
void I_ResumeSong(INT32 handle)
boolean I_SongPlaying(void)
{
(void)handle;
}
//
// MIDI I/O
//
void I_InitMIDIMusic(void){}
void I_ShutdownMIDIMusic(void){}
void I_SetMIDIMusicVolume(UINT8 volume)
{
(void)volume;
}
INT32 I_RegisterSong(void *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
boolean I_PlaySong(INT32 handle, boolean looping)
{
(void)handle;
(void)looping;
return false;
}
void I_StopSong(INT32 handle)
boolean I_SongPaused(void)
{
(void)handle;
}
void I_UnRegisterSong(INT32 handle)
{
(void)handle;
}
//
// DIGMUSIC I/O
//
void I_InitDigMusic(void){}
void I_ShutdownDigMusic(void){}
boolean I_StartDigSong(const char *musicname, boolean looping)
{
(void)musicname;
(void)looping;
return false;
}
void I_StopDigSong(void){}
void I_SetDigMusicVolume(UINT8 volume)
{
(void)volume;
}
/// ------------------------
// MUSIC EFFECTS
/// ------------------------
boolean I_SetSongSpeed(float speed)
{
@ -141,8 +95,51 @@ boolean I_SetSongSpeed(float speed)
return false;
}
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
boolean I_LoadSong(char *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
void I_UnloadSong(void)
{
(void)handle;
}
boolean I_PlaySong(boolean looping)
{
(void)handle;
(void)looping;
return false;
}
void I_StopSong(void)
{
(void)handle;
}
void I_PauseSong(void)
{
(void)handle;
}
void I_ResumeSong(void)
{
(void)handle;
}
void I_SetMusicVolume(UINT8 volume)
{
(void)volume;
}
boolean I_SetSongTrack(int track)
{
(void)track;
return false;
}
}

View file

@ -1279,7 +1279,7 @@ static void F_AdvanceToNextScene(void)
void F_EndCutScene(void)
{
cutsceneover = true; // do this first, just in case Y_EndGame or something wants to turn it back false later
cutsceneover = true; // do this first, just in case G_EndGame or something wants to turn it back false later
if (runningprecutscene)
{
if (server)
@ -1294,7 +1294,7 @@ void F_EndCutScene(void)
else if (nextmap < 1100-1)
G_NextLevel();
else
Y_EndGame();
G_EndGame();
}
}

View file

@ -2621,10 +2621,10 @@ static boolean G_CheckSpot(INT32 playernum, mapthing_t *mthing)
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
if (!P_CheckPosition(players[playernum].mo, x, y))
if (!K_CheckPlayersRespawnColliding(playernum, x, y))
return false;
if (!K_CheckPlayersRespawnColliding(playernum, x, y))
if (!P_CheckPosition(players[playernum].mo, x, y))
return false;
return true;
@ -3065,7 +3065,7 @@ void G_ExitLevel(void)
CON_LogMessage(M_GetText("The round has ended.\n"));
// Remove CEcho text on round end.
HU_DoCEcho("");
HU_ClearCEcho();
}
}
@ -3561,14 +3561,20 @@ void G_AfterIntermission(void)
HU_ClearCEcho();
//G_NextLevel();
if (mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking) // Start a custom cutscene.
if (modeattacking) // End the run.
{
M_EndModeAttackRun();
return;
}
if (mapheaderinfo[gamemap-1]->cutscenenum) // Start a custom cutscene.
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->cutscenenum-1, false, false);
else
{
if (nextmap < 1100-1)
G_NextLevel();
else
Y_EndGame();
G_EndGame();
}
}
@ -3686,6 +3692,38 @@ static void G_DoContinued(void)
gameaction = ga_nothing;
}
//
// G_EndGame (formerly Y_EndGame)
// Frankly this function fits better in g_game.c than it does in y_inter.c
//
// ...Gee, (why) end the game?
// Because G_AfterIntermission and F_EndCutscene would
// both do this exact same thing *in different ways* otherwise,
// which made it so that you could only unlock Ultimate mode
// if you had a cutscene after the final level and crap like that.
// This function simplifies it so only one place has to be updated
// when something new is added.
void G_EndGame(void)
{
// Only do evaluation and credits in coop games.
if (gametype == GT_COOP)
{
if (nextmap == 1102-1) // end game with credits
{
F_StartCredits();
return;
}
if (nextmap == 1101-1) // end game with evaluation
{
F_StartGameEvaluation();
return;
}
}
// 1100 or competitive multiplayer, so go back to title screen.
D_StartTitle();
}
//
// G_LoadGameSettings
//

View file

@ -57,6 +57,9 @@ extern INT16 rw_maximums[NUM_WEAPONS];
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatspamprotection, cv_chatbacktint;
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove;
extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_mousemove2;
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis;
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2;
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3;
@ -205,6 +208,7 @@ void G_NextLevel(void);
void G_Continue(void);
void G_UseContinue(void);
void G_AfterIntermission(void);
void G_EndGame(void); // moved from y_inter.c/h and renamed
void G_Ticker(boolean run);
boolean G_Responder(event_t *ev);

View file

@ -126,6 +126,8 @@ typedef enum
// mouse values are used once
extern consvar_t cv_mousesens, cv_mouseysens;
extern consvar_t cv_mousesens2, cv_mouseysens2;
extern consvar_t cv_controlperkey;
extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity

View file

@ -361,7 +361,7 @@ INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, chan
if (splitscreen) listenmobj2 = players[secondarydisplayplayer].mo;
if (nosound)
if (sound_disabled)
return -1;
sfx = &S_sfx[sfx_id];

View file

@ -112,10 +112,10 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
if (option & V_NOSCALESTART)
sdupx = sdupy = 2.0f;
v[0].x = v[3].x = (x*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1;
v[2].x = v[1].x = (x*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1;
v[0].y = v[1].y = 1-(y*sdupy-gpatch->topoffset*pdupy)/vid.height;
v[2].y = v[3].y = 1-(y*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height;
v[0].x = v[3].x = (x*sdupx-SHORT(gpatch->leftoffset)*pdupx)/vid.width - 1;
v[2].x = v[1].x = (x*sdupx+(SHORT(gpatch->width)-SHORT(gpatch->leftoffset))*pdupx)/vid.width - 1;
v[0].y = v[1].y = 1-(y*sdupy-SHORT(gpatch->topoffset)*pdupy)/vid.height;
v[2].y = v[3].y = 1-(y*sdupy+(SHORT(gpatch->height)-SHORT(gpatch->topoffset))*pdupy)/vid.height;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
@ -179,18 +179,29 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
dupx = dupy = (dupx < dupy ? dupx : dupy);
fscale = FIXED_TO_FLOAT(pscale);
if (option & V_OFFSET)
// See my comments in v_video.c's V_DrawFixedPatch
// -- Monster Iestyn 29/10/18
{
cx -= (float)gpatch->leftoffset * dupx * fscale;
cy -= (float)gpatch->topoffset * dupy * fscale;
}
else
{
cy -= (float)gpatch->topoffset * fscale;
float offsetx = 0.0f, offsety = 0.0f;
// left offset
if (option & V_FLIP)
cx -= ((float)gpatch->width - (float)gpatch->leftoffset) * fscale;
offsetx = (float)(SHORT(gpatch->width) - SHORT(gpatch->leftoffset)) * fscale;
else
cx -= (float)gpatch->leftoffset * fscale;
offsetx = (float)SHORT(gpatch->leftoffset) * fscale;
// top offset
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
offsety = (float)SHORT(gpatch->topoffset) * fscale;
if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
{
offsetx *= dupx;
offsety *= dupy;
}
cx -= offsetx;
cy -= offsety;
}
if (option & V_SPLITSCREEN)
@ -240,13 +251,13 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
if (pscale != FRACUNIT)
{
fwidth = (float)gpatch->width * fscale * dupx;
fheight = (float)gpatch->height * fscale * dupy;
fwidth = (float)SHORT(gpatch->width) * fscale * dupx;
fheight = (float)SHORT(gpatch->height) * fscale * dupy;
}
else
{
fwidth = (float)gpatch->width * dupx;
fheight = (float)gpatch->height * dupy;
fwidth = (float)SHORT(gpatch->width) * dupx;
fheight = (float)SHORT(gpatch->height) * dupy;
}
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
@ -344,8 +355,8 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
dupx = dupy = (dupx < dupy ? dupx : dupy);
fscale = FIXED_TO_FLOAT(pscale);
cy -= (float)gpatch->topoffset * fscale;
cx -= (float)gpatch->leftoffset * fscale;
cy -= (float)SHORT(gpatch->topoffset) * fscale;
cx -= (float)SHORT(gpatch->leftoffset) * fscale;
if (!(option & V_NOSCALESTART))
{
@ -395,11 +406,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
if (fheight > h - sy)
fheight = h - sy;
if (fwidth > gpatch->width)
fwidth = gpatch->width;
if (fwidth > SHORT(gpatch->width))
fwidth = SHORT(gpatch->width);
if (fheight > gpatch->height)
fheight = gpatch->height;
if (fheight > SHORT(gpatch->height))
fheight = SHORT(gpatch->height);
if (pscale != FRACUNIT)
{
@ -429,10 +440,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].sow = v[3].sow = ((sx)/(float)gpatch->width )*gpatch->max_s;
v[2].sow = v[1].sow = ((w )/(float)gpatch->width )*gpatch->max_s;
v[0].tow = v[1].tow = ((sy)/(float)gpatch->height)*gpatch->max_t;
v[2].tow = v[3].tow = ((h )/(float)gpatch->height)*gpatch->max_t;
v[0].sow = v[3].sow = ((sx)/(float)SHORT(gpatch->width) )*gpatch->max_s;
v[2].sow = v[1].sow = ((w )/(float)SHORT(gpatch->width) )*gpatch->max_s;
v[0].tow = v[1].tow = ((sy)/(float)SHORT(gpatch->height))*gpatch->max_t;
v[2].tow = v[3].tow = ((h )/(float)SHORT(gpatch->height))*gpatch->max_t;
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;

View file

@ -108,8 +108,6 @@ static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics
// protos.
// -------
static void HU_DrawRankings(void);
//static void HU_DrawCoopOverlay(void);
//static void HU_DrawNetplayCoopOverlay(void);
//======================================================================
// KEYBOARD LAYOUTS FOR ENTERING TEXT
@ -2111,16 +2109,12 @@ void HU_Drawer(void)
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_rankings))
#endif
HU_DrawRankings();
//if (gametype == GT_COOP)
//HU_DrawNetplayCoopOverlay();
}
//else
//HU_DrawCoopOverlay();
HU_DrawRankings();
#ifdef HAVE_BLUA
LUAh_ScoresHUD();
#endif
}
}
}
if (gamestate != GS_LEVEL)
return;
@ -2706,65 +2700,6 @@ static void HU_DrawRankings(void)
HU_DrawSpectatorTicker();
}
/*static void HU_DrawCoopOverlay(void)
{
if (token
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_tokens)
#endif
)
{
V_DrawString(168, 176, 0, va("- %d", token));
V_DrawSmallScaledPatch(148, 172, 0, tokenicon);
}
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_tabemblems))
#endif
if (!modifiedgame || savemoddata)
{
V_DrawString(160, 144, 0, va("- %d/%d", M_CountEmblems(), numemblems+numextraemblems));
V_DrawScaledPatch(128, 144 - SHORT(emblemicon->height)/4, 0, emblemicon);
}
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_coopemeralds))
return;
#endif
if (emeralds & EMERALD1)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)-32, 0, emeraldpics[0]);
if (emeralds & EMERALD2)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[1]);
if (emeralds & EMERALD3)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[2]);
if (emeralds & EMERALD4)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)+32, 0, emeraldpics[3]);
if (emeralds & EMERALD5)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[4]);
if (emeralds & EMERALD6)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[5]);
if (emeralds & EMERALD7)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3) , 0, emeraldpics[6]);
}
static void HU_DrawNetplayCoopOverlay(void)
{
int i;
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_coopemeralds))
return;
#endif
for (i = 0; i < 7; ++i)
{
if (emeralds & (1 << i))
V_DrawScaledPatch(20 + (i * 20), 6, 0, emeraldpics[i]);
}
}*/
// Interface to CECHO settings for the outside world, avoiding the
// expense (and security problems) of going via the console buffer.
void HU_ClearCEcho(void)

View file

@ -18,6 +18,21 @@
#include "sounds.h"
#include "command.h"
// copied from SDL mixer, plus GME
typedef enum {
MU_NONE,
MU_CMD,
MU_WAV,
MU_MOD,
MU_MID,
MU_OGG,
MU_MP3,
MU_MP3_MAD_UNUSED, // use MU_MP3 instead
MU_FLAC,
MU_MODPLUG_UNUSED, // use MU_MOD instead
MU_GME
} musictype_t;
/** \brief Sound subsystem runing and waiting
*/
extern UINT8 sound_started;
@ -51,9 +66,9 @@ void I_StartupSound(void);
*/
void I_ShutdownSound(void);
//
// SFX I/O
//
/// ------------------------
/// SFX I/O
/// ------------------------
/** \brief Starts a sound in a particular sound channel.
\param id sfxid
@ -105,9 +120,10 @@ void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch);
*/
void I_SetSfxVolume(UINT8 volume);
//
// MUSIC I/O
//
/// ------------------------
// MUSIC SYSTEM
/// ------------------------
/** \brief Init the music systems
*/
void I_InitMusic(void);
@ -116,41 +132,23 @@ void I_InitMusic(void);
*/
void I_ShutdownMusic(void);
/** \brief PAUSE game handling.
/// ------------------------
// MUSIC PROPERTIES
/// ------------------------
\param handle song handle
musictype_t I_SongType(void);
boolean I_SongPlaying(void);
boolean I_SongPaused(void);
\return void
*/
void I_PauseSong(INT32 handle);
/// ------------------------
// MUSIC EFFECTS
/// ------------------------
/** \brief RESUME game handling
boolean I_SetSongSpeed(float speed);
\param handle song handle
\return void
*/
void I_ResumeSong(INT32 handle);
//
// MIDI I/O
//
/** \brief Startup the MIDI music system
*/
void I_InitMIDIMusic(void);
/** \brief Shutdown the MIDI music system
*/
void I_ShutdownMIDIMusic(void);
/** \brief The I_SetMIDIMusicVolume function
\param volume volume to set at
\return void
*/
void I_SetMIDIMusicVolume(UINT8 volume);
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
/** \brief Registers a song handle to song data.
@ -161,7 +159,16 @@ void I_SetMIDIMusicVolume(UINT8 volume);
\todo Remove this
*/
INT32 I_RegisterSong(void *data, size_t len);
boolean I_LoadSong(char *data, size_t len);
/** \brief See ::I_LoadSong, then think backwards
\param handle song handle
\sa I_LoadSong
\todo remove midi handle
*/
void I_UnloadSong(void);
/** \brief Called by anything that wishes to start music
@ -172,7 +179,7 @@ INT32 I_RegisterSong(void *data, size_t len);
\todo pass music name, not handle
*/
boolean I_PlaySong(INT32 handle, boolean looping);
boolean I_PlaySong(boolean looping);
/** \brief Stops a song over 3 seconds
@ -181,58 +188,37 @@ boolean I_PlaySong(INT32 handle, boolean looping);
/todo drop handle
*/
void I_StopSong(INT32 handle);
void I_StopSong(void);
/** \brief See ::I_RegisterSong, then think backwards
/** \brief PAUSE game handling.
\param handle song handle
\sa I_RegisterSong
\todo remove midi handle
\return void
*/
void I_UnRegisterSong(INT32 handle);
void I_PauseSong(void);
//
// DIGMUSIC I/O
//
/** \brief RESUME game handling
/** \brief Startup the music system
\param handle song handle
\return void
*/
void I_InitDigMusic(void);
void I_ResumeSong(void);
/** \brief Shutdown the music system
*/
void I_ShutdownDigMusic(void);
boolean I_SetSongSpeed(float speed);
boolean I_SetSongTrack(INT32 track);
/** \brief The I_StartDigSong function
\param musicname music lump name
\param looping if true, loop the song
\return if true, song playing
*/
boolean I_StartDigSong(const char *musicname, boolean looping);
/** \brief stop non-MIDI song
*/
void I_StopDigSong(void);
/** \brief The I_SetDigMusicVolume function
/** \brief The I_SetMusicVolume function
\param volume volume to set at
\return void
*/
void I_SetDigMusicVolume(UINT8 volume);
void I_SetMusicVolume(UINT8 volume);
//
// CD MUSIC I/O
//
boolean I_SetSongTrack(INT32 track);
/// ------------------------
// CD MUSIC I/O
/// ------------------------
/** \brief cd music interface
*/
@ -279,4 +265,4 @@ void I_PlayCD(UINT8 track, UINT8 looping);
*/
boolean I_SetVolumeCD(INT32 volume);
#endif
#endif

View file

@ -184,12 +184,12 @@ state_t states[NUMSTATES] =
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY
// 1-Up Box Sprites (uses player sprite)
// Kart: default to signpost just to ensure there are no missing sprite errors...
{SPR_PLAY, 18, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1
// Kart: hide for now, fix for R2
{SPR_NULL, 0, 2, {NULL}, 0, 16, S_PLAY_BOX2}, // S_PLAY_BOX1
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_PLAY_BOX1}, // S_PLAY_BOX2
{SPR_PLAY, 18, 4, {NULL}, 0, 4, S_PLAY_ICON2}, // S_PLAY_ICON1
{SPR_NULL, 0, 4, {NULL}, 0, 4, S_PLAY_ICON2}, // S_PLAY_ICON1
{SPR_NULL, 0, 12, {NULL}, 0, 0, S_PLAY_ICON3}, // S_PLAY_ICON2
{SPR_PLAY, 18, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3
{SPR_NULL, 0, 18, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3
// Level end sign (uses player sprite)
{SPR_PLAY, 18, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN S
@ -2850,16 +2850,6 @@ state_t states[NUMSTATES] =
{SPR_DEZL, FF_FULLBRIGHT|FF_PAPERSPRITE, 8, {NULL}, 0, 0, S_NULL}, // S_DEZLASER
{SPR_POKE, 0, 2, {A_MoveAbsolute}, 0, 2, S_POKEY2}, // S_POKEY1
{SPR_POKE, 1, 2, {A_MoveAbsolute}, 0, 2, S_POKEY3}, // S_POKEY2
{SPR_POKE, 2, 2, {A_MoveAbsolute}, 0, 2, S_POKEY4}, // S_POKEY3
{SPR_POKE, 3, 2, {A_MoveAbsolute}, 0, 2, S_POKEY1}, // S_POKEY4
{SPR_POKE, 0, 2, {A_MoveAbsolute}, 180, 2, S_POKEY6}, // S_POKEY5
{SPR_POKE, 1, 2, {A_MoveAbsolute}, 180, 2, S_POKEY7}, // S_POKEY6
{SPR_POKE, 2, 2, {A_MoveAbsolute}, 180, 2, S_POKEY8}, // S_POKEY7
{SPR_POKE, 3, 2, {A_MoveAbsolute}, 180, 2, S_POKEY5}, // S_POKEY8
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_POKEYIDLE
{SPR_NULL, 0, 1, {A_RandomStateRange}, S_AUDIENCE_CHAO_CHEER1, S_AUDIENCE_CHAO_CHEER2, S_RANDOMAUDIENCE}, // S_RANDOMAUDIENCE
{SPR_AUDI, 0, 5, {NULL}, 0, 0, S_AUDIENCE_CHAO_CHEER2}, // S_AUDIENCE_CHAO_CHEER1
@ -2870,15 +2860,6 @@ state_t states[NUMSTATES] =
{SPR_AUDI, 4|FF_ANIMATE, -1, {NULL}, 1, 17, S_NULL}, // S_AUDIENCE_CHAO_LOSE
{SPR_AUDI, 10, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_KOTE
{SPR_AUDI, 11, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_RYAN
{SPR_AUDI, 12, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_WENDY
{SPR_AUDI, 13, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_FREEZOR
{SPR_AUDI, 14, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_METALKO
{SPR_AUDI, 15, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_BLACKOUT
{SPR_AUDI, 16, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_BLADE
{SPR_AUDI, 17, -1, {NULL}, 0, 0, S_NULL}, // S_FANCHAR_HINOTE
{SPR_FLAM, 0, 3, {NULL}, 0, 0, S_FLAYM2}, // S_FLAYM1,
{SPR_FLAM, 1, 3, {NULL}, 0, 0, S_FLAYM3}, // S_FLAYM2,
{SPR_FLAM, 2, 3, {NULL}, 0, 0, S_FLAYM4}, // S_FLAYM3,
@ -16045,60 +16026,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_POKEY
2100, // doomednum
S_POKEY1, // spawnstate
1000, // spawnhealth
S_POKEY1, // seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
100, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
3, // speed
21*FRACUNIT, // radius
69*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE, // flags
S_NULL // raisestate
},
{ // MT_ENEMYFLIP
2101, // doomednum
S_NULL, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
100, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
8, // speed
32*FRACUNIT, // radius
64*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_WAYPOINT
2001, // doomednum
S_NULL, // spawnstate
@ -16153,222 +16080,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_FANCHAR_KOTE
1994, // doomednum
S_FANCHAR_KOTE, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FANCHAR_RYAN
1995, // doomednum
S_FANCHAR_RYAN, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FANCHAR_WENDY
1996, // doomednum
S_FANCHAR_WENDY, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FANCHAR_FREEZOR
1997, // doomednum
S_FANCHAR_FREEZOR, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FANCHAR_METALKO
1998, // doomednum
S_FANCHAR_METALKO, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FANCHAR_BLACKOUT
1999, // doomednum
S_FANCHAR_BLACKOUT, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FANCHAR_BLADE
1993, // doomednum
S_FANCHAR_BLADE, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FANCHAR_HINOTE
1992, // doomednum
S_FANCHAR_HINOTE, // spawnstate
-1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
1048576, // radius
3670016, // height
0, // display offset
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOTHINK|MF_NOBLOCKMAP|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_FLAYM
1479, // doomednum
S_FLAYM1, // spawnstate

View file

@ -3517,17 +3517,6 @@ typedef enum state
// DEZ Laser respawn
S_DEZLASER,
// Pokey
S_POKEY1,
S_POKEY2,
S_POKEY3,
S_POKEY4,
S_POKEY5,
S_POKEY6,
S_POKEY7,
S_POKEY8,
S_POKEYIDLE,
// Audience Members
S_RANDOMAUDIENCE,
S_AUDIENCE_CHAO_CHEER1,
@ -3536,15 +3525,6 @@ typedef enum state
S_AUDIENCE_CHAO_WIN2,
S_AUDIENCE_CHAO_LOSE,
S_FANCHAR_KOTE,
S_FANCHAR_RYAN,
S_FANCHAR_WENDY,
S_FANCHAR_FREEZOR,
S_FANCHAR_METALKO,
S_FANCHAR_BLACKOUT,
S_FANCHAR_BLADE,
S_FANCHAR_HINOTE,
// 1.0 Kart Decoratives
S_FLAYM1,
S_FLAYM2,
@ -4668,20 +4648,9 @@ typedef enum mobj_type
MT_DEZLASER,
MT_POKEY, // Huh, thought this was a default asset for some reason, guess not.
MT_ENEMYFLIP,
MT_WAYPOINT,
MT_RANDOMAUDIENCE,
MT_FANCHAR_KOTE,
MT_FANCHAR_RYAN,
MT_FANCHAR_WENDY,
MT_FANCHAR_FREEZOR,
MT_FANCHAR_METALKO,
MT_FANCHAR_BLACKOUT,
MT_FANCHAR_BLADE,
MT_FANCHAR_HINOTE,
MT_FLAYM,
MT_DEVIL,

View file

@ -20,6 +20,7 @@
#include "m_cond.h"
#include "k_kart.h"
#include "f_finale.h"
#include "lua_hud.h" // For Lua hud checks
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
@ -6509,6 +6510,11 @@ static boolean K_drawKartPositionFaces(void)
if (numplayersingame <= 1)
return true;
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_minirankings))
return false; // Don't proceed but still return true for free play above if HUD is disabled.
#endif
for (j = 0; j < numplayersingame; j++)
{
@ -7734,7 +7740,12 @@ void K_drawKartHUD(void)
K_drawKartFirstPerson();
if (splitscreen == 2) // Player 4 in 3P is the minimap :p
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minimap))
#endif
K_drawKartMinimap();
}
// Draw full screen stuff that turns off the rest of the HUD
if (mapreset && stplyr == &players[displayplayer])
@ -7759,25 +7770,45 @@ void K_drawKartHUD(void)
K_drawKartPlayerCheck();
if (splitscreen == 0 && cv_kartminimap.value)
K_drawKartMinimap(); // 3P splitscreen is handled above
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minimap))
#endif
K_drawKartMinimap(); // 3P splitscreen is handled above
}
// Draw the item window
K_drawKartItem();
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_item))
#endif
K_drawKartItem();
// Draw WANTED status
if (G_BattleGametype())
K_drawKartWanted();
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_wanted))
#endif
K_drawKartWanted();
}
// If not splitscreen, draw...
if (!splitscreen)
{
// Draw the timestamp
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, 0);
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_time))
#endif
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, 0);
if (!modeattacking)
{
// The top-four faces on the left
isfreeplay = K_drawKartPositionFaces();
/*#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minirankings))
#endif*/
isfreeplay = K_drawKartPositionFaces();
}
}
@ -7786,12 +7817,18 @@ void K_drawKartHUD(void)
if (G_RaceGametype()) // Race-only elements
{
// Draw the lap counter
K_drawKartLaps();
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_gametypeinfo))
#endif
K_drawKartLaps();
if (!splitscreen)
{
// Draw the speedometer
// TODO: Make a better speedometer.
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_speedometer))
#endif
K_drawKartSpeedometer();
}
@ -7800,18 +7837,27 @@ void K_drawKartHUD(void)
else if (!modeattacking)
{
// Draw the numerical position
K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_position))
#endif
K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
}
else //if (!(demoplayback && hu_showscores))
{
// Draw the input UI
K_drawInput();
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_position))
#endif
K_drawInput();
}
}
else if (G_BattleGametype()) // Battle-only
{
// Draw the hits left!
K_drawKartBumpersOrKarma();
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_gametypeinfo))
#endif
K_drawKartBumpersOrKarma();
}
}

View file

@ -13,26 +13,17 @@
enum hud {
hud_stagetitle = 0,
hud_textspectator,
// Singleplayer / Co-op
hud_score,
hud_time,
hud_rings,
hud_lives,
// Match / CTF / Tag / Ringslinger
hud_weaponrings,
hud_powerstones,
// NiGHTS mode
hud_nightslink,
hud_nightsdrill,
hud_nightsrings,
hud_nightsscore,
hud_nightstime,
hud_nightsrecords,
// TAB scores overlays
hud_rankings,
hud_coopemeralds,
hud_tokens,
hud_tabemblems,
hud_gametypeinfo,
hud_minimap,
hud_item,
hud_position,
hud_minirankings, // Rankings to the left
hud_wanted,
hud_speedometer,
hud_rankings, // Tab rankings
hud_MAX
};

View file

@ -39,25 +39,15 @@ static const char *const hud_disable_options[] = {
"stagetitle",
"textspectator",
"score",
"time",
"rings",
"lives",
"weaponrings",
"powerstones",
"nightslink",
"nightsdrill",
"nightsrings",
"nightsscore",
"nightstime",
"nightsrecords",
"gametypeinfo", // Bumpers / Karma / Laps depending on gametype
"minimap",
"item",
"position",
"minirankings", // Gametype rankings to the left
"wanted",
"speedometer",
"rankings",
"coopemeralds",
"tokens",
"tabemblems",
NULL};
enum hudinfo {
@ -584,6 +574,15 @@ static int libd_renderer(lua_State *L)
return 1;
}
// 30/10/18 Lat': Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int
// Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn
static int libd_getlocaltransflag(lua_State *L)
{
HUDONLY
lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V
return 1;
}
static luaL_Reg lib_draw[] = {
{"patchExists", libd_patchExists},
{"cachePatch", libd_cachePatch},
@ -601,6 +600,7 @@ static luaL_Reg lib_draw[] = {
{"dupx", libd_dupx},
{"dupy", libd_dupy},
{"renderer", libd_renderer},
{"localTransFlag", libd_getlocaltransflag},
{NULL, NULL}
};
@ -624,6 +624,18 @@ static int lib_huddisable(lua_State *L)
return 0;
}
// 30/10/18: Lat': How come this wasn't here before?
static int lib_hudenabled(lua_State *L)
{
enum hud option = luaL_checkoption(L, 1, NULL, hud_disable_options);
if (hud_enabled[option/8] & (1<<(option%8)))
lua_pushboolean(L, true);
else
lua_pushboolean(L, false);
return 1;
}
// add a HUD element for rendering
static int lib_hudadd(lua_State *L)
{
@ -648,6 +660,7 @@ static int lib_hudadd(lua_State *L)
static luaL_Reg lib_hud[] = {
{"enable", lib_hudenable},
{"disable", lib_huddisable},
{"enabled", lib_hudenabled},
{"add", lib_hudadd},
{NULL, NULL}
};

View file

@ -886,7 +886,7 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
LUA_PushUserdata(gL, &sectors[READUINT16(save_p)], META_SECTOR);
break;
case ARCH_MAPHEADER:
LUA_PushUserdata(gL, &sectors[READUINT16(save_p)], META_MAPHEADER);
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER);
break;
case ARCH_TEND:
return 1;

View file

@ -313,7 +313,9 @@ menu_t OP_OpenGLOptionsDef, OP_OpenGLFogDef, OP_OpenGLColorDef;
menu_t OP_SoundOptionsDef;
static void M_ToggleSFX(INT32 choice);
static void M_ToggleDigital(INT32 choice);
//static void M_ToggleMIDI(INT32 choice);
#ifndef NO_MIDI
static void M_ToggleMIDI(INT32 choice);
#endif
//static void M_RestartAudio(void);
//Misc
@ -5269,25 +5271,25 @@ static void M_DrawSkyRoom(void)
{
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
currentMenu->y+currentMenu->menuitems[0].alphaKey,
(nosound ? warningflags : highlightflags),
((nosound || sound_disabled) ? "OFF" : "ON"));
(sound_disabled ? warningflags : highlightflags),
(sound_disabled ? "OFF" : "ON"));
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
currentMenu->y+currentMenu->menuitems[2].alphaKey,
(nodigimusic ? warningflags : highlightflags),
((nodigimusic || digital_disabled) ? "OFF" : "ON"));
(digital_disabled ? warningflags : highlightflags),
(digital_disabled ? "OFF" : "ON"));
/*V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x,
currentMenu->y+currentMenu->menuitems[5].alphaKey,
(nomidimusic ? warningflags : highlightflags),
((nomidimusic || music_disabled) ? "OFF" : "ON"));*/
(midi_disabled ? warningflags : highlightflags),
(midi_disabled ? "OFF" : "ON"));*/
if (itemOn == 0)
lengthstring = 8*((nosound || sound_disabled) ? 3 : 2);
lengthstring = 8*(sound_disabled ? 3 : 2);
else if (itemOn == 2)
lengthstring = 8*((nodigimusic || digital_disabled) ? 3 : 2);
lengthstring = 8*(digital_disabled ? 3 : 2);
/*else if (itemOn == 5)
lengthstring = 8*((nomidimusic || music_disabled) ? 3 : 2);*/
lengthstring = 8*(midi_disabled ? 3 : 2);*/
}
for (i = 0; i < currentMenu->numitems; ++i)
@ -8931,29 +8933,18 @@ static void M_ToggleSFX(INT32 choice)
break;
}
if (nosound)
if (sound_disabled)
{
nosound = false;
I_StartupSound();
if (nosound) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value);//, cv_midimusicvolume.value);
sound_disabled = false;
S_InitSfxChannels(cv_soundvolume.value);
S_StartSound(NULL, sfx_strpst);
//M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING);
}
else
{
if (sound_disabled)
{
sound_disabled = false;
S_StartSound(NULL, sfx_strpst);
//M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING);
}
else
{
sound_disabled = true;
S_StopSounds();
//M_StartMessage(M_GetText("SFX Disabled\n"), NULL, MM_NOTHING);
}
sound_disabled = true;
S_StopSounds();
//M_StartMessage(M_GetText("SFX Disabled\n"), NULL, MM_NOTHING);
}
}
@ -8982,12 +8973,10 @@ static void M_ToggleDigital(INT32 choice)
break;
}
if (nodigimusic)
if (digital_disabled)
{
nodigimusic = false;
I_InitDigMusic();
if (nodigimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value);//, cv_midimusicvolume.value);
digital_disabled = false;
I_InitMusic();
S_StopMusic();
if (Playing())
P_RestoreMusic(&players[consoleplayer]);
@ -8997,25 +8986,36 @@ static void M_ToggleDigital(INT32 choice)
}
else
{
if (digital_disabled)
digital_disabled = true;
#ifndef NO_MIDI
if (S_MusicType() != MU_MID)
{
digital_disabled = false;
if (Playing())
P_RestoreMusic(&players[consoleplayer]);
if (midi_disabled)
S_StopMusic();
else
S_ChangeMusicInternal("titles", looptitle);
//M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
}
else
{
digital_disabled = true;
S_StopMusic();
//M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
{
char mmusic[7];
UINT16 mflags;
boolean looping;
if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic))
{
S_StopMusic();
S_ChangeMusic(mmusic, mflags, looping);
}
else
S_StopMusic();
}
}
#else
S_StopMusic();
#endif
//M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
}
}
/*static void M_ToggleMIDI(INT32 choice)
#ifndef NO_MIDI
static void M_ToggleMIDI(INT32 choice)
{
switch (choice)
{
@ -9039,37 +9039,42 @@ static void M_ToggleDigital(INT32 choice)
break;
}
if (nomidimusic)
if (midi_disabled)
{
nomidimusic = false;
I_InitMIDIMusic();
if (nomidimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
midi_disabled = false;
I_InitMusic();
if (Playing())
P_RestoreMusic(&players[consoleplayer]);
else
S_ChangeMusicInternal("_clear", false);
S_ChangeMusicInternal("titles", looptitle);
//M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
}
else
{
if (music_disabled)
midi_disabled = true;
if (S_MusicType() == MU_MID)
{
music_disabled = false;
if (Playing())
P_RestoreMusic(&players[consoleplayer]);
if (digital_disabled)
S_StopMusic();
else
S_ChangeMusicInternal("_clear", false);
//M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
}
else
{
music_disabled = true;
S_StopMusic();
//M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING);
{
char mmusic[7];
UINT16 mflags;
boolean looping;
if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic))
{
S_StopMusic();
S_ChangeMusic(mmusic, mflags, looping);
}
else
S_StopMusic();
}
}
//M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING);
}
}*/
}
#endif
/*static void M_RestartAudio(void)
{

View file

@ -19,6 +19,7 @@
#include "tables.h"
#include "d_event.h" // Screenshot responder
#include "command.h"
typedef enum {
MM_OFF = 0,
@ -28,6 +29,12 @@ typedef enum {
} moviemode_t;
extern moviemode_t moviemode;
extern consvar_t cv_screenshot_option, cv_screenshot_folder;
extern consvar_t cv_moviemode;
extern consvar_t cv_zlib_memory, cv_zlib_level, cv_zlib_strategy, cv_zlib_window_bits;
extern consvar_t cv_zlib_memorya, cv_zlib_levela, cv_zlib_strategya, cv_zlib_window_bitsa;
extern consvar_t cv_apng_delay;
void M_StartMovie(void);
void M_SaveFrame(void);
void M_StopMovie(void);

View file

@ -3150,13 +3150,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false;
}
// SRB2kart 011617 - Special Case for Pokey so it doesn't die.
if (target->type == MT_POKEY)
{
target->threshold = 1;
return false;
}
// Special case for Crawla Commander
if (target->type == MT_CRAWLACOMMANDER)
{

View file

@ -1112,25 +1112,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true;
}
if (thing->type == MT_POKEY)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (tmthing->type == MT_ENEMYFLIP)
{
if (tmthing->angle)
P_SetMobjState(thing, S_POKEY5);
else
P_SetMobjState(thing, S_POKEY1);
}
if (tmthing->type == MT_PLAYER && !thing->threshold)
P_DamageMobj(tmthing, thing, thing->target, 1);
}
//}
if ((thing->type == MT_FALLINGROCK && (tmthing->player || tmthing->type == MT_FALLINGROCK))
@ -1380,13 +1361,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
}*/
// check for special pickup
if (thing->flags & MF_SPECIAL && tmthing->player && thing->type != MT_POKEY)
if (thing->flags & MF_SPECIAL && tmthing->player)
{
P_TouchSpecialThing(thing, tmthing, true); // can remove thing
return true;
}
// check again for special pickup
if (tmthing->flags & MF_SPECIAL && thing->player && tmthing->type != MT_POKEY)
if (tmthing->flags & MF_SPECIAL && thing->player)
{
P_TouchSpecialThing(tmthing, thing, true); // can remove thing
return true;

View file

@ -10631,7 +10631,7 @@ void P_PrecipitationEffects(void)
if (!playeringame[displayplayer] || !players[displayplayer].mo)
return;
if (nosound || sound_disabled)
if (sound_disabled)
return; // Sound off? D'aw, no fun.
if (players[displayplayer].mo->subsector->sector->ceilingpic == skyflatnum)

View file

@ -8893,7 +8893,7 @@ static void P_CalcPostImg(player_t *player)
void P_DoTimeOver(player_t *player)
{
if (netgame && player->health > 0)
CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]);
CON_LogMessage(va(M_GetText("%s ran out of time.\n"), player_names[player-players]));
player->pflags |= PF_TIMEOVER;

View file

@ -164,6 +164,7 @@ void R_DrawSplat_8(void);
void R_DrawTranslucentSplat_8(void);
void R_DrawTranslucentSpan_8(void);
void R_Draw2sMultiPatchColumn_8(void);
void R_Draw2sMultiPatchTranslucentColumn_8(void);
void R_DrawFogSpan_8(void);
void R_DrawFogColumn_8(void);
void R_DrawColumnShadowed_8(void);

View file

@ -203,6 +203,103 @@ void R_Draw2sMultiPatchColumn_8(void)
}
}
void R_Draw2sMultiPatchTranslucentColumn_8(void)
{
INT32 count;
register UINT8 *dest;
register fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
if (count < 0) // Zero length, column does not exceed a pixel.
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height)
return;
#endif
// Framebuffer destination address.
// Use ylookup LUT to avoid multiply with ScreenWidth.
// Use columnofs LUT for subwindows?
//dest = ylookup[dc_yl] + columnofs[dc_x];
dest = &topleft[dc_yl*vid.width + dc_x];
count++;
// Determine scaling, which is the only mapping to be done.
fracstep = dc_iscale;
//frac = dc_texturemid + (dc_yl - centery)*fracstep;
frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep))*(!dc_hires);
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
// This is as fast as it gets.
{
register const UINT8 *source = dc_source;
register const UINT8 *transmap = dc_transmap;
register const lighttable_t *colormap = dc_colormap;
register INT32 heightmask = dc_texheight-1;
register UINT8 val;
if (dc_texheight & heightmask) // not a power of 2 -- killough
{
heightmask++;
heightmask <<= FRACBITS;
if (frac < 0)
while ((frac += heightmask) < 0);
else
while (frac >= heightmask)
frac -= heightmask;
do
{
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
// heightmask is the Tutti-Frutti fix
val = source[frac>>FRACBITS];
if (val != TRANSPARENTPIXEL)
*dest = *(transmap + (colormap[val]<<8) + (*dest));
dest += vid.width;
// Avoid overflow.
if (fracstep > 0x7FFFFFFF - frac)
frac += fracstep - heightmask;
else
frac += fracstep;
while (frac >= heightmask)
frac -= heightmask;
} while (--count);
}
else
{
while ((count -= 2) >= 0) // texture height is a power of 2
{
val = source[(frac>>FRACBITS) & heightmask];
if (val != TRANSPARENTPIXEL)
*dest = *(transmap + (colormap[val]<<8) + (*dest));
dest += vid.width;
frac += fracstep;
val = source[(frac>>FRACBITS) & heightmask];
if (val != TRANSPARENTPIXEL)
*dest = *(transmap + (colormap[val]<<8) + (*dest));
dest += vid.width;
frac += fracstep;
}
if (count & 1)
{
val = source[(frac>>FRACBITS) & heightmask];
if (val != TRANSPARENTPIXEL)
*dest = *(transmap + (colormap[val]<<8) + (*dest));
}
}
}
}
/** \brief The R_DrawShadeColumn_8 function
Experiment to make software go faster. Taken from the Boom source
*/

View file

@ -273,6 +273,8 @@ static void R_Render2sidedMultiPatchColumn(column_t *column)
if (colfunc == wallcolfunc)
twosmultipatchfunc();
else if (colfunc == fuzzcolfunc)
twosmultipatchtransfunc();
else
colfunc();
}

View file

@ -80,7 +80,9 @@ static consvar_t precachesound = {"precachesound", "Off", CV_SAVE, CV_OnOff, NUL
// actual general (maximum) sound & music volume, saved into the config
consvar_t cv_soundvolume = {"soundvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_digmusicvolume = {"digmusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_midimusicvolume = {"midimusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#ifndef NO_MIDI
consvar_t cv_midimusicvolume = {"midimusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
// number of channels available
#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
consvar_t cv_numChannels = {"snd_channels", "8", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
@ -226,7 +228,7 @@ void S_RegisterSoundStuff(void)
{
if (dedicated)
{
nosound = true;
sound_disabled = true;
return;
}
@ -404,7 +406,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
mobj_t *listenmobj3 = NULL;
mobj_t *listenmobj4 = NULL;
if (sound_disabled || !sound_started || nosound)
if (sound_disabled || !sound_started)
return;
// Don't want a sound? Okay then...
@ -849,7 +851,9 @@ void S_StopSound(void *origin)
//
static INT32 actualsfxvolume; // check for change through console
static INT32 actualdigmusicvolume;
//static INT32 actualmidimusicvolume;
#ifndef NO_MIDI
static INT32 actualmidimusicvolume;
#endif
void S_UpdateSounds(void)
{
@ -876,8 +880,10 @@ void S_UpdateSounds(void)
S_SetSfxVolume (cv_soundvolume.value);
if (actualdigmusicvolume != cv_digmusicvolume.value)
S_SetDigMusicVolume (cv_digmusicvolume.value);
//if (actualmidimusicvolume != cv_midimusicvolume.value)
//S_SetMIDIMusicVolume (cv_midimusicvolume.value);
#ifndef NO_MIDI
if (actualmidimusicvolume != cv_midimusicvolume.value)
S_SetMIDIMusicVolume (cv_midimusicvolume.value);
#endif
// We're done now, if we're not in a level.
if (gamestate != GS_LEVEL)
@ -892,7 +898,7 @@ void S_UpdateSounds(void)
return;
}
if (dedicated || nosound)
if (dedicated || sound_disabled)
return;
if (players[displayplayer].awayviewtics)
@ -1442,6 +1448,43 @@ void S_StartSoundName(void *mo, const char *soundname)
S_StartSound(mo, soundnum);
}
//
// Initializes sound stuff, including volume
// Sets channels, SFX volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_InitSfxChannels(INT32 sfxVolume)
{
INT32 i;
if (dedicated)
return;
S_SetSfxVolume(sfxVolume);
SetChannelsNum();
// Note that sounds have not been cached (yet).
for (i = 1; i < NUMSFX; i++)
{
S_sfx[i].usefulness = -1; // for I_GetSfx()
S_sfx[i].lumpnum = LUMPERROR;
}
// precache sounds if requested by cmdline, or precachesound var true
if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value))
{
// Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... "));
for (i = 1; i < NUMSFX; i++)
if (S_sfx[i].name)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
CONS_Printf(M_GetText(" pre-cached all sound data\n"));
}
}
/// ------------------------
/// Music
/// ------------------------
@ -1468,37 +1511,113 @@ const char *compat_special_music_slots[16] =
};
#endif
#define music_playing (music_name[0]) // String is empty if no music is playing
static char music_name[7]; // up to 6-character name
static lumpnum_t music_lumpnum; // lump number of music (used??)
static void *music_data; // music raw data
static INT32 music_handle; // once registered, the handle for the music
static void *music_data;
static UINT16 music_flags;
static boolean music_looping;
static boolean mus_paused = 0; // whether songs are mus_paused
/// ------------------------
/// Music Status
/// ------------------------
static boolean S_MIDIMusic(const char *mname, boolean looping)
boolean S_DigMusicDisabled(void)
{
/*lumpnum_t mlumpnum;
void *mdata;
INT32 mhandle;*/
return digital_disabled;
}
(void)looping;
boolean S_MIDIMusicDisabled(void)
{
return midi_disabled; // SRB2Kart: defined as "true" w/ NO_MIDI
}
/*if (nomidimusic || music_disabled)
return false; // didn't search.*/
boolean S_MusicDisabled(void)
{
return (midi_disabled && digital_disabled);
}
if (W_CheckNumForName(va("d_%s", mname)) == LUMPERROR)
boolean S_MusicPlaying(void)
{
return I_SongPlaying();
}
boolean S_MusicPaused(void)
{
return I_SongPaused();
}
musictype_t S_MusicType(void)
{
return I_SongType();
}
boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping)
{
if (!I_SongPlaying())
return false;
CONS_Alert(CONS_ERROR, "A MIDI Music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
return false;
strncpy(mname, music_name, 7);
mname[6] = 0;
*mflags = music_flags;
*looping = music_looping;
/*mlumpnum = W_GetNumForName(va("d_%s", mname));
return (boolean)mname[0];
}
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi)
{
return (
(checkDigi ? W_CheckNumForName(va("O_%s", mname)) != LUMPERROR : false)
|| (checkMIDI ? W_CheckNumForName(va("D_%s", mname)) != LUMPERROR : false)
);
}
/// ------------------------
/// Music Effects
/// ------------------------
boolean S_SpeedMusic(float speed)
{
return I_SetSongSpeed(speed);
}
/// ------------------------
/// Music Playback
/// ------------------------
static boolean S_LoadMusic(const char *mname)
{
lumpnum_t mlumpnum;
void *mdata;
if (S_MusicDisabled())
return false;
if (!S_DigMusicDisabled() && S_DigExists(mname))
mlumpnum = W_GetNumForName(va("o_%s", mname));
else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname))
mlumpnum = W_GetNumForName(va("d_%s", mname));
else if (S_DigMusicDisabled() && S_DigExists(mname))
{
CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n");
return false;
}
else if (S_MIDIMusicDisabled() && S_MIDIExists(mname))
{
#ifdef NO_MIDI
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
#else
CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n");
#endif
return false;
}
else
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname);
return false;
}
// load & register it
mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC);
mhandle = I_RegisterSong(mdata, W_LumpLength(mlumpnum));
#ifdef MUSSERV
if (msg_id != -1)
@ -1512,31 +1631,43 @@ static boolean S_MIDIMusic(const char *mname, boolean looping)
}
#endif
// play it
if (!I_PlaySong(mhandle, looping))
if (I_LoadSong(mdata, W_LumpLength(mlumpnum)))
{
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_data = mdata;
return true;
}
else
return false;
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = mlumpnum;
music_data = mdata;
music_handle = mhandle;
return true;*/
}
static boolean S_DigMusic(const char *mname, boolean looping)
static void S_UnloadMusic(void)
{
if (nodigimusic || digital_disabled)
return false; // try midi
I_UnloadSong();
if (!I_StartDigSong(mname, looping))
#ifndef HAVE_SDL //SDL uses RWOPS
Z_ChangeTag(music_data, PU_CACHE);
#endif
music_data = NULL;
music_name[0] = 0;
music_flags = 0;
music_looping = false;
}
static boolean S_PlayMusic(boolean looping)
{
if (S_MusicDisabled())
return false;
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = LUMPERROR;
music_data = NULL;
music_handle = 0;
if (!I_PlaySong(looping))
{
S_UnloadMusic();
return false;
}
S_InitMusicVolume(); // switch between digi and sequence volume
return true;
}
@ -1546,7 +1677,7 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
S_ClearSfx();
#endif
if (/*(nomidimusic || music_disabled) && */(nodigimusic || digital_disabled))
if (S_MusicDisabled())
return;
// No Music (empty string)
@ -1556,121 +1687,117 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
return;
}
if (strncmp(music_name, mmusic, 6))
if (strnicmp(music_name, mmusic, 6))
{
S_StopMusic(); // shutdown old music
if (!S_DigMusic(mmusic, looping) && !S_MIDIMusic(mmusic, looping))
if (!S_LoadMusic(mmusic))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic);
CONS_Alert(CONS_ERROR, "Music %.6s could not be loaded!\n", mmusic);
return;
}
music_flags = mflags;
music_looping = looping;
if (!S_PlayMusic(looping))
{
CONS_Alert(CONS_ERROR, "Music %.6s could not be played!\n", mmusic);
return;
}
}
I_SetSongTrack(mflags & MUSIC_TRACKMASK);
}
boolean S_SpeedMusic(float speed)
{
return I_SetSongSpeed(speed);
}
void S_StopMusic(void)
{
if (!music_playing)
if (!I_SongPlaying())
return;
if (mus_paused)
I_ResumeSong(music_handle);
if (!nodigimusic)
I_StopDigSong();
if (I_SongPaused())
I_ResumeSong();
S_SpeedMusic(1.0f);
I_StopSong(music_handle);
I_UnRegisterSong(music_handle);
#ifndef HAVE_SDL //SDL uses RWOPS
Z_ChangeTag(music_data, PU_CACHE);
#endif
music_data = NULL;
music_name[0] = 0;
I_StopSong();
S_UnloadMusic(); // for now, stopping also means you unload the song
}
void S_SetDigMusicVolume(INT32 volume)
//
// Stop and resume music, during game PAUSE.
//
void S_PauseAudio(void)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
if (I_SongPlaying() && !I_SongPaused())
I_PauseSong();
CV_SetValue(&cv_digmusicvolume, volume&31);
// pause cd music
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
I_PauseCD();
#else
I_StopCD();
#endif
}
void S_ResumeAudio(void)
{
if (I_SongPlaying() && I_SongPaused())
I_ResumeSong();
// resume cd music
I_ResumeCD();
}
void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume)
{
if (digvolume < 0)
digvolume = cv_digmusicvolume.value;
#ifdef NO_MIDI
(void)seqvolume;
#else
if (seqvolume < 0)
seqvolume = cv_midimusicvolume.value;
#endif
if (digvolume < 0 || digvolume > 31)
CONS_Alert(CONS_WARNING, "digmusicvolume should be between 0-31\n");
CV_SetValue(&cv_digmusicvolume, digvolume&31);
actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#ifndef NO_MIDI
if (seqvolume < 0 || seqvolume > 31)
CONS_Alert(CONS_WARNING, "midimusicvolume should be between 0-31\n");
CV_SetValue(&cv_midimusicvolume, seqvolume&31);
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
#endif
I_SetDigMusicVolume(volume&31);
#ifdef DJGPPDOS
digvolume = 31;
#ifndef NO_MIDI
seqvolume = 31;
#endif
#endif
switch(I_SongType())
{
#ifndef NO_MIDI
case MU_MID:
//case MU_MOD:
//case MU_GME:
I_SetMusicVolume(seqvolume&31);
break;
#endif
default:
I_SetMusicVolume(digvolume&31);
break;
}
}
/*void S_SetMIDIMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_midimusicvolume, volume&0x1f);
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
I_SetMIDIMusicVolume(volume&0x1f);
}*/
/// ------------------------
/// Init & Others
/// ------------------------
//
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume)
{
INT32 i;
if (dedicated)
return;
S_SetSfxVolume(sfxVolume);
S_SetDigMusicVolume(digMusicVolume);
//S_SetMIDIMusicVolume(midiMusicVolume);
SetChannelsNum();
// no sounds are playing, and they are not mus_paused
mus_paused = 0;
// Note that sounds have not been cached (yet).
for (i = 1; i < NUMSFX; i++)
{
S_sfx[i].usefulness = -1; // for I_GetSfx()
S_sfx[i].lumpnum = LUMPERROR;
}
// precache sounds if requested by cmdline, or precachesound var true
if (!nosound && (M_CheckParm("-precachesound") || precachesound.value))
{
// Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... "));
for (i = 1; i < NUMSFX; i++)
if (S_sfx[i].name)
S_sfx[i].data = I_GetSfx(&S_sfx[i]);
CONS_Printf(M_GetText(" pre-cached all sound data\n"));
}
}
//
// Per level startup code.
// Kills playing sounds at start of level,
@ -1685,46 +1812,7 @@ void S_Start(void)
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
}
mus_paused = 0;
if (cv_resetmusic.value)
S_StopMusic();
S_ChangeMusic(mapmusname, mapmusflags, true);
}
//
// Stop and resume music, during game PAUSE.
//
void S_PauseAudio(void)
{
if (!nodigimusic)
I_PauseSong(0);
if (music_playing && !mus_paused)
{
I_PauseSong(music_handle);
mus_paused = true;
}
// pause cd music
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
I_PauseCD();
#else
I_StopCD();
#endif
}
void S_ResumeAudio(void)
{
if (!nodigimusic)
I_ResumeSong(0);
else
if (music_playing && mus_paused)
{
I_ResumeSong(music_handle);
mus_paused = false;
}
// resume cd music
I_ResumeCD();
}

View file

@ -14,6 +14,7 @@
#ifndef __S_SOUND__
#define __S_SOUND__
#include "i_sound.h" // musictype_t
#include "sounds.h"
#include "m_fixed.h"
#include "command.h"
@ -70,9 +71,9 @@ void S_RegisterSoundStuff(void);
//
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume, allocates channel buffer, sets S_sfx lookup.
// Sets channels, SFX, allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume);
void S_InitSfxChannels(INT32 sfxVolume);
//
// Per level startup code.
@ -98,6 +99,33 @@ void S_StartSoundAtVolume(const void *origin, sfxenum_t sound_id, INT32 volume);
// Stop sound for thing at <origin>
void S_StopSound(void *origin);
//
// Music Status
//
boolean S_DigMusicDisabled(void);
boolean S_MIDIMusicDisabled(void);
boolean S_MusicDisabled(void);
boolean S_MusicPlaying(void);
boolean S_MusicPaused(void);
musictype_t S_MusicType(void);
boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping);
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
#define S_DigExists(a) S_MusicExists(a, false, true)
#define S_MIDIExists(a) S_MusicExists(a, true, false)
//
// Music Properties
//
// Set Speed of Music
boolean S_SpeedMusic(float speed);
//
// Music Routines
//
// Start music track, arbitrary, given its name, and set whether looping
// note: music flags 12 bits for tracknum (gme, other formats with more than one track)
// 13-15 aren't used yet
@ -105,9 +133,6 @@ void S_StopSound(void *origin);
#define S_ChangeMusicInternal(a,b) S_ChangeMusic(a,0,b)
void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping);
// Set Speed of Music
boolean S_SpeedMusic(float speed);
// Stops the music.
void S_StopMusic(void);
@ -122,9 +147,11 @@ void S_UpdateSounds(void);
FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
void S_SetDigMusicVolume(INT32 volume);
//void S_SetMIDIMusicVolume(INT32 volume);
void S_SetSfxVolume(INT32 volume);
void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume);
#define S_SetDigMusicVolume(a) S_SetMusicVolume(a,-1)
#define S_SetMIDIMusicVolume(a) S_SetMusicVolume(-1,a)
#define S_InitMusicVolume() S_SetMusicVolume(-1,-1)
INT32 S_OriginPlaying(void *origin);
INT32 S_IdPlaying(sfxenum_t id);

View file

@ -49,6 +49,7 @@ void (*splatfunc)(void); // span drawer w/ transparency
void (*basespanfunc)(void); // default span func for color mode
void (*transtransfunc)(void); // translucent translated column drawer
void (*twosmultipatchfunc)(void); // for cols with transparent pixels
void (*twosmultipatchtransfunc)(void); // for cols with transparent pixels AND translucency
// ------------------
// global video state
@ -127,6 +128,7 @@ void SCR_SetMode(void)
fuzzcolfunc = R_DrawTranslucentColumn_8;
walldrawerfunc = R_DrawWallColumn_8;
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8;
twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8;
#ifdef RUSEASM
if (R_ASM)
{

View file

@ -136,6 +136,7 @@ extern void (*basespanfunc)(void);
extern void (*splatfunc)(void);
extern void (*transtransfunc)(void);
extern void (*twosmultipatchfunc)(void);
extern void (*twosmultipatchtransfunc)(void);
// -----
// CPUID

View file

@ -608,7 +608,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
// Tell game we got focus back, resume music if necessary
window_notinfocus = false;
if (!paused)
I_ResumeSong(0); //resume it
I_ResumeSong(); //resume it
if (!firsttimeonmouse)
{
@ -620,7 +620,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
{
// Tell game we lost focus, pause music
window_notinfocus = true;
I_PauseSong(0);
I_PauseSong();
if (!disable_mouse)
{

View file

@ -34,6 +34,12 @@
(SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
#endif
// thanks alam for making the buildbots happy!
#if SDL_MIXER_VERSION_ATLEAST(2,0,2)
#define MUS_MP3_MAD MUS_MP3_MAD_UNUSED
#define MUS_MODPLUG MUS_MODPLUG_UNUSED
#endif
#ifdef HAVE_LIBGME
#include "gme/gme.h"
#define GME_TREBLE 5.0
@ -60,9 +66,8 @@
UINT8 sound_started = false;
static boolean midimode;
static Mix_Music *music;
static UINT8 music_volume, midi_volume, sfx_volume;
static UINT8 music_volume, sfx_volume;
static float loop_point;
static boolean songpaused;
@ -71,13 +76,20 @@ static Music_Emu *gme;
static INT32 current_track;
#endif
/// ------------------------
/// Audio System
/// ------------------------
void I_StartupSound(void)
{
I_Assert(!sound_started);
// EE inits audio first so we're following along.
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
CONS_Printf("SDL Audio already started\n");
{
CONS_Debug(DBG_DETAILED, "SDL Audio already started\n");
return;
}
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError());
@ -85,9 +97,8 @@ void I_StartupSound(void)
return;
}
midimode = false;
music = NULL;
music_volume = midi_volume = sfx_volume = 0;
music_volume = sfx_volume = 0;
#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG);
@ -128,6 +139,10 @@ void I_UpdateSound(void)
{
}
/// ------------------------
/// SFX
/// ------------------------
// this is as fast as I can possibly make it.
// sorry. more asm needed.
static Mix_Chunk *ds2chunk(void *stream)
@ -453,11 +468,10 @@ void I_SetSfxVolume(UINT8 volume)
sfx_volume = volume;
}
//
// Music
//
/// ------------------------
/// Music Hooks
/// ------------------------
// Music hooks
static void music_loop(void)
{
Mix_PlayMusic(music, 0);
@ -485,79 +499,100 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
}
#endif
void I_InitMusic(void)
/// ------------------------
/// Music System
/// ------------------------
FUNCMATH void I_InitMusic(void)
{
}
void I_ShutdownMusic(void)
{
I_ShutdownDigMusic();
I_ShutdownMIDIMusic();
I_UnloadSong();
}
void I_PauseSong(INT32 handle)
{
(void)handle;
Mix_PauseMusic();
songpaused = true;
}
/// ------------------------
/// Music Properties
/// ------------------------
void I_ResumeSong(INT32 handle)
{
(void)handle;
Mix_ResumeMusic();
songpaused = false;
}
//
// Digital Music
//
void I_InitDigMusic(void)
musictype_t I_SongType(void)
{
#ifdef HAVE_LIBGME
gme = NULL;
current_track = -1;
if (gme)
return MU_GME;
else
#endif
if (!music)
return MU_NONE;
else if (Mix_GetMusicType(music) == MUS_MID)
return MU_MID;
else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG)
return MU_MOD;
else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD)
return MU_MP3;
else
return (musictype_t)Mix_GetMusicType(music);
}
void I_ShutdownDigMusic(void)
boolean I_SongPlaying(void)
{
if (midimode)
return;
return (
#ifdef HAVE_LIBGME
(I_SongType() == MU_GME && gme) ||
#endif
(boolean)music
);
}
boolean I_SongPaused(void)
{
return songpaused;
}
/// ------------------------
/// Music Effects
/// ------------------------
boolean I_SetSongSpeed(float speed)
{
if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME
if (gme)
{
Mix_HookMusic(NULL, NULL);
gme_delete(gme);
gme = NULL;
SDL_LockAudio();
gme_set_tempo(gme, speed);
SDL_UnlockAudio();
return true;
}
#else
(void)speed;
#endif
if (!music)
return;
Mix_HookMusicFinished(NULL);
Mix_FreeMusic(music);
music = NULL;
return false;
}
boolean I_StartDigSong(const char *musicname, boolean looping)
/// ------------------------
/// Music Playback
/// ------------------------
boolean I_LoadSong(char *data, size_t len)
{
char *data;
size_t len;
lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname));
const char *key1 = "LOOP";
const char *key2 = "POINT=";
const char *key3 = "MS=";
const size_t key1len = strlen(key1);
const size_t key2len = strlen(key2);
const size_t key3len = strlen(key3);
char *p = data;
SDL_RWops *rw;
I_Assert(!music);
if (music
#ifdef HAVE_LIBGME
I_Assert(!gme);
|| gme
#endif
if (lumpnum == LUMPERROR)
return false;
midimode = false;
data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC);
len = W_LumpLength(lumpnum);
)
I_UnloadSong();
#ifdef HAVE_LIBGME
if ((UINT8)data[0] == 0x1F
@ -650,10 +685,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
else if (!gme_open_data(data, len, &gme, 44100))
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
gme_start_track(gme, 0);
current_track = 0;
gme_set_equalizer(gme, &eq);
Mix_HookMusic(mix_gme, gme);
return true;
}
#endif
@ -666,48 +698,75 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
if (!music)
{
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
return true;
return false;
}
// Find the OGG loop point.
loop_point = 0.0f;
if (looping)
while ((UINT32)(p - data) < len)
{
const char *key1 = "LOOP";
const char *key2 = "POINT=";
const char *key3 = "MS=";
const size_t key1len = strlen(key1);
const size_t key2len = strlen(key2);
const size_t key3len = strlen(key3);
char *p = data;
while ((UINT32)(p - data) < len)
if (strncmp(p++, key1, key1len))
continue;
p += key1len-1; // skip OOP (the L was skipped in strncmp)
if (!strncmp(p, key2, key2len)) // is it LOOPPOINT=?
{
if (strncmp(p++, key1, key1len))
continue;
p += key1len-1; // skip OOP (the L was skipped in strncmp)
if (!strncmp(p, key2, key2len)) // is it LOOPPOINT=?
{
p += key2len; // skip POINT=
loop_point = (float)((44.1L+atoi(p)) / 44100.0L); // LOOPPOINT works by sample count.
// because SDL_Mixer is USELESS and can't even tell us
// something simple like the frequency of the streaming music,
// we are unfortunately forced to assume that ALL MUSIC is 44100hz.
// This means a lot of tracks that are only 22050hz for a reasonable downloadable file size will loop VERY badly.
}
else if (!strncmp(p, key3, key3len)) // is it LOOPMS=?
{
p += key3len; // skip MS=
loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds.
// Everything that uses LOOPMS will work perfectly with SDL_Mixer.
}
// Neither?! Continue searching.
p += key2len; // skip POINT=
loop_point = (float)((44.1L+atoi(p)) / 44100.0L); // LOOPPOINT works by sample count.
// because SDL_Mixer is USELESS and can't even tell us
// something simple like the frequency of the streaming music,
// we are unfortunately forced to assume that ALL MUSIC is 44100hz.
// This means a lot of tracks that are only 22050hz for a reasonable downloadable file size will loop VERY badly.
}
else if (!strncmp(p, key3, key3len)) // is it LOOPMS=?
{
p += key3len; // skip MS=
loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds.
// Everything that uses LOOPMS will work perfectly with SDL_Mixer.
}
// Neither?! Continue searching.
}
return true;
}
void I_UnloadSong(void)
{
I_StopSong();
#ifdef HAVE_LIBGME
if (gme)
{
gme_delete(gme);
gme = NULL;
}
#endif
if (music)
{
Mix_FreeMusic(music);
music = NULL;
}
}
boolean I_PlaySong(boolean looping)
{
#ifdef HAVE_LIBGME
if (gme)
{
gme_start_track(gme, 0);
current_track = 0;
Mix_HookMusic(mix_gme, gme);
return true;
}
else
#endif
if (!music)
return false;
if (Mix_PlayMusic(music, looping && loop_point == 0.0f ? -1 : 0) == -1)
{
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
return true;
return false;
}
Mix_VolumeMusic((UINT32)music_volume*128/31);
@ -716,51 +775,49 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
return true;
}
void I_StopDigSong(void)
void I_StopSong(void)
{
if (midimode)
return;
#ifdef HAVE_LIBGME
if (gme)
{
Mix_HookMusic(NULL, NULL);
gme_delete(gme);
gme = NULL;
current_track = -1;
return;
}
#endif
if (!music)
return;
Mix_HookMusicFinished(NULL);
Mix_FreeMusic(music);
music = NULL;
}
void I_SetDigMusicVolume(UINT8 volume)
{
music_volume = volume;
if (midimode || !music)
return;
Mix_VolumeMusic((UINT32)volume*128/31);
}
boolean I_SetSongSpeed(float speed)
{
if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME
if (gme)
if (music)
{
SDL_LockAudio();
gme_set_tempo(gme, speed);
SDL_UnlockAudio();
return true;
Mix_HookMusicFinished(NULL);
Mix_HaltMusic();
}
#else
(void)speed;
}
void I_PauseSong(void)
{
Mix_PauseMusic();
songpaused = true;
}
void I_ResumeSong(void)
{
Mix_ResumeMusic();
songpaused = false;
}
void I_SetMusicVolume(UINT8 volume)
{
if (!I_SongPlaying())
return;
#ifdef _WIN32
if (I_SongType() == MU_MID)
// HACK: Until we stop using native MIDI,
// disable volume changes
music_volume = 31;
else
#endif
return false;
music_volume = volume;
Mix_VolumeMusic((UINT32)music_volume*128/31);
}
boolean I_SetSongTrack(int track)
@ -794,83 +851,4 @@ boolean I_SetSongTrack(int track)
return false;
}
//
// MIDI Music
//
void I_InitMIDIMusic(void)
{
}
void I_ShutdownMIDIMusic(void)
{
if (!midimode || !music)
return;
Mix_FreeMusic(music);
music = NULL;
}
void I_SetMIDIMusicVolume(UINT8 volume)
{
// HACK: Until we stop using native MIDI,
// disable volume changes
(void)volume;
midi_volume = 31;
//midi_volume = volume;
if (!midimode || !music)
return;
Mix_VolumeMusic((UINT32)midi_volume*128/31);
}
INT32 I_RegisterSong(void *data, size_t len)
{
SDL_RWops *rw = SDL_RWFromMem(data, len);
if (rw != NULL)
{
music = Mix_LoadMUS_RW(rw, 1);
}
if (!music)
{
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
return -1;
}
return 1337;
}
boolean I_PlaySong(INT32 handle, boolean looping)
{
(void)handle;
midimode = true;
if (Mix_PlayMusic(music, looping ? -1 : 0) == -1)
{
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
return false;
}
Mix_VolumeMusic((UINT32)midi_volume*128/31);
return true;
}
void I_StopSong(INT32 handle)
{
if (!midimode || !music)
return;
(void)handle;
Mix_HaltMusic();
}
void I_UnRegisterSong(INT32 handle)
{
if (!midimode || !music)
return;
(void)handle;
Mix_FreeMusic(music);
music = NULL;
}
#endif

View file

@ -194,8 +194,8 @@ static srb2audio_t localdata;
static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio callback
{
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
else if (nosound) return;
else if (nomidimusic && nodigimusic
else if (sound_disabled) return;
else if (midi_disabled && digital_disabled
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
#endif
@ -208,8 +208,8 @@ static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio call
static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio callback
{
if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
else if (nosound) return;
else if (nomidimusic && nodigimusic
else if (sound_disabled) return;
else if (midi_disabled && digital_disabled
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
#endif
@ -493,7 +493,7 @@ static inline void I_SetChannels(void)
INT32 *steptablemid = steptable + 128;
if (nosound)
if (sound_disabled)
return;
// This table provides step widths for pitch parameters.
@ -610,7 +610,7 @@ INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priori
(void)pitch;
(void)channel;
if (nosound)
if (sound_disabled)
return 0;
if (S_sfx[id].data == NULL) return -1;
@ -990,7 +990,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len)
if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
}
#ifdef HAVE_LIBGME
#if 0 //#ifdef HAVE_LIBGME
static void I_UpdateSteamGME(Music_Emu *emu, INT16 *stream, int len, UINT8 looping)
{
#define GME_BUFFER_LEN 44100*2048
@ -1050,14 +1050,16 @@ static void SDLCALL I_UpdateStream(void *userdata, Uint8 *stream, int len)
else if (audio.channels == 2 && audio.format == AUDIO_S16SYS)
{
I_UpdateStream16S(stream, len);
#ifdef HAVE_LIBGME
if (userdata)
{
srb2audio_t *sa_userdata = userdata;
if (!sa_userdata->gme_pause)
I_UpdateSteamGME(sa_userdata->gme_emu, (INT16 *)stream, len/4, sa_userdata->gme_loop);
}
#endif
// Crashes! But no matter; this build doesn't play music anyway...
// #ifdef HAVE_LIBGME
// if (userdata)
// {
// srb2audio_t *sa_userdata = userdata;
// if (!sa_userdata->gme_pause)
// I_UpdateSteamGME(sa_userdata->gme_emu, (INT16 *)stream, len/4, sa_userdata->gme_loop);
// }
// #endif
}
}
@ -1137,7 +1139,7 @@ static INT32 Init3DSDriver(const char *soName)
void I_ShutdownSound(void)
{
if (nosound || !sound_started)
if (sound_disabled || !sound_started)
return;
CONS_Printf("I_ShutdownSound: ");
@ -1151,7 +1153,7 @@ void I_ShutdownSound(void)
}
#endif
if (nomidimusic && nodigimusic)
if (midi_disabled && digital_disabled)
SDL_CloseAudio();
CONS_Printf("%s", M_GetText("shut down\n"));
sound_started = false;
@ -1171,7 +1173,7 @@ void I_StartupSound(void)
const char *sdrv_name = NULL;
#endif
#ifndef HAVE_MIXER
nomidimusic = nodigimusic = true;
midi_disabled = digital_disabled = true;
#endif
memset(channels, 0, sizeof (channels)); //Alam: Clean it
@ -1214,7 +1216,7 @@ void I_StartupSound(void)
audio.samples /= 2;
}
if (nosound)
if (sound_disabled)
return;
#ifdef HW3SOUND
@ -1262,7 +1264,7 @@ void I_StartupSound(void)
{
snddev_t snddev;
//nosound = true;
//sound_disabled = true;
//I_AddExitFunc(I_ShutdownSound);
snddev.bps = 16;
snddev.sample_rate = audio.freq;
@ -1289,7 +1291,7 @@ void I_StartupSound(void)
if (!musicStarted && SDL_OpenAudio(&audio, &audio) < 0)
{
CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
nosound = true;
sound_disabled = true;
return;
}
else
@ -1314,13 +1316,11 @@ void I_StartupSound(void)
// MUSIC API.
//
void I_ShutdownMIDIMusic(void)
{
nomidimusic = false;
if (nodigimusic) I_ShutdownMusic();
}
/// ------------------------
// MUSIC SYSTEM
/// ------------------------
#ifdef HAVE_LIBGME
#if 0 //#ifdef HAVE_LIBGME
static void I_ShutdownGMEMusic(void)
{
Snd_LockAudio();
@ -1331,391 +1331,127 @@ static void I_ShutdownGMEMusic(void)
}
#endif
void I_ShutdownDigMusic(void)
{
nodigimusic = false;
if (nomidimusic) I_ShutdownMusic();
}
#ifdef HAVE_MIXER
static boolean LoadSong(void *data, size_t lumplength, size_t selectpos)
{
FILE *midfile;
const char *tempname;
#ifdef USE_RWOPS
if (canuseRW)
{
SDL_RWops *SDLRW;
void *olddata = Smidi[selectpos]; //quick shortcut to set
Z_Free(olddata); //free old memory
Smidi[selectpos] = NULL;
if (!data)
return olddata != NULL; //was there old data?
SDLRW = SDL_RWFromConstMem(data, (int)lumplength); //new RWops from Z_zone
if (!SDLRW) //ERROR while making RWops!
{
CONS_Printf(M_GetText("Couldn't load music lump: %s\n"), SDL_GetError());
Z_Free(data);
return false;
}
music[selectpos] = Mix_LoadMUS_RW(SDLRW); // new Mix_Chuck from RWops
if (music[selectpos])
Smidi[selectpos] = data; //all done
else //ERROR while making Mix_Chuck
{
CONS_Printf(M_GetText("Couldn't load music data: %s\n"), Mix_GetError());
Z_Free(data);
SDL_RWclose(SDLRW);
Smidi[selectpos] = NULL;
}
return true;
}
#endif
tempname = va("%s/%s", MIDI_PATH, fmidi[selectpos]);
if (!data)
{
if (FIL_FileExists(tempname))
return unlink(tempname)+1;
#ifdef MIDI_PATH2
else if (FIL_FileExists(tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos])))
return unlink(tempname)+1;
#endif
else
return false;
}
midfile = fopen(tempname, "wb");
#ifdef MIDI_PATH2
if (!midfile)
{
tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos]);
midfile = fopen(tempname, "wb");
}
#endif
if (!midfile)
{
CONS_Printf(M_GetText("Couldn't open file %s to write music in\n"), tempname);
Z_Free(data);
return false;
}
if (fwrite(data, lumplength, 1, midfile) == 0)
{
CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, strerror(ferror(midfile)));
Z_Free(data);
fclose(midfile);
return false;
}
fclose(midfile);
Z_Free(data);
music[selectpos] = Mix_LoadMUS(tempname);
if (!music[selectpos]) //ERROR while making Mix_Chuck
{
CONS_Printf(M_GetText("Couldn't load music file %s: %s\n"), tempname, Mix_GetError());
return false;
}
return true;
}
#endif
void I_ShutdownMusic(void)
{
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
return;
CONS_Printf("%s", M_GetText("I_ShutdownMusic: "));
I_UnRegisterSong(0);
I_StopDigSong();
Mix_CloseAudio();
#ifdef MIX_INIT
Mix_Quit();
#endif
CONS_Printf("%s", M_GetText("shut down\n"));
musicStarted = SDL_FALSE;
if (Msc_Mutex)
SDL_DestroyMutex(Msc_Mutex);
Msc_Mutex = NULL;
#endif
}
void I_InitMIDIMusic(void)
{
if (nodigimusic) I_InitMusic();
}
void I_InitDigMusic(void)
{
if (nomidimusic) I_InitMusic();
}
void I_InitMusic(void)
{
#ifdef HAVE_MIXER
char ad[100];
SDL_version MIXcompiled;
const SDL_version *MIXlinked;
#ifdef MIXER_INIT
const int mixstart = MIX_INIT_OGG;
int mixflags;
#endif
#endif
#ifdef HAVE_LIBGME
#if 0 //#ifdef HAVE_LIBGME
I_AddExitFunc(I_ShutdownGMEMusic);
#endif
#ifdef HAVE_MIXER
MIX_VERSION(&MIXcompiled)
MIXlinked = Mix_Linked_Version();
I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n",
MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch);
#ifdef MIXER_POS
if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7)
canlooping = SDL_FALSE;
#endif
#ifdef USE_RWOPS
if (M_CheckParm("-noRW"))
canuseRW = SDL_FALSE;
#endif
I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n",
MIXlinked->major, MIXlinked->minor, MIXlinked->patch);
if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz
{
audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq));
audio.freq = 44100; //Alam: to keep it around the same XX ms
}
if (sound_started
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
#endif
)
{
I_OutputMsg("Temp Shutdown of SDL Audio System");
SDL_CloseAudio();
I_OutputMsg(" Done\n");
}
CONS_Printf("%s", M_GetText("I_InitMusic:"));
#ifdef MIXER_INIT
mixflags = Mix_Init(mixstart);
if ((mixstart & MIX_INIT_FLAC) != (mixflags & MIX_INIT_FLAC))
{
CONS_Printf("%s", M_GetText(" Unable to load FLAC support\n"));
}
if ((mixstart & MIX_INIT_MOD ) != (mixflags & MIX_INIT_MOD ))
{
CONS_Printf("%s", M_GetText(" Unable to load MOD support\n"));
}
if ((mixstart & MIX_INIT_MP3 ) != (mixflags & MIX_INIT_MP3 ))
{
CONS_Printf("%s", M_GetText(" Unable to load MP3 support\n"));
}
if ((mixstart & MIX_INIT_OGG ) != (mixflags & MIX_INIT_OGG ))
{
CONS_Printf("%s", M_GetText(" Unable to load OGG support\n"));
}
#endif
if (Mix_OpenAudio(audio.freq, audio.format, audio.channels, audio.samples) < 0) //open_music(&audio)
{
CONS_Printf(M_GetText(" Unable to open music: %s\n"), Mix_GetError());
nomidimusic = nodigimusic = true;
if (sound_started
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
#endif
)
{
if (SDL_OpenAudio(&audio, NULL) < 0) //retry
{
CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
nosound = true;
sound_started = false;
}
else
{
CONS_Printf(M_GetText(" Starting with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
}
}
return;
}
else
CONS_Printf(M_GetText(" Starting up with audio driver : %s with SDL_Mixer\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
samplecount = audio.samples;
CV_SetValue(&cv_samplerate, audio.freq);
if (sound_started
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
#endif
)
I_OutputMsg(" Reconfigured SDL Audio System");
else I_OutputMsg(" Configured SDL_Mixer System");
I_OutputMsg(" with %d samples/slice at %ikhz(%dms buffer)\n", samplecount, audio.freq/1000, (INT32) ((audio.samples * 1000.0f) / audio.freq));
Mix_SetPostMix(audio.callback, audio.userdata); // after mixing music, add sound effects
Mix_Resume(-1);
CONS_Printf("%s", M_GetText("Music initialized\n"));
musicStarted = SDL_TRUE;
Msc_Mutex = SDL_CreateMutex();
#endif
}
boolean I_PlaySong(INT32 handle, boolean looping)
void I_ShutdownMusic(void) { }
/// ------------------------
// MUSIC PROPERTIES
/// ------------------------
musictype_t I_SongType(void)
{
(void)handle;
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted || !music[handle])
return false;
return MU_NONE;
}
#ifdef MIXER_POS
if (canlooping)
Mix_HookMusicFinished(NULL);
#endif
if (Mix_FadeInMusic(music[handle], looping ? -1 : 0, MIDIfade) == -1)
CONS_Printf(M_GetText("Couldn't play song because %s\n"), Mix_GetError());
else
{
Mix_VolumeMusic(musicvol);
return true;
}
#else
(void)looping;
#endif
boolean I_SongPlaying(void)
{
return false;
}
boolean I_SongPaused(void)
{
return false;
}
/// ------------------------
// MUSIC EFFECTS
/// ------------------------
boolean I_SetSongSpeed(float speed)
{
(void)speed;
return false;
}
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
#if 0 //#ifdef HAVE_LIBGME
static void I_StopGME(void)
{
Snd_LockAudio();
gme_seek(localdata.gme_emu, 0);
Snd_UnlockAudio();
}
static void I_PauseGME(void)
{
#ifdef HAVE_LIBGME
localdata.gme_pause = true;
#endif
}
void I_PauseSong(INT32 handle)
{
(void)handle;
I_PauseGME();
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
return;
Mix_PauseMusic();
//I_StopSong(handle);
#endif
}
static void I_ResumeGME(void)
{
#ifdef HAVE_LIBGME
localdata.gme_pause = false;
#endif
}
void I_ResumeSong(INT32 handle)
{
(void)handle;
I_ResumeGME();
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
return;
Mix_VolumeMusic(musicvol);
Mix_ResumeMusic();
//I_PlaySong(handle, true);
#endif
}
void I_StopSong(INT32 handle)
boolean I_LoadSong(char *data, size_t len)
{
(void)handle;
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted)
return;
Mix_FadeOutMusic(MIDIfade);
#endif
}
void I_UnRegisterSong(INT32 handle)
{
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted)
return;
Mix_HaltMusic();
while (Mix_PlayingMusic())
;
if (music[handle])
Mix_FreeMusic(music[handle]);
music[handle] = NULL;
LoadSong(NULL, 0, handle);
#else
(void)handle;
#endif
}
INT32 I_RegisterSong(void *data, size_t len)
{
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted)
return false;
if (!LoadSong(data, len, 0))
return false;
if (music[0])
return true;
CONS_Printf(M_GetText("Couldn't load MIDI: %s\n"), Mix_GetError());
#else
(void)len;
(void)data;
#endif
return false;
}
void I_SetMIDIMusicVolume(UINT8 volume)
{
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
return;
void I_UnloadSong(void) { }
if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
musicvol = volume * 2;
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
Mix_VolumeMusic(musicvol);
#else
(void)volume;
boolean I_PlaySong(boolean looping)
{
(void)looping;
return false;
}
void I_StopSong(void)
{
#if 0 //#ifdef HAVE_LIBGME
I_StopGME();
#endif
}
#ifdef HAVE_LIBGME
void I_PauseSong(void)
{
#if 0 //#ifdef HAVE_LIBGME
I_PauseGME();
#endif
}
void I_ResumeSong(void)
{
#if 0
I_ResumeGME();
#endif
}
void I_SetMusicVolume(UINT8 volume)
{
(void)volume;
}
boolean I_SetSongTrack(int track)
{
(void)track;
return false;
}
/// ------------------------
// MUSIC LOADING AND CLEANUP
// \todo Split logic between loading and playing,
// then move to Playback section
/// ------------------------
#if 0 //#ifdef HAVE_LIBGME
static void I_CleanupGME(void *userdata)
{
Z_Free(userdata);
}
#endif
static boolean I_StartGMESong(const char *musicname, boolean looping)
{
#ifdef HAVE_LIBGME
XBOXSTATIC char filename[9];
char filename[9];
void *data;
lumpnum_t lumpnum;
size_t lumplength;
@ -1760,240 +1496,7 @@ static boolean I_StartGMESong(const char *musicname, boolean looping)
Snd_UnlockAudio();
return true;
#else
(void)musicname;
(void)looping;
#endif
return false;
}
boolean I_StartDigSong(const char *musicname, boolean looping)
{
#ifdef HAVE_MIXER
XBOXSTATIC char filename[9];
void *data;
lumpnum_t lumpnum;
size_t lumplength;
#endif
if(I_StartGMESong(musicname, looping))
return true;
#ifdef HAVE_MIXER
if (nodigimusic)
return false;
snprintf(filename, sizeof filename, "o_%s", musicname);
lumpnum = W_CheckNumForName(filename);
I_StopDigSong();
if (lumpnum == LUMPERROR)
{
// Alam_GBC: like in win32/win_snd.c: Graue 02-29-2004: don't worry about missing music, there might still be a MIDI
//I_OutputMsg("Music lump %s not found!\n", filename);
return false; // No music found. Oh well!
}
else
lumplength = W_LumpLength(lumpnum);
data = W_CacheLumpNum(lumpnum, PU_MUSIC);
if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
#ifdef MIXER_POS
if (canlooping && (loopingDig = looping) == SDL_TRUE && strcmp(data, "OggS") == 0)
looping = false; // Only on looping Ogg files, will we will do our own looping
// Scan the Ogg Vorbis file for the COMMENT= field for a custom
// loop point
if (!looping && loopingDig)
{
size_t scan;
const char *dataum = data;
XBOXSTATIC char looplength[64];
UINT32 loopstart = 0;
UINT8 newcount = 0;
Mix_HookMusicFinished(I_FinishMusic);
for (scan = 0; scan < lumplength; scan++)
{
if (*dataum++ == 'C'){
if (*dataum++ == 'O'){
if (*dataum++ == 'M'){
if (*dataum++ == 'M'){
if (*dataum++ == 'E'){
if (*dataum++ == 'N'){
if (*dataum++ == 'T'){
if (*dataum++ == '='){
if (*dataum++ == 'L'){
if (*dataum++ == 'O'){
if (*dataum++ == 'O'){
if (*dataum++ == 'P'){
if (*dataum++ == 'P'){
if (*dataum++ == 'O'){
if (*dataum++ == 'I'){
if (*dataum++ == 'N'){
if (*dataum++ == 'T'){
if (*dataum++ == '=')
{
while (*dataum != 1 && newcount != 63)
looplength[newcount++] = *dataum++;
looplength[newcount] = '\0';
loopstart = atoi(looplength);
}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
else
dataum--;}
}
if (loopstart > 0)
{
loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs
//#ifdef PARANOIA
//I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig);
//#endif
}
else
{
looping = true; // loopingDig true, but couldn't find start loop point
}
}
else
loopstartDig = 0.0l;
#else
if (looping && strcmp(data, "OggS") == 0)
I_OutputMsg("I_StartDigSong: SRB2Kart was not compiled with looping music support(no Mix_FadeInMusicPos)\n");
#endif
if (!LoadSong(data, lumplength, 1))
{
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
return false;
}
// Note: LoadSong() frees the data. Let's make sure
// we don't try to use the data again.
data = NULL;
if (Mix_FadeInMusic(music[1], looping ? -1 : 0, Digfade) == -1)
{
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
I_OutputMsg("I_StartDigSong: Couldn't play song %s because %s\n", musicname, Mix_GetError());
return false;
}
Mix_VolumeMusic(musicvol);
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
return true;
#else
(void)looping;
(void)musicname;
return false;
#endif
}
static void I_StopGME(void)
{
#ifdef HAVE_LIBGME
Snd_LockAudio();
gme_seek(localdata.gme_emu, 0);
Snd_UnlockAudio();
#endif
}
void I_StopDigSong(void)
{
I_StopGME();
#ifdef HAVE_MIXER
if (nodigimusic)
return;
#ifdef MIXER_POS
if (canlooping)
Mix_HookMusicFinished(NULL);
#endif
Mix_HaltMusic();
while (Mix_PlayingMusic())
;
if (music[1])
Mix_FreeMusic(music[1]);
music[1] = NULL;
LoadSong(NULL, 0, 1);
#endif
}
void I_SetDigMusicVolume(UINT8 volume)
{
I_SetMIDIMusicVolume(volume);
}
boolean I_SetSongSpeed(float speed)
{
(void)speed;
return false;
}
boolean I_SetSongTrack(int track)
{
(void)track;
return false;
}
#ifdef MIXER_POS
static void SDLCALL I_FinishMusic(void)
{
if (!music[1])
return;
else if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
// I_OutputMsg("I_FinishMusic: Loopping song to %g seconds\n", loopstartDig);
if (Mix_FadeInMusicPos(music[1], loopstartDig ? 0 : -1, Digfade, loopstartDig) == 0)
Mix_VolumeMusic(musicvol);
else
I_OutputMsg("I_FinishMusic: Couldn't loop song because %s\n", Mix_GetError());
if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
}
#endif
#endif //HAVE_SDL

View file

@ -335,7 +335,6 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
{
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
UINT32 alphalevel = 0;
boolean flip = false;
fixed_t col, ofs, colfrac, rowfrac, fdup;
INT32 dupx, dupy;
@ -410,22 +409,32 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
colfrac = FixedDiv(FRACUNIT, fdup);
rowfrac = FixedDiv(FRACUNIT, fdup);
if (scrn & V_OFFSET) // Crosshair shit
// So it turns out offsets aren't scaled in V_NOSCALESTART unless V_OFFSET is applied ...poo, that's terrible
// For now let's just at least give V_OFFSET the ability to support V_FLIP
// I'll probably make a better fix for 2.2 where I don't have to worry about breaking existing support for stuff
// -- Monster Iestyn 29/10/18
{
y -= FixedMul((SHORT(patch->topoffset)*dupy)<<FRACBITS, pscale);
x -= FixedMul((SHORT(patch->leftoffset)*dupx)<<FRACBITS, pscale);
}
else
{
y -= FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
fixed_t offsetx = 0, offsety = 0;
// left offset
if (scrn & V_FLIP)
{
flip = true;
x -= FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
}
offsetx = FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
else
x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
offsetx = FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
// top offset
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
offsety = FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
if ((scrn & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
{
offsetx = FixedMul(offsetx, dupx<<FRACBITS);
offsety = FixedMul(offsety, dupy<<FRACBITS);
}
// Subtract the offsets from x/y positions
x -= offsetx;
y -= offsety;
}
if (scrn & V_SPLITSCREEN)
@ -510,7 +519,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
{
INT32 topdelta, prevdelta = -1;
if (flip) // offx is measured from right edge instead of left
if (scrn & V_FLIP) // offx is measured from right edge instead of left
{
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
break;
@ -534,7 +543,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
prevdelta = topdelta;
source = (const UINT8 *)(column) + 3;
dest = desttop;
if (flip)
if (scrn & V_FLIP)
dest = deststart + (destend - desttop);
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width;

View file

@ -394,6 +394,8 @@ UINT16 W_LoadWadFile(const char *filename)
if (fread(&header, 1, sizeof header, handle) < sizeof header)
{
CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header from %s because %s\n"), filename, strerror(ferror(handle)));
if (handle)
fclose(handle);
return INT16_MAX;
}
@ -404,6 +406,8 @@ UINT16 W_LoadWadFile(const char *filename)
&& memcmp(header.identification, "SDLL", 4) != 0)
{
CONS_Alert(CONS_ERROR, M_GetText("%s does not have a valid WAD header\n"), filename);
if (handle)
fclose(handle);
return INT16_MAX;
}
@ -418,6 +422,8 @@ UINT16 W_LoadWadFile(const char *filename)
{
CONS_Alert(CONS_ERROR, M_GetText("Wadfile directory in %s is corrupted (%s)\n"), filename, strerror(ferror(handle)));
free(fileinfov);
if (handle)
fclose(handle);
return INT16_MAX;
}
@ -475,6 +481,8 @@ UINT16 W_LoadWadFile(const char *filename)
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
{
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
if (handle)
fclose(handle);
return INT16_MAX;
}
}

View file

@ -471,7 +471,7 @@ void I_PlayCD(UINT8 nTrack, UINT8 bLooping)
//faB: stop MIDI music, MIDI music will restart if volume is upped later
cv_digmusicvolume.value = 0;
cv_midimusicvolume.value = 0;
I_StopSong (0);
I_StopSong();
//faB: I don't use the notify message, I'm trying to minimize the delay
mciPlay.dwCallback = (DWORD)((size_t)hWndMain);

View file

@ -110,9 +110,9 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
// pause music when alt-tab
if (appActive && !paused)
I_ResumeSong(0);
I_ResumeSong();
else if (!paused)
I_PauseSong(0);
I_PauseSong();
{
HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;

View file

@ -40,7 +40,6 @@
static FMOD_SYSTEM *fsys;
static FMOD_SOUND *music_stream;
static FMOD_CHANNEL *music_channel;
static boolean midimode;
static UINT8 music_volume, midi_volume, sfx_volume;
static INT32 current_track;
@ -439,9 +438,9 @@ void I_SetSfxVolume(UINT8 volume)
sfx_volume = volume;
}
//
// MUSIC
//
/// ------------------------
// MUSIC SYSTEM
/// ------------------------
void I_InitMusic(void)
{
@ -449,53 +448,111 @@ void I_InitMusic(void)
void I_ShutdownMusic(void)
{
I_ShutdownDigMusic();
I_ShutdownMIDIMusic();
I_StopSong();
}
void I_PauseSong(INT32 handle)
{
UNREFERENCED_PARAMETER(handle);
if (music_stream)
FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, true));
}
/// ------------------------
// MUSIC PROPERTIES
/// ------------------------
void I_ResumeSong(INT32 handle)
musictype_t I_SongType(void)
{
UNREFERENCED_PARAMETER(handle);
if (music_stream)
FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false));
}
#ifdef HAVE_LIBGME
if (gme)
return MU_GME;
#endif
void I_InitDigMusic(void)
{
}
if (!music_stream)
return MU_NONE;
void I_ShutdownDigMusic(void)
{
if (!midimode)
I_StopDigSong();
}
boolean I_StartDigSong(const char *musicname, boolean looping)
{
char *data;
size_t len;
FMOD_CREATESOUNDEXINFO fmt;
lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname));
if (lumpnum == LUMPERROR)
FMOD_SOUND_TYPE type;
if (FMOD_Sound_GetFormat(music_stream, &type, NULL, NULL, NULL) == FMOD_OK)
{
lumpnum = W_CheckNumForName(va("D_%s",musicname));
if (lumpnum == LUMPERROR)
return false;
midimode = true;
switch(type)
{
case FMOD_SOUND_TYPE_WAV:
return MU_WAV;
case FMOD_SOUND_TYPE_MOD:
return MU_MOD;
case FMOD_SOUND_TYPE_MIDI:
return MU_MID;
case FMOD_SOUND_TYPE_OGGVORBIS:
return MU_OGG;
case FMOD_SOUND_TYPE_MPEG:
return MU_MP3;
case FMOD_SOUND_TYPE_FLAC:
return MU_FLAC;
default:
return MU_NONE;
}
}
else
midimode = false;
return MU_NONE;
}
data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC);
len = W_LumpLength(lumpnum);
boolean I_SongPlaying(void)
{
return (boolean)music_stream;
}
boolean I_SongPaused(void)
{
boolean fmpaused = false;
if (music_stream)
FMOD_Channel_GetPaused(music_channel, &fmpaused);
return fmpaused;
}
/// ------------------------
// MUSIC EFFECTS
/// ------------------------
boolean I_SetSongSpeed(float speed)
{
FMOD_RESULT e;
float frequency;
if (!music_stream)
return false;
if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME
// Try to set GME speed
if (gme)
{
gme_set_tempo(gme, speed);
return true;
}
#endif
// Try to set Mod/Midi speed
e = FMOD_Sound_SetMusicSpeed(music_stream, speed);
if (e == FMOD_ERR_FORMAT)
{
// Just change pitch instead for Ogg/etc.
FMR(FMOD_Sound_GetDefaults(music_stream, &frequency, NULL, NULL, NULL));
FMR_MUSIC(FMOD_Channel_SetFrequency(music_channel, speed*frequency));
}
else
FMR_MUSIC(e);
return true;
}
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
boolean I_LoadSong(char *data, size_t len)
{
FMOD_CREATESOUNDEXINFO fmt;
FMOD_RESULT e;
FMOD_TAG tag;
unsigned int loopstart, loopend;
if (gme || music_stream)
I_UnloadSong();
memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO));
fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
@ -530,8 +587,6 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
Z_Free(data); // We don't need this, either.
gme_start_track(gme, 0);
current_track = 0;
gme_set_equalizer(gme,&gmeq);
fmt.format = FMOD_SOUND_FORMAT_PCM16;
fmt.defaultfrequency = 44100;
@ -540,10 +595,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
fmt.decodebuffersize = (44100 * 2) / 35;
fmt.pcmreadcallback = GMEReadCallback;
fmt.userdata = gme;
FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER | (looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream));
FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
FMR(FMOD_Channel_SetPriority(music_channel, 0));
FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream));
return true;
}
}
@ -602,8 +654,6 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
{
gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
Z_Free(data); // We don't need this anymore.
gme_start_track(gme, 0);
current_track = 0;
gme_set_equalizer(gme,&gmeq);
fmt.format = FMOD_SOUND_FORMAT_PCM16;
fmt.defaultfrequency = 44100;
@ -612,7 +662,102 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
fmt.decodebuffersize = (44100 * 2) / 35;
fmt.pcmreadcallback = GMEReadCallback;
fmt.userdata = gme;
FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER | (looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream));
FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream));
return true;
}
#endif
fmt.length = len;
e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT, &fmt, &music_stream);
if (e != FMOD_OK)
{
if (e == FMOD_ERR_FORMAT)
CONS_Alert(CONS_WARNING, "Failed to play music lump due to invalid format.\n");
else
FMR(e);
return false;
}
// Try to find a loop point in streaming music formats (ogg, mp3)
// A proper LOOPPOINT is its own tag, stupid.
e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// Use LOOPMS for time in miliseconds.
e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// Try to fetch it from the COMMENT tag, like A.J. Freda
e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
char *loopText;
// Handle any errors that arose, first
FMR(e);
// Figure out where the number starts
loopText = strstr((char *)tag.data,"LOOPPOINT=");
if (loopText != NULL)
{
// Skip the "LOOPPOINT=" part.
loopText += 10;
// Convert it to our looppoint
// FMOD seems to ensure the tag is properly NULL-terminated.
// atoi will stop when it reaches anything that's not a number.
loopstart = atoi(loopText);
// Now do the rest like above
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM));
}
return true;
}
// No special loop point
return true;
}
void I_UnloadSong(void)
{
I_StopSong();
#ifdef HAVE_LIBGME
if (gme)
{
gme_delete(gme);
gme = NULL;
}
#endif
if (music_stream)
{
FMR(FMOD_Sound_Release(music_stream));
music_stream = NULL;
}
}
boolean I_PlaySong(boolean looping)
{
#ifdef HAVE_LIBGME
if (gme)
{
gme_start_track(gme, 0);
current_track = 0;
FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
FMR(FMOD_Channel_SetPriority(music_channel, 0));
@ -620,139 +765,48 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
}
#endif
fmt.length = len;
{
FMOD_RESULT e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT|(looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream);
if (e != FMOD_OK)
{
if (e == FMOD_ERR_FORMAT)
CONS_Alert(CONS_WARNING, "Failed to play music lump %s due to invalid format.\n", W_CheckNameForNum(lumpnum));
else
FMR(e);
return false;
}
}
FMR(FMOD_Sound_SetMode(music_stream, (looping ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF)));
FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
if (midimode)
if (I_SongType() != MU_MID)
FMR(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0));
else
FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
FMR(FMOD_Channel_SetPriority(music_channel, 0));
current_track = 0;
// Try to find a loop point in streaming music formats (ogg, mp3)
if (looping)
{
FMOD_RESULT e;
FMOD_TAG tag;
unsigned int loopstart, loopend;
// A proper LOOPPOINT is its own tag, stupid.
e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// Use LOOPMS for time in miliseconds.
e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// Try to fetch it from the COMMENT tag, like A.J. Freda
e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
char *loopText;
// Handle any errors that arose, first
FMR(e);
// Figure out where the number starts
loopText = strstr((char *)tag.data,"LOOPPOINT=");
if (loopText != NULL)
{
// Skip the "LOOPPOINT=" part.
loopText += 10;
// Convert it to our looppoint
// FMOD seems to ensure the tag is properly NULL-terminated.
// atoi will stop when it reaches anything that's not a number.
loopstart = atoi(loopText);
// Now do the rest like above
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM));
}
return true;
}
}
// No special loop point, but we're playing so it's all good.
return true;
}
void I_StopDigSong(void)
void I_StopSong(void)
{
if (music_stream)
FMR(FMOD_Sound_Release(music_stream));
music_stream = NULL;
#ifdef HAVE_LIBGME
if (gme)
gme_delete(gme);
gme = NULL;
#endif
current_track = -1;
if (music_channel)
FMR_MUSIC(FMOD_Channel_Stop(music_channel));
}
void I_SetDigMusicVolume(UINT8 volume)
void I_PauseSong(void)
{
if (music_channel)
FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, true));
}
void I_ResumeSong(void)
{
if (music_channel)
FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false));
}
void I_SetMusicVolume(UINT8 volume)
{
if (!music_channel)
return;
// volume is 0 to 31.
music_volume = volume;
if (!midimode && music_stream)
FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0));
}
boolean I_SetSongSpeed(float speed)
{
FMOD_RESULT e;
float frequency;
if (!music_stream)
return false;
if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME
// Try to set GME speed
if (gme)
{
gme_set_tempo(gme, speed);
return true;
}
#endif
// Try to set Mod/Midi speed
e = FMOD_Sound_SetMusicSpeed(music_stream, speed);
if (e == FMOD_ERR_FORMAT)
{
// Just change pitch instead for Ogg/etc.
FMR(FMOD_Sound_GetDefaults(music_stream, &frequency, NULL, NULL, NULL));
FMR_MUSIC(FMOD_Channel_SetFrequency(music_channel, speed*frequency));
}
if (I_SongType() == MU_MID)
music_volume = 31; // windows bug hack
else
FMR_MUSIC(e);
music_volume = volume;
return true;
FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
}
boolean I_SetSongTrack(INT32 track)
@ -799,62 +853,3 @@ boolean I_SetSongTrack(INT32 track)
}
return false;
}
//
// Fuck MIDI. ... Okay fine, you can have your silly D_-only mode.
//
void I_InitMIDIMusic(void)
{
}
void I_ShutdownMIDIMusic(void)
{
if (midimode)
I_StopSong(0);
}
void I_SetMIDIMusicVolume(UINT8 volume)
{
// volume is 0 to 31.
midi_volume = volume;
if (midimode && music_stream)
FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0));
}
INT32 I_RegisterSong(void *data, size_t len)
{
FMOD_CREATESOUNDEXINFO fmt;
memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO));
fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
fmt.length = len;
FMR(FMOD_System_CreateStream(fsys, (char *)data, FMOD_OPENMEMORY_POINT, &fmt, &music_stream));
return 1337;
}
boolean I_PlaySong(INT32 handle, boolean looping)
{
if (1337 == handle)
{
midimode = true;
if (looping)
FMR(FMOD_Sound_SetMode(music_stream, FMOD_LOOP_NORMAL));
FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0));
FMR_MUSIC(FMOD_Channel_SetPriority(music_channel, 0));
}
return true;
}
void I_StopSong(INT32 handle)
{
I_UnRegisterSong(handle);
}
void I_UnRegisterSong(INT32 handle)
{
UNREFERENCED_PARAMETER(handle);
if (music_stream)
FMR(FMOD_Sound_Release(music_stream));
music_stream = NULL;
}

View file

@ -822,63 +822,15 @@ void Y_EndIntermission(void)
usebuffer = false;
}
//
// Y_EndGame
//
// Why end the game?
// Because Y_FollowIntermission and F_EndCutscene would
// both do this exact same thing *in different ways* otherwise,
// which made it so that you could only unlock Ultimate mode
// if you had a cutscene after the final level and crap like that.
// This function simplifies it so only one place has to be updated
// when something new is added.
void Y_EndGame(void)
{
// Only do evaluation and credits in coop games.
if (gametype == GT_COOP)
{
if (nextmap == 1102-1) // end game with credits
{
F_StartCredits();
return;
}
if (nextmap == 1101-1) // end game with evaluation
{
F_StartGameEvaluation();
return;
}
}
// 1100 or competitive multiplayer, so go back to title screen.
D_StartTitle();
}
//
// Y_FollowIntermission
//
static void Y_FollowIntermission(void)
{
if (modeattacking)
{
M_EndModeAttackRun();
return;
}
if (nextmap < 1100-1)
{
// normal level
G_AfterIntermission();
return;
}
// Start a custom cutscene if there is one.
if (mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking)
{
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->cutscenenum-1, false, false);
return;
}
Y_EndGame();
// This handles whether to play a post-level cutscene, end the game,
// or simply go to the next level.
// No need to duplicate the code here!
G_AfterIntermission();
}
#define UNLOAD(x) Z_ChangeTag(x, PU_CACHE); x = NULL

View file

@ -15,7 +15,6 @@ void Y_IntermissionDrawer(void);
void Y_Ticker(void);
void Y_StartIntermission(void);
void Y_EndIntermission(void);
void Y_EndGame(void);
void Y_VoteDrawer(void);
void Y_VoteTicker(void);