Initial CSlideShow

This commit is contained in:
Jack Andersen 2016-09-16 10:18:03 -10:00
parent f5ac582541
commit 2fed8f36fb
19 changed files with 383 additions and 39 deletions

View File

@ -39,4 +39,5 @@ add_library(DNACommon
Tweaks/ITweakPlayerGun.hpp
Tweaks/ITweakGunRes.hpp
Tweaks/ITweakPlayerRes.hpp
Tweaks/ITweakGui.hpp)
Tweaks/ITweakGui.hpp
Tweaks/ITweakSlideShow.hpp)

View File

@ -10,6 +10,7 @@
#include "hecl/Database.hpp"
#include "../SpecBase.hpp"
#include "boo/ThreadLocalPtr.hpp"
#include "zeus/CColor.hpp"
namespace DataSpec
{
@ -47,6 +48,40 @@ public:
{return __isz + 4;}
};
class DNAColor final : public BigYAML, public zeus::CColor
{
public:
DNAColor() = default;
DNAColor(const zeus::CColor& color) : zeus::CColor(color) {}
Delete expl;
void read(athena::io::IStreamReader& reader)
{zeus::CColor::readRGBABig(reader);}
void write(athena::io::IStreamWriter& writer) const
{zeus::CColor::writeRGBABig(writer);}
void read(athena::io::YAMLDocReader& reader)
{
size_t count;
reader.enterSubVector(nullptr, count);
r = (count >= 1) ? reader.readFloat(nullptr) : 0.f;
g = (count >= 2) ? reader.readFloat(nullptr) : 0.f;
b = (count >= 3) ? reader.readFloat(nullptr) : 0.f;
a = (count >= 4) ? reader.readFloat(nullptr) : 0.f;
reader.leaveSubVector();
}
void write(athena::io::YAMLDocWriter& writer) const
{
writer.enterSubVector(nullptr);
writer.writeFloat(nullptr, r);
writer.writeFloat(nullptr, g);
writer.writeFloat(nullptr, b);
writer.writeFloat(nullptr, a);
writer.leaveSubVector();
}
size_t binarySize(size_t __isz) const
{return __isz + 4;}
};
using FourCC = hecl::FourCC;
class UniqueID32;
class UniqueID64;

View File

@ -0,0 +1,15 @@
#ifndef __DNACOMMON_ITWEAKSLIDESHOW_HPP__
#define __DNACOMMON_ITWEAKSLIDESHOW_HPP__
#include "../DNACommon.hpp"
namespace DataSpec
{
struct ITweakSlideShow : BigYAML
{
};
}
#endif // __DNACOMMON_ITWEAKSLIDESHOW_HPP__

View File

