git » fp-git.git » commit c2ccb94

coded chopper gfx

author ecalot
2004-08-27 17:52:47 UTC
committer ecalot
2004-08-27 17:52:47 UTC
parent f4eeefb3aab220241b847e3e252265b4db509259

coded chopper gfx

FP/src/include/output.h +2 -3
FP/src/ker/room.c +30 -6
FP/src/out/output.c +2 -1

diff --git a/FP/src/include/output.h b/FP/src/include/output.h
index 7dc5803..73c9329 100644
--- a/FP/src/include/output.h
+++ b/FP/src/include/output.h
@@ -91,9 +91,8 @@ void outputStop();
 /* Finish all output modes, including the screen mode
  */
 
-int getHeight();
-
-int getWidth();
+int outputGetHeight(void* image);
+int outputGetWidth(void* image);
 
 
 #endif
diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c
index 712342f..e9e33c8 100644
--- a/FP/src/ker/room.c
+++ b/FP/src/ker/room.c
@@ -237,7 +237,7 @@ void drawExit(int x, int y, int frame) {
 
 typedef enum {layBack=113,layRight=108,layFore=102}tSpikeLayer;
 void drawSpike(int x, int y, int frame, tSpikeLayer layer) {
-	/* Frame defined from 0 (none) to 7 (near none). 4 is out. */
+	/* Frame defined from 0 (none) to 5 (near none). 3 is out normal. */
 	switch (layer) { /* TODO: use relative offsets in resources */
 		case layRight:
 			x+=32;
@@ -251,6 +251,34 @@ void drawSpike(int x, int y, int frame, tSpikeLayer layer) {
 	outputDrawBitmap(roomGfx.environment->pFrames[(int)layer+((frame>4)?(6-frame):frame)],x,y);
 }	
 
+typedef enum {layCBack=1,layCFore=2}tChopperLayer;
+void drawChopper(int x, int y, int frame, tChopperLayer layer) {
+	/* Frame defined from 0 (normal) to 7 (near normal). 3 is close. */
+	if (frame<4) {
+		frame++;
+	} else {
+		frame=7-frame;
+	}
+	switch (layer) { /* TODO: use relative offsets in resources */
+		case layCFore:
+			outputDrawBitmap(
+				roomGfx.environment->pFrames[91],x,y
+			);
+			break;
+		case layCBack:
+			outputDrawBitmap(
+				roomGfx.environment->pFrames[92-frame],x,y
+			);
+			if (frame<3)
+				outputDrawBitmap(
+					roomGfx.environment->pFrames[100-frame],
+					x,
+					y-60+outputGetHeight(roomGfx.environment->pFrames[100-frame])
+				);
+			break;
+	}
+}
+
 /* main panel block */
 void drawBackPanel(tRoom* room,int x, int y) {
 	tTile tile=roomGetTile(room,x,y);
@@ -373,11 +401,7 @@ void drawBackPanel(tRoom* room,int x, int y) {
 	}
 	/* chopper/this */
 	if (tile.hasChopper) {
-		outputDrawBitmap(
-			roomGfx.environment->pFrames[91],
-			(x-1)*TILE_W,
-			y*TILE_H
-		);
+		drawChopper((x-1)*TILE_W,y*TILE_H,room->level->time%8,layCBack);
 	}
 	/* empty_bricks/this */
 	if ((0<tile.bricks)&&(tile.bricks<4)&&(tile.code==T_EMPTY)) {
diff --git a/FP/src/out/output.c b/FP/src/out/output.c
index 889f57d..f95ed7f 100644
--- a/FP/src/out/output.c
+++ b/FP/src/out/output.c
@@ -239,7 +239,8 @@ int outputGetScreenWidth()
 
 int outputGetHeight(void* image)
 {
-	return ((SDL_Surface*)image)->h;
+	register tSurface* img=(tSurface*)image;
+	return img->surface->h+img->bottom;
 }
 
 int outputGetWidth(void* image)