Skip to content

Duke3D: improve how labels are loaded into memory and introduce MAXLABELS limit

Dino Bollinger requested to merge dibollinger/eduke32:label_handling into master

Currently, the game hijacks the sprite, wall and sector arrays to store the label data temporarily, which then gets copied into freshly allocated arrays once the scripts are fully parsed.

This leads to the maximum number of labels depending on MAXSPRITES, which is undesirable as the resulting value is rather arbitrary (11264). With this merge request, this coupling is removed, and an independent limit MAXLABELS would be introduced, which is currently set to 16384.

Additionally, with this merge, the limit is checked before character data is loaded into memory, rather than after everything has been loaded. Before, the game could potentially just happily write outside the array boundaries.

Edited by Dino Bollinger

Merge request reports