TR2-Rando icon indicating copy to clipboard operation
TR2-Rando copied to clipboard

Organise data hierarchically

Open lahm86 opened this issue 1 year ago • 0 comments

Remove as many global containers as possible, and structure the level classes more hierarchically. For example, in TR1:

short[] SoundMap
List<TRSoundDetails> SoundDetails
List<byte> Samples
List<uint> SampleIndices

should all get squashed into:

SortedDictionary<TR1SFX, TR1SoundEffect>

where TR1SoundEffect contains List<byte[]> Samples (and other fields from TRSoundDetails). The sound map and indices are then worked out on write and so there is no need to store them. This implicitly allows adding/removing with ease and guarantees sorting.

Other hierarchies:

  • Models (all animation data and meshes)
  • Static meshes (actual meshes within)
  • SpriteSequences (list of textures within, well-defined with enum types)
  • Boxes (overlap list and zone data)

This will break current model transport, but moving data around will become easier anyway so its codebase should become much smaller.

lahm86 avatar Apr 16 '24 21:04 lahm86