Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#333 Improved EM Serialization
Default values will no longer be included in serialized EM data. This applies to standard EM files, along with TR3 secret and boss mappings. All JSON files have been reserialized with this new format. Thanks to @makotocchi and @chreden for assistance with this.
The files are also ordered in the way that the various groups are applied within the actual randomizer classes - purely for reference if looking anything up manually.
#241 TR3 Environment Randomization
All functions have now been implemented for TR3, so for example we can flood/drain rooms and the water surface textures will be handled, raise/lower platforms, move keyholes/slots and their triggers will follow, and so on. Only the logic has been implemented, no actual function data has been added to the JSON files yet.
Other Improvements
The following improvements have also been made for general EM definitions.
Reverse Lookup
Previously for such things as adding reward rooms, we would use short.Max to reference the new room's index. Instead, negative values are now used to reference an item in an array searching backwards. So for example, we might add two rooms within the same set of functions, and want to link them with portals, so we would in that case use -1 and -2 to reference them:
This can be applied to rooms, cameras and entities.
Location Expander
In
EMTriggerFunction
it's now possible to define one location along with an X and Z value indicating that we want to cover all tiles within that range. This avoids having to specify the location for every sector. So you could specify a location and tell it to go 8 tiles in the +X and 8 in the +Z and hey presto, you have 64 triggers. You can also specify an entire room just by referencing the room number, but there may be times when we only want to cover a portion of the room so the expander can be used in that instance.EM Triggers
Rather than defining
FDTriggerEntry
objects in JSON, a new wrapper class is now used -EMTrigger
. This takes the basics of what's required to make a trigger and results in much less JSON, as we don't need to specify the various values that are taken care of inFDControl
(the actual ushort values,EndData
etc). You can set the trigger type, mask, timer, OneShot and SwitchOrKeyRef properties and populate the action list, Another benefit is that the SwitchOrKeyRef and Parameter action properties are signed, so we can use negative values if we wish to reference newly added items.The comparison below hopefully shows how simple it will be to define triggers going forward. The before section refers to before the introduction of
EMTrigger
but after the reserialization in relation to #333, rather than referring to the current release. The alternative to this was changing the source inFDControl
to addDefaultValue
attributes so that the system would know what to ignore when serializing, or further customising the serialization settings to ignore specific values for specific classes, but I don't think either of these approaches would be appropriate.Before
After