[Change] Improved transition into hyperspace a little.
This commit is contained in:
parent
44c6ea6ed6
commit
b2a887ba45
23
src/pilot.c
23
src/pilot.c
@ -275,13 +275,24 @@ static void pilot_hyperspace(Pilot* p) {
|
|||||||
pilot_setFlag(p, PILOT_HYPERSPACE);
|
pilot_setFlag(p, PILOT_HYPERSPACE);
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if(ABS(diff) < MAX_DIR_ERR) {
|
||||||
// We can now prepare the jump.
|
// We should prepare for the jump now.
|
||||||
p->solid->dir_vel = 0.;
|
p->solid->dir_vel = 0.;
|
||||||
p->ptimer = SDL_GetTicks() + HYPERSPACE_ENGINE_DELAY;
|
p->ptimer = SDL_GetTicks() + HYPERSPACE_ENGINE_DELAY;
|
||||||
pilot_setFlag(p, PILOT_HYP_BEGIN);
|
pilot_setFlag(p, PILOT_HYP_BEGIN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ int space_canHyperspace(Pilot* p) {
|
|||||||
int space_hyperspace(Pilot* p) {
|
int space_hyperspace(Pilot* p) {
|
||||||
if(!space_canHyperspace(p)) return -1;
|
if(!space_canHyperspace(p)) return -1;
|
||||||
// Too fast.
|
// 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 is now going to get automatically ready for hyperspace.
|
||||||
pilot_setFlag(p, PILOT_HYP_PREP);
|
pilot_setFlag(p, PILOT_HYP_PREP);
|
||||||
@ -527,8 +527,8 @@ void space_render(double dt) {
|
|||||||
for(i = 0; i < nstars; i++) {
|
for(i = 0; i < nstars; i++) {
|
||||||
if(!paused && !toolkit) {
|
if(!paused && !toolkit) {
|
||||||
// Update the position.
|
// Update the position.
|
||||||
stars[i].x -= VX(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)/(15.-10.*stars[i].brightness)*dt;
|
stars[i].y -= VY(player->solid->vel)/(13.-10.*stars[i].brightness)*dt;
|
||||||
// Scroll those stars bitch!
|
// Scroll those stars bitch!
|
||||||
if(stars[i].x > gl_screen.w + STAR_BUF) stars[i].x = -STAR_BUF;
|
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;
|
else if(stars[i].x < -STAR_BUF) stars[i].x = gl_screen.w + STAR_BUF;
|
||||||
|
Loading…
Reference in New Issue
Block a user