shithub: sce

Download patch

ref: 291da955bdf66cb0d92038221d362c78cfdeed0a
parent: bda2b5e7352b706c816ddd6ce0264e4546df77df
author: qwx <qwx@sciops.net>
date: Thu Mar 12 22:31:21 EDT 2020

update asset extraction scripts and add a script for drone graphics

to be updated later with the rest of the assets used currently,
with extraction from grp added as well.

--- /dev/null
+++ b/rc/extract
@@ -1,0 +1,29 @@
+#!/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 '' -42 -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' -42 -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' -42 -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' -42 -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' -42 -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' -42 -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
--- a/rc/sceass
+++ b/rc/sceass
@@ -1,16 +1,17 @@
 #!/bin/rc
-# for(i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17) sceass drone.grp.000^$i^.bit drone 00 $i
-# for(i in 1 2 3 4 5 6 7 8) scerot drone$i.00
-if(! ~ $#* 4){
-	echo usage: sceass grp name frm rot
+if(! ~ $#* 7){
+	echo usage: sceass grp name frm rot id dx dy
 	exit usage
 }
 grp=$1
 name=$2
 frm=$3
-rot=$4
+rot=`{echo $4 | awk '{printf "%02d", $1 % 17}'}
+id=$5
+dx=$6
+dy=$7
 echo '
-	r s '^$grp^'
+	!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
@@ -20,17 +21,15 @@
 	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 -q
-for(i in $name^?.^$frm^.^$rot.bit)
-	iconv -c r8g8b8 $i > a && mv a $i
-t=`{read -c 36 $grp | awk '{print $2, $3}'}
-for(i in $name^?.^$frm^.^$rot.bit)
-	crop -t $t $i > a && mv a $i
+	!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
+++ b/rc/scerot
@@ -1,4 +1,4 @@
-#!/bin/rc
+#!/bin/rc -e
 if(! ~ $#* 1){
 	echo usage: sceass radix
 	exit usage
@@ -5,52 +5,52 @@
 }
 name=$1	#scv1.00
 echo '
-	r s '^$name^'.15.bit
+	!r '^$name^'.15.bit s
 	m = s[X-x-1,y,z]
-	w m '^$name^'.17.bit
-	r sa '^$name^'.14.bit
-	ma = sa[X-x-1,y,z]
-	w ma '^$name^'.18.bit
-	r sb '^$name^'.13.bit
-	mb = sb[X-x-1,y,z]
-	w mb '^$name^'.19.bit
-	r sc '^$name^'.12.bit
-	mc = sc[X-x-1,y,z]
-	w mc '^$name^'.20.bit
-	r sd '^$name^'.11.bit
-	md = sd[X-x-1,y,z]
-	w md '^$name^'.21.bit
-	r se '^$name^'.10.bit
-	me = se[X-x-1,y,z]
-	w me '^$name^'.22.bit
-	r sf '^$name^'.09.bit
-	mf = sf[X-x-1,y,z]
-	w mf '^$name^'.23.bit
-	r sg '^$name^'.08.bit
-	mg = sg[X-x-1,y,z]
-	w mg '^$name^'.24.bit
-	r sh '^$name^'.07.bit
-	mh = sh[X-x-1,y,z]
-	w mh '^$name^'.25.bit
-	r si '^$name^'.06.bit
-	mi = si[X-x-1,y,z]
-	w mi '^$name^'.26.bit
-	r sj '^$name^'.05.bit
-	mj = sj[X-x-1,y,z]
-	w mj '^$name^'.27.bit
-	r sk '^$name^'.04.bit
-	mk = sk[X-x-1,y,z]
-	w mk '^$name^'.28.bit
-	r sl '^$name^'.03.bit
-	ml = sl[X-x-1,y,z]
-	w ml '^$name^'.29.bit
-	r sm '^$name^'.02.bit
-	mm = sm[X-x-1,y,z]
-	w mm '^$name^'.30.bit
-	r sn '^$name^'.01.bit
-	mn = sn[X-x-1,y,z]
-	w mn '^$name^'.31.bit
-' | pico -q
+	!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}'}
--- a/sim.c
+++ b/sim.c
@@ -11,27 +11,9 @@
 
 static Lobj vlist = {.lo = &vlist, .lp = &vlist };
 
-/* FIXME: drone graphics
- *	- idle -> one frame, but moving is animated
- *	- moving animation in all rotations
- *		; page /sys/games/lib/sce/drone1.00.00.bit drone.grp.00^`{for(i in 018 034 051 068 085) echo $i}^.bit
- *		=> all remaining frames (085 is same as first)
- *		idle frame is actually last moving frame
- *	- attack animation in all rotations
- *	- gather animation in all rotations
- *		=> starting from 102
- *	- death animation
- *	- burrow animation
- *	=> find out ranges in drone grp
- */
-
-/* FIXME: compose is broken when scaling */
-
 /* FIXME: networking: recvbuf and sendbuf for accumulating messages to flush
  * to all clients */
 /* FIXME: acceleration, deceleration, turning speed (360°) */
-
-/* FIXME: compose: clip like drawpic or toss */
 /* FIXME: minerals: 4 spaces in every direction forbidding cc placement */
 /* FIXME: resource tiles: take 2x1 tiles, drawn on top of rest
  *	-> actual (immutable) object, not terrain (remove resource= from