Chronic Logic

Gish => Gish Editor => Topic started by: Jonathan_NL on May 27, 2005, 09:26:28 AM

Title: The level format
Post by: Jonathan_NL on May 27, 2005, 09:26:28 AM
This is what I think is the final lvl format (stored in LSB first):

int magic == 9;
char background[32];
int tileset, gametype, gametime;
struct { int x1, y1, x2, y2; } rects[64]; /* the colored rects you get when you select a region and press 5678 */
char back[0x10000]; /* encrypted */
char mid[0x10000]; /* encrypted */
char front[0x10000]; /* encrypted */
float unused[3]; /* was start position in older versions (might be int) */
struct { float r, g, b; } backcolor, midcolor, frontcolor, waybackcolor;

int numobjects;
struct {
int type, texture, link;
float x, y, z; /* set z to 0 if you don't want to mess up sticking */
int unused; /* probably something in older versions */
float xscale, yscale;
float mass, friction;
int lighttype;
float red, green, blue, intensity;
int unused; /* probably something in older versions */
} objects[numobjects];

int numropes;
struct {
int type, texture;
int object1, anchor1;
int object2, anchor2;
} ropes[numropes]; /* note that I never tested them... */

struct {
int width;
if(width) { /* if not the texture is what is currently in memory */
int height, unused[2]; /* would be mag and min filters but never got implemented. always GL_LINEAR == 0x2601 */
int tex[width*height]; /* encrypted RGBA */
}
int numlines;
struct { float x1, y1, x2, y2, unused[4]; /* left in from older versions where it was {friction, breakpoint, x, x} */ } lines[numlines];
float friction, breakpoint;
int middamage, foredamage;
float density, drag;
int animation, animatespd;
} tiles[250]; /* tiles 1-250, was 1-255 in older versions but they are now ignored by gish */


(sorry about the spacing, but iB can't do much better)

I won't tell anything about the encryption unless they (CL) allow me to.
Title: The level format
Post by: Jonathan_NL on September 15, 2005, 10:11:55 PM
Josiah/Alex: Do you think the encryption is still useful? Can I add it here?
Title: The level format
Post by: Kampfschaf on September 16, 2005, 12:01:06 PM
Very interesting!!! I understand the code! Some changes will make the Game much better ^^ No really... I programmed the GISH Trainer and decompile and use the Hex Codes to change some settings. I think this here is usefull to make much more... So tell more...
Title: The level format
Post by: Jonathan_NL on September 16, 2005, 07:08:03 PM
It's the whole level format. I figured it out mainly by looking with a hexeditor, and writing a program that parsed as much as possible and often presented parts in a better format than the hexeditor. That way I reached the end fairly quickly.
Title: The level format
Post by: Kampfschaf on September 16, 2005, 08:21:58 PM
If you would like to make much more hacks please contact me n ICQ: 306155901

I program the Gish Trainer in VB! Maybe we can program a tool to make much more ;)
Title: The level format
Post by: Jonathan_NL on September 16, 2005, 10:10:58 PM
Quote (Kampfschaf @ Sep. 16 2005,10:21)
If you would like to make much more hacks please contact me n ICQ: 306155901

I don't have ICQ.
I program the Gish Trainer in VB!
I used C, and I'm not using Windows.
Maybe we can program a tool to make much more ;)
I don't feel like doing much with it now.
Title: The level format
Post by: Kampfschaf on September 16, 2005, 11:31:26 PM
No ICQ? Where you live? ^^

Can you send me you C Code? I can this a little bit! I think i can use this 4 my VB Code a little bit! :) To make the GISH Trainer much better.
Title: The level format
Post by: Jonathan_NL on September 17, 2005, 12:13:25 AM
Quote (Kampfschaf @ Sep. 17 2005,1:31)
No ICQ? Where you live? ^^

In front of my computer. :laugh:
Can you send me you C Code? I can this a little bit! I think i can use this 4 my VB Code a little bit! :) To make the GISH Trainer much better.
How would code to read levels help reading player files?
Title: The level format
Post by: Kampfschaf on September 17, 2005, 12:32:37 PM
ould like to see the code with you decompile the LevelHexCode!
Title: The level format
Post by: Jonathan_NL on September 17, 2005, 04:51:17 PM
What do you mean? Reading a .pla file works like this:
Code Sample
fp = fopen(path, "rb");
fread(&plastruct, sizeof plastruct, 1, fp); /* making assumptions about struct packing */
fclose(fp);
/* swap bytes on a big-endian machine */

Reading levels works almost the same, but there are points where you depend on previous data, such as lists of dynamic size. That gives:
Code Sample
fread(&lvlstruct, untilfirstlist, 1, fp);
/* swap bytes on a big-endian machine */
int i;
for(i=0; i<numitems; i++) fread(&somewhere, sizeof somewhere, 1, fp);
/* etc */

Of course there should be error checks in a real program.