git » fp-git.git » commit 06f2b9f

Finished loose tile falling system

author ecalot
2005-02-18 22:29:06 UTC
committer ecalot
2005-02-18 22:29:06 UTC
parent bea207140bc44a696c8b6892d02a06e7e976202a

Finished loose tile falling system

FP/src/conf/states/main.conf +1 -1
FP/src/conf/tiles.conf +5 -2
FP/src/include/states.h +1 -1
FP/src/ker/room.c +4 -7
FP/src/ker/states.c +3 -0
FP/src/res/maps.c +1 -1

diff --git a/FP/src/conf/states/main.conf b/FP/src/conf/states/main.conf
index 27a4129..354a00e 100644
--- a/FP/src/conf/states/main.conf
+++ b/FP/src/conf/states/main.conf
@@ -186,7 +186,7 @@ normal:
 			
 	action		 Falling for debug
 		conditions          #TODO: delete this action, is only for debug purposes
-			MapOn         space
+			MapNotOn         walkable
 		next
 			crouched
 		steps
diff --git a/FP/src/conf/tiles.conf b/FP/src/conf/tiles.conf
index f4db087..35018cf 100644
--- a/FP/src/conf/tiles.conf
+++ b/FP/src/conf/tiles.conf
@@ -61,10 +61,13 @@ tile POTION 10 potion
 walkable potion floor
 
 tile LOOSE 11 none
-#walkable only if it is not down
-floor@Danger@info->action!=eLosDown
+#it has floor and is walkable only if it is not down
+floor@Danger@info->action==eLosNormal
 walkable@Danger@info->action!=eLosDown
+
 loosemoving@Danger@info->action==eLosMoving
+loosenormal@Danger@info->action==eLosNormal
+chopper_spike
 
 tile TAPESTRY_TOP 12 ttop
 gateFrame
diff --git a/FP/src/include/states.h b/FP/src/include/states.h
index fb0f5b6..941c5e1 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,esMapUpForward,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,esMapNotOn}tsConditionType;
 
 								
 typedef enum {esDangerous,esNone,esWalk,esPotion,esSword,esMirror,esNotApplicable=0}tsTileType;
diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c
index 8f7203b..39fc6ef 100644
--- a/FP/src/ker/room.c
+++ b/FP/src/ker/room.c
@@ -127,6 +127,7 @@ tTile roomGetTile(tRoom* room,int x, int y) {
 #define spikeGetFrame(a)   (((tDanger*)a.moreInfo)->frame)
 #define looseGetFrame(a)   (((tDanger*)a.moreInfo)->frame)
 #define wallGetInfo(a)     (wallGet(env,cases,(a),seed))
+#define touchLoose(a)      (((tDanger*)a.moreInfo)->action=eLosMoving)
 
 /* door drawing */
 #define drawGateTop(x,y,frame) outputDrawBitmap(roomGfx.environment->pFrames[35-((frame)&7)],x,y)
@@ -525,8 +526,6 @@ int roomPress(tRoom* room, tObject* obj) {
 	 * returns 0 if the room didn't change, 1 if it did
 	 */
 
-	tMap* map=room->level;
-	int s=room->id;
 	int x=(obj->location/TILE_W)+1;
 	int y=obj->floor+1;
 	tTile tile=roomGetTile(room,x,y);
@@ -554,11 +553,9 @@ int roomPress(tRoom* room, tObject* obj) {
 #ifdef DEBUGROOM
 	printf("s=%d x=%d y=%d\n",s,x,y);
 #endif
-	if (isIn(tile,TILE_LOOSE)) {
-		map->fore[(s-1)*30+(x-1)+(y-1)*10]=TILE_EMPTY;
-		refresh=1; /* room changed, refresh it */
-	}
-
+  if (isIn(tile,TILES_LOOSENORMAL)) 
+		touchLoose(tile);
+	
 	/* spikes */
 	/* there are 7 possibilities to be */
 #define WHERE_NEAR 6
diff --git a/FP/src/ker/states.c b/FP/src/ker/states.c
index ac3d46f..7a5644c 100644
--- a/FP/src/ker/states.c
+++ b/FP/src/ker/states.c
@@ -146,6 +146,9 @@ int evaluateCondition(int condition,tKey* key, tObject* kid, tRoom* room) {
 	case esMapOn:
 		DefaultFalse(room);
 		statesCondRet(isIn(statesTile(0,0),c.argument));
+	case esMapNotOn:
+		DefaultFalse(room);
+		statesCondRet(!isIn(statesTile(0,0),c.argument));
 	case esForwardTileNearerThan:
 		DefaultFalse(kid);
 		statesCondRet((whereInTile<c.argument));
diff --git a/FP/src/res/maps.c b/FP/src/res/maps.c
index cd00d6d..18e2574 100644
--- a/FP/src/res/maps.c
+++ b/FP/src/res/maps.c
@@ -442,7 +442,7 @@ void  mapMove(tMap* map) {
 			if (!map->dangers[i].more.time) map->dangers[i].frame++;
 			break;
 		case eLosMoving:
-			if (map->dangers[i].frame) map->dangers[i].frame++;
+			map->dangers[i].frame++;
 			if (map->dangers[i].frame==11) map->dangers[i].action=eLosDown;
 			break;
 		default: