2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood 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-09-21 18:59:54 +00:00
|
|
|
|
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "build.h"
|
|
|
|
#include "compat.h"
|
|
|
|
#include "SmackerDecoder.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
#include "blood.h"
|
|
|
|
#include "controls.h"
|
|
|
|
#include "globals.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "view.h"
|
2020-04-12 05:46:53 +00:00
|
|
|
#include "animtexture.h"
|
2019-12-25 13:13:15 +00:00
|
|
|
#include "../glbackend/glbackend.h"
|
2020-04-12 06:09:38 +00:00
|
|
|
#include "raze_sound.h"
|
2020-06-12 18:31:23 +00:00
|
|
|
#include "v_2ddrawer.h"
|
2020-07-29 21:18:08 +00:00
|
|
|
#include "screenjob.h"
|
|
|
|
#include "gamestate.h"
|
|
|
|
#include "seq.h"
|
|
|
|
#include "menu.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2020-07-29 21:18:08 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2020-07-29 21:18:08 +00:00
|
|
|
void playlogos()
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-07-29 21:18:08 +00:00
|
|
|
JobDesc jobs[6];
|
|
|
|
int job = 0;
|
|
|
|
static AnimSound logosound[] =
|
|
|
|
{
|
|
|
|
{ 1, -1 },
|
|
|
|
{ -1, -1 },
|
|
|
|
{ 1, -1 },
|
|
|
|
{ -1,-1 }
|
|
|
|
};
|
|
|
|
|
|
|
|
if (logosound[0].soundnum == -1)
|
|
|
|
{
|
|
|
|
logosound[0].soundnum = S_FindSound("logo.wav");
|
|
|
|
logosound[2].soundnum = S_FindSound("gt.wav");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (fileSystem.FindFile("logo.smk"))
|
|
|
|
{
|
|
|
|
jobs[job++] = { PlayVideo("logo.smk", &logosound[0], 0) };
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jobs[job++] = { Create<DBlackScreen>(1), []() { sndStartSample("THUNDER2", 128, -1); }};
|
|
|
|
jobs[job++] = { Create<DImageScreen>(2050) };
|
|
|
|
}
|
|
|
|
if (fileSystem.FindFile("gti.smk"))
|
|
|
|
{
|
|
|
|
jobs[job++] = { PlayVideo("gti.smk", &logosound[2], 0) };
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jobs[job++] = { Create<DBlackScreen>(1), []() { sndStartSample("THUNDER2", 128, -1); }};
|
|
|
|
jobs[job++] = { Create<DImageScreen>(2052) };
|
|
|
|
}
|
|
|
|
jobs[job++] = { Create<DBlackScreen>(1), []() { sndPlaySpecialMusicOrNothing(MUS_INTRO); sndStartSample("THUNDER2", 128, -1); }};
|
|
|
|
jobs[job++] = { Create<DImageScreen>(2518, DScreenJob::fadein) };
|
|
|
|
|
|
|
|
RunScreenJob(jobs, job, [](bool) {
|
|
|
|
gamestate = GS_DEMOSCREEN;
|
|
|
|
M_StartControlPanel(false);
|
|
|
|
M_SetMenu(NAME_Mainmenu);
|
|
|
|
}, true, true);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-29 21:18:08 +00:00
|
|
|
void playSmk(const char *smk, const char *wav, int wavid, CompletionFunc func)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-07-29 21:18:08 +00:00
|
|
|
JobDesc jobs{};
|
|
|
|
static AnimSound smksound[] =
|
|
|
|
{
|
|
|
|
{ 1, -1 },
|
|
|
|
{ -1, -1 },
|
|
|
|
};
|
|
|
|
int id = S_FindSoundByResID(wavid);
|
|
|
|
if (id <= 0)
|
|
|
|
{
|
|
|
|
FString wavv = wav;
|
|
|
|
FixPathSeperator(wavv);
|
|
|
|
id = S_FindSound(wavv);
|
|
|
|
}
|
|
|
|
FString smkk = smk;
|
|
|
|
FixPathSeperator(smkk);
|
|
|
|
smksound[0].soundnum = id;
|
|
|
|
jobs.job = PlayVideo(smkk, smksound, nullptr);
|
|
|
|
RunScreenJob(&jobs, 1, func);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-29 21:18:08 +00:00
|
|
|
void levelPlayIntroScene(int nEpisode, CompletionFunc completion)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-07-29 21:18:08 +00:00
|
|
|
gGameOptions.uGameFlags &= ~4;
|
|
|
|
Mus_Stop();
|
|
|
|
sndKillAllSounds();
|
|
|
|
sfxKillAllSounds();
|
|
|
|
ambKillAll();
|
|
|
|
seqKillAll();
|
|
|
|
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
2020-08-02 21:47:21 +00:00
|
|
|
playSmk(pEpisode->cutsceneAName, pEpisode->cutsceneASound, pEpisode->at9028, completion);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-29 21:18:08 +00:00
|
|
|
void levelPlayEndScene(int nEpisode, CompletionFunc completion)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-07-29 21:18:08 +00:00
|
|
|
gGameOptions.uGameFlags &= ~8;
|
|
|
|
Mus_Stop();
|
|
|
|
sndKillAllSounds();
|
|
|
|
sfxKillAllSounds();
|
|
|
|
ambKillAll();
|
|
|
|
seqKillAll();
|
|
|
|
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
2020-08-02 21:47:21 +00:00
|
|
|
playSmk(pEpisode->cutsceneBName, pEpisode->cutsceneBSound, pEpisode->at902c, completion);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
|
|
|
|
END_BLD_NS
|