[Change] Improved transition into hyperspace a little.
This commit is contained in:
parent
44c6ea6ed6
commit
b2a887ba45
17
src/pilot.c
17
src/pilot.c
@ -275,15 +275,26 @@ 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(diff < MAX_DIR_ERR) {
|
||||
// We can now prepare the jump.
|
||||
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(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==Init pilot.===========================================
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user