X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fmoving.c;h=b273c60051e0ad32c38e6afe7715a18e99fbfd53;hp=48c08a210449561ff4a81ea8f5ac9daaac619205;hb=2cae1cd3feb922843b40af851f43f9e08bb18f0d;hpb=c81e0f1dc6cd1fe5c56e9d521ee1d262932e3a2b diff --git a/src/moving.c b/src/moving.c index 48c08a2..b273c60 100644 --- a/src/moving.c +++ b/src/moving.c @@ -2,7 +2,7 @@ #include "sstlinux.h" #include "sst.h" -static void getcd(int, int); +static void getcd(bool, int); void imove(void) { @@ -14,7 +14,7 @@ void imove(void) w.x = w.y = 0; if (game.inorbit) { prout("Helmsman Sulu- \"Leaving standard orbit.\""); - game.inorbit = FALSE; + game.inorbit = false; } angle = ((15.0 - game.direc) * 0.5235988); @@ -237,7 +237,7 @@ void dock(int l) game.shield = game.inshld; game.torps = game.intorps; game.lsupres = game.inlsr; - if (game.damage[DRADIO] == 0.0 && + if (!damaged(DRADIO) && (is_scheduled(FCDBAS) || game.isatb == 1) && game.iseenit == 0) { /* get attack report from base */ prout("Lt. Uhura- \"Captain, an important message from the starbase:\""); @@ -246,7 +246,7 @@ void dock(int l) } } -static void getcd(int isprobe, int akey) { +static void getcd(bool isprobe, int akey) { /* This program originally required input in terms of a (clock) direction and distance. Somewhere in history, it was changed to cartesian coordinates. So we need to convert. I think @@ -276,7 +276,7 @@ static void getcd(int isprobe, int akey) { return; } while (automatic == -1) { - if (game.damage[DCOMPTR]) { + if (damaged(DCOMPTR)) { if (isprobe) prout("Computer damaged; manual navigation only"); else @@ -438,7 +438,7 @@ void impuls(void) double power; game.ididit = 0; - if (game.damage[DIMPULS]) { + if (damaged(DIMPULS)) { chew(); skip(1); prout("Engineer Scott- \"The impulse engines are damaged, Sir.\""); @@ -446,7 +446,7 @@ void impuls(void) } if (game.energy > 30.0) { - getcd(FALSE, 0); + getcd(false, 0); if (game.direc == -1.0) return; power = 20.0 + 100.0*game.dist; } @@ -489,12 +489,12 @@ void impuls(void) } -void warp(int i) +void warp(bool timewarp) { int blooey=0, twarp=0, iwarp; double power; - if (i!=2) { /* Not WARPX entry */ + if (!timewarp) { /* Not WARPX entry */ game.ididit = 0; if (game.damage[DWARPEN] > 10.0) { chew(); @@ -502,7 +502,7 @@ void warp(int i) prout("Engineer Scott- \"The impulse engines are damaged, Sir.\""); return; } - if (game.damage[DWARPEN] > 0.0 && game.warpfac > 4.0) { + if (damaged(DWARPEN) && game.warpfac > 4.0) { chew(); skip(1); prout("Engineer Scott- \"Sorry, Captain. Until this damage"); @@ -511,7 +511,7 @@ void warp(int i) } /* Read in course and distance */ - getcd(FALSE, 0); + getcd(false, 0); if (game.direc == -1.0) return; /* Make sure starship has enough energy for the trip */ @@ -523,7 +523,7 @@ void warp(int i) game.ididit = 0; skip(1); prout("Engineering to bridge--"); - if (game.shldup==0 || 0.5*power > game.energy) { + if (!game.shldup || 0.5*power > game.energy) { iwarp = pow((game.energy/(game.dist+0.05)), 0.333333333); if (iwarp <= 0) { prout("We can't do it, Captain. We haven't the energy."); @@ -565,13 +565,11 @@ void warp(int i) } /* Decide if time warp will occur */ if (0.5*game.dist*pow(7.0,game.warpfac-10.0) > Rand()) twarp=1; -#ifdef DEBUG - if (game.idebug &&game.warpfac==10 && twarp==0) { + if (idebug && game.warpfac==10 && twarp==0) { blooey=0; - proutn("Force time warp? "); + proutn("=== Force time warp? "); if (ja()==1) twarp=1; } -#endif if (blooey || twarp) { /* If time warp or engine damage, check path */ /* If it is obstructed, don't do warp or damage */ @@ -643,7 +641,7 @@ void setwrp(void) prout("Warp engines inoperative."); return; } - if (game.damage[DWARPEN] > 0.0 && aaitem > 4.0) { + if (damaged(DWARPEN) && aaitem > 4.0) { prout("Engineer Scott- \"I'm doing my best, Captain,"); prout(" but right now we can only go warp 4.\""); return; @@ -683,7 +681,7 @@ void atover(int igrab) chew(); /* is captain on planet? */ if (game.landed==1) { - if (game.damage[DTRANSP]) { + if (damaged(DTRANSP)) { finish(FPNOVA); return; } @@ -733,10 +731,10 @@ void atover(int igrab) crmshp(); skip(1); prout("safely out of quadrant."); - if (game.damage[DRADIO] == 0.0) - game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = TRUE; + if (!damaged(DRADIO)) + game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true; /* Try to use warp engines */ - if (game.damage[DWARPEN]) { + if (damaged(DWARPEN)) { skip(1); prout("Warp engines damaged."); finish(FSNOVAED); @@ -751,10 +749,10 @@ void atover(int igrab) if (distreq < game.dist) game.dist = distreq; game.optime = 10.0*game.dist/game.wfacsq; game.direc = 12.0*Rand(); /* How dumb! */ - game.justin = 0; - game.inorbit = 0; - warp(2); - if (game.justin == 0) { + game.justin = false; + game.inorbit = false; + warp(true); + if (!game.justin) { /* This is bad news, we didn't leave quadrant. */ if (game.alldone) return; skip(1); @@ -843,7 +841,7 @@ void probe(void) prout("Ye Faerie Queene has no deep space probes."); return; } - if (game.damage[DDSP] != 0.0) { + if (damaged(DDSP)) { chew(); skip(1); prout("Engineer Scott- \"The probe launcher is damaged, Sir.\""); @@ -852,7 +850,7 @@ void probe(void) if (is_scheduled(FDSPROB)) { chew(); skip(1); - if (game.damage[DRADIO] != 0 && game.condit != IHDOCKED) { + if (damaged(DRADIO) && game.condit != IHDOCKED) { prout("Spock- \"Records show the previous probe has not yet"); prout(" reached its destination.\""); } @@ -869,16 +867,16 @@ void probe(void) if (ja()==0) return; } - game.isarmed = FALSE; + game.isarmed = false; if (key == IHALPHA && strcmp(citem,"armed") == 0) { - game.isarmed = TRUE; + game.isarmed = true; key = scan(); } else if (key == IHEOL) { proutn("Arm NOVAMAX warhead? "); game.isarmed = ja(); } - getcd(TRUE, key); + getcd(true, key); if (game.direc == -1.0) return; game.nprobes--; angle = ((15.0 - game.direc) * 0.5235988); @@ -913,7 +911,7 @@ void mayday(void) prout("Lt. Uhura- \"But Captain, we're already docked.\""); return; } - if (game.damage[DRADIO] != 0) { + if (damaged(DRADIO)) { prout("Subspace radio damaged."); return; } @@ -943,8 +941,7 @@ void mayday(void) } } /* Since starbase not in quadrant, set up new quadrant */ - game.quadrant.x = game.state.baseq[line].x; - game.quadrant.y = game.state.baseq[line].y; + game.quadrant = game.state.baseq[line]; newqad(1); } /* dematerialize starship */