You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

481 lines
15 KiB
Plaintext

poke646,1:poke53281,0:poke53280,0:rv=1.02:goto@instructions:REM DRUGWAR64 1.02
£titlebar {this literally just draws the game title at the top of the screen}
poke53280,int(rnd(1)*16)
poke214,0:poke211,15:sys58640:?"drugwar/64"
?CHR$(18)" ":return
£seed
j=RND(-TI):return
£wait {ubiquitious "Press ENTER to continue}
?:input"Press enter to continue.";x$:return
£twofifteen
poke214,1:poke211,14:sys58640:return
£twosixteen
poke214,1:poke211,15:sys58640:return
£twoseventeen
poke214,1:poke211,16:sys58640:return
£twoeighteen
poke214,1:poke211,17:sys58640:return
£twonineteen
poke214,1:poke211,18:sys58640:return
£jetalthere
gosub@twonineteen:?CHR$(18)"Jet":return
£timera
forj=1to2500:nextj:k=int(rnd(1)+.5):return
£timerb
forj=1to1000:nextj:return
£timerc
forj=1to2000:nextj:return
[
"Common logic" has been moved to buy/sell subroutines.
This has cleaned the code up a bit
]
£howmuchbuy {some common purchase code}
?"You can afford ";j:?"You can carry ";f
£howmanybuy
?:input"How many?(Enter 0 cancel):";k:ifK=0goto@menu
ifk<ACthen?:?CHR$(18)"STOP CHEATING!":AD=AD+1:gosub@cheater:gosub@TIMERC:goto@MENU
ifk<0thenad=ad+1:gosub@cheater:return
ifk>fTHEN?CHR$(18)"You can't carry that much!":goto@howmanybuy
ifk>jTHEN?CHR$(18)"You can't afford that much!":goto@howmanybuy
return
£howmuchsell {common sell code}
?"You can sell:";j:?
£howmanysell
input"How many?(Enter 0 to cancel.):";k
Ifk>jthen?"You don't have that many!":goto@howmanysell
ifK=0goto@menu
return
£freespace
f=i-((g*5)+m+n+o+u+t+q):return
£chase
gosub@twofifteen:?CHR$(18)"Being Chased":return
£gmod
gosub@twosixteen:?chr$(18)"Game Over":return
£bronxcheck
ifp$="THE BRONX"thenreturn
?"you need to be in the bronx":?"to take care of this business."
gosub@timerc:goto@menu
£daily {randomizes drug prices, adds a day, calculates interests, checks day number}
c=int(rnd(1)*12000+16000.5):h=int(rnd(1)*7000+5000.5)
a=int((rnd(1)*34+10)*100+.5):z=int((rnd(1)*42+33)*10+.5)
s=int((rnd(1)*15+7)*10+.5):l=int((rnd(1)*4+1)*10+.5)
b=int(rnd(1)*20+.5):d=d+1:ac=int(((rnd(1)*10)+1)*-1):ifad>0thenad=ad-1
£checkday {so I can check the day by itself}
ifD>=31GOTO@endgame
return
£scorecalculate
k=(w+e)-v:ifk<0THENk=0:return
k=int(sqr((k/31.5)+.5)):ifk>100thenk=100
return
£gamestart {set wallet, debt, location, inventory space, zero out inventory}
w=2000:e=0:v=5000:p$="The Bronx":g=0:i=100:m=0:n=0:o=0:u=0:t=0:q=0
d=0:bb=100:gosub@daily:goto@menu
£cheater
ifad>=3thengoto@threestrikes
return
£menu {main menu. everything should loop back here}
?CHR$(147):gosub@freespace:gosub@titlebar:poke214,1:poke211,3:sys58640:?CHR$(18)"Day:"D
poke214,1:poke211,17:sys58640:?CHR$(18)"Location:"p$:?:?"(C)heck Prices"
?"(T)renchcoat":?"(B)uy":?"(S)ell":?"(J)et"
?"(L)oan shark":?"(V)isit Bank":?
input "Please make your selection:";x$
ifx$="C"goto@prices
ifx$="T"goto@inventory
ifx$="B"goto@buy
ifx$="S"goto@sell
ifx$="J"goto@jet
ifx$="L"goto@loan
ifx$="V"goto@bank
{if x$="debug" goto@debug}
goto@menu
[
£debug
?"Testing Screen"
?
?"(w)allet,(g)uns,(v)debt,(e)savings,(i)nventory space"
input "What to change?";db$
input "To?";dx
if db$="w" then w=dx
if db$="g" then g=dx
if db$="v" then v=dx
if db$="e" then e=dx
if db$="i" then i=dx
goto@menu
]
£prices
?CHR$(147):gosub@titlebar:gosub@twoeighteen:?CHR$(18)"Prices":?:?"cocaine:","$"c
?"heroin:","$"h:?"acid:","$"a:?"weed:","$"z:?"speed:","$"s:?"ludes:","$"l
?"wallet:","$"w:gosub@wait:goto@menu
£inventory
?CHR$(147):gosub@titlebar:gosub@twosixteen:?CHR$(18)"Trenchcoat":?:?"cocaine:",m
?"heroin:",n:?"acid:",o:?"weed:",u:?"speed:",t:?"ludes:",q:?"free space:";f
gosub@wait:goto@menu
£buy
?CHR$(147):gosub@titlebar:gosub@twonineteen:?CHR$(18)"Buy":?
?"What do you want to buy?":?:?"(C)ocaine":?"(H)eroin":?"(A)cid"
?"(W)eed":?"(S)peed":?"(L)udes":?:input"Enter Selection:";x$
ifx$="c"goto@cokebuy
ifx$="h"goto@herbuy
ifx$="a"goto@acidbuy
ifx$="w"goto@weedbuy
ifx$="s"goto@spdbuy
ifx$="l"goto@ludbuy
goto@menu
£sell
?CHR$(147):gosub@titlebar:gosub@twoeighteen:?CHR$(18)"Sell":?
?"What would you like to sell?":?:?"(C)ocaine":?"(H)eroin":?"(A)cid"
?"(W)eed":?"(S)peed":?"(L)udes":?
£sellsel
input"Enter Selection:(0 to cancel)";x$
ifx$="c"goto@cokesell
ifx$="h"goto@hersell
ifx$="a"goto@acidsell
ifx$="w"goto@weedsell
ifx$="s"goto@spdsell
ifx$="l"goto@ludsell
ifx$="0"goto@menu
?"Invalid Selection!":goto@sellsel
£jet
?CHR$(147):gosub@titlebar:gosub@jetalthere:?:?"(B)ronx":?"(G)hetto":?"(C)entral Park
?"(M)anhattan":?"Coney (I)sland":?"Broo(K)lyn":?"(O)ops...stay!":?
input "Where to dude";x$
ifx$="B"theny$="The Bronx":GOTO@jetb {we can use strings}
ifx$="G"theny$="The Ghetto":GOTO@jetb
ifx$="C"theny$="Central Park":GOTO@jetb
ifx$="M"theny$="Manhattan":goto@jetb
ifx$="I"theny$="Coney Island":goto@jetb
ifx$="K"theny$="Brooklyn":goto@jetb
ifx$="O"thengoto@menu
{if x$="COPTEST" then b=5:g=1:goto@police}
goto@jet
£jetb
{input "event:";ev testing/debug}
ify$=p$thengoto@alreadythere
p$=y$:y$="":goto@subway
£loan
?CHR$(147):gosub@titlebar:Gosub@twosixteen:?CHR$(18)"Loan Shark":?:gosub@bronxcheck
?"Your debt is:$";v:?"You have:$";w:?
input"(R)epay, (B)orrow, (L)eave:";X$
IfX$="R"goto@payme
IfX$="B"goto@borrow
IfX$="L"goto@Menu
goto@loan
£bank
?CHR$(147):gosub@titlebar:gosub@twofifteen:?CHR$(18)"Bank O'Murica":?:gosub@bronxcheck
?"Your balance:$";e:?"Your wallet:$";w:?
INPUT"(D)EPOSIT, (W)ITHDRAW, (L)EAVE:";X$
ifx$="d"goto@deposit
ifx$="w"goto@mymoney
ifx$="l"goto@menu
{if x$=eg$ then goto@egg}
goto@bank
£cokebuy
?CHR$(147):gosub@titlebar:gosub@twosixteen:?CHR$(18)"Buy Cocaine"
ac=0:?:j=int(w/c):gosub@howmuchbuy:m=m+k:w=w-(c*k):goto@menu
£herbuy
?CHR$(147):gosub@titlebar:gosub@twosixteen:?CHR$(18)"Buy Heroin"
ac=0:?:j=int(w/h):gosub@howmuchbuy:n=n+k:w=w-(h*k):goto@menu
£acidbuy
?CHR$(147):gosub@titlebar:gosub@twoseventeen:?CHR$(18)"Buy Acid"
?:j=int(w/a):gosub@howmuchbuy:o=o+k:w=w-(a*k):goto@menu
£weedbuy
?CHR$(147):gosub@titlebar:gosub@twoseventeen:?CHR$(18)"Buy Weed"
?:j=int(w/z):gosub@howmuchbuy:u=u+k:w=w-(z*k):goto@menu
£spdbuy
?CHR$(147):gosub@titlebar:gosub@twoseventeen:?CHR$(18)"Buy Speed"
?:j=int(w/s):gosub@howmuchbuy:t=t+k:w=w-(s*k):goto@menu
£ludbuy
?CHR$(147):gosub@titlebar:gosub@twoseventeen:?CHR$(18)"Buy Ludes"
?:j=int(w/l):gosub@howmuchbuy:q=q+k:w=w-(l*k):goto@menu
£cokesell
?CHR$(147):gosub@titlebar:gosub@twofifteen:?CHR$(18)"Sell Cocaine"
?:j=m:gosub@howmuchsell:m=m-k:w=w+(c*k)::goto@menu
£hersell
?CHR$(147):gosub@titlebar:gosub@twoseventeen:?CHR$(18)"Sell Heroin"
?:j=n:gosub@howmuchsell:n=n-k:w=w+(h*k):goto@menu
£acidsell
?CHR$(147):gosub@titlebar:gosub@twoseventeen:?CHR$(18)"Sell Acid"
?:j=o:gosub@howmuchsell:o=o-k:w=w+(a*k):goto@menu
£weedsell
?CHR$(147):gosub@titlebar:gosub@twoseventeen:?CHR$(18)"Sell Weed":?:j=u
gosub@howmuchsell:u=u-k:w=w+(z*k):goto@menu
£spdsell
?CHR$(147):gosub@titlebar:gosub@twosixteen:?CHR$(18)"Sell Speed":?:j=t
gosub@howmuchsell:t=t-k:w=w+(s*k):goto@menu
£ludsell
?CHR$(147):gosub@titlebar:gosub@twosixteen:?CHR$(18)"Sell Ludes":?:j=q
gosub@howmuchsell:q=q-k:w=w+(l*k):goto@menu
£alreadythere
?CHR$(147):gosub@titlebar:gosub@jetalthere:?
?"You're already in:":?" ";p$:gosub@timerc:goto@jet
£subway
?CHR$(147):gosub@daily:V=int(V*1.1+.5):E=int(E*1.06+.5):gosub@titlebar:gosub@twoeighteen
?CHR$(18)"Subway":?
ifb=1goto@cheapludes
ifb=2goto@cheepweed
ifb=3goto@pigheroin
ifb=4goto@heroinbust
ifb=5goto@heroinbust
ifb=6goto@cokebust
ifb=7goto@cokebust
ifb=8goto@mugged
ifb=9goto@cops
ifb=10goto@cops
ifb=11goto@cops
ifb=12goto@gunbuy
ifb=13goto@gunbuy
ifb=14goto@dedweed
ifb=15goto@newcoat
ifb=16goto@dedguy
ifb=17goto@homeacid
£nothinghappens
poke211,8:sys58640:?:?"Welcome to ";p$:?:gosub@timerc:goto@menu
£cheapludes
?"Rival dealers are selling cheap ludes!":l=2:gosub@timerc:goto@menu
£cheepweed
?"Weed prices have bottomed-out!":z=122:gosub@timerc:goto@menu
£pigheroin
?"Pigs are selling cheap heroin":?"from last week's raid!"
h=int((rnd(1)*1150)+850.5):gosub@timerc:goto@menu
£heroinbust
?"Addicts are buying heroin":?"at outrageous prices!"
h=int((rnd(1)*25000)+18000.5):gosub@timerc:goto@menu
£cokebust
?"Pigs made a big coke bust!":?"Prices are outrageous!!!!"
c=int((rnd(1)*60000)+80000.5):gosub@timerc:goto@menu
£mugged
?"You got mugged!":?:j=int(w/3):j=int(j*2):k=int(w-j)
?"You lost $";k:w=j:gosub@timerc:gosub@menu
£cops
gosub @freespace
[
my improved revisions will likely add some additional
conditions on how/when we run cops
]
iff>i/2thengoto@nothinghappens
ifb=9thenb=2
ifb=10thenb=4
ifb=11thenb=5
?"It's the cops!":?:?"Officer Hardass and ";B-1;" of his"
?"deputies are after you!":?:gosub@timerc
£police
?CHR$(147):gosub@titlebar:gosub@chase:?:?:?"View (G)uns":?"View (D)amage"
?"(N)umber of pigs":?"(R)un":?"(F)ight":?
input"What do you want to do?";x$
ifx$="G"goto@pgun
ifx$="D"goto@damage
ifx$="N"goto@ncops
ifx$="R"goto@run
ifX$="F"goto@fight
goto@police
£pgun
?CHR$(147):gosub@titlebar:gosub@chase:?:?
Ifg=1then?"You have 1 gun.":gosub@wait:goto@police
?"You have ";g;" guns.":?:gosub@wait:goto@police
£damage
?CHR$(147):gosub@titlebar:gosub@chase
?:?:?"Your current health is ";bb;".":?
?"0 and you die!":?:gosub@wait:goto@police
£ncops
?CHR$(147):gosub@titlebar:gosub@chase
Ifb=1then?:?:?"There is 1 pig still chasing you!":?:?:gosub@wait:goto@police
?:?:?"There are ";b;" pigs still chasing you!":?:?:gosub@wait:goto@police
£run
?CHR$(147):gosub@titlebar:gosub@chase:?:?:?"RUNNING...":gosub@timera
ifk=0then?"You lost them in an alley!":goto@loserun
?"You can't shake them!":?:goto@next
£loserun
?:gosub@wait:goto@menu
£fight
ifg>0goto@fightc
?:?"YOU DON'T HAVE ANY GUNS!":gosub@wait:goto@police
£fightc
?CHR$(147):gosub@titlebar:gosub@chase:?:?"You shoot!":gosub@timera
IfK=0GOTO@miss
?"You got one!":?:?:b=b-1:goto@next
£miss
?"You missed!":?:?
£next
Ifb<=0goto@allgone
gosub@timerb:?"They're firing at you!":gosub@timera
ifk=0goto@theymiss
?"You've been hit!":bb=bb-6
ifbb<=0goto@ded
goto@nexta
£theymiss
?"They missed!"
£nexta
gosub@timerc:goto@police
£ded
?:?"You've been killed!":gosub@wait:goto@endgame
£allgone
?"You killed all of them!":?:gosub@timera:j=int(((rnd(1)*1250)+750)+.5)
w=w+j:?"You found $";j;" on officer Hardass'":?"carcass!"
ifw>=1200goto@doctor
goto@menu
£doctor
gosub@timerc:?:?"Will you pay $1000 for a doctor":input"to sew you up?(Y/N)";x$
ifX$<>"Y"goto@menu
w=w-1000:bb=0:goto@menu
£gunbuy
ifw<500goto@nothinghappens
gosub@freespace
iff<5goto@nothinghappens
j=int((rnd(1)*2)+.5)
ifj=0then y$="Baretta"
ifj=1then y$="Saturday Night Special"
ifj=2then y$=".44 Magnum"
?"Will you buy a ";y$:input"for $400?(Y/N)";x$
ifx$<>"Y"goto@menu
g=g+1:w=w-400:goto@menu
£dedweed {don't smoke the weed}
?"There's some weed here that smells"
?"like good stuff!!":?:input"Will you smoke it?(Y/N)";X$
IfX$="Y"GOTO@weedend
goto@menu
£newcoat
ifw<300goto@nothinghappens
?"Will you buy a new trenchcoat"
input"with more pockets for $200?(Y/N)";X$
ifX$<>"Y"goto@menu
i=i+10:w=w-200:goto@menu
£dedguy
gosub@freespace:Iff<8goto@nothinghappens
j=int((rnd(1)*7)+1.5):k=int(rnd(1)*5+.5)
ifk=0THENq=q+j:y$="Ludes"
ifk=1THENt=t+j:y$="Speed"
ifk=2THENu=u+j:y$="Weed"
ifk=3THENo=o+j:y$="Acid"
ifk=4THENn=n+j:y$="Heroin"
ifk=5THENm=m+j:y$="Cocaine"
?"You found ";j;" units of ";y$
?"on a dead dude in the subway!":?
gosub@timerc:goto@menu
£homeacid
?"The market has been flooded":?"with cheap home-made acid!"
a=int((rnd(1)*550)+250.5):gosub@timerc:goto@menu
£payme
INPUT"Repay how much?";k
IFk>wTHEN?:?"YOU DON'T HAVE THAT MUCH!":GOSUB@timerb:GOTO@LOAN
IF k>v THEN?:?"YOU DON'T OWE THAT MUCH!":GOSUB@timerb:GOTO@LOAN
W=W-k:v=v-k:?:?"THANK YOU.":GOSUB@timerc:GOTO@MENU
£borrow
?:Input"How much do you want?";K:?:j=int((rnd(1)*10000)+5000)
ifk<0then?"trying to rob me? double debt!":ad=ad+3:v=v*2:gosub@timerc:goto@menu
ifK>14000then?"He's not that stupid!":gosub@timerc:goto@menu
ifK>Jthen?"He doesn't feel like it.":gosub@timerb:goto@menu
v=v+k:w=w+k:?:?"Here's your money.":?:?"Remember, I break thumbs."
gosub@timerc:goto@menu
£deposit
?:k=int((rnd(1)*100)+1):INPUT"How much?";j:ifk=64goto@chaching
ifj<0then?"You tried to rob the bank, but failed!":ad=ad+3:gosub@timerb:goto@menu
Ifj>wthen?"You don't have that much cash.":goto@deposit
£chaching
e=e+j:w=w-j:?:?"Thank you for your deposit.":ifw<0thenw=w*-1
gosub@timerc:goto@menu
[
£egg
?"You found the easter egg!"
?
?"$1,000,000 has been deposited in to your account."
gosub@timerc
goto@bank
]
£mymoney
?:INPUT"How much?";j:
ifj<0then?chr$(18)"Try making a deposit, idiot.":goto@timerb:goto@bank
Ifj>ethen?"You don't have sufficient funds.":goto@mymoney
e=e-j:w=w+j:?:?"Thank you for your business.":gosub@timerc:goto@menu
£instructions
?CHR$(147):poke211,3:sys58640:?"welcome to drugwar/64 version";rv
poke211,9:sys58640:?"ported from drugwar//e":?:?:?:?:?:?:?
poke211,5:sys58640:?"based on the ti-basic clone of"
poke211,7:sys58640:?"john e. dell's 1984 drugwar"
poke211,11:sys58640:?"for ibm and trs-80":?:?:?:?
poke211,6:sys58640:?"applesoft version by jay moore"
poke211,10:sys58640:?"c64 port by jay moore":poke211,1:poke214,23:sys58640
input "would you like instructions?(y/n)";x$:gosub@seed {c64}
{j=RND(-1 *(PEEK(78)+256*PEEK(79))) - applesoft}
IfX$="Y"THENGOTO@inst
GOTO@gamestart
£inst
?CHR$(147):gosub@titlebar:gosub@seed:?
?"This is a game of buying and selling."
?"Your goal is to pay off your debt and"
?"make as much money as possible in a one"
?"month period. Prices change every day"
?"and interest on your loan is calculated as well."
?:?"Deal too heavily and you'll attract the"
?"attention of the police.":?
?"Commands are entered using the letter"
?"highlighted (L)ike (S)o. Y is yes and"
?"anything counts as no.":gosub@wait:goto@gamestart
£threestrikes
?CHR$(147):poke211,7:poke214,9:sys58640:?"Put a quarter in your ass":gosub@timerb
poke211,6:sys58640:?"'Cause you played yourself!":gosub@timerc
poke214,18:poke211,10:sys58640:?"Don't cheat so much.":end
£weedend
?CHR$(147):gosub@titlebar:gosub@twofifteen:?CHR$(18)"SMOKE Weed"
?"You hallucinate on the wildest trip"
?"of your life, stumble on to the tracks,"
?"and get creamed by a train!":?:?
poke211,7:sys58640:?"Just say NO to drugs!"
gosub@timerc:gosub@timerb:goto@ironicend
£endgame
?CHR$(147):gosub@titlebar:gosub@scorecalculate:gosub@gmod:?
?"Your score on a scale of 1 to 100:";k
?:input "Would you like to play again?(Y/N)";x$:if x$="Y" then goto@gamestart
?:?:?"Remember to watch your back":?"Thanks for playing"
?"and have a nice day.":end
£ironicend
?CHR$(147):gosub@titlebar:gosub@gmod
?:?"You died from smoking weed.":?:?:gosub@timerc
?"See? Games are totally fake.":?:input "Would you like to play again?";x$
ifx$="Y"THENGOTO@GAMESTART
end