From: Eric S. Raymond Date: Fri, 28 Jan 2005 21:49:25 +0000 (+0000) Subject: Second round of merging Sergeev changes. X-Git-Tag: 2.0~413 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=49483a1747cd310e33eea758b32a453fb46d4aac;p=super-star-trek.git Second round of merging Sergeev changes. --- diff --git a/ai.c b/ai.c index 719c50c..ad550a1 100644 --- a/ai.c +++ b/ai.c @@ -25,7 +25,7 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) { if (game.damage[DSRSENS] == 0.0 || game.damage[DLRSENS] == 0.0 || condit == IHDOCKED) { crmena(1, ienm, 2, game.kx[loccom], game.ky[loccom]); - proutn(" escapes to %s (and regains strength).", + prout(" escapes to %s (and regains strength).", cramlc(quadrant, iqx, iqy)); } /* handle local matters related to escape */ @@ -252,9 +252,8 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) { if (game.damage[DSRSENS] == 0 || condit == IHDOCKED) { proutn("***"); cramen(ienm); - proutn(" from"); - cramlc(2, comx, comy); - if (game.kdist[loccom] < dist1) proutn(" advances to"); + proutn(" from %s", cramlc(2, comx, comy)); + if (game.kdist[loccom] < dist1) proutn(" advances to "); else proutn(" retreats to "); prout(cramlc(sector, nextx, nexty)); } diff --git a/battle.c b/battle.c index 845aa83..455801b 100644 --- a/battle.c +++ b/battle.c @@ -1235,7 +1235,7 @@ void phasers(void) { void hittem(double *hits) { double kp, kpow, wham, hit, dustfac, kpini; #ifdef SERGEEV - int cx, cy; + int crx, cry; #endif /* SERGEEV */ int nenhr2=nenhere, k=1, kk=1, ii, jj, ienm; diff --git a/conio.c b/conio.c index 9259814..9c37ad5 100644 --- a/conio.c +++ b/conio.c @@ -31,6 +31,7 @@ char color_warning=1; int directvideo; WINDOW *conio_scr; +#ifdef SERGEEV /* Some internals... */ static int colortab(int a) /* convert LINUX Color code to DOS-standard */ { @@ -46,6 +47,7 @@ static int colortab(int a) /* convert LINUX Color code to DOS-standard */ } return COLOR_BLACK; } +#endif /* SERGEEV */ static void docolor (int color) /* Set DOS-like text mode colors */ { diff --git a/finish.c b/finish.c index 2caf34d..b19ce7f 100644 --- a/finish.c +++ b/finish.c @@ -1,3 +1,6 @@ +#ifdef SERGEEV +#include +#endif /* SERGEEV */ #include "sst.h" #include #include @@ -9,23 +12,34 @@ void dstrct() { prout("Computer damaged; cannot execute destruct sequence."); return; } - skip(1); prouts("---WORKING---"); skip(1); - prout("SELF-DESTRUCT-SEQUENCE-ACTIVATED"); + prouts("SELF-DESTRUCT-SEQUENCE-ACTIVATED"); skip(1); prouts(" 10"); skip(1); prouts(" 9"); skip(1); prouts(" 8"); skip(1); prouts(" 7"); skip(1); prouts(" 6"); skip(1); +#ifdef SERGEEV + skip(1); +#endif /* SERGEEV */ prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-"); +#ifdef SERGEEV + skip(1); +#endif /* SERGEEV */ prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-"); +#ifdef SERGEEV + skip(1); +#endif /* SERGEEV */ prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED"); +#ifdef SERGEEV + skip(1); +#endif /* SERGEEV */ scan(); chew(); if (strcmp(game.passwd, citem) != 0) { prouts("PASSWORD-REJECTED;"); skip(1); - prout("CONTINUITY-EFFECTED"); - skip(1); + prouts("CONTINUITY-EFFECTED"); + skip(2); return; } prouts("PASSWORD-ACCEPTED"); skip(1); @@ -38,7 +52,6 @@ void dstrct() { prouts("GOODBYE-CRUEL-WORLD"); skip(1); } - skip(2); kaboom(); } @@ -69,13 +82,13 @@ void finish(FINTYPE ifin) { alldone = 1; skip(3); prout("It is stardate %.1f.", game.state.date); - prout(""); + skip(1); switch (ifin) { case FWON: // Game has been won if (game.state.nromrem != 0) prout("The remaining %d Romulans surrender to Starfleet Command.", game.state.nromrem); - + prout("You have smashed the Klingon invasion fleet and saved"); prout("the Federation."); gamewon=1; @@ -110,14 +123,19 @@ void finish(FINTYPE ifin) { break; case 5: skip(1); - prout("Computer- ERROR-ERROR-ERROR-ERROR"); + proutn("Computer- "); + prouts("ERROR-ERROR-ERROR-ERROR"); + skip(2); + prouts(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM"); + skip(1); + prouts(" THIS-PROGRAM-MUST-SURVIVE"); + skip(1); + prouts(" THIS-PROGRAM-MUST-SURVIVE"); skip(1); - prout(" YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM"); - prout(" THIS-PROGRAM-MUST-SURVIVE"); - prout(" THIS-PROGRAM-MUST-SURVIVE"); - prout(" THIS-PROGRAM-MUST-SURVIVE"); - prout(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI"); + prouts(" THIS-PROGRAM-MUST-SURVIVE"); skip(1); + prouts(" THIS-PROGRAM-MUST?- MUST ? - SUR? ? -? VI"); + skip(2); prout("Now you can retire and write your own Star Trek game!"); skip(1); break; @@ -130,8 +148,7 @@ void finish(FINTYPE ifin) { ) prout("You cannot get a citation, so..."); else { - prout("Do you want your Commodore Emeritus Citation printed?"); - proutn("(You need a 132 column printer.)"); + proutn("Do you want your Commodore Emeritus Citation printed? "); chew(); if (ja()) { igotit = 1; @@ -307,8 +324,6 @@ void score(void) { double timused = game.state.date - indate; int ithperd, iwon, klship; - pause_game(0); - iskill = skill; if ((timused == 0 || game.state.remkl != 0) && timused < 5.0) timused = 5.0; perdate = (game.state.killc + game.state.killk + game.state.nsckill)/timused; @@ -341,7 +356,7 @@ void score(void) { prout("%6d Super-Commander destroyed %5d", game.state.nsckill, 200*game.state.nsckill); if (ithperd) - prout("%.2f Klingons per stardate %5d", + prout("%6.2f Klingons per stardate %5d", perdate, ithperd); if (game.state.starkl) prout("%6d stars destroyed by your action %5d", @@ -364,7 +379,6 @@ void score(void) { if (alive==0) prout("Penalty for getting yourself killed -200"); if (gamewon) { - skip(1); proutn("Bonus for winning "); switch (skill) { case 1: proutn("Novice game "); break; @@ -375,7 +389,7 @@ void score(void) { } prout(" %5d", iwon); } - skip(2); + skip(1); prout("TOTAL SCORE %5d", iscore); } @@ -389,28 +403,38 @@ void plaque(void) { skip(2); while (fp == NULL) { +#ifdef SERGEEV + proutn("File or device name for your plaque: "); + getline(winner, sizeof(winner)); +#else proutn("File or device name for your plaque:"); fgets(winner, 128, stdin); winner[strlen(winner)-1] = '\0'; +#endif /* SERGEEV */ fp = fopen(winner, "w"); if (fp==NULL) { - prout("Invalid name."); + prout("Invalid name."); } } - proutn("Enter name to go on plaque (up to 30 characters):"); - fgets(winner, 128, stdin); - winner[strlen(winner)-1] = '\0'; + proutn("Enter name to go on plaque (up to 30 characters): "); + getline(winner, sizeof(winner)); + proutn("Enter name to go on plaque (up to 30 characters): "); + getline(winner, sizeof(winner)); winner[30] = '\0'; +#ifdef SERGEEV + nskip = 38 - strlen(winner)/2; +#else nskip = 64 - strlen(winner)/2; +#endif /* SERGEEV */ fprintf(fp,"\n\n\n\n"); /* --------DRAW ENTERPRISE PICTURE. */ - fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" ); + fprintf(fp, " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" ); fprintf(fp, " EEE E : : : E\n" ); fprintf(fp, " EE EEE E : : NCC-1701 : E\n"); - fprintf(fp, " EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE E : : : E\n"); - fprintf(fp, " E E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n"); + fprintf(fp, "EEEEEEEEEEEEEEEE EEEEEEEEEEEEEEE : : : E\n"); + fprintf(fp, " E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n"); fprintf(fp, " EEEEEEEEE EEEEEEEEEEEEE E E\n"); fprintf(fp, " EEEEEEE EEEEE E E E E\n"); fprintf(fp, " EEE E E E E\n"); diff --git a/io.c b/io.c index d67c232..258da55 100644 --- a/io.c +++ b/io.c @@ -169,14 +169,14 @@ void skip(int i) { } static void vproutn(char *fmt, va_list ap) { - char *strbuf, *p, *s; - vasprintf(&strbuf, fmt, ap); - p=s=strbuf; + char *s, *p; + vasprintf(&s, fmt, ap); + p=s; if ((curwnd==4)&&(wherey()==wnds[curwnd].wndbottom-wnds[curwnd].wndtop)){ - if (strchr(strbuf,'\n')){ - p=strchr(strbuf,'\n'); + if (strchr(s,'\n')) { + p=strchr(s,'\n'); p[0]=0; - cprintf("%s",strbuf); + cprintf("%s",s); p++; pause_game(0); } @@ -188,7 +188,7 @@ static void vproutn(char *fmt, va_list ap) { // setwnd(curwnd); if (strchr(s,'\n') || strchr(s,'\r')) clreol(); cprintf("%s",p); - free(strbuf); + free(s); #endif /* SERGEEV */ } @@ -245,10 +245,11 @@ static void prchr(char *s){ } static void vprouts(char *fmt, va_list ap) { - char *s; + char *s, *p; vasprintf(&s, fmt, ap); - while (*s) { - prchr(s++); + p=s; + while (*p) { + prchr(p++); delay(30); } free(s); diff --git a/makefile b/makefile index 76b167d..d047666 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,7 @@ VERS=$(shell sed