Skip to content

Use unsigned texinfo references in vbsp/tools #3040

@artemking4

Description

@artemking4

Description

Due to the fact that vbsp holds texinfo references as short-sized indexes into a global array, >32767 intermediary texinfos cause memory corruption in the CompactTexinfos routine. The fix is rather simple: just set the fields to be unsigned short. Structures and fields affected:

  • dface_t::texinfo -> unsigned short
  • dbrushside_t::texinfo -> unsigned short
  • doverlay_t::nTexInfo -> unsigned short
  • dleafwaterdata_t::surfaceTexInfoID -> unsigned short
  • dworldlight_t::texinfo: no change, the type is int already
  • dwateroverlay_t::nTexInfo -> unsigned short

I've made a patch doing exactly that (just in the CompactTexinfos routine, as its the only place where that even gets used) to fix a map compilation error, and it just works fine. Doesn't break bsp compatibility either, as it does not change any structure sizes.

This, by the way, was the cause for corrupted texinfos in maps, as, i can see, you have rolled out a fix for that.

Activity

added
ToolsThe request relates to the modding and development tools.
on Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThe request relates to the modding and development tools.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @robotboy655@artemking4

        Issue actions