git » fp-git.git » commit 742f8e0

new step types

author ecalot
2004-11-06 02:05:57 UTC
committer ecalot
2004-11-06 02:05:57 UTC
parent e41299d22a4fd5acfd4bec872f17cb57b7e4cd34

new step types

FP/src/conf/awk/states_conf_static.awk +1 -1
FP/src/conf/states/main.conf +4 -4
FP/src/ker/states.c +28 -1

diff --git a/FP/src/conf/awk/states_conf_static.awk b/FP/src/conf/awk/states_conf_static.awk
index 0ae9d7c..5260f17 100644
--- a/FP/src/conf/awk/states_conf_static.awk
+++ b/FP/src/conf/awk/states_conf_static.awk
@@ -258,7 +258,7 @@ END {
 	for (i=0;i<currentAnimation;i++) {
 		flags=arrayAnimation[i,"flags"]
 		steps=arrayAnimation[i,"steps"]
-		if (flags!="") {
+		if (flags ~ /[a-z]+/) {
 			coma2=""
 			flagmask=""
 			for (j=1;j<=length(flags);j++) {
diff --git a/FP/src/conf/states/main.conf b/FP/src/conf/states/main.conf
index 09acb81..03a7fe1 100644
--- a/FP/src/conf/states/main.conf
+++ b/FP/src/conf/states/main.conf
@@ -125,7 +125,7 @@ normal:
 			relative 0
 		animation
 			15 p
-	action            Start walking
+	action            Walking a step
 		conditions
 			KeyShift               pressed
 			KeyForward             pressed
@@ -134,9 +134,9 @@ normal:
 		steps
 			relative 10
 		animation
-			134-135 p
-			136-142
-			143-145	p
+			134-135 p 1
+			136-142 2
+			143-145	p 1
 	action            Start running and crashing
 		conditions
 			KeyForward             pressed
diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index cb37ce9..a2990ca 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -144,6 +144,8 @@ int evaluateState(int state, tKey* key, tKid* kid, tRoom* room) {
 	return i;
 }
 
+#define alternate(i,n) (((i)%2)?(n-(((i)+1)>>1)):((i)>>1))
+
 /* This function should return the image frame and actions to be performed by this call
  * returns the animation number corresponding to this frame */
 short stateUpdate(tKey* key, tKid* kid,tRoom* room) {
@@ -180,9 +182,19 @@ short stateUpdate(tKey* key, tKid* kid,tRoom* room) {
 		printf("NEW STATE: action=%d next=%d\n",action,current->currentState);
 			/* Move the kid (turn+traslate) */
 		/* TODO: code absolutestepsforward and relativestepsforward*/
+	/*	switch(statesActionList[action].moveType) {
+		case STATES_MOVETYPES_ABSOLUTEONSTART:
+			break;
+		case STATES_MOVETYPES_ABSOLUTEONSTOP:
+			break;
+		case STATES_MOVETYPES_RELATIVETURN:
+			break;
+		case STATES_MOVETYPES_RELATIVE:
+			break;
+		}*/
 		if (kid->direction==DIR_LEFT) {
 			/*current->step=-current->step;*/
-			steps=-steps;
+			/*steps=-steps;*/
 			switch(statesActionList[action].moveType) {
 			case STATES_MOVETYPES_RELATIVE:
 				/*kid->location-=statesActionList[action].moveOffset;*/
@@ -212,7 +224,22 @@ short stateUpdate(tKey* key, tKid* kid,tRoom* room) {
 		current->acumLocation=kid->location;
 	}
 	/*current->acumLocation+=current->step;*/
+	steps=(kid->direction==DIR_LEFT)?steps:-steps;
 	kid->location+=steps; /*current->acumLocation;*/
+
+
+	{
+		int jj;
+		for (jj=0;jj<5;jj++) {
+
+			printf("%d=>",alternate(jj,10));
+			printf("%d ",alternate(jj,5));
+		}
+		printf("\n");
+	}
+
+
+	
 	if (current->currentState<0) return current->currentState; /* if last state return exit code */
 	return flags;
 }