aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-04-09 02:35:55 -0400
committerB. Watson <yalhcru@gmail.com>2021-04-09 02:35:55 -0400
commitd174861fabcc8efbf28fb9817a7000d8d38f0d97 (patch)
tree28108820d09618bb4d6ae1f6bb9a6acf51de49cb
parentf7481c4eaf95e176dd0a736ed1af46b6dd06a2b0 (diff)
downloadtaipan-d174861fabcc8efbf28fb9817a7000d8d38f0d97.tar.gz
More port status update stuff
-rw-r--r--taipan.c114
1 files changed, 22 insertions, 92 deletions
diff --git a/taipan.c b/taipan.c
index bb81eb1..5ff991b 100644
--- a/taipan.c
+++ b/taipan.c
@@ -115,6 +115,8 @@ extern const char *port_stat_screen;
port_stat_screen into screen RAM) */
char port_stat_dirty = 1;
+char bank_dirty = 1;
+
/* boolean, turbo fighting mode. cleared on entry to sea_battle(), set
when user enters turbo mode. has no effect outside of sea_battle() so
the caller doesn't have to reset it. */
@@ -1672,59 +1674,17 @@ unsigned int warehouse_in_use() {
#endif
-void port_stats(void)
-{
+void port_stats(void) {
int i, in_use, status = get_ship_status();
- // status = 100 - ((damage * 100L) / capacity);
+
+ if(port_stat_dirty) bank_dirty = 1;
/* all the static text that used to be in port_stats() has
been moved to mkportstats.c, which creates a .xex file which
will get prepended to taipan.xex and loaded into a chunk of memory
cc65 won't use. When it's time to print it, it'll get copied
into *SAVMSC. */
-
-#if 0
- chlinexy(1, 1, 26);
- chlinexy(1, 7, 26);
- chlinexy(1, 13, 26);
- cvlinexy(0, 2, 5);
- cvlinexy(27, 2, 5);
- cvlinexy(0, 8, 5);
- cvlinexy(27, 8, 5);
- chlinexy(0, 15, 40);
-
- cputcxy(0, 1, 17); // upper left corner
- cputcxy(0, 7, 1); // |-
- cputcxy(0, 13, 26); // lower left corner
-
- cputcxy(27, 1, 5); // upper right corner
- cputcxy(27, 7, 4); // -|
- cputcxy(27, 13, 3); // lower right corner
-
- cputsxy(1, 2, "Hong Kong Warehouse");
- cputsxy(4, 3, "Opium In use");
- cputsxy(4, 4, "Silk ");
- cputsxy(4, 5, "Arms Vacant");
- cputsxy(4, 6, "General ");
- cputsxy(1, 8, "Hold ");
- cputsxy(16, 8, "Guns ");
-
- cputsxy(4, 9, "Opium ");
- cputsxy(4, 10, "Silk ");
- cputsxy(4, 11, "Arms ");
- cputsxy(4, 12, "General ");
- cputsxy(32, 2, "Date");
- cputsxy(29, 3, "15 ");
-
- cputsxy(30, 5, "Location");
- cputsxy(32, 8, "Debt");
- cputsxy(29, 11, "Ship Status");
- cputsxy(0, 14, "Cash: ");
- cputsxy(20, 14, "Bank: ");
-#else
-
redraw_port_stat();
-#endif
/* dynamic stuff: */
gotoxy(firmpos, 0);
@@ -1750,76 +1710,40 @@ void port_stats(void)
cblankto(18);
}
- /*
- gotoxy(12, 3);
- cblank(5);
- cprintulong(hkw_[0]);
-
- gotoxy(12, 4);
- cblank(5);
- cprintulong(hkw_[1]);
-
- gotoxy(12, 5);
- cblank(5);
- cprintulong(hkw_[2]);
-
- gotoxy(12, 6);
- cblank(5);
- cprintulong(hkw_[3]);
- */
-
gotoxy(7, 8);
if(hold >= 0) {
- cblank(8);
cprintulong(hold);
+ cblankto(15);
} else {
cputs("\xcf\xf6\xe5\xf2\xec\xef\xe1\xe4"); // inverse "Overload"
}
gotoxy(22, 8);
- cblank(5);
cprintuint(guns);
+ cblankto(27);
for(i = 0; i < 4; ++i) {
gotoxy(12, i + 9);
- cblank(9);
cprintulong(hold_[i]);
+ cblankto(21);
}
- /*
- gotoxy(12, 9);
- cblank(9);
- cprintulong(hold_[0]);
-
- gotoxy(12, 10);
- cblank(9);
- cprintulong(hold_[1]);
-
- gotoxy(12, 11);
- cblank(9);
- cprintulong(hold_[2]);
-
- gotoxy(12, 12);
- cblank(9);
- cprintulong(hold_[3]);
- */
-
gotoxy(32, 3);
cputs(months + 4 * (month - 1));
cspace();
cprintuint(year);
gotoxy(30, 6);
- rvs_on();
if(port == 4 || port == 5) cspace();
+ rvs_on();
// cputs(location[port]);
print_msg(location[port]);
rvs_off();
clrtoeol();
gotoxy(28, 9);
- clrtoeol();
cprintfancy_centered(debt);
+ clrtoeol();
gotoxy(29, 12);
clrtoeol();
@@ -1831,13 +1755,16 @@ void port_stats(void)
cprintfancy(cash);
cblankto(20);
- gotoxy(26, 14);
+ if(bank_dirty) {
+ gotoxy(26, 14);
#ifdef BIGNUM
- cprintfancy_big(bank);
+ cprintfancy_big(bank);
#else
- cprintfancy(bank);
+ cprintfancy(bank);
#endif
- clrtoeol();
+ clrtoeol();
+ bank_dirty = 0;
+ }
}
void mchenry(void) {
@@ -2572,6 +2499,7 @@ void quit(void)
// bank = bank + (bank / 200);
big_div(banktmp, bank, interest_denom);
big_add(bank, bank, banktmp);
+ if(big_cmp(bank, big0) != 0) bank_dirty = 1;
#else
/* bank calculation original formula was:
bank = bank + (bank * .005);
@@ -2584,6 +2512,7 @@ void quit(void)
else
bank++;
}
+ if(bank > 0) bank_dirty = 1;
#endif
set_prices();
@@ -3260,8 +3189,7 @@ void too_much_cash(void) {
#endif
-void visit_bank(void)
-{
+void visit_bank(void) {
unsigned long amount = 0;
#ifdef BIGNUM
bignum(bigamt);
@@ -3290,6 +3218,7 @@ void visit_bank(void)
#else
bank += amount;
#endif
+ if(amount) bank_dirty = 1;
break;
} else {
you_only_have(0);
@@ -3305,6 +3234,7 @@ void visit_bank(void)
print_msg(M_withdraw);
amount = get_num();
+ if(amount) bank_dirty = 1;
#ifdef BIGNUM
if(amount == UINT32_MAX) {
big_copy(bigamt, bank);