git » fp-git.git » commit 932c90b

floor changing

author ecalot
2004-10-27 06:45:29 UTC
committer ecalot
2004-10-27 06:45:29 UTC
parent 817a2a44c634caec546320a5bdf6a300f8b1f87a

floor changing

FP/src/conf/flags.conf +1 -0
FP/src/conf/states/main.conf +23 -0
FP/src/include/states.h +1 -1
FP/src/ker/kid.c +3 -0
FP/src/ker/object.c +3 -0
FP/src/ker/states.c +4 -0

diff --git a/FP/src/conf/flags.conf b/FP/src/conf/flags.conf
index f41d926..dfc204c 100644
--- a/FP/src/conf/flags.conf
+++ b/FP/src/conf/flags.conf
@@ -7,3 +7,4 @@ c press the ceiling
 s make a sound
 g you hit the guard/kid
 f fall down
+u go up one floor
diff --git a/FP/src/conf/states/main.conf b/FP/src/conf/states/main.conf
index 7a2db5f..4a4e0eb 100644
--- a/FP/src/conf/states/main.conf
+++ b/FP/src/conf/states/main.conf
@@ -51,6 +51,19 @@ normal:
 			53-64
 		steps
 			relative 0
+	action            Climb up
+		conditions
+			KeyUp                  pressed
+			MapUp                  space
+			MapUpForward           walkable
+		next
+			normal
+		animation
+			81-93 
+			96-98
+			99 u
+		steps
+			relative 5 #use absolute forward
 	action            Jump up with free space up
 		conditions
 			KeyUp                  pressed
@@ -111,6 +124,16 @@ normal:
 			relative 0
 		animation
 			118-120 p
+			
+	action		 Falling for debug
+		conditions          #TODO: delete this action, is only for debug purposes
+			MapOn         space
+		next
+			crouched
+		steps
+			relative 0
+		animation
+			15 f
 
 	action            If there aren't more actions then the normal state is kept
 		conditions
diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index b344ad1..c4c619a 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 {esLast=0,esKeyUp,esKeyDown,esKeyForward,esKeyBack,esKeyShift,esMapUp,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esScreenUp,esScreenDown,esScreenLeft,esScreenRight,esInScreen,esInLevel,esForwardChangeToScreen,esInFloorTop,esInfloorMiddle,esInfloorBottom}tsConditionType;
+typedef enum {esLast=0,esKeyUp,esKeyDown,esKeyForward,esKeyBack,esKeyShift,esMapUp,esMapUpForward,esMapDown,esMapForward,esMapBack,esMapOn,esForwardTileNearerThan,esForwardTileFartherThan,esScreenUp,esScreenDown,esScreenLeft,esScreenRight,esInScreen,esInLevel,esForwardChangeToScreen,esInFloorTop,esInfloorMiddle,esInfloorBottom}tsConditionType;
 
 								
 typedef enum {esDangerous,esNone,esWalk,esPotion,esSword,esMirror,esNotApplicable=0}tsTileType;
diff --git a/FP/src/ker/kid.c b/FP/src/ker/kid.c
index 6645563..f432c9b 100644
--- a/FP/src/ker/kid.c
+++ b/FP/src/ker/kid.c
@@ -141,6 +141,7 @@ void kidDraw(tKid kid) {
 
 int kidMove(tKid* kid,tKey key,tRoom* room) {
 #ifdef NEW_KERNEL
+	/* advance state and get the flag, then interpret the flag and do the events */
 	short flags;
 	flags=stateUpdate(&key,kid,room);
 	if (flags&STATES_FLAG_P)
@@ -153,6 +154,8 @@ int kidMove(tKid* kid,tKey key,tRoom* room) {
 		);
 	if (flags&STATES_FLAG_F)
 		kid->floor++;
+	if (flags&STATES_FLAG_U)
+		kid->floor--;
 	return flags;
 #else
 	int result;
diff --git a/FP/src/ker/object.c b/FP/src/ker/object.c
index 6645563..f432c9b 100644
--- a/FP/src/ker/object.c
+++ b/FP/src/ker/object.c
@@ -141,6 +141,7 @@ void kidDraw(tKid kid) {
 
 int kidMove(tKid* kid,tKey key,tRoom* room) {
 #ifdef NEW_KERNEL
+	/* advance state and get the flag, then interpret the flag and do the events */
 	short flags;
 	flags=stateUpdate(&key,kid,room);
 	if (flags&STATES_FLAG_P)
@@ -153,6 +154,8 @@ int kidMove(tKid* kid,tKey key,tRoom* room) {
 		);
 	if (flags&STATES_FLAG_F)
 		kid->floor++;
+	if (flags&STATES_FLAG_U)
+		kid->floor--;
 	return flags;
 #else
 	int result;
diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index 0bd534e..daaabde 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -74,6 +74,10 @@ int evaluateCondition(int condition,tKey* key, tKid* kid, tRoom* room) {
 		DefaultFalse(key);
 		return inputGetShift(key->status)?
 			STATES_CONDRESULT_TRUE:STATES_CONDRESULT_FALSE;
+	case esMapUpForward:
+		DefaultFalse(room);
+		return isInGroup(room->fore[thisTile-12+((kid->direction==DIR_LEFT)?-1:1)],room->back[thisTile-12+((kid->direction==DIR_LEFT)?-1:1)],c.argument)?
+			STATES_CONDRESULT_TRUE:STATES_CONDRESULT_FALSE;
 	case esMapUp:
 		DefaultFalse(room);
 		return isInGroup(room->fore[thisTile-12],room->back[thisTile-12],c.argument)?