@ -24,7 +24,8 @@ make_dnalist(liblist
Tweaks/CTweakPlayerGun
Tweaks/CTweakGunRes
Tweaks/CTweakPlayerRes
Tweaks/CTweakGui)
Tweaks/CTweakGui
Tweaks/CTweakSlideShow)
add_library(DNAMP1
DNAMP1.hpp DNAMP1.cpp

View File

@ -0,0 +1,40 @@
#ifndef _DNAMP1_CTWEAKSLIDESHOW_HPP_
#define _DNAMP1_CTWEAKSLIDESHOW_HPP_
#include "../../DNACommon/Tweaks/ITweakSlideShow.hpp"
#include "zeus/CColor.hpp"
namespace DataSpec
{
namespace DNAMP1
{
struct CTweakSlideShow : ITweakSlideShow
{
DECL_YAML
String<-1> x4_pakName;
String<-1> x14_fontAssetName;
DNAColor x24_;
DNAColor x28_;
Value<float> x2c_;
Value<float> x30_;
Value<float> x34_;
Value<float> x38_;
Value<float> x3c_;
DNAColor x40_;
Value<float> x44_;
Value<float> x48_;
Value<float> x4c_;
Value<float> x50_;
Value<float> x54_;
Value<float> x58_;
CTweakSlideShow() = default;
CTweakSlideShow(athena::io::IStreamReader& in) { read(in); }
};
}
}
#endif // _DNAMP1_CTWEAKSLIDESHOW_HPP_

View File

@ -22,6 +22,7 @@
#include "DNACommon/Tweaks/TweakWriter.hpp"
#include "DNAMP1/Tweaks/CTweakPlayerRes.hpp"
#include "DNAMP1/Tweaks/CTweakGunRes.hpp"
#include "DNAMP1/Tweaks/CTweakSlideShow.hpp"
#include "hecl/ClientProcess.hpp"
@ -354,6 +355,8 @@ struct SpecMP1 : SpecBase
return true;
else if (!strcmp(classType, DNAMP1::CTweakGunRes::DNAType()))
return true;
else if (!strcmp(classType, DNAMP1::CTweakSlideShow::DNAType()))
return true;
else if (!strcmp(classType, DNAMP1::HINT::DNAType()))
return true;
return false;
@ -507,6 +510,12 @@ struct SpecMP1 : SpecBase
gunRes.read(reader);
WriteTweak(gunRes, out);
}
else if (!classStr.compare(DNAMP1::CTweakSlideShow::DNAType()))
{
DNAMP1::CTweakSlideShow slideShow;
slideShow.read(reader);
WriteTweak(slideShow, out);
}
else if (!classStr.compare(DNAMP1::HINT::DNAType()))
{
DNAMP1::HINT::Cook(in, out);

View File

@ -140,7 +140,8 @@ SObjectTag ProjectResourceFactoryMP1::TagFromPath(const hecl::ProjectPath& path,
return true;
}
else if (!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerRes") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakGunRes"))
!strcmp(className, "DataSpec::DNAMP1::CTweakGunRes") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakSlideShow"))
{
resTag.type = SBIG('CTWK');
return true;

View File

@ -17,7 +17,7 @@ enum class EClientFlowStates
class CMainFlowBase : public CIOWin
{
protected:
EClientFlowStates x14_gameState;
EClientFlowStates x14_gameState = EClientFlowStates::Unspecified;
public:
CMainFlowBase(const char* name) : CIOWin(name) {}
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);

View File

@ -23,5 +23,6 @@ DataSpec::ITweakPlayerGun* g_tweakPlayerGun = nullptr;
DataSpec::ITweakGunRes* g_tweakGunRes = nullptr;
DataSpec::ITweakPlayerRes* g_tweakPlayerRes = nullptr;
DataSpec::ITweakGui* g_tweakGui = nullptr;
DataSpec::ITweakSlideShow* g_tweakSlideShow = nullptr;
}

View File

@ -7,6 +7,7 @@
#include "../DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakGui.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp"
#include "AutoMapper/ITweakAutoMapper.hpp"
#include "GuiSys/ITweakGui.hpp"
@ -34,6 +35,7 @@ extern DataSpec::ITweakGunRes* g_tweakGunRes;
extern DataSpec::ITweakPlayerRes* g_tweakPlayerRes;
extern ITweakAutoMapper* g_tweakAutoMapper;
extern DataSpec::ITweakGui* g_tweakGui;
extern DataSpec::ITweakSlideShow* g_tweakSlideShow;
}

View File

@ -39,7 +39,7 @@ CIOWin::EMessageReturn CSplashScreen::OnMessage(const CArchitectureMessage& msg,
if (x18_splashTimeout <= 0.f)
{
if (x14_which != ESplashScreen::Dolby)
if (x14_which != ESplashScreen::Retro)
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 9999, 9999,
new CSplashScreen(ESplashScreen(int(x14_which) + 1))));
return EMessageReturn::RemoveIOWinAndExit;

View File

