Changing styles?

Started by SeriousGamer, June 07, 2006, 05:51:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SeriousGamer

Does anyone know a good way to quickly and easily take a cheapo level made in one style and open it with another? And I mean easier than copying/pasting everything and remaking all the objects. I have tried opening a level in notepad and changing the name of the style given near the beginning, but an error pops up when the level is opened.

Error in loading level
Invlaid Header

So how would I go about fixing this? Or should I just consider it impossible?

Proxima

I don't think it can be done -- other than the copy/paste method you mentioned.

SeriousGamer

Hrm, that's a shame. :(
It just seems strange to me that you can overwrite a style with a completely different one, and the editor has no problem opening a level. But the second you try to change the name, it screws everything up. :?

geoo

Well, changing the style name in the level file does actually work in a limited way: as long as the new style name you want to chenge the level into has the same lenght as the old one, you can simple change the style name from one into the other.
I suppose it doesn't work for different lenghts because some bytes in the file are referring to other ones which are shifted if you change the lenght. It's just a theory though.

That way you can convert the objects from one style to another, but as said, only limitedly. It won't change the terrain though, as you probably already noted.

SeriousGamer

Oh thank you! That may be a limit, but it's still good to know that it's possible. Also (silly me) notepad won't work in this situation because it saves everything as ascii. I got a hex editor and finally got it to work.

geoo

Good news for you: I worked out how you can change to a style of any length of the name:
The problem is, that there seem to be some pointers and stuff like this.
Well, let's assume you want to change from StyleA.sty to OtherStyleB.sty, your level file has a size of 15997 bytes (which is 3E7D in hexadecimal).
Firstly, change the style name at the obvious position. Note to insert the missing bytes, not overwrite the "0x00"s following.
Then, change the byte before the style name to the size of the new name + 1, for the example, to 0x10 (cuz it's 15 bytes long).
The first four bytes in the file mean the file size (lowest valued byte first, i.e. your file is now 16002 bytes long = 3E82 hex, so change it to 0x823E0000).
Then there are the file size once again and pointers in the last 28 bytes, one takes four bytes (again, lowest valued byte first). Adjust the file size again, and change the value of the pointers by the value you change the file size (for the example, +5), excexpt for the third of the pointers (0x22) because it points to a place before the level name and therefore is not shifted.
My explaining skill are not good, but I hope you understand what I want to say. ;)

Proxima

I might try that. Where can I get a hex editor?

geoo

I don't remember where I got my one from, but just search for "free hex editor" or something like that and you'll surely find some.

chaos_defrost

"こんなげーむにまじになっちゃってどうするの"

~"Beat" Takeshi Kitano

Essman

I'm impressed that anyone would try to figure out the binary format of the cheapo files. Even though I made the game and have the source code for it, it would take me a long time to figure out the file format.

Lately I've been working on the follow-up to cheapo, the website for the new game is here:
http://spadapet.members.winisp.net/dimwits/

Shvegait

Good to see you're working on Dimwits again  :smiley: