Match CTextParser::ParseTag, thanks Cuyler

This commit is contained in:
2025-05-13 20:57:29 -07:00
parent 03165e3e54
commit c4a0f92b44
11 changed files with 98 additions and 41 deletions

View File

@@ -13332,12 +13332,12 @@ FromHex__11CTextParserFw = .text:0x803043BC; // type:function size:0x5C scope:gl
ParseInt__11CTextParserFPCwib = .text:0x80304418; // type:function size:0x110 scope:global ParseInt__11CTextParserFPCwib = .text:0x80304418; // type:function size:0x110 scope:global
Equals__11CTextParserFPCwiPCw = .text:0x80304528; // type:function size:0x54 scope:global Equals__11CTextParserFPCwiPCw = .text:0x80304528; // type:function size:0x54 scope:global
BeginsWith__11CTextParserFPCwiPCw = .text:0x8030457C; // type:function size:0x54 scope:global BeginsWith__11CTextParserFPCwiPCw = .text:0x8030457C; // type:function size:0x54 scope:global
ParseTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x803045D0; // type:function size:0x6D4 scope:global ParseTag__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x803045D0; // type:function size:0x6D4 scope:global
HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304CA4; // type:function size:0x8 scope:global HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304CA4; // type:function size:0x8 scope:global
GetImage__11CTextParserFPCwi = .text:0x80304CAC; // type:function size:0x87C scope:global GetImage__11CTextParserFPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x80304CAC; // type:function size:0x87C scope:global
GetFont__11CTextParserFPCwi = .text:0x80305528; // type:function size:0xC4 scope:global GetFont__11CTextParserFPCwi = .text:0x80305528; // type:function size:0xC4 scope:global
GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> = .text:0x803055EC; // type:function size:0x160 scope:global GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> = .text:0x803055EC; // type:function size:0x160 scope:global
ParseText__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x8030574C; // type:function size:0x154 scope:global ParseText__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x8030574C; // type:function size:0x154 scope:global
__ct__11CTextParserFR12IObjectStore = .text:0x803058A0; // type:function size:0x8 scope:global __ct__11CTextParserFR12IObjectStore = .text:0x803058A0; // type:function size:0x8 scope:global
reserve__Q24rstl54vector<17TToken<8CTexture>,Q24rstl17rmemory_allocator>Fi = .text:0x803058A8; // type:function size:0xF8 scope:global reserve__Q24rstl54vector<17TToken<8CTexture>,Q24rstl17rmemory_allocator>Fi = .text:0x803058A8; // type:function size:0xF8 scope:global
GetEndRank__16CWordBreakTablesFw = .text:0x803059A0; // type:function size:0x94 scope:global GetEndRank__16CWordBreakTablesFw = .text:0x803059A0; // type:function size:0x94 scope:global
@@ -13998,7 +13998,7 @@ fn_80329BE4 = .text:0x80329BE4; // type:function size:0x58
fn_80329C3C = .text:0x80329C3C; // type:function size:0xC8 fn_80329C3C = .text:0x80329C3C; // type:function size:0xC8
LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329D04; // type:function size:0x10C scope:global LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329D04; // type:function size:0x10C scope:global
CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>UiP11CSimplePool = .text:0x80329E10; // type:function size:0x140 scope:global CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>UiP11CSimplePool = .text:0x80329E10; // type:function size:0x140 scope:global
GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePool = .text:0x80329F50; // type:function size:0xBC scope:global GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePoolUi = .text:0x80329F50; // type:function size:0xBC scope:global
FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A00C; // type:function size:0xE0 scope:global FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A00C; // type:function size:0xE0 scope:global
GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A0EC; // type:function size:0x2C scope:global GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A0EC; // type:function size:0x2C scope:global
GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A118; // type:function size:0x9C scope:global GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A118; // type:function size:0x9C scope:global

View File

@@ -13332,10 +13332,10 @@ FromHex__11CTextParserFw = .text:0x8030449C; // type:function size:0x5C scope:gl
ParseInt__11CTextParserFPCwib = .text:0x803044F8; // type:function size:0x110 scope:global ParseInt__11CTextParserFPCwib = .text:0x803044F8; // type:function size:0x110 scope:global
Equals__11CTextParserFPCwiPCw = .text:0x80304608; // type:function size:0x54 scope:global Equals__11CTextParserFPCwiPCw = .text:0x80304608; // type:function size:0x54 scope:global
BeginsWith__11CTextParserFPCwiPCw = .text:0x8030465C; // type:function size:0x54 scope:global BeginsWith__11CTextParserFPCwiPCw = .text:0x8030465C; // type:function size:0x54 scope:global
ParseTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x803046B0; // type:function size:0x6D4 scope:global ParseTag__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x803046B0; // type:function size:0x6D4 scope:global
HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304D84; // type:function size:0x8 scope:global HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304D84; // type:function size:0x8 scope:global
GetImage__11CTextParserFPCwi = .text:0x80304D8C; // type:function size:0x87C scope:global GetImage__11CTextParserFPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x80304D8C; // type:function size:0x87C scope:global
GetFont__11CTextParserFPCwi = .text:0x80305608; // type:function size:0xC4 scope:global GetFont__11CTextParserFPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x80305608; // type:function size:0xC4 scope:global
GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> = .text:0x803056CC; // type:function size:0x160 scope:global GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> = .text:0x803056CC; // type:function size:0x160 scope:global
ParseText__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x8030582C; // type:function size:0x154 scope:global ParseText__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x8030582C; // type:function size:0x154 scope:global
__ct__11CTextParserFR12IObjectStore = .text:0x80305980; // type:function size:0x8 scope:global __ct__11CTextParserFR12IObjectStore = .text:0x80305980; // type:function size:0x8 scope:global
@@ -13998,7 +13998,7 @@ fn_80329BE4 = .text:0x80329CC4; // type:function size:0x58 scope:global
fn_80329C3C = .text:0x80329D1C; // type:function size:0xC8 scope:global fn_80329C3C = .text:0x80329D1C; // type:function size:0xC8 scope:global
LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329DE4; // type:function size:0x10C scope:global LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329DE4; // type:function size:0x10C scope:global
CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>UiP11CSimplePool = .text:0x80329EF0; // type:function size:0x140 scope:global CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>UiP11CSimplePool = .text:0x80329EF0; // type:function size:0x140 scope:global
GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePool = .text:0x8032A030; // type:function size:0xBC scope:global GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePoolUi = .text:0x8032A030; // type:function size:0xBC scope:global
FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A0EC; // type:function size:0xE0 scope:global FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A0EC; // type:function size:0xE0 scope:global
GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A1CC; // type:function size:0x2C scope:global GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A1CC; // type:function size:0x2C scope:global
GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A1F8; // type:function size:0x9C scope:global GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A1F8; // type:function size:0x9C scope:global

View File

@@ -13332,12 +13332,12 @@ FromHex__11CTextParserFw = .text:0x8030452C; // type:function size:0x5C
ParseInt__11CTextParserFPCwib = .text:0x80304588; // type:function size:0x110 ParseInt__11CTextParserFPCwib = .text:0x80304588; // type:function size:0x110
Equals__11CTextParserFPCwiPCw = .text:0x80304698; // type:function size:0x54 Equals__11CTextParserFPCwiPCw = .text:0x80304698; // type:function size:0x54
BeginsWith__11CTextParserFPCwiPCw = .text:0x803046EC; // type:function size:0x54 BeginsWith__11CTextParserFPCwiPCw = .text:0x803046EC; // type:function size:0x54
ParseTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304740; // type:function size:0x6D4 ParseTag__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x80304740; // type:function size:0x6D4
HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304E14; // type:function size:0x8 HandleUserTag__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x80304E14; // type:function size:0x8
GetImage__11CTextParserFPCwi = .text:0x80304E1C; // type:function size:0x87C GetImage__11CTextParserFPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x80304E1C; // type:function size:0x87C
GetFont__11CTextParserFPCwi = .text:0x80305698; // type:function size:0xC4 GetFont__11CTextParserFPCwi = .text:0x80305698; // type:function size:0xC4
GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> = .text:0x8030575C; // type:function size:0x160 GetAssetIdFromString__11CTextParserFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator> = .text:0x8030575C; // type:function size:0x160
ParseText__11CTextParserFR18CTextExecuteBufferPCwi = .text:0x803058BC; // type:function size:0x154 ParseText__11CTextParserFR18CTextExecuteBufferPCwiRQ24rstl52vector<Q24rstl9pair<i,i>,Q24rstl17rmemory_allocator> = .text:0x803058BC; // type:function size:0x154
__ct__11CTextParserFR12IObjectStore = .text:0x80305A10; // type:function size:0x8 __ct__11CTextParserFR12IObjectStore = .text:0x80305A10; // type:function size:0x8
reserve__Q24rstl54vector<17TToken<8CTexture>,Q24rstl17rmemory_allocator>Fi = .text:0x80305A18; // type:function size:0xF8 reserve__Q24rstl54vector<17TToken<8CTexture>,Q24rstl17rmemory_allocator>Fi = .text:0x80305A18; // type:function size:0xF8
GetEndRank__16CWordBreakTablesFw = .text:0x80305B10; // type:function size:0x94 GetEndRank__16CWordBreakTablesFw = .text:0x80305B10; // type:function size:0x94
@@ -13998,7 +13998,7 @@ fn_80329D54 = .text:0x80329D54; // type:function size:0x58
fn_80329DAC = .text:0x80329DAC; // type:function size:0xC8 fn_80329DAC = .text:0x80329DAC; // type:function size:0xC8
LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329E74; // type:function size:0x10C LoadGPSMTokens__20CParticleDataFactoryFP15CGenDescription = .text:0x80329E74; // type:function size:0x10C
CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>UiP11CSimplePool = .text:0x80329F80; // type:function size:0x140 CreateGeneratorDescription__20CParticleDataFactoryFR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>UiP11CSimplePool = .text:0x80329F80; // type:function size:0x140
GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePool = .text:0x8032A0C0; // type:function size:0xBC GetGeneratorDesc__20CParticleDataFactoryFR12CInputStreamP11CSimplePoolUi = .text:0x8032A0C0; // type:function size:0xBC
FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A17C; // type:function size:0xE0 FParticleFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer = .text:0x8032A17C; // type:function size:0xE0
GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A25C; // type:function size:0x2C GetIObjObjectFor__25TToken<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A25C; // type:function size:0x2C
GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A288; // type:function size:0x9C GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CGenDescription>FRCQ24rstl27auto_ptr<15CGenDescription> = .text:0x8032A288; // type:function size:0x9C

View File

@@ -25,8 +25,6 @@ public:
static CVParamTransfer Null(); static CVParamTransfer Null();
const IVParamObj& operator*() const { return *x0_obj; } const IVParamObj& operator*() const { return *x0_obj; }
private:
rstl::rc_ptr< IVParamObj > x0_obj; rstl::rc_ptr< IVParamObj > x0_obj;
}; };

View File

@@ -1,12 +1,17 @@
#ifndef _CPARTICLEDATAFACTORY #ifndef _CPARTICLEDATAFACTORY
#define _CPARTICLEDATAFACTORY #define _CPARTICLEDATAFACTORY
#include "Kyoto/Particles/CGenDescription.hpp"
#include "Kyoto/Particles/IElement.hpp" #include "Kyoto/Particles/IElement.hpp"
#include "Kyoto/SObjectTag.hpp" #include "Kyoto/SObjectTag.hpp"
class CInputStream; class CInputStream;
class CParticleDataFactory { class CParticleDataFactory {
public:
static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* pool, uint offset);
static CGenDescription* CreateGeneratorDescription(CInputStream&, rstl::vector< uint >& assets, uint offset,
CSimplePool* pool);
static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool); static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool);
static CColorElement* GetColorElement(CInputStream& in); static CColorElement* GetColorElement(CInputStream& in);
static CModVectorElement* GetModVectorElement(CInputStream& in); static CModVectorElement* GetModVectorElement(CInputStream& in);

View File

