git » fp-git.git » commit fc30b0d

bugfixes

author ecalot
2004-08-25 06:54:07 UTC
committer ecalot
2004-08-25 06:54:07 UTC
parent c25446a6a7b65abfe735dec68e308ce2d913541d

bugfixes

FP/src/include/types.h +2 -2
FP/src/ker/room.c +25 -7
FP/src/res/compress.c +0 -1
FP/src/res/maps.c +4 -2
FP/src/res/resources.c +2 -2

diff --git a/FP/src/include/types.h b/FP/src/include/types.h
index 3e37ff3..e7ad265 100644
--- a/FP/src/include/types.h
+++ b/FP/src/include/types.h
@@ -35,7 +35,7 @@ types.h: FreePrince : Kernel types
 
 #include "resources.h"
 
-typedef char tRoomId;
+typedef unsigned char tRoomId;
 typedef unsigned char tTileId;
 typedef unsigned char tModId;
 
@@ -83,7 +83,7 @@ typedef struct {
 	int hasBigPillar;
 	int isExit;
 	int isGate;
-	int gateStatus;
+	tGate* gateInfo;
 	int bricks;
 	int isPressable;
 	int hasSpikes;
diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c
index e6c2262..6bc8ef6 100644
--- a/FP/src/ker/room.c
+++ b/FP/src/ker/room.c
@@ -70,6 +70,28 @@ tTile roomGetTile(tRoom* room,int x, int y) {
 	result.code=fore&0x1F;
 	
 	switch (result.code) { /* TODO: use arrays and a better algorithm */
+	case T_GATE:
+	case T_EXIT_LEFT:
+		result.hasGateFrame=(result.code==T_GATE);
+		result.bricks=0;
+		result.hasPillar=0;
+		result.hasBigPillar=0;
+		result.isGate=(result.code==T_GATE);
+		printf("getting details on gate at %d,%d\n",x,y);
+		result.gateInfo=NULL/*room->level->screenGates[room->id][back]*/;
+		result.walkable=1;
+		result.hasChopper=0;
+		result.isExit=(result.code==T_EXIT_LEFT)?1:((result.code==T_EXIT_RIGHT)?2:0);
+		result.block=0;
+		result.isPressable=0;
+		result.hasSkeleton=0;
+		result.hasSpikes=0;
+		result.hasTorch=0;
+		result.hasFloor=0;
+		result.hasBrokenTile=0;
+		result.isWall=0;
+		result.hasSword=0;
+		break;
 	case T_FLOOR:
 	case T_TORCH:
 	case T_SWORD:
@@ -79,9 +101,7 @@ tTile roomGetTile(tRoom* room,int x, int y) {
 	case T_BP_BOTTOM:
 	case T_BTN_RAISE:
 	case T_BTN_DROP:
-	case T_GATE:
 	case T_TORCH_DEBRIS:
-	case T_EXIT_LEFT:
 	case T_EXIT_RIGHT:
 	case T_SKELETON:
 	case T_LOOSE:
@@ -91,9 +111,7 @@ tTile roomGetTile(tRoom* room,int x, int y) {
 		result.bricks=(result.code==T_FLOOR)?back:0;
 		result.hasPillar=(result.code==T_PILLAR);
 		result.hasBigPillar=(result.code==T_BP_BOTTOM);
-		result.isGate=(result.code==T_GATE);
-		/* only important if tile is gate*/
-		result.gateStatus=(result.code==T_GATE)?((!back)*47):15;
+		result.isGate=0;
 		result.walkable=1;
 		result.hasChopper=(result.code==T_CHOPPER);
 		result.isExit=(result.code==T_EXIT_LEFT)?1:((result.code==T_EXIT_RIGHT)?2:0);
@@ -203,7 +221,7 @@ void drawBackPanel(tRoom* room,int x, int y) {
 			(x-1)*TILE_W,
 			y*TILE_H+2
 		);
-		drawGate((x-1)*TILE_W,(y-1)*TILE_H+3,tile.gateStatus);
+/*		drawGate((x-1)*TILE_W,(y-1)*TILE_H+3,tile.gateInfo->status);*/
 	}
 	/* normal/left */
 	if (left.hasFloor) {
@@ -475,7 +493,7 @@ void drawBackBottomTile(tRoom* room,int x, int y) {
 					(x-1)*TILE_W,
 					y*TILE_H+3
 				);
-		drawGateTop(x*TILE_W,(y-1)*TILE_H+3,tile.gateStatus);
+/*				drawGateTop(x*TILE_W,(y-1)*TILE_H+3,tile.gateInfo->status);*/
 			}
 			/* big_pillar/left */
 			if (dleft.hasBigPillar==2) {
diff --git a/FP/src/res/compress.c b/FP/src/res/compress.c
index 916659c..7e46d70 100644
--- a/FP/src/res/compress.c
+++ b/FP/src/res/compress.c
@@ -219,7 +219,6 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes)
 	data+=2;
 	image->width =array2short(data);/*((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2;*/
 	data+=2;
-
 	if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */
 	image->type=(unsigned char)(*(data++));
 	dataSizeInBytes-=7;
diff --git a/FP/src/res/maps.c b/FP/src/res/maps.c
index 98d63fe..c5d5d91 100644
--- a/FP/src/res/maps.c
+++ b/FP/src/res/maps.c
@@ -124,13 +124,14 @@ void* mapLoadLevel(tMemory level) {
 		unsigned char byte1=level.array[MAPS_BLOCK_OFFSET_GATE_1+i];
 		unsigned char byte2=level.array[MAPS_BLOCK_OFFSET_GATE_2+i];
 		int S,L,T;
-		S=((byte1>>5)&3)|((byte2>>3)&7);
+		S=((byte1>>5)&3)|((byte2>>3)&28);
 		L=byte1&31;
 		T=(byte1>>7)&1;
+		fprintf(stderr,"mapLoadLevel: Loading event: S=%d L=%d T=%d\n",S,L,T);
 		map->events[i].triggerNext=T;
 		map->events[i].gate=auxGates[(S-1)*30+L]; /* in case of error null is assigned */
 	}
-	free(auxGates);	
+	free(auxGates);
 	return (void*)map;
 }
 
@@ -283,6 +284,7 @@ void  mapStart(tMap* map, tKid* kid, tRoomId *roomId, int level) {
 	static char environments[]=MAP_ENVIRONMENTS;
 	*roomId=slevel(start)[0];
 	printf("mapStart: binding kid to map in room %d using the %d environment\n",*roomId,environments[level]);
+	slevel(time)=0;
 	roomLoadGfx(/*environments[level]?RES_IMG_ENV_PALACE:*/RES_IMG_ENV_DUNGEON);
 }
 
diff --git a/FP/src/res/resources.c b/FP/src/res/resources.c
index 74f2ed6..27bc68a 100644
--- a/FP/src/res/resources.c
+++ b/FP/src/res/resources.c
@@ -162,8 +162,8 @@ tData* resLoad(long id) {
 			return result; /* transform from raw to a loaded map */
 		case RES_TYPE_IMG: {
 			tMemory palette;
-      tImage image;
-      tPalette pal;
+			tImage image;
+			tPalette pal;
 			int has_D=((mask&RES_MODS_HAS_D)?1:0);
 			int has_L=((mask&RES_MODS_HAS_L)?1:0);
 			int has_R=((mask&RES_MODS_HAS_R)?1:0);