shithub: sce

Download patch

ref: 6cd38c070da8bc242d0418c0a8eb428183493b31
parent: d2e82dee94817cd37ea2fa08b8000cd7ee706430
author: qwx <qwx@sciops.net>
date: Tue May 18 17:30:02 EDT 2021

spr: extract mineral sprites and don't use grp filenames for object names

--- a/sce/map1.db
+++ b/sce/map1.db
@@ -25,4 +25,4 @@
 mapobj,drone,2,10,10
 mapobj,drone,2,10,10
 mapobj,drone,2,10,10
-mapobj,mutalid,2,10,10
+mapobj,mutalisk,2,10,10
--- a/sce/sce.db
+++ b/sce/sce.db
@@ -9,12 +9,12 @@
 # obj: name, flags, w, h, hp, def, vis, cost[3], time, attack[2], speed, accel, halt, turn
 obj,scv,0x3,4,4,60,0,224,1,50,0,20,fusion cutter,,4.92,67,12227,40
 obj,drone,0x1,4,4,40,0,224,1,50,0,20,spines,,4.92,67,12227,40
-obj,mutalid,0x5,4,4,120,0,224,2,100,100,600,glave wurm,glave wurm,6.67,67,21745,40
+obj,mutalisk,0x5,4,4,120,0,224,2,100,100,600,glave wurm,glave wurm,6.67,67,21745,40
 obj,control,0x8,16,12,1500,1,1,10,400,0,1800,,,0,0,0,0
 obj,hatchery,0x8,16,12,1250,1,1,10,300,0,1800,,,0,0,0,0
 # spawn: objname, [obj..]
 spawn,control,scv
-spawn,hatchery,drone,mutalid
+spawn,hatchery,drone,mutalisk
 # spr: objname, flags (PF enum), rotations, [frame..]
 spr,scv,0x2,17,0
 spr,scv,0xc002,17,0
@@ -25,7 +25,7 @@
 spr,drone,0xc004,17,0,1,2,3,4
 spr,hatchery,2,1,0,1,2,3,3,2,1,0
 spr,hatchery,0xc002,1,0,0,0,0,0,0,0,0
-spr,mutalid,0x2,17,0,1,2,3,4
-spr,mutalid,0xc002,17,0,1,2,3,4
-spr,mutalid,0x4,17,0,1,2,3,4
-spr,mutalid,0xc004,17,0,1,2,3,4
+spr,mutalisk,0x2,17,0,1,2,3,4
+spr,mutalisk,0xc002,17,0,1,2,3,4
+spr,mutalisk,0x4,17,0,1,2,3,4
+spr,mutalisk,0xc004,17,0,1,2,3,4
--- a/utils/genspr
+++ b/utils/genspr
@@ -13,6 +13,12 @@
 zerg/hatchery\
 zerg/zhashad\
 thingy/tscglow\
+neutral/min01\
+neutral/min01Sha\
+neutral/min02\
+neutral/min02sha\
+neutral/min03\
+neutral/min03Sha\
 )^.grp /n/sce/
 pcx -9t tileset/badlands/ofire.pcx >/n/sce/ofire.bit
 cp tileset/badlands.^(wpe vr4 vx4) /n/sce/
