Include "FP"; Include ">configs"; Release 2; Array typebuf -> 256; Array real1 --> 2; Array real2 --> 2; Array real3 --> 2; Array real4 --> 2; Array real5 --> 2; Array real6 --> 2; Array real7 --> 2; Array firm -> 30; Array cargo --> 0 0 0 0 0 0 0 0; Array prices --> 8; Array whcargo --> 0 0 0 0; Global whvacancy = WAREHOUSE_CAPACITY; Array holdfree --> 2; Global shipsize = INITIAL_HOLD_SIZE; Global guns = 0; Array cash --> 2; Array bank --> 0 0; Array debt --> 2; Global hostilefreq = 0; Global month = 0; Global year = START_YEAR; Global location = 1; Global time = 1; Global li = 1; Global wuwisdom = 0; ! We store double the internal damage, so as to be able to do integer ! calculations Global dam2 = 0; Global firepower = 1; Global hardiness = 20; Global destitution = 0; ! Beep factor: 2=classic mode, 1=important message mode, 0=silent Global beepsalot = 2; ! Fight mode: 3=classic, slow, 2=classic on methamphetamine, ! 1=as fast as possible, 0=instant. Global fightmode = 3; ! The Elder Brother Wu cheat: 1=disabled, 0=enabled Global nobrothercheat = 0; Include ">screenmodel"; [ rettrue; rtrue; ]; [ arrayp a i; for (i=1: i<=a->0:i++) print (char) a->i; ]; [ warrayp a i; for (i=2: i0+2:i++) print (char) a->i; ]; [ fpword r i; fcpy(real5,r); fitos(real6,1000); i=0; while(fge(real5,real6)) { fdiv(real7,real5,real6); fcpy(real5,real7); i++; } if (i<2) { frnd(real5,r); print (fp) real5; } else { fitos(real6,100); fmul(real7,real5,real6); frnd(real5,real7); fdiv(real7,real5,real6); print (fp) real7; if (i==2) print " Million"; if (i==3) print " Billion"; if (i==4) print " Trillion"; } ]; ! Stolen, and shamelessly modified, from parserm.h [ TryNumber x c len mul tot d digit; len=x->1; if (len>=4) mul=1000; if (len==3) mul=100; if (len==2) mul=10; if (len==1) mul=1; tot=0; c=0; len=len+1; for (c=2:c<=len:c++) { digit=x->c; if (digit=='0') { d=0; jump digok; } if (digit=='1') { d=1; jump digok; } if (digit=='2') { d=2; jump digok; } if (digit=='3') { d=3; jump digok; } if (digit=='4') { d=4; jump digok; } if (digit=='5') { d=5; jump digok; } if (digit=='6') { d=6; jump digok; } if (digit=='7') { d=7; jump digok; } if (digit=='8') { d=8; jump digok; } if (digit=='9') { d=9; jump digok; } return -1000; .digok; tot=tot+mul*d; mul=mul/10; } if (len>5) tot=10000; return tot; ]; ! Read number or 'A' ! Returns 0 for non-number, 1 for number, 2 for 'A' [ ReadFP whereto allval i; typebuf->0=30; read typebuf 0; if (typebuf->1==1 && typebuf->2=='A' or 'a') { fcpy(whereto,allval); return 2; } for (i=1:i<=typebuf->1:i++) if (typebuf->(i+1)<'0' || typebuf->(i+1)>'9') return 0; i=strtof(whereto,typebuf+2,typebuf->1); if (i) return 1; else return 0; ]; [ YorN i; i=0; do { if(i) StdBeep(); @read_char 1 -> i; } until (i=='y' or 'n' or 'Y' or 'N'); if (i=='y' or 'Y') { print "Y^"; return 1; } else { print "N^"; return 0; } ]; [ StdBeep; if(beepsalot>0) @sound_effect 1; ]; [ Beep2512 i; ! Why 2512? Because this appears where "CALL 2512" does in the ! Applesoft Basic source. if(beepsalot==2) { @sound_effect 1; @read_char 1 1 rettrue -> i; @sound_effect 1; @read_char 1 1 rettrue -> i; @sound_effect 1; } else if(beepsalot==1) { @sound_effect 1; @read_char 1 2 rettrue -> i; } else { @read_char 1 2 rettrue -> i; } ]; [ Beep2518 i; ! Why 2518? Because this appears where "CALL 2518" does in the ! Applesoft Basic source. if(beepsalot==2) { @sound_effect 1; @read_char 1 1 rettrue -> i; @sound_effect 1; @read_char 1 1 rettrue -> i; @sound_effect 1; } else if(beepsalot==1) { @sound_effect 1; @read_char 1 2 rettrue -> i; } else { @read_char 1 2 rettrue -> i; } ]; [ Beep2521 i; ! Why 2521? Because this appears where "CALL 2521" does in the ! Applesoft Basic source. if(beepsalot==2) { @sound_effect 1; @read_char 1 1 rettrue -> i; @sound_effect 1; } else if(beepsalot==1) { @sound_effect 1; @read_char 1 1 rettrue -> i; } else { @read_char 1 1 rettrue -> i; } ]; [ Beep2524; ! Why 2524? Because this appears where "CALL 2524" does in the ! Applesoft Basic source. if(beepsalot) @sound_effect 1; ]; [ LongPause i; @read_char 1 LONG_DELAY_TIME rettrue -> i; ]; [ MedPause i; @read_char 1 MED_DELAY_TIME rettrue -> i; ]; [ ShortPause i; @read_char 1 SHORT_DELAY_TIME rettrue -> i; ]; [ GetFirm i option; ! Code shamelessly stolen from The Mad Bomber for (i=0: i<=22: i++) { firm->i=32; } @erase_window $ffff; @split_window 5; @set_window 1; @buffer_mode 0; @set_cursor 1 1; print "+"; for (i=2:i31 && option<127) { if (i<22) { i++; firm->i=option; i=i+12; @set_cursor 4 i; i=i-12; print (char) option; } else { @sound_effect 1; } } if (option==131) { if (i>0) { i--; i=i+13; @set_cursor 4 i; i=i-13; } else @sound_effect 1; } if (option==132) { if (i<22) { i++; i=i+13; @set_cursor 4 i; i=i-13; } else @sound_effect 1; } if (option==127 or 8) { if (i>0) { i=i+12; @set_cursor 4 i; print "_"; @set_cursor 4 i; i=i-12; firm->i=32; i--; } else @sound_effect 1; } } until (option==13); firm->0=i; @set_window 0; @buffer_mode 1; ]; Include ">ports"; Include ">atsea"; Constant Story "Taipan!^"; Constant Headline "A game based on the China trade of the 1800's^ Created by Art Canfil^ Apple ][ Program by: Mega-Micro Computers^ Copyright 1982 by Avalanche Productions, Inc.^ Z-Machine port written by D. Jacob Wildstrom (wildcard@@64alum.mit.edu)^^"; ! This is shamelessly stolen from VerbLib and slightly tweaked. [ Banner i; if (Story ~= 0) { #IFV5; style bold; #ENDIF; print (string) Story; #IFV5; style roman; #ENDIF; } if (Headline ~= 0) print (string) Headline; print "Release ", (0-->1) & $03ff, " / Serial number "; for (i=18:i<24:i++) print (char) 0->i; print " / Inform v"; inversion; #ifdef STRICT_MODE; print "S"; #endif; #ifdef INFIX; print "X"; #ifnot; #ifdef DEBUG; print "D"; #endif; #endif; new_line; ]; [ VersionSub standard_interpreter; standard_interpreter=$32-->0; Banner(); if (standard_interpreter > 0) print "Standard interpreter ", standard_interpreter/256, ".", standard_interpreter%256, " (", 0->$1e, (char) 0->$1f, ")"; else print "Interpreter ", 0->$1e, " Version ", (char) 0->$1f; #IFDEF LanguageVersion; print (string) LanguageVersion, "^"; #ENDIF; ]; [ Main i; bank-->0=0; bank-->1=0; fitos(holdfree,INITIAL_HOLD_SIZE); VersionSub(); print "^^Special thanks to Kevin Bracey for providing an Inform floating-point library.^^"; SetScreen(); print "^Would you like the game to be (0) silent, (1) slightly noisy, or (2) intolerably noisy? "; do @read_char 1 -> i; until(i=='0' or '1' or '2'); if(i=='0') { print "silent^^"; beepsalot=0; } if(i=='1') { print "slightly noisy^^"; beepsalot=1; } if(i=='2') { print "intolerably noisy^^"; beepsalot=2; } print "^Would you like the fight scenes to be (0) instantaneous, (1) extremely fast classic-style, or (2) classic-style? "; do @read_char 1 -> i; until(i=='0' or '1' or '2'); if(i=='0') { print "instantaneous^^"; fightmode=0; } if(i=='1') { print "extremely fast classic-style^^"; fightmode=1; } if(i=='2') { print "classic style^^"; fightmode=2; } print "[Press any key to begin]"; @read_char 1 -> i; @erase_window 0; do { GetFirm(); if (firm->0==0) @sound_effect 1; } until (firm->0); @erase_window 1; @split_window 10; @set_window 1; @buffer_mode 0; @set_cursor 1 1; print "Do you want to start . . .^^"; print " 1) With cash (and a debt)^^"; print " >> or <<^^"; print " 2) With five guns and no cash^"; print " (but no debt!)^"; print " ?"; do @read_char 1->i; until (i=='1' or '2'); if(i=='1') { guns=0; fitos(debt,5000); fitos(cash,400); fitos(holdfree,INITIAL_HOLD_SIZE); hostilefreq = 10; } else { guns=5; fitos(debt,0); fitos(cash,0); fitos(holdfree,INITIAL_HOLD_SIZE-5*GUN_SIZE); hostilefreq = 7; } @set_window 0; @buffer_mode 1; i=0; while(i~=-1) { DrawTopWindow(); i=PortStuff(i); if(i~=-1) i=Sailing(i); } WinScreen(); ]; Include ">abbreviations";