git » fp-git.git » commit b8b0be8

fixed some syntax in states module

author ecalot
2004-10-17 00:12:00 UTC
committer ecalot
2004-10-17 00:12:00 UTC
parent ec0857cd3d2fdcc0cf1a8a853f2b19d7fc2e6942

fixed some syntax in states module

FP/src/Makefile +4 -0
FP/src/conf/awk/states_conf_static.awk +3 -3
FP/src/include/states.h +26 -43
FP/src/ker/states.c +0 -4

diff --git a/FP/src/Makefile b/FP/src/Makefile
index f0baf4e..ab0908c 100644
--- a/FP/src/Makefile
+++ b/FP/src/Makefile
@@ -180,6 +180,10 @@ config.o: res/config.c include/resources.h include/res_conf.h
 	$(INFO) Compiling resource configuration module...
 	$(CC) -c res/config.c $(OPTIONS)
 
+states.o: ker/states.c include/states.h include/states_conf.h
+	$(INFO) Compiling kernel states module...
+	$(CC) -c ker/states.c $(OPTIONS)
+
 #AWK scripts: header generation
 include/res_conf.h: $(GENERATEDRESHEADERS)
 
diff --git a/FP/src/conf/awk/states_conf_static.awk b/FP/src/conf/awk/states_conf_static.awk
index 729b97f..be3ab8c 100644
--- a/FP/src/conf/awk/states_conf_static.awk
+++ b/FP/src/conf/awk/states_conf_static.awk
@@ -1,7 +1,7 @@
 BEGIN {
 	currentCondition=-1
 	currentAction=0
-	printf("#define STATES_CONDITIONS={\\\n");
+	printf("#define STATES_CONDITIONS {\\\n");
 	tmp="conf/statesproperties.conf"
 	while ((getline line < tmp) > 0) {
 		gsub(/[	 ]+/, "-",line)
@@ -107,7 +107,7 @@ function addLine(coma) {
 }
 
 END {
-	printf("\t{esTrue,0} /* the end */\\\n};\n\n#define STATES_ACTIONS={\\\n");
+	printf("\t{esTrue,0} /* the end */\\\n};\n\n#define STATES_ACTIONS {\\\n");
 	linkedState=currentState
 	addLine("")
 	for (i=0;i<=currentAction;i++) {
@@ -119,7 +119,7 @@ END {
 		if (!stateNumber) stateNumber=0
 		printf "%s%d /* %s */%s", substr(stateArray[i],0,replaceStart),stateNumber,line,substr(stateArray[i],11+replaceEnd+replaceStart)
 	}
-	printf("};\n\n#define STATES_ANIMATIONS={\\\n\t");
+	printf("};\n\n#define STATES_ANIMATIONS {\\\n\t");
 	coma=""
 	for (i=0;i<currentAnimation;i++) {
 		printf "%s%d",coma,arrayAnimation[i]
diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index 9dbe619..72e48ea 100644
--- a/FP/src/include/states.h
+++ b/FP/src/include/states.h
@@ -1,60 +1,43 @@
-/*
+#ifndef _STATES_H_
+#define _STATES_H_
 
-tsCondition stateGetCondition(tsState state, int number);
-* Returns a condition number "number" or NULL if there are no more conditions *
+/* Structs */
 
-tsConditionType stateGetConditionType(tsCondition condition);
-* returns condition type *
+#include "types.h"
 
-int stateEvaluateKeyCondition(tKey* keyState);
-int stateEvaluateMapCondition(tRoom* room,int x, int y);
- returns 0 if the condition if false for the current position or keys 
+typedef enum {esKeyUp,esKeyDown,esKeyForward,esKeyBack,esShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esInScreen,esInLevel,esForwardChangeToScreen,esLast=0}tsConditionType;
 
-tsAction stateGetAction(tsCondition condition);
- get the action related to the given condition to be performed in case that it is true */
 
-/* Start here */
+typedef enum {esDangerous,esNone,esWalk,esPotion,esSword,esMirror,esNotApplicable=0}tsTileType;
+typedef enum {esRelative,esForwardTile}tsMoveType; /*  */
+
+typedef struct {
+	tsConditionType type;
+	char	argument;
+} tsCondition;
+
+typedef struct {
+	short        conditionId; /* 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        nextStateId; /* Id of the first action of the next state */
+} tsAction;
 
 /* public object */
-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;
-	tsAction* currentState;
-}
+typedef struct { /* The state object: only struct that is not static to the state class */
+	short  frame; /* when zero, animation is released and the next state is taken */
+	short* animation;
+	short  currentState;
+} tState;
 
 /* public functions interface */
-tState* createState(tKid* kid,tMap* map);
-void updateState(tState* current,tKid* kid,tMap* map,tKey* key); /* This function should return the image frame
+/*void updateState(tState* current,tKid* kid,tMap* map,tKey* key); * This function should return the image frame
 																													and actions to be performed by this call */
 
 /* privates */
 
 #include "states_conf.h"
 
-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,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esInScreen,esInLevel,esForwardChangeToScreen,esLast=0}tsConditionType;
-
-
-typedef enum {esDangerous,esNone,esWalk,esPotion,esSword,esMirror,esNotApplicable=0}tsTileType;
-typedef enum {esRelative,esForwardTile}tsMoveType; /*  */
-
-struct tsCondition {
-	tsConditionType type;
-	union {
-		tsTileType tile;
-		char units; 
-		char screen; 
-		char level; 
-	}
-}
-
-struct tsAction {
-	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 */
-}
 
+#endif
 
diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index 6046571..58f11ad 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -1,9 +1,5 @@
 #include "states.h"
 
-void setNewState(tState* current,tsAction action) {
-
-}
-
 /* public functions interface */
 tState createState(int level) {
 	tState start;