21 Dec 11, 05:01AM
(This post was last modified: 21 Dec 11, 05:10AM by MasterKaen.)
I see now!
Each byte in the total of identical squares is preceded by a FF byte.
So in the sequence
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:
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).
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).
Each byte in the total of identical squares is preceded by a FF byte.
So in the sequence
[SELECT ALL] Code:
FF FF FF FF FF 09
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:
[SELECT ALL] Code:
char tmp = *(c-1);
memset(c, tmp, n);
[SELECT ALL] Code:
for(int i = 0; i<n; i++, k++) memcpy(&world[k], t, sizeof(sqr));