git » fp-git.git » commit f7ab4ed

improved animation support

author ecalot
2005-01-09 14:49:13 UTC
committer ecalot
2005-01-09 14:49:13 UTC
parent 970baceb2452346b0d25eb29ae3db7ace6c49b73

improved animation support

FP/src/Makefile +4 -2
FP/src/conf/anims.conf +4 -4
FP/src/conf/awk/anims_conf.awk +8 -6
FP/src/conf/types.conf +1 -0
FP/src/include/anims.h +4 -3

diff --git a/FP/src/Makefile b/FP/src/Makefile
index b86989c..233d365 100644
--- a/FP/src/Makefile
+++ b/FP/src/Makefile
@@ -165,7 +165,8 @@ kid.o: ker/kid.c include/kid.h include/resources.h include/res_conf.h\
 	$(INFO) Compiling kernel kid object...
 	$(CC) -c ker/kid.c $(OPTIONS)
 
-titles.o: ker/titles.c include/resources.h include/res_conf.h
+titles.o: ker/titles.c include/resources.h include/res_conf.h\
+          include/anims_conf.h $(GENERATEDSTAHEADERS) $(GENERATEDRESHEADERS)
 	$(INFO) Compiling kernel titles module...
 	$(CC) -c ker/titles.c $(OPTIONS)
 
@@ -174,7 +175,8 @@ compress.o: res/compress.c include/compress.h include/memory.h \
 	$(INFO) Compiling resource compression module...
 	$(CC) -c res/compress.c $(OPTIONS)
 
-maps.o: res/maps.c include/maps.h include/map_defs.h include/tiles.h include/tiles_conf.h
+maps.o: res/maps.c include/maps.h include/map_defs.h include/tiles.h\
+        include/tiles_conf.h
 	$(INFO) Compiling resource map handling module...
 	$(CC) -c res/maps.c $(OPTIONS)
 
diff --git a/FP/src/conf/anims.conf b/FP/src/conf/anims.conf
index 8f65c33..bc4372a 100644
--- a/FP/src/conf/anims.conf
+++ b/FP/src/conf/anims.conf
@@ -5,10 +5,10 @@
 #be drawn over the state animation.
 
 ANIMATION presentation 1000
-	#frame type     res                 Layer  x  y
-	0      FIXEDIMG img_princess_room   bottom        #princess room
-	0      FIXEDIMG img_princess_bed    bottom 98 124 #bed
-	0      FIXEDIMG img_princess_pillar top    98 124 #pillar
+	#frame type     res                 Duration Layer  x  y
+	0      FIXEDIMG img_princess_room   infinite bottom        #princess room
+	0      FIXEDIMG img_princess_bed    infinite bottom 98 124 #bed
+	0      FIXEDIMG img_princess_pillar infinite top    98 124 #pillar
 	#frame type     res                 state
 	0      STATE    img_jaffar          jaffar
 	#frame type     res
diff --git a/FP/src/conf/awk/anims_conf.awk b/FP/src/conf/awk/anims_conf.awk
index 4289dbb..ff3c779 100644
--- a/FP/src/conf/awk/anims_conf.awk
+++ b/FP/src/conf/awk/anims_conf.awk
@@ -59,9 +59,11 @@ BEGIN {
 	totalfixedimg++
 	f["frame" totalfixedimg]=$1/1
 	f["res" totalfixedimg]=toupper($3)
-	f["layer" totalfixedimg]=toupper($4)
-	f["x" totalfixedimg]=$5/1
-	f["y" totalfixedimg]=$6/1
+	if (toupper($4)=="INFINITE") $4=0
+	f["duration" totalfixedimg]=$4/1
+	f["layer" totalfixedimg]=toupper($5)
+	f["x" totalfixedimg]=$6/1
+	f["y" totalfixedimg]=$7/1
 	animation["sizef" animcount]++
 	halt
 }
@@ -115,7 +117,7 @@ END {
 	coma=""
 	printf("#define ANIMS_FIXEDIMG {")
 	for (i=1;i<=totalfixedimg;i++) {
-		printf("%s\\\n\t{/*frame*/ (unsigned short)%d,/*res*/ (unsigned short)RES_%s, /*layer*/ (unsigned char)ANIMS_LAYERTYPE_%s, /*x,y*/ (unsigned short)%d,(unsigned short)%d}",coma,f["frame" i],f["res" i],f["layer" i],f["x" i],f["y" i])
+		printf("%s\\\n\t{/*frame*/ (unsigned short)%d,/*res*/ (unsigned long)RES_%s, /*layer*/ (unsigned char)ANIMS_LAYERTYPE_%s, /*x,y*/ (unsigned short)%d,(unsigned short)%d}",coma,f["frame" i],f["res" i],f["layer" i],f["x" i],f["y" i])
 		coma=","
 	}
 	printf("\\\n}\n\n")
@@ -124,7 +126,7 @@ END {
 	coma=""
 	printf("#define ANIMS_STATE {")
 	for (i=1;i<=totalstate;i++) {
-		printf("%s\\\n\t{/*frame*/ %d,/*res*/ RES_%s, /*state*/ STATE_MARKS_%s}",coma,t["frame" i],t["res" i],t["state" i])
+		printf("%s\\\n\t{/*frame*/ %d,/*res*/ (unsigned long)RES_%s, /*state*/ STATE_MARKS_%s}",coma,t["frame" i],t["res" i],t["state" i])
 		coma=","
 	}
 	printf("\\\n}\n\n")
@@ -133,7 +135,7 @@ END {
 	coma=""
 	printf("#define ANIMS_SOUND {")
 	for (i=1;i<=totalsound;i++) {
-		printf("%s\\\n\t{/*frame*/ %d,/*res*/ RES_%s, /*type*/ anims_enum_%s}",coma,o["frame" i],o["res" i],o["type" i])
+		printf("%s\\\n\t{/*frame*/ %d,/*res*/ (unsigned long)RES_%s, /*type*/ anims_enum_%s}",coma,o["frame" i],o["res" i],o["type" i])
 		coma=","
 	}
 	printf("\\\n}\n\n")
diff --git a/FP/src/conf/types.conf b/FP/src/conf/types.conf
index 1cee5fc..f5c5be9 100644
--- a/FP/src/conf/types.conf
+++ b/FP/src/conf/types.conf
@@ -2,3 +2,4 @@
 
 IMG
 LVL
+SND
diff --git a/FP/src/include/anims.h b/FP/src/include/anims.h
index 321a134..083d90c 100644
--- a/FP/src/include/anims.h
+++ b/FP/src/include/anims.h
@@ -40,21 +40,22 @@ anims.h: FreePrince : Animation functions
 /* table types */
 typedef struct {
 	unsigned short frame;
-	unsigned short res;
+	unsigned long res;
 	unsigned char layer;
+	unsigned short duration;
 	unsigned short x;
 	unsigned short y;
 } animFixedimg;
 
 typedef struct {
 	unsigned short frame;
-	unsigned short res;
+	unsigned long res;
 	unsigned short state;
 } animState;
 
 typedef struct {
 	unsigned short frame;
-	unsigned short res;
+	unsigned long res;
 	enum {anims_enum_midi,anims_enum_wav,anims_enum_speaker} type;
 } animSound;