Jump to content

Strange sector references in plutonia's map data


Recommended Posts

I wrote a WAD map importer for my own game engine for testing purposes and stumbled upon a strange issue regarding some sector references in plutonia.wad which I don't understand, maybe someone here can explain it to me?

 

The importer works perfectly for all maps in doom.wad and doom2.wad but when I try loading MAP17 of plutonia.wad it fails. This is because sector 19 apparently has no linedefs associated with it so I checked the map in Doom Builder and there it shows that sector 19 has four linedefs: 1195, 1203, 1205 and 1206. After seeing this I looked up the data directly in SLADE and there those four linedefs have sidedefs (1782, 1795, 1796 and 1797) that reference a sector 122 (instead of 19) which isn't shown at all in Doom Builder (here there are only sectors 0 up to 121). I searched all sidedefs in the map data and not a single one references sector 19 so why does Doom Builder associate those that reference sector 122 with sector 19 and why doesn't sector 122 exist there at all? There are a two more sectors that are also referenced in the data but do not exist in Doom Builder, namely 123 and 124.

 

SLADE's map editor and the Doom engine itself all have the same behaviour, so it must be correct but i don't understand how the connection is made between those linedefs and sector 19.

Edited by Sylvester

Share this post


Link to post

I guess Doom Builder is proactively* garbage-collecting the three unreferenced sectors on map load by renumbering the highest numbered sectors to fill the gaps in the sector array. That is, copying the property data for sector 122 to sector 19 and updating the references of any side referring to sector 122 to refer instead to sector 19. Similarly sector 123 is moved to sector 22 and 124 is moved to 120. Then the sector array is simply truncated to remove the top three unused now-unused elements, hence reporting the map only has sectors up to 121. This saves removing elements from the middle of the sector array, and having to move everything else down and renumber the sector references in hundreds of sides.
 

________

* Other editors tend to be more lazy with garbage collection, for example Eureka only removes unreferenced sectors on running the map checker, whereupon it says "3 unused sectors" and you can click a "Remove" button.

Share this post


Link to post
23 minutes ago, RjY said:

I guess Doom Builder is proactively* garbage-collecting the three unreferenced sectors on map load by renumbering the highest numbered sectors to fill the gaps in the sector array. ...

 

You're probably right, that seems to be the case. Interestingly, when not opening the map directly but instead first opening another one from the same IWAD and then switching to MAP17 with ctrl+shift+o this garbage collection is not performed and the sector is "correctly" labeled as sector 122. At least that's the case when I do it in Ultimate Doom Builder R3925.

Edited by Sylvester

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...