@ -1,67 +1,154 @@
#include "CFrontEndUI.hpp"
#include "CArchitectureMessage.hpp"
#include "CArchitectureQueue.hpp"
#include "CDvdFile.hpp"
#include "CSimplePool.hpp"
#include "GameGlobalObjects.hpp"
#include "MP1.hpp"
#include "CSlideShow.hpp"
namespace urde
{
namespace MP1
{
CFrontEndUI::CFrontEndUI()
SObjectTag g_DefaultWorldTag = {FOURCC('MLVL'), 0x158efe17};
CFrontEndUI::CFrontEndUI(CArchitectureQueue& queue)
: CIOWin("FrontEndUI")
{
x20_depsGroup = g_SimplePool->GetObj("FrontEnd_DGRP");
x38_pressStart = g_SimplePool->GetObj("TXTR_PressStart");
x44_frontendAudioGrp = g_SimplePool->GetObj("FrontEnd_AGSC");
g_Main->ResetGameState();
g_GameState->SetCurrentWorldId(g_DefaultWorldTag.id);
for (int i=0 ; CDvdFile::FileExists(GetAttractMovieFileName(i).c_str()) ; ++i)
++xc0_attractCount;
}
void CFrontEndUI::OnSliderSelectionChange(CGuiSliderGroup* grp, float)
{}
void CFrontEndUI::OnCheckBoxSelectionChange(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnOptionSubMenuCancel(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnOptionsMenuCancel(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnNewGameMenuCancel(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnFileMenuCancel(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnGenericMenuSelectionChange(CGuiTableGroup* grp, int, int)
{}
void CFrontEndUI::OnOptionsMenuAdvance(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnNewGameMenuAdvance(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnFileMenuAdvance(CGuiTableGroup* grp)
{}
void CFrontEndUI::OnMainMenuAdvance(CGuiTableGroup* grp)
{}
const char* CFrontEndUI::GetAttractMovieFileName(int idx)
{return nullptr;}
const char* CFrontEndUI::GetNextAttractMovieFileName(int idx)
{return nullptr;}
void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue)
{
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CSlideShow())));
}
std::string CFrontEndUI::GetAttractMovieFileName(int idx)
{
return hecl::Format("Video/attract%d.thp", idx);
}
std::string CFrontEndUI::GetNextAttractMovieFileName()
{
GetAttractMovieFileName(xbc_nextAttract);
xbc_nextAttract = (xbc_nextAttract + 1) % xc0_attractCount;
}
void CFrontEndUI::SetCurrentMovie(EMenuMovie movie)
{}
void CFrontEndUI::StopAttractMovie()
{}
void CFrontEndUI::StartAttractMovie(int idx)
{}
void CFrontEndUI::UpdateMenuHighlights(CGuiTableGroup* grp)
{}
void CFrontEndUI::CompleteStateTransition()
{}
bool CFrontEndUI::CanBuild(const SObjectTag& tag)
{return false;}
{
return false;
}
void CFrontEndUI::StartStateTransition(EScreen screen)
{}
void CFrontEndUI::HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue)
{}
void CFrontEndUI::Draw() const
{}
{
printf("DRAW\n");
}
void CFrontEndUI::UpdateMovies(float dt)
{}
void CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
{}
void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue& queue)
{
}
CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue)
{
printf("UPDATE\n");
return EMessageReturn::Exit;
}
CIOWin::EMessageReturn CFrontEndUI::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
{return EMessageReturn::Normal;}
{
switch (msg.GetType())
{
case EArchMsgType::UserInput:
{
const CArchMsgParmUserInput& input = MakeMsg::GetParmUserInput(msg);
ProcessUserInput(input.x4_parm, queue);
break;
}
case EArchMsgType::TimerTick:
{
float dt = MakeMsg::GetParmTimerTick(msg).x4_parm;
return Update(dt, queue);
}
case EArchMsgType::QuitGameplay:
{
x14_phase = Phase::Six;
break;
}
default: break;
}
return EMessageReturn::Normal;
}
void CFrontEndUI::StartGame()
{}
void CFrontEndUI::InitializeFrame()
{}

View File

@ -3,6 +3,8 @@
#include "CIOWin.hpp"
#include "CGameDebug.hpp"
#include "RetroTypes.hpp"
#include "CToken.hpp"
namespace urde
{
@ -10,14 +12,62 @@ class CGuiSliderGroup;
class CGuiTableGroup;
class CMoviePlayer;
struct SObjectTag;
class CDependencyGroup;
class CTexture;
class CAudioGroupSet;
namespace MP1
{
class CFrontEndUI : public CIOWin
{
u32 x14_ = 0;
u32 x18_;
public:
enum class Phase
{
Zero,
One,
Two,
Three,
Four,
Five,
Six
};
struct SScreenData
{
};
private:
Phase x14_phase = Phase::Zero;
u32 x18_rndA;
u32 x1c_rndB;
TLockedToken<CDependencyGroup> x20_depsGroup;
TLockedToken<CTexture> x38_pressStart;
TLockedToken<CAudioGroupSet> x44_frontendAudioGrp;
u32 x50_ = 0;
u32 x54_ = 0;
float x58_ = 0.f;
bool x5c_ = false;
float x60_ = 0.f;
float x64_ = 0.f;
float x68_ = 1.f;
std::unique_ptr<u32> x6c_[9];
int xb8_nextAttract = -1;
int xbc_nextAttract = 0;
int xc0_attractCount = 0;
std::unique_ptr<u32> xc4_;
u32 xc8_ = 0;
u32 xcc_ = 0;
bool xd0_ = 0;
bool xd1_ = 0;
bool xd2_ = 0;
u32 xd4_ = 0;
u32 xd8_ = 0;
std::unique_ptr<SScreenData> xdc_scrData;
u32 xe0_ = 0;
u32 xe4_ = 0;
u32 xec_ = 0;
u32 xf0_ = 0;
u32 xf4_ = 0;
public:
enum class EMenuMovie
{
@ -26,7 +76,7 @@ public:
{
};
CFrontEndUI();
CFrontEndUI(CArchitectureQueue& queue);
void OnSliderSelectionChange(CGuiSliderGroup* grp, float);
void OnCheckBoxSelectionChange(CGuiTableGroup* grp);
void OnOptionSubMenuCancel(CGuiTableGroup* grp);
@ -38,8 +88,9 @@ public:
void OnNewGameMenuAdvance(CGuiTableGroup* grp);
void OnFileMenuAdvance(CGuiTableGroup* grp);
void OnMainMenuAdvance(CGuiTableGroup* grp);
const char* GetAttractMovieFileName(int idx);
const char* GetNextAttractMovieFileName(int idx);
void StartSlideShow(CArchitectureQueue& queue);
std::string GetAttractMovieFileName(int idx);
std::string GetNextAttractMovieFileName();
void SetCurrentMovie(EMenuMovie movie);
void StopAttractMovie();
void StartAttractMovie(int idx);
@ -50,7 +101,8 @@ public:
void HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue);
void Draw() const;
void UpdateMovies(float dt);
void Update(float dt, CArchitectureQueue& queue);
void ProcessUserInput(const CFinalInput& input, CArchitectureQueue& queue);
EMessageReturn Update(float dt, CArchitectureQueue& queue);
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
void StartGame();
void InitializeFrame();

View File

@ -17,10 +17,12 @@ void CMainFlow::AdvanceGameState(CArchitectureQueue& queue)
{
switch (x14_gameState)
{
case EClientFlowStates::Unspecified:
CMainFlow::SetGameState(EClientFlowStates::FrontEnd, queue);
break;
case EClientFlowStates::FrontEnd:
CMainFlow::SetGameState(EClientFlowStates::GameLoad, queue);
break;
case EClientFlowStates::Unspecified:
case EClientFlowStates::GameLoad:
CMainFlow::SetGameState(EClientFlowStates::MoviePlay, queue);
break;
@ -48,7 +50,7 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
*/
g_Main->LoadAudio();
g_Main->RegisterResourceTweaks();
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CFrontEndUI())));
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CFrontEndUI(queue))));
break;
}
case EClientFlowStates::GameLoad:

