ientesc=0;
isatb=0;
game.future[FSCMOVE]=0.2777+game.state.date;
- game.future[FSCDBAS]=1e30;
+ game.future[FSCDBAS]=FOREVER;
game.state.isx=iqx;
game.state.isy=iqy;
}
isatb=0;
ishere=0;
ientesc=0;
- game.future[FSCDBAS]=1e30;
+ game.future[FSCDBAS]=FOREVER;
for_local_enemies(i)
if (game.quad[game.kx[i]][game.ky[i]] == IHS) break;
game.quad[game.kx[i]][game.ky[i]] = IHDOT;
/* compute distances to starbases */
if (game.state.rembase <= 0) {
/* nothing left to do */
- game.future[FSCMOVE] = 1e30;
+ game.future[FSCMOVE] = FOREVER;
return;
}
sx = game.state.isx;
}
/* check for a base */
if (game.state.rembase == 0) {
- game.future[FSCMOVE] = 1e30;
+ game.future[FSCMOVE] = FOREVER;
}
else for_starbases(i) {
ibqx = game.state.baseqx[i];
iseenit = 0;
isatb=1;
game.future[FSCDBAS] = game.state.date + 1.0 +2.0*Rand();
- if (game.future[FCDBAS] < 1e30) game.future[FSCDBAS] +=
+ if (game.future[FCDBAS] < FOREVER) game.future[FSCDBAS] +=
game.future[FCDBAS]-game.state.date;
if (game.damage[DRADIO] > 0 && condit != IHDOCKED)
return; /* no warning */
return;
}
-void torpedo(double course, double r, int inx, int iny, double *hit, int wait, int i, int n)
+void torpedo(double course, double r, int inx, int iny, double *hit, int i, int n)
{
int l, iquad=0, ix=0, iy=0, jx=0, jy=0, shoved=0, ll;
iy = y + 0.5;
if (!VALID_SECTOR(ix, iy)) break;
iquad=game.quad[ix][iy];
- tracktorpedo(x, y, ix, iy, wait, l, i, n, iquad);
- wait = 1;
+ tracktorpedo(ix, iy, l, i, n);
if (iquad==IHDOT) continue;
/* hit something */
setwnd(message_window);
prout(" ");
r = (Rand()+Rand())*0.5 -0.5;
r += 0.002*game.kpower[l]*r;
- torpedo(course, r, jx, jy, &hit, 0, 1, 1);
+ torpedo(course, r, jx, jy, &hit, 1, 1);
if (game.state.remkl==0)
finish(FWON); /* Klingons did themselves in! */
if (game.state.galaxy[quadx][quady].supernova || alldone)
game.state.cx[game.state.remcom] = 0;
game.state.cy[game.state.remcom] = 0;
game.state.remcom--;
- game.future[FTBEAM] = 1e30;
+ game.future[FTBEAM] = FOREVER;
if (game.state.remcom != 0)
game.future[FTBEAM] = game.state.date + expran(1.0*incom/game.state.remcom);
game.state.killc++;
case IHS:
game.state.nscrem = ishere = game.state.isx = game.state.isy = isatb = iscate = 0;
game.state.nsckill = 1;
- game.future[FSCMOVE] = game.future[FSCDBAS] = 1e30;
+ game.future[FSCMOVE] = game.future[FSCDBAS] = FOREVER;
break;
}
}
game.state.remtime = game.state.remres/(game.state.remkl + 4*game.state.remcom);
/* Remove enemy ship from arrays describing local conditions */
- if (game.future[FCDBAS] < 1e30 && batx==quadx && baty==quady && type==IHC)
- game.future[FCDBAS] = 1e30;
+ if (game.future[FCDBAS] < FOREVER && batx==quadx && baty==quady && type==IHC)
+ game.future[FCDBAS] = FOREVER;
for_local_enemies(i)
if (game.kx[i]==ix && game.ky[i]==iy) break;
nenhere--;
}
if (shldup || condit == IHDOCKED)
r *= 1.0 + 0.0001*shield;
- torpedo(course[i], r, sectx, secty, &dummy, 0, i, n);
+ torpedo(course[i], r, sectx, secty, &dummy, i, n);
if (alldone || game.state.galaxy[quadx][quady].supernova)
return;
}
if (game.options & OPTION_CURSES) {
if (l == 1)
sensor();
+ setwnd(srscan_window);
+ wmove(curwnd, 0, 0);
+ enqueue("no");
+ srscan(SCAN_FULL);
if (l != 2) {
- setwnd(srscan_window);
- wmove(curwnd, 0, 0);
- enqueue("no");
- srscan(SCAN_FULL);
setwnd(report_window);
wclear(report_window);
wmove(report_window, 0, 0);
}
}
+static void put_srscan_sym(int x, int y, char sym)
+{
+ wmove(srscan_window, x+1, y*2+2);
+ waddch(srscan_window, sym);
+ wrefresh(srscan_window);
+}
+
void boom(int ii, int jj)
/* enemy fall down, go boom */
{
if (game.options & OPTION_CURSES) {
- setwnd(srscan_window);
drawmaps(2);
- wmove(srscan_window, ii*2+3, jj+2);
+ setwnd(srscan_window);
wattron(srscan_window, A_REVERSE);
- waddch(srscan_window, game.quad[ii][jj]);
- wrefresh(srscan_window);
+ put_srscan_sym(ii, jj, game.quad[ii][jj]);
sound(500);
delay(1000);
nosound();
- wmove(srscan_window, ii*2+3, jj+2);
wattroff(srscan_window, A_REVERSE);
- waddch(srscan_window, game.quad[ii][jj]);
- wrefresh(srscan_window);
- setwnd(message_window);
+ put_srscan_sym(ii, jj, game.quad[ii][jj]);
delay(500);
+ setwnd(message_window);
}
}
prouts(" . . . . . ");
}
-void tracktorpedo(int x, int y, int ix, int iy, int wait, int l, int i, int n, int iquad)
+void tracktorpedo(int ix, int iy, int l, int i, int n)
/* torpedo-track animation */
{
if (!game.options & OPTION_CURSES) {
}
} else if (l==4 || l==9)
skip(1);
- proutn("%d - %d ", (int)x, (int)y);
+ proutn("%d - %d ", ix, iy);
} else {
if (game.damage[DSRSENS]==0 || condit==IHDOCKED) {
- drawmaps(2);
- delay((wait!=1)*400);
- if ((game.quad[ix][iy]==IHDOT)||(game.quad[ix][iy]==IHBLANK)){
- game.quad[ix][iy]='+';
+ if (i != 1 && l == 1) {
drawmaps(2);
- game.quad[ix][iy]=iquad;
+ delay(400);
+ }
+ if ((game.quad[ix][iy]==IHDOT)||(game.quad[ix][iy]==IHBLANK)){
+ put_srscan_sym(ix, iy, '+');
sound(l*10);
delay(100);
nosound();
+ put_srscan_sym(ix, iy, game.quad[ix][iy]);
}
else {
- game.quad[ix][iy] |= DAMAGED;
- drawmaps(2);
- game.quad[ix][iy]=iquad;
+ wattron(curwnd, A_REVERSE);
+ put_srscan_sym(ix, iy, game.quad[ix][iy]);
sound(500);
delay(1000);
nosound();
wattroff(curwnd, A_REVERSE);
+ put_srscan_sym(ix, iy, game.quad[ix][iy]);
}
} else {
- proutn("%d - %d ", (int)x, (int)y);
+ proutn("%d - %d ", ix, iy);
}
}
}
}
#endif
// asave = future[FSNOVA];
-// future[FSNOVA] = 1e30; /* defer supernovas */
+// future[FSNOVA] = FOREVER; /* defer supernovas */
events(); /* Used to avoid if future[FSCMOVE] within time */
// future[FSNOVA] = asave;
/*fails if game over, quadrant super-novas or we've moved to new quadrant*/
if (game.quad[i][j] != ship)
highvideo();
}
- if (game.quad[i][j] & DAMAGED)
- highvideo();
- proutn("%c ",game.quad[i][j] & ~DAMAGED);
+ proutn("%c ",game.quad[i][j]);
textcolor(DEFAULT);
}
else
else
prout(" [Using Base's sensors]");
}
- else proutn(" Short-range scan\n");
+ else proutn(" Short-range scan");
if (goodScan && !game.damage[DRADIO]) {
game.state.chart[quadx][quady].klingons = game.state.galaxy[quadx][quady].klingons;
game.state.chart[quadx][quady].starbase = game.state.galaxy[quadx][quady].starbase;
void deadkl(int, int, int, int, int);
void timwrp(void);
void movcom(void);
-void torpedo(double, double, int, int, double *, int, int, int);
+void torpedo(double, double, int, int, double *, int, int);
void huh(void);
void pause_game(int);
void nova(int, int);
void setwnd(WINDOW *);
void warble(void);
void boom(int ii, int jj);
-void tracktorpedo(int x, int y, int ix, int iy, int wait, int l, int i, int n, int iquad);
+void tracktorpedo(int ix, int iy, int l, int i, int n);
void cgetline(char *, int);
void waitfor(void);
void setpassword(void);