shithub: sce

Download patch

ref: fa58e6f08dfd43666eb5c6c4de9dd0f8775f8f83
parent: 89781e8f82536819091eab05f8beb6944d72d203
author: qwx <qwx@sciops.net>
date: Sat Mar 14 17:50:46 EDT 2020

rename rc to utils and extract to genspr

genspr only generates new sprites based on already extracted data

diff: cannot open b/utils//null: file does not exist: 'b/utils//null'
--- a/rc/extract
+++ /dev/null
@@ -1,48 +1,0 @@
-#!/bin/rc -e
-bind -a $home/p/pico /bin
-bind -a $home/p/sce/rc /bin
-
-# drones
-for(i in `{awk 'BEGIN{s=0*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
-	sceass drone.grp.00^$i^.bit drone 00 $i '' -48 -47
-for(i in `{awk 'BEGIN{s=0*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
-	sceass drone.grp.00^$i^.bit drone 00 $i 'm' -48 -47
-for(i in `{awk 'BEGIN{s=1*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
-	sceass drone.grp.00^$i^.bit drone 01 $i 'm' -48 -47
-for(i in `{awk 'BEGIN{s=2*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
-	sceass drone.grp.00^$i^.bit drone 02 $i 'm' -48 -47
-for(i in `{awk 'BEGIN{s=3*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
-	sceass drone.grp.00^$i^.bit drone 03 $i 'm' -48 -47
-for(i in `{awk 'BEGIN{s=4*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
-	sceass drone.grp.00^$i^.bit drone 04 $i 'm' -48 -47
-for(i in `{seq 1 8})
-	scerot drone^$i^.00
-for(i in `{seq 1 8})
-	scerot drone^$i^m.00
-for(i in `{seq 1 8})
-	scerot drone^$i^m.01
-for(i in `{seq 1 8})
-	scerot drone^$i^m.02
-for(i in `{seq 1 8})
-	scerot drone^$i^m.03
-for(i in `{seq 1 8})
-	scerot drone^$i^m.04
-
-# hatchery
-sceass hatchery.grp.00000.bit hatchery 00 00 '' -32 -30
-sceass hatchery.grp.00001.bit hatchery 01 00 '' -32 -30
-sceass hatchery.grp.00002.bit hatchery 02 00 '' -32 -30
-sceass hatchery.grp.00003.bit hatchery 03 00 '' -32 -30
-sceass hatchery.grp.00003.bit hatchery 04 00 '' -32 -30
-sceass hatchery.grp.00002.bit hatchery 05 00 '' -32 -30
-sceass hatchery.grp.00001.bit hatchery 06 00 '' -32 -30
-sceass hatchery.grp.00000.bit hatchery 07 00 '' -32 -30
-
-# command center
-sceass control.grp.00005.bit control 00 00 '' -2 -32
-
-# scv
-for(i in `{awk 'BEGIN{s=0*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
-	sceass scv.grp.00^$i^.bit scv 00 $i '' -26 -14
-for(i in `{seq 1 8})
-	scerot scv^$i^.00
--- a/rc/genmap
+++ /dev/null
@@ -1,15 +1,0 @@
-#!/bin/rc
-if(! ~ $#* 3){
-	echo usage: $0 x y tile >[1=2]
-	exit usage
-}
-awk -v 'x='$1 -v 'y='$2 -v 't='$3 '
-BEGIN{
-	srand()
-	n = int(x) * int(y)
-	while(n-- > 0){
-		v = 1 + rand() * 1000000 % 10
-		print "map=" t int(v)
-	}
-}
-'
--- a/rc/jvc2pal
+++ /dev/null
@@ -1,9 +1,0 @@
-#!/bin/rc
-awk '
-NR==3{
-	print "pal 256"
-}
-NR>3{
-	x = $1*65536 + $2*256 + $3
-	printf "0x%06x\n", x
-}' $*
--- a/rc/sceass
+++ /dev/null
@@ -1,35 +1,0 @@
-#!/bin/rc
-if(! ~ $#* 7){
-	echo usage: sceass grp name frm rot id dx dy
-	exit usage
-}
-grp=$1
-name=$2
-frm=$3
-rot=`{echo $4 | awk '{printf "%02d", $1 % 17}'}
-id=$5
-dx=$6
-dy=$7
-echo '
-	!r '^$grp^' s
-	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'^$id^'.'^$frm^.^$rot^'.bit
-	!w blue '^$name^'2'^$id^'.'^$frm^.^$rot^'.bit
-	!w teal '^$name^'3'^$id^'.'^$frm^.^$rot^'.bit
-	!w purple '^$name^'4'^$id^'.'^$frm^.^$rot^'.bit
-	!w orange '^$name^'5'^$id^'.'^$frm^.^$rot^'.bit
-	!w brown '^$name^'6'^$id^'.'^$frm^.^$rot^'.bit
-	!w white '^$name^'7'^$id^'.'^$frm^.^$rot^'.bit
-	!w yellow '^$name^'8'^$id^'.'^$frm^.^$rot^'.bit
-' | pico
-t=`{read -c 36 $grp | awk '{print $2+'^$dx^', $3+'^$dy^'}'}
-for(i in $name^?^$id^.^$frm^.^$rot.bit)
-	iconv -c r8g8b8 $i | crop -t $t > a && mv a $i
--- a/rc/scerot
+++ /dev/null
@@ -1,85 +1,0 @@
-#!/bin/rc -e
-if(! ~ $#* 1){
-	echo usage: sceass radix
-	exit usage
-}
-name=$1	#scv1.00
-echo '
-	!r '^$name^'.15.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.17.bit
-	!r '^$name^'.14.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.18.bit
-	!r '^$name^'.13.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.19.bit
-	!r '^$name^'.12.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.20.bit
-	!r '^$name^'.11.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.21.bit
-	!r '^$name^'.10.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.22.bit
-	!r '^$name^'.09.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.23.bit
-	!r '^$name^'.08.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.24.bit
-	!r '^$name^'.07.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.25.bit
-	!r '^$name^'.06.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.26.bit
-	!r '^$name^'.05.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.27.bit
-	!r '^$name^'.04.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.28.bit
-	!r '^$name^'.03.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.29.bit
-	!r '^$name^'.02.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.30.bit
-	!r '^$name^'.01.bit s
-	m = s[X-x-1,y,z]
-	!w m '^$name^'.31.bit
-' | pico
-for(i in $name.^`{seq 17 31}^.bit)
-	iconv -c r8g8b8 $i > a && mv a $i
-t=`{read -c 46 $name^.15.bit | awk '{print $2, $3}'}
-crop -t $t $name^.17.bit > a && mv a $name^.17.bit
-t=`{read -c 46 $name^.14.bit | awk '{print $2, $3}'}
-crop -t $t $name^.18.bit > a && mv a $name^.18.bit
-t=`{read -c 46 $name^.13.bit | awk '{print $2, $3}'}
-crop -t $t $name^.19.bit > a && mv a $name^.19.bit
-t=`{read -c 46 $name^.12.bit | awk '{print $2, $3}'}
-crop -t $t $name^.20.bit > a && mv a $name^.20.bit
-t=`{read -c 46 $name^.11.bit | awk '{print $2, $3}'}
-crop -t $t $name^.21.bit > a && mv a $name^.21.bit
-t=`{read -c 46 $name^.10.bit | awk '{print $2, $3}'}
-crop -t $t $name^.22.bit > a && mv a $name^.22.bit
-t=`{read -c 46 $name^.09.bit | awk '{print $2, $3}'}
-crop -t $t $name^.23.bit > a && mv a $name^.23.bit
-t=`{read -c 46 $name^.08.bit | awk '{print $2, $3}'}
-crop -t $t $name^.24.bit > a && mv a $name^.24.bit
-t=`{read -c 46 $name^.07.bit | awk '{print $2, $3}'}
-crop -t $t $name^.25.bit > a && mv a $name^.25.bit
-t=`{read -c 46 $name^.06.bit | awk '{print $2, $3}'}
-crop -t $t $name^.26.bit > a && mv a $name^.26.bit
-t=`{read -c 46 $name^.05.bit | awk '{print $2, $3}'}
-crop -t $t $name^.27.bit > a && mv a $name^.27.bit
-t=`{read -c 46 $name^.04.bit | awk '{print $2, $3}'}
-crop -t $t $name^.28.bit > a && mv a $name^.28.bit
-t=`{read -c 46 $name^.03.bit | awk '{print $2, $3}'}
-crop -t $t $name^.29.bit > a && mv a $name^.29.bit
-t=`{read -c 46 $name^.02.bit | awk '{print $2, $3}'}
-crop -t $t $name^.30.bit > a && mv a $name^.30.bit
-t=`{read -c 46 $name^.01.bit | awk '{print $2, $3}'}
-crop -t $t $name^.31.bit > a && mv a $name^.31.bit
--- /dev/null
+++ b/utils/genmap
@@ -1,0 +1,15 @@
+#!/bin/rc
+if(! ~ $#* 3){
+	echo usage: $0 x y tile >[1=2]
+	exit usage
+}
+awk -v 'x='$1 -v 'y='$2 -v 't='$3 '
+BEGIN{
+	srand()
+	n = int(x) * int(y)
+	while(n-- > 0){
+		v = 1 + rand() * 1000000 % 10
+		print "map=" t int(v)
+	}
+}
+'
--- /dev/null
+++ b/utils/genspr
@@ -1,0 +1,48 @@
+#!/bin/rc -e
+bind -a $home/p/pico /bin
+bind -a $home/p/sce/rc /bin
+
+# drones
+for(i in `{awk 'BEGIN{s=0*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
+	sceass drone.grp.00^$i^.bit drone 00 $i '' -48 -47
+for(i in `{awk 'BEGIN{s=0*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
+	sceass drone.grp.00^$i^.bit drone 00 $i 'm' -48 -47
+for(i in `{awk 'BEGIN{s=1*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
+	sceass drone.grp.00^$i^.bit drone 01 $i 'm' -48 -47
+for(i in `{awk 'BEGIN{s=2*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
+	sceass drone.grp.00^$i^.bit drone 02 $i 'm' -48 -47
+for(i in `{awk 'BEGIN{s=3*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
+	sceass drone.grp.00^$i^.bit drone 03 $i 'm' -48 -47
+for(i in `{awk 'BEGIN{s=4*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
+	sceass drone.grp.00^$i^.bit drone 04 $i 'm' -48 -47
+for(i in `{seq 1 8})
+	scerot drone^$i^.00
+for(i in `{seq 1 8})
+	scerot drone^$i^m.00
+for(i in `{seq 1 8})
+	scerot drone^$i^m.01
+for(i in `{seq 1 8})
+	scerot drone^$i^m.02
+for(i in `{seq 1 8})
+	scerot drone^$i^m.03
+for(i in `{seq 1 8})
+	scerot drone^$i^m.04
+
+# hatchery
+sceass hatchery.grp.00000.bit hatchery 00 00 '' -32 -30
+sceass hatchery.grp.00001.bit hatchery 01 00 '' -32 -30
+sceass hatchery.grp.00002.bit hatchery 02 00 '' -32 -30
+sceass hatchery.grp.00003.bit hatchery 03 00 '' -32 -30
+sceass hatchery.grp.00003.bit hatchery 04 00 '' -32 -30
+sceass hatchery.grp.00002.bit hatchery 05 00 '' -32 -30
+sceass hatchery.grp.00001.bit hatchery 06 00 '' -32 -30
+sceass hatchery.grp.00000.bit hatchery 07 00 '' -32 -30
+
+# command center
+sceass control.grp.00005.bit control 00 00 '' -2 -32
+
+# scv
+for(i in `{awk 'BEGIN{s=0*17; for(i=s; i<s+17; i++) printf "%03d\n", i;}'})
+	sceass scv.grp.00^$i^.bit scv 00 $i '' -26 -14
+for(i in `{seq 1 8})
+	scerot scv^$i^.00
--- /dev/null
+++ b/utils/jvc2pal
@@ -1,0 +1,9 @@
+#!/bin/rc
+awk '
+NR==3{
+	print "pal 256"
+}
+NR>3{
+	x = $1*65536 + $2*256 + $3
+	printf "0x%06x\n", x
+}' $*
--- /dev/null
+++ b/utils/sceass
@@ -1,0 +1,35 @@
+#!/bin/rc
+if(! ~ $#* 7){
+	echo usage: sceass grp name frm rot id dx dy
+	exit usage
+}
+grp=$1
+name=$2
+frm=$3
+rot=`{echo $4 | awk '{printf "%02d", $1 % 17}'}
+id=$5
+dx=$6
+dy=$7
+echo '
+	!r '^$grp^' s
+	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'^$id^'.'^$frm^.^$rot^'.bit
+	!w blue '^$name^'2'^$id^'.'^$frm^.^$rot^'.bit
+	!w teal '^$name^'3'^$id^'.'^$frm^.^$rot^'.bit
+	!w purple '^$name^'4'^$id^'.'^$frm^.^$rot^'.bit
+	!w orange '^$name^'5'^$id^'.'^$frm^.^$rot^'.bit
+	!w brown '^$name^'6'^$id^'.'^$frm^.^$rot^'.bit
+	!w white '^$name^'7'^$id^'.'^$frm^.^$rot^'.bit
+	!w yellow '^$name^'8'^$id^'.'^$frm^.^$rot^'.bit
+' | pico
+t=`{read -c 36 $grp | awk '{print $2+'^$dx^', $3+'^$dy^'}'}
+for(i in $name^?^$id^.^$frm^.^$rot.bit)
+	iconv -c r8g8b8 $i | crop -t $t > a && mv a $i
--- /dev/null
+++ b/utils/scerot
@@ -1,0 +1,85 @@
+#!/bin/rc -e
+if(! ~ $#* 1){
+	echo usage: sceass radix
+	exit usage
+}
+name=$1	#scv1.00
+echo '
+	!r '^$name^'.15.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.17.bit
+	!r '^$name^'.14.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.18.bit
+	!r '^$name^'.13.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.19.bit
+	!r '^$name^'.12.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.20.bit
+	!r '^$name^'.11.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.21.bit
+	!r '^$name^'.10.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.22.bit
+	!r '^$name^'.09.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.23.bit
+	!r '^$name^'.08.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.24.bit
+	!r '^$name^'.07.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.25.bit
+	!r '^$name^'.06.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.26.bit
+	!r '^$name^'.05.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.27.bit
+	!r '^$name^'.04.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.28.bit
+	!r '^$name^'.03.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.29.bit
+	!r '^$name^'.02.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.30.bit
+	!r '^$name^'.01.bit s
+	m = s[X-x-1,y,z]
+	!w m '^$name^'.31.bit
+' | pico
+for(i in $name.^`{seq 17 31}^.bit)
+	iconv -c r8g8b8 $i > a && mv a $i
+t=`{read -c 46 $name^.15.bit | awk '{print $2, $3}'}
+crop -t $t $name^.17.bit > a && mv a $name^.17.bit
+t=`{read -c 46 $name^.14.bit | awk '{print $2, $3}'}
+crop -t $t $name^.18.bit > a && mv a $name^.18.bit
+t=`{read -c 46 $name^.13.bit | awk '{print $2, $3}'}
+crop -t $t $name^.19.bit > a && mv a $name^.19.bit
+t=`{read -c 46 $name^.12.bit | awk '{print $2, $3}'}
+crop -t $t $name^.20.bit > a && mv a $name^.20.bit
+t=`{read -c 46 $name^.11.bit | awk '{print $2, $3}'}
+crop -t $t $name^.21.bit > a && mv a $name^.21.bit
+t=`{read -c 46 $name^.10.bit | awk '{print $2, $3}'}
+crop -t $t $name^.22.bit > a && mv a $name^.22.bit
+t=`{read -c 46 $name^.09.bit | awk '{print $2, $3}'}
+crop -t $t $name^.23.bit > a && mv a $name^.23.bit
+t=`{read -c 46 $name^.08.bit | awk '{print $2, $3}'}
+crop -t $t $name^.24.bit > a && mv a $name^.24.bit
+t=`{read -c 46 $name^.07.bit | awk '{print $2, $3}'}
+crop -t $t $name^.25.bit > a && mv a $name^.25.bit
+t=`{read -c 46 $name^.06.bit | awk '{print $2, $3}'}
+crop -t $t $name^.26.bit > a && mv a $name^.26.bit
+t=`{read -c 46 $name^.05.bit | awk '{print $2, $3}'}
+crop -t $t $name^.27.bit > a && mv a $name^.27.bit
+t=`{read -c 46 $name^.04.bit | awk '{print $2, $3}'}
+crop -t $t $name^.28.bit > a && mv a $name^.28.bit
+t=`{read -c 46 $name^.03.bit | awk '{print $2, $3}'}
+crop -t $t $name^.29.bit > a && mv a $name^.29.bit
+t=`{read -c 46 $name^.02.bit | awk '{print $2, $3}'}
+crop -t $t $name^.30.bit > a && mv a $name^.30.bit
+t=`{read -c 46 $name^.01.bit | awk '{print $2, $3}'}
+crop -t $t $name^.31.bit > a && mv a $name^.31.bit