Editing zone owner

This is for general discussion about Hidden & Dangerous 2, talk about what you liked or what you didn't like about the sequel. Talk about multiplayer games, setup matches etc.
User avatar
Ikaros
Sergeant
Posts: 82
Joined: Wed Mar 23, 2011 11:30 am
Location: Italy
Contact:

Editing zone owner

Unread post by Ikaros » Mon Jun 13, 2011 9:14 am

betteryouthanme wrote: Are you sure? I just compared both zone definitions & model files. The only difference is the name zone1 / zone2..
So probably you meant scene2.bin? However i've uploaded both.
Ehm, in actors.bin I can't find the zone2 object (both specification and definition). Here's a screenshot of what RevEngEd2 loads:
Image

And here's the log that RevEngEd2 produces:
http://malgolan.altervista.org/forumIma ... rs.bin.txt

If you search for "zone" string, only zone1 is found. It's the wrong file?
If not, you miss the actor for the zone2.

Anyway, the owner for a zone is defined by the 29th byte after the label in the definition:
Image
0 means Axis,
1 means Allies,
2 means neutral.
betteryouthanme wrote: Btw with your new Editor it's possible to edit/delete/add actors in scene2.bin? Cause for me it's still not possible to edit this file with DCED or without..
With the new editor will be possible to edit/delete/add in actors.bin (This is already possible with the first version). It will be possible also modify objects in scene2.bin.

If you want to try version 1, just tell me. I'll have to teach you some steps to make it operative, because it's not user friendly..
http://malgolan.altervista.org/
Italian politicians - Not in my name!

User avatar
betteryouthanme
Lieutenant
Posts: 116
Joined: Thu Jun 12, 2008 1:37 pm
Location: Germany
Contact:

Re: Editing zone owner

Unread post by betteryouthanme » Mon Jun 13, 2011 10:03 am

Damn sorry i thought that Burma 2 coop has also both zones activated. :cry: I sent you a PM with the correct mapfiles.

It seems that the definitions are fine. Both are defined for allied and I'm able to use both spawns!
I just want to change the color, which is not working when I just edit the definiton to 00/01/02

[img width=800 height=323]http://img196.imageshack.us/img196/448/ ... 115329.jpg[/img]

User avatar
Ikaros
Sergeant
Posts: 82
Joined: Wed Mar 23, 2011 11:30 am
Location: Italy
Contact:

Re: Editing zone owner

Unread post by Ikaros » Mon Jun 13, 2011 11:07 am

You have wrong texture index in map.4ds objects.

First of all, look at this log (right-click, save and open with an editor to see line numbers):
map.4ds.txt

In the first part you can see the textures:
- number 5 (line 29) is X_BLUE.TGA, i.e. the blue transparent color
- number 6 (line 36) is X_FLGALL.TGA, i.e. the uk flag
- number 11 (line 71) is X_BLACK.TGA, i.e. the black transparent color
- number 12 (line 78) is X_FLGAXS.TGA, i.e. the nazi eagle flag

The look at line 161. This is where is defined the zone1 area, when it's owned by allies.
You can notice, at line 192 that there are two "Areas", i.e. it is a polygon with two separate sections, each with its own texture. Area1 has texture number 6 (the allied flag) and Area2 has texture number 5 (blue color).

Now look at line 343. This is the structure loaded when allied own zone2.
You can notice that has two sections (Areas) with these texture associated:
Line 377 tells that Area1 has texture 12 (i.e. the nazi flag)
Line 378 tells that Area2 has texture 11 (i.e. black color).

So, when zone2 is owned by allies, "allied2" object is loaded, which points to wrong textures.

Telling which bytes are associated to texture is a bit annoying.
Look at these pictures...

Bytes for area1 texture index of allied1 zone highlighted:
[img width=666 height=600]http://malgolan.altervista.org/forumIma ... hanme4.jpg[/img]

Bytes for area2 texture index of allied1 zone highlighted:
[img width=666 height=600]http://malgolan.altervista.org/forumIma ... hanme3.jpg[/img]

Bytes for area1 texture index of allied2 zone highlighted:
[img width=666 height=600]http://malgolan.altervista.org/forumIma ... hanme5.jpg[/img]

