Map format
#4
I see now!

Each byte in the total of identical squares is preceded by a FF byte.
So in the sequence
FF FF FF FF FF 09
The second and fourth FF byte and the 09 byte are each part of the total, and the first, third and fifth FF bytes each delineate that following byte is a part of the sum. Like so
FF FF FF FF FF 09
Where FF is a marker and XX is a part of the total. As you can see, the blue bytes sum up to 519.
Oh, and as far as the memset/memcpy:

char tmp = *(c-1);
memset(c, tmp, n);
Sets n bytes, starting at the byte pointed to by c, to the value of tmp (which is the value of the byte that precedes byte c). n is one of the blue values in the above example. I can't explain what this accomplishes, because I've no idea what c points to (a byte inside of mlayout, I'm sure, but I don't know what mlayout is).

for(int i = 0; i<n; i++, k++) memcpy(&world[k], t, sizeof(sqr));
just copies n squares identical to the last square (t) into the memory structure which represents the world to be drawn (this is the part that actually takes the file and makes it into the game's concept of a map).
Thanks given by:


Messages In This Thread
Map format - by Ronald_Reagan - 21 Dec 11, 03:27AM
RE: Map format - by MasterKaen - 21 Dec 11, 04:02AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 04:13AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:01AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 05:32AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:34AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 05:35AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:44AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 05:51AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:55AM
RE: Map format - by Mael - 21 Dec 11, 03:42PM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 09:35PM
RE: Map format - by V-Man - 22 Dec 11, 08:27AM
RE: Map format - by Ronald_Reagan - 22 Dec 11, 08:48AM