- RR bonus screens.

This commit is contained in:
Christoph Oelckers 2020-06-28 22:17:27 +02:00
parent 69d9a98ead
commit 726ebec9ec
7 changed files with 172 additions and 255 deletions

View file

@ -45,6 +45,34 @@
IMPLEMENT_CLASS(DScreenJob, true, false) IMPLEMENT_CLASS(DScreenJob, true, false)
IMPLEMENT_CLASS(DImageScreen, true, false)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DImageScreen::Frame(uint64_t clock, bool skiprequest)
{
if (tilenum > 0)
{
tex = tileGetTexture(tilenum, true);
}
if (!tex) return 0;
int span = int(clock / 1'000'000);
int light = 255;
if (span < 255) light = span;
else if (fadeoutstart > 0 && span > fadeoutstart - 255) light = fadeoutstart - span;
light = clamp(light, 0, 255);
PalEntry pe(255, light, light, light);
twod->ClearScreen();
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, DTA_Color, pe, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
// Only end after having faded out.
if (skiprequest&& fadeoutstart < 0) fadeoutstart = span;
return fadeoutstart > 0 && light == 0 ? -1 : 1;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //

View file

@ -12,6 +12,37 @@ public:
virtual int Frame(uint64_t clock, bool skiprequest) = 0; virtual int Frame(uint64_t clock, bool skiprequest) = 0;
}; };
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
class DImageScreen : public DScreenJob
{
DECLARE_CLASS(DImageScreen, DScreenJob)
int fadeoutstart = -1;
int tilenum = -1;
FGameTexture* tex = nullptr;
public:
DImageScreen(FGameTexture* tile)
{
tex = tile;
}
DImageScreen(int tile)
{
tilenum = tile;
}
int Frame(uint64_t clock, bool skiprequest) override;
};
struct JobDesc struct JobDesc
{ {
DScreenJob* job; DScreenJob* job;

View file

@ -552,50 +552,6 @@ public:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class DImageScreen : public DScreenJob
{
int fadeoutstart = -1;
int tilenum = -1;
FGameTexture* tex = nullptr;
public:
DImageScreen(FGameTexture * tile)
{
tex = tile;
}
DImageScreen(int tile)
{
tilenum = tile;
}
int Frame(uint64_t clock, bool skiprequest) override
{
if (tilenum > 0)
{
tex = tileGetTexture(tilenum, true);
}
if (!tex) return 0;
int span = int(clock / 1'000'000);
int light = 255;
if (span < 255) light = span;
else if (fadeoutstart > 0 && span > fadeoutstart - 255) light = fadeoutstart - span;
light = clamp(light, 0, 255);
PalEntry pe(255, light, light, light);
twod->ClearScreen();
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, DTA_Color, pe, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
// Only end after having faded out.
if (skiprequest && fadeoutstart < 0) fadeoutstart = span;
return fadeoutstart > 0 && light == 0 ? -1 : 1;
}
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
class DBlackScreen : public DScreenJob class DBlackScreen : public DScreenJob
{ {
int wait; int wait;
@ -809,12 +765,38 @@ void bonussequence_d(int num, CompletionFunc completion)
static const AnimSound vol4e3[] = static const AnimSound vol4e3[] =
{ {
{ 1, BOSS4_DEADSPEECH }, { 1, BOSS4_DEADSPEECH+1 },
{ 40, VOL4ENDSND1 }, { 40, VOL4ENDSND1+1 },
{ 40, DUKE_UNDERWATER }, { 40, DUKE_UNDERWATER+1 },
{ 50, BIGBANG }, { 50, BIGBANG+1 },
{ -1,-1 } { -1,-1 }
}; };
static const AnimSound vol42a[] =
{
{ 1, INTRO4_B +1 },
{ 12, SHORT_CIRCUIT + 1 },
{ 18, INTRO4_5 + 1 },
{ 34, SHORT_CIRCUIT+1 },
{ -1,-1 }
};
static const AnimSound vol41a[] =
{
{ 1, INTRO4_1+1 },
{ 7, INTRO4_3+1 },
{ 12, INTRO4_2+1 },
{ 26, INTRO4_4+1 },
{ -1,-1 }
};
static const AnimSound vol43a[] =
{
{ 10, INTRO4_6+1 },
{ -1,-1 }
};
static const int framespeed_10[] = { 10, 10, 10 }; static const int framespeed_10[] = { 10, 10, 10 };
static const int framespeed_14[] = { 14, 14, 14 }; static const int framespeed_14[] = { 14, 14, 14 };
static const int framespeed_18[] = { 18, 18, 18 }; static const int framespeed_18[] = { 18, 18, 18 };
@ -856,6 +838,12 @@ void bonussequence_d(int num, CompletionFunc completion)
jobs[job++] = { Create<DEpisode5End>(), []() { FX_StopAllSounds(); } }; jobs[job++] = { Create<DEpisode5End>(), []() { FX_StopAllSounds(); } };
break; break;
case 5: // Episode 4 start
S_PlaySpecialMusic(MUS_BRIEFING);
jobs[job++] = { PlayVideo("vol41a.anm", vol41a, framespeed_10), nullptr };
jobs[job++] = { PlayVideo("vol42a.anm", vol42a, framespeed_14), nullptr };
jobs[job++] = { PlayVideo("vol43a.anm", vol43a, framespeed_10), nullptr };
break;
} }
RunScreenJob(jobs, job, completion); RunScreenJob(jobs, job, completion);
} }

View file

@ -761,6 +761,11 @@ void ShowMapFrame(void)
#endif #endif
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void Logo_r(CompletionFunc completion) void Logo_r(CompletionFunc completion)
{ {
@ -785,16 +790,16 @@ void Logo_r(CompletionFunc completion)
{ -1, -1 } { -1, -1 }
}; };
static const int frametimes[] = { 9, 9, 9 }; // same for all 3 anims static const int framespeed[] = { 9, 9, 9 }; // same for all 3 anims
JobDesc jobs[3]; JobDesc jobs[3];
int job = 0; int job = 0;
if (!isRRRA()) if (!isRRRA())
{ {
jobs[job++] = { PlayVideo("rr_intro.anm", introsound, frametimes), nullptr }; jobs[job++] = { PlayVideo("rr_intro.anm", introsound, framespeed), nullptr };
jobs[job++] = { PlayVideo("redneck.anm", rednecksound, frametimes), nullptr }; jobs[job++] = { PlayVideo("redneck.anm", rednecksound, framespeed), nullptr };
jobs[job++] = { PlayVideo("xatlogo.anm", xatrixsound, frametimes), nullptr }; jobs[job++] = { PlayVideo("xatlogo.anm", xatrixsound, framespeed), nullptr };
} }
else else
{ {
@ -803,6 +808,61 @@ void Logo_r(CompletionFunc completion)
RunScreenJob(jobs, job, completion); RunScreenJob(jobs, job, completion);
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void bonussequence_r(int num, CompletionFunc completion)
{
static const AnimSound turdmov[] =
{
{ 1, 82 + 1 },
{ -1, -1 }
};
static const AnimSound rr_outro[] =
{
{ 1, 35 + 1 },
{ -1, -1 }
};
static const int framespeed[] = { 9, 9, 9 }; // same for all 3 anims
Mus_Stop();
FX_StopAllSounds();
JobDesc jobs[2];
int job = 0;
switch (num)
{
case 0:
jobs[job++] = { PlayVideo("turdmov.anm", turdmov, framespeed), nullptr };
jobs[job++] = { Create<DImageScreen>(TENSCREEN), nullptr };
break;
case 1:
jobs[job++] = { PlayVideo("rr_outro.anm", rr_outro, framespeed), nullptr };
jobs[job++] = { Create<DImageScreen>(TENSCREEN), nullptr };
break;
default:
break;
}
RunScreenJob(jobs, job, completion);
}
#if 0
CCMD(testbonus)
{
if (argv.argc() > 1)
{
bonussequence_r(strtol(argv[1], nullptr, 0), nullptr);
}
}
#endif
#if 0 #if 0

View file

@ -90,104 +90,6 @@ void Anim_Init(void)
uint8_t frame; uint8_t frame;
}; };
static defaultanmsound const logo[] =
{
{ FLY_BY, 1 },
{ PIPEBOMB_EXPLODE, 19 },
};
static defaultanmsound const cineov2[] =
{
{ WIND_AMBIENCE, 1 },
{ ENDSEQVOL2SND1, 26 },
{ ENDSEQVOL2SND2, 36 },
{ THUD, 54 },
{ ENDSEQVOL2SND3, 62 },
{ ENDSEQVOL2SND4, 75 },
{ ENDSEQVOL2SND5, 81 },
{ ENDSEQVOL2SND6, 115 },
{ ENDSEQVOL2SND7, 124 },
};
static defaultanmsound const cineov3[] =
{
{ WIND_REPEAT, 1 },
{ DUKE_GRUNT, 98 },
{ THUD, 82+20 },
{ SQUISHED, 82+20 },
{ ENDSEQVOL3SND3, 104+20 },
{ ENDSEQVOL3SND2, 114+20 },
{ PIPEBOMB_EXPLODE, 158 },
};
static defaultanmsound const vol42a[] =
{
{ INTRO4_B, 1 },
{ SHORT_CIRCUIT, 12 },
{ INTRO4_5, 18 },
{ SHORT_CIRCUIT, 34 },
};
static defaultanmsound const vol41a[] =
{
{ INTRO4_1, 1 },
{ INTRO4_3, 7 },
{ INTRO4_2, 12 },
{ INTRO4_4, 26 },
};
static defaultanmsound const vol43a[] =
{
{ INTRO4_6, 10 },
};
static defaultanmsound const vol4e1[] =
{
{ DUKE_UNDERWATER, 3 },
{ VOL4ENDSND1, 35 },
};
static defaultanmsound const vol4e2[] =
{
{ DUKE_UNDERWATER, 11 },
{ VOL4ENDSND1, 20 },
{ VOL4ENDSND2, 39 },
{ StopAllSounds, 50 },
};
static defaultanmsound const vol4e3[] =
{
{ BOSS4_DEADSPEECH, 1 },
{ VOL4ENDSND1, 40 },
{ DUKE_UNDERWATER, 40 },
{ BIGBANG, 50 },
};
static defaultanmsound const rr_intro[] =
{
{ 29, 1 },
};
static defaultanmsound const redneck[] =
{
{ 478, 1 },
};
static defaultanmsound const xatlogo[] =
{
{ 479, 1 },
};
static defaultanmsound const turdmov[] =
{
{ 82, 1 },
};
static defaultanmsound const rr_outro[] =
{
{ 35, 1 },
};
struct defaultanm { struct defaultanm {
char const *fn; char const *fn;
defaultanmsound const *sounds; defaultanmsound const *sounds;
@ -198,23 +100,6 @@ void Anim_Init(void)
#define anmsnd(x) (x), ARRAY_SIZE(x) #define anmsnd(x) (x), ARRAY_SIZE(x)
static defaultanm const anms[] = static defaultanm const anms[] =
{ {
{ "logo.anm", anmsnd(logo), 9 },
{ "3dr.anm", NULL, 0, 10 },
{ "vol4e1.anm", anmsnd(vol4e1), 10 },
{ "vol4e2.anm", anmsnd(vol4e2), 14 },
{ "vol4e3.anm", anmsnd(vol4e3), 10 },
{ "vol41a.anm", anmsnd(vol41a), 14 },
{ "vol42a.anm", anmsnd(vol42a), 18 },
{ "vol43a.anm", anmsnd(vol43a), 10 },
{ "duketeam.anm", NULL, 0, 10 },
{ "radlogo.anm", NULL, 0, 10 },
{ "cineov2.anm", anmsnd(cineov2), 18 },
{ "cineov3.anm", anmsnd(cineov3), 10 },
{ "rr_intro.anm", anmsnd(rr_intro), 9 },
{ "redneck.anm", anmsnd(redneck), 9 },
{ "xatlogo.anm", anmsnd(xatlogo), 9 },
{ "turdmov.anm", anmsnd(turdmov), 9 },
{ "rr_outro.anm", anmsnd(rr_outro), 9 },
{ "lvl1.anm", NULL, 0, 20 }, { "lvl1.anm", NULL, 0, 20 },
{ "lvl2.anm", NULL, 0, 20 }, { "lvl2.anm", NULL, 0, 20 },
{ "lvl3.anm", NULL, 0, 20 }, { "lvl3.anm", NULL, 0, 20 },

View file

@ -231,6 +231,7 @@ void G_InitRRRASkies(void)
void prelevel_d(int g); void prelevel_d(int g);
void prelevel_r(int g); void prelevel_r(int g);
void bonussequence_d(int num, CompletionFunc completion);
void G_NewGame(int volumeNum, int levelNum, int skillNum) void G_NewGame(int volumeNum, int levelNum, int skillNum)
{ {
@ -270,31 +271,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
if (!RR && (!g_netServer && ud.multimode < 2) && UserMap == 0 && if (!RR && (!g_netServer && ud.multimode < 2) && UserMap == 0 &&
levelNum == 0 && volumeNum == 3 && adult_lockout == 0) levelNum == 0 && volumeNum == 3 && adult_lockout == 0)
{ {
S_PlaySpecialMusic(MUS_BRIEFING); bonussequence_d(5, [](bool) {});
renderFlushPerms();
videoSetViewableArea(0,0,xdim-1,ydim-1);
twod->ClearScreen();
videoNextPage();
int animReturn = Anim_Play("vol41a.anm");
twod->ClearScreen();
videoNextPage();
if (animReturn)
goto end_vol4a;
animReturn = Anim_Play("vol42a.anm");
twod->ClearScreen();
videoNextPage();
if (animReturn)
goto end_vol4a;
Anim_Play("vol43a.anm");
twod->ClearScreen();
videoNextPage();
end_vol4a:
FX_StopAllSounds();
} }
#ifdef EDUKE32_TOUCH_DEVICES #ifdef EDUKE32_TOUCH_DEVICES

View file

@ -832,9 +832,7 @@ void G_DisplayRest(int32_t smoothratio)
if (!DEER && g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1) if (!DEER && g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1)
{ {
int32_t a = TILE_CROSSHAIR; int32_t a = TILE_CROSSHAIR;
//ud.returnvar[0] = (160<<16) - (g_player[myconnectindex].ps->look_ang<<15);
//ud.returnvar[1] = 100<<16;
//int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, TILE_CROSSHAIR);
if ((unsigned) a < MAXTILES) if ((unsigned) a < MAXTILES)
{ {
vec2_t crosshairpos = { (160<<16) - (g_player[myconnectindex].ps->look_ang<<15), 100<<16 }; vec2_t crosshairpos = { (160<<16) - (g_player[myconnectindex].ps->look_ang<<15), 100<<16 };
@ -848,15 +846,6 @@ void G_DisplayRest(int32_t smoothratio)
} }
} }
/*
if (VM_HaveEvent(EVENT_DISPLAYREST))
{
int32_t vr=viewingrange, asp=yxaspect;
VM_ExecuteEvent(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek);
renderSetAspect(vr, asp);
}
*/
if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
menutext_center(100, GStrings("Game Paused")); menutext_center(100, GStrings("Game Paused"));
@ -924,13 +913,11 @@ void G_DisplayRest(int32_t smoothratio)
Net_DisplaySyncMsg(); Net_DisplaySyncMsg();
#ifndef EDUKE32_TOUCH_DEVICES
if (VOLUMEONE) if (VOLUMEONE)
{ {
if (g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) if (g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, TILE_BETAVERSION, 0, 0, 2+8+16+128); rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, TILE_BETAVERSION, 0, 0, 2+8+16+128);
} }
#endif
if (!Demo_IsProfiling()) if (!Demo_IsProfiling())
{ {
@ -1090,6 +1077,7 @@ void G_DoOrderScreen(void)
} }
void bonussequence_d(int num, CompletionFunc completion); void bonussequence_d(int num, CompletionFunc completion);
void bonussequence_r(int num, CompletionFunc completion);
static void G_BonusCutscenes(void) static void G_BonusCutscenes(void)
{ {
@ -1100,64 +1088,24 @@ static void G_BonusCutscenes(void)
if (RR) if (RR)
{ {
switch (ud.volume_number) bonussequence_r(ud.volume_number, [](bool) {});
if (ud.volume_number == 0)
{ {
case 0: // Todo: allow to return to the menu here
videoClearScreen(0L);
videoNextPage();
if (adult_lockout == 0)
{
Anim_Play("turdmov.anm");
inputState.ClearAllInput();
videoClearScreen(0L);
videoNextPage();
}
m_level_number = ud.level_number = 0; m_level_number = ud.level_number = 0;
ud.m_volume_number = ud.volume_number = 1; ud.m_volume_number = ud.volume_number = 1;
ud.eog = 0; ud.eog = 0;
fadepal(0, 0, 0, 0, 252, 4); g_turdLevel = false;
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
rotatesprite_fs(0, 0, 65536L, 0, TILE_TENSCREEN, 0, 0, 2+8+16+64+128+BGSTRETCH);
videoNextPage();
fadepal(0, 0, 0, 252, 0, -4);
inputState.ClearAllInput();
G_HandleEventsWhileNoInput();
fadepal(0, 0, 0, 0, 252, 4);
FX_StopAllSounds();
S_ClearSoundLocks();
break;
case 1:
videoClearScreen(0L);
videoNextPage();
if (adult_lockout == 0)
{
Anim_Play("rr_outro.anm");
inputState.ClearAllInput();
videoClearScreen(0L);
videoNextPage();
} }
else
{
g_lastLevel = 0; g_lastLevel = 0;
g_vixenLevel = 1; g_vixenLevel = 1;
ud.level_number = 0; ud.level_number = 0;
ud.volume_number = 0; ud.volume_number = 0;
fadepal(0, 0, 0, 0, 252, 4);
videoSetViewableArea(0, 0, xdim-1, ydim-1);
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
rotatesprite_fs(0, 0, 65536L, 0, TILE_TENSCREEN, 0, 0, 2 + 8 + 16 + 64 + 128 + BGSTRETCH);
videoNextPage();
fadepal(0, 0, 0, 252, 0, -4);
inputState.ClearAllInput();
G_HandleEventsWhileNoInput();
fadepal(0, 0, 0, 0, 252, 4);
FX_StopAllSounds();
S_ClearSoundLocks();
break;
} }
return;
} }
else
bonussequence_d(ud.volume_number, [](bool){}); bonussequence_d(ud.volume_number, [](bool){});
} }