2019-11-20 16:21:32 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 sirlemonhead, Nuke.YKT
|
|
|
|
This file is part of PCExhumed.
|
|
|
|
PCExhumed is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-11-22 23:11:37 +00:00
|
|
|
#include "ns.h"
|
2019-11-24 20:32:07 +00:00
|
|
|
#include "build.h"
|
2019-08-27 06:08:18 +00:00
|
|
|
#include "compat.h"
|
|
|
|
#include "baselayer.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "cd.h"
|
2019-11-24 20:32:07 +00:00
|
|
|
#include "sound.h"
|
|
|
|
#include "exhumed.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2019-12-12 23:19:34 +00:00
|
|
|
#include "z_music.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
extern short word_9AC30;
|
|
|
|
|
2019-11-24 20:32:07 +00:00
|
|
|
int nLastVolumeSet = 0;
|
|
|
|
|
2019-11-28 20:40:17 +00:00
|
|
|
/* TODO
|
2019-11-24 20:32:07 +00:00
|
|
|
|
2019-11-28 20:40:17 +00:00
|
|
|
Currently playing music must keep playing on return to map screen or exit from training level
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2019-11-28 20:40:17 +00:00
|
|
|
*/
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-28 20:40:17 +00:00
|
|
|
bool playCDtrack(int nTrack, bool bLoop)
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2019-11-24 20:32:07 +00:00
|
|
|
if (nTrack < 2) {
|
2019-11-28 20:40:17 +00:00
|
|
|
return false;
|
2019-11-24 20:32:07 +00:00
|
|
|
}
|
|
|
|
|
2019-11-28 20:40:17 +00:00
|
|
|
StopCD();
|
2019-11-26 12:47:12 +00:00
|
|
|
|
|
|
|
char filename[128];
|
2019-11-24 20:32:07 +00:00
|
|
|
|
2019-12-12 23:19:34 +00:00
|
|
|
// try ogg vorbis now
|
|
|
|
sprintf(filename, "exhumed%02d.ogg", nTrack);
|
2019-12-26 17:29:10 +00:00
|
|
|
Mus_Play(nullptr, filename, true);
|
2019-11-28 20:40:17 +00:00
|
|
|
return true;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void StartfadeCDaudio()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int StepFadeCDaudio()
|
|
|
|
{
|
2019-11-24 20:32:07 +00:00
|
|
|
if (!CDplaying()) {
|
2019-08-31 07:47:15 +00:00
|
|
|
return 0;
|
2019-11-24 20:32:07 +00:00
|
|
|
}
|
2019-12-12 23:19:34 +00:00
|
|
|
Mus_Stop();
|
2019-11-24 20:32:07 +00:00
|
|
|
return 1;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
2019-11-28 20:40:17 +00:00
|
|
|
bool CDplaying()
|
2019-08-26 03:59:14 +00:00
|
|
|
{
|
2019-12-26 17:29:10 +00:00
|
|
|
return Mus_IsPlaying();
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void StopCD()
|
|
|
|
{
|
2019-12-12 23:19:34 +00:00
|
|
|
Mus_Stop();
|
2019-11-22 23:11:37 +00:00
|
|
|
}
|
2019-11-24 20:32:07 +00:00
|
|
|
|
2019-12-25 22:37:16 +00:00
|
|
|
void FadeSong()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-12-26 17:29:10 +00:00
|
|
|
int fadecdaudio()
|
|
|
|
{
|
|
|
|
StartfadeCDaudio();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (!StepFadeCDaudio()) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
WaitTicks(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|