mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-03 01:41:15 +00:00
Music_Seek: argument in milliseconds instead of tics
This commit is contained in:
parent
15775adcb9
commit
b7c9c92749
6 changed files with 8 additions and 7 deletions
|
|
@ -216,7 +216,7 @@ void Music_DelayEnd(const char* id, tic_t duration)
|
|||
}
|
||||
}
|
||||
|
||||
void Music_Seek(const char* id, tic_t set)
|
||||
void Music_Seek(const char* id, UINT32 set)
|
||||
{
|
||||
Tune* tune = g_tunes.find(id);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ void Music_UnSuspend(const char *id);
|
|||
//
|
||||
|
||||
|
||||
// Seek to a specific time in the tune.
|
||||
void Music_Seek(const char *id, tic_t set);
|
||||
// Seek to a specific time in milliseconds in the tune.
|
||||
void Music_Seek(const char *id, UINT32 set);
|
||||
|
||||
// Remap a tune to another song. Use the lump name, with the
|
||||
// 'O_' at the beginning removed. song is case insensitive.
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ void TuneManager::seek(Tune* tune)
|
|||
uint32_t end = I_GetSongLength();
|
||||
uint32_t loop = I_GetSongLoopPoint();
|
||||
|
||||
uint32_t pos = detail::tics_to_msec(tune->seek + tune->elapsed()) * tune->speed();
|
||||
uint32_t pos = (tune->seek + detail::tics_to_msec(tune->elapsed())) * tune->speed();
|
||||
|
||||
if (pos > end && (end - loop) > 0u)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#define MUSIC_TUNE_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ public:
|
|||
bool nightcoreable = false;
|
||||
|
||||
// Start playing this number of tics into the tune.
|
||||
tic_t seek = 0;
|
||||
std::uint32_t seek = 0;
|
||||
|
||||
// these track state
|
||||
bool can_fade_out = true;
|
||||
|
|
|
|||
|
|
@ -8202,7 +8202,7 @@ void P_LoadLevelMusic(void)
|
|||
Music_Remap("level", music);
|
||||
|
||||
tic_t level_music_start = starttime + (TICRATE/2);
|
||||
Music_Seek("level", std::max(leveltime, level_music_start) - level_music_start);
|
||||
Music_Seek("level", (std::max(leveltime, level_music_start) - level_music_start) * 1000UL / TICRATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2296,7 +2296,7 @@ static void Command_Tunes_f(void)
|
|||
Music_Play("stereo");
|
||||
|
||||
if (argc > 3)
|
||||
Music_Seek("stereo", (atoi(COM_Argv(3)) * TICRATE) / 1000);
|
||||
Music_Seek("stereo", atoi(COM_Argv(3)));
|
||||
|
||||
if (argc > 2)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue