mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-21 12:17:53 -05:00
ZoneCodeGenerator: Make members have a block they are being loaded into instead of structures
This commit is contained in:
@ -13,7 +13,7 @@ LoaderClassName(asset) ::= "Loader_$asset.Type.Name$"
|
||||
|
||||
HeaderConstructor(context) ::= "$LoaderClassName(context.Asset)$(IZoneScriptStringProvider* scriptStringProvider, Zone* zone, IZoneInputStream* stream);"
|
||||
|
||||
HeaderSinglePtrLoadMethodDeclaration(structure) ::= "void LoadPtr_$structure.Type.Name$(bool atStreamStart);"
|
||||
HeaderTempPtrLoadMethodDeclaration(structure) ::= "void LoadPtr_$structure.Type.Name$(bool atStreamStart);"
|
||||
HeaderArrayLoadMethodDeclaration(type) ::= "void LoadArray_$SafeTypeName(type)$(bool atStreamStart, size_t count);"
|
||||
HeaderPtrArrayLoadMethodDeclaration(type) ::= "void LoadPtrArray_$SafeTypeName(type)$(bool atStreamStart, size_t count);"
|
||||
HeaderLoadMethodDeclaration(structure) ::= "void Load_$structure.Type.Name$(bool atStreamStart);"
|
||||
@ -62,7 +62,7 @@ namespace $context.Game$
|
||||
$context.UsedTypes:{usedType | $if(usedType.ArrayReferenceExists && usedType.Information && !usedType.Information.IsLeaf)$$HeaderArrayLoadMethodDeclaration(usedType.Type)$$\n$$endif$}$
|
||||
$context.UsedStructures:{usedStructure | $if(!usedStructure.IsLeaf && !usedStructure.IsAsset)$$HeaderLoadMethodDeclaration(usedStructure)$$\n$$endif$}$
|
||||
$HeaderLoadMethodDeclaration(context.Asset)$
|
||||
$HeaderSinglePtrLoadMethodDeclaration(context.Asset)$
|
||||
$HeaderTempPtrLoadMethodDeclaration(context.Asset)$
|
||||
$HeaderAssetLoadMethodDeclaration(context.Asset)$
|
||||
|
||||
public:
|
||||
@ -113,7 +113,7 @@ $endif$
|
||||
$endif$
|
||||
%>
|
||||
|
||||
LoadSinglePtrMethod(context, structure) ::= <<
|
||||
LoadTempPtrMethod(context, structure) ::= <<
|
||||
void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool atStreamStart)
|
||||
{
|
||||
assert($TypePtrVarName(structure.Type)$ != nullptr);
|
||||
@ -121,7 +121,7 @@ void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool
|
||||
if(atStreamStart)
|
||||
m_stream->Load<$structure.Type.FullName$*>($TypePtrVarName(structure.Type)$);
|
||||
|
||||
m_stream->PushBlock($structure.Block.Name$);
|
||||
m_stream->PushBlock($context.DefaultTempBlock.Name$);
|
||||
|
||||
if(*$TypePtrVarName(structure.Type)$ != nullptr)
|
||||
{
|
||||
@ -131,12 +131,10 @@ void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool
|
||||
if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING)
|
||||
$endif$
|
||||
{
|
||||
$if(structure.Block.IsTemp)$
|
||||
$structure.Type.FullName$** toInsert = nullptr;
|
||||
if(*$TypePtrVarName(structure.Type)$ == PTR_INSERT)
|
||||
toInsert = m_stream->InsertPointer<$structure.Type.FullName$>();
|
||||
|
||||
$endif$
|
||||
*$TypePtrVarName(structure.Type)$ = m_stream->Alloc<$structure.Type.FullName$>(alignof($structure.Type.FullName$));
|
||||
|
||||
$if(!structure.IsLeaf)$
|
||||
@ -147,11 +145,9 @@ void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool
|
||||
$if(structure.IsAsset)$
|
||||
LoadAsset_$structure.Type.Name$($TypePtrVarName(structure.Type)$);
|
||||
$endif$
|
||||
$if(structure.Block.IsTemp)$
|
||||
|
||||
if(toInsert != nullptr)
|
||||
*toInsert = *$TypePtrVarName(structure.Type)$;
|
||||
$endif$
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -286,7 +282,7 @@ $context.UsedTypes:{usedType | $if(usedType.ArrayReferenceExists && usedType.Inf
|
||||
$context.UsedStructures:{usedStructure | $if(!usedStructure.IsLeaf && !usedStructure.IsAsset)$$LoadMethod(context, usedStructure)$$\n$$\n$$endif$}$
|
||||
$LoadMethod(context, context.Asset)$
|
||||
|
||||
$LoadSinglePtrMethod(context, context.Asset)$
|
||||
$LoadTempPtrMethod(context, context.Asset)$
|
||||
|
||||
$LoadAssetMethod(context, context.Asset)$
|
||||
|
||||
|
Reference in New Issue
Block a user