[Change] Improved hyperspace transition.

This commit is contained in:
Allanis 2013-02-26 17:54:51 +00:00
parent a10931b7b6
commit 409dbff310

View File

@ -43,7 +43,6 @@ unsigned int player_target = PLAYER_ID; // Targetted pilot.
static int planet_target = -1; // Targetted planet. static int planet_target = -1; // Targetted planet.
// Internal. // Internal.
static int hyperspace_target = -1; // Target hyperspace route. static int hyperspace_target = -1; // Target hyperspace route.
static double hyperspace_flash = 0.;
// Pilot stuff for GUI. // Pilot stuff for GUI.
extern Pilot** pilot_stack; extern Pilot** pilot_stack;
@ -477,8 +476,11 @@ void player_render(void) {
} }
// Hyperspace FLASH BANG!!! // Hyperspace FLASH BANG!!!
if(pilot_isFlag(player, PILOT_HYPERSPACE)) { if(pilot_isFlag(player, PILOT_HYPERSPACE)) {
x = 1. - (double)(player->ptimer - SDL_GetTicks()) / HYPERSPACE_FLY_DELAY; i = (int)player->ptimer - HYPERSPACE_FLY_DELAY/4.;
glColor4d(1.,1.,1.,pow(x,16)); // We'll | I'll, make this more effiecent later. j = (int)SDL_GetTicks();
if(i < j) {
x = (double)(j-i) / (HYPERSPACE_FLY_DELAY/4.);
glColor4d(1.,1.,1.,pow(x,4)); // We'll | I'll, make this more effiecent later.
glBegin(GL_QUADS); 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.);
@ -487,6 +489,7 @@ void player_render(void) {
glEnd(); glEnd();
} }
} }
}
// Renders a pilot. // Renders a pilot.
static void gui_renderPilot(const Pilot* p) { static void gui_renderPilot(const Pilot* p) {
@ -991,9 +994,7 @@ void player_brokeHyperspace(void) {
// Stop hyperspace. // Stop hyperspace.
pilot_rmFlag(player, PILOT_HYPERSPACE | PILOT_HYP_BEGIN | PILOT_HYP_PREP); pilot_rmFlag(player, PILOT_HYPERSPACE | PILOT_HYP_BEGIN | PILOT_HYP_PREP);
// Done with that flash thingy.
player_message("BANG!"); player_message("BANG!");
hyperspace_flash = 0.;
} }
// Take a screenshot. // Take a screenshot.