git » fp-git.git » commit 2c00b4e

animation frame flags

author ecalot
2004-10-20 18:47:32 UTC
committer ecalot
2004-10-20 18:47:32 UTC
parent 3e88ef40673af1ce9307211d53e9edb97350dcc6

animation frame flags

FP/src/Makefile +12 -7
FP/src/conf/awk/states_conf_flags.awk +42 -0
FP/src/conf/awk/states_conf_static.awk +17 -3
FP/src/conf/flags.conf +7 -0
FP/src/conf/states/main.conf +4 -2
FP/src/include/.cvsignore +1 -1
FP/src/include/states.h +1 -1
FP/src/include/states_conf.h +2 -0

diff --git a/FP/src/Makefile b/FP/src/Makefile
index 66d3666..88e598e 100644
--- a/FP/src/Makefile
+++ b/FP/src/Makefile
@@ -55,7 +55,8 @@ EXEFILE       = bin/freeprince
 GENERATEDRESHEADERS = include/res_conf_parts.h include/res_conf_files.h\
                       include/res_conf_types.h include/res_conf_mods.h\
                       include/res_conf_resources.h
-GENERATEDSTAHEADERS = include/states_conf_static.h include/states_conf_properties.h
+GENERATEDSTAHEADERS = include/states_conf_static.h include/states_conf_properties.h\
+                      include/states_conf_flags.h
 
 GENERATEDTILHEADERS = include/tiles_conf_types.h include/tiles_conf_groups.h
 
@@ -192,23 +193,23 @@ include/res_conf.h: $(GENERATEDRESHEADERS)
 
 include/res_conf_parts.h: conf/parts.conf conf/awk/res_conf_parts.awk
 	$(INFO) Creating resource id parts configuration file...
-	$(AWK) -f conf/awk/res_conf_parts.awk  conf/parts.conf>include/res_conf_parts.h
+	$(AWK) -f conf/awk/res_conf_parts.awk conf/parts.conf>include/res_conf_parts.h
 
 include/res_conf_files.h: conf/files.conf conf/awk/res_conf_files.awk
 	$(INFO) Creating resource dat files list configuration file...
-	$(AWK) -f conf/awk/res_conf_files.awk  conf/files.conf>include/res_conf_files.h
+	$(AWK) -f conf/awk/res_conf_files.awk conf/files.conf>include/res_conf_files.h
 
 include/res_conf_types.h: conf/types.conf conf/awk/res_conf_types.awk
 	$(INFO) Creating resource types configuration file...
-	$(AWK) -f conf/awk/res_conf_types.awk  conf/types.conf>include/res_conf_types.h
+	$(AWK) -f conf/awk/res_conf_types.awk conf/types.conf>include/res_conf_types.h
 
 include/res_conf_mods.h: conf/mods.conf conf/awk/res_conf_mods.awk
 	$(INFO) Creating resource modifiers configuration file...
-	$(AWK) -f conf/awk/res_conf_mods.awk  conf/mods.conf>include/res_conf_mods.h
+	$(AWK) -f conf/awk/res_conf_mods.awk conf/mods.conf>include/res_conf_mods.h
 
 include/res_conf_resources.h: conf/resources.conf conf/awk/res_conf_resources.awk
 	$(INFO) Creating resource list configuration file...
-	$(AWK) -f conf/awk/res_conf_resources.awk  conf/resources.conf>include/res_conf_resources.h
+	$(AWK) -f conf/awk/res_conf_resources.awk conf/resources.conf>include/res_conf_resources.h
 
 include/states_conf.h: $(GENERATEDSTAHEADERS)
 
@@ -218,7 +219,11 @@ include/states_conf_static.h: conf/states.conf conf/awk/states_conf_static.awk
 
 include/states_conf_properties.h: conf/statesproperties.conf conf/awk/states_conf_properties.awk
 	$(INFO) Creating states condition properties configuration file...
-	$(AWK) -f conf/awk/states_conf_properties.awk  conf/statesproperties.conf>include/states_conf_properties.h
+	$(AWK) -f conf/awk/states_conf_properties.awk conf/statesproperties.conf>include/states_conf_properties.h
+
+include/states_conf_flags.h: conf/flags.conf conf/awk/states_conf_flags.awk
+	$(INFO) Creating states frame flags configuration file...
+	$(AWK) -f conf/awk/states_conf_flags.awk conf/flags.conf>include/states_conf_flags.h
 
 include/tiles_conf.h: $(GENERATEDTILHEADERS)
 
