Skip to content

Commit

Permalink
PART: Support all existing prime 3 parts
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquegemignani committed Jun 21, 2021
1 parent b649649 commit 83c7a1f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Construct type definitions for Retro Studios game
| ANIM | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| CSKR | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| CINF | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| PART | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| PART | ✓ | ✓ | ✓ | ✓ | ✓ [1] | ✓ [1] |

* [1] All existing files parse, but not checked if exhaustive for what the game supports.
* [2] Missing re-calculation of how sections are split between blocks.


Expand Down
39 changes: 34 additions & 5 deletions retro_data_structures/formats/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ def create_keyf_emitter(keys_type):
d=GetIntElement,
)),
# Prime 2 Complete

# Prime 3
'PAP9': StartingAtVersion(3, Pass),
})
INT_ELEMENT_TYPES.update({
'KEYE': IEKeyframeEmitter,
Expand Down Expand Up @@ -341,8 +344,8 @@ def create_keyf_emitter(keys_type):
b=GetIntElement,
),
'RTOI': Struct(
a=GetIntElement,
b=GetIntElement,
a=GetRealElement,
b=GetRealElement,
),
'TSCL': GetRealElement,
'GAPC': Pass,
Expand Down Expand Up @@ -460,6 +463,7 @@ def create_keyf_emitter(keys_type):
'PETR': StartingAtVersion(2, Pass),
'PITR': StartingAtVersion(2, Pass),
'RNDV': StartingAtVersion(2, GetRealElement),

})
TEXTURE_ELEMENT_TYPES.update({
'CNST': Struct(
Expand All @@ -483,6 +487,15 @@ def create_keyf_emitter(keys_type):
# Echoes explicitly tracks this value, but it's present in Prime 1 since the parser ignores unknown values
'NONE': Pass,
# Prime 2 Complete

# Prime 3
'TEXP': StartingAtVersion(3, Struct(
sub_id=FourCC,
id=If(lambda ctx: ctx.sub_id != 'NONE', AssetIdCorrect) * "TXTR",
a=GetIntElement,
b=GetIntElement,
c=GetRealElement,
)),
})
EMITTER_ELEMENT_TYPES.update({
'SETR': Struct(
Expand Down Expand Up @@ -592,6 +605,12 @@ def create_keyf_emitter(keys_type):
)),

# Prime 2 Complete

# Prime 3
'CFDL': StartingAtVersion(3, Struct(
a=GetColorElement,
b=GetColorElement,
)),
})
MOD_VECTOR_ELEMENT_TYPES.update({
'IMPL': Struct(
Expand Down Expand Up @@ -671,6 +690,12 @@ def create_keyf_emitter(keys_type):
c=GetModVectorElement,
)),
# Prime 2 Complete

# Prime 3
'SWLC': StartingAtVersion(3, Struct(
a=GetRealElement,
b=GetRealElement,
)),
})

# Particle
Expand Down Expand Up @@ -787,6 +812,9 @@ def create_keyf_emitter(keys_type):
'ADV9': StartingAtVersion(3, GetRealElement),
'AMSC': StartingAtVersion(3, GetIntElement),
'XJAK': StartingAtVersion(3, GetIntElement),
'EADV': StartingAtVersion(3, GetRealElement),
'PMTF': StartingAtVersion(3, GetBool),
'HJAK': StartingAtVersion(3, GetIntElement),

# End
'_END': Pass,
Expand All @@ -804,9 +832,10 @@ def create_keyf_emitter(keys_type):
def dependencies_for(obj, target_game):
for element in obj.elements:
if element.type in ('TEXR', 'TIND'):
texture = element.body.body.id
if texture is not None:
yield "TXTR", texture
if element.body is not None:
texture = element.body.body.id
if texture is not None:
yield "TXTR", texture

if element.type == 'KSSM':
for spawn in element.body.spawns:
Expand Down

0 comments on commit 83c7a1f

Please sign in to comment.