git » fp-git.git » commit bd1dd24

better states configuration

author ecalot
2004-10-23 02:02:59 UTC
committer ecalot
2004-10-23 02:02:59 UTC
parent 8fffd303b92439271c5a8e4834ca3525ca41d9b1

better states configuration

FP/src/conf/awk/states_conf_static.awk +27 -7
FP/src/conf/flags.conf +1 -0
FP/src/conf/states/main.conf +50 -0

diff --git a/FP/src/conf/awk/states_conf_static.awk b/FP/src/conf/awk/states_conf_static.awk
index f6ceccb..2a1650f 100644
--- a/FP/src/conf/awk/states_conf_static.awk
+++ b/FP/src/conf/awk/states_conf_static.awk
@@ -47,7 +47,7 @@ BEGIN {
 	}
 	close(tmp)
 	currentAnimation=0
-	latestLevel=-1
+	greatestLevel=-1
 	first=0
 }
 
@@ -96,12 +96,22 @@ BEGIN {
 					}
 				} else if (listType == "level") {
 					if (arrayLevel[$1]) {
-						printf("Parsing error in states.conf: Redeclaration of level '%d' in uncommented line %d.\n",$1,NR)>"/dev/stderr"
+						printf("Parsing error in states.conf: Redeclaration of level '%d' on line %d.\n",$1,NR)>"/dev/stderr"
 						exit 23
 					} else {
 						arrayLevel[$1]=currentAction+1
-						if ($1>latestLevel) {
-							latestLevel=$1
+						if ($1>greatestLevel) {
+							greatestLevel=$1
+						}
+					}
+				} else if (listType == "guardskill") {
+					if (arrayGuard[$1]) {
+						printf("Parsing error in states.conf: Redeclaration of guard skill '%d' on line %d.\n",$1,NR)>"/dev/stderr"
+						exit 25
+					} else {
+						arrayGuard[$1]=currentAction+1
+						if ($1>greatestSkill) {
+							greatestSkill=$1
 						}
 					}
 				}
@@ -220,15 +230,25 @@ END {
 
 	printf("\\\n}\n\n#define STATES_LEVELS {")
 	coma=""
-	for (i=0;i<=latestLevel;i++) {
+	for (i=0;i<=greatestLevel;i++) {
 		if (!arrayLevel[i]) {
-			printf("Parsing error in states.conf: Level number %d is defined but level %d is not.\n",latestLevel,i)>"/dev/stderr"
+			printf("Parsing error in states.conf: Level number %d is defined but level %d is not.\n",greatestLevel,i)>"/dev/stderr"
 			exit 24
 		}
 		printf "%s%s",coma,arrayLevel[i]-1
 		coma=","
 	}
-	printf("}\n")
+	printf("}\n\n#define STATES_GUARDS {")
+	coma=""
+	for (i=0;i<=greatestGuard;i++) {
+		if (!arrayGuard[i]) {
+			printf("Parsing error in states.conf: Guard skill %d is defined but skill %d is not.\n",greatestGuard,i)>"/dev/stderr"
+			exit 26
+		}
+		printf "%s%s",coma,arrayGuard[i]-1
+		coma=","
+	}
+printf("}\n")
 
 }
 
diff --git a/FP/src/conf/flags.conf b/FP/src/conf/flags.conf
index cc7c45d..2d8125f 100644
--- a/FP/src/conf/flags.conf
+++ b/FP/src/conf/flags.conf
@@ -5,3 +5,4 @@ n go down
 p press the floor
 c press the ceiling
 s make a sound
+g you hit the guard/kid
diff --git a/FP/src/conf/states/main.conf b/FP/src/conf/states/main.conf
index 12894dc..be87ba0 100644
--- a/FP/src/conf/states/main.conf
+++ b/FP/src/conf/states/main.conf
@@ -41,6 +41,15 @@ normal:
 			134-135 p
 			136-142
 			143-145	p
+	action            Start running
+		conditions
+			KeyForward             pressed
+		next
+			running
+		steps
+			relative 12
+		animation
+			1-4 p
 	action            Turn
 		conditions
 			KeyBack                pressed
@@ -73,7 +82,48 @@ normal:
 			relative 0
 		level
 			1
+		guardskill
+			0
+			1
 
+running:
+	action            Keep running
+		conditions
+			KeyForward             pressed
+		next
+			running
+		steps
+			relative 15
+		animation
+			5-14 p
+	action            Turn
+		conditions
+			KeyBack                pressed
+		next
+			normal
+		steps
+			relativeTurn 0
+		animation
+			65-77 p
+	action            Jump
+		conditions
+			KeyUp                  pressed
+			KeyForward             pressed
+		next
+			normal
+		animation
+			34-44 
+		steps
+			relative 20
+	action            Stop running
+		conditions
+			none
+		next
+			normal
+		steps
+			relative 15
+		animation
+			55-68 p
 
 oldnormal:
 	action                     Start walking when it is near a falling