Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
f974bb96
Commit
f974bb96
authored
6 years ago
by
Monster Iestyn
Browse files
Options
Downloads
Plain Diff
Merge branch 'music-clean' into 'master'
Some code cleanup. See merge request
STJr/SRB2!298
parents
7cc5caf6
ea4ce70f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!488
Merge in next and don't billboard papersprites in GL
,
!298
Some code cleanup.
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/d_netcmd.c
+0
-94
0 additions, 94 deletions
src/d_netcmd.c
src/d_netcmd.h
+1
-5
1 addition, 5 deletions
src/d_netcmd.h
src/s_sound.c
+94
-0
94 additions, 0 deletions
src/s_sound.c
src/s_sound.h
+1
-0
1 addition, 0 deletions
src/s_sound.h
with
96 additions
and
99 deletions
src/d_netcmd.c
+
0
−
94
View file @
f974bb96
...
...
@@ -128,8 +128,6 @@ FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void);
static
void
Command_Playintro_f
(
void
);
static
void
Command_Displayplayer_f
(
void
);
static
void
Command_Tunes_f
(
void
);
static
void
Command_RestartAudio_f
(
void
);
static
void
Command_ExitLevel_f
(
void
);
static
void
Command_Showmap_f
(
void
);
...
...
@@ -319,7 +317,6 @@ consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL,
consvar_t
cv_rollingdemos
=
{
"rollingdemos"
,
"On"
,
CV_SAVE
,
CV_OnOff
,
NULL
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
};
consvar_t
cv_timetic
=
{
"timerres"
,
"Normal"
,
CV_SAVE
,
timetic_cons_t
,
NULL
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
};
// use tics in display
consvar_t
cv_resetmusic
=
{
"resetmusic"
,
"No"
,
CV_SAVE
,
CV_YesNo
,
NULL
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
};
static
CV_PossibleValue_t
pointlimit_cons_t
[]
=
{{
0
,
"MIN"
},
{
999999990
,
"MAX"
},
{
0
,
NULL
}};
consvar_t
cv_pointlimit
=
{
"pointlimit"
,
"0"
,
CV_NETVAR
|
CV_CALL
|
CV_NOINIT
,
pointlimit_cons_t
,
...
...
@@ -668,9 +665,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar
(
&
cv_ghost_guest
);
COM_AddCommand
(
"displayplayer"
,
Command_Displayplayer_f
);
COM_AddCommand
(
"tunes"
,
Command_Tunes_f
);
COM_AddCommand
(
"restartaudio"
,
Command_RestartAudio_f
);
CV_RegisterVar
(
&
cv_resetmusic
);
// FIXME: not to be here.. but needs be done for config loading
CV_RegisterVar
(
&
cv_usegamma
);
...
...
@@ -3881,94 +3875,6 @@ static void Command_Displayplayer_f(void)
CONS_Printf
(
M_GetText
(
"Displayplayer is %d
\n
"
),
displayplayer
);
}
static
void
Command_Tunes_f
(
void
)
{
const
char
*
tunearg
;
UINT16
tunenum
,
track
=
0
;
const
size_t
argc
=
COM_Argc
();
if
(
argc
<
2
)
//tunes slot ...
{
CONS_Printf
(
"tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:
\n
"
);
CONS_Printf
(
M_GetText
(
"Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.
\n
"
));
CONS_Printf
(
M_GetText
(
"If the format supports multiple songs, you can specify which one to play.
\n\n
"
));
CONS_Printf
(
M_GetText
(
"* With
\"
-show
\"
, shows the currently playing tune and track.
\n
"
));
CONS_Printf
(
M_GetText
(
"* With
\"
-default
\"
, returns to the default music for the map.
\n
"
));
CONS_Printf
(
M_GetText
(
"* With
\"
-none
\"
, any music playing will be stopped.
\n
"
));
return
;
}
tunearg
=
COM_Argv
(
1
);
tunenum
=
(
UINT16
)
atoi
(
tunearg
);
track
=
0
;
if
(
!
strcasecmp
(
tunearg
,
"-show"
))
{
CONS_Printf
(
M_GetText
(
"The current tune is: %s [track %d]
\n
"
),
mapmusname
,
(
mapmusflags
&
MUSIC_TRACKMASK
));
return
;
}
if
(
!
strcasecmp
(
tunearg
,
"-none"
))
{
S_StopMusic
();
return
;
}
else
if
(
!
strcasecmp
(
tunearg
,
"-default"
))
{
tunearg
=
mapheaderinfo
[
gamemap
-
1
]
->
musname
;
track
=
mapheaderinfo
[
gamemap
-
1
]
->
mustrack
;
}
else
if
(
!
tunearg
[
2
]
&&
toupper
(
tunearg
[
0
])
>=
'A'
&&
toupper
(
tunearg
[
0
])
<=
'Z'
)
tunenum
=
(
UINT16
)
M_MapNumber
(
tunearg
[
0
],
tunearg
[
1
]);
if
(
tunenum
&&
tunenum
>=
1036
)
{
CONS_Alert
(
CONS_NOTICE
,
M_GetText
(
"Valid music slots are 1 to 1035.
\n
"
));
return
;
}
if
(
!
tunenum
&&
strlen
(
tunearg
)
>
6
)
// This is automatic -- just show the error just in case
CONS_Alert
(
CONS_NOTICE
,
M_GetText
(
"Music name too long - truncated to six characters.
\n
"
));
if
(
argc
>
2
)
track
=
(
UINT16
)
atoi
(
COM_Argv
(
2
))
-
1
;
if
(
tunenum
)
snprintf
(
mapmusname
,
7
,
"%sM"
,
G_BuildMapName
(
tunenum
));
else
strncpy
(
mapmusname
,
tunearg
,
7
);
mapmusname
[
6
]
=
0
;
mapmusflags
=
(
track
&
MUSIC_TRACKMASK
);
S_ChangeMusic
(
mapmusname
,
mapmusflags
,
true
);
if
(
argc
>
3
)
{
float
speed
=
(
float
)
atof
(
COM_Argv
(
3
));
if
(
speed
>
0
.
0
f
)
S_SpeedMusic
(
speed
);
}
}
static
void
Command_RestartAudio_f
(
void
)
{
if
(
dedicated
)
// No point in doing anything if game is a dedicated server.
return
;
S_StopMusic
();
S_StopSounds
();
I_ShutdownMusic
();
I_ShutdownSound
();
I_StartupSound
();
I_InitMusic
();
// These must be called or no sound and music until manually set.
I_SetSfxVolume
(
cv_soundvolume
.
value
);
S_SetMusicVolume
(
cv_digmusicvolume
.
value
,
cv_midimusicvolume
.
value
);
if
(
Playing
())
// Gotta make sure the player is in a level
P_RestoreMusic
(
&
players
[
consoleplayer
]);
}
/** Quits a game and returns to the title screen.
*
*/
...
...
This diff is collapsed.
Click to expand it.
src/d_netcmd.h
+
1
−
5
View file @
f974bb96
...
...
@@ -99,8 +99,6 @@ extern consvar_t cv_startinglives;
// for F_finale.c
extern
consvar_t
cv_rollingdemos
;
extern
consvar_t
cv_resetmusic
;
extern
consvar_t
cv_ringslinger
,
cv_soundtest
;
extern
consvar_t
cv_specialrings
,
cv_powerstones
,
cv_matchboxes
,
cv_competitionboxes
;
...
...
@@ -198,6 +196,4 @@ void D_SetPassword(const char *pw);
// used for the player setup menu
UINT8
CanChangeSkin
(
INT32
playernum
);
#endif
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/s_sound.c
+
94
−
0
View file @
f974bb96
...
...
@@ -36,6 +36,7 @@ extern INT32 msg_id;
#include
"d_main.h"
#include
"r_sky.h"
// skyflatnum
#include
"p_local.h"
// camera info
#include
"m_misc.h"
// for tunes command
#ifdef HW3SOUND
// 3D Sound Interface
...
...
@@ -46,6 +47,8 @@ static INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, I
CV_PossibleValue_t
soundvolume_cons_t
[]
=
{{
0
,
"MIN"
},
{
31
,
"MAX"
},
{
0
,
NULL
}};
static
void
SetChannelsNum
(
void
);
static
void
Command_Tunes_f
(
void
);
static
void
Command_RestartAudio_f
(
void
);
// commands for music and sound servers
#ifdef MUSSERV
...
...
@@ -89,6 +92,7 @@ consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned,
#endif
static
consvar_t
surround
=
{
"surround"
,
"Off"
,
CV_SAVE
,
CV_OnOff
,
NULL
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
};
consvar_t
cv_resetmusic
=
{
"resetmusic"
,
"No"
,
CV_SAVE
,
CV_YesNo
,
NULL
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
};
#define S_MAX_VOLUME 127
...
...
@@ -243,6 +247,11 @@ void S_RegisterSoundStuff(void)
#endif
CV_RegisterVar
(
&
surround
);
CV_RegisterVar
(
&
cv_samplerate
);
CV_RegisterVar
(
&
cv_resetmusic
);
COM_AddCommand
(
"tunes"
,
Command_Tunes_f
);
COM_AddCommand
(
"restartaudio"
,
Command_RestartAudio_f
);
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
{
...
...
@@ -1503,3 +1512,88 @@ void S_Start(void)
S_StopMusic
();
S_ChangeMusic
(
mapmusname
,
mapmusflags
,
true
);
}
static
void
Command_Tunes_f
(
void
)
{
const
char
*
tunearg
;
UINT16
tunenum
,
track
=
0
;
const
size_t
argc
=
COM_Argc
();
if
(
argc
<
2
)
//tunes slot ...
{
CONS_Printf
(
"tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:
\n
"
);
CONS_Printf
(
M_GetText
(
"Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.
\n
"
));
CONS_Printf
(
M_GetText
(
"If the format supports multiple songs, you can specify which one to play.
\n\n
"
));
CONS_Printf
(
M_GetText
(
"* With
\"
-show
\"
, shows the currently playing tune and track.
\n
"
));
CONS_Printf
(
M_GetText
(
"* With
\"
-default
\"
, returns to the default music for the map.
\n
"
));
CONS_Printf
(
M_GetText
(
"* With
\"
-none
\"
, any music playing will be stopped.
\n
"
));
return
;
}
tunearg
=
COM_Argv
(
1
);
tunenum
=
(
UINT16
)
atoi
(
tunearg
);
track
=
0
;
if
(
!
strcasecmp
(
tunearg
,
"-show"
))
{
CONS_Printf
(
M_GetText
(
"The current tune is: %s [track %d]
\n
"
),
mapmusname
,
(
mapmusflags
&
MUSIC_TRACKMASK
));
return
;
}
if
(
!
strcasecmp
(
tunearg
,
"-none"
))
{
S_StopMusic
();
return
;
}
else
if
(
!
strcasecmp
(
tunearg
,
"-default"
))
{
tunearg
=
mapheaderinfo
[
gamemap
-
1
]
->
musname
;
track
=
mapheaderinfo
[
gamemap
-
1
]
->
mustrack
;
}
else
if
(
!
tunearg
[
2
]
&&
toupper
(
tunearg
[
0
])
>=
'A'
&&
toupper
(
tunearg
[
0
])
<=
'Z'
)
tunenum
=
(
UINT16
)
M_MapNumber
(
tunearg
[
0
],
tunearg
[
1
]);
if
(
tunenum
&&
tunenum
>=
1036
)
{
CONS_Alert
(
CONS_NOTICE
,
M_GetText
(
"Valid music slots are 1 to 1035.
\n
"
));
return
;
}
if
(
!
tunenum
&&
strlen
(
tunearg
)
>
6
)
// This is automatic -- just show the error just in case
CONS_Alert
(
CONS_NOTICE
,
M_GetText
(
"Music name too long - truncated to six characters.
\n
"
));
if
(
argc
>
2
)
track
=
(
UINT16
)
atoi
(
COM_Argv
(
2
))
-
1
;
if
(
tunenum
)
snprintf
(
mapmusname
,
7
,
"%sM"
,
G_BuildMapName
(
tunenum
));
else
strncpy
(
mapmusname
,
tunearg
,
7
);
mapmusname
[
6
]
=
0
;
mapmusflags
=
(
track
&
MUSIC_TRACKMASK
);
S_ChangeMusic
(
mapmusname
,
mapmusflags
,
true
);
if
(
argc
>
3
)
{
float
speed
=
(
float
)
atof
(
COM_Argv
(
3
));
if
(
speed
>
0
.
0
f
)
S_SpeedMusic
(
speed
);
}
}
static
void
Command_RestartAudio_f
(
void
)
{
S_StopMusic
();
S_StopSounds
();
I_ShutdownMusic
();
I_ShutdownSound
();
I_StartupSound
();
I_InitMusic
();
// These must be called or no sound and music until manually set.
I_SetSfxVolume
(
cv_soundvolume
.
value
);
S_SetMusicVolume
(
cv_digmusicvolume
.
value
,
cv_midimusicvolume
.
value
);
if
(
Playing
())
// Gotta make sure the player is in a level
P_RestoreMusic
(
&
players
[
consoleplayer
]);
}
This diff is collapsed.
Click to expand it.
src/s_sound.h
+
1
−
0
View file @
f974bb96
...
...
@@ -26,6 +26,7 @@
extern
consvar_t
stereoreverse
;
extern
consvar_t
cv_soundvolume
,
cv_digmusicvolume
,
cv_midimusicvolume
;
extern
consvar_t
cv_numChannels
;
extern
consvar_t
cv_resetmusic
;
#ifdef SNDSERV
extern
consvar_t
sndserver_cmd
,
sndserver_arg
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment