X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsetup.c;h=afb9c4fbcbf533142147675c21fc72f194d0b15d;hb=188965b8e49bc7a0233258627917239b57429e77;hp=b93859ca788a2161579e3ed1fc7c5a674c349693;hpb=86f17194d065df99c2079102072cdcb1cfbc2339;p=super-star-trek.git diff --git a/src/setup.c b/src/setup.c index b93859c..afb9c4f 100644 --- a/src/setup.c +++ b/src/setup.c @@ -228,22 +228,35 @@ void setup(int needprompt) game.docfac = 0.25; for_quadrants(i) for_quadrants(j) { - game.state.galaxy[i][j].charted = 0; - game.state.galaxy[i][j].planet = NULL; - game.state.galaxy[i][j].romulans = 0; - game.state.galaxy[i][j].klingons = 0; - game.state.galaxy[i][j].starbase = 0; - game.state.galaxy[i][j].supernova = 0; + struct quadrant *quad = &game.state.galaxy[i][j]; + quad->charted = 0; + quad->planet = NULL; + quad->romulans = 0; + quad->klingons = 0; + quad->starbase = 0; + quad->supernova = 0; +#ifdef EXPERIMENTAL + quad->status = secure; +#endif /* EXPERIMENTAL */ } // Initialize times for extraneous events - game.future[FSNOVA] = game.state.date + expran(0.5 * game.intime); - game.future[FTBEAM] = game.state.date + expran(1.5 * (game.intime / game.state.remcom)); - game.future[FSNAP] = game.state.date + 1.0 + Rand(); // Force an early snapshot - game.future[FBATTAK] = game.state.date + expran(0.3*game.intime); - game.future[FCDBAS] = FOREVER; - game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : FOREVER; - game.future[FSCDBAS] = FOREVER; - game.future[FDSPROB] = FOREVER; + schedule(FSNOVA, expran(0.5 * game.intime)); + schedule(FTBEAM, expran(1.5 * (game.intime / game.state.remcom))); + schedule(FSNAP, 1.0 + Rand()); // Force an early snapshot + schedule(FBATTAK, expran(0.3*game.intime)); + unschedule(FCDBAS); + if (game.state.nscrem) + schedule(FSCMOVE, 0.2777); + else + unschedule(FSCMOVE); + unschedule(FSCDBAS); + unschedule(FDSPROB); +#ifdef EXPERIMENTAL + if (game.options & OPTION_WORLDS) + schedule(FDISTR, expran(1.0 + game.intime)); + unschedule(FENSLV); + unschedule(FREPRO); +#endif /* EXPERIMENTAL */ // Starchart is functional but we've never seen it game.lastchart = FOREVER; // Put stars in the galaxy @@ -474,7 +487,7 @@ int choose(int needprompt) // Choose game options -- added by ESR for SST2K if (scan() != IHALPHA) { chew(); - proutn("Choose your game options: "); + proutn("Choose your game style (or just press enter): "); scan(); } if (isit("plain")) { @@ -537,11 +550,20 @@ void newcnd(void) if (!game.alive) game.condit=IHDEAD; } +void newkling(int i, int *pix, int *piy) +/* drop new Klingon into current quadrant */ +{ + dropin(IHK, pix, piy); + game.kx[i] = *pix; + game.ky[i] = *piy; + game.kdist[i] = game.kavgd[i] = sqrt(square(game.sectx-*pix) + square(game.secty-*piy)); + game.kpower[i] = Rand()*150.0 +300.0 +25.0*game.skill; +} void newqad(int shutup) { int i, j, ix, iy; - planet *planhere; + struct quadrant *here; game.iattak = 1; game.justin = 1; @@ -570,25 +592,21 @@ void newqad(int shutup) for_sectors(i) for_sectors(j) game.quad[i][j] = IHDOT; + here = &game.state.galaxy[game.quadx][game.quady]; // cope with supernova - if (game.state.galaxy[game.quadx][game.quady].supernova) + if (here->supernova) return; - game.klhere = game.state.galaxy[game.quadx][game.quady].klingons; - game.irhere = game.state.galaxy[game.quadx][game.quady].romulans; + game.klhere = here->klingons; + game.irhere = here->romulans; game.nenhere = game.klhere + game.irhere; // Position Starship game.quad[game.sectx][game.secty] = game.ship; - if (game.state.galaxy[game.quadx][game.quady].klingons) { + if (here->klingons) { // Position ordinary Klingons - for (i = 1; i <= game.klhere; i++) { - dropin(IHK, &ix, &iy); - game.kx[i] = ix; - game.ky[i] = iy; - game.kdist[i] = game.kavgd[i] = sqrt(square(game.sectx-ix) + square(game.secty-iy)); - game.kpower[i] = Rand()*150.0 +300.0 +25.0*game.skill; - } + for (i = 1; i <= game.klhere; i++) + newkling(i, &ix, &iy); // If we need a commander, promote a Klingon for_commanders(i) if (game.state.cx[i]==game.quadx && game.state.cy[i]==game.quady) break; @@ -616,14 +634,13 @@ void newqad(int shutup) game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*game.skill; } // If quadrant needs a starbase, put it in - if (game.state.galaxy[game.quadx][game.quady].starbase) + if (here->starbase) dropin(IHB, &game.basex, &game.basey); // If quadrant needs a planet, put it in - planhere = game.state.galaxy[game.quadx][game.quady].planet; - if (planhere) { - game.iplnet = planhere - game.state.plnets; - if (planhere->inhabited == UNINHABITED) + if (here->planet) { + game.iplnet = here->planet - game.state.plnets; + if (here->planet->inhabited == UNINHABITED) dropin(IHP, &game.plnetx, &game.plnety); else dropin(IHW, &game.plnetx, &game.plnety); @@ -631,11 +648,11 @@ void newqad(int shutup) // Check for game.condition newcnd(); // And finally the stars - for (i = 1; i <= game.state.galaxy[game.quadx][game.quady].stars; i++) + for (i = 1; i <= here->stars; i++) dropin(IHSTAR, &ix, &iy); // Check for RNZ - if (game.irhere > 0 && game.klhere == 0 && (!planhere || planhere->inhabited == UNINHABITED)) { + if (game.irhere > 0 && game.klhere == 0 && (!here->planet || here->planet->inhabited == UNINHABITED)) { game.neutz = 1; if (game.damage[DRADIO] <= 0.0) { skip(1);