diff options
Diffstat (limited to 'taipan.c')
-rw-r--r-- | taipan.c | 72 |
1 files changed, 39 insertions, 33 deletions
@@ -117,6 +117,12 @@ extern void clrtoeol(void); /* print 'count' spaces: */ extern void __fastcall__ cspaces(unsigned char count); +/* avoid calling/linking conio's revers() function. This saves us + 49 bytes (2 per call to revers(), plus these functions are smaller + than conio's revers() because they return void) */ +extern void rvs_on(void); +extern void rvs_off(void); + /* asm funcs from draw_lorcha.s for drawing/animating enemy ships. used by sea_battle() */ extern void __fastcall__ draw_lorcha(int which); @@ -578,9 +584,9 @@ void cprintulong(unsigned long ul) { void at_sea(void) { gotoxy(30, 6); cspace(); - revers(1); + rvs_on(); cputs(location[0]); - revers(0); + rvs_off(); cspaces(3); } @@ -694,13 +700,13 @@ void cprintfancy_centered(unsigned long num) { cspaces(3); if(num < 100L) cspace(); if(num < 10000L) cspace(); - revers(1); + rvs_on(); cprintulong(num); } else { - revers(1); + rvs_on(); cprintfancy(num); } - revers(0); + rvs_off(); } /* if BIGNUM, cprintfancy() just converts to bignum and uses @@ -787,10 +793,10 @@ void hide_cursor() { */ void update_guns() { - revers(1); + rvs_on(); gotoxy(31, 1); justify_int(guns); - revers(0); + rvs_off(); // hide_cursor(); } @@ -885,13 +891,13 @@ int sea_battle(int id, int num_ships) { /* the static part of "we have N guns" display, gets printed only once per battle. Bloats the code by 30-odd bytes, but updates are smoother-looking. Maybe. */ - revers(1); + rvs_on(); gotoxy(30, 0); cputs(" We have"); gotoxy(30, 1); cspaces(6); cputs("guns"); - revers(0); + rvs_off(); update_guns(); fight_stats(num_ships, orders); @@ -1610,18 +1616,18 @@ void port_stats(void) */ gotoxy(32, 3); - // revers(1); + // rvs_on(); cputs(months + 4 * (month - 1)); - // revers(0); + // rvs_off(); cspace(); cprintulong(year); gotoxy(30, 6); cblank(10); - revers(1); + rvs_on(); if(port == 4 || port == 5) cspace(); cputs(location[port]); - revers(0); + rvs_off(); gotoxy(28, 9); clrtoeol(); @@ -1630,11 +1636,11 @@ void port_stats(void) gotoxy(29, 12); clrtoeol(); i = status / 20; - // if(i < 2) revers(1); + // if(i < 2) rvs_on(); cputs(st[i]); cputc(':'); cprintulong(status); - // revers(0); + // rvs_off(); gotoxy(6, 14); cblank(14); @@ -1748,7 +1754,7 @@ void aire(void) { void retire(void) { compradores_report(); - revers(1); + rvs_on(); // cspaces(29); // crlf(); retire_blanks(); @@ -1769,7 +1775,7 @@ void retire(void) { // cspaces(29); // crlf(); retire_blanks(); - revers(0); + rvs_off(); timed_getch(); final_stats(); @@ -1842,7 +1848,7 @@ void final_stats(void) cputc_s(); } cputs("\r\n\n"); - revers(1); + rvs_on(); cputs("Your score is "); #ifdef BIGNUM cprintfancy_big(bigscore); @@ -1850,7 +1856,7 @@ void final_stats(void) cprintulong(score); #endif cputs(".\r\n"); - revers(0); + rvs_off(); if ((score < 100) && (score >= 0)) { cputs("Have you considered a land based job?\r\n\n\n"); @@ -1871,10 +1877,10 @@ void final_stats(void) if (score > 49999L) { - revers(1); + rvs_on(); } cputs("Ma Tsu"); - revers(0); + rvs_off(); cspaces(9); cputs("50,000 and over |\r\n"); cprint_pipe(); @@ -1882,21 +1888,21 @@ void final_stats(void) if ((score < 50000L) && (score > 7999L)) { - revers(1); + rvs_on(); } cputs("Master Taipan"); - revers(0); + rvs_off(); cputs(" 8,000 to 49,999|\r\n"); cprint_pipe(); // cputc('|'); if ((score < 8000L) && (score > 999L)) { - revers(1); + rvs_on(); } // cputs("Taipan"); cprint_taipan(); - revers(0); + rvs_off(); cspaces(10); cputs("1,000 to 7,999|\r\n"); cprint_pipe(); @@ -1904,10 +1910,10 @@ void final_stats(void) if ((score < 1000) && (score > 499)) { - revers(1); + rvs_on(); } cputs("Compradore"); - revers(0); + rvs_off(); cspaces(8); cputs("500 to 999|\r\n"); cprint_pipe(); @@ -1915,10 +1921,10 @@ void final_stats(void) if (score < 500) { - revers(1); + rvs_on(); } cputs("Galley Hand"); - revers(0); + rvs_off(); cspaces(7); cputs("less than 500|\r\n"); @@ -2921,15 +2927,15 @@ void buy(void) { clrtobot(); afford = cash / price[choice]; - revers(1); + rvs_on(); cputs(" You can "); - revers(0); + rvs_off(); gotoxy(0, 22); how_much(); cputs(item[choice]); cputs(" shall"); gotoxy(31, 22); - revers(1); + rvs_on(); cputs(" afford "); gotoxy(31, 23); // cspaces(9); @@ -2942,7 +2948,7 @@ void buy(void) { if(afford < 100000000) cspace(); cprintulong(afford); - revers(0); + rvs_off(); gotoxy(0, 23); cputs("I buy, "); |