shithub: sce

Download patch

ref: 13e4185989d42efd2d2dad6daddb67a61a55d94d
parent: 11c36b1a1c1361293f76bd735485266f532858cc
author: qwx <qwx@sciops.net>
date: Wed Feb 17 17:33:06 EST 2021

utils: make shadows argb images, and fix some silly typos

--- a/utils/genspr
+++ b/utils/genspr
@@ -17,8 +17,9 @@
 	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;}'})
 			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))
+		for(n in `{seq 1 8})
 			scerot $1^$n^.^$id($i) $2 r8g8b8
+		scerot $1^s^.^$id($i) $2 a8r8g8b8
 	}
 }
 
@@ -37,6 +38,18 @@
 	}
 }
 
+fn genshad{
+	grp=$1
+	name=$4
+	echo '
+		!r '^$grp^' s
+		o = s[x,y,0] == 0 && s[x,y,1] == Z && s[x,y,2] == Z ? Z : 0
+		o = z == 3 ? o[x,y,0] == 0 ? Z/2+1 : 0 : o
+		!w o a
+	' | pico
+	iconv -c a8r8g8b8 a | crop -t $2 $3 > $name
+}
+
 # individual units
 unit drone 32 -48 -47 (0 1 2 3 4) (00 01 02 03 04)
 unit scv 32 -26 -14 0 00
@@ -49,11 +62,11 @@
 sceass -s hatchery.grp.00001.bit hatchery 01 00 -32 -30
 sceass -s hatchery.grp.00002.bit hatchery 02 00 -32 -30
 sceass -s hatchery.grp.00003.bit hatchery 03 00 -32 -30
-crop -t -32 -30 zhashad.grp.00000.bit >hatcherys.00.00.bit
+genshad zhashad.grp.00000.bit 9 -7 hatcherys.00.00.bit
 
 # command center
 sceass -s control.grp.00005.bit control 00 00 -2 -32
-crop -t -2 -32 tccShad.grp.00000.bit >controls.00.00.bit
+genshad tccShad.grp.00000.bit -2 -6 controls.00.00.bit
 
 # generate tileset palette and tileset bitmap
 sctile badlands
--- a/utils/sceass
+++ b/utils/sceass
@@ -44,9 +44,11 @@
 		m = z == 3 ? Z : y >= Y-8 ? Z : s[x,y+8,0] != 0 || s[x,y+8,1] != Z || s[x,y+8,2] != Z ? 0 : Z
 		b = z == 3 ? Z : s[x,y,0] != 0 || s[x,y,1] != Z || s[x,y,2] != Z ? 0 : Z
 		o = z == 3 || y < 8 ? Z : Z-m + b
-		o = z == 3 ? Z : z == 2 ? Z : z == 0 ? o == 0 ? o + 35 : 0 : z == 1 ? o == 0 ? o + 35 : Z : Z
+		#o = z == 3 ? Z : z == 2 ? Z : z == 0 ? o == 0 ? o + 35 : 0 : z == 1 ? o == 0 ? o + 35 : Z : Z
+		#o = z == 3 ? (o[x,y,0] == 0 && o[x,y,1] == Z && o[x,y,2] == Z ? 0 : Z/2) : o
+		o = z == 3 ? o[x,y,0] + o[x,y,1] + o[x,y,2] > 0 ? 0 : Z/2+1 : o
 		!w o '^$f^'
 	' | pico
-	iconv -c r8g8b8 $f | crop -t $t(1) $t(3) > a && mv a $f
+	iconv -c a8r8g8b8 $f | crop -t $t(1) $t(3) > a && mv a $f
 }
 status=''
--- a/utils/scefix
+++ b/utils/scefix
@@ -82,8 +82,6 @@
 
 fn translate{
 	crop -t $2 $3 $1 > a && mv a $1
-crop -t -1 0 drone.00.23.bit > a && mv a drone.00.23.bit
-
 }
 
 cat <<! >/env/fuckrc
@@ -121,11 +119,11 @@
 crop -t -3 0 drone.04.23.bit > a && mv a drone.04.23.bit
 crop -t -3 0 drone.04.23.s.bit > a && mv a drone.04.23.s.bit
 for(i in 00 01 02 03){
-	translate scv.$i.17.git 26 0
-	translate scv.$i.19.git 30 0
-	translate scv.$i.21.git 28 0
-	translate scv.$i.23.git 23 0
-	translate scv.$i.25.git 25 0
-	translate scv.$i.27.git 21 0
-	translate scv.$i.29.git 14 0
+	translate scv.$i.17.g.bit 26 0
+	translate scv.$i.19.g.bit 30 0
+	translate scv.$i.21.g.bit 28 0
+	translate scv.$i.23.g.bit 23 0
+	translate scv.$i.25.g.bit 25 0
+	translate scv.$i.27.g.bit 21 0
+	translate scv.$i.29.g.bit 14 0
 }