Beispiel #1
0
int credits(void)
{
    int i,done, quit, scroll;
    SDL_Rect subscreen, dest;
	
	char credit_tts_text[MAX_LINES*MAX_LINEWIDTH]; 
    credit_tts_text[0] = '\0';
	for (i = 0; i< MAX_LINES;i++)
	{
		strcat(credit_tts_text,credit_text[i]);
	}
	strcat(credit_tts_text,"Thaks for reading \0");
	//fprintf(stderr,"OUTPUT = %s \n LEN = %d",credit_tts_text,MAX_LINES*MAX_LINEWIDTH);
	
	T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,"%s",credit_tts_text);
	

    /* Clear window: */

    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));


    /* Draw title: */

    dest.x = (screen->w - images[IMG_TITLE]->w) / 2;
    dest.y = 0;
    dest.w = images[IMG_TITLE]->w;
    dest.h = images[IMG_TITLE]->h;

    SDL_BlitSurface(images[IMG_TITLE], NULL, screen, &dest);


    /* --- MAIN OPTIONS SCREEN LOOP: --- */

    done = 0;
    quit = 0;
    scroll = 0;
    line = 0;

    subscreen.x = 0;
    subscreen.y = images[IMG_TITLE]->h;
    subscreen.w = screen->w;
    subscreen.h = screen->h - images[IMG_TITLE]->h;

    /*convert the text array to one wrapped at 40 columns: */
    T4K_LineWrapList(credit_text, wrapped_lines, 40, MAX_LINES, MAX_LINEWIDTH);
    quit = scroll_text(wrapped_lines, subscreen, 2);
    fprintf(stderr,"\n%s",credit_text[10]);

    /* Return the chosen command: */

    return quit;
}
Beispiel #2
0
void showGameOver()
{
    const char text[2][MAX_LINEWIDTH] = {N_("Sorry, try again!"), ""};
    T4K_LineWrapList(text, wrapped_lines, 40, MAX_LINES, MAX_LINEWIDTH);
    scroll_text(wrapped_lines, screen->clip_rect, 3);
}
Beispiel #3
0
void showGameWon()
{
    const char text[2][MAX_LINEWIDTH] = {N_("Mission accomplished. The galaxy is safe!"), ""};
    T4K_LineWrapList(text, wrapped_lines, 40, MAX_LINES, MAX_LINEWIDTH);
    scroll_text(wrapped_lines, screen->clip_rect, 3);
}
Beispiel #4
0
void briefPlayer(int stage)
{
    /* NOTE: the convention has changed. Use " " for a blank line (note
       the space), and use "" (rather than NULL) for the termination
       string. This is a consequence of the linewrapping code.  TEH Feb
       2009. */

    const char briefings[NUM_STAGES][MAX_LINES][MAX_LINEWIDTH] = 
    {
	//cadet
	{
	    {N_("-[Esc] to skip")},
	    {N_("Mission One: Careful Cadet")},
	    {"--------------------------"},
	    {N_("I'm so glad you've come!")},
	    {" "},
	    {N_("The penguins need your help! Comets are falling from the sky, and are melting the penguins' igloos. To save their homes, we need you to find the secret code that will zap each comet.")},
	    {" "},
	    {N_("Do your best!")},
	    {""}
	},
	//scout
	{
	    {N_("-[Esc] to skip")},
	    {N_("Mission Two: Smart Scout")},
	    {"------------------------"},
	    {N_("Great job! Since you saved the penguins' homes, we are promoting you to Scout. Scouts are good for keeping an eye out for trouble...")},
	    {" "},
	    {N_("...like what's happening right now! The TakeAways have come, and they're sending new, trickier comets against the penguins!")},
	    {N_("But you can save them!")},
	    {""}
	},
	//ranger
	{
	    {"-[Esc] to skip"},
	    {N_("Mission Three: Royal Ranger")},
	    {"---------------------------"},
	    {N_("You've done it again! The Penguin Emperor has chosen you to join his team of Rangers that help protect the city.  We're sending you there now...")},
	    {" "},
	    {N_("...oh no! Now the Emperor himself is under attack, from new types of comets: these problems are multiplying! To fight these, you need great skill. We think you can do it. Join the Rangers and help save the city!")},
	    {""}
	},
	//ace
	{
	    {N_("-[Esc] to skip")},
	    {N_("Mission Four: Imperial Ace")},
	    {"--------------------------"},
	    {N_("You did it! The Emperor wants to thank you in person. We are taking you to his ice palace for a great honor: you will become the Imperial Ace!")},
	    {" "},
	    {N_("But right in the middle of the ceremony, a new attack from the land of Division starts!")},
	    {N_("Now is no time for resting; the city needs your help!")},
	    {""}
	},
	//commando
	{
	    {N_("-[Esc] to skip")},
	    {N_("Final Mission: Computing Commando")},
	    {"---------------------------------"},
	    {N_("Penguin scientists have learned that all these attacks are coming from a secret base, and they need you to go fight the final battle. They also give you this clue: first do multiplication and division, and then do addition and subtraction.")},
	    {N_("I hope that hint helps!")},
	    {" "},
	    {N_("This is it! You can stop these attacks forever, Commando!")},
	    {""}
	},
    };


    char* sprites[] = {
	"sprites/tux_helmet_yellow.svg",
	"sprites/tux_helmet_green.svg",
	"sprites/tux_helmet_blue.svg",
	"sprites/tux_helmet_red.svg",
	"sprites/tux_helmet_black.svg"
    };

    SDL_Surface* icon = NULL;
    SDL_Rect textarea = screen->clip_rect;
    SDL_Surface* loadedsprite = T4K_LoadScaledImage(
	    sprites[stage], IMG_REGULAR|IMG_NOT_REQUIRED, 
	    screen->h / 4, screen->h / 4
	    );



    if (loadedsprite) //if using an image, make sure the text doesn't hit it
    {
	icon = loadedsprite;
	textarea.x = icon->w;
	textarea.y = icon->h;
	textarea.w = screen->w - icon->w;
	textarea.h = screen->h - icon->h;
    }

    //background is dark blue with a black text area
    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 32));
    SDL_FillRect(screen, &textarea, 0);

    //show this stage's text
    DEBUGMSG(debug_game, "Briefing\n");

    SDL_BlitSurface(icon, NULL, screen, NULL);

    T4K_LineWrapList(briefings[stage], wrapped_lines, 40, MAX_LINES, MAX_LINEWIDTH);
    scroll_text(wrapped_lines, textarea, 1);

    DEBUGMSG(debug_game, "Finished briefing\n");

    SDL_FreeSurface(loadedsprite);
    if (icon != loadedsprite)
	SDL_FreeSurface(icon);
}