git » fp-git.git » commit 7da43f4

States improved

author ecalot
2004-10-16 02:48:23 UTC
committer ecalot
2004-10-16 02:48:23 UTC
parent 73d4a551dcdad81cf8bd1152eefd02f68294f291

States improved

FP/src/Makefile +7 -2
FP/src/conf/states/main.conf +2 -2
FP/src/include/states.h +7 -7

diff --git a/FP/src/Makefile b/FP/src/Makefile
index fe7a204..daa5716 100644
--- a/FP/src/Makefile
+++ b/FP/src/Makefile
@@ -50,12 +50,13 @@ LINKERRELEASE =
 #Binary code files
 OBJFILES      = main.o kernel.o resources.o dat.o disk.o compress.o \
                 output.o maps.o config.o room.o titles.o \
-								input.o kid.o
+                input.o kid.o
 EXEFILE       = bin/freeprince
 
 GENERATEDHEADERS = 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 include/states_static.h
+                   include/res_conf_resources.h include/states_static.h\
+                   include/states_properties.h
 
 #Use this to temporary remove an option
 OPTIONS       = $(INCLUDE) $(DEFINES) $(RELEASE)
@@ -178,3 +179,7 @@ include/states_static.h: conf/states.conf conf/awk/states_static.awk
 	$(INFO) Creating states list configuration file...
 	$(GREP) conf/states.conf|sed -e 's/^\t\t\t/- - - /g' -e 's/^\t\t/- - /g' -e 's/^\t/- /g' -e 's/:$$//g'|$(AWK) -f conf/awk/states_static.awk>include/states_static.h
 
+include/states_properties.h: conf/statesproperties.conf conf/awk/states_properties.awk
+	$(INFO) Creating states properties configuration file...
+	$(GREP) conf/statesproperties.conf|$(AWK) -f conf/awk/states_properties.awk >include/states_properties.h:
+
diff --git a/FP/src/conf/states/main.conf b/FP/src/conf/states/main.conf
index 8244223..2ea47d9 100644
--- a/FP/src/conf/states/main.conf
+++ b/FP/src/conf/states/main.conf
@@ -3,8 +3,8 @@ normal:
 	action                     Start walking when it is near a falling
 		conditions
 			ForwardTile            careful       #includes: empty and loose tiles
-			ForwardTileFarThan     0
-			ForwardTileNearerrThan 10
+			ForwardTileFartherThan 0
+			ForwardTileNearerThan  10
 			KeyForward             pressed
 			KeyShift               pressed
 		next
diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index 39beacd..d1ff817 100644
--- a/FP/src/include/states.h
+++ b/FP/src/include/states.h
@@ -21,7 +21,7 @@ tsAction stateGetAction(tsCondition condition);
 struct tState { /* The state object: only struct that is not static to the state class */
 	int frame; /* when zero, animation is released and the next state is taken */
 	void** animation;
-	tsState* currentState;
+	tsAction* currentState;
 }
 
 /* public functions interface */
@@ -34,11 +34,11 @@ void updateState(tState* current,tKid* kid,tMap* map,tKey* key); /* This functio
 tsAction createInitialState(tKid* kid,tMap* map); 
 tsAction evaluateState(tState* current,tKid* kid,tMap* map); 
 
-typedef enum {esKeyUp,esKeyDown,esKeyForward,esKeyBack,esShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapIn,esForwardTileNearerThan,esForwardTileFarThan,esInScreen,esInLevel,esForwardChangeToScreen,esLast=0}tsConditionType;
+typedef enum {esKeyUp,esKeyDown,esKeyForward,esKeyBack,esShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esInScreen,esInLevel,esForwardChangeToScreen,esLast=0}tsConditionType;
 
 
 typedef enum {esDangerous,esNone,esWalk,esPotion,esSword,esMirror,esNotApplicable=0}tsTileType;
-typedef enum {esRelative,esForwardTile}tsMoveOffset;
+typedef enum {esRelative,esForwardTile}tsMoveType; /*  */
 
 struct tsCondition {
 	tsConditionType type;
@@ -51,10 +51,10 @@ struct tsCondition {
 }
 
 struct tsAction {
-	short tsConditionPointer;
-	tsMoveOffset moveOffset;
-	char	moveUnits;
-	short tsStatePointer;
+	short        tsConditionId; /* Id of the first condition to be evaluated */
+	tsMoveType   moveType; /* absolute or relative */
+	char         moveOffset; /* amount of moving units the kid will move depending on the offset type */
+	short        tsNextStateId; /* Id of the first action of the next state */
 }