@@ -39,9 +45,9 @@
 
 function unit17(u,	i, r, n, fi, fo, fs, gf, dim, rect, dx, dy){
 	n = split(units[u], a)
-	gf = u ".grp"
+	gf = a[1] ".grp"
 	split(pipe("grp -s " palfile " " gf), dim)
-	for(i=5; i<=n; i++){
+	for(i=6; i<=n; i++){
 		frm = a[i] * 17
 		for(r=0; r<17; r+=2){
 			fi = sprintf(gf ".%05d.bit", frm + r)
@@ -48,10 +54,10 @@
 			fo = sprintf(u ".%02d.%02d.bit", i-5, r)
 			fs = sprintf(u ".%02d.%02d.s.bit", i-5, r)
 			split(pipe("read -c 60 " fi), rect)
-			dx = rect[2] - (dim[1] / 2 - a[1])
-			dy = rect[3] - (dim[2] / 2 - a[2])
+			dx = rect[2] - (dim[1] / 2 - a[2])
+			dy = rect[3] - (dim[2] / 2 - a[3])
 			exec("scespr " fi " " fo " " dx " " dy)
-			exec("scesha " fi " " fs " " dx+a[3] " " dy+a[4] " " a[3] " " a[4])
+			exec("scesha " fi " " fs " " dx+a[4] " " dy+a[5] " " a[4] " " a[5])
 			if(r != 16){
 				exec("rotate -l " fi " | iconv -u >" tmp)
 				dx += dim[1] - rect[2] - rect[4]
@@ -58,7 +64,7 @@
 				fo = sprintf(u ".%02d.%02d.bit", i-5, 31-r)
 				fs = sprintf(u ".%02d.%02d.s.bit", i-5, 31-r)
 				exec("scespr " tmp " " fo " " dx " " dy)
-				exec("scesha " tmp " " fs " " dx+a[3] " " dy+a[4] " " a[3] " " a[4])
+				exec("scesha " tmp " " fs " " dx+a[4] " " dy+a[5] " " a[4] " " a[5])
 			}
 		}
 	}
@@ -90,15 +96,15 @@
 
 function build(u,	i, r, n, fi, fo, gf, dim, rect, dx, dy){
 	n = split(builds[u], a)
-	gf = u ".grp"
+	gf = a[1] ".grp"
 	split(pipe("grp -s " palfile " " gf), dim)
-	for(i=3; i<=n; i++){
+	for(i=4; i<=n; i++){
 		frm = a[i]
 		fi = sprintf(gf ".%05d.bit", frm)
 		fo = sprintf(u ".%02d.00.bit", i-3)
 		split(pipe("read -c 60 " fi), rect)
-		dx = rect[2] - ((dim[1] / 2 - a[1]) >= 32 ? 32 : 0)
-		dy = rect[3] - ((dim[2] / 2 - a[2]) >= 32 ? 32 : 0)
+		dx = rect[2] - ((dim[1] / 2 - a[2]) >= 32 ? 32 : 0)
+		dy = rect[3] - ((dim[2] / 2 - a[3]) >= 32 ? 32 : 0)
 		exec("scespr " fi " " fo " " dx " " dy)
 	}
 	exec("rm -f " tmp " " gf "*")
@@ -138,14 +144,36 @@
 BEGIN{
 	palfile = "SC_Unit_Palette.pal"
 	tmp = "derp"
-	units["scv"] = "11 11 0 7 0"
-	units["drone"] = "11 11 0 7 0 1 2 3 4"
-	units["mutalid"] = "22 22 0 42 0 1 2 3 4"
+	# width/2 height/2 shadx shady frm..
+	units["scv"] = "scv 11 11 0 7 0"
+	units["drone"] = "drone 11 11 0 7 0 1 2 3 4"
+	units["mutalisk"] = "mutalid 22 22 0 42 0 1 2 3 4"
+	# grp width/2 height/2 shadx shady frm..
 	glows["scv"] = "tscglow 11 11 0 1 2 3"
-	builds["control"] = "58 41 0"
-	builds["hatchery"] = "49 32 0 1 2 3"
+	# width/2 height/2 frm..
+	builds["control"] = "control 58 41 0"
+	builds["hatchery"] = "hatchery 49 32 0 1 2 3"
+	builds["mineral0h"] = "min01 32 16 0"
+	builds["mineral0m"] = "min01 32 16 1"
+	builds["mineral0l"] = "min01 32 16 2"
+	builds["mineral1h"] = "min02 32 16 0"
+	builds["mineral1m"] = "min02 32 16 1"
+	builds["mineral1l"] = "min02 32 16 2"
+	builds["mineral2h"] = "min03 32 16 0"
+	builds["mineral2m"] = "min03 32 16 1"
+	builds["mineral2l"] = "min03 32 16 2"
+	# grp width/2 height/2 frm..
 	shads["control"] = "tccShad 58 41 0"
 	shads["hatchery"] = "zhashad 49 32 0"
+	shads["mineral0h"] = "min01Sha 32 16 0"
+	shads["mineral0m"] = "min01Sha 32 16 1"
+	shads["mineral0l"] = "min01Sha 32 16 2"
+	shads["mineral1h"] = "min02sha 32 16 0"
+	shads["mineral1m"] = "min02sha 32 16 1"
+	shads["mineral1l"] = "min02sha 32 16 2"
+	shads["mineral2h"] = "min03Sha 32 16 0"
+	shads["mineral2m"] = "min03Sha 32 16 1"
+	shads["mineral2l"] = "min03Sha 32 16 2"
 	for(u in units)
 		unit17(u)
 	for(u in glows)