ref: db005316eeb552c68b6c54c7392bc119a69b12e0
dir: /utils/genspr/
#!/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 # 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