aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--taipan.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/taipan.c b/taipan.c
index 1ba5751..fe2a7b9 100644
--- a/taipan.c
+++ b/taipan.c
@@ -191,6 +191,12 @@ unsigned char get_item(unsigned char allow_all) {
extern char *ultostr(unsigned long value, char* s);
#define ultoa(x, y, z) ultostr(x, y)
+/* if your debt goes above this, Elder Brother Wu has
+ you assassinated, game over. Value is:
+ int((2**31 - 1) / 1.1) */
+#define DEBT_MAX 1952257860L
+char wu_assassin = 0;
+
/* taipan functions (modified as little as possible) */
#define GENERIC 1
#define LI_YUEN 2
@@ -1630,17 +1636,11 @@ void final_stats(void)
return;
}
- // clrscr();
-
- /* I can't get cc65's exit() to play nice, just do a coldstart */
- // __asm__("jmp $e477");
-
- /* exit(0) works in DOS 2.0s and 2.5, known to fail in Sparta */
- // exit(0);
-
- /* let's try doing it this way. I suspect it will have the same
- results as exit(0)... */
- __asm__("jmp (10)"); // aka DOSVEC
+ /* restore ROM character set. TODO: save old PEEK(756)
+ in newtitle.s, restore that here instead of using
+ hardcoded value. */
+ POKE(756, 224);
+ exit(0);
}
void transfer(void)
@@ -1976,6 +1976,7 @@ void quit(void)
else
debt++;
}
+ if(debt >= DEBT_MAX) wu_assassin = 1;
/* bank calculation original formula was:
bank = bank + (bank * .005);
@@ -2664,6 +2665,24 @@ int main(void) {
port_stats();
+ if(wu_assassin) {
+ wu_assassin = 0;
+ compradores_report();
+ cputs("Taipan, you have been assassinated!");
+ under_attack_sound();
+ timed_getch(TMOUT_3S);
+ compradores_report();
+ cputs("As the masked figure plunges the blade\r\n");
+ cputs("into your heart, he says:\r\n");
+ timed_getch(TMOUT_3S);
+ compradores_report();
+ cputs("Elder Brother Wu regrets to inform you\r\n");
+ cputs("that your account has been terminated\r\n");
+ cputs("with extreme prejudice.");
+ timed_getch(TMOUT_3S);
+ final_stats();
+ }
+
if ((port == 1) && (li == 0) && (cash > 0))
{
li_yuen_extortion();