shithub: sce

ref: bda2b5e7352b706c816ddd6ce0264e4546df77df
dir: /rc/sceass/

View raw version
#!/bin/rc
# for(i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17) sceass drone.grp.000^$i^.bit drone 00 $i
# for(i in 1 2 3 4 5 6 7 8) scerot drone$i.00
if(! ~ $#* 4){
	echo usage: sceass grp name frm rot
	exit usage
}
grp=$1
name=$2
frm=$3
rot=$4
echo '
	r s '^$grp^'
	m = z == 3 ? Z : s[x,y,0] == Z && s[x,y,1] == 0 && s[x,y,2] == Z || s[x,y,0] == 222 && s[x,y,1] == 0 && s[x,y,2] == 222 || s[x,y,0] == 189 && s[x,y,1] == 0 && s[x,y,2] == 189 || s[x,y,0] == 156 && s[x,y,1] == 0 && s[x,y,2] == 156 || s[x,y,0] == 124 && s[x,y,1] == 0 && s[x,y,2] == 124 || s[x,y,0] == 91 && s[x,y,1] == 0 && s[x,y,2] == 91 || s[x,y,0] == 58 && s[x,y,1] == 0 && s[x,y,2] == 58 || s[x,y,0] == 25 && s[x,y,1] == 0 && s[x,y,2] == 25 ? s[x,y,0] : 0
	white = m > 0 ? m : s
	red = m > 0 ? z == 0 ? s[x,y,0] : z == 1 ? s[x,y,1] : z == 2 ? s[x,y,1] : Z : s
	blue = m > 0 ? z == 0 ? s[x,y,1] : z == 1 ? s[x,y,1] : z == 2 ? m : Z : s
	teal = m > 0 ? z == 0 ? s[x,y,1] : z == 1 ? s[x,y,0] : z == 2 ? s[x,y,0] : Z : s
	yellow = m > 0 ? z == 0 ? s[x,y,0] : z == 1 ? s[x,y,0] : z == 2 ? s[x,y,1] : Z : s
	purple = m > 0 ? z == 0 ? s[x,y,0]/2 : z == 1 ? s[x,y,1] : z == 2 ? s[x,y,0] : Z : s
	brown = m > 0 ? z == 0 ? s[x,y,0]/2 : z == 1 ? s[x,y,0]/2 : z == 2 ? s[x,y,1] : Z : s
	orange = m > 0 ? z == 0 ? s[x,y,0] : z == 1 ? s[x,y,0]/2 : z == 2 ? s[x,y,1] : Z : s
	w red '^$name^'1.'^$frm^.^$rot^'.bit
	w blue '^$name^'2.'^$frm^.^$rot^'.bit
	w teal '^$name^'3.'^$frm^.^$rot^'.bit
	w purple '^$name^'4.'^$frm^.^$rot^'.bit
	w orange '^$name^'5.'^$frm^.^$rot^'.bit
	w brown '^$name^'6.'^$frm^.^$rot^'.bit
	w white '^$name^'7.'^$frm^.^$rot^'.bit
	w yellow '^$name^'8.'^$frm^.^$rot^'.bit
' | pico -q
for(i in $name^?.^$frm^.^$rot.bit)
	iconv -c r8g8b8 $i > a && mv a $i
t=`{read -c 36 $grp | awk '{print $2, $3}'}
for(i in $name^?.^$frm^.^$rot.bit)
	crop -t $t $i > a && mv a $i