Jump to content

[C&C1] Cell Replacer.


pichorra

Recommended Posts

C&C95 cell replacer.

 

Use it at your own risk! ALWAYS BACKUP YOUR MAPS! THE TOOL ITSELF DOES NOT CREATE ANY BACKUP

 

Usage: open a command prompt on the folder that the cell_replacer is. then you can use it typing:

cell_replacer -f MAPFILE.BIN -w ID firstcell secondcell...

example:

 

cell_replacer -f bogusmap.bin -w 0500 67 68 135 4095

That will replace the IDs of cell 67, 68, 135 and 4095 with 0500 (Water rock in Temperate).

 

Getting the Cell number:

 

XCC:

 

dtLPB.jpg

 

CCWMAP:

 

SWE0x.jpg

 

Easy, huh Download HERE. Get the binary for your operating system. If you are crazy like me and like to use an older Windows version (such as 98), there is a DOS binary there too :P. You can edit the source the way you want too.

 

Bugs: Post here. If you want to post an enhancement of this application, fell free.

 

TODO list:

 

- Replace all X cells with Y ID with Z id.

- Add better memory managment. The fixed Array is pretty unsecure and it will crash the application if you give anything bigger than 8kb. C&C95 bin maps are always 8kb, so, there won't be problem with it. DONE

- Add Sole Survivor and Red Alert Support.

 

This application will also be the base for an .bin fixer. It will replace all cell ID that crash the map editor and replace it with an neutral cell.

 

Currently know cell IDs (they are all in Hexadecimal):

 

0500: Water Rock. (Temperate)

5A00: Passable Cell, but Unbuildable. (Temperate) This is awesome for Multiplayer maps. Stop those base-rush guys!

FFFF: Normal Cell. (Temperate).

 

Those IDs can also work for other theaters, but the cell itself can be all black, crashing when opened in map-editor.

cell_replacer2.zip

Link to comment
Share on other sites

all cell IDs? :P

 

http://nyerguds.arsaneus-design.com/cnc95upd/inirules/tilesets.ini

These are decimal though. And are just the actual tilesets (first byte value), not the actual tile numbers (second byte) for useful stuff. The information below it does give you each tileset's dimensions though.

 

Anyway, with that list converted to hexadecimal, it's just a matter of looking up these tileset files in the theater mixfiles (or heck, in xcc editor; it shows these filenames in the status bar on mouse over) and finding interesting cells on them :)

 

Link to comment
Share on other sites

Newsflash!: In DOS C&C, the .BIN first id starts in the savegame at 0x5E0 . The common difference is 9C. Add C to 5E0 and you will get the 2nd cell id. Do it while the 4096-rd times and you will get the .bin trough the savegame. (dos). Haha Solo, the missing .bin maps can now be recovered :D

 

I will just adapt my application to do it, 'cause i do not want to do it all by one. I can make my computer do that xD

 

forget it

Link to comment
Share on other sites

Forget it. It is at somehow the first 1500 cells are in a ordenated way, the others i dunno :(

 

Well, I got Hifi's memory hack. I will aim it at dosbox running C&CDOS, and get the cells from there. mwahahah :D

 

Well. I gave up about doing it directly from the savegame. THe game only seems to store the non-FF 00 bytes cells there. Now the only hope is to manage it to read the memory after the savegame is loaded, Like i have said before.

 

Link to comment
Share on other sites

Alright. Look at the attachment.

 

main.old.c is trough Direct "Sav2bin" way.

 

 

main.c is what i'm trying to do messing with the Windows's memory. The issue is that I don't know ANYTHING about those handle stuff, and Hifi seems dead. :(

 

 

Another Thing: It seems to simple Ignore all empty cells. That mean that FF00, FFFF and all others from that kind of isn't stored in the savegame separatelly.

 

The code is messy. Don't annoy me with it. :P

 

 

Savegame.001 is a full FFFF ID map.

Savegame.002 is the one that i'm trying to convert.

Savegame.003 is the one that I was using for testing. It was from a full 0x5555 ID Map

 

 

Tore: Add crappy .txt support attachment!

bin_recoverer.zip

Link to comment
Share on other sites

That makes a lot of sense Nyer, so whats the struct of a cell like?

Don't have a clue. Never really looked at those structs, besides those of hardcoded data arrays like music and warheads, which I can actually see in ida without debugging.

Link to comment
Share on other sites

  • 1 year later...

Update Relased!

 

- Removed the 8kb buffer. Now the tool directly replace the ID into the file.

- Added checks to avoid users from selecting an wrong file.

- It is now a command line application.

- Added binaries for DOS and Unix-like (all binaries are compiled with GCC, except for the DOS one, which uses OpenWatcom compiler). :P

Link to comment
Share on other sites

Can you add the ability to globally replace all occurrences of one specific tile by another specific tile, instead of giving cell numbers? For example,

cell_replacer -f bogusmap.bin -o FF00 -w BA04

 

with the -o specifying the original cell bytes to replace

 

What on earth does the "-w" stand for anyway?

Link to comment
Share on other sites

  • 2 months later...

Can you add the ability to globally replace all occurrences of one specific tile by another specific tile, instead of giving cell numbers? For example,

cell_replacer -f bogusmap.bin -o FF00 -w BA04

 

with the -o specifying the original cell bytes to replace

 

What on earth does the "-w" stand for anyway?

 

Wow, I just saw that today :P I will when I get time :P

 

I can't remember why I put that -w there, probably I had my reasons when I was writting it. Actually that code looks pretty ugly :P

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...