Bytes for area2 texture index of allied2 zone highlighted:
[img width=666 height=600]http://malgolan.altervista.org/forumIma ... hanme6.jpg[/img]

You can see also the "Pos" at botton, which tells you the address of highlighted bytes.

I've changed texture index of allied2, according to allied1, in your map.4ds.
You can download it here:
kingslayer.rar

Please tell me if it works :)

I've added also your actors.bin with correct bytecounts (you can compare it to your one, to see which bytes have been changed).
http://malgolan.altervista.org/
Italian politicians - Not in my name!

User avatar
betteryouthanme
Lieutenant
Posts: 116
Joined: Thu Jun 12, 2008 1:37 pm
Location: Germany
Contact:

Re: Editing zone owner

Unread post by betteryouthanme » Mon Jun 13, 2011 12:42 pm

Great job! Works like a charm! thup01

About bytecount:
You changed it from D6C6 0000 (=50902) to 640C 0100 (=68708) ?
Is it important to have a correct bytecounts? And how do you "count bytes" ? Is it working with mirkes HEX Editor?

Thanks a lot for your help

User avatar
Ikaros
Sergeant
Posts: 82
Joined: Wed Mar 23, 2011 11:30 am
Location: Italy
Contact:

Re: Editing zone owner

Unread post by Ikaros » Mon Jun 13, 2011 1:26 pm

Actually, two bytecounts have been changed (automatically by RevEngEd 2).
Also bytes @38542 have been changed, from 12362 to 30168.

Actors.bin has a recursive structure.

You have a block, which is "ID [2 bytes] - length [4 bytes] - *data [length-6 bytes] ".
*data could be two things
- a list blocks (recursive, nodes of a tree)
- some final values (leafs)

The "-6" is because "length" is for the entire block, id and lenght-bytes themselves included.

An example will make it clear. Look again at this log: actors.bin.txt

0x534C [68708] (19539) .BIN file > this is the outer block
- 0x534 is the ID (2 bytes), i.e. "SL" (bytes 0-1)
- [68708] is the int value for bytes 2-5 and is the length of this block. In this case, the block is the file, so this is also the file length
- (19539) is just the int value for 0x534C, don't mind it

The main block contains (in this case) two blocks: Specifications block (line 2 of log) and Definitions block (line 2543 of log).

Specification block has:
- ID: 0x0040 (bytes 6-7)
- Length: 38534 (bytes 8-11)

38534 is the length of the specifications block, and the next 38534 - 6 bytes will contain all specifications (-6 because of 6 bytes are used to store ID and length)

So go at byte 38534 (specs length) + 6 (ID and length of the outer block): @38540 the definitions block starts.

It is:
- ID: 0x20AE (bytes 38540-38541)
- length: 30168 (bytes 38542-38545)

The next 30168 - 6 bytes are the definitions. If you add manually a definition using a hex editor, you should also change the entire file byte count and the definitions block byte count.

Now, if you look at every definition (I imagine you can tell where they start and end, because you handled them),
you'll notice that they have the same structure (ID, length, data).

So, the first definition is the one for "m_B2_zebr_", which has
ID: 0x21AE @38546
Len: 57 bytes
Data.

At 38546 + 57 will start the second definition.

Also, the "m_B2_zebr_" has recursively the same structure, divided into 3 blocks

Block1 @38552 > ID: 0x23AE, length 17, then 17-6 charactes as the LABEL (with 0x00 as string end)

Block2 @38569 > ID: 0x22AE, length 10, then 10-6 bytes which are the int value representing the type for this definition (in this case is 8, i.e. a LADDER)

Block3 @38579 > ID: 0x24AE, length 24, then 24-6 bytes which are the very definition for ladder "m_B2_zebr_"

I hope this is clear enough.
Scene2.bin works the very same way, but it's more complex.
Here an example log: scene2.bin.txt

I don't know why you can't delete object in this scene2.bin with DC|ED. DC|ED can't handle correctly the bytecounts, so a manual (hex editor) work should be done (at least until RevEngEd 2 is released  :grin: )
http://malgolan.altervista.org/
Italian politicians - Not in my name!

Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests