Edit UDMF map format with texteditor (Notepad++) breaks it?

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
User avatar
Tormentor667
Posts: 13562
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Edit UDMF map format with texteditor (Notepad++) breaks it?

Post by Tormentor667 »

Hello all together,

for Blade of Agony I am using Notepad++ to search and replace textures across my wad files (UDMF map format). Unfortunately it doesn't work the way I want it. As soon as I open a map in the editor, change a single letter and save it (as an example I just changed one texture in the text editor), I can't neither play it with GZDoom (map can't be loaded, console error) nor can I open it in GZDoomBuilder (wad doesn't contain any map).

Is there some kind of checksum in the WAD? And how can I search and replace across more than one wad regarding textures?

Best regards,
Dan
User avatar
simc
Posts: 138
Joined: Fri Feb 03, 2012 11:44 am

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by simc »

One cumbersome way is to edit the textmaps outside their wads: (Make backups first)

In Slade open the wad, select the TEXTMAP lump, choose Entry > Export, and save it with some name: textmap-e1m8.txt
Now edit and save the textmap in other editors.
Reselect the TEXTMAP lump of the original wad in Slade, choose Entry > Import, and choose the edited and saved textmap-e1m8.txt.
Save. If vertices/lines/sidedefs got changed the nodes need rebuilding.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by Gez »

Did you open the wad file directly?
User avatar
Tormentor667
Posts: 13562
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by Tormentor667 »

@simc - This makes sense for 1-3 maps but not if you have 30 maps you want to search and replace.

@Gez - Exactly but I wasn’t aware that it breaks the wad if I only change textures. What other choice do I have if I want to search and replace textures across several wads that have map data in them?
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by Gez »

Unfortunately, even with a text editor that dutifully preserve binary data, if you do any modification that changes the size of the TEXTMAP lump, you're going to break the wad's directory, because it's going to change the offset position of the following lumps.

Your best bet if you don't want to do it manually is to either get someone to fill in SLADE's missing feature of search-and-replacing textures in UDMF maps, or get someone to write a small utility to mass extract TEXTMAP lumps from wads and then mass-inject them back after modification.
User avatar
Enjay
 
 
Posts: 27652
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by Enjay »

It's worth remembering that a WAD file is a container file that has lots of lumps inside it and the TEXTMAP lump is just one of those. If you were to open another container file directly in a text editor (a zip, a RAR, a PAK, whaever) and tried to edit the files therein, it also wouldn't work out well because even though the text editor can edit and save the text lumps, it doesn't know how to save the container format and that's where the problem happens. By opening the container (WAD), that's the file that the text editor has open and so that's the file it tries to save - and the text editor doesn't know how to save a WAD. It's probably doing something like trying to save the entire container in a text format and thereby losing all of the directory structure and other information.

So, as has been suggested, you either need to extract the TEXTMAP lumps and work with them outside the WADs as text files, or use a dedicated WAD file manager that can do what you want (and the full functionality that you are looking for doesn't seem to be available yet - though it does sound like something that would fit into SLADE's feature set quite nicely).
User avatar
Tormentor667
Posts: 13562
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by Tormentor667 »

Understood, thanks for the explanations to both of you Gez and Enjay, now I understand why the whole thing isn't working as expected. I already posted a feature request to UDB and SLADE - hoping to avoid 3280 actions of search & replace :)
User avatar
simc
Posts: 138
Joined: Fri Feb 03, 2012 11:44 am

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by simc »

If this is still open, it can (almost) be done automaticly with existing commandline tools.

The method is to extract the TEXTMAP lump from the wad, replace the text strings and attach it back. However, there's one crank in the last phase that'll require manually to order the lumps with Slade. It also requires a premade list of all the texture changes to do. Still it could be faster than replacing the textures one by one in UDB.

To try this,
Spoiler:
Attachments
tex-changes.zip
(1.26 KiB) Downloaded 47 times
Last edited by simc on Sat Mar 21, 2020 2:55 am, edited 1 time in total.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Edit UDMF map format with texteditor (Notepad++) breaks

Post by Gez »

Torm, that's your best bet for the time being.
Post Reply

Return to “Mapping”