View Single Post
djazz djazz's Avatar

JCF Member

Joined: Feb 2009

Posts: 257

djazz is OFF DA CHARTdjazz is OFF DA CHARTdjazz is OFF DA CHART

Oct 22, 2010, 08:12 AM
djazz is offline
Reply With Quote
I made a little comparison between TilesetCompiler's data3 and JCS's data3, as seen in the image below.
I use unpack to "split" the stream into longs, and decbin to convert it to a binary string. The "tiles" are splitted with a line. I used automask in both, and JCS's mask and TilesetCompiler's mask are equal (same as PHP's data3, because of automask). Below the black there's the tileset I used.



I was using this code:

PHP Code:
$stream3 unpack("V*"$s3); // JCS's data3
$stream3php unpack("V*"$_Stream3); // TilesetCompiler's data3
$length count($stream3) > count($stream3php) ? count($stream3) : count($stream3php); // Lengths do not equal, so use the biggest
for($i=1$i $length+1$i+=1) {
    if(isset(
$stream3[$i]))
        echo 
str_replace("1""X"str_replace("0"".",str_pad(decbin($stream3[$i]), 32"0")))."  ";
    else
        echo 
str_repeat(" "34);
    if(isset(
$stream3php[$i]))
        echo 
str_replace("1""X"str_replace("0"".",str_pad(decbin($stream3php[$i]), 32"0")));
    else
        echo 
str_repeat(" "32);
    echo 
"";
    
    if(
$i%32==0) echo str_repeat("-"32)."  ".str_repeat("-"32).""// Each 32 row, add a line

This code is also in TilesetCompiler's updated source.
__________________
WebJCS 2 (new and in progress)
WebJCS 1 (old but complete)
SGIP Simple Games in Progress list
Level Packer v2 - With a GUI!
PHP Tileset Compiler