- ported Duke end of E1 cutscene

This commit is contained in:
Christoph Oelckers 2021-04-22 21:30:13 +02:00
parent b0163ff729
commit 05fa21785d

View file

@ -87,19 +87,20 @@ class TitleScreen : SkippableScreenJob
override void Draw(double smoothratio)
{
int clock = (ticks + smoothratio) * 120 / GameTicRate;
int etrans = Translation.MakeID(Translation_BasePalette, Duke.TITLEPAL);
screen.ClearScreen();
// Only translate if the image depends on the global palette.
let tex = TexMan.CheckForTexture("BETASCREEN");
int trans = TexMan.UseGamePalette(tex)? Translation.MakeID(Translation_BasePalette, Duke.TITLEPAL) : 0;
int trans = TexMan.UseGamePalette(tex)? etrans : 0;
screen.DrawTexture(tex, true, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_TranslationIndex, trans, DTA_LegacyRenderStyle, STYLE_Normal);
double scale = clamp(clock - 120, 0, 60) / 64.;
if (scale > 0.)
{
let tex = TexMan.CheckForTexture("DUKENUKEM");
trans = TexMan.UseGamePalette(tex)? Translation.MakeID(Translation_BasePalette, Duke.TITLEPAL) : 0; // re-check for different texture!
trans = TexMan.UseGamePalette(tex)? etrans : 0; // re-check for different texture!
screen.DrawTexture(tex, true, 160, 104, DTA_FullscreenScale, FSMode_Fit320x200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, trans, DTA_ScaleX, scale, DTA_ScaleY, scale);
@ -109,7 +110,7 @@ class TitleScreen : SkippableScreenJob
if (scale > 0.)
{
let tex = TexMan.CheckForTexture("THREEDEE");
trans = TexMan.UseGamePalette(tex)? Translation.MakeID(Translation_BasePalette, Duke.TITLEPAL) : 0; // re-check for different texture!
trans = TexMan.UseGamePalette(tex)? etrans : 0; // re-check for different texture!
screen.DrawTexture(tex, true, 160, 129, DTA_FullscreenScale, FSMode_Fit320x200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, trans, DTA_ScaleX, scale, DTA_ScaleY, scale);
@ -121,7 +122,7 @@ class TitleScreen : SkippableScreenJob
if (scale > 0. && clock > 280)
{
let tex = TexMan.CheckForTexture("TITLEPLUTOPAKSPRITE");
trans = TexMan.UseGamePalette(tex)? Translation.MakeID(Translation_BasePalette, Duke.TITLEPAL) : 0; // re-check for different texture!
trans = TexMan.UseGamePalette(tex)? etrans : 0; // re-check for different texture!
screen.DrawTexture(tex, true, 160, 151, DTA_FullscreenScale, FSMode_Fit320x200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, trans, DTA_ScaleX, scale, DTA_ScaleY, scale);
@ -134,3 +135,119 @@ class TitleScreen : SkippableScreenJob
Duke.PlaySound(DukeSnd.NITEVISION_ONOFF, CHAN_AUTO, CHANF_UI);
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
class Episode1End1 : SkippableScreenJob
{
int bonuscnt;
TextureID bossani;
TextureID breatheani;
bool breathebg;
const breathe_x = 176;
const breathe_y = 59;
const boss_x = 86;
const boss_y = 59;
void Init()
{
bonuscnt = 0;
breathebg = false;
bossani.SetInvalid();
breatheani.SetInvalid();
Super.Init(fadein | fadeout);
}
override void OnTick()
{
static const int breathe_time[] = { 0, 30, 60, 90 };
static const int breathe_time2[] = { 30, 60, 90, 120 };
static const String breathe_tile[] = { "VICTORY2", "VICTORY3", "VICTORY2", "" };
static const int boss_time[] = { 0, 220, 260, 290, 320, 350, 350 };
static const int boss_time2[] = { 120, 260, 290, 320, 350, 380, 380 };
static const String boss_tile[] = { "VICTORY4", "VICTORY5", "VICTORY6", "VICTORY7", "VICTORY8", "VICTORY9", "VICTORY9" };
int currentclock = ticks * 120 / GameTicRate;
bossani.SetInvalid();
breathebg = false;
breatheani.SetInvalid();
// boss
if (currentclock > 390 && currentclock < 780)
{
for (int t = 0, tt = 0; t < 35; t +=5, tt++) if ((currentclock % 390) > boss_time[tt] && (currentclock % 390) <= boss_time2[tt])
{
if (t == 10 && bonuscnt == 1)
{
Duke.PlaySound(DukeSnd.SHOTGUN_FIRE, CHAN_AUTO, CHANF_UI);
Duke.PlaySound(DukeSnd.SQUISHED, CHAN_AUTO, CHANF_UI);
bonuscnt++;
}
bossani = TexMan.CheckForTexture(boss_tile[tt]);
}
}
// Breathe
if (currentclock < 450 || currentclock >= 750)
{
if (currentclock >= 750)
{
breathebg = true;
if (currentclock >= 750 && bonuscnt == 2)
{
Duke.PlaySound(DukeSnd.DUKETALKTOBOSS, CHAN_AUTO, CHANF_UI);
bonuscnt++;
}
}
for (int t = 0, tt = 0; t < 20; t += 5, tt++)
if (breathe_tile[tt] != "" && (currentclock % 120) > breathe_time[tt] && (currentclock % 120) <= breathe_time2[tt])
{
if (t == 5 && bonuscnt == 0)
{
Duke.PlaySound(DukeSnd.BOSSTALKTODUKE, CHAN_AUTO, CHANF_UI);
bonuscnt++;
}
breatheani = TexMan.CheckForTexture(breathe_tile[tt]);
}
}
}
override void Draw(double sr)
{
int etrans = Translation.MakeID(Translation_BasePalette, Duke.ENDINGPAL);
screen.ClearScreen();
let tex = TexMan.CheckForTexture("VICTORY1");
int trans = TexMan.UseGamePalette(tex)? etrans : 0;
screen.DrawTexture(tex, false, 0, 50, DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, trans, DTA_LegacyRenderStyle, STYLE_Normal, DTA_TopLeft, true);
if (bossani.isValid())
{
trans = TexMan.UseGamePalette(tex)? etrans : 0; // re-check for different texture!
screen.DrawTexture(bossani, false, boss_x, boss_y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, trans, DTA_TopLeft, true);
}
if (breathebg)
{
tex = TexMan.CheckForTexture("VICTORY9");
trans = TexMan.UseGamePalette(tex)? etrans : 0; // re-check for different texture!
screen.DrawTexture(tex, false, 86, 59, DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, trans, DTA_TopLeft, true);
}
if (breatheani.isValid())
{
trans = TexMan.UseGamePalette(tex)? etrans : 0; // re-check for different texture!
screen.DrawTexture(breatheani, false, breathe_x, breathe_y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, trans, DTA_TopLeft, true);
}
}
}