Files "replace.c" and "genlist.c" are available under the terms of GPL v2 or
any later version: ../../id1/docs/misc-docs/COPYING

(c) Victor Matei Petrescu - https://matei.one

Program "replace" is for replacing strings in a file. I made this program to
edit "*.bsp" files from Quake, which have some fragments in text format, but
these files are not entirely in text format, so modifying and saving them with
a text editor doesn't work. The strings to be replaced must be specified in
file "itemlist".

Program "genlist" is for automatically generating the file "itemlist" for a
certain map ("*.bsp" file). File "itemlist" will contain a list with all the
"monsters" found in the map, some useful instructions at the top, and the
number of times each "monster" was found. You can edit file "itemlist" with a
text editor, as indicated in the instructions inside, and then use "replace"
to modify the map.

The items specified in file "itemlist" will be replaced in the entire file, in
order, so if you have the following 2 lines in "itemlist" -

|"monster_army"| |"monster_dog" |
|"monster_dog"| |"light"      |

- then both "monsters" will be replaced with "light".

To compile:

gcc replace.c -o replace -Wall -W

gcc genlist.c -o genlist -Wall -W

Then if you have file "map.bsp":

./genlist map.bsp

and edit file "itemlist" as you prefer. To create the modified "map.bsp":

./replace map.bsp

If everything works fine, the modified file, "output.bsp", will be created.

If you use winDoW$ then 2 executable files are already provided, so click on
"MSDOS.bat" and type:

genlist.exe map.bsp

replace.exe map.bsp
