git » fp-git.git » commit 970bace

abstracted the initial state and the initial level

author ecalot
2005-01-09 14:48:14 UTC
committer ecalot
2005-01-09 14:48:14 UTC
parent 22f35fe140a275e1bcfe764a71c3b331d7787b7d

abstracted the initial state and the initial level

FP/src/include/states.h +2 -1
FP/src/ker/states.c +8 -4

diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index 2a3b4bd..449b0e3 100644
--- a/FP/src/include/states.h
+++ b/FP/src/include/states.h
@@ -51,7 +51,8 @@ typedef struct {
 short stateUpdate(tKey* key, tKid* kid,tRoom* room);
 
 /* Create a State depending on the level */
-tState createState(int level);
+int stateKidInLevel(int level);
+tState createState(short stateId);
 
 #include "states_conf.h"
 
diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index d81faf4..8cef3ae 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -70,11 +70,15 @@ void stateGetAnimation(int action,tState *state/*short *frames,short** flags,flo
 }
 
 /* public functions interface */
-tState createState(int level) {
-	tState start;
+int stateKidInLevel(int level) {
 	static short statesLevelList[]=STATES_LEVELS;
-	stateGetAnimation(statesLevelList[level],&start);
-	start.currentState=statesActionList[statesLevelList[level]].nextStateId;
+	return statesLevelList[level];
+}
+
+tState createState(short stateId) {
+	tState start;
+	stateGetAnimation(stateId,&start);
+	start.currentState=statesActionList[stateId].nextStateId;
 	return start;
 }