From e033d3cecc1707419525382f4635fcbc54df1e39 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 17 Jan 2016 06:33:59 -0500 Subject: save a few bytes, use a proper loop for flashing enemy ships --- README.txt | 11 +++++------ taipan.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 86f0b5b..ad6736d 100644 --- a/README.txt +++ b/README.txt @@ -114,10 +114,7 @@ slower, and the prompt timeouts will be 20% longer (1 sec => 1.2 sec). I don't think this is a real issue (it's not like Taipan is a fast-paced arcade game). -Bugs! At least these: - -- Exiting the game (Play again? N) needs to at minimum restore the - original text/background colors. +BUGS! At least these: - The BSS can overlap the start of the title screen (it's very close anyway). Consequences: There is a momentary graphics glitch when the @@ -160,7 +157,9 @@ Bugs! At least these: - One of my playtesters reported that, when running away from combat, it said 4 billion ships were attacking (number of ships must have gone - negative). I was never able to reproduce this. + negative). I was never able to reproduce this.... but another playtester + reported that (in a later version), the number of enemy ships suddenly + jumped to 6000+ during a fight, so there's something hinky there. - After a fight, "Arriving at Manila" or such will sometimes appear on the fight screen without clearing it first (ships still visible). @@ -333,7 +332,7 @@ Other things that need doing to the code: 4 digits there, 9999trillion would be the max. Or, abbreviate "billion" as "bil", allowing 4 more digits. "99999999 bil" would be 99 quadrillion. -- Size optimization. Right now, the executable is almost 28K of code. I'd +- Size optimization. Right now, the executable is almost 30K of code. I'd like it to at least fit on a 16K cartridge. A lot of the C code is redundant, and some things can be rewritten in asm if need be. I've already eliminated all uses of printf() and its ilk, which removed 2K diff --git a/taipan.c b/taipan.c index fc3bb7b..ebd023e 100644 --- a/taipan.c +++ b/taipan.c @@ -761,7 +761,7 @@ int sea_battle(int id, int num_ships) { i, input, status; - char choice; + char choice, flashctr; long amount, total; port_stat_dirty = 1; @@ -933,13 +933,24 @@ int sea_battle(int id, int num_ships) { gotoxy(0, 16); cputs("\r\n"); + do { + targeted = randi()%10; + } while(ships_on_screen[targeted] == 0); + + /* targeted = randi()%10; while(ships_on_screen[targeted] == 0) { targeted = randi()%10; } + */ /* 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++) { + flash_lorcha(targeted); + jsleep(2); + } + /* flash_lorcha(targeted); jsleep(2); flash_lorcha(targeted); @@ -952,6 +963,7 @@ int sea_battle(int id, int num_ships) { jsleep(2); flash_lorcha(targeted); jsleep(2); + */ damage_lorcha(targeted); ships_on_screen[targeted] -= randi()%30 + 10; -- cgit v1.2.3