Adding spawnable characters: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (AE:AddCHAR moved to AE:Adding spawnable characters: mini-names are just no good, sorry)
m (cat.d)
Line 45: Line 45:


For more information on CHAR, look at this page: http://wiki.oni2.net/OBD:BINA/OBJC/CHAR
For more information on CHAR, look at this page: http://wiki.oni2.net/OBD:BINA/OBJC/CHAR
[[Category:Tutorials]]

Revision as of 05:38, 17 November 2008

Adding characters.

You can now add additional characters to any level by simply using a hexeditor.

The BINACJBOCharacter.oni file in each level has data for each character in that level. If you look at the file with a hexeditor, you'll see that the info for each character starts with RAHC and it is 0x224 in size (hex) or 548 bytes.

Here is an example:

level19NInja.jpg

This is important to know because for each character you add to a level, you have to change 2 other numbers in the file.

As this screenshot shows:

CHARlevel1.jpg

38 7C is the size of the part in the raw/sep file in bytes (31800)

30 7C is the size of the complete collection from this postion in bytes (31792)

To convert to decimal switch the pair of numbers 387C becomes 7C38, then use a hex to decimal converter: http://www.easycalculation.com/hex-converter.php to get the number 31800. The same for the other number.

(Note: These numbers will be different depending on which level you are editing. )


So for example, if you add ten characters to this level, its will increase the size by 5,480 bytes (10 x 548 bytes per character)

The size of the raw will become 37280 (31800+5480) and the collection size will be 37272 (31792+5480)

Now you have to convert those numbers into hex: http://www.easycalculation.com/decimal-converter.php

37280 becomes 91A0 and 37272 becomes 9198. But in Oni, you have to reverse the numbers (its related to endian), so in the file you have to change them to A091 and 9891.


Now one more thing you have to remember:

The last 4 bytes (after the last CHAR entry) used to be 00 00 00 00, indicating the end of the collection. You will have to change them to 20 02 00 00, to indicate you are adding another character. After the first additional charcter you'll have to write 20 02 00 00 to indicate another character will be added. Finally, after your "new last element", be sure to write 00 00 00 00 to signal the end of the collection.

After, you have made the changes, you will need to recompile that level again.

As always Make a backup of the original BINACJBOCharacter.oni file, just in case, you need to start over.

For more information on CHAR, look at this page: http://wiki.oni2.net/OBD:BINA/OBJC/CHAR