I have gathered some information about the ELEM part. Here is a little introduction and tutorial about adding new characters.
Take for instance Level_12.dvd (Escape from El Paso). I played around a bit there with the sheriff and also added another enemy.
After ELEM come 4 bytes for the section size. This size ends right before FXBK (The next section) but the 4 bytes for the section size and the section name itself do not count towards the whole size. In this case ELEM is C7 1D 00 00.
Then come 4 bytes (usually 1C 00 00 00) not sure what that is.
And finally 2 bytes for the number of elements. Here 0x7B = 123(dec) elements.
Next come the elements themselves. I guess it begins with animated stuff such as here the Flag, lady at door where Sam is...
I haven't researched these too much but its probably info about the position, if the anim is playing...
Now come the PC-s. (Doesn't have to be sorted like this)
Cooper:
01 00 06 00 43 6F 6F 70 65 72 0B 00 4A 6F 68 6E 20 43 6F 6F 70 65 72 00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 69 03 EA 01 02 00 79 00 17 00 00 0A 00 00 07 00
Length is 0x3A.
Offset - Info:
+0x00 (2 bytes) - ID of some sort,
01 00: Cooper, 02 00: Doc, 03 00: Sam, 04 00: Kate, 05 00: Sanchez, 06 00: Mia, 01 01: Enemy, 02 01: Civilian, 10(Dog)/12(Han)/13(Pig) 02: Animal (Each with its own ID), 01 02: Horse...
ID-s seem to influence what data will be present after the name. If you change it, you must change the structure after it.
+0x02 (2 bytes) - Length of name, Cooper has 6 letters so size is 0x06. Each elements has two (sometimes different) names associated with it.
For instance after "Cooper" comes "John Cooper" but before it another 2 bytes with the length of the second name. In this case 0x0B.
Since each element has a different name length, I will start counting from the last letters of the second name, where the structure starts.
Lets compare a PC, Enemy and Civilian.
Cooper: (PC)
00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 69 03 EA 01 02 00 79 00 17 00 00 0A 00 00 07 00
Sheriff: (Enemy)
00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 02 03 8F 03 00 00 00 00 00 00 00 01 00 00 05 00 00 00 00 00 03 00 18 00 00 00
Cowboy Civilian: (Civilian)
00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 D4 07 D9 03 00 00 00 00 00 00 00 07 00 00 0E 00 00 00 03 00 FF FF 00 00
The first 0x13 bytes are exactly the same on every mission so I haven't looked much into that.
At offset +0x13 we have 2 bytes for X starting position (larger values move right) and 2 bytes for Y (larger values move down). I guess that the next 7 bytes are the starting height.
If I change Cooper's values to 00, he will spawn on the ground next to the starting building (not sure how exactly that works tho). And finally the value at offset +0x1E (2 bytes I think) is the starting rotation (Here 0A 00 for Cooper and I think it goes clockwise).
This here is mostly about testing different values until you found a good starting position.
This is now where things start to change...
At +0x21 (2 byte) is Cooper's starting stance. 00 00 is for standing, 07 00 (like in this case) is prone, 10 00 mounts the char to the nearest horse (even if it doesn't have a saddle!), and there might be more...
We continue with the NPC-s at offset +21: Actual character. The name at the beginning is actually just the look. The "spirit" lies in this byte. Changing Sheriff's 05 to 15 will make him behave like a Desperado3.
He will start with 140 health, do massive damage, have a different voice... These values correspond to the ID-s in the Characters.dat file. For civilians this mostly changes the voice.
Here comes the difference between a Civ and an Enemy. Enemies have 5 00s between the next usefull byte where as civilians have 3. (not sure why but it has to be like this otherwise it crashes the game if you change their ID at the beginning)
The byte at +27 (2 bytes) for enemy and +25 for civ is their "neutrality".
For enemies: 01 = neutral, wont attack unless sees drawn weapon or something suspecious (like the lopez in the first mission), 02 = agressive but carefull means that he wont instantly recognize the player but will instead try to get closer to confirm and 03 = normal agressive will shoot on sight.
For the civilians: 00 = will ignore but stop for a second when seeing the player, 01 = will ignore the player, 03 = will run away or alert the guards
The next 2 bytes starting at 29/27 is the patrol route. FF FF means stand at spawn position. Here the sheriff has his route ID set to 18 00. Changing it to FF FF will make him stand at spawn point. (Multiple chars can patrol the same route)
And finally the last 2 bytes are like the PC-s last 2 bytes. The starting stance. 00 = standing, 01 = sitting, 06 = crouched, 10 = mounted (horse must have a saddle), 54 = sleeping...
I haven't done much testing with the animals so I am not sure about those...
Now I am gonna show you a process of adding a new enemy to the map. We will change the Sheriff to a Desperado3 and add a Desperado4 that will be sitting on the bench nerby.
Step 1: We look for the sheriff (using text search)
....Sheriff..Sheriff
01 01 07 00 53 68 65 72 69 66 66 07 00 53 68 65 72 69 66 66
Here we must change the name to:
....Desperado4..Desperado 04
01 01 0A 00 44 65 73 70 65 72 61 64 6F 34 0C 00 44 65 73 70 65 72 61 64 6F 20 30 34
For that we must insert a few bytes and update the new lengths.
Step 2: We change his char ID from 05 to 15 (at offset +21 starting after the name)
00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 02 03 8F 03 00 00 00 00 00 00 00 01 00 00 05 00 00 00 00 00 03 00 18 00 00 00
to
00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 02 03 8F 03 00 00 00 00 00 00 00 01 00 00 15 00 00 00 00 00 01 00 18 00 00 00
(I also made him neutral by changing the "neutrality" byte from 03 to 01)
Step 3: We now want to add a completely new character, so we copy Desperado3 (whole thing)
01 01 0A 00 44 65 73 70 65 72 61 64 6F 33 0C 00 44 65 73 70 65 72 61 64 6F 20 30 33 00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 02 03 8F 03 00 00 00 00 00 00 00 01 00 00 15 00 00 00 00 00 01 00 18 00 00 00
and paste it at the end of the ELEM section. It seems that pasting it somewere in the middle corrupts the scripts or something so you have to paste it just before the FXBK section.
Step 4: Change the new character's data
Here I changed him to a Desperado4 and made him sit by the bench. (Had to restart the mission a couple of times to get the right position)
01 01 0A 00 44 65 73 70 65 72 61 64 6F 34 0C 00 44 65 73 70 65 72 61 64 6F 20 30 34 00 00 40 00 44 00 4C 00 4A 00 01 3B 00 41 00 51 00 4D 00 E4 02 5A 03 00 00 00 00 00 00 00 05 00 00 16 00 00 00 00 00 01 00 FF FF 07 00
Note the "E4 02 5A 03" for the position and "05" for rotation. Also "16" for Des4 char and "FF FF 07 00" for sitting with no patrol route.
If you want to make an enemy to a civilian change the first byte to 02 and remove 2 bytes before the "neutrality" byte. You can also change the char "spirit" byte for a specific voice. (for instance if the game crashes you can try that)
Step 5: Update the section size and elemnts count.
Start selecting from the last byte (before FXBK) all the way to the "1C" at the beginning of ELEM and replace the old size (write the new length reversed)
Here C7 1D becomes 18 1E.
Now increase the element counter after 1C (from 7B to 7C)
And thats it!
Now when testing this do NOT skip the intro cinematic at the start of a mission or else some changes wont work. Also you don't have to restart the whole game for something like position testing, just go back to the main menu and load the level again.
But again, do NOT click at SKIP during the cutscene.
Also there are some sound problems that I can't figure out. Since this mission has no character that uses twin colts, there will be no shooting sounds for the Desperado3 but his voice will be there since Jackson for some reason uses his char ID (0x15).
Desperado4 on the other hand won't have a voice but will have a shooting sound effect since he uses a rifle like some other chars here. Gotta figure this one out. Also how to manipulate patrol routes or create your own.
I have done some testing with the scripts as well, managed to figure some interesting things out, but I will post about those another time.
I attached a more compact version of this info for easier reading.
Hope this helps in further research. :-)