From 376a3af3952f58d87358b342d6fcf5ce05ba7ba2 Mon Sep 17 00:00:00 2001 From: Allanis Date: Wed, 20 Feb 2013 21:10:39 +0000 Subject: [PATCH] [Add] Fade to white when hyperspacing. Might want to add sound to that later. --- src/opengl.c | 1 - src/player.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/opengl.c b/src/opengl.c index c157e7f..62395cb 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -357,7 +357,6 @@ void gl_blitSprite(const glTexture* sprite, const double bx, const double by, ty = sprite->sh * (sprite->sy-(double)sy-1)/sprite->rh; // Actual blitting.... - glShadeModel(GL_FLAT); glBindTexture(GL_TEXTURE_2D, sprite->texture); glBegin(GL_QUADS); if(c == NULL) glColor4d(1., 1., 1., 1.); diff --git a/src/player.c b/src/player.c index bad79c0..1700288 100644 --- a/src/player.c +++ b/src/player.c @@ -37,6 +37,7 @@ double player_acc = 0.; // Accel velocity from input. unsigned int player_target = PLAYER_ID; // Targetted pilot. static int planet_target = -1; // Targetted planet. static int hyperspace_target = -1; // Target hyperspace route. +static double hyperspace_flash = 0.; // Pilot stuff for GUI. extern Pilot** pilot_stack; @@ -442,6 +443,18 @@ void player_render(void) { else gl_print(NULL, x, y, NULL, "%s", msg_stack[msg_max-i-1].str); } } + // Hyperspace FLASH BANG!!! + if(pilot_isFlag(player, PILOT_HYPERSPACE)) { + x = 1. - (double)(player->ptimer - SDL_GetTicks()) / HYPERSPACE_FLY_DELAY; + glColor4d(1.,1.,1.,pow(x,16)); // We'll | I'll, make this more effiecent later. + glBegin(GL_QUADS); + glVertex2d(-gl_screen.w/2., -gl_screen.h/2.); + glVertex2d(-gl_screen.w/2., gl_screen.h/2.); + glVertex2d( gl_screen.w/2., gl_screen.h/2.); + glVertex2d( gl_screen.w/2., -gl_screen.h/2.); + + glEnd(); + } } // Renders a pilot. @@ -945,6 +958,9 @@ void player_brokeHyperspace(void) { // Stop hyperspace. pilot_rmFlag(player, PILOT_HYPERSPACE | PILOT_HYP_BEGIN | PILOT_HYP_PREP); + + // Done with that flash thingy. + hyperspace_flash = 0.; } // Take a screenshot.