git » fp-git.git » commit b33a1fb

Added element support. Inverted coordinate system (now offsets are taken from the bottom).

author ecalot
2004-08-16 03:56:08 UTC
committer ecalot
2004-08-16 03:56:08 UTC
parent effff321bf67d6c333cd58e5b029628d9faf8ddc

Added element support. Inverted coordinate system (now offsets are taken from the bottom).

FP/src/conf/resources.conf +1 -1
FP/src/include/room.h +1 -0
FP/src/ker/kid.c +1 -1
FP/src/ker/object.c +1 -1
FP/src/ker/room.c +48 -5
FP/src/ker/titles.c +3 -3
FP/src/out/output.c +1 -1

diff --git a/FP/src/conf/resources.conf b/FP/src/conf/resources.conf
index a6f9761..b24ce01 100644
--- a/FP/src/conf/resources.conf
+++ b/FP/src/conf/resources.conf
@@ -18,7 +18,7 @@ ANIM_TURNING         IMG KID     400 445-451
 ANIM_WALKING         IMG KID     400 534-544 
 GUARD_1              IMG PRINCE  GUARD 100 101
 IMG_BACKGROUND       IMG PV      950 951
-IMG_ENV_DUNGEON      IMG DUNGEON 200 297 300 298 1327 1333 1230 1231 241-243 269-274 235 296 236 347 348-232
+IMG_ENV_DUNGEON      IMG DUNGEON 200 297 298 300 1327 1333 1230 1231 241-243 269-274 235 296 236 347 348 232 292-295
 IMG_MAIN_BACKGROUND  IMG TITLES  50-55 
 IMG_TEXT_BACKGROUND  IMG TITLES  40-45
 
diff --git a/FP/src/include/room.h b/FP/src/include/room.h
index ae7e730..c120369 100644
--- a/FP/src/include/room.h
+++ b/FP/src/include/room.h
@@ -55,6 +55,7 @@ typedef struct {
 	
 	/* Graphical arributes */
 	int hasTorch;
+	int hasPillar;
 	int hasFloor;
 	int hasBrokenTile;
 	int isWall;
diff --git a/FP/src/ker/kid.c b/FP/src/ker/kid.c
index 24fd5a6..f12dc6c 100644
--- a/FP/src/ker/kid.c
+++ b/FP/src/ker/kid.c
@@ -111,7 +111,7 @@ tKid kidCreate() {
 }
 
 void kidDraw(tKid kid) {
-	outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,kid.floor*20);
+	outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,100+kid.floor*20);
 }
 
 int kidMove(tKid* kid,tKey key/*,tRoom room*/) {
diff --git a/FP/src/ker/object.c b/FP/src/ker/object.c
index 24fd5a6..f12dc6c 100644
--- a/FP/src/ker/object.c
+++ b/FP/src/ker/object.c
@@ -111,7 +111,7 @@ tKid kidCreate() {
 }
 
 void kidDraw(tKid kid) {
-	outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,kid.floor*20);
+	outputDrawBitmap(kid.action->pFrames[kid.frame],kid.location,100+kid.floor*20);
 }
 
 int kidMove(tKid* kid,tKey key/*,tRoom room*/) {
diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c
index ee7e030..d136c6b 100644
--- a/FP/src/ker/room.c
+++ b/FP/src/ker/room.c
@@ -82,7 +82,9 @@ tTile roomGetTile(tRoom* room,int x, int y) {
 	case T_FLOOR:
 	case T_TORCH:
 	case T_SWORD:
+	case T_PILLAR:
 	case T_DEBRIS:
+		result.hasPillar=(result.code==T_PILLAR);
 		result.walkable=1;
 		result.block=0;
 		result.hasTorch=(result.code==T_TORCH);
@@ -114,22 +116,63 @@ void roomDrawBackground(tRoom* room) {
 			tile=roomGetTile(room,x,y);
 			if (tile.hasTorch) {
 				outputDrawBitmap(
-					roomGfx.torch->pFrames[map->time%(roomGfx.torch->frames)],
-					(x+1)*13,
-					y*24
+					roomGfx.torch->pFrames[(map->time+2*x+y)%(roomGfx.torch->frames)],
+					x*32,
+					y*48
 				);
 			}
 			if (tile.hasFloor) {
 				outputDrawBitmap(
 					roomGfx.environment->pFrames[10],
-					(x+1)*13,
-					y*24
+					x*32,
+					y*48
+				);
+				outputDrawBitmap(
+					roomGfx.environment->pFrames[9],
+					x*32,
+					y*48+2
+				);
+			}
+			if (tile.hasBrokenTile) {
+				outputDrawBitmap(
+					roomGfx.environment->pFrames[2],
+					x*32,
+					y*48
+				);
+				outputDrawBitmap(
+					roomGfx.environment->pFrames[1],
+					x*32,
+					y*48+2
+				);
+			}
+			if (tile.walkable) {
+				outputDrawBitmap(
+					roomGfx.environment->pFrames[8],
+					x*32+32,
+					y*48+1
 				);
 			}
 		}
 	}
 }
+
 void roomDrawForeground(tRoom* room) {
+	int x,y;
+	tTile tile;
+	/*tMap* map=room->level;*/
+	
+	for (x=0;x<12;x++) {
+		for (y=0;y<5;y++) {
+			tile=roomGetTile(room,x,y);
+			if (tile.hasPillar) {
+				outputDrawBitmap(
+					roomGfx.environment->pFrames[14],
+					x*32+32,
+					y*48+1
+				);
+			}
+		}
+	}
 }
 
 
diff --git a/FP/src/ker/titles.c b/FP/src/ker/titles.c
index 6ea83fe..d9096df 100644
--- a/FP/src/ker/titles.c
+++ b/FP/src/ker/titles.c
@@ -83,7 +83,7 @@ tMenuOption showTitles() {
 	}
 	outputClearScreen();
 	/* The main background */
-	outputDrawBitmap(main_title->pFrames[0], 0, 0);
+	outputDrawBitmap(main_title->pFrames[0], 0, 200);
 	outputUpdateScreen();
 	result=sleep(12);
 	if (result!=menuNone) return result;
@@ -94,14 +94,14 @@ tMenuOption showTitles() {
 	if (result!=menuNone) return result;
 	/* The author*/
 	outputClearScreen();
-	outputDrawBitmap(main_title->pFrames[0], 0, 0);
+	outputDrawBitmap(main_title->pFrames[0], 0, 200);
 	outputDrawBitmap(main_title->pFrames[2], 100, 100);
 	outputUpdateScreen();
 	result=sleep(12);
 	if (result!=menuNone) return result;
 	/* The game name*/
 	outputClearScreen();
-	outputDrawBitmap(main_title->pFrames[0], 0, 0);
+	outputDrawBitmap(main_title->pFrames[0], 0, 200);
 	outputDrawBitmap(main_title->pFrames[3], 30, 70);
 	outputDrawBitmap(main_title->pFrames[4], 30, 190);
 	outputUpdateScreen();
diff --git a/FP/src/out/output.c b/FP/src/out/output.c
index cd52121..04d6f4f 100644
--- a/FP/src/out/output.c
+++ b/FP/src/out/output.c
@@ -159,7 +159,7 @@ void outputDrawBitmap(void* image, int x, int y) {
 	SDL_Surface *s = (SDL_Surface *)image;
 	SDL_Rect dest;
 	dest.x = x;
-	dest.y = y;
+	dest.y = y-s->h;
 	dest.w = s->w;
 	dest.h = s->h;
 	if (SDL_MUSTLOCK(screen)) SDL_LockSurface(screen);