diff options
-rw-r--r-- | taipan.c | 80 |
1 files changed, 62 insertions, 18 deletions
@@ -182,10 +182,15 @@ extern void __fastcall__ clear_lorcha(int which); extern void redraw_port_stat(void); /* this pragma places compiled C code in bank 3 of the cartridge, - so it doesn't need to be copied to RAM (speeds startup). */ + so it doesn't need to be copied to RAM (speeds startup). + currently commented out, since we want to make room in bank2 + for the help text (when that gets added). + */ +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ /* this didn't work out, bummer. */ // extern void __fastcall__ waitvcount(unsigned char c); @@ -290,9 +295,11 @@ void under_attack_timed_getch() { timed_getch(); } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ /* modified ultoa() with hardcoded radix */ extern char *ultostr(unsigned long value, char* s); @@ -471,9 +478,11 @@ long damage = 0, capacity = 60, newdamage; there are diminishing returns. Anything that only occurs twice might or might not be worth turning into a function. */ +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ void how_much(void) { // cputs("How much "); @@ -602,9 +611,11 @@ void cprint_firm_colon(void) { char get_ship_status(void) { return 100 - ((damage * 100L) / capacity); } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ #ifdef BIGNUM bignum(big1T) = BIG_1T; @@ -693,9 +704,11 @@ void cprintfancy_big(bignump b) { } #endif +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ int get_time(void) { return ((year - 1860) * 12) + month; @@ -748,9 +761,11 @@ unsigned int gunamt(void) { return randi()%(1000 * (get_time() + 5) / 6); } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ void new_ship(void) { unsigned long amount; @@ -818,9 +833,11 @@ void new_gun(void) { return; } +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ /* cprintfancy_centered() does this for 0 to 999999: | 999999 | @@ -858,25 +875,31 @@ void cprintfancy_centered(unsigned long num) { } #endif +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ /* if BIGNUM, cprintfancy() just converts to bignum and uses cprintfancy_big() to do the work. A bit slower, but fast enough, and avoids duplicate logic. */ #ifdef BIGNUM +/* # ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") # endif +*/ void cprintfancy(unsigned long num) { bignum(b); ulong_to_big(num, b); cprintfancy_big(b); } +/* # ifdef CART_TARGET # pragma code-name (pop) # endif +*/ #else /* replaces old fancy_numbers. same logic, but stuff is just printed on the screen rather than being kept in a buffer. @@ -933,9 +956,11 @@ void cprintfancy(unsigned long num) { } #endif +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ void justify_int(unsigned int num) { if(num < 1000) cspace(); if(num < 100) cspace(); @@ -964,6 +989,17 @@ void set_orders(void) { */ void fight_stats(int ships) { + char status = get_ship_status(); + gotox0y(5); + clrtoeol(); + + // cputs("Current seaworthiness: "); + print_msg(M_cur_seaworth); + print_status_desc(status); + cputs(" ("); + cprintuchar(status); + cputs("%)"); + gotox0y(0); justify_int(ships); @@ -1005,9 +1041,11 @@ void plus_or_space(unsigned char b) { } */ +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ int ships_on_screen[10]; extern char have_ships_on_screen(void); @@ -1026,7 +1064,7 @@ char sea_battle(char id, int num_ships) { ik, i; // input, - char choice, flashctr, num_on_screen, status; + char choice, flashctr, num_on_screen; unsigned long amount, total; port_stat_dirty = 1; @@ -1065,31 +1103,17 @@ char sea_battle(char id, int num_ships) { rvs_off(); update_guns(); - fight_stats(num_ships); - while(num_ships > 0) { + fight_stats(num_ships); if(damage >= capacity) return 4; - // status = 100L - ((damage * 100L / capacity)); - status = get_ship_status(); + // status = get_ship_status(); /* // I think this is a problem: if(status <= 0) { return 4; } */ - // flushinp(); - gotox0y(6); - clrtoeol(); - - // cputs("Current seaworthiness: "); - print_msg(M_cur_seaworth); - print_status_desc(status); - cputs(" ("); - cprintuchar(status); - cputs("%)"); - // gotox0y(4); - for(i = 0; i <= 9; i++) { if (num_ships > num_on_screen) { if (ships_on_screen[i] == 0) { @@ -1556,9 +1580,11 @@ unsigned long get_num(void) { } /* TODO: rewrite in asm */ +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ void cash_or_guns(void) { char choice; @@ -1636,9 +1662,11 @@ void set_prices(void) { unsigned int warehouse_in_use() { return hkw_[0] + hkw_[1] + hkw_[2] + hkw_[3]; } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ void port_stats(void) { @@ -2131,16 +2159,20 @@ char have_no_cargo(void) { return 1; } +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ void you_have_only(void) { // cputs("You have only "); print_msg(M_you_have_only); } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ void transfer(void) { @@ -2953,17 +2985,21 @@ int port_choices(void) { return choice; } +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ void print_bar_line(void) { cprint_pipe(); cspaces(38); cprint_pipe(); } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ /* TODO: rewrite in asm, or at least better C */ void name_firm(void) { @@ -3058,9 +3094,11 @@ void name_firm(void) { return; } +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ char what_do_you_wish_me_to(char *buy_or_sell) { gotox0y22(); clrtobot(); @@ -3073,9 +3111,11 @@ char what_do_you_wish_me_to(char *buy_or_sell) { cprint_taipan_prompt(); return get_item_port(); } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ void buy(void) { int choice; @@ -3178,9 +3218,11 @@ void sell(void) { return; } +/* #ifdef CART_TARGET # pragma code-name (push, "HIGHCODE") #endif +*/ char would_overflow(unsigned long a, unsigned long b) { return ((UINT32_MAX - b) <= a); } @@ -3194,9 +3236,11 @@ void too_much_cash(void) { print_msg(M_ship_would_sink); bad_joss_timed_getch(); } +/* #ifdef CART_TARGET # pragma code-name (pop) #endif +*/ void visit_bank(void) { |