X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=battle.c;h=15ff3b316b51a235eaf50ca916994fd3756f1e20;hb=d7ddf0df59133fd0ff3f49d0ed83079e3a695aeb;hp=5389821ab5d3dd048a2867eeaaa83b9a265b1fea;hpb=a67634b9dc32d47cba5f75341bff2349d9ebbbcf;p=super-star-trek.git diff --git a/battle.c b/battle.c index 5389821..15ff3b3 100644 --- a/battle.c +++ b/battle.c @@ -1,5 +1,4 @@ #include -#include "conio.h" #include "sst.h" void doshield(int i) { @@ -175,7 +174,6 @@ void ram(int ibumpd, int ienm, int ix, int iy) { void torpedo(double course, double r, int inx, int iny, double *hit, int wait, int i, int n) { int l, iquad=0, ix=0, iy=0, jx=0, jy=0, shoved=0, ll; - int crx,cry; double ac=course + 0.25*r; double angle = (15.0-ac)*0.5235988; @@ -187,25 +185,25 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i if (fabs(deltay) > bigger) bigger = fabs(deltay); deltax /= bigger; deltay /= bigger; - crx=wherex(); - cry=wherey(); - if (game.damage[DSRSENS]==0 || condit==IHDOCKED) setwnd(LEFTUPPER_WINDOW); - else setwnd(LOWER_WINDOW); + if (game.damage[DSRSENS]==0 || condit==IHDOCKED) + setwnd(srscan_window); + else + setwnd(message_window); /* Loop to move a single torpedo */ for (l=1; l <= 15; l++) { x += deltax; ix = x + 0.5; - if (ix < 1 || ix > 10) break; + if (ix < 1 || ix > QUADSIZE) break; y += deltay; iy = y + 0.5; - if (iy < 1 || iy > 10) break; + if (iy < 1 || iy > QUADSIZE) break; iquad=game.quad[ix][iy]; tracktorpedo(x, y, ix, iy, wait, l, i, n, iquad); wait = 1; if (iquad==IHDOT) continue; /* hit something */ - setwnd(LOWER_WINDOW); - gotoxy(crx,cry); + setwnd(message_window); + skip(1); /* start new line after text track */ switch(iquad) { case IHE: /* Hit our ship */ case IHF: @@ -227,7 +225,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i yy = cos(ang)/temp; jx=ix+xx+0.5; jy=iy+yy+0.5; - if (jx<1 || jx>10 || jy<1 ||jy > 10) return; + if (jx<1 || jx>QUADSIZE || jy<1 ||jy > QUADSIZE) return; if (game.quad[jx][jy]==IHBLANK) { finish(FHOLE); return; @@ -275,7 +273,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i yy = cos(ang)/temp; jx=ix+xx+0.5; jy=iy+yy+0.5; - if (jx<1 || jx>10 || jy<1 ||jy > 10) { + if (jx<1 || jx>QUADSIZE || jy<1 ||jy > QUADSIZE) { prout(" damaged but not destroyed."); return; } @@ -322,7 +320,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i plnetx = plnety = 0; game.quad[ix][iy] = IHDOT; if (landed==1) { - /* captain parishes on planet */ + /* captain perishes on planet */ finish(FDPLANET); } return; @@ -400,9 +398,8 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i } break; } - if(curwnd!=LOWER_WINDOW) { - setwnd(LOWER_WINDOW); - gotoxy(crx,cry); + if(curwnd!=message_window) { + setwnd(message_window); } if (shoved) { game.quad[jx][jy]=iquad; @@ -681,7 +678,7 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy) { static int targetcheck(double x, double y, double *course) { double deltx, delty; /* Return TRUE if target is invalid */ - if (x < 1.0 || x > 10.0 || y < 1.0 || y > 10.0) { + if (x < 1.0 || x > QUADSIZE || y < 1.0 || y > QUADSIZE) { huh(); return 1; }