X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=planets.c;h=a45879f05c8adf225ea236fec6150810117b8eb2;hp=b95761f0e48dfb3fdeec94efcd16e9476c741cbc;hb=2a0411c349010501abd2f907b8965a8ca9b4e80c;hpb=48763357ef69f0b711fc332b13e2170ab914d881 diff --git a/planets.c b/planets.c index b95761f..a45879f 100644 --- a/planets.c +++ b/planets.c @@ -1,8 +1,9 @@ #include "sst.h" -static char classes[4][2]={"","M","N","O"}; static int height; +static char *classes[] = {"M","N","O"}; + static int consumeTime(void) { /* I think most of this avoidance was caused by overlay scheme. Let's see what happens if all events can occur here */ @@ -31,23 +32,23 @@ void preport(void) { chew(); prout("Spock- \"Planet report follows, Captain.\""); skip(1); - for (i = 1; i <= inplan; i++) { - if (game.state.plnets[i].known + for (i = 0; i < inplan; i++) { + if (game.state.plnets[i].known != unknown #ifdef DEBUG || ( idebug && game.state.plnets[i].x !=0) #endif ) { iknow = 1; #ifdef DEBUG - if (idebug && game.state.plnets[i].known==0) proutn("(Unknown) "); + if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) "); #endif - cramlc(1, game.state.plnets[i].x, game.state.plnets[i].y); + proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y)); proutn(" class "); proutn(classes[game.state.plnets[i].pclass]); proutn(" "); if (game.state.plnets[i].crystals == 0) proutn("no "); prout("dilithium crystals present."); - if (game.state.plnets[i].known==2) + if (game.state.plnets[i].known==shuttle_down) prout(" Shuttle Craft Galileo on surface."); } } @@ -77,9 +78,8 @@ void orbit(void) { prout("Helmsman Sulu- \"Entering standard orbit, Sir.\""); newcnd(); if (consumeTime()) return; - proutn("Sulu- \"Entered orbit at altitude "); - cramf(height = (1400.+7200.*Rand()), 0, 2); - prout(" kilometers.\""); + height = (1400.+7200.*Rand()); + prout("Sulu- \"Entered orbit at altitude %.2f kilometers.\"", height); inorbit = 1; return; } @@ -95,21 +95,17 @@ void sensor(void) { prout("No planet in this quadrant."); return; } - proutn("Spock- \"Sensor scan for"); - cramlc(1, quadx, quady); - prout("-"); + prout("Spock- \"Sensor scan for %s-", cramlc(quadrant, quadx, quady)); skip(1); - proutn(" Planet at"); - cramlc(2, plnetx, plnety); - proutn(" is of class "); - proutn(classes[game.state.plnets[iplnet].pclass]); - prout("."); - if (game.state.plnets[iplnet].known==2) + prout(" Planet at %s is of class %s.", + cramlc(sector, plnetx, plnety), + classes[game.state.plnets[iplnet].pclass]); + if (game.state.plnets[iplnet].known==shuttle_down) prout(" Sensors show Galileo still on surface."); proutn(" Readings indicate"); if (game.state.plnets[iplnet].crystals == 0) proutn(" no"); prout(" dilithium crystals present.\""); - if (game.state.plnets[iplnet].known == 0) game.state.plnets[iplnet].known = 1; + if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known; return; } @@ -118,7 +114,7 @@ void beam(void) { skip(1); if (game.damage[DTRANSP] != 0) { prout("Transporter damaged."); - if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==2 || iscraft == 1)) { + if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) { skip(1); prout("Spock- \"May I suggest the shuttle craft, Sir?\" "); if (ja() != 0) shuttle(); @@ -134,7 +130,7 @@ void beam(void) { prout("Impossible to transport through shields."); return; } - if (game.state.plnets[iplnet].known==0) { + if (game.state.plnets[iplnet].known==unknown) { prout("Spock- \"Captain, we have no information on this planet"); prout(" and Starfleet Regulations clearly state that in this situation"); prout(" you may not go down.\""); @@ -142,7 +138,7 @@ void beam(void) { } if (landed==1) { /* Coming from planet */ - if (game.state.plnets[iplnet].known==2) { + if (game.state.plnets[iplnet].known==shuttle_down) { proutn("Spock- \"Wouldn't you rather take the Galileo?\" "); if (ja() != 0) { chew(); @@ -188,7 +184,7 @@ void beam(void) { skip(2); prout("Transport complete."); landed = -landed; - if (landed==1 && game.state.plnets[iplnet].known==2) { + if (landed==1 && game.state.plnets[iplnet].known==shuttle_down) { prout("The shuttle craft Galileo is here!"); } if (landed!=1 && imine==1) { @@ -287,7 +283,7 @@ void shuttle(void) { ididit = 0; if(game.damage[DSHUTTL] != 0.0) { if (game.damage[DSHUTTL] == -1.0) { - if (inorbit && game.state.plnets[iplnet].known == 2) + if (inorbit && game.state.plnets[iplnet].known == shuttle_down) prout("Ye Faerie Queene has no shuttle craft bay to dock it at."); else prout("Ye Faerie Queene had no shuttle craft."); @@ -302,11 +298,11 @@ void shuttle(void) { prout(" not in standard orbit."); return; } - if ((game.state.plnets[iplnet].known != 2) && iscraft != 1) { + if ((game.state.plnets[iplnet].known != shuttle_down) && iscraft != 1) { prout("Shuttle craft not currently available."); return; } - if (landed==-1 && game.state.plnets[iplnet].known==2) { + if (landed==-1 && game.state.plnets[iplnet].known==shuttle_down) { prout("You will have to beam down to retrieve the shuttle craft."); return; } @@ -314,7 +310,7 @@ void shuttle(void) { prout("Shuttle craft cannot pass through shields."); return; } - if (game.state.plnets[iplnet].known==0) { + if (game.state.plnets[iplnet].known==unknown) { prout("Spock- \"Captain, we have no information on this planet"); prout(" and Starfleet Regulations clearly state that in this situation"); prout(" you may not fly down.\""); @@ -323,9 +319,8 @@ void shuttle(void) { Time = 3.0e-5*height; if (Time >= 0.8*game.state.remtime) { prout("First Officer Spock- \"Captain, I compute that such"); - prout(" a maneuver would require approximately "); - cramf(100*Time/game.state.remtime,0,4); - prout("% of our"); + proutn(" a maneuver would require approximately 2d%% of our", + (int)(100*Time/game.state.remtime)); prout("remaining time."); prout("Are you sure this is wise?\" "); if (ja()==0) { @@ -351,7 +346,7 @@ void shuttle(void) { iscraft = 0; skip(1); if (consumeTime()) return; - game.state.plnets[iplnet].known=2; + game.state.plnets[iplnet].known=shuttle_down; prout("Trip complete."); return; } @@ -361,7 +356,7 @@ void shuttle(void) { prout("shuttle craft for the trip back to the Enterprise."); skip(1); prout("The short hop begins . . ."); - game.state.plnets[iplnet].known=1; + game.state.plnets[iplnet].known=known; icraft = 1; skip(1); landed = -1; @@ -388,7 +383,7 @@ void shuttle(void) { icraft = 1; iscraft = 0; if (consumeTime()) return; - game.state.plnets[iplnet].known = 2; + game.state.plnets[iplnet].known = shuttle_down; landed = 1; icraft = 0; prout("Trip complete"); @@ -445,7 +440,7 @@ void deathray(void) { prout(" is still operational.\""); } else { - prout(" has been rendered disfunctional.\""); + prout(" has been rendered nonfunctional.\""); game.damage[DDRAY] = 39.95; } return;