View File

@ -9,6 +9,7 @@ set(MP1_SOURCES
CMFGame.hpp CMFGame.cpp
CPlayMovie.hpp CPlayMovie.cpp
CFrontEndUI.hpp CFrontEndUI.cpp
CSlideShow.hpp CSlideShow.cpp
CNewIntroBoss.hpp CNewIntroBoss.cpp
CBeetle.hpp CBeetle.cpp
CWarWasp.hpp CWarWasp.cpp

View File

@ -0,0 +1,20 @@
#include "CSlideShow.hpp"
namespace urde
{
CSlideShow::CSlideShow()
: CIOWin("SlideShow")
{
}
CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
{
return EMessageReturn::Exit;
}
void CSlideShow::Draw() const
{
}
}

View File

@ -0,0 +1,86 @@
#ifndef __URDE_MP1_CSLIDESHOW_HPP__
#define __URDE_MP1_CSLIDESHOW_HPP__
#include "RetroTypes.hpp"
#include "CIOWin.hpp"
#include "CToken.hpp"
namespace urde
{
class CTexture;
class CSlideShow : public CIOWin
{
u32 x14_ = 0;
u32 x1c_ = 0;
u32 x20_ = 0;
u32 x24_ = 0;
u32 x2c_ = 0;
u32 x30_ = 0;
u32 x34_ = 0;
u32 x38_ = 0;
u32 x3c_ = 0;
u32 x40_ = 0;
u32 x44_ = 0;
u32 x48_ = -1;
float x4c_ = 0.f;
float x50_ = 0.f;
float x54_ = 0.f;
float x58_ = 0.f;
u32 x5c_ = 0;
u32 x60_ = -1;
u32 x64_ = 0;
bool x68_ = false;
u32 x6c_ = 0;
bool x70_ = false;
u32 xc4_ = 0;
u32 xc8_ = 0;
u32 xcc_ = 0;
u32 xd4_ = 0;
u32 xd8_ = 0;
u32 xdc_ = 0;
u32 xe0_ = 0;
u32 xe4_ = 0;
u32 xe8_ = 0;
u32 xec_ = 0;
u32 xf0_ = 0;
u32 xf4_ = 0;
u32 xfc_ = 0;
u32 x100_ = 0;
u32 x104_ = 0;
u32 x10c_ = 0;
u32 x110_ = 0;
u32 x114_ = 0;
u32 x11c_ = 0;
u32 x120_ = 0;
u32 x124_ = 0;
float x128_ = 32.f;
float x12c_ = 32.f;
union
{
struct
{
bool x134_24_ : 1;
bool x134_25_ : 1;
bool x134_26_ : 1;
bool x134_27_ : 1;
bool x134_28_ : 1;
bool x134_29_ : 1;
bool x134_30_ : 1;
bool x134_31_ : 1;
bool x135_24_ : 1;
};
u32 dummy = 0;
};
public:
CSlideShow();
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&);
bool GetIsContinueDraw() const {return false;}
void Draw() const;
};
}
#endif // __URDE_MP1_CSLIDESHOW_HPP__

