git » fp-git.git » commit 09ae7da

+ getHeight(), getWidth in output

author sijoange
2004-07-21 20:31:38 UTC
committer sijoange
2004-07-21 20:31:38 UTC
parent 3b6ffdec7f515d46de7f7c8c9f96b71560dd4d8d

+ getHeight(), getWidth in output
+ some routines to put the intro images
( press any key in the console)

FP/src/include/output.h +5 -0
FP/src/ker/titles.c +44 -0
FP/src/out/output.c +14 -1
stuff/data/def/RES_IMG_MAIN_BACKGROUND.def +8 -0
stuff/data/def/RES_IMG_TEXT_BACKGROUND.def +8 -0

diff --git a/FP/src/include/output.h b/FP/src/include/output.h
index d51fb9d..965beea 100644
--- a/FP/src/include/output.h
+++ b/FP/src/include/output.h
@@ -91,5 +91,10 @@ void outputStop();
 /* Finish all output modes, including the screen mode
  */
 
+int getHeight();
+
+int getWidth();
+
+
 #endif
 
diff --git a/FP/src/ker/titles.c b/FP/src/ker/titles.c
index a8782e4..bed7c3d 100644
--- a/FP/src/ker/titles.c
+++ b/FP/src/ker/titles.c
@@ -33,6 +33,7 @@ titles.c: FreePrince : Titles, animation and presentation
 
 #include "output.h"
 #include "titles.h"
+#include <SDL/SDL.h>
 
 tMenuOption showTitles() {
 /* Show the titles animation
@@ -40,6 +41,49 @@ tMenuOption showTitles() {
  * returns 1 if the user has selected to load a saved game 
  * returns 2 if the user has selected to start the game
  */
+
+	tData *main_title;
+	tData *main_text;
+	
+	main_title = resLoad(RES_IMG_MAIN_BACKGROUND);
+	if (! main_title) {
+		printf("The resource couldn't be loaded!\n");
+		return 1;
+	}
+	outputClearScreen();
+	/* The main background */
+	outputDrawBitmap(main_title->pFrames[0], 0, 0);
+	outputUpdateScreen();
+	SDL_Delay(1000);
+	/* The presents */
+	outputDrawBitmap(main_title->pFrames[1], 100, 100);
+	outputUpdateScreen();
+	SDL_Delay(1050);
+	/* The author*/
+	outputClearScreen();
+	outputDrawBitmap(main_title->pFrames[0], 0, 0);
+	outputDrawBitmap(main_title->pFrames[2], 100, 100);
+	outputUpdateScreen();
+	SDL_Delay(1050);
+	/* The game name*/
+	outputClearScreen();
+	outputDrawBitmap(main_title->pFrames[0], 0, 0);
+	outputDrawBitmap(main_title->pFrames[3], 30, 70);
+	outputDrawBitmap(main_title->pFrames[4], 30, 190);
+	outputUpdateScreen();
+	SDL_Delay(1050);
+
+	main_text = resLoad(RES_IMG_TEXT_BACKGROUND);
+	if (! main_text) {
+		printf("The resource couldn't be loaded!\n");
+		return 1;
+	}
+	/* The presents */
+	outputDrawBitmap(main_text->pFrames[0], 0, 0);
+	outputDrawBitmap(main_text->pFrames[1], 0, 0);
+	outputUpdateScreen();
+	SDL_Delay(1050);
+	getchar();
 	return sStart;	
 }	
 
diff --git a/FP/src/out/output.c b/FP/src/out/output.c
index e466fdc..d7b1367 100644
--- a/FP/src/out/output.c
+++ b/FP/src/out/output.c
@@ -40,6 +40,9 @@ output.c: Free Prince : Output Devices Handler
 #include "resources.h" /* tMemory structure */
 #include "output.h"
 
+#define DEF_SCREEN_WIDTH 320
+#define DEF_SCREEN_HEIGHT 200
+
 /* Main screen object */
 SDL_Surface *screen;
 
@@ -185,12 +188,22 @@ int outputInit()
 		colors[i].g=255-i;
 		colors[i].b=255-i;
 	}
-	screen = SDL_SetVideoMode(320, 200, 8, SDL_SWSURFACE|SDL_HWPALETTE);
+	screen = SDL_SetVideoMode(DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT, 8, SDL_SWSURFACE|SDL_HWPALETTE);
 	if (!screen) return -1;
 	/*SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256);*/
 	return 0;
 }
 
+int getHeight()
+{
+	return DEF_SCREEN_HEIGHT;
+}
+
+int getWidth()
+{
+	return DEF_SCREEN_WIDTH;
+}
+
 /* Finish all output modes, including the screen mode */
 void outputStop()
 {
diff --git a/stuff/data/def/RES_IMG_MAIN_BACKGROUND.def b/stuff/data/def/RES_IMG_MAIN_BACKGROUND.def
new file mode 100644
index 0000000..dc352a4
--- /dev/null
+++ b/stuff/data/def/RES_IMG_MAIN_BACKGROUND.def
@@ -0,0 +1,8 @@
+title.dat
+IMG
+50
+51
+52
+53
+54
+55
diff --git a/stuff/data/def/RES_IMG_TEXT_BACKGROUND.def b/stuff/data/def/RES_IMG_TEXT_BACKGROUND.def
new file mode 100644
index 0000000..9c1fcaa
--- /dev/null
+++ b/stuff/data/def/RES_IMG_TEXT_BACKGROUND.def
@@ -0,0 +1,8 @@
+title.dat
+IMG
+40
+41
+42
+43
+44
+45