Quote:
Originally Posted by DJazz
|
Here's some stuff I added to your updated source. In particular, the only changes I made are between lines 293 and 324. I added 4 (or 5) new lines of code and modified 2 existing ones:
PHP Code:
$isempty=true;
$curpx=0;
$tmp4=""; /********** NEOBEO-CODE **********/
for ($j = 0; $j < 32; $j++) { // each row of pixels in tile
$tmp3="";
for ($k = 0; $k < 32; $k++) { // each pixel in row
//$curpix = ord($s2[$offsets[$i+1]+32*$j+$k]);
$tmp2=imagecolorat($img,$xoff+$k,$yoff+$j);
if($tmp2!=0) {$isempty=false;$tmp3.="1";}
else $tmp3.="0";
$curpx++;
if($curpx==32) {
$curpx=0;
$tmp.=pack("V*",bindec(strrev($tmp3)));
$rle=preg_replace('/(0*)(1+)/e','chr(strlen("$1")).chr(strlen("$2"))',
rtrim($tmp3,0),-1,$count); /********** NEOBEO-CODE **********/
$tmp4.=chr($count).$rle; /********** NEOBEO-CODE **********/
$tmp3="";
}
}
}
$tmp.=$tmp4; /********** NEOBEO-CODE **********/
if(array_search($tmp,$_TransData)===FALSE && ($isempty===false || $i==0)) {
$_TransData[$i]=$tmp;
//echo ".".$tmp."";
$_TransOffsets[$i]=$ioff; /********** NEOBEO-MODIFY **********/
$ioff+=strlen($tmp); /********** NEOBEO-MODIFY **********/
}
elseif(array_search($tmp,$_TransData)!==FALSE && $isempty===false) {
$_TransOffsets[$i]=$_TransOffsets[array_search($tmp,$_TransData)];
}
That should complete the data3 specifications. I'll probably update the specification in the (far) future.
Last edited by Neobeo; Oct 22, 2010 at 03:05 PM.
Reason: decreased code indent
|