From 38fbe6b269192f151aeb9f171a895520d0fd6479 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 3 Apr 2021 18:14:50 -0400 Subject: Turbo fight mode, initial implementation --- taipan.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'taipan.c') diff --git a/taipan.c b/taipan.c index 8ee33c8..92c3d80 100644 --- a/taipan.c +++ b/taipan.c @@ -112,6 +112,11 @@ extern const char *port_stat_screen; port_stat_screen into screen RAM) */ char port_stat_dirty = 1; +/* boolean, turbo fighting mode. cleared on entry to sea_battle(), set + when user enters turbo mode. must be cleared by the caller, when + sea_battle() returns. */ +unsigned char turbo; + /* asm curses/conio funcs from console.s. Old C versions moved to oldcurses.c for reference. */ extern void clrtobot(void); @@ -1020,6 +1025,7 @@ char sea_battle(char id, int num_ships) { char choice, flashctr, num_on_screen, status; unsigned long amount, total; + turbo = 0; port_stat_dirty = 1; orders = 0; @@ -1082,7 +1088,7 @@ char sea_battle(char id, int num_ships) { for(i = 0; i <= 9; i++) { if (num_ships > num_on_screen) { if (ships_on_screen[i] == 0) { - jsleep(5); + if(!turbo) jsleep(5); ships_on_screen[i] = (randi() % ec) + 20; draw_lorcha(i); num_on_screen++; @@ -1101,6 +1107,7 @@ char sea_battle(char id, int num_ships) { if(orders == 0) { set_orders(); if(!orders) { + turbo = 0; gotox0y(3); clrtoeol(); cprint_taipan_comma(); @@ -1169,7 +1176,7 @@ char sea_battle(char id, int num_ships) { /* flash_lorcha must be called an even number of times to leave the lorcha in an unflashed state after. */ - for(flashctr = 0; flashctr < 6; flashctr++) { + if(!turbo) for(flashctr = 0; flashctr < 6; flashctr++) { flash_lorcha(targeted); jsleep(2); } @@ -1185,7 +1192,10 @@ char sea_battle(char id, int num_ships) { ships_on_screen[targeted] = 0; bad_joss_sound(); /* not sure this should be here */ - sink_lorcha(targeted); + if(turbo) + clear_lorcha(targeted); + else + sink_lorcha(targeted); plus_or_space(num_ships > num_on_screen); @@ -1195,7 +1205,7 @@ char sea_battle(char id, int num_ships) { if(num_ships == 0) { i += guns; } else { - jsleep(10); + if(!turbo) jsleep(10); } } gotox0y(3); @@ -1207,7 +1217,7 @@ char sea_battle(char id, int num_ships) { // cputs(" of the buggers"); print_msg(M_of_the_buggers); cprint_taipan_bang(); - bad_joss_sound(); + if(!turbo) bad_joss_sound(); } else { // cputs("Hit 'em, but didn't sink 'em"); print_msg(M_didnt_sink); @@ -1238,7 +1248,7 @@ char sea_battle(char id, int num_ships) { num_on_screen--; clear_lorcha(i); - jsleep(5); + if(!turbo) jsleep(5); } } if(num_ships == num_on_screen) { @@ -1257,10 +1267,12 @@ char sea_battle(char id, int num_ships) { print_msg(M_we_have_no_guns); cprint_taipan_bangbang(); set_orders(); + turbo = 0; } else if (orders == 3) { choice = 0; amount = 0; total = 0; + turbo = 0; gotox0y(3); // cputs("You have the following on board"); @@ -1425,7 +1437,7 @@ char sea_battle(char id, int num_ships) { cprint_taipan_bang(); set_orders(); - explosion(); + if(!turbo) explosion(); fight_stats(num_ships, orders); plus_or_space(num_ships > num_on_screen); @@ -1457,7 +1469,7 @@ char sea_battle(char id, int num_ships) { // cputs("The buggers hit a gun"); print_msg(M_buggers_hit_gun); cprint_taipan_bangbang(); - under_attack_sound(); + if(!turbo) under_attack_sound(); fight_stats(num_ships, orders); update_guns(); -- cgit v1.2.3