View File

@ -10,6 +10,7 @@
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp"
namespace urde
{
@ -29,22 +30,12 @@ static const SObjectTag& IDFromFactory(CResFactory& factory, const char* name)
void CTweaks::RegisterTweaks()
{
#if 0
CResFactory& factory = *g_ResFactory;
CResLoader& loader = factory.GetLoader();
std::unique_ptr<CInputStream> strm;
ProjectResourceFactoryMP1& factory = ProjectManager::g_SharedManager->resourceFactoryMP1();
std::experimental::optional<CMemoryInStream> strm;
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Game"), nullptr));
TOneStatic<DataSpec::DNAMP1::CTweakGame> game(*strm);
g_tweakGame = game.GetAllocSpace();
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "Player"), nullptr));
TOneStatic<DataSpec::DNAMP1::CTweakPlayer> player(*strm);
g_tweakPlayer = player.GetAllocSpace();
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "PlayerControls"), nullptr));
TOneStatic<DataSpec::DNAMP1::CTweakPlayerControl> playerControl(*strm);
g_tweakPlayerControl = playerControl.GetAllocSpace();
#endif
SObjectTag tag = factory.ProjectResourceFactoryBase::TagFromPath(_S("MP1/Tweaks/SlideShow.yaml"));
strm.emplace(factory.LoadResourceSync(tag).release(), factory.ResourceSize(tag));
g_tweakSlideShow = new DataSpec::DNAMP1::CTweakSlideShow(*strm);
}
void CTweaks::RegisterResourceTweaks()

@ -1 +1 @@
Subproject commit 981cc9d0b3e7f99b314ebe1ef87b23a94e38e58e
Subproject commit d355cca051ee8695f63b442dfcf1e4b11fd9a20e