- RR intro movies.

This commit is contained in:
Christoph Oelckers 2020-06-28 10:14:42 +02:00
parent 6be1a9a9e4
commit 9aaf6b416d
11 changed files with 2165 additions and 128 deletions

View file

@ -52,7 +52,7 @@ IMPLEMENT_CLASS(DScreenJob, true, false)
//
//---------------------------------------------------------------------------
void RunScreenJob(DScreenJob *job, std::function<void(bool skipped)> completion, bool clearbefore)
void RunScreenJob(DScreenJob *job, CompletionFunc completion, bool clearbefore)
{
if (clearbefore)
{
@ -183,7 +183,7 @@ public:
//
//---------------------------------------------------------------------------
void PlayVideo(const char* filename, const AnimSound* ans, const int* frameticks, std::function<void(bool skipped)> completion)
void PlayVideo(const char* filename, const AnimSound* ans, const int* frameticks, CompletionFunc completion)
{
if (!filename) // this is for chaining optional videos without special case coding by the caller.
{

View file

@ -2,6 +2,7 @@
#include <functional>
#include "dobject.h"
using CompletionFunc = std::function<void(bool)>;
class DScreenJob : public DObject
{
@ -14,7 +15,7 @@ public:
void RunScreenJob(DScreenJob *job, std::function<void(bool skipped)> completion, bool clearbefore = true);
void RunScreenJob(std::function<int(uint64_t, bool)> action, std::function<void(bool)> completion, bool clearbefore = true);
void RunScreenJob(std::function<int(uint64_t, bool)> action, CompletionFunc completion, bool clearbefore = true);
struct AnimSound
{
@ -22,10 +23,10 @@ struct AnimSound
int soundnum;
};
void PlayVideo(const char *filename, const AnimSound *ans, const int *frameticks, std::function<void(bool)> completion);
void PlayVideo(const char *filename, const AnimSound *ans, const int *frameticks, CompletionFunc completion);
// This one is not suitable for ANM and SMK unless a descriptor file format is implemented.
inline void PlayVideo(const char *filename, std::function<void(bool skipped)> completion)
inline void PlayVideo(const char *filename,CompletionFunc completion)
{
PlayVideo(filename, nullptr, nullptr , completion);
}

View file

@ -1,6 +1,7 @@
set( PCH_SOURCES
src/2d_d.cpp
src/2d_r.cpp
src/game_main.cpp
src/actors.cpp
src/actors_r.cpp

View file

@ -36,6 +36,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "raze_music.h"
#include "mapinfo.h"
#include "screenjob.h"
#include "texturemanager.h"
//#include "zz_text.h"
#undef gametext
@ -43,10 +44,80 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
BEGIN_DUKE_NS
//==========================================================================
//
// Sets up the game fonts.
//
//==========================================================================
void InitFonts_d()
{
GlyphSet fontdata;
// Small font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
fontdata.Insert('!' + i, tile);
}
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear();
// Big font
// This font is VERY messy...
fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11));
fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11));
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i));
fontdata.Insert('.', tileGetTexture(BIGPERIOD));
fontdata.Insert(',', tileGetTexture(BIGCOMMA));
fontdata.Insert('!', tileGetTexture(BIGX));
fontdata.Insert('?', tileGetTexture(BIGQ));
fontdata.Insert(';', tileGetTexture(BIGSEMI));
fontdata.Insert(':', tileGetTexture(BIGCOLIN));
fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69));
fontdata.Insert('`', tileGetTexture(BIGAPPOS));
fontdata.Insert('"', tileGetTexture(BIGAPPOS));
fontdata.Insert('\'', tileGetTexture(BIGAPPOS));
BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear();
// Tiny font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(MINIFONT + i);
if (tile && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
fontdata.Insert('!' + i, tile);
}
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear();
// SBAR index font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i));
fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10));
fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11));
fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!'));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear();
// digital font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
}
// Text output - needs to transition to the actual font routines once everything is set up.
#if 1
int gametext(int x,int y,const char *t,char s,short dabits)
static int gametext(int x,int y,const char *t,char s,short dabits)
{
short ac,newx;
char centre;
@ -95,7 +166,7 @@ int gametext(int x,int y,const char *t,char s,short dabits)
return (x);
}
int gametextpal(int x,int y,const char *t,char s,unsigned char p)
static int gametextpal(int x,int y,const char *t,char s,unsigned char p)
{
short ac,newx;
char centre;
@ -143,7 +214,7 @@ int gametextpal(int x,int y,const char *t,char s,unsigned char p)
return (x);
}
int gametextpart(int x,int y,const char *t,char s,short p)
static int gametextpart(int x,int y,const char *t,char s,short p)
{
short ac,newx, cnt;
char centre;
@ -199,15 +270,15 @@ int gametextpart(int x,int y,const char *t,char s,short p)
return (x);
}
#endif
void gamenumber(int x,int y,int n,char s)
static void gamenumber(int x,int y,int n,char s)
{
char b[10];
//ltoa(n,b,10);
mysnprintf(b,10,"%d",n);
gametext(x,y,b,s,2+8+16);
}
#endif
// ANM player - catastrophically shitty implementation. Todo: Move the sound and fps data to a control file per movie.
@ -551,7 +622,7 @@ class DTitleScreen : public DScreenJob
//
//---------------------------------------------------------------------------
void Logo(void)
void Logo_d(CompletionFunc completion)
{
Mus_Stop();
FX_StopAllSounds(); // JBF 20031228
@ -564,43 +635,21 @@ void Logo(void)
};
static const int logoframetimes[] = { 9, 9, 9 };
PlayVideo(VOLUMEALL && !inputState.CheckAllInput() ? "logo.anm" : nullptr, logosound, logoframetimes, [](bool skipped)
PlayVideo(VOLUMEALL && !inputState.CheckAllInput() ? "logo.anm" : nullptr, logosound, logoframetimes, [=](bool skipped)
{
S_PlaySpecialMusic(MUS_INTRO);
RunScreenJob(!isNam() ? Create<DDRealmsScreen>() : nullptr, [](bool skipped)
RunScreenJob(!isNam() ? Create<DDRealmsScreen>() : nullptr, [=](bool skipped)
{
RunScreenJob(Create<DTitleScreen>(), [](bool skipped)
RunScreenJob(Create<DTitleScreen>(), [=](bool skipped)
{
sound(NITEVISION_ONOFF);
completion(skipped);
});
});
});
#if 0
// Needs to be fixed later. The network code busy-waits and blocks the entire app.
if(ud.multimode > 1)
{
rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1);
rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1);
if (PLUTOPAK) // JBF 20030804
rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1);
gametext(160,190,"WAITING FOR PLAYERS",14,2);
videoNextPage();
}
waitforeverybody();
#endif
twod->ClearScreen();
videoNextPage();
}
void dobonus(char bonusonly)
{
short t, /*r,*/ tinc,gfx_offset;

File diff suppressed because it is too large Load diff

View file

@ -112,6 +112,10 @@ void displaymasks_r(int snum);
void think_d();
void think_r();
void Logo_d(CompletionFunc);
void Logo_r(CompletionFunc);
void InitFonts_d();
void InitFonts_r();
Dispatcher fi;
@ -121,6 +125,8 @@ void SetDispatcher()
if (!isRR())
{
fi = {
Logo_d,
InitFonts_d,
think_d,
initactorflags_d,
isadoorwall_d,
@ -168,6 +174,8 @@ void SetDispatcher()
else
{
fi = {
Logo_r,
InitFonts_r,
think_r,
initactorflags_r,
isadoorwall_r,

View file

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h"
#include "palette.h"
#include "cmdlib.h"
#include "screenjob.h"
BEGIN_DUKE_NS
@ -469,6 +470,10 @@ void spawneffector(int i);
struct Dispatcher
{
// global stuff
void (*ShowLogo)(CompletionFunc completion);
void (*InitFonts)();
// sectors_?.cpp
void (*think)();
void (*initactorflags)();

View file

@ -122,14 +122,14 @@ void genspriteremaps(void)
if (isRR())
{
uint8_t table[256];
for (j = 0; j < 768; j++)
for (j = 0; j < 256; j++)
table[j] = j;
for (j = 0; j < 32; j++)
table[j] = j + 32;
lookups.makeTable(7, table, 0, 0, 0, 0);
for (j = 0; j < 768; j++)
for (j = 0; j < 256; j++)
table[j] = j;
lookups.makeTable(30, table, 0, 0, 0, 0);
lookups.makeTable(31, table, 0, 0, 0, 0);
@ -152,7 +152,7 @@ void genspriteremaps(void)
table[j] = j + 32;
}
lookups.makeTable(34, table, 0, 0, 0, 0);
for (j = 0; j < 768; j++)
for (j = 0; j < 256; j++)
table[j] = j;
for (j = 0; j < 16; j++)
table[j] = j + 129;

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS
extern void G_DisplayExtraScreens(void);
extern void G_DisplayLogo(void);
extern void G_DoOrderScreen(void);
#ifdef DEBUGGINGAIDS

View file

@ -1645,8 +1645,6 @@ void G_PostCreateGameState(void)
Net_SendClientInfo();
}
void InitFonts();
static void G_Startup(void)
{
int32_t i;
@ -1708,7 +1706,7 @@ static void G_Startup(void)
if (TileFiles.artLoadFiles("tiles%03i.art") < 0)
G_GameExit("Failed loading art.");
InitFonts();
fi.InitFonts();
// Make the fullscreen nuke logo background non-fullbright. Has to be
// after dynamic tile remapping (from C_Compile) and loading tiles.
@ -1906,8 +1904,6 @@ static const char* actions[] = {
"Toggle_Crouch", // This is the last one used by EDuke32.
};
void InitFonts();
int32_t SetDefaults(void)
{
g_player[0].ps->aim_mode = 1;
@ -2076,7 +2072,6 @@ int GameInterface::app_main()
#endif
videoInit();
InitFonts();
V_LoadTranslations();
videoSetPalette(BASEPAL, 0);
@ -2142,9 +2137,11 @@ MAIN_LOOP_RESTART:
Net_WaitForEverybody();
}
else
G_DisplayLogo();
{
fi.ShowLogo([](bool) {});
}
M_StartControlPanel(false);
M_StartControlPanel(false);
M_SetMenu(NAME_Mainmenu);
if (G_PlaybackDemo())
{

View file

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menu/menu.h"
#include "mapinfo.h"
#include "v_2ddrawer.h"
#include "screenjob.h"
BEGIN_DUKE_NS
@ -1069,84 +1070,6 @@ void G_DisplayExtraScreens(void)
}
}
void Logo_d();
void Logo_r();
void G_DisplayLogo(void)
{
if (!isRR())
{
Logo_d();
return;
}
int32_t soundanm = 0;
//int32_t logoflags = G_GetLogoFlags();
ready2send = 0;
inputState.ClearAllInput();
videoSetViewableArea(0, 0, xdim-1, ydim-1);
videoClearScreen(0L);
G_FadePalette(0, 0, 0, 252);
renderFlushPerms();
videoNextPage();
Mus_Stop();
FX_StopAllSounds(); // JBF 20031228
if (RRRA)
return;
if (RR)
{
if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo)
{
Net_GetPackets();
Anim_Play("rr_intro.anm");
G_FadePalette(0, 0, 0, 252);
inputState.ClearAllInput();
}
videoClearScreen(0L);
videoNextPage();
FX_StopAllSounds();
S_ClearSoundLocks();
if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo)
{
Net_GetPackets();
Anim_Play("redneck.anm");
G_FadePalette(0, 0, 0, 252);
inputState.ClearAllInput();
}
videoClearScreen(0L);
videoNextPage();
FX_StopAllSounds();
S_ClearSoundLocks();
if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo)
{
Net_GetPackets();
Anim_Play("xatlogo.anm");
G_FadePalette(0, 0, 0, 252);
inputState.ClearAllInput();
}
videoClearScreen(0L);
videoNextPage();
FX_StopAllSounds();
S_ClearSoundLocks();
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
S_PlaySound(NITEVISION_ONOFF, CHAN_AUTO, CHANF_UI);
//G_FadePalette(0,0,0,0);
videoClearScreen(0L);
return;
}
}
void G_DoOrderScreen(void)
{
int32_t i;