author | ecalot
<ecalot> 2004-10-17 05:18:54 UTC |
committer | ecalot
<ecalot> 2004-10-17 05:18:54 UTC |
parent | b2cefa03007a799e7e3d5db58428c5d227002480 |
FP/src/conf/awk/states_conf_static.awk | +2 | -2 |
FP/src/conf/states/main.conf | +5 | -5 |
FP/src/include/states.h | +4 | -3 |
FP/src/ker/states.c | +2 | -2 |
diff --git a/FP/src/conf/awk/states_conf_static.awk b/FP/src/conf/awk/states_conf_static.awk index a4eaa86..c72cfba 100644 --- a/FP/src/conf/awk/states_conf_static.awk +++ b/FP/src/conf/awk/states_conf_static.awk @@ -32,7 +32,7 @@ BEGIN { if (oldType != listType ) { oldType=listType currentCondition++ - printf("\t{esTrue,0}, /* condition number %d */\\\n",currentCondition) + printf("\t{esLast,0}, /* condition number %d */\\\n",currentCondition) conditions=currentCondition+1 } currentCondition++ @@ -120,7 +120,7 @@ END { actionArray[currentAction,"moveType"]=moveType actionArray[currentAction,"moveOffset"]=moveOffset actionArray[currentAction,"lastComma"]="" - printf("\t{esTrue,0} /* the end */\\\n}\n\n#define STATES_ACTIONS {\\\n") + printf("\t{esLast,0} /* the end */\\\n}\n\n#define STATES_ACTIONS {\\\n") for (i=0;i<=currentAction;i++) { nextStateId=stateList[actionArray[i,"nextState"]] diff --git a/FP/src/conf/states/main.conf b/FP/src/conf/states/main.conf index 56070d3..a26323f 100644 --- a/FP/src/conf/states/main.conf +++ b/FP/src/conf/states/main.conf @@ -1,7 +1,7 @@ #states tree normal: action Start walking when it is near a falling - conditions + conditions # Note that conditions are case sensitive!!! ForwardTile careful #includes: empty and loose tiles ForwardTileFartherThan 0 ForwardTileNearerThan 10 @@ -21,8 +21,8 @@ normal: action Start walking on normal floor conditions ForwardTile walkable - keyForward pressed - keyShift pressed + KeyForward pressed + KeyShift pressed next normal animation @@ -33,8 +33,8 @@ normal: action Start running and falling conditions ForwardTile empty #includes: empty and loose tiles - ForwardTileFarThan 0 - ForwardTileNearerrThan 20 + ForwardTileFartherThan 0 + ForwardTileNearerThan 20 KeyForward pressed KeyShift notPressed next diff --git a/FP/src/include/states.h b/FP/src/include/states.h index 9cb3bf4..ab561d7 100644 --- a/FP/src/include/states.h +++ b/FP/src/include/states.h @@ -6,7 +6,7 @@ #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; +typedef enum {esLast=0,esKeyUp,esKeyDown,esKeyForward,esKeyBack,esKeyShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esInScreen,esInLevel,esForwardChangeToScreen}tsConditionType; typedef enum {esDangerous,esNone,esWalk,esPotion,esSword,esMirror,esNotApplicable=0}tsTileType; @@ -37,10 +37,11 @@ typedef struct { /* The state object: only struct that is not static to the stat /*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" +#define STATES_CONDRESULT_FALSE 2 +#define STATES_CONDRESULT_END 1 +#define STATES_CONDRESULT_TRUE 0 #endif diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c index cfdbf1f..c2acaf2 100644 --- a/FP/src/ker/states.c +++ b/FP/src/ker/states.c @@ -5,7 +5,7 @@ short* stateGetAnimation(int action,short* frames); static tsAction statesActionList[]=STATES_ACTIONS; static short statesAnimationList[]=STATES_ANIMATIONS; -static short statesConditionList[]=STATES_CONDITIONS; +static tsCondition statesConditionList[]=STATES_CONDITIONS; /* public functions interface */ tState createState(int level) { @@ -26,7 +26,7 @@ int evaluateCondition(int condition,tKey* key,tMap* map) { case esKeyDown: case esKeyForward: case esKeyBack: - case esShift: + case esKeyShift: case esMapUp: case esMapDown: case esMapForward: