Skip to content

Load save lev#33

Draft
Blounard wants to merge 10 commits intomateusfavarin:mainfrom
Blounard:LoadSaveLEV
Draft

Load save lev#33
Blounard wants to merge 10 commits intomateusfavarin:mainfrom
Blounard:LoadSaveLEV

Conversation

@Blounard
Copy link
Contributor

@Blounard Blounard commented Feb 3, 2026

With this PR, CTE should be able to load a .lev file (created by CTE, vanilla track would take more work), and save it again, without losing data.

Missing feature : Loading VisTree with loadLEV (I tried to preserve it, but it crashed when I tried to modify it afterward, i'll investigate later)

Important note : To get "perfect" recreation of the .lev file, some raw data needs to be stored.
Currently it's hardocded to be restored in saveLEV. It means you can't modify :

  • Vertices
  • Textures
  • Quadblocks (partially)

In quadblock, you can modify only :

  • flags
  • speed impact /downforce
  • terrain
  • checkpoint index
  • BBox

BSP Tree is now loaded with LoadLEV
Adjusted the conversion between float and PSX integers, so converting from PSX int to float, and back to PSX int doesn't modify the value.
Modified Vertex == operator and hash function so 2 vertices which are going to be serialized into the same data are considered equal. This allow for way better vertices deduplication. (drive thru danger lev file is 15% lighter with this)
LoadLEV can now load texture as raw data, and restitute it back in SaveLEV.

The git diff looks a bit messy for some reason, but in SaveLEV, it's really just
if (!m_hasRawTextureData) *old code*
else *new code*
Makes LoadLEV preserve vertices and quadblock data when using SaveLEV. Useful for example to sync replay on saphi
Load ghost with LoadLev
it was never initialized before
@Blounard Blounard marked this pull request as draft February 5, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant