ref: 6be6bc64459a8790b1e5020d61e482d0b1d7b84d
parent: 49d5b03c43c8eb2f13909c8831705753be1c6233
author: qwx <qwx@sciops.net>
date: Thu Apr 22 17:57:53 EDT 2021
utils: deprecate old extraction scripts
--- a/utils/genspr
+++ /dev/null
@@ -1,78 +1,0 @@
-#!/bin/rc -e
-rfork n
-bind -a $home/p/pico /bin
-bind -a $home/p/sce/utils /bin
-bind -ca /sys/games/lib/sce .
-
-# pwd must contain extracted object bitmaps and corresponding shadows,
-# tile palette, tileset (wpe vr4 vx4) files
-# and sctile in /bin
-
-fn unit{
- 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;}'})
- 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})
- scerot $1^$n^.^$id($i) $2 r8g8b8
- scerot $1^s^.^$id($i) $2 a8r8g8b8
- }
-}
-
-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 a8r8g8b8
- }
-}
-
-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
-unit mutalid 32 -36 -38 (0 1 2 3 4) (00 01 02 03 04)
-
-# 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
-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
-genshad zhashad.grp.00000.bit 9 -7 hatcherys.00.00.bit
-
-# command center
-sceass -s control.grp.00005.bit control 00 00 -2 -32
-genshad tccShad.grp.00000.bit -2 -6 controls.00.00.bit
-
-# generate tileset palette and tileset bitmap
-sctile badlands
-rm badlands.?[1-4]???.bit badlands.00[1-9]??.bit badlands.000[3-9]?.bit badlands.000^(25 26 27 28 29)^.bit badlands.00000.bit
-
-# now fix the shit we just generated...
-# (FIXME: remove the need for this)
-scefix
--- a/utils/sceass
+++ /dev/null
@@ -1,54 +1,0 @@
-#!/bin/rc
-rfork e
-if(~ $1 -s){
- noshad=1
- shift
-}
-if(! ~ $#* 6){
- echo usage: $0 [-s] grp name frm rot dx dy
- exit usage
-}
-grp=$1
-name=$2
-frm=$3
-rot=$4
-dx=$5
-dy=$6
-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.'^$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
-t=`{read -c 36 $grp | awk '{dx=$2+'^$dx^'; dy=$3+'^$dy^'; print dx, dy, dy+8}'}
-for(i in $name^?.^$frm^.^$rot.bit)
- iconv -c r8g8b8 $i | crop -t $t(1-2) > a && mv a $i
-if(~ $#noshad 0){
- f=$name^s.^$frm^.^$rot.bit
- echo '
- !r '^$grp^' s
- 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 ? (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 a8r8g8b8 $f | crop -t $t(1) $t(3) > a && mv a $f
-}
-status=''
--- a/utils/scefix
+++ /dev/null
@@ -1,130 +1,0 @@
-#!/bin/rc
-rfork n
-
-fn terrain{
- name=$1
- shift
- echo $name `{ls $name^.*.bit | wc -l} |\
- awk '
-{
- n = int($2)
- print "!s", 32, 32*n
- print "r = z == 0 ? 0 : Z"
- for(i=0; i<n; i++){
- printf "!r %s.%05d.bit a\n", $1, i+1
- print "r = y >= 32*" i " && y < 32*" i+1 " ? a[x,y-32*" i "] : r"
- }
- print "!w r /tmp/a.bit"
-}
-' >/env/fuckrc
- $home/p/pico/pico </env/fuckrc
- iconv -c r8g8b8 /tmp/a.bit >$name^.bit
- rm /tmp/a.bit $name^.*.bit
-}
-
-fn sprsheet{
- name=$1
- frm=$2
- rot=$3
- dim=`{read -c 72 $name^1.$frm.$rot.bit | awk 'NR>1{print $2, $3, $4, $5}'}
- x1=$dim(1)
- y1=$dim(2)
- x2=$dim(3)
- y2=$dim(4)
- dy=`{echo $y2-$y1 | pc -n}
- crop -b 0 255 255 -r $x1 $y1 $x2 \
- `{echo $y1^'+'^$dy^'*8' | pc -n} \
- $name^1.$frm.$rot.bit >/tmp/a.bit
- sed 's/NAME/'^$name^'/g;s/FRM/'^$frm^'/g;s/ROT/'^$rot^'/g;s/DY/'^$dy^'/g' \
- /env/fuckrc >/env/forever
- </env/forever $home/p/pico/pico
- iconv -c r8g8b8 /tmp/b.bit |\
- crop -t $x1 $y1 \
- >$name.$frm.$rot.bit
- mv $name^s.$frm.$rot.bit $name.$frm.$rot.s.bit
- rm /tmp/b.bit
-}
-
-fn gen32{
- name=$1
- shift
- for(frm in $*){
- for(rot in 00 02 04 06 08 10 12 14 16 17 19 21 23 25 27 29 31)
- sprsheet $name $frm $rot
- rm $name^?.$frm.*.bit
- }
- rm /tmp/a.bit
-}
-
-fn gen1{
- name=$1
- shift
- for(frm in $*){
- sprsheet $name $frm 00
- rm $name^?.$frm.*.bit
- }
- 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
-}
-
-fn rename{
- if(! ~ $3 '')
- suf=';s/\.bit/.'^$3^'&/'
- if not
- suf=''
- for(i in $1^.*)
- mv $i `{echo $i | sed 's/'^$1^'/'^$2^'/'^$suf}
-}
-
-fn translate{
- crop -t $2 $3 $1 > a && mv a $1
-}
-
-cat <<! >/env/fuckrc
-!r /tmp/a.bit a
-r = a
-!r NAME2.FRM.ROT.bit b
-r = y >= DY*1 && y < DY*2 ? b[x,y-DY*1] : r
-!r NAME3.FRM.ROT.bit b
-r = y >= DY*2 && y < DY*3 ? b[x,y-DY*2] : r
-!r NAME4.FRM.ROT.bit b
-r = y >= DY*3 && y < DY*4 ? b[x,y-DY*3] : r
-!r NAME5.FRM.ROT.bit b
-r = y >= DY*4 && y < DY*5 ? b[x,y-DY*4] : r
-!r NAME6.FRM.ROT.bit b
-r = y >= DY*5 && y < DY*6 ? b[x,y-DY*5] : r
-!r NAME7.FRM.ROT.bit b
-r = y >= DY*6 && y < DY*7 ? b[x,y-DY*6] : r
-!r NAME8.FRM.ROT.bit b
-r = y >= DY*7 && y < DY*8 ? b[x,y-DY*7] : r
-!w r /tmp/b.bit
-!
-
-gen32 scv 00
-gen32 drone 00 01 02 03 04
-gen32 mutalid 00 01 02 03 04
-clean tscglow
-rename tscglow scv g
-gen1 control 00
-gen1 hatchery 00 01 02 03
-terrain badlands
-
-translate drone.00.23.bit -1 0
-translate drone.00.23.s.bit -1 0
-translate drone.03.23.bit 1 0
-translate drone.03.23.s.bit 1 0
-translate drone.04.23.bit -3 0
-translate drone.04.23.s.bit -3 0
-for(i in 00 01 02 03){
- 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
-}