diff --git a/FP/src/conf/awk/states_conf_flags.awk b/FP/src/conf/awk/states_conf_flags.awk
new file mode 100644
index 0000000..c945aae
--- /dev/null
+++ b/FP/src/conf/awk/states_conf_flags.awk
@@ -0,0 +1,42 @@
+#   Princed V3 - Prince of Persia Level Editor for PC Version
+#   Copyright (C) 2003 Princed Development Team
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#   The authors of this program may be contacted at http://forum.princed.com.ar
+
+# states_conf_flags.awk: FreePrince : flags.conf parser
+# \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf
+# Copyright 2004, 2003 Princed Development Team
+#  Created: 20 Oct 2004
+#
+#  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+#
+# Note:
+#  DO NOT remove this copyright notice
+#
+
+BEGIN {
+	k=0
+}
+
+
+/^([ ]*[^# ].*)$/ {
+	f=toupper($1)
+	$1=""
+	printf("/*%s */\n#define STATES_FLAG_%s (1<<%d)\n\n",$0,f,k)
+	k++
+}
+
diff --git a/FP/src/conf/awk/states_conf_static.awk b/FP/src/conf/awk/states_conf_static.awk
index e426048..2a73192 100644
--- a/FP/src/conf/awk/states_conf_static.awk
+++ b/FP/src/conf/awk/states_conf_static.awk
@@ -84,11 +84,13 @@ BEGIN {
 					if (match($1,/^[0-9]+-[0-9]*$/)) {
 						split($1,a,"-")
 						for (g=a[1];g<=a[2];g++) {
-							arrayAnimation[currentAnimation]=g
+							arrayAnimation[currentAnimation,"frame"]=g
+							arrayAnimation[currentAnimation,"flags"]=""
 							currentAnimation++
 						}
 					} else {
-						arrayAnimation[currentAnimation]=$1
+						arrayAnimation[currentAnimation,"frame"]=$1
+						arrayAnimation[currentAnimation,"flags"]=$2
 						currentAnimation++
 					}
 				} else if (listType == "level") {
@@ -198,7 +200,19 @@ END {
 	printf("}\n\n#define STATES_ANIMATIONS {\\\n\t")
 	coma=""
 	for (i=0;i<currentAnimation;i++) {
-		printf "%s%d",coma,arrayAnimation[i]
+		flags=arrayAnimation[i,"flags"]
+		if (flags!="") {
+			coma2=""
+			flagmask=""
+			for (j=1;j<=length(flags);j++) {
+				c=substr(flags,j,j+1)
+				flagmask=sprintf("%s%sSTATES_FLAG_%s",flagmask,coma2,toupper(c))
+				coma2="|"
+			}
+		} else {
+			flagmask="0"
+		}
+		printf "%s%d,%s",coma,arrayAnimation[i,"frame"],flagmask
 		if (i%10==9) printf("\\\n\t")
 		coma=","
 	}
diff --git a/FP/src/conf/flags.conf b/FP/src/conf/flags.conf
new file mode 100644
index 0000000..cc7c45d
--- /dev/null
+++ b/FP/src/conf/flags.conf
@@ -0,0 +1,7 @@
+u go up a screen
+h go left
+j go right
+n go down
+p press the floor
+c press the ceiling
+s make a sound
diff --git a/FP/src/conf/states/main.conf b/FP/src/conf/states/main.conf
index 5110890..a661f85 100644
--- a/FP/src/conf/states/main.conf
+++ b/FP/src/conf/states/main.conf
@@ -69,7 +69,9 @@ normal:
 		next
 			falling
 		animation
-			20-30
+			20-25
+			26 c
+			27-30
 		steps
 			absoluteForward 0
 		level
@@ -82,7 +84,7 @@ normal:
 		next
 			normal
 		animation
-			11
+			11 p
 		steps
 			relative 0
 
diff --git a/FP/src/include/.cvsignore b/FP/src/include/.cvsignore
index 4ad29d5..ab615d8 100644
--- a/FP/src/include/.cvsignore
+++ b/FP/src/include/.cvsignore
@@ -5,6 +5,6 @@ res_conf_mods.h
 res_conf_resources.h
 states_conf_static.h
 states_conf_properties.h
+states_conf_flags.h
 tiles_conf_types.h
 tiles_conf_groups.h
-
diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index 9a20547..bbfaf5b 100644
--- a/FP/src/include/states.h
+++ b/FP/src/include/states.h
@@ -6,7 +6,7 @@
 #include "types.h" /* tMap */
 #include "input.h" /* tKey */
 
-typedef enum {esLast=0,esKeyUp,esKeyDown,esKeyForward,esKeyBack,esKeyShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esInScreen,esInLevel,esForwardChangeToScreen}tsConditionType;
+typedef enum {esLast=0,esKeyUp,esKeyDown,esKeyForward,esKeyBack,esKeyShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esScreenUp,esScreenDown,esScreenLeft,esScreenRight,esInScreen,esInLevel,esForwardChangeToScreen,esInFloorTop,esInfloorMiddle,esInfloorBottom}tsConditionType;
 
 
 typedef enum {esDangerous,esNone,esWalk,esPotion,esSword,esMirror,esNotApplicable=0}tsTileType;
diff --git a/FP/src/include/states_conf.h b/FP/src/include/states_conf.h
index 40b0641..c62042c 100644
--- a/FP/src/include/states_conf.h
+++ b/FP/src/include/states_conf.h
@@ -7,6 +7,8 @@
 #ifndef _STATES_CONF_
 #define _STATES_CONF_
 
+/* animation frame flag options */
+#include "states_conf_flags.h"
 /* condition properties */
 #include "states_conf_properties.h"
 /* state/action, animation and condition lists */