git » fp-git.git » commit 9d340bf

added exit gate

author ecalot
2004-08-26 03:49:13 UTC
committer ecalot
2004-08-26 03:49:13 UTC
parent b413df789e0cc04127e7a11c90561768ec71d88a

added exit gate

FP/src/include/types.h +8 -0
FP/src/ker/room.c +1 -1
FP/src/res/maps.c +8 -4

diff --git a/FP/src/include/types.h b/FP/src/include/types.h
index 4bfb09d..6a401a9 100644
--- a/FP/src/include/types.h
+++ b/FP/src/include/types.h
@@ -40,10 +40,13 @@ typedef unsigned char tTileId;
 typedef unsigned char tModId;
 
 typedef enum {eOpenTimer,eOpen,eClose,eClosing,eOpening,eClosingFast}tGateAction;
+typedef enum {eJustPressed,eNormal,ePressed,eStuck}tPressableAction;
+typedef enum {eNormalGate,eExitGate}tGateType;
 
 typedef struct {
 	int time;
 	int frame;
+	tGateType type;
 	tGateAction action;
 } tGate;
 
@@ -52,6 +55,11 @@ typedef struct {
 	int triggerNext;
 } tEvent;
 
+typedef struct {
+	tEvent* event;
+	tPressableAction action;
+} tPressable;
+
 typedef struct {
 	tRoomId        links[4*24];
 	unsigned char  fore [24*30];
diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c
index 4a94c2d..d73947b 100644
--- a/FP/src/ker/room.c
+++ b/FP/src/ker/room.c
@@ -246,7 +246,6 @@ void drawBackPanel(tRoom* room,int x, int y) {
 			(x-1)*TILE_W,
 			y*TILE_H+2
 		);
-		/*drawExit((x-2)*TILE_W+8,(y-1)*TILE_H-1,left.gateInfo->frame);*/
 	}
 	/* pillar/left */
 	if (left.hasPillar) {
@@ -381,6 +380,7 @@ void drawBackPanel(tRoom* room,int x, int y) {
 				(x-1)*TILE_W,
 				y*TILE_H
 			);
+			drawExit(x*TILE_W+8,(y-1)*TILE_H-1,tile.gateInfo->frame);
 		}
 	}
 	/* pillar/this */
diff --git a/FP/src/res/maps.c b/FP/src/res/maps.c
index 20fcbc7..d75569b 100644
--- a/FP/src/res/maps.c
+++ b/FP/src/res/maps.c
@@ -77,6 +77,7 @@ void* mapLoadLevel(tMemory level) {
 				tGate newGate;
 				newGate.frame=map->back[i*30+j];
 				newGate.action=map->back[i*30+j]?eClose:eOpen;
+				newGate.type=((map->fore[i*30+j]&0x1f)==T_GATE)?eNormalGate:eExitGate;
 				map->back[i*30+j]=gateInRoom;
 				map->screenGates[i][gateInRoom]=map->gates+gates;
 				auxGates[i*30+j]=map->gates+gates;
@@ -260,7 +261,10 @@ void  mapMove(tMap* map) {
 	slevel(time)++;
 	if (slevel(time)==1000) slevel(time)=0;
 	/* check out all the gates in the level */
+	
 	for (i=0;i<slevel(totalGates);i++) {
+		int maxFrames;
+		maxFrames=(map->gates[i].type==eNormalGate)?46:50;
 		switch (map->gates[i].action) {
 		case eOpenTimer:
 			if (map->gates[i].time) {
@@ -278,7 +282,7 @@ void  mapMove(tMap* map) {
 			}
 			break;
 		case eClosing:
-			if (map->gates[i].frame!=46) {
+			if (map->gates[i].frame!=maxFrames) {
 				map->gates[i].frame++;
 			} else {
 				map->gates[i].action=eClose;
@@ -286,13 +290,13 @@ void  mapMove(tMap* map) {
 			break;
 		case eClosingFast:
 			map->gates[i].frame+=30;
-			if (map->gates[i].frame>46) {
+			if (map->gates[i].frame>maxFrames) {
 				map->gates[i].action=eClose;
-				map->gates[i].frame=46;
+				map->gates[i].frame=maxFrames;
 			}
 			break;
 		case eClose:
-			map->gates[i].frame=46;
+			map->gates[i].frame=maxFrames;
 			break;
 		case eOpen:
 			map->gates[i].frame=0;