BigBang1112 / gbx-net

General purpose library for Gbx files - data from Nadeo games like Trackmania or Shootmania, written in C#/.NET. It supports high performance serialization and deserialization of 200+ Gbx classes.
https://explorer.gbx.tools
86 stars 21 forks source link

It is impossible to get the position of a free block #61

Closed Miningflo closed 1 year ago

Miningflo commented 2 years ago

There is no field for the position of a free block. This includes the slope of any block (since sloped blocks are automatically free). All free blocks are positioned outside the grid at <-1,-1,-1> but there is no way to retrieve their actual position given from the fields provided.

BigBang1112 commented 2 years ago

It is because first, the full list of block clips and their relative positions need to be resolved before it's accurate to get all the free block positions and rotations. This cannot be done with ManiaScript due to two types of clips called TopClip and BottomClip that aren't abstracted by ManiaScript.

This is not far from completion as the CGameCtnBlockInfo for TM2020 needs just a few more chunks to figure out.

Currently, you can overcome this limitation by using a macroblock. Macroblocks don't include clip positions for whatever reason.

Miningflo commented 2 years ago

Currently I can only read flags for macroblocks. No positions sadly. Am I looking in the wrong location?

BigBang1112 commented 2 years ago

It's not part of MacroblockInstances but rather a different Gbx file Macroblock.Gbx. You need to pack your map (or part of a map) into the macroblock first which for sure isn't ideal.

BigBang1112 commented 2 years ago

The file needed to determine free blocks correctly has just been generated, so there should be something functional on the dev branch in a few days.

https://gist.github.com/BigBang1112/6988f0fe5f407920dad6ec540daff674

EDIT: Updated the gist to address a bug.

BigBang1112 commented 2 years ago

It took me 2 years to realize the binary, but better late than never. Fixed in https://github.com/BigBang1112/gbx-net/commit/954a1d6fa3c9c498c01261fcc7eb5d500dab2d67