git » fp-git.git » commit a284947

flags added to FP source

author ecalot
2004-10-20 19:42:08 UTC
committer ecalot
2004-10-20 19:42:08 UTC
parent 2c00b4e66a0ea89b0b38425456713a2cf7d4480b

flags added to FP source

FP/src/include/states.h +7 -2
FP/src/ker/states.c +8 -3

diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index bbfaf5b..8dab921 100644
--- a/FP/src/include/states.h
+++ b/FP/src/include/states.h
@@ -34,8 +34,13 @@ typedef struct { /* The state object: only struct that is not static to the stat
 } tState;
 
 /* public functions interface */
-/*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 */
+
+/* This function should return the image frame
+ * and actions to be performed by this call */
+int stateUpdate(tState* current,tKey* key, tKid* kid,tRoom* room,short* flags);
+
+/* Create a State depending on the level */
+tState createState(int level);
 
 #include "states_conf.h"
 
diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index 01c11af..18e3c08 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -14,8 +14,12 @@ short* stateGetAnimation(int action,short *frames) {
 	short* j=statesAnimationList+a->animStart;
 	/* TODO: depending on relative and absolute crop the middle frames */
 	*frames=i;
+	i<<=1;
 	result=(short*)malloc(sizeof(short)*i);
-	while (i--) result[i]=*(j++);
+	while (i) {
+		result[i--]=*(j++);
+		result[i--]=*(j++); /* result[i] is a flag and doesn't have to be evaluated */
+	}
 	return result;
 }
 
@@ -107,8 +111,9 @@ int evaluateState(int state, tKey* key, tKid* kid, tRoom* room) {
 
 /* This function should return the image frame and actions to be performed by this call
  * returns the animation number corresponding to this frame */
-int stateUpdate(tState* current,tKey* key, tKid* kid,tRoom* room) {
-	int imageFrame=statesAnimationList[current->animation[current->frame]];
+int stateUpdate(tState* current,tKey* key, tKid* kid,tRoom* room,short* flags) {
+	int imageFrame=statesAnimationList[current->animation[(current->frame<<1)+0]];
+	*flags        =statesAnimationList[current->animation[(current->frame<<1)+1]];
 	if (current->frame) {
 		current->frame--;
 	} else {