X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=battle.c;h=d8dce472a4d38367118265a5b1b3d96c008a12b2;hb=25f154a67f40eac351dd69368af471bf5d27a153;hp=845aa832937bcd98f2fd2c2052ce6aacceba8fed;hpb=ba71f219a8543b5510a53c59ce793339b84903a7;p=super-star-trek.git diff --git a/battle.c b/battle.c index 845aa83..d8dce47 100644 --- a/battle.c +++ b/battle.c @@ -1,8 +1,6 @@ -#ifdef SERGEEV -#include #include +#include "conio.h" #include "sstlinux.h" -#endif /* SERGEEV */ #include "sst.h" void doshield(int i) { @@ -178,10 +176,8 @@ 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 l, iquad=0, ix=0, iy=0, jx=0, jy=0, shoved=0, ll; -#ifdef SERGEEV int crx,cry; -#endif /* SERGEEV */ double ac=course + 0.25*r; double angle = (15.0-ac)*0.5235988; double bullseye = (15.0 - course)*0.5235988; @@ -192,12 +188,10 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait) { if (fabs(deltay) > bigger) bigger = fabs(deltay); deltax /= bigger; deltay /= bigger; -#ifdef SERGEEV crx=wherex(); cry=wherey(); - if (game.damage[DSRSENS]==0 || condit==IHDOCKED) setwnd(1); - else setwnd(4); -#endif /* SERGEEV */ + if (game.damage[DSRSENS]==0 || condit==IHDOCKED) setwnd(LEFTUPPER_WINDOW); + else setwnd(LOWER_WINDOW); /* Loop to move a single torpedo */ for (l=1; l <= 15; l++) { x += deltax; @@ -206,12 +200,11 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait) { y += deltay; iy = y + 0.5; if (iy < 1 || iy > 10) break; + iquad=game.quad[ix][iy]; #ifndef SERGEEV if (l==4 || l==9) skip(1); proutn("%d - %d ", (int)x, (int)y); - iquad=game.quad[ix][iy]; #else - iquad=game.quad[ix][iy]; if (game.damage[DSRSENS]==0 || condit==IHDOCKED){ drawmaps(2); delay((wait!=1)*400); @@ -243,12 +236,8 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait) { #endif /* SERGEEV */ if (iquad==IHDOT) continue; /* hit something */ -#ifndef SERGEEV - skip(1); -#else - setwnd(4); + setwnd(LOWER_WINDOW); gotoxy(crx,cry); -#endif switch(iquad) { case IHE: /* Hit our ship */ case IHF: @@ -260,9 +249,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait) { 1000.0*sqrt(square(ix-inx)+square(iy-iny))* fabs(sin(bullseye-angle)); *hit = fabs(*hit); -#ifndef SERGEEV - newcnd(); /* undock */ -#endif /* SERGEEV */ + newcnd(); /* we're blown out of dock */ /* We may be displaced. */ if (landed==1 || condit==IHDOCKED) return; /* Cheat if on a planet */ ang = angle + 2.5*(Rand()-0.5); @@ -450,12 +437,10 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait) { } break; } -#ifdef SERGEEV - if(curwnd!=4) { - setwnd(4); + if(curwnd!=LOWER_WINDOW) { + setwnd(LOWER_WINDOW); gotoxy(crx,cry); } -#endif /* SERGEEV */ if (shoved) { game.quad[jx][jy]=iquad; game.quad[ix][iy]=IHDOT; @@ -465,9 +450,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait) { sortkl(); return; } -#ifndef SERGEEV skip(1); -#endif /* SERGEEV */ prout("Torpedo missed."); return; } @@ -654,9 +637,7 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy) { int i,j; -#ifdef SERGEEV skip(1); -#endif /* SERGEEV */ crmena(1, type, 2, ixx, iyy); /* Decide what kind of enemy it is and update approriately */ if (type == IHR) { @@ -1234,9 +1215,6 @@ void phasers(void) { void hittem(double *hits) { double kp, kpow, wham, hit, dustfac, kpini; -#ifdef SERGEEV - int cx, cy; -#endif /* SERGEEV */ int nenhr2=nenhere, k=1, kk=1, ii, jj, ienm; skip(1); @@ -1254,10 +1232,11 @@ void hittem(double *hits) { jj = game.ky[kk]; if (hit > 0.005) { #ifdef SERGEEV + int crx, cry; if (game.damage[DSRSENS]==0){ crx=wherex(); cry=wherey(); - setwnd(1); + setwnd(LEFTUPPER_WINDOW); drawmaps(2); gotoxy(jj*2+3,ii+2); highvideo(); @@ -1268,7 +1247,7 @@ void hittem(double *hits) { nosound(); lowvideo(); proutn("%c", game.quad[ii][jj]); - setwnd(4); + setwnd(LOWER_WINDOW); gotoxy(crx,cry); _setcursortype(_NORMALCURSOR); delay(500);