From: Eric S. Raymond Date: Thu, 3 Feb 2005 19:38:09 +0000 (+0000) Subject: textcolor() is now available in the text input manager. X-Git-Tag: 2.0~404 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=2e65db78c58369f165c7d5c4edc849300a2d7f53;p=super-star-trek.git textcolor() is now available in the text input manager. --- diff --git a/conio.c b/conio.c index 9c37ad5..d603349 100644 --- a/conio.c +++ b/conio.c @@ -276,11 +276,14 @@ void textbackground (int color) docolor(color); } + void textcolor (int color) { +#ifdef SERGEEV fgc=color; color=(bgc*16)+fgc; docolor(color); +#endif /* SERGEEV */ } void textmode (int mode) diff --git a/io.c b/io.c index 2e66d36..f4ed854 100644 --- a/io.c +++ b/io.c @@ -286,6 +286,23 @@ void prouts(char *fmt, ...) { #endif /* SERGEEV */ } +void warble(void) +{ +#ifdef SERGEEV + int posx, posy; + posx=wherex(); + posy=wherey(); + drawmaps(1); + setwnd(4); + gotoxy(posx,posy); + sound(50); + delay(1000); + nosound(); +#else + prouts(" . . . . . "); +#endif /* SERGEEV */ +} + void getline(char *line, int max) { if (curses) { #ifndef SERGEEV diff --git a/moving.c b/moving.c index 13cd543..4f2af10 100644 --- a/moving.c +++ b/moving.c @@ -1,7 +1,5 @@ -#ifdef SERGEEV -#include +#include "conio.h" #include "sstlinux.h" -#endif /* SERGEEV */ #include #include "sst.h" @@ -55,12 +53,13 @@ void imove(void) { (iy-game.ky[l])*(double)(iy-game.ky[l])); game.kavgd[l] = 0.5 * (finald+game.kdist[l]); } -#ifdef SERGEEV + /* + * Stas Sergeev added the condition + * that attacks only happen if Klingons + * are present and your skill is > 3. + */ if (skill > 3 && klhere > 0 && game.state.galaxy[quadx][quady] != 1000) attack(0); -#else - if (game.state.galaxy[quadx][quady] != 1000) attack(0); -#endif /* SERGEEV */ if (alldone) return; } /* compute final position -- new quadrant and sector */ @@ -824,9 +823,7 @@ void timwrp() { game.damage[DRADIO] += Time; } newqad(0); -#ifdef SERGEEV - events(); -#endif /* SERGEEV */ + events(); /* Stas Sergeev added this -- do pending events */ } void probe(void) { @@ -905,9 +902,6 @@ void help(void) { /* There's more than one way to move in this game! */ double ddist, xdist, probf; int line = 0, l, ix, iy; -#ifdef SERGEEV - int posx, posy; -#endif /* SERGEEV */ chew(); /* Test for conditions which prevent calling for help */ @@ -982,19 +976,8 @@ void help(void) { } proutn(" attempt to re-materialize "); crmshp(); - prouts(" . . . . . "); -#ifdef SERGEEV - posx=wherex(); - posy=wherey(); - drawmaps(1); - setwnd(4); - gotoxy(posx,posy); - sound(50); - delay(1000); - nosound(); -#endif /* SERGEEV */ + warble(); if (Rand() > probf) break; -#ifdef SERGEEV switch (l){ case 1: game.quad[ix][iy]=IHMATER1; break; @@ -1004,25 +987,18 @@ void help(void) { break; } textcolor(RED); -#endif /* SERGEEV */ prout("fails."); -#ifdef SERGEEV delay(500); textcolor(LIGHTGRAY); -#endif /* SERGEEV */ } if (l > 3) { finish(FMATERIALIZE); return; } game.quad[ix][iy]=ship; -#ifdef SERGEEV textcolor(WHITE); -#endif /* SERGEEV */ prout("succeeds."); -#ifdef SERGEEV textcolor(LIGHTGRAY); -#endif /* SERGEEV */ dock(0); skip(1); prout("Lt. Uhura- \"Captain, we made it!\""); diff --git a/reports.c b/reports.c index 6486d9d..852094f 100644 --- a/reports.c +++ b/reports.c @@ -2,10 +2,9 @@ #include #include #include -#ifdef SERGEEV -#include +#include "conio.h" #include "sstlinux.h" -#else +#ifndef SERGEEV #define c_printf proutn #endif /* SERGEEV */ @@ -281,7 +280,6 @@ int srscan(int l) { for (j = 1; j <= 10; j++) { if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){ if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){ -#ifdef SERGEEV switch (condit) { case IHRED: textcolor(RED); break; case IHGREEN: textcolor(GREEN); break; @@ -289,6 +287,7 @@ int srscan(int l) { case IHDOCKED: textcolor(LIGHTGRAY); break; case IHDEAD: textcolor(WHITE); } +#ifdef SERGEEV if (game.quad[i][j]!=ship) highvideo(); #endif /* SERGEEV */ } @@ -296,9 +295,7 @@ int srscan(int l) { if (game.quad[i][j] & 128) highvideo(); #endif /* SERGEEV */ c_printf("%c ",game.quad[i][j] & 127); -#ifdef SERGEEV textcolor(LIGHTGRAY); -#endif /* SERGEEV */ } else proutn("- "); diff --git a/sst.h b/sst.h index 5ba7004..da406c1 100644 --- a/sst.h +++ b/sst.h @@ -441,6 +441,7 @@ void ioend(void); #ifdef SERGEEV void setwnd(short); #endif /* SERGEEV */ +void warble(void); void getline(char *, int); void commandhook(char *, int); diff --git a/sstlinux.h b/sstlinux.h index 779f8eb..e4d4ea3 100644 --- a/sstlinux.h +++ b/sstlinux.h @@ -5,7 +5,9 @@ int c_printf (char *format, ... ); void sound(unsigned int); void nosound(void); +#ifdef SERGEEV extern WINDOW *conio_scr; +#endif /* SERGEEV */ #define delay(x) usleep(x*1000) #define randomize() srand((unsigned)time(NULL))