[Add] Perfected hyperspace visuals. ^.^
This commit is contained in:
parent
409dbff310
commit
45d75779dd
@ -9,8 +9,10 @@
|
||||
|
||||
#define PLAYER_ID 1
|
||||
|
||||
#define HYPERSPACE_FLY_DELAY 5000
|
||||
#define HYPERSPACE_ENGINE_DELAY 3000
|
||||
#define HYPERSPACE_ENGINE_DELAY 3000 // Warm up the engines.
|
||||
#define HYPERSPACE_FLY_DELAY 5000 // Time taken to hyperspace.
|
||||
#define HYPERSPACE_STARS_BLUR 3000 // Time stars blur.
|
||||
#define HYPERSPACE_FADEOUT 1000 // Time fadeout.
|
||||
|
||||
// Aproximation for pilot size.
|
||||
#define PILOT_SIZE_APROX 0.8
|
||||
|
@ -476,11 +476,11 @@ void player_render(void) {
|
||||
}
|
||||
// Hyperspace FLASH BANG!!!
|
||||
if(pilot_isFlag(player, PILOT_HYPERSPACE)) {
|
||||
i = (int)player->ptimer - HYPERSPACE_FLY_DELAY/4.;
|
||||
i = (int)player->ptimer - HYPERSPACE_FADEOUT;
|
||||
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.
|
||||
x = (double)(j-i) / HYPERSPACE_FADEOUT;
|
||||
glColor4d(1.,1.,1., x); // 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.);
|
||||
|
39
src/space.c
39
src/space.c
@ -521,10 +521,42 @@ int space_load(void) {
|
||||
// Render the system. -- Just playing god now.
|
||||
void space_render(double dt) {
|
||||
int i;
|
||||
unsigned int t, timer;
|
||||
double x, y, m;
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix(); // Translation matrix.
|
||||
glTranslated(-(double)gl_screen.w/2., -(double)gl_screen.h/2., 0);
|
||||
|
||||
t = SDL_GetTicks();
|
||||
timer = player->ptimer - HYPERSPACE_STARS_BLUR;
|
||||
if(pilot_isFlag(player, PILOT_HYPERSPACE) && (timer < t)) {
|
||||
// Fancy hyperspace effects.
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
|
||||
// Lines will be based on velocity.
|
||||
m = 250*(double)(t-timer)/(HYPERSPACE_STARS_BLUR);
|
||||
x = m*cos(VANGLE(player->solid->vel)+M_PI);
|
||||
y = m*sin(VANGLE(player->solid->vel)+M_PI);
|
||||
|
||||
for(i = 0; i < nstars; i++) {
|
||||
glColor4d(1., 1., 1., stars[i].brightness);
|
||||
glVertex2d(stars[i].x, stars[i].y);
|
||||
glColor4d(1., 1., 1., 0.);
|
||||
glVertex2d(stars[i].x + x*stars[i].brightness, stars[i].y + y*stars[i].brightness);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
} else {
|
||||
glBegin(GL_POINTS);
|
||||
|
||||
for(i = 0; i < nstars; i++) {
|
||||
if(!paused && !toolkit) {
|
||||
// Update the position.
|
||||
// Update position.
|
||||
stars[i].x -= VX(player->solid->vel)/(13.-10.*stars[i].brightness)*dt;
|
||||
stars[i].y -= VY(player->solid->vel)/(13.-10.*stars[i].brightness)*dt;
|
||||
// Scroll those stars bitch!
|
||||
@ -535,11 +567,12 @@ void space_render(double dt) {
|
||||
}
|
||||
// Render.
|
||||
glColor4d(1., 1., 1., stars[i].brightness);
|
||||
glVertex2d(stars[i].x - (double)gl_screen.w/2.,
|
||||
stars[i].y - (double)gl_screen.h/2.);
|
||||
glVertex2d(stars[i].x, stars[i].y);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glPopMatrix(); // Translation matrix.
|
||||
}
|
||||
|
||||
// Render the planets.
|
||||
void planets_render(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user