Initial HINT support

This commit is contained in:
Phillip Stephens 2016-09-07 19:01:29 -07:00
parent 9b436b4b23
commit f5db2527e4
11 changed files with 202 additions and 5 deletions

View File

@ -16,6 +16,7 @@ make_dnalist(liblist
SCAN
FRME
SAVW
HINT
Tweaks/CTweakGame
Tweaks/CTweakParticle
Tweaks/CTweakPlayer

View File

@ -14,6 +14,7 @@
#include "../DNACommon/DPSC.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/DGRP.hpp"
#include "HINT.hpp"
#include "CMDL.hpp"
#include "AFSM.hpp"
#include "SAVW.hpp"
@ -282,6 +283,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
return {STRG::Extract, nullptr, {_S(".yaml")}};
case SBIG('SCAN'):
return {SCAN::Extract, nullptr, {_S(".yaml")}, 0, SCAN::Name};
case SBIG('HINT'):
return {HINT::Extract, nullptr, {_S(".yaml")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
case SBIG('TXTR'):

52
DataSpec/DNAMP1/HINT.hpp Normal file
View File

@ -0,0 +1,52 @@
#ifndef _DNAMP1_HINT_HPP_
#define _DNAMP1_HINT_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/PAK.hpp"
namespace DataSpec
{
namespace DNAMP1
{
struct HINT : BigYAML
{
DECL_YAML
Value<atUint32> magic;
Value<atUint32> version;
struct Hint : BigYAML
{
DECL_YAML
String<-1> name;
Value<float> unknown1;
Value<float> fadeInTime;
UniqueID32 stringID;
Value<atUint32> unknown2;
struct Location : BigYAML
{
DECL_YAML
UniqueID32 worldAssetID;
UniqueID32 areaAssetID;
Value<atUint32> areaID;
UniqueID32 stringID;
};
Value<atUint32> locationCount;
Vector<Location, DNA_COUNT(locationCount)> locations;
};
Value<atUint32> hintCount;
Vector<Hint, DNA_COUNT(hintCount)> hints;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
HINT hint;
hint.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
hint.toYAMLStream(writer);
return true;
}
};
}
}
#endif // _DNAMP1_HINT_HPP_

View File

@ -8,6 +8,7 @@
#include "MAPA.hpp"
#include "AFSM.hpp"
#include "SAVW.hpp"
#include "../DNAMP1/HINT.hpp"
#include "../DNACommon/FSM2.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/FONT.hpp"
@ -217,6 +218,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK& pak, const
{
switch (entry.type)
{
case SBIG('HINT'):
return {DNAMP1::HINT::Extract, nullptr, {_S(".yaml")}};
case SBIG('STRG'):
return {STRG::Extract, nullptr, {_S(".yaml")}};
case SBIG('TXTR'):

View File

@ -8,7 +8,8 @@ make_dnalist(liblist
CSKR
MREA
SAVW
CAUD)
CAUD
HINT)
add_library(DNAMP3
DNAMP3.hpp DNAMP3.cpp
${liblist}

View File

@ -10,6 +10,7 @@
#include "MREA.hpp"
#include "MAPA.hpp"
#include "SAVW.hpp"
#include "HINT.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/FSM2.hpp"
@ -236,6 +237,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
return {TXTR::Extract, nullptr, {_S(".png")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
case SBIG('HINT'):
return {HINT::Extract, nullptr, {_S(".yaml")}};
case SBIG('CMDL'):
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
case SBIG('CHAR'):

52
DataSpec/DNAMP3/HINT.hpp Normal file
View File

@ -0,0 +1,52 @@
#ifndef _DNAMP3_HINT_HPP_
#define _DNAMP3_HINT_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec
{
namespace DNAMP3
{
struct HINT : BigYAML
{
DECL_YAML
Value<atUint32> magic;
Value<atUint32> version;
struct Hint : BigYAML
{
DECL_YAML
String<-1> name;
Value<float> unknown1;
Value<float> fadeInTime;
UniqueID64 stringID;
Value<atUint32> unknown2;
struct Location : BigYAML
{
DECL_YAML
UniqueID64 worldAssetID;
UniqueID64 areaAssetID;
Value<atUint32> areaID;
UniqueID64 stringID;
Value<atUint32> unknown[3];
};
Value<atUint32> locationCount;
Vector<Location, DNA_COUNT(locationCount)> locations;
};
Value<atUint32> hintCount;
Vector<Hint, DNA_COUNT(hintCount)> hints;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
HINT hint;
hint.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
hint.toYAMLStream(writer);
return true;
}
};
}
}
#endif // _DNAMP1_HINT_HPP_

43
Runtime/CGameHintInfo.cpp Normal file
View File

@ -0,0 +1,43 @@
#include "CGameHintInfo.hpp"
#include "CToken.hpp"
namespace urde
{
CGameHintInfo::CGameHintInfo(CInputStream& in, s32 version)
{
u32 hintCount = in.readUint32Big();
x0_hints.reserve(hintCount);
for (u32 i = 0; i < hintCount; ++i)
x0_hints.emplace_back(in, version);
}
CGameHintInfo::CGameHint::CGameHint(CInputStream& in, s32 version)
: x0_name(in.readString())
, x10_(in.readFloatBig())
, x14_fadeInTime(in.readFloatBig())
, x18_stringId(in.readUint32Big())
, x1c_(3.f * float(version <= 0 ? 1 : in.readUint32Big()))
{
u32 locationCount = in.readUint32Big();
x20_locations.reserve(locationCount);
for (u32 i = 0; i < locationCount; ++i)
x20_locations.emplace_back(in, version);
}
CGameHintInfo::SHintLocation::SHintLocation(CInputStream& in, s32)
: x0_mlvlId(in.readUint32Big())
, x4_mreaId(in.readUint32Big())
, x8_areaId(in.readUint32Big())
, xc_stringId(in.readUint32Big())
{
}
CFactoryFnReturn FHintFactory(const SObjectTag&, CInputStream& in, const CVParamTransfer, CObjectReference*)
{
in.readUint32Big();
s32 version = in.readInt32Big();
return TToken<CGameHintInfo>::GetIObjObjectFor(std::make_unique<CGameHintInfo>(in, version));
}
}

41
Runtime/CGameHintInfo.hpp Normal file
View File

@ -0,0 +1,41 @@
#ifndef __URDE_CGAMEHINTINFO_HPP__
#define __URDE_CGAMEHINTINFO_HPP__
#include "RetroTypes.hpp"
#include "IFactory.hpp"
namespace urde
{
class CGameHintInfo
{
public:
struct SHintLocation
{
ResId x0_mlvlId = -1;
ResId x4_mreaId = -1;
TAreaId x8_areaId = kInvalidAreaId;
ResId xc_stringId = -1;
SHintLocation(CInputStream&, s32);
};
class CGameHint
{
std::string x0_name;
float x10_;
float x14_fadeInTime;
ResId x18_stringId;
float x1c_;
std::vector<SHintLocation> x20_locations;
public:
CGameHint(CInputStream&, s32);
};
private:
std::vector<CGameHint> x0_hints;
public:
CGameHintInfo(CInputStream&, s32);
};
CFactoryFnReturn FHintFactory(const SObjectTag&, CInputStream&, const CVParamTransfer, CObjectReference*);
}
#endif // __URDE_CGAMEHINTINFO_HPP__

View File

@ -36,11 +36,8 @@ class CGameState
std::vector<CWorldState> x88_worldStates;
std::shared_ptr<CPlayerState> x98_playerState;
std::shared_ptr<CWorldTransManager> x9c_transManager;
CGameOptions m_gameOpts;
double xa0_playTime;
u32 xa4_;
/* x17c_ */
CGameOptions x17c_gameOptions;
/* x1f8_ */
union

View File

@ -95,6 +95,7 @@ add_library(RuntimeCommon
CInGameTweakManagerBase.hpp
CPlayMovieBase.hpp
CGameDebug.hpp CGameDebug.cpp
CGameHintInfo.hpp CGameHintInfo.cpp
rstl.hpp rstl.cpp
GameGlobalObjects.hpp GameGlobalObjects.cpp
RetroTypes.hpp