This commit is contained in:
Jack Andersen 2016-03-17 16:46:10 -10:00
commit a5e3440866
3 changed files with 10 additions and 6 deletions

View File

@ -6,6 +6,7 @@
#include "Runtime/Particle/CElectricDescription.hpp"
#include "Runtime/Particle/CSwooshDescription.hpp"
#include "Runtime/GuiSys/CGuiFrame.hpp"
#include "Runtime/GuiSys/CRasterFont.hpp"
#include "Runtime/Graphics/CModel.hpp"
#include "Runtime/Graphics/CTexture.hpp"
@ -17,6 +18,7 @@ ProjectResourceFactory::ProjectResourceFactory()
m_factoryMgr.AddFactory(FOURCC('TXTR'), urde::FTextureFactory);
m_factoryMgr.AddFactory(FOURCC('PART'), urde::FParticleFactory);
m_factoryMgr.AddFactory(FOURCC('FRME'), urde::RGuiFrameFactoryInGame);
m_factoryMgr.AddFactory(FOURCC('FONT'), urde::FRasterFontFactory);
}
void ProjectResourceFactory::BuildObjectMap(const hecl::Database::Project::ProjectDataSpec &spec)

View File

@ -4,7 +4,8 @@ namespace urde
{
CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
{
u32 magic = in.readUint32Big();
u32 magic;
in.readBytesToBuf(&magic, 4);
if (magic != SBIG('FONT'))
return;
@ -27,8 +28,8 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
u32 tmp4 = in.readUint32Big();
std::string name= in.readString();
u32 txtrId = in.readUint32Big();
x80_texture = store.GetObj({'TXTR', txtrId});
x30_fontInfo = CFontInfo(tmp1, tmp2, tmp3, tmp4, name.c_str());
x80_texture = store.GetObj({'TXTR', txtrId});
u32 mode = in.readUint32Big();
/* TODO: Make an enum */
if (mode == 1)
@ -52,7 +53,7 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
s32 cellWidth = in.readInt32Big();
s32 cellHeight = in.readInt32Big();
s32 baseline = in.readInt32Big();
s32 kernStart = in.readUint32();
s32 kernStart = in.readInt32Big();
xc_glyphs[i] = std::make_pair(chr, CGlyph(a, b, c, startU, startV, endU, endV,
cellWidth, cellHeight, baseline, kernStart));
}
@ -192,7 +193,8 @@ void CRasterFont::GetSize(const CDrawStringOptions& opts, int& width, int& heigh
std::unique_ptr<IObj> FRasterFontFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms)
{
return TToken<CRasterFont>::GetIObjObjectFor(std::make_unique<CRasterFont>(in, *(reinterpret_cast<IObjectStore*>(vparms.GetObj()))));
return TToken<CRasterFont>::GetIObjObjectFor(
std::make_unique<CRasterFont>(in, *static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam()));
}
}

View File

@ -88,7 +88,7 @@ class CFontInfo
bool x1_ = false;
s32 x4_ = 0;
s32 x8_fontSize = 0;
char* xc_name = 0;
char xc_name[40];
public:
CFontInfo() = default;
@ -109,7 +109,7 @@ class CRasterFont
s32 x28_lineMargin = 0;
s32 x2c_mode = 0;
CFontInfo x30_fontInfo;
TToken<CTexture> x80_texture;
TLockedToken<CTexture> x80_texture;
bool x88_ = false;
s32 x8c_baseline;
s32 x90_lineMargin = 0;