@@ -13,6 +13,8 @@ public:
CFontImageDef(const TToken< CTexture >& texture, const CVector2f& cropFactor); CFontImageDef(const TToken< CTexture >& texture, const CVector2f& cropFactor);
CFontImageDef(const rstl::vector< TToken< CTexture > >& texture, float fps, CFontImageDef(const rstl::vector< TToken< CTexture > >& texture, float fps,
const CVector2f& cropFactor); const CVector2f& cropFactor);
CFontImageDef(const CFontImageDef&);
~CFontImageDef();
bool IsLoaded() const; bool IsLoaded() const;
// inline short GetWidth() { } // inline short GetWidth() { }

View File

@@ -10,6 +10,7 @@
class CInstruction; class CInstruction;
class CBlockInstruction; class CBlockInstruction;
class CLineInstruction; class CLineInstruction;
class CFontImageDef;
class CTextExecuteBuffer { class CTextExecuteBuffer {
typedef rstl::list< rstl::ncrc_ptr< CInstruction > > InstList; typedef rstl::list< rstl::ncrc_ptr< CInstruction > > InstList;
@@ -24,6 +25,10 @@ public:
void AddVerticalJustification(EVerticalJustification just); void AddVerticalJustification(EVerticalJustification just);
void AddPushState(); void AddPushState();
void AddPopState(); void AddPopState();
void AddImage(const CFontImageDef& image);
void AddColor(EColorType type, const CTextColor& color);
void AddRemoveColorOverride(int idx);
void AddColorOverride(int idx, const CTextColor& color);
private: private:
InstList x0_instructions; InstList x0_instructions;

View File

@@ -6,6 +6,7 @@
#include <Kyoto/Text/CTextColor.hpp> #include <Kyoto/Text/CTextColor.hpp>
#include <Kyoto/TToken.hpp> #include <Kyoto/TToken.hpp>
#include "Kyoto/Text/CFontImageDef.hpp"
class IObjectStore; class IObjectStore;
class CRasterFont; class CRasterFont;
@@ -14,17 +15,17 @@ class CTextExecuteBuffer;
class CTextParser { class CTextParser {
public: public:
CTextParser(IObjectStore& store); CTextParser(IObjectStore& store);
void ParseText(CTextExecuteBuffer&, const wchar_t* str, int len); void ParseText(CTextExecuteBuffer&, const wchar_t* str, int len, rstl::vector<rstl::pair<int, int> >& vec);
uint GetAssetIdFromString(const rstl::string& str); uint GetAssetIdFromString(const rstl::string& str);
TToken< CRasterFont > GetFont(const wchar_t* str, int len); TToken< CRasterFont > GetFont(const wchar_t* str, int len);
uint GetImage(const wchar_t* str, int len); CFontImageDef GetImage(const wchar_t* str, int len, rstl::vector<rstl::pair<int, int> >& vec);
uint HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* str, int len); uint HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* str, int len);
void ParseTag(CTextExecuteBuffer&, const wchar_t* str, int len); void ParseTag(CTextExecuteBuffer&, const wchar_t* str, int len, rstl::vector<rstl::pair<int, int> >& vec);
static bool BeginsWith(const wchar_t* str1, int len, const wchar_t* str2); static bool BeginsWith(const wchar_t* str1, int len, const wchar_t* str2);
static bool Equals(const wchar_t* str1, int len, const wchar_t* str2); static bool Equals(const wchar_t* str1, int len, const wchar_t* str2);
static uint ParseInt(const wchar_t* str, int len, bool); static int ParseInt(const wchar_t* str, int len, bool);
static uint FromHex(wchar_t c); static int FromHex(wchar_t c);
static uint GetColorValue(const wchar_t* str); static int GetColorValue(const wchar_t* str);
CTextColor ParseColor(const wchar_t* str, int len); CTextColor ParseColor(const wchar_t* str, int len);
private: private:

View File

@@ -2,7 +2,10 @@
#define _TEXTCOMMON #define _TEXTCOMMON
enum EColorType { enum EColorType {
kCT_Main,
kCT_Outline,
kCT_Geometry,
kCT_Foreground,
}; };
enum ETextDirection { enum ETextDirection {

View File

@@ -1,5 +1,9 @@
#include "Kyoto/Particles/CParticleDataFactory.hpp" #include "Kyoto/Particles/CParticleDataFactory.hpp"
#include "Kyoto/CFactoryFnReturn.hpp"
#include "Kyoto/CSimplePool.hpp"
#include "Kyoto/CVParamTransfer.hpp"
#include "Kyoto/Particles/CGenDescription.hpp"
#include "Kyoto/Particles/CIntElement.hpp" #include "Kyoto/Particles/CIntElement.hpp"
#include "Kyoto/Particles/CModVectorElement.hpp" #include "Kyoto/Particles/CModVectorElement.hpp"
#include "Kyoto/Particles/CRealElement.hpp" #include "Kyoto/Particles/CRealElement.hpp"
@@ -8,6 +12,26 @@
#define SBIG(v) v #define SBIG(v) v
CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer) {
rstl::rc_ptr< IVParamObj > obj = xfer.x0_obj;
CSimplePool* pool = static_cast< TObjOwnerParam< CSimplePool* >* >(obj.GetPtr())->GetData();
return CParticleDataFactory::GetGeneratorDesc(in, pool, in.GetBlockOffset());
}
CGenDescription* CParticleDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* pool,
uint offset) {
rstl::vector< uint > assets;
assets.reserve(8);
return CParticleDataFactory::CreateGeneratorDescription(in, assets, offset, pool);
}
CGenDescription* CParticleDataFactory::CreateGeneratorDescription(CInputStream& in,
rstl::vector< uint >& assets,
uint, CSimplePool* pool) {
return nullptr;
}
FourCC CParticleDataFactory::GetClassID(CInputStream& in) { return in.ReadLong(); } FourCC CParticleDataFactory::GetClassID(CInputStream& in) { return in.ReadLong(); }
bool CParticleDataFactory::GetBool(CInputStream& in) { bool CParticleDataFactory::GetBool(CInputStream& in) {

View File

@@ -1,13 +1,12 @@
#include "Kyoto/SObjectTag.hpp" #include "Kyoto/Text/CTextParser.hpp"
#include "Kyoto/Math/CVector2f.hpp"
#include "Kyoto/Text/CRasterFont.hpp"
#include "Kyoto/Text/CTextExecuteBuffer.hpp"
#include "Kyoto/Text/TextCommon.hpp" #include "Kyoto/Text/TextCommon.hpp"
#include <Kyoto/Text/CTextParser.hpp>
#include <Kyoto/Text/CRasterFont.hpp>
#include <Kyoto/Text/CTextExecuteBuffer.hpp>
CTextParser::CTextParser(IObjectStore& store) : mObjectStore(store) {} CTextParser::CTextParser(IObjectStore& store) : mObjectStore(store) {}
void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len) {} void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len, rstl::vector<rstl::pair<int, int> >& vec) {}
uint CTextParser::GetAssetIdFromString(const rstl::string& str) {} uint CTextParser::GetAssetIdFromString(const rstl::string& str) {}
@@ -18,27 +17,47 @@ TToken< CRasterFont > CTextParser::GetFont(const wchar_t* str, int len) {
return mObjectStore.GetObj(SObjectTag('FONT', id)); return mObjectStore.GetObj(SObjectTag('FONT', id));
} }
uint CTextParser::GetImage(const wchar_t* str, int len) { return -1; } CFontImageDef CTextParser::GetImage(const wchar_t* str, int len, rstl::vector<rstl::pair<int, int> >& vec) {
return CFontImageDef(TToken< CTexture >(), CVector2f(0.f, 0.f));
}
uint CTextParser::HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) { uint CTextParser::HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) {
return 0; return 0;
} }
void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) { void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len, rstl::vector<rstl::pair<int, int> >& vec) {
if (BeginsWith(string, len, L"font=")) { if (BeginsWith(string, len, L"font=")) {
buffer.AddFont(GetFont(string + 5, len - 5)); TToken< CRasterFont > font = GetFont(string + 5, len - 5);
buffer.AddFont(font);
} else if (BeginsWith(string, len, L"image=")) { } else if (BeginsWith(string, len, L"image=")) {
CFontImageDef texture = GetImage(string + 6, len - 6, vec);
buffer.AddImage(texture);
} else if (BeginsWith(string, len, L"fg-color=")) { } else if (BeginsWith(string, len, L"fg-color=")) {
buffer.AddColor(kCT_Foreground, ParseColor(string + 9, len - 9));
} else if (BeginsWith(string, len, L"main-color=")) { } else if (BeginsWith(string, len, L"main-color=")) {
buffer.AddColor(kCT_Main, ParseColor(string + 11, len - 11));
} else if (BeginsWith(string, len, L"geometry-color=")) { } else if (BeginsWith(string, len, L"geometry-color=")) {
buffer.AddColor(kCT_Geometry, ParseColor(string + 11, len - 11));
} else if (BeginsWith(string, len, L"outline-color=")) { } else if (BeginsWith(string, len, L"outline-color=")) {
buffer.AddColor(kCT_Outline, ParseColor(string + 14, len - 14));
} else if (BeginsWith(string, len, L"color")) { } else if (BeginsWith(string, len, L"color")) {
int idx = string[6] - L'0';
if (idx < 0 || idx > 9) {
return;
}
const wchar_t* str_remain = string + 7;
len -= 7;
if (*str_remain >= L'0' && *str_remain <= L'9') {
wchar_t tmp = *str_remain;
++str_remain;
len--;
idx = (idx * 10) + (tmp - L'0');
}
if (Equals(str_remain + 10, len - 10, L"no")) {
buffer.AddRemoveColorOverride(idx);
} else {
buffer.AddColorOverride(idx, ParseColor(str_remain + 10, len - 10));
}
} else if (BeginsWith(string, len, L"line-spacing=")) { } else if (BeginsWith(string, len, L"line-spacing=")) {
const float v = (float)ParseInt(string + 13, len - 13, true); const float v = (float)ParseInt(string + 13, len - 13, true);
buffer.AddLineSpacing(v / 100.f); buffer.AddLineSpacing(v / 100.f);
@@ -76,9 +95,9 @@ void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, in
} else if (Equals(string + 6, len - 6, L"nbottom")) { } else if (Equals(string + 6, len - 6, L"nbottom")) {
buffer.AddVerticalJustification(kVerticalJustification_NBottom); buffer.AddVerticalJustification(kVerticalJustification_NBottom);
} }
} else if (BeginsWith(string, len, L"push")) { } else if (Equals(string, len, L"push")) {
buffer.AddPushState(); buffer.AddPushState();
} else if (BeginsWith(string, len, L"pop")) { } else if (Equals(string, len, L"pop")) {
buffer.AddPopState(); buffer.AddPopState();
} else { } else {
HandleUserTag(buffer, string, len); HandleUserTag(buffer, string, len);
@@ -107,7 +126,7 @@ bool CTextParser::Equals(const wchar_t* str1, int len, const wchar_t* str2) {
return str2[i] == L'\x0'; return str2[i] == L'\x0';
} }
uint CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) { int CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) {
bool neg = false; bool neg = false;
int procCur = 0; int procCur = 0;
if (signVal && len > 0 && *str == L'-') { if (signVal && len > 0 && *str == L'-') {
@@ -126,7 +145,7 @@ uint CTextParser::ParseInt(const wchar_t* str, int len, bool signVal) {
return neg ? -val : val; return neg ? -val : val;
} }
uint CTextParser::FromHex(wchar_t ch) { int CTextParser::FromHex(wchar_t ch) {
if (ch >= L'0' && ch <= L'9') if (ch >= L'0' && ch <= L'9')
return ch - L'0'; return ch - L'0';
@@ -139,7 +158,7 @@ uint CTextParser::FromHex(wchar_t ch) {
return 0; return 0;
} }
uint CTextParser::GetColorValue(const wchar_t* str) { int CTextParser::GetColorValue(const wchar_t* str) {
return FromHex(str[1]) + (FromHex(str[0]) << 4); return FromHex(str[1]) + (FromHex(str[0]) << 4);
} }