diff --git a/src/pilot.c b/src/pilot.c index acc5d2d..087c2f7 100644 --- a/src/pilot.c +++ b/src/pilot.c @@ -275,13 +275,24 @@ static void pilot_hyperspace(Pilot* p) { pilot_setFlag(p, PILOT_HYPERSPACE); } } else { - double diff = pilot_face(p, VANGLE(player->solid->pos)); + // Pilot is getting ready for hyperspace. + double diff; + + if(VMOD(p->solid->vel) > MIN_VEL_ERR) { + diff = pilot_face(p, VANGLE(player->solid->vel) + M_PI); + + if(ABS(diff) < MAX_DIR_ERR) // Brake. + vect_pset(&p->solid->force, p->ship->thrust, p->solid->dir); + } else { + vectnull(&p->solid->force); // Stop accelerating. + diff = pilot_face(p, VANGLE(player->solid->pos)); - if(diff < MAX_DIR_ERR) { - // We can now prepare the jump. - p->solid->dir_vel = 0.; - p->ptimer = SDL_GetTicks() + HYPERSPACE_ENGINE_DELAY; - pilot_setFlag(p, PILOT_HYP_BEGIN); + if(ABS(diff) < MAX_DIR_ERR) { + // We should prepare for the jump now. + p->solid->dir_vel = 0.; + p->ptimer = SDL_GetTicks() + HYPERSPACE_ENGINE_DELAY; + pilot_setFlag(p, PILOT_HYP_BEGIN); + } } } } diff --git a/src/space.c b/src/space.c index 29c8ddb..dcb1ed0 100644 --- a/src/space.c +++ b/src/space.c @@ -168,7 +168,7 @@ int space_canHyperspace(Pilot* p) { int space_hyperspace(Pilot* p) { if(!space_canHyperspace(p)) return -1; // Too fast. - if(VMOD(p->solid->vel) > MAX_HYPERSPACE_VEL) return -2; + //if(VMOD(p->solid->vel) > MAX_HYPERSPACE_VEL) return -2; // Pilot is now going to get automatically ready for hyperspace. pilot_setFlag(p, PILOT_HYP_PREP); @@ -527,8 +527,8 @@ void space_render(double dt) { for(i = 0; i < nstars; i++) { if(!paused && !toolkit) { // Update the position. - stars[i].x -= VX(player->solid->vel)/(15.-10.*stars[i].brightness)*dt; - stars[i].y -= VY(player->solid->vel)/(15.-10.*stars[i].brightness)*dt; + 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! if(stars[i].x > gl_screen.w + STAR_BUF) stars[i].x = -STAR_BUF; else if(stars[i].x < -STAR_BUF) stars[i].x = gl_screen.w + STAR_BUF;