mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
ZoneCodeGenerator: Fixup templates and structs to be able to generate code for AddonMapEnts
This commit is contained in:
parent
42e571427b
commit
5853950888
@ -420,6 +420,47 @@ use clipMap_t;
|
|||||||
set string name;
|
set string name;
|
||||||
set name name;
|
set name name;
|
||||||
|
|
||||||
|
// ClipInfo
|
||||||
|
use ClipInfo;
|
||||||
|
set reusable planes;
|
||||||
|
set count planes planeCount;
|
||||||
|
set reusable materials;
|
||||||
|
set count materials numMaterials;
|
||||||
|
set reusable brushsides;
|
||||||
|
set count brushsides numBrushSides;
|
||||||
|
set reusable leafbrushNodes;
|
||||||
|
set count leafbrushNodes leafbrushNodesCount;
|
||||||
|
set reusable leafbrushes;
|
||||||
|
set count leafbrushes numLeafBrushes;
|
||||||
|
set count brushVerts numBrushVerts;
|
||||||
|
set count uinds nuinds;
|
||||||
|
set reusable brushes;
|
||||||
|
set count brushes numBrushes;
|
||||||
|
set reusable brushBounds;
|
||||||
|
set count brushBounds numBrushes;
|
||||||
|
set reusable brushContents;
|
||||||
|
set count brushContents numBrushes;
|
||||||
|
|
||||||
|
// ClipMaterial
|
||||||
|
set string ClipMaterial::name;
|
||||||
|
|
||||||
|
// cbrushside_t
|
||||||
|
set reusable cbrushside_t::plane;
|
||||||
|
|
||||||
|
// cLeafBrushNode_s
|
||||||
|
use cLeafBrushNode_s;
|
||||||
|
set condition data::leaf leafBrushCount > 0;
|
||||||
|
set reusable data::leaf::brushes;
|
||||||
|
set count data::leaf::brushes leafBrushCount;
|
||||||
|
|
||||||
|
// cbrush_t
|
||||||
|
use cbrush_t;
|
||||||
|
set reusable sides;
|
||||||
|
set reusable verts;
|
||||||
|
|
||||||
|
// cmodel_t
|
||||||
|
set reusable cmodel_t::info;
|
||||||
|
|
||||||
// =========================================
|
// =========================================
|
||||||
// ComWorld
|
// ComWorld
|
||||||
// =========================================
|
// =========================================
|
||||||
|
@ -36,6 +36,11 @@ namespace ZoneCodeGenerator.Generating
|
|||||||
private readonly IDictionary<DataType, UsedType> usedTypes;
|
private readonly IDictionary<DataType, UsedType> usedTypes;
|
||||||
public IEnumerable<UsedType> UsedTypes => usedTypes.Values;
|
public IEnumerable<UsedType> UsedTypes => usedTypes.Values;
|
||||||
|
|
||||||
|
public IEnumerable<StructureInformation> UsedStructures => UsedTypes
|
||||||
|
.Select(type => type.Information)
|
||||||
|
.Where(information => information != null)
|
||||||
|
.Distinct();
|
||||||
|
|
||||||
public IEnumerable<UsedType> ReferencedAssets => UsedTypes.Where(type => type.Information != null && type.Information.IsAsset && type.Information != Asset);
|
public IEnumerable<UsedType> ReferencedAssets => UsedTypes.Where(type => type.Information != null && type.Information.IsAsset && type.Information != Asset);
|
||||||
|
|
||||||
public IList<FastFileBlock> Blocks { get; private set; }
|
public IList<FastFileBlock> Blocks { get; private set; }
|
||||||
|
@ -5,8 +5,8 @@ Lower(name) ::= "$name; format=\"lower\"$"
|
|||||||
|
|
||||||
TypeDeclaration(typeDecl) ::= "$if(typeDecl.IsConst)$const $endif$$typeDecl.Type.FullName$"
|
TypeDeclaration(typeDecl) ::= "$if(typeDecl.IsConst)$const $endif$$typeDecl.Type.FullName$"
|
||||||
|
|
||||||
TypeVarName(structure) ::= "var$SafeTypeName(structure.Type)$"
|
TypeVarName(type) ::= "var$SafeTypeName(type)$"
|
||||||
TypePtrVarName(structure) ::= "var$SafeTypeName(structure.Type)$Ptr"
|
TypePtrVarName(type) ::= "var$SafeTypeName(type)$Ptr"
|
||||||
|
|
||||||
SafeTypeName(type) ::= "$type; format=\"safe_name\"$"
|
SafeTypeName(type) ::= "$type; format=\"safe_name\"$"
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ $endif$
|
|||||||
%>
|
%>
|
||||||
|
|
||||||
PrintOperandDynamic(op) ::= <%
|
PrintOperandDynamic(op) ::= <%
|
||||||
$TypeVarName(op.Structure)$
|
$TypeVarName(op.Structure.Type)$
|
||||||
->$first(op.ReferencedMemberChain):{member | $member.Member.Name$}$
|
->$first(op.ReferencedMemberChain):{member | $member.Member.Name$}$
|
||||||
$rest(op.ReferencedMemberChain):{member | .$member.Member.Name$}$
|
$rest(op.ReferencedMemberChain):{member | .$member.Member.Name$}$
|
||||||
$op.ArrayIndices:{ arrayIndex | [$arrayIndex$]}$
|
$op.ArrayIndices:{ arrayIndex | [$arrayIndex$]}$
|
||||||
|
@ -3,24 +3,28 @@ delimiters "$", "$"
|
|||||||
// Everything related to loading a pointer with a count that can be larger than 1
|
// Everything related to loading a pointer with a count that can be larger than 1
|
||||||
|
|
||||||
LoadArrayPointer_Loading(context, structure, member, reference) ::= <%
|
LoadArrayPointer_Loading(context, structure, member, reference) ::= <%
|
||||||
$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));$\n$
|
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));
|
||||||
|
// $member.Member.VariableType.Type.Alignment$
|
||||||
|
$\n$
|
||||||
|
|
||||||
$if(member.StructureType && !member.StructureType.IsLeaf)$
|
$if(member.StructureType && !member.StructureType.IsLeaf)$
|
||||||
|
|
||||||
$TypeVarName(member.StructureType)$ = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
$TypeVarName(member.Member.VariableType.Type)$ = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadArray_$member.Member.VariableType.Type.Name$(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
LoadArray_$member.Member.VariableType.Type.Name$(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
||||||
|
|
||||||
$else$
|
$else$
|
||||||
|
|
||||||
m_stream->Load<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
m_stream->Load<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
||||||
|
|
||||||
$endif$
|
$endif$
|
||||||
%>
|
%>
|
||||||
|
|
||||||
LoadArrayPointer_ScriptString(context, structure, member, reference) ::= <%
|
LoadArrayPointer_ScriptString(context, structure, member, reference) ::= <%
|
||||||
$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));$\n$
|
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));
|
||||||
|
// $member.Member.VariableType.Type.Alignment$
|
||||||
|
$\n$
|
||||||
|
|
||||||
varScriptString = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
varScriptString = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadScriptStringArray(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
LoadScriptStringArray(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
||||||
|
|
||||||
%>
|
%>
|
||||||
@ -34,16 +38,16 @@ $endif$
|
|||||||
%>
|
%>
|
||||||
|
|
||||||
LoadArrayPointer_PointerCheck(context, structure, member, reference) ::= <<
|
LoadArrayPointer_PointerCheck(context, structure, member, reference) ::= <<
|
||||||
if ($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$)
|
if ($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$)
|
||||||
{
|
{
|
||||||
$if(member.IsReusable)$
|
$if(member.IsReusable)$
|
||||||
if($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_FOLLOWING)
|
if($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_FOLLOWING)
|
||||||
{
|
{
|
||||||
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->ConvertOffsetToPointer($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->ConvertOffsetToPointer($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||||
}
|
}
|
||||||
$else$
|
$else$
|
||||||
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
$LoadArrayPointer_TypeCheck(context, structure, member, reference)$
|
||||||
|
@ -3,28 +3,42 @@ delimiters "$", "$"
|
|||||||
// Everything related to loading an embedded reference
|
// Everything related to loading an embedded reference
|
||||||
|
|
||||||
LoadEmbedded_Load(context, structure, member, reference) ::= <<
|
LoadEmbedded_Load(context, structure, member, reference) ::= <<
|
||||||
$TypeVarName(member.StructureType)$ = &$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;
|
$TypeVarName(member.Member.VariableType.Type)$ = &$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;
|
||||||
Load_$member.Member.VariableType.Type.Name$(false);
|
Load_$member.Member.VariableType.Type.Name$(false);
|
||||||
>>
|
>>
|
||||||
|
|
||||||
LoadEmbedded_TypeCheck(context, structure, member, reference) ::= <%
|
LoadEmbedded_TypeCheck(context, structure, member, reference) ::= <%
|
||||||
$if(member.IsScriptString)$
|
$if(member.IsScriptString)$
|
||||||
$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ = UseScriptString($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = UseScriptString($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||||
$else$
|
$else$
|
||||||
$LoadEmbedded_Load(context, structure, member, reference)$
|
$LoadEmbedded_Load(context, structure, member, reference)$
|
||||||
$endif$
|
$endif$
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
LoadEmbedded_Condition(context, structure, member, reference) ::= <<
|
||||||
|
$if(member.Condition)$
|
||||||
|
if($PrintEvaluation(member.Condition)$)
|
||||||
|
{
|
||||||
|
$LoadEmbedded_TypeCheck(context, structure, member, reference)$
|
||||||
|
$if(structure.IsUnion)$
|
||||||
|
return;
|
||||||
|
$endif$
|
||||||
|
}
|
||||||
|
$else$$\\$
|
||||||
|
$LoadEmbedded_TypeCheck(context, structure, member, reference)$$\\$
|
||||||
|
$endif$
|
||||||
|
>>
|
||||||
|
|
||||||
LoadEmbedded(context, structure, member, reference) ::= <%
|
LoadEmbedded(context, structure, member, reference) ::= <%
|
||||||
$LoadEmbedded_TypeCheck(context, structure, member, reference)$
|
$LoadEmbedded_Condition(context, structure, member, reference)$
|
||||||
%>
|
%>
|
||||||
|
|
||||||
LoadEmbeddedArray_TypeCheck(context, structure, member, reference) ::= <%
|
LoadEmbeddedArray_TypeCheck(context, structure, member, reference) ::= <%
|
||||||
$if(member.IsScriptString)$
|
$if(member.IsScriptString)$
|
||||||
varScriptString = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
varScriptString = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadScriptStringArray(false, $reference.ArraySize$);
|
LoadScriptStringArray(false, $reference.ArraySize$);
|
||||||
$else$
|
$else$
|
||||||
$TypeVarName(member.StructureType)$ = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
$TypeVarName(member.Member.VariableType.Type)$ = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadArray_$member.Member.VariableType.Type.Name$(false, $reference.ArraySize$);
|
LoadArray_$member.Member.VariableType.Type.Name$(false, $reference.ArraySize$);
|
||||||
$endif$
|
$endif$
|
||||||
%>
|
%>
|
||||||
|
@ -2,21 +2,23 @@ delimiters "$", "$"
|
|||||||
|
|
||||||
LoadPointerArray_Loading(context, structure, member, reference) ::= <%
|
LoadPointerArray_Loading(context, structure, member, reference) ::= <%
|
||||||
$if(member.Computations.IsArray)$
|
$if(member.Computations.IsArray)$
|
||||||
$TypePtrVarName(member.Member.VariableType)$ = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
$TypePtrVarName(member.Member.VariableType.Type)$ = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadPtrArray_$SafeTypeName(member.Member.VariableType.Type)$(false, $reference.ArraySize$);
|
LoadPtrArray_$SafeTypeName(member.Member.VariableType.Type)$(false, $reference.ArraySize$);
|
||||||
$else$
|
$else$
|
||||||
$TypePtrVarName(member.Member.VariableType)$ = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
$TypePtrVarName(member.Member.VariableType.Type)$ = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadPtrArray_$SafeTypeName(member.Member.VariableType.Type)$(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
LoadPtrArray_$SafeTypeName(member.Member.VariableType.Type)$(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
||||||
$endif$
|
$endif$
|
||||||
%>
|
%>
|
||||||
|
|
||||||
LoadPointerArray_String(context, structure, member, reference) ::= <%
|
LoadPointerArray_String(context, structure, member, reference) ::= <%
|
||||||
$if(reference.IsArray)$
|
$if(reference.IsArray)$
|
||||||
varXString = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
varXString = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadXStringArray(false, $reference.ArraySize$);
|
LoadXStringArray(false, $reference.ArraySize$);
|
||||||
$else$
|
$else$
|
||||||
$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));$\n$
|
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));
|
||||||
varXString = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
// $member.Member.VariableType.Alignment$
|
||||||
|
$\n$
|
||||||
|
varXString = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
LoadXStringArray(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
LoadXStringArray(true, $PrintEvaluation(reference.ArrayPointerCountEvaluation)$);
|
||||||
$endif$
|
$endif$
|
||||||
%>
|
%>
|
||||||
|
@ -3,39 +3,41 @@ delimiters "$", "$"
|
|||||||
// Everything related to loading a pointer with a count that is statically 1
|
// Everything related to loading a pointer with a count that is statically 1
|
||||||
|
|
||||||
LoadSinglePointerInner(context, structure, member, reference) ::= <%
|
LoadSinglePointerInner(context, structure, member, reference) ::= <%
|
||||||
$TypeVarName(structure)$->$member.Member.Name$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));$\n$
|
$TypeVarName(structure.Type)$->$member.Member.Name$ = m_stream->Alloc<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>(alignof($TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$));
|
||||||
|
// $member.Member.VariableType.Type.Alignment$
|
||||||
|
$\n$
|
||||||
|
|
||||||
$if(member.StructureType && !member.StructureType.IsLeaf)$
|
$if(member.StructureType && !member.StructureType.IsLeaf)$
|
||||||
|
|
||||||
$TypeVarName(member.StructureType)$ = $TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
$TypeVarName(member.Member.VariableType.Type)$ = $TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
Load_$member.Member.VariableType.Type.Name$(true);
|
Load_$member.Member.VariableType.Type.Name$(true);
|
||||||
|
|
||||||
$else$
|
$else$
|
||||||
|
|
||||||
m_stream->Load<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
m_stream->Load<$TypeDeclaration(member.Member.VariableType)$$PrintFollowingReferences(reference.FollowingReferences)$>($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||||
|
|
||||||
$endif$
|
$endif$
|
||||||
%>
|
%>
|
||||||
|
|
||||||
LoadSinglePointerAsset(context, structure, member, reference) ::= <<
|
LoadSinglePointerAsset(context, structure, member, reference) ::= <<
|
||||||
$LoaderClassName(member.StructureType)$ loader(m_script_string_provider, m_zone, m_stream);
|
$LoaderClassName(member.StructureType)$ loader(m_script_string_provider, m_zone, m_stream);
|
||||||
loader.Load(&$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
loader.Load(&$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||||
>>
|
>>
|
||||||
|
|
||||||
LoadSinglePointer_PointerCheck(context, structure, member, reference) ::= <<
|
LoadSinglePointer_PointerCheck(context, structure, member, reference) ::= <<
|
||||||
if ($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$)
|
if ($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$)
|
||||||
{
|
{
|
||||||
$if(member.StructureType && member.StructureType.IsAsset)$
|
$if(member.StructureType && member.StructureType.IsAsset)$
|
||||||
$LoadSinglePointerAsset(context, structure, member, reference)$
|
$LoadSinglePointerAsset(context, structure, member, reference)$
|
||||||
$else$
|
$else$
|
||||||
$if(member.IsReusable)$
|
$if(member.IsReusable)$
|
||||||
if($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_FOLLOWING)
|
if($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ == PTR_FOLLOWING)
|
||||||
{
|
{
|
||||||
$LoadSinglePointerInner(context, structure, member, reference)$
|
$LoadSinglePointerInner(context, structure, member, reference)$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->ConvertOffsetToPointer($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$ = m_stream->ConvertOffsetToPointer($TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);
|
||||||
}
|
}
|
||||||
$else$
|
$else$
|
||||||
$LoadSinglePointerInner(context, structure, member, reference)$
|
$LoadSinglePointerInner(context, structure, member, reference)$
|
||||||
@ -46,9 +48,9 @@ if ($TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$
|
|||||||
|
|
||||||
LoadSinglePointer_String(context, structure, member, reference) ::= <%
|
LoadSinglePointer_String(context, structure, member, reference) ::= <%
|
||||||
$if(member.Member.VariableType.IsConst)$
|
$if(member.Member.VariableType.IsConst)$
|
||||||
varXString = &$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
varXString = &$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$;$\n$
|
||||||
$else$
|
$else$
|
||||||
varXString = const_cast<const char**>(&$TypeVarName(structure)$->$member.Member.Name$$PrintArrayIndices(reference)$);$\n$
|
varXString = const_cast<const char**>(&$TypeVarName(structure.Type)$->$member.Member.Name$$PrintArrayIndices(reference)$);$\n$
|
||||||
$endif$
|
$endif$
|
||||||
LoadXString(false);
|
LoadXString(false);
|
||||||
%>
|
%>
|
||||||
|
@ -14,7 +14,7 @@ LoaderClassName(asset) ::= "Loader_$asset.Type.Name$"
|
|||||||
HeaderConstructor(context) ::= "$LoaderClassName(context.Asset)$(IZoneScriptStringProvider* scriptStringProvider, Zone* zone, IZoneInputStream* stream);"
|
HeaderConstructor(context) ::= "$LoaderClassName(context.Asset)$(IZoneScriptStringProvider* scriptStringProvider, Zone* zone, IZoneInputStream* stream);"
|
||||||
|
|
||||||
HeaderSinglePtrLoadMethodDeclaration(structure) ::= "void LoadPtr_$structure.Type.Name$(bool atStreamStart);"
|
HeaderSinglePtrLoadMethodDeclaration(structure) ::= "void LoadPtr_$structure.Type.Name$(bool atStreamStart);"
|
||||||
HeaderArrayLoadMethodDeclaration(structure) ::= "void LoadArray_$structure.Type.Name$(bool atStreamStart, size_t count);"
|
HeaderArrayLoadMethodDeclaration(type) ::= "void LoadArray_$SafeTypeName(type)$(bool atStreamStart, size_t count);"
|
||||||
HeaderPtrArrayLoadMethodDeclaration(type) ::= "void LoadPtrArray_$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);"
|
HeaderLoadMethodDeclaration(structure) ::= "void Load_$structure.Type.Name$(bool atStreamStart);"
|
||||||
|
|
||||||
@ -30,21 +30,6 @@ PointerVariableDeclaration(type) ::= <<
|
|||||||
$type.FullName$** var$SafeTypeName(type)$Ptr;
|
$type.FullName$** var$SafeTypeName(type)$Ptr;
|
||||||
>>
|
>>
|
||||||
|
|
||||||
HeaderMethodDeclarations(usedType) ::= <%
|
|
||||||
$if(usedType.PointerArrayReferenceExists)$
|
|
||||||
$HeaderPtrArrayLoadMethodDeclaration(usedType.Type)$
|
|
||||||
$\n$
|
|
||||||
$endif$
|
|
||||||
$if(usedType.ArrayReferenceExists && usedType.Information && !usedType.Information.IsLeaf)$
|
|
||||||
$HeaderArrayLoadMethodDeclaration(usedType.Information)$
|
|
||||||
$\n$
|
|
||||||
$endif$
|
|
||||||
$if(usedType.Information && !usedType.Information.IsLeaf && !usedType.Information.IsAsset)$
|
|
||||||
$HeaderLoadMethodDeclaration(usedType.Information)$
|
|
||||||
$\n$
|
|
||||||
$endif$
|
|
||||||
%>
|
|
||||||
|
|
||||||
// =======================
|
// =======================
|
||||||
// Header file entry point
|
// Header file entry point
|
||||||
// =======================
|
// =======================
|
||||||
@ -73,7 +58,9 @@ namespace $context.Game$
|
|||||||
$context.UsedTypes:{type | $if(type.PointerArrayReferenceExists && !type.IsContextAsset)$$PointerVariableDeclaration(type.Type)$
|
$context.UsedTypes:{type | $if(type.PointerArrayReferenceExists && !type.IsContextAsset)$$PointerVariableDeclaration(type.Type)$
|
||||||
$endif$}$$\\$
|
$endif$}$$\\$
|
||||||
|
|
||||||
$context.UsedTypes:{usedType | $HeaderMethodDeclarations(usedType)$}$
|
$context.UsedTypes:{usedType | $if(usedType.PointerArrayReferenceExists)$$HeaderPtrArrayLoadMethodDeclaration(usedType.Type)$$\n$$endif$}$
|
||||||
|
$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)$
|
$HeaderLoadMethodDeclaration(context.Asset)$
|
||||||
$HeaderSinglePtrLoadMethodDeclaration(context.Asset)$
|
$HeaderSinglePtrLoadMethodDeclaration(context.Asset)$
|
||||||
$HeaderAssetLoadMethodDeclaration(context.Asset)$
|
$HeaderAssetLoadMethodDeclaration(context.Asset)$
|
||||||
@ -129,49 +116,49 @@ $endif$
|
|||||||
LoadSinglePtrMethod(context, structure) ::= <<
|
LoadSinglePtrMethod(context, structure) ::= <<
|
||||||
void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool atStreamStart)
|
void $LoaderClassName(context.Asset)$::LoadPtr_$structure.Type.Name$(const bool atStreamStart)
|
||||||
{
|
{
|
||||||
assert($TypePtrVarName(structure)$ != nullptr);
|
assert($TypePtrVarName(structure.Type)$ != nullptr);
|
||||||
|
|
||||||
if(atStreamStart)
|
if(atStreamStart)
|
||||||
m_stream->Load<$structure.Type.FullName$*>($TypePtrVarName(structure)$);
|
m_stream->Load<$structure.Type.FullName$*>($TypePtrVarName(structure.Type)$);
|
||||||
|
|
||||||
m_stream->PushBlock($structure.Block.Name$);
|
m_stream->PushBlock($structure.Block.Name$);
|
||||||
|
|
||||||
if(*$TypePtrVarName(structure)$ != nullptr)
|
if(*$TypePtrVarName(structure.Type)$ != nullptr)
|
||||||
{
|
{
|
||||||
$if(structure.Block.IsTemp)$
|
$if(structure.Block.IsTemp)$
|
||||||
if(*$TypePtrVarName(structure)$ == PTR_FOLLOWING || *$TypePtrVarName(structure)$ == PTR_INSERT)
|
if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING || *$TypePtrVarName(structure.Type)$ == PTR_INSERT)
|
||||||
$else$
|
$else$
|
||||||
if(*$TypePtrVarName(structure)$ == PTR_FOLLOWING)
|
if(*$TypePtrVarName(structure.Type)$ == PTR_FOLLOWING)
|
||||||
$endif$
|
$endif$
|
||||||
{
|
{
|
||||||
$if(structure.Block.IsTemp)$
|
$if(structure.Block.IsTemp)$
|
||||||
$structure.Type.FullName$** toInsert = nullptr;
|
$structure.Type.FullName$** toInsert = nullptr;
|
||||||
if(*$TypePtrVarName(structure)$ == PTR_INSERT)
|
if(*$TypePtrVarName(structure.Type)$ == PTR_INSERT)
|
||||||
toInsert = m_stream->InsertPointer<$structure.Type.FullName$>();
|
toInsert = m_stream->InsertPointer<$structure.Type.FullName$>();
|
||||||
|
|
||||||
$endif$
|
$endif$
|
||||||
*$TypePtrVarName(structure)$ = m_stream->Alloc<$structure.Type.FullName$>(alignof($structure.Type.FullName$));
|
*$TypePtrVarName(structure.Type)$ = m_stream->Alloc<$structure.Type.FullName$>(alignof($structure.Type.FullName$));
|
||||||
|
|
||||||
$if(!structure.IsLeaf)$
|
$if(!structure.IsLeaf)$
|
||||||
$TypeVarName(structure)$ = *$TypePtrVarName(structure)$;
|
$TypeVarName(structure.Type)$ = *$TypePtrVarName(structure.Type)$;
|
||||||
Load_$structure.Type.Name$(true);
|
Load_$structure.Type.Name$(true);
|
||||||
$endif$
|
$endif$
|
||||||
|
|
||||||
$if(structure.IsAsset)$
|
$if(structure.IsAsset)$
|
||||||
LoadAsset_$structure.Type.Name$($TypePtrVarName(structure)$);
|
LoadAsset_$structure.Type.Name$($TypePtrVarName(structure.Type)$);
|
||||||
$endif$
|
$endif$
|
||||||
$if(structure.Block.IsTemp)$
|
$if(structure.Block.IsTemp)$
|
||||||
|
|
||||||
if(toInsert != nullptr)
|
if(toInsert != nullptr)
|
||||||
*toInsert = *$TypePtrVarName(structure)$;
|
*toInsert = *$TypePtrVarName(structure.Type)$;
|
||||||
$endif$
|
$endif$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$if(structure.Block.IsTemp)$
|
$if(structure.Block.IsTemp)$
|
||||||
*$TypePtrVarName(structure)$ = m_stream->ConvertOffsetToAlias(*$TypePtrVarName(structure)$);
|
*$TypePtrVarName(structure.Type)$ = m_stream->ConvertOffsetToAlias(*$TypePtrVarName(structure.Type)$);
|
||||||
$else$
|
$else$
|
||||||
*$TypePtrVarName(structure)$ = m_stream->ConvertOffsetToPointer(*$TypePtrVarName(structure)$);
|
*$TypePtrVarName(structure.Type)$ = m_stream->ConvertOffsetToPointer(*$TypePtrVarName(structure.Type)$);
|
||||||
$endif$
|
$endif$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,18 +174,21 @@ void $LoaderClassName(context.Asset)$::LoadPtrArray_$SafeTypeName(type)$(const b
|
|||||||
}
|
}
|
||||||
>>
|
>>
|
||||||
|
|
||||||
LoadArrayMethod(context, structure) ::= <<
|
LoadArrayMethod(context, type, structure) ::= <<
|
||||||
void $LoaderClassName(context.Asset)$::LoadArray_$structure.Type.Name$(const bool atStreamStart, const size_t count)
|
void $LoaderClassName(context.Asset)$::LoadArray_$type.Name$(const bool atStreamStart, const size_t count)
|
||||||
{
|
{
|
||||||
assert($TypeVarName(structure)$ != nullptr);
|
assert($TypeVarName(type)$ != nullptr);
|
||||||
|
|
||||||
if(atStreamStart)
|
if(atStreamStart)
|
||||||
m_stream->Load<$structure.Type.FullName$>($TypeVarName(structure)$, count);
|
m_stream->Load<$type.FullName$>($TypeVarName(type)$, count);
|
||||||
|
|
||||||
for(size_t index = 0; index < count; index++)
|
for(size_t index = 0; index < count; index++)
|
||||||
{
|
{
|
||||||
|
$if(!type.Members)$
|
||||||
|
$TypeVarName(structure.Type)$ = $TypeVarName(type)$;
|
||||||
|
$endif$
|
||||||
Load_$structure.Type.Name$(false);
|
Load_$structure.Type.Name$(false);
|
||||||
$TypeVarName(structure)$++;
|
$TypeVarName(type)$++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>>
|
>>
|
||||||
@ -206,10 +196,10 @@ void $LoaderClassName(context.Asset)$::LoadArray_$structure.Type.Name$(const boo
|
|||||||
LoadMethod(context, structure) ::= <<
|
LoadMethod(context, structure) ::= <<
|
||||||
void $LoaderClassName(context.Asset)$::Load_$structure.Type.Name$(const bool atStreamStart)
|
void $LoaderClassName(context.Asset)$::Load_$structure.Type.Name$(const bool atStreamStart)
|
||||||
{
|
{
|
||||||
assert($TypeVarName(structure)$ != nullptr);
|
assert($TypeVarName(structure.Type)$ != nullptr);
|
||||||
|
|
||||||
if(atStreamStart)
|
if(atStreamStart)
|
||||||
m_stream->Load<$structure.Type.FullName$>($TypeVarName(structure)$);$\\$
|
m_stream->Load<$structure.Type.FullName$>($TypeVarName(structure.Type)$);$\\$
|
||||||
$if(structure.Block.IsTemp)$
|
$if(structure.Block.IsTemp)$
|
||||||
|
|
||||||
m_stream->PushBlock($context.DefaultNormalBlock.Name$);$\\$
|
m_stream->PushBlock($context.DefaultNormalBlock.Name$);$\\$
|
||||||
@ -222,21 +212,6 @@ void $LoaderClassName(context.Asset)$::Load_$structure.Type.Name$(const bool atS
|
|||||||
}
|
}
|
||||||
>>
|
>>
|
||||||
|
|
||||||
SourceDefinition(context, usedType) ::= <%
|
|
||||||
$if(usedType.PointerArrayReferenceExists)$
|
|
||||||
$LoadPointerArrayMethod(context, usedType.Type, usedType.Information)$
|
|
||||||
$\n$$\n$
|
|
||||||
$endif$
|
|
||||||
$if(usedType.ArrayReferenceExists && usedType.Information && !usedType.Information.IsLeaf)$
|
|
||||||
$LoadArrayMethod(context, usedType.Information)$
|
|
||||||
$\n$$\n$
|
|
||||||
$endif$
|
|
||||||
$if(usedType.Information && !usedType.Information.IsLeaf && !usedType.Information.IsAsset)$
|
|
||||||
$LoadMethod(context, usedType.Information)$
|
|
||||||
$\n$$\n$
|
|
||||||
$endif$
|
|
||||||
%>
|
|
||||||
|
|
||||||
VariableInitialization(type) ::= <<
|
VariableInitialization(type) ::= <<
|
||||||
var$type.Name$ = nullptr;
|
var$type.Name$ = nullptr;
|
||||||
>>
|
>>
|
||||||
@ -272,7 +247,7 @@ void $LoaderClassName(context.Asset)$::Load($context.Asset.Type.FullName$** pAss
|
|||||||
{
|
{
|
||||||
assert(pAsset != nullptr);
|
assert(pAsset != nullptr);
|
||||||
|
|
||||||
$TypePtrVarName(context.Asset)$ = pAsset;
|
$TypePtrVarName(context.Asset.Type)$ = pAsset;
|
||||||
LoadPtr_$context.Asset.Type.Name$(false);
|
LoadPtr_$context.Asset.Type.Name$(false);
|
||||||
}
|
}
|
||||||
>>
|
>>
|
||||||
@ -313,7 +288,9 @@ using namespace $context.Game$;
|
|||||||
|
|
||||||
$ConstructorMethod(context)$
|
$ConstructorMethod(context)$
|
||||||
|
|
||||||
$context.UsedTypes:{usedType | $SourceDefinition(context, usedType)$}$
|
$context.UsedTypes:{usedType | $if(usedType.PointerArrayReferenceExists)$$LoadPointerArrayMethod(context, usedType.Type, usedType.Information)$$\n$$\n$$endif$}$
|
||||||
|
$context.UsedTypes:{usedType | $if(usedType.ArrayReferenceExists && usedType.Information && !usedType.Information.IsLeaf)$$LoadArrayMethod(context, usedType.Type, usedType.Information)$$\n$$\n$$endif$}$
|
||||||
|
$context.UsedStructures:{usedStructure | $if(!usedStructure.IsLeaf && !usedStructure.IsAsset)$$LoadMethod(context, usedStructure)$$\n$$\n$$endif$}$
|
||||||
$LoadMethod(context, context.Asset)$
|
$LoadMethod(context, context.Asset)$
|
||||||
|
|
||||||
$LoadSinglePtrMethod(context, context.Asset)$
|
$LoadSinglePtrMethod(context, context.Asset)$
|
||||||
|
@ -794,6 +794,10 @@ struct SndPatch
|
|||||||
unsigned int *elements;
|
unsigned int *elements;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef unsigned short LeafBrush;
|
||||||
|
typedef __declspec(align(128)) cbrush_t cbrush_array_t;
|
||||||
|
typedef __declspec(align(128)) Bounds BoundsArray;
|
||||||
|
|
||||||
struct ClipInfo
|
struct ClipInfo
|
||||||
{
|
{
|
||||||
int planeCount;
|
int planeCount;
|
||||||
@ -805,14 +809,14 @@ struct ClipInfo
|
|||||||
unsigned int leafbrushNodesCount;
|
unsigned int leafbrushNodesCount;
|
||||||
cLeafBrushNode_s *leafbrushNodes;
|
cLeafBrushNode_s *leafbrushNodes;
|
||||||
unsigned int numLeafBrushes;
|
unsigned int numLeafBrushes;
|
||||||
unsigned __int16 *leafbrushes;
|
LeafBrush* leafbrushes;
|
||||||
unsigned int numBrushVerts;
|
unsigned int numBrushVerts;
|
||||||
vec3_t *brushVerts;
|
vec3_t *brushVerts;
|
||||||
unsigned int nuinds;
|
unsigned int nuinds;
|
||||||
unsigned __int16 *uinds;
|
unsigned __int16 *uinds;
|
||||||
unsigned __int16 numBrushes;
|
unsigned __int16 numBrushes;
|
||||||
cbrush_t *brushes;
|
cbrush_array_t *brushes;
|
||||||
Bounds *brushBounds;
|
BoundsArray *brushBounds;
|
||||||
int *brushContents;
|
int *brushContents;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2667,7 +2671,7 @@ struct cbrushside_t
|
|||||||
|
|
||||||
struct cLeafBrushNodeLeaf_t
|
struct cLeafBrushNodeLeaf_t
|
||||||
{
|
{
|
||||||
unsigned __int16 *brushes;
|
LeafBrush *brushes;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cLeafBrushNodeChildren_t
|
struct cLeafBrushNodeChildren_t
|
||||||
@ -3253,7 +3257,7 @@ struct GfxBrushModelWritable
|
|||||||
float padding2;
|
float padding2;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GfxBrushModel
|
struct __declspec(align(16)) GfxBrushModel
|
||||||
{
|
{
|
||||||
GfxBrushModelWritable writable;
|
GfxBrushModelWritable writable;
|
||||||
vec3_t bounds[2];
|
vec3_t bounds[2];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user