Author Topic: Changing styles?  (Read 7505 times)

0 Members and 1 Guest are viewing this topic.

SeriousGamer

  • Guest
Changing styles?
« on: June 07, 2006, 05:51:43 AM »
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?

Online Proxima

  • Posts: 4570
    • View Profile
Changing styles?
« Reply #1 on: June 07, 2006, 09:33:42 AM »
I don't think it can be done -- other than the copy/paste method you mentioned.

SeriousGamer

  • Guest
Changing styles?
« Reply #2 on: June 07, 2006, 08:21:43 PM »
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. :?

Offline geoo

  • Administrator
  • Posts: 1475
    • View Profile
Changing styles?
« Reply #3 on: June 07, 2006, 09:39:18 PM »
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

  • Guest
Changing styles?
« Reply #4 on: June 08, 2006, 02:30:25 AM »
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.

Offline geoo

  • Administrator
  • Posts: 1475
    • View Profile
Changing styles?
« Reply #5 on: June 09, 2006, 08:19:21 PM »
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. ;)

Online Proxima

  • Posts: 4570
    • View Profile
Changing styles?
« Reply #6 on: June 10, 2006, 09:57:41 AM »
I might try that. Where can I get a hex editor?

Offline geoo

  • Administrator
  • Posts: 1475
    • View Profile
Changing styles?
« Reply #7 on: June 10, 2006, 11:07:55 AM »
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.

Offline chaos_defrost

  • Posts: 908
  • the artist formerly known as Insane Steve
    • View Profile
Changing styles?
« Reply #8 on: June 10, 2006, 03:17:30 PM »
I use XVI32.
"こんなげーむにまじになっちゃってどうするの"

~"Beat" Takeshi Kitano

Offline Essman

  • Posts: 139
    • View Profile
    • Ferret Face Games
Re: Changing styles?
« Reply #9 on: August 15, 2006, 08:58:11 AM »
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/

Offline Shvegait

  • Posts: 772
    • View Profile
Re: Changing styles?
« Reply #10 on: August 15, 2006, 05:43:21 PM »
Good to see you're working on Dimwits again  :smiley: