author | ecalot
<ecalot> 2004-10-17 04:53:54 UTC |
committer | ecalot
<ecalot> 2004-10-17 04:53:54 UTC |
parent | f6c1e4972663690364fb450f8f7156d747684658 |
FP/src/include/states.h | +2 | -1 |
FP/src/include/states_conf.h | +2 | -2 |
FP/src/ker/states.c | +18 | -16 |
diff --git a/FP/src/include/states.h b/FP/src/include/states.h index 5974e8d..9cb3bf4 100644 --- a/FP/src/include/states.h +++ b/FP/src/include/states.h @@ -3,7 +3,8 @@ /* Structs */ -#include "types.h" +#include "types.h" /* tMap */ +#include "input.h" /* tKey */ typedef enum {esKeyUp,esKeyDown,esKeyForward,esKeyBack,esShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esInScreen,esInLevel,esForwardChangeToScreen,esLast=0}tsConditionType; diff --git a/FP/src/include/states_conf.h b/FP/src/include/states_conf.h index e0a9624..40b0641 100644 --- a/FP/src/include/states_conf.h +++ b/FP/src/include/states_conf.h @@ -7,10 +7,10 @@ #ifndef _STATES_CONF_ #define _STATES_CONF_ -/* state/action, animation and condition lists */ -#include "states_conf_static.h" /* condition properties */ #include "states_conf_properties.h" +/* state/action, animation and condition lists */ +#include "states_conf_static.h" #endif diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c index b64348d..cfdbf1f 100644 --- a/FP/src/ker/states.c +++ b/FP/src/ker/states.c @@ -4,6 +4,8 @@ short* stateGetAnimation(int action,short* frames); static tsAction statesActionList[]=STATES_ACTIONS; +static short statesAnimationList[]=STATES_ANIMATIONS; +static short statesConditionList[]=STATES_CONDITIONS; /* public functions interface */ tState createState(int level) { @@ -14,23 +16,8 @@ tState createState(int level) { return start; } -/* 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,tMap* map) { - int imageFrame=statesAnimationList[current->animation[frame]]; - if (frame) { - current->frame--; - } else { - int action; - /* free(current->animation) */ - action=evaluateState(current->currentState,key,map); - current->animation=stateGetAnimation(action,&(current->frame)); - current->currentState=statesActionList[action].nextStateId; - } -} +/* private functions */ -/* privates */ /* Evaluates a condition indexed in the condition table */ int evaluateCondition(int condition,tKey* key,tMap* map) { tsCondition c=statesConditionList[condition]; @@ -74,4 +61,19 @@ int evaluateState(int state, tKey* key, tMap* map) { return i; } +/* 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,tMap* map) { + int imageFrame=statesAnimationList[current->animation[current->frame]]; + if (current->frame) { + current->frame--; + } else { + int action; + /* free(current->animation) */ + action=evaluateState(current->currentState,key,map); + current->animation=stateGetAnimation(action,&(current->frame)); + current->currentState=statesActionList[action].nextStateId; + } +} +