shithub: sce

Download patch

ref: e9d88c30ac1f76c8f386f2f333f3518d44d928fc
parent: b09e7e2594189a32716c9c202b42cd33dc8257f2
author: qwx <[email protected]>
date: Thu Sep 24 21:57:05 EDT 2020

genspr: add tscglow, sprite with alpha channel, to extraction scripts

--- a/utils/genspr
+++ b/utils/genspr
@@ -18,13 +18,31 @@
 		for(n in `{awk 'BEGIN{s='^$rng($i)^'*17; for(i=s; i<s+17; i+=32/'^$2^') printf "%03d\n", i;}'})
 			sceass $1^.grp.^00^$n^.bit $1 $id($i) `{echo $n | awk '{printf "%02d", ($1%17) / (32/'^$2^')}'} $3 $4
 		for(n in (`{seq 1 8} s))
-			scerot $1^$n^.^$id($i) $2
+			scerot $1^$n^.^$id($i) $2 r8g8b8
 	}
 }
 
+fn asprite{
+	n=`{echo '(' $#* - 4 ')' / 2 | pc -n}
+	s1=`{echo 5 + $n - 1 | pc -n}
+	s2=`{echo $s1 + 1 | pc -n}
+	rng=$*(5-$s1)
+	id=$*($s2-)
+	for(i in `{seq 1 $#id}){
+		for(n in `{awk 'BEGIN{s='^$rng($i)^'*17; for(i=s; i<s+17; i+=32/'^$2^') printf "%03d\n", i;}'}){
+			crop -t $3 $4 $1^.grp.^00^$n^.bit >a
+			mv a $1^.^$id($i)^.^`{echo $n | awk '{printf "%02d", ($1%17) / (32/'^$2^')}'}^.bit
+		}
+		scerot $1^.^$id($i) $2 r8g8b8a8
+	}
+}
+
 # individual units
 unit drone 32 -48 -47 (0 1 2 3 4) (00 01 02 03 04)
 unit scv 32 -26 -14 0 00
+
+# sprites with transparency
+asprite tscglow 32 -26 -14 (0 1 2 3) (00 01 02 03)
 
 # hatchery
 sceass -s hatchery.grp.00000.bit hatchery 00 00 -32 -30
--- a/utils/scefix
+++ b/utils/scefix
@@ -66,6 +66,11 @@
 	rm /tmp/a.bit
 }
 
+fn clean{
+	for(rot in 01 03 05 07 09 11 13 15 18 20 22 24 26 28 30)
+		rm $1^.??.^$rot^.bit
+}
+
 cat <<! >/env/fuckrc
 !r /tmp/a.bit a
 r = a
@@ -88,6 +93,7 @@
 
 gen32 scv 00
 gen32 drone 00 01 02 03 04
+clean tscglow
 gen1 control 00
 gen1 hatchery 00 01 02 03
 terrain badlands
--- a/utils/scerot
+++ b/utils/scerot
@@ -1,6 +1,6 @@
 #!/bin/rc -e
-if(! ~ $#* 2){
-	echo usage: sceass radix nrot
+if(! ~ $#* 3){
+	echo usage: sceass radix nrot chan
 	exit usage
 }
 id=`{awk 'BEGIN{for(i=1; i<='^$2^'/2-1; i++) printf "%02d\n", i}'}
@@ -14,5 +14,5 @@
 for(i in $n){
 	t=`{read -c 46 $1^.^$id($i)^.bit | awk '{print $2, $3}'}
 	f=$1^.^$rev($i)^.bit
-	iconv -c r8g8b8 $f | crop -t $t > a && mv a $f
+	iconv -c $3 $f | crop -t $t > a && mv a $f
 }