2012-02-28 13:09:12 +01:00
|
|
|
/*! \file about.c
|
|
|
|
* \brief About screen.
|
|
|
|
*/
|
2012-03-04 13:32:42 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) Sebastian Krzyszkowiak <dos@dosowisko.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
2012-02-19 20:18:28 +01:00
|
|
|
#include <stdio.h>
|
2012-02-17 00:19:21 +01:00
|
|
|
#include "about.h"
|
|
|
|
|
2012-09-26 03:08:58 +02:00
|
|
|
void About_Logic(struct Game *game) {
|
|
|
|
if (al_get_sample_instance_position(game->about.music)<700000) { return; }
|
2012-04-03 21:17:56 +02:00
|
|
|
if (game->about.fadeloop>=0) {
|
2012-05-03 19:42:23 +02:00
|
|
|
if (game->about.fadeloop==0) PrintConsole(game, "Fade in");
|
2012-09-26 03:08:58 +02:00
|
|
|
game->about.fadeloop+=5;
|
2012-04-03 21:17:56 +02:00
|
|
|
if (game->about.fadeloop>=256) {
|
|
|
|
al_destroy_bitmap(game->about.fade_bitmap);
|
|
|
|
game->about.fadeloop=-1;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2012-09-26 03:08:58 +02:00
|
|
|
game->about.x+=0.00025;
|
|
|
|
}
|
|
|
|
|
|
|
|
void About_Draw(struct Game *game) {
|
|
|
|
/*PrintConsole(game, "%d", al_get_sample_instance_position(game->about.music));*/
|
|
|
|
if (al_get_sample_instance_position(game->about.music)<700000) { al_clear_to_color(al_map_rgba(0,0,0,0)); return; }
|
|
|
|
if (game->about.fadeloop>=0) {
|
|
|
|
if (game->about.fadeloop==0) PrintConsole(game, "Fade in");
|
|
|
|
al_draw_tinted_bitmap(game->about.fade_bitmap,al_map_rgba_f(game->about.fadeloop/255.0,game->about.fadeloop/255.0,game->about.fadeloop/255.0,1),0,0,0);
|
|
|
|
return;
|
|
|
|
}
|
2012-04-03 21:17:56 +02:00
|
|
|
|
2012-08-04 20:58:24 +02:00
|
|
|
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,game->viewportWidth, game->viewportHeight,0);
|
|
|
|
al_draw_bitmap(game->about.letter, game->viewportWidth*0.3, -game->viewportHeight*0.1, 0);
|
2012-02-22 13:38:56 +01:00
|
|
|
float x = game->about.x;
|
|
|
|
if (x<0) x=0;
|
2012-05-22 21:29:55 +02:00
|
|
|
ALLEGRO_BITMAP* subbitmap;
|
2012-08-04 20:58:24 +02:00
|
|
|
subbitmap = al_create_sub_bitmap(game->about.text_bitmap, 0, x*al_get_bitmap_height(game->about.text_bitmap), al_get_bitmap_width(game->about.text_bitmap), game->viewportHeight);
|
|
|
|
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, game->viewportWidth*0.5+al_get_bitmap_width(subbitmap)/2.0, game->viewportHeight*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
2012-05-22 21:29:55 +02:00
|
|
|
al_destroy_bitmap(subbitmap);
|
2012-02-25 22:26:31 +01:00
|
|
|
if (game->about.x>1) {
|
2012-02-22 14:55:21 +01:00
|
|
|
UnloadGameState(game);
|
|
|
|
game->loadstate = GAMESTATE_MENU;
|
2012-03-01 01:46:45 +01:00
|
|
|
LoadGameState(game);
|
2012-02-22 14:55:21 +01:00
|
|
|
}
|
2012-02-17 00:19:21 +01:00
|
|
|
}
|
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
void About_Load(struct Game *game) {
|
2012-03-05 21:07:42 +01:00
|
|
|
al_play_sample_instance(game->about.music);
|
2012-04-03 21:17:56 +02:00
|
|
|
game->about.fadeloop = 0;
|
2012-02-19 22:20:05 +01:00
|
|
|
About_Draw(game);
|
2012-02-18 06:26:58 +01:00
|
|
|
}
|
2012-02-25 22:26:31 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
2012-02-22 14:55:21 +01:00
|
|
|
if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
2012-02-18 06:26:58 +01:00
|
|
|
UnloadGameState(game);
|
|
|
|
game->loadstate = GAMESTATE_MENU;
|
2012-02-29 23:00:59 +01:00
|
|
|
LoadGameState(game);
|
2012-02-22 14:55:21 +01:00
|
|
|
}
|
2012-02-22 15:21:28 +01:00
|
|
|
return 0;
|
2012-02-18 06:26:58 +01:00
|
|
|
}
|
2012-02-25 22:26:31 +01:00
|
|
|
|
2012-05-18 18:34:07 +02:00
|
|
|
void About_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
2012-05-19 20:00:27 +02:00
|
|
|
PROGRESS_INIT(6);
|
2012-05-18 18:34:07 +02:00
|
|
|
|
2012-08-04 20:58:24 +02:00
|
|
|
game->about.image =LoadScaledBitmap("table.png", game->viewportWidth, game->viewportHeight);
|
2012-05-18 18:34:07 +02:00
|
|
|
PROGRESS;
|
2012-08-04 20:58:24 +02:00
|
|
|
game->about.letter = LoadScaledBitmap("about/letter.png", game->viewportHeight*1.3, game->viewportHeight*1.3 );
|
2012-05-18 18:34:07 +02:00
|
|
|
PROGRESS;
|
2012-03-01 10:54:56 +01:00
|
|
|
|
2012-09-03 02:25:32 +02:00
|
|
|
game->about.sample = al_load_sample( GetDataFilePath("about/about.flac") );
|
2012-05-18 18:34:07 +02:00
|
|
|
PROGRESS;
|
|
|
|
|
2012-03-05 21:07:42 +01:00
|
|
|
game->about.music = al_create_sample_instance(game->about.sample);
|
|
|
|
al_attach_sample_instance_to_mixer(game->about.music, game->audio.music);
|
|
|
|
al_set_sample_instance_playmode(game->about.music, ALLEGRO_PLAYMODE_LOOP);
|
2012-04-03 21:17:56 +02:00
|
|
|
al_set_sample_instance_position(game->about.music, game->music ? 420000 : 700000);
|
2012-03-05 21:07:42 +01:00
|
|
|
|
2012-09-19 01:20:24 +02:00
|
|
|
game->about.font = al_load_ttf_font(GetDataFilePath("fonts/ShadowsIntoLight.ttf"),game->viewportHeight*0.035,0 );
|
2012-05-18 18:34:07 +02:00
|
|
|
PROGRESS;
|
2012-02-22 14:55:21 +01:00
|
|
|
game->about.x = -0.1;
|
2012-02-19 20:18:28 +01:00
|
|
|
if (!game->about.sample){
|
|
|
|
fprintf(stderr, "Audio clip sample not loaded!\n" );
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-08-04 20:58:24 +02:00
|
|
|
game->about.text_bitmap = al_create_bitmap(game->viewportWidth*0.4, game->viewportHeight*3.225);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_set_target_bitmap(game->about.text_bitmap);
|
2012-02-26 15:04:12 +01:00
|
|
|
al_clear_to_color(al_map_rgba(0,0,0,0));
|
2012-05-22 21:29:55 +02:00
|
|
|
al_draw_text(game->about.font, al_map_rgb(0,0,0), 0.5*al_get_bitmap_width(game->about.text_bitmap), 0.015*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_CENTRE, "Super Derpy: Muffin Attack");
|
2012-07-13 11:05:38 +02:00
|
|
|
al_draw_text(game->about.font, al_map_rgb(0,0,0), 0.5*al_get_bitmap_width(game->about.text_bitmap), 0.035*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_CENTRE, "Version 0.1a (Development Preview)");
|
2012-02-22 14:55:21 +01:00
|
|
|
|
|
|
|
float y=0.07;
|
|
|
|
void draw_text(char* text) {
|
2012-05-22 21:29:55 +02:00
|
|
|
al_draw_text(game->about.font, al_map_rgb(0,0,0), 0, y*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, text);
|
2012-07-08 22:11:31 +02:00
|
|
|
y+=0.0131;
|
2012-02-22 14:55:21 +01:00
|
|
|
}
|
2012-05-18 18:34:07 +02:00
|
|
|
|
2012-02-22 14:55:21 +01:00
|
|
|
draw_text("Written by:");
|
|
|
|
draw_text(" - Sebastian Krzyszkowiak");
|
|
|
|
draw_text(" http://dosowisko.net/");
|
|
|
|
draw_text("");
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text("Animations:");
|
|
|
|
draw_text(" - Yudhaikeledai");
|
|
|
|
draw_text(" http://yudhaikeledai.deviantart.com/");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("Voices:");
|
2012-07-08 22:11:31 +02:00
|
|
|
/*draw_text(" - BaldDumboRat");
|
|
|
|
draw_text(" Derpy Hooves");*/
|
2012-07-12 18:54:32 +02:00
|
|
|
draw_text(" - MEMJ0123");
|
2012-07-13 11:05:38 +02:00
|
|
|
draw_text(" http://www.youtube.com/user/MEMJ0123");
|
2012-07-12 18:54:32 +02:00
|
|
|
draw_text(" Princess Celestia");
|
|
|
|
draw_text(" - Meredith Sims (Emichwan88)");
|
|
|
|
draw_text(" http://www.youtube.com/Emichwan88");
|
2012-09-03 02:25:32 +02:00
|
|
|
draw_text(" Fluttershy");
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text(" Twilight Sparkle");
|
2012-07-08 22:11:31 +02:00
|
|
|
/*draw_text(" - Hnilmik");
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text(" Rarity");
|
|
|
|
draw_text(" - Karen VO");
|
2012-07-08 22:11:31 +02:00
|
|
|
draw_text(" Applejack");*/
|
2012-09-03 02:25:32 +02:00
|
|
|
/* draw_text(" - Erica Mendez");
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text(" Rainbow Dash");
|
|
|
|
draw_text(" - Emily Fajardo");
|
2012-07-08 22:11:31 +02:00
|
|
|
draw_text(" Pinkie Pie");*/
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text("");
|
|
|
|
draw_text("Original graphics:");
|
2012-07-08 22:11:31 +02:00
|
|
|
draw_text(" - Ania Karlik");
|
|
|
|
draw_text(" (Eris)");
|
|
|
|
draw_text(" - Agata Kurczewska");
|
|
|
|
draw_text(" http://kiciazkrainyczarow.deviantart.com/");
|
|
|
|
draw_text(" - Wiktor Grześkowiak");
|
|
|
|
draw_text(" http://gl0w.pl/");
|
2012-02-22 14:55:21 +01:00
|
|
|
draw_text("");
|
|
|
|
draw_text("Music:");
|
2012-04-09 16:41:10 +02:00
|
|
|
draw_text(" - Claire Anne Carr");
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text(" http://claireannecarr.bandcamp.com/");
|
2012-07-08 22:11:31 +02:00
|
|
|
draw_text(" - Dr Dissonance");
|
|
|
|
draw_text(" http://dr-dissonance.tumblr.com/");
|
2012-02-22 14:55:21 +01:00
|
|
|
draw_text(" - Dan O'Connor");
|
|
|
|
draw_text(" http://www.danosongs.com/");
|
|
|
|
draw_text(" - Kevin MacLeod");
|
|
|
|
draw_text(" http://incompetech.com/");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("Sounds:");
|
|
|
|
draw_text(" - Sound Jay");
|
|
|
|
draw_text(" http://www.soundjay.com/");
|
|
|
|
draw_text("");
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text("Other graphics:");
|
2012-07-12 18:54:32 +02:00
|
|
|
draw_text(" - CptOfTheFriendship");
|
|
|
|
draw_text(" http://cptofthefriendship.deviantart.com/");
|
2012-04-03 21:17:56 +02:00
|
|
|
draw_text(" - hombre0");
|
|
|
|
draw_text(" http://hombre0.deviantart.com/");
|
|
|
|
draw_text(" - Siobhan Brewer");
|
|
|
|
draw_text(" http://boxdrink.deviantart.com/");
|
|
|
|
draw_text("");
|
2012-02-22 14:55:21 +01:00
|
|
|
draw_text("Super Derpy: Muffin Attack comes");
|
|
|
|
draw_text("with ABSOLUTELY NO WARRANTY.");
|
|
|
|
draw_text("You may redistribute copies of this");
|
|
|
|
draw_text("game under the terms of");
|
|
|
|
draw_text("GNU General Public License.");
|
|
|
|
draw_text("For more information, see the file");
|
|
|
|
draw_text("named COPYING.");
|
|
|
|
draw_text("");
|
2012-02-26 13:00:03 +01:00
|
|
|
draw_text("Super Derpy: Muffin Attack is");
|
|
|
|
draw_text("a fan-made game with no profit");
|
|
|
|
draw_text("intended. Its author is unpaid");
|
|
|
|
draw_text("volunteer and doesn't receive");
|
|
|
|
draw_text("any economical profit from it.");
|
2012-02-22 14:55:21 +01:00
|
|
|
draw_text("");
|
2012-02-26 13:00:03 +01:00
|
|
|
draw_text("My Little Pony: Friendship is Magic");
|
2012-02-22 14:55:21 +01:00
|
|
|
draw_text("is copyrighted trademark owned");
|
|
|
|
draw_text("by Hasbro.");
|
|
|
|
draw_text("");
|
2012-02-26 13:00:03 +01:00
|
|
|
draw_text("Author of Super Derpy is not");
|
|
|
|
draw_text("affiliated to Hasbro, The Hub");
|
|
|
|
draw_text("or its associates.");
|
2012-07-08 22:11:31 +02:00
|
|
|
draw_text("");
|
|
|
|
draw_text("http://www.superderpy.com/");
|
2012-05-18 18:34:07 +02:00
|
|
|
PROGRESS;
|
2012-02-22 13:38:56 +01:00
|
|
|
|
2012-08-04 20:58:24 +02:00
|
|
|
game->about.fade_bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
2012-09-26 03:08:58 +02:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
al_set_target_bitmap(game->about.fade_bitmap);
|
2012-03-01 01:14:24 +01:00
|
|
|
al_draw_bitmap(game->about.image, 0, 0, 0);
|
2012-08-04 20:58:24 +02:00
|
|
|
al_draw_bitmap(game->about.letter, game->viewportWidth*0.3, -game->viewportHeight*0.1, 0);
|
2012-05-22 21:29:55 +02:00
|
|
|
ALLEGRO_BITMAP* subbitmap;
|
2012-08-04 20:58:24 +02:00
|
|
|
subbitmap = al_create_sub_bitmap(game->about.text_bitmap, 0, 0, al_get_bitmap_width(game->about.text_bitmap), game->viewportHeight);
|
|
|
|
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, game->viewportWidth*0.5+al_get_bitmap_width(subbitmap)/2.0, game->viewportHeight*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
2012-05-22 21:29:55 +02:00
|
|
|
al_destroy_bitmap(subbitmap);
|
2012-02-22 13:38:56 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
al_set_target_bitmap(al_get_backbuffer(game->display));
|
2012-05-18 18:34:07 +02:00
|
|
|
PROGRESS;
|
2012-02-18 06:26:58 +01:00
|
|
|
}
|
2012-02-25 22:26:31 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
void About_Unload(struct Game *game) {
|
2012-09-26 03:08:58 +02:00
|
|
|
if (game->about.fadeloop!=0) {
|
|
|
|
FadeGameState(game, false);
|
|
|
|
}
|
2012-02-18 06:26:58 +01:00
|
|
|
al_destroy_bitmap(game->about.image);
|
2012-03-04 15:57:23 +01:00
|
|
|
al_destroy_bitmap(game->about.letter);
|
2012-09-26 03:08:58 +02:00
|
|
|
if (game->about.fadeloop>=0) al_destroy_bitmap(game->about.fade_bitmap);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_destroy_bitmap(game->about.text_bitmap);
|
2012-03-05 21:07:42 +01:00
|
|
|
al_destroy_sample_instance(game->about.music);
|
2012-02-19 20:18:28 +01:00
|
|
|
al_destroy_sample(game->about.sample);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_destroy_font(game->about.font);
|
2012-02-18 06:26:58 +01:00
|
|
|
}
|