mirror of https://github.com/AxioDL/metaforce.git
CRasterFont fixes
This commit is contained in:
parent
becd55a9d2
commit
c0afcc2a22
|
@ -6,6 +6,7 @@
|
||||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
||||||
|
#include "Runtime/GuiSys/CRasterFont.hpp"
|
||||||
#include "Runtime/Graphics/CModel.hpp"
|
#include "Runtime/Graphics/CModel.hpp"
|
||||||
#include "Runtime/Graphics/CTexture.hpp"
|
#include "Runtime/Graphics/CTexture.hpp"
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ ProjectResourceFactory::ProjectResourceFactory()
|
||||||
m_factoryMgr.AddFactory(FOURCC('TXTR'), urde::FTextureFactory);
|
m_factoryMgr.AddFactory(FOURCC('TXTR'), urde::FTextureFactory);
|
||||||
m_factoryMgr.AddFactory(FOURCC('PART'), urde::FParticleFactory);
|
m_factoryMgr.AddFactory(FOURCC('PART'), urde::FParticleFactory);
|
||||||
m_factoryMgr.AddFactory(FOURCC('FRME'), urde::RGuiFrameFactoryInGame);
|
m_factoryMgr.AddFactory(FOURCC('FRME'), urde::RGuiFrameFactoryInGame);
|
||||||
|
m_factoryMgr.AddFactory(FOURCC('FONT'), urde::FRasterFontFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectResourceFactory::BuildObjectMap(const hecl::Database::Project::ProjectDataSpec &spec)
|
void ProjectResourceFactory::BuildObjectMap(const hecl::Database::Project::ProjectDataSpec &spec)
|
||||||
|
|
|
@ -4,7 +4,8 @@ namespace urde
|
||||||
{
|
{
|
||||||
CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
|
CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
|
||||||
{
|
{
|
||||||
u32 magic = in.readUint32Big();
|
u32 magic;
|
||||||
|
in.readBytesToBuf(&magic, 4);
|
||||||
if (magic != SBIG('FONT'))
|
if (magic != SBIG('FONT'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -27,8 +28,8 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
|
||||||
u32 tmp4 = in.readUint32Big();
|
u32 tmp4 = in.readUint32Big();
|
||||||
std::string name= in.readString();
|
std::string name= in.readString();
|
||||||
u32 txtrId = in.readUint32Big();
|
u32 txtrId = in.readUint32Big();
|
||||||
x80_texture = store.GetObj({'TXTR', txtrId});
|
|
||||||
x30_fontInfo = CFontInfo(tmp1, tmp2, tmp3, tmp4, name.c_str());
|
x30_fontInfo = CFontInfo(tmp1, tmp2, tmp3, tmp4, name.c_str());
|
||||||
|
x80_texture = store.GetObj({'TXTR', txtrId});
|
||||||
u32 mode = in.readUint32Big();
|
u32 mode = in.readUint32Big();
|
||||||
/* TODO: Make an enum */
|
/* TODO: Make an enum */
|
||||||
if (mode == 1)
|
if (mode == 1)
|
||||||
|
@ -52,7 +53,7 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store)
|
||||||
s32 cellWidth = in.readInt32Big();
|
s32 cellWidth = in.readInt32Big();
|
||||||
s32 cellHeight = in.readInt32Big();
|
s32 cellHeight = in.readInt32Big();
|
||||||
s32 baseline = 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,
|
xc_glyphs[i] = std::make_pair(chr, CGlyph(a, b, c, startU, startV, endU, endV,
|
||||||
cellWidth, cellHeight, baseline, kernStart));
|
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)
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ class CFontInfo
|
||||||
bool x1_ = false;
|
bool x1_ = false;
|
||||||
s32 x4_ = 0;
|
s32 x4_ = 0;
|
||||||
s32 x8_fontSize = 0;
|
s32 x8_fontSize = 0;
|
||||||
char* xc_name = 0;
|
char xc_name[40];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFontInfo() = default;
|
CFontInfo() = default;
|
||||||
|
@ -109,7 +109,7 @@ class CRasterFont
|
||||||
s32 x28_lineMargin = 0;
|
s32 x28_lineMargin = 0;
|
||||||
s32 x2c_mode = 0;
|
s32 x2c_mode = 0;
|
||||||
CFontInfo x30_fontInfo;
|
CFontInfo x30_fontInfo;
|
||||||
TToken<CTexture> x80_texture;
|
TLockedToken<CTexture> x80_texture;
|
||||||
bool x88_ = false;
|
bool x88_ = false;
|
||||||
s32 x8c_baseline;
|
s32 x8c_baseline;
|
||||||
s32 x90_lineMargin = 0;
|
s32 x90_lineMargin = 0;
|
||||||
|
|
Loading…
Reference in New Issue