[Add] Fuel is now used ingame.
This commit is contained in:
parent
b4d3bb72a8
commit
960017f2f9
@ -15,6 +15,7 @@
|
||||
#define HYPERSPACE_STARS_BLUR 2000 // Time stars blur.
|
||||
#define HYPERSPACE_STARS_LENGTH 1000 // Length the stars blur to at max.
|
||||
#define HYPERSPACE_FADEOUT 1000 // Time fadeout.
|
||||
#define HYPERSPACE_FUEL 100 // Amount of fuel taken.
|
||||
|
||||
// Aproximation for pilot size.
|
||||
#define PILOT_SIZE_APROX 0.8
|
||||
|
@ -603,7 +603,8 @@ void player_render(void) {
|
||||
c, "Hyperspace");
|
||||
|
||||
gl_printMid(&gl_smallFont, (int)gui.nav.w, gui.nav.x,
|
||||
gui.nav.y - 10 - gl_smallFont.h, NULL, "%s",
|
||||
gui.nav.y - 10 - gl_smallFont.h,
|
||||
NULL, "%d - %s", (int)(player->fuel) / HYPERSPACE_FUEL,
|
||||
systems_stack[cur_system->jumps[hyperspace_target]].name);
|
||||
}
|
||||
else {
|
||||
@ -1260,6 +1261,8 @@ void player_jump(void) {
|
||||
player_message("You are too close to gravity centers to initiate hyperspace.");
|
||||
else if(i == -2)
|
||||
player_message("You are moving too fast to enter hyperspace.");
|
||||
else if(i == -3)
|
||||
player_message("You do not have enough fuel to hyperspace jump.");
|
||||
else
|
||||
player_message("Preparing for hyperspace");
|
||||
}
|
||||
@ -1282,6 +1285,9 @@ void player_brokeHyperspace(void) {
|
||||
player_warp(-cos(player->solid->dir) * MIN_HYPERSPACE_DIST * 2.5,
|
||||
-sin(player->solid->dir) * MIN_HYPERSPACE_DIST * 2.5);
|
||||
|
||||
// Reduce fuel.
|
||||
player->fuel -= HYPERSPACE_FUEL;
|
||||
|
||||
// Stop hyperspace.
|
||||
pilot_rmFlag(player, PILOT_HYPERSPACE | PILOT_HYP_BEGIN | PILOT_HYP_PREP);
|
||||
|
||||
|
@ -377,6 +377,8 @@ static PlanetClass planetclass_get(const char a) {
|
||||
int space_canHyperspace(Pilot* p) {
|
||||
int i;
|
||||
double d;
|
||||
if(p->fuel < HYPERSPACE_FUEL) return 0;
|
||||
|
||||
for(i = 0; i < cur_system->nplanets; i++) {
|
||||
d = vect_dist(&p->solid->pos, &cur_system->planets[i].pos);
|
||||
if(d < MIN_HYPERSPACE_DIST)
|
||||
@ -387,6 +389,7 @@ int space_canHyperspace(Pilot* p) {
|
||||
|
||||
// Hyperspace, returns 0 if entering hyperspace, or the distance if not.
|
||||
int space_hyperspace(Pilot* p) {
|
||||
if(p->fuel < HYPERSPACE_FUEL) return -3;
|
||||
if(!space_canHyperspace(p)) return -1;
|
||||
|
||||
// Pilot is now going to get automatically ready for hyperspace.
|
||||
|
Loading…
Reference in New Issue
Block a user