- the WH intro movies are playing now.

This commit is contained in:
Christoph Oelckers 2020-10-25 20:09:19 +01:00
parent b8c700e284
commit 2bebe0fa6a
10 changed files with 206 additions and 9 deletions

View file

@ -241,10 +241,11 @@ FResourceFile *CheckPak(const char *filename, FileReader &file, bool quiet, Lump
FResourceFile *CheckZip(const char *filename, FileReader &file, bool quiet, LumpFilterInfo* filter);
FResourceFile *Check7Z(const char *filename, FileReader &file, bool quiet, LumpFilterInfo* filter);
FResourceFile* CheckSSI(const char* filename, FileReader& file, bool quiet, LumpFilterInfo* filter);
FResourceFile* CheckWHRes(const char* filename, FileReader& file, bool quiet, LumpFilterInfo* filter);
FResourceFile *CheckLump(const char *filename,FileReader &file, bool quiet, LumpFilterInfo* filter);
FResourceFile *CheckDir(const char *filename, bool quiet, bool nosub, LumpFilterInfo* filter);
static CheckFunc funcs[] = { CheckWad, CheckZip, Check7Z, CheckPak, CheckGRP, CheckRFF, CheckSSI, CheckLump };
static CheckFunc funcs[] = { CheckWad, CheckZip, Check7Z, CheckPak, CheckGRP, CheckRFF, CheckSSI, CheckWHRes, CheckLump };
FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileReader &file, bool quiet, bool containeronly, LumpFilterInfo* filter)
{

View file

@ -52,7 +52,7 @@
#define PATH_MAX 260
#endif
static const char* validexts[] = { "*.grp", "*.zip", "*.pk3", "*.pk4", "*.7z", "*.pk7", "*.dat", "*.rff" };
static const char* validexts[] = { "*.grp", "*.zip", "*.pk3", "*.pk4", "*.7z", "*.pk7", "*.dat", "*.rff", "*.ssi" };
//==========================================================================
//

View file

@ -586,6 +586,15 @@ void SetDefaultMenuColors()
gameinfo.mSliderColor = "Yellow";
cls = PClass::FindClass("ExhumedMenuDelegate");
}
else if (g_gameType & (GAMEFLAG_WH | GAMEFLAG_WH2))
{
OptionSettings.mFontColorHeader = CR_DARKGREEN;
OptionSettings.mFontColorHighlight = CR_GRAY;
OptionSettings.mFontColorSelection = CR_GREEN;
OptionSettings.mFontColor = CR_FIRE;
gameinfo.mSliderColor = "Yellow";
cls = PClass::FindClass(g_gameType & GAMEFLAG_WH2? "WH2MenuDelegate" : "WHMenuDelegate");
}
else
{
if (g_gameType & (GAMEFLAG_NAM | GAMEFLAG_NAPALM | GAMEFLAG_WW2GI))

View file

@ -47,7 +47,7 @@
#include "filesystem.h"
#include "findfile.h"
static const char* res_exts[] = { ".grp", ".zip", ".pk3", ".pk4", ".7z", ".pk7" };
static const char* res_exts[] = { ".grp", ".zip", ".pk3", ".pk4", ".7z", ".pk7", "esnd" }; // 'esnd' is for 'JOESND' as used by the Capstone games
int g_gameType;
@ -561,7 +561,8 @@ static TArray<GrpInfo> ParseGrpInfo(const char *fn, FileReader &fr, TMap<FString
}
else sc.ScriptError(nullptr);
}
if (grp.dependencyCRC == 0 && (grp.flags & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_NAPALM | GAMEFLAG_WW2GI | GAMEFLAG_RRALL | GAMEFLAG_BLOOD | GAMEFLAG_SW | GAMEFLAG_PSEXHUMED)) == 0)
if (grp.dependencyCRC == 0 && (grp.flags & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_NAPALM | GAMEFLAG_WW2GI | GAMEFLAG_RRALL |
GAMEFLAG_BLOOD | GAMEFLAG_SW | GAMEFLAG_PSEXHUMED | GAMEFLAG_WH | GAMEFLAG_WH2)) == 0)
{
sc.ScriptMessage("Warning: GRP without game defined. Ignoring");
groups.Pop();

View file

@ -41,6 +41,8 @@ set( PCH_SOURCES
src/wh.cpp
src/main.cpp
src/music.cpp
src/sound.cpp
src/fonts.cpp
)
add_game_library2( whaven )

View file

@ -1,8 +1,36 @@
#include "ns.h"
#include "wh.h"
#include "screenjob.h"
#include "raze_music.h"
#include "raze_sound.h"
BEGIN_WH_NS
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void IntroMovie(const CompletionFunc& completion)
{
Mus_Stop();
FX_StopAllSounds();
if (userConfig.nologo)
{
completion(false);
return;
}
else
{
JobDesc job = { PlayVideo(g_gameType & GAMEFLAG_WH2? "smk/intro.smk" : "intro.smk"), nullptr };
RunScreenJob(&job, 1, completion, true, true);
}
}
void showStatisticsScreen()
{
#if 0

View file

@ -0,0 +1,46 @@
#include "ns.h"
#include "wh.h"
#include "v_font.h"
BEGIN_WH_NS
//==========================================================================
//
// Sets up the game fonts.
//
//==========================================================================
void InitFonts()
{
// Remap table for the menu font.
uint8_t remapbuf[256];
for(int i = 242; i < 252; i++) //yellow to green
remapbuf[i] = (uint8_t) (368 - i);
for(int i = 117; i < 127; i++) //green to yellow
remapbuf[i] = (uint8_t) (368 - i);
lookups.makeTable(20, remapbuf, 0, 0, 0, true);
GlyphSet fontdata;
// Small font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THEFONT + 26 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(THEFONT + i));
fontdata.Insert('!', tileGetTexture(1547)); // WH2 is each one less.
fontdata.Insert('?', tileGetTexture(1548));
fontdata.Insert('-', tileGetTexture(1549));
fontdata.Insert('_', tileGetTexture(1549));
fontdata.Insert(':', tileGetTexture(1550));
// The texture offsets in this font are useless for font printing. This should only apply to these glyphs, not for international extensions, though.
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 5, false, false, false, &fontdata);
}
END_WH_NS

View file

@ -203,6 +203,8 @@ static void readpalettetable(void)
void GameInterface::app_init()
{
InitNames();
engineInit();
TileFiles.LoadArtSet("tiles%03d.art");
TileFiles.tileMakeWritable(ANILAVA);
TileFiles.tileMakeWritable(HEALTHWATER);
@ -211,6 +213,8 @@ void GameInterface::app_init()
//ConsoleInit();
g_visibility=1024;
readpalettetable();
TileFiles.SetBackup();
InitFonts();
if(isWh2()) {
tileDelete(FLOORMIRROR);
@ -229,6 +233,7 @@ void GameInterface::app_init()
FadeInit();
setupmidi();
sfxInit();
//sndInit();
//initpaletteshifts();
InitOriginalEpisodes();
@ -236,12 +241,16 @@ void GameInterface::app_init()
void GameInterface::Startup()
{
/*
if (gCutsceneScreen.init("intro.smk"))
changeScreen(gCutsceneScreen.setSkipping(main).escSkipping(true));
if (userConfig.CommandMap.IsNotEmpty())
{
}
else
changeScreen(gMenuScreen);
*/
{
IntroMovie([](bool)
{
gameaction = ga_mainmenu;
});
}
}
::GameInterface* CreateInterface()

View file

@ -0,0 +1,96 @@
#include "ns.h"
#include "wh.h"
#include "raze_sound.h"
BEGIN_WH_NS
class WHSoundEngine : public SoundEngine
{
// client specific parts of the sound engine go in this class.
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan *channel) override;
TArray<uint8_t> ReadSound(int lumpnum) override;
public:
WHSoundEngine()
{
S_Rolloff.RolloffType = ROLLOFF_Doom;
S_Rolloff.MinDistance = 170; // these are the numbers I got when uncrunching the original sound code.
S_Rolloff.MaxDistance = 850;
}
void StopChannel(FSoundChan* chan) override
{
if (chan && chan->SysChannel != NULL && !(chan->ChanFlags & CHANF_EVICTED) && chan->SourceType == SOURCE_Actor)
{
chan->Source = NULL;
chan->SourceType = SOURCE_Unattached;
}
SoundEngine::StopChannel(chan);
}
};
void sfxInit(void)
{
soundEngine = new WHSoundEngine;
}
void sfxTerm()
{
}
//==========================================================================
//
//
//
//==========================================================================
TArray<uint8_t> WHSoundEngine::ReadSound(int lumpnum)
{
auto wlump = fileSystem.OpenFileReader(lumpnum);
return wlump.Read();
}
void WHSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan *)
{
#if 0
if (pos != nullptr && type != SOURCE_None)
{
FVector3 camera;
if (gMe && gMe->pSprite) camera = GetSoundPos(&gMe->pSprite->pos);
else camera = { 0, 0, 0 }; // don't crash if there is no player.
if (vel) vel->Zero();
if (type == SOURCE_Unattached)
{
pos->X = pt[0];
pos->Y = pt[1];
pos->Z = pt[2];
}
else if (type == SOURCE_Actor)
{
auto actor = (spritetype*)source;
assert(actor != nullptr);
size_t index = actor - sprite;
// Engine expects velocity in units per second, not units per tic.
if (vel) *vel = { xvel[index] * (30 / 65536.f), zvel[index] * (-30 / 65536.f), yvel[index] * (-30 / 65536.f) };
*pos = GetSoundPos(&actor->pos);
}
else if (type == SOURCE_Ambient)
{
*pos = camera; // just to be safe. Ambient sounds are in the world but unpositioned
}
if ((chanflags & CHANF_LISTENERZ))
{
pos->Y = camera.Y;
}
}
#endif
}
END_WH_NS

View file

@ -23,6 +23,7 @@ END_WH_NS
#include "gstrings.h"
#include "gamecontrol.h"
#include "d_net.h"
#include "screenjob.h"
BEGIN_WH_NS
@ -460,6 +461,10 @@ void showStatisticsScreen();
void showVictoryScreen();
void InitNames();
void InitFonts();
void sfxInit(void);
void IntroMovie(const CompletionFunc& completion);
#include "item.h"