From 65e6bb6bae08be492d76b00b661108afc4ad93be Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 13 Apr 2021 16:18:36 -0400 Subject: Save 43 bytes (8326 free) --- taipan.c | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'taipan.c') diff --git a/taipan.c b/taipan.c index 98e136d..283c4c8 100644 --- a/taipan.c +++ b/taipan.c @@ -134,6 +134,11 @@ extern void __fastcall__ cspaces(unsigned char count); this saves 208 bytes! */ extern void __fastcall__ gotox0y(char y); +/* replacing all gotox0y(3) and gotox0y(22) calls with these + save us 43 bytes. */ +extern void __fastcall__ gotox0y3(void); /* same as gotoxy(0,3) */ +extern void __fastcall__ gotox0y22(void); /* same as gotoxy(0,22) */ + /* each prints one specific character */ extern void crlf(void); extern void cspace(void); @@ -1120,7 +1125,7 @@ char sea_battle(char id, int num_ships) { set_orders(); if(!orders) { turbo = 0; - gotox0y(3); + gotox0y3(); clrtoeol(); cprint_taipan_comma(); // cputs("what shall we do??\n(Fight, Run, Throw cargo)"); @@ -1129,7 +1134,7 @@ char sea_battle(char id, int num_ships) { while(!orders) set_orders(); - gotox0y(3); + gotox0y3(); clrtoeol(); gotox0y(4); clrtoeol(); @@ -1143,14 +1148,14 @@ char sea_battle(char id, int num_ships) { ok = 3; ik = 1; - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Aye, we'll fight 'em"); print_msg(M_aye_fight); cprint_taipan_period(); set_orders(); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We're firing on 'em"); print_msg(M_were_firing); @@ -1215,7 +1220,7 @@ char sea_battle(char id, int num_ships) { tjsleep(10); } } - gotox0y(3); + gotox0y3(); clrtoeol(); if(sk > 0) { // cputs("Sunk "); @@ -1240,7 +1245,7 @@ char sea_battle(char id, int num_ships) { num_ships -= ran; fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); cprintuint(ran); // cputs(" ran away"); @@ -1268,7 +1273,7 @@ char sea_battle(char id, int num_ships) { set_orders(); } } else if ((orders == 1) && (guns == 0)) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We have no guns"); print_msg(M_we_have_no_guns); @@ -1281,7 +1286,7 @@ char sea_battle(char id, int num_ships) { total = 0; turbo = 0; - gotox0y(3); + gotox0y3(); // cputs("You have the following on board"); print_msg(M_you_have_on_board); cprint_colon_space(); @@ -1345,7 +1350,7 @@ char sea_battle(char id, int num_ships) { clrtoeol(); if(total > 0) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Let's hope we lose 'em"); print_msg(M_hope_we_lose_em); @@ -1366,7 +1371,7 @@ char sea_battle(char id, int num_ships) { set_orders(); } else { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("There's nothing there"); print_msg(M_nothing_there); @@ -1379,7 +1384,7 @@ char sea_battle(char id, int num_ships) { if((orders == 2) || (orders == 3)) { if(orders == 2) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Aye, we'll run"); print_msg(M_aye_run); @@ -1389,7 +1394,7 @@ char sea_battle(char id, int num_ships) { ok += ik++; if(randi()%ok > randi()%num_ships) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We got away from 'em"); print_msg(M_we_got_away); @@ -1401,7 +1406,7 @@ char sea_battle(char id, int num_ships) { timed_getch(); num_ships = 0; } else { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Couldn't lose 'em."); print_msg(M_couldnt_lose_em); @@ -1413,7 +1418,7 @@ char sea_battle(char id, int num_ships) { num_ships -= lost; fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("But we escaped from "); print_msg(M_but_we_escaped); @@ -1442,7 +1447,7 @@ char sea_battle(char id, int num_ships) { } if(num_ships > 0) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("They're firing on us"); print_msg(M_theyre_firing); @@ -1454,7 +1459,7 @@ char sea_battle(char id, int num_ships) { fight_stats(num_ships, orders); plus_or_space(num_ships > num_on_screen); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We've been hit"); print_msg(M_weve_been_hit); @@ -1476,7 +1481,7 @@ char sea_battle(char id, int num_ships) { guns--; hold += 10; fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("The buggers hit a gun"); print_msg(M_buggers_hit_gun); @@ -1541,7 +1546,7 @@ char sea_battle(char id, int num_ships) { if(orders == 1) { fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We got 'em all"); print_msg(M_we_got_em_all); @@ -2102,7 +2107,7 @@ void final_stats(void) chline(31); cputc(3); // lower right corner - gotox0y(22); + gotox0y22(); // cputs("Play again? "); print_msg(M_play_again); choice = yngetc(0); @@ -2185,7 +2190,7 @@ void transfer(void) { unsigned long amount = 0; if(have_no_cargo()) { - gotox0y(22); + gotox0y22(); clrtobot(); // cputs("You have no cargo"); print_msg(M_you_have_no_cargo); @@ -2925,7 +2930,7 @@ int port_choices(void) { cprintulong(price[3]); */ - gotox0y(22); + gotox0y22(); clrtobot(); #ifdef BIGNUM @@ -3094,7 +3099,7 @@ void name_firm(void) { # pragma code-name (push, "HIGHCODE") #endif char what_do_you_wish_me_to(char buy_or_sell) { - gotox0y(22); + gotox0y22(); clrtobot(); // cputs("What "); print_msg(M_what); @@ -3124,7 +3129,7 @@ void buy(void) { // cputs(" You can "); print_msg(M_spc_you_can_spc); rvs_off(); - gotox0y(22); + gotox0y22(); how_much(); // cputs(item[choice]); print_msg(item[choice]); @@ -3175,7 +3180,7 @@ void sell(void) { choice = what_do_you_wish_me_to(0); for (;;) { - gotox0y(22); + gotox0y22(); clrtobot(); how_much(); -- cgit v1.2.3