home *** CD-ROM | disk | FTP | other *** search
/ ISV Strong Games / ISV_STRONG_GAMES.iso / arcade / jawwars / !JawWars / !RunImage3 (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1998-05-10  |  17KB  |  656 lines

  1.  >!RunImage
  2.  Jaw Wars - Acorn 32-bit version (development)
  3.  All code, graphics, sound and design by Stephen Scott
  4.  1993, 1996, 1997, 1998
  5. wimp_initialise
  6. game_initialise
  7.  quit%
  8. wimp_poll
  9. remove_sounds
  10.  "Wimp_CloseDown"
  11.  INITIALISE WIMP FRONT END
  12. wimp_initialise
  13.  block% 520,imenu% 100,winind% 400
  14. quit%=
  15. app$="JawWars"
  16.  "Wimp_Initialise",200,&4B534154,app$,0 
  17.  ver,t_handle
  18. report(
  19. $+" at line "+
  20.  Check version of Risc OS and load either flat or 3D templates
  21.  ver=200 
  22.  "Wimp_OpenTemplate",,"<JawWar$Dir>.Templates2"
  23.  "Wimp_OpenTemplate",,"<JawWar$Dir>.Templates3"
  24.  "Wimp_LoadTemplate",,block%,winind%,winind%+400,-1,"info",0 
  25.  ,,freeind%
  26.  "Wimp_CreateWindow",,block% 
  27.  info%
  28.  "Wimp_CloseTemplate"
  29.  Set up menus and install on icon bar
  30. create_menu(imenu%)
  31. '<ibar%=
  32. create_icon(-1,0,0,136,68,&3002,"!jawwars",0,0,0)
  33.  Jaw Wars,3
  34.  0,info%,Info
  35.  0,-1,Help
  36.  &80,-1,Quit
  37.  REPORT WIMP BASED ERROR MESSAGES
  38. report(mess$,flag%)
  39. !block%=255
  40. 5;$(block%+4)=mess$+" Jaw Wars must exit immediately!"+
  41. name$=app$
  42.  flag% 
  43.  name$="Message from "+name$
  44.  "Wimp_ReportError",block%,flag%,name$ 
  45.  ,errclick%
  46.  flag% 
  47.  "Wimp_CloseDown"
  48.  WIMP POLLING LOOP
  49. wimp_poll
  50.  "Wimp_Poll",0,block% 
  51.  reason%
  52.  reason% 
  53.  "Wimp_OpenWindow",,block%
  54.  "Wimp_CloseWindow",,block%
  55. mouse_click(block%!8,block%!16)
  56. menu_select
  57.  17,18:
  58. receive_message
  59.  DETECT WIMP MOUSE CLICKS
  60. mouse_click(button%,icon%)
  61.  button% 
  62.  1,4:
  63. mode%=
  64.  "OS_Byte",21,0
  65.  "Wimp_SetMode",mode%
  66.  "Wimp_CreateMenu",,imenu%,!block%-64,228
  67.  DETECT SELECTIONS ON ICON BAR MENU
  68. menu_select
  69. sel%=!block%
  70.  sel% 
  71.  "Filer_Run <JawWar$Dir>.!Help"
  72. quit%=
  73.  DETECT WIMP MESSAGES
  74. receive_message
  75.  block%!16 
  76.  0:quit%=
  77.  CREATE MENU
  78. create_menu(menu%)
  79.  title$,num%
  80. $menu%=title$
  81. width%=(
  82. (title$)-2)*16
  83. menu%!12=&00070207
  84. menu%!20=44
  85. menu%!24=0
  86. ptr%=menu%+28
  87.  i%=1 
  88.  num%
  89.  mflags%,subptr%,item$
  90. !ptr%=mflags%
  91. ptr%!4=subptr%
  92.  item$<>"" 
  93. ptr%!8=&7000021
  94. $(ptr%+12)=item$
  95. (item$)+1)*16
  96. ptr%!8=&7000121
  97.  addr%,len%
  98. ptr%!12=addr%
  99. ptr%!16=null%
  100. ptr%!20=len%
  101. a%=(len%+1)*16
  102.  a%>width% width%=a%
  103. ptr%+=24
  104. menu%!16=width%
  105.  CREATE ICON BAR ICON
  106. create_icon(whan%,ix%,iy%,iw%,ih%,flag%,text$,ptr1%,ptr2%,ptr3%)
  107. !block%=whan%
  108. block%!4=ix%
  109. block%!8=iy%
  110. block%!12=ix%+iw%
  111. block%!16=iy%+ih%
  112. block%!20=flag%
  113.  ptr1%=0 
  114. $(block%+24)=text$
  115. block%!24=ptr1%
  116. block%!28=ptr2%
  117. block%!32=ptr3%
  118.  "Wimp_CreateIcon",,block% 
  119.  ihandle%
  120. =ihandle%
  121.  END OF WIMP CODE
  122.  JAW WARS INITIALISE ARRAYS
  123. game_initialise
  124. #teeth=16    : 
  125.  Number of teeth
  126. 5germs=16    : 
  127.  Maximum number of germs on screen
  128.  exist(teeth)
  129.  decay(teeth)
  130.  count(teeth)
  131.  totalled(teeth)
  132.  tx(teeth),ty(teeth)
  133.  germexist(germs)
  134.  germx(germs),germy(germs)
  135.  g$(germs)
  136.  germpox(germs),germpoy(germs)
  137.  hiscore(5),hiscore$(5)
  138. #hiscore()=0,500,400,300,200,100
  139. 9hiscore$()="","Nuni","Bunny","Dopey","Bruno","Graeme"
  140.  sprites_loaded%=FALSE
  141. sounds_loaded%=
  142. seen%=
  143. load_sprites
  144.  scale% 16
  145. scale%!8=1
  146. scale%!12=1
  147. load_sounds
  148. sounds_loaded%=
  149.  JAW WARS GAME LOOP
  150. error:
  151. spop%=34
  152. scale%!0=1
  153. scale%!4=1
  154. 128+49:
  155. spop%=52
  156. scale%!0=1
  157. scale%!4=2
  158.  seen%=
  159. view_titles
  160. score=0
  161. title_screen
  162. reset_banks
  163. germexist()=
  164. exist()=
  165. fin%=
  166. g$()=""
  167. totalled()=0
  168. total=0
  169. decay()=0
  170. count()=0
  171. count2=0
  172. offset=0
  173. pressed=
  174. stilldown=
  175. bonus=
  176. time=0
  177. frame=0:framtim=0
  178. score=0:loopy=
  179. /paste=9 : 
  180.  Number of shots of toothpaste+1
  181. max=paste 
  182.  data=1 
  183.  teeth
  184.  tx(data),ty(data)
  185.  170,586,308,574
  186.  398,606,496,600
  187.  626,600,748,606
  188.  856,574,932,586: REM Top set
  189.  302,292,374,272
  190.  464,274,548,272
  191.  624,272,702,274
  192.  786,272,878,292: REM Bottom set
  193.  data2=1 
  194.  germs
  195.  germpox(data2),germpoy(data2)
  196.  270,600,351,600
  197.  438,618,558,618
  198.  688,618,800,618
  199.  888,600,970,600: REM Top coords
  200.  342,372,420,372
  201.  500,348,582,348
  202.  660,348,738,348
  203.  825,372,909,372: REM Bottom coords
  204. A%=1:O%=0
  205. A%=2:O%=-32
  206. &2E,spop%+256,area%,"mouth",0,O%,0,scale%,0
  207. print_teeth
  208. text_size(16,16)
  209. outline("Ready?",14,15,23)
  210. A%=1:
  211. text_size(8,8)
  212. A%=2:
  213. text_size(8,16)
  214.  xco,yco,butty
  215. 6,112,fr
  216.  xco,yco,butty
  217. &2E,spop%+256,area%,"mouth",0,O%,0,scale%,0
  218. print_teeth
  219. print_germs
  220. print_stats
  221. update_teeth
  222. framtim+=1
  223.  framtim>4 
  224. 3 frame+=1:
  225.  frame>3 
  226.  frame=0
  227. framtim=0
  228.  bonus=
  229.  paste<10 
  230. (40)=11:bonus=
  231. 2,383,100,100:time=0:blown=
  232. (40)+10
  233.  bonus:
  234. plot("paste",624,524+O%,8):time+=1:
  235.  time>=blown:bonus=
  236. plot("ptr_brush",(xco+offset),(yco-offset),8)
  237. (15)=2:
  238.  butty=4:pressed=
  239. :offset=16
  240.  butty=0:pressed=
  241. :stilldown=
  242. :offset=0
  243.  pressed 
  244.  stilldown:
  245. whatone
  246.  pressed 
  247.  stilldown:offset=16
  248.  butty=0:
  249.  paste>-2 
  250.  paste<max:count2+=1:
  251.  count2>=30:paste+=1:count2=0
  252. (-97) 
  253. 6,113,fr:fr=3-fr
  254.  fin%
  255. end_game
  256. fin%=
  257. print_stats
  258. outline("Score: "+
  259. (score)+" ",1,1,127)
  260. outline("Teeth: "+
  261. (13-total)+" ",30,1,127)
  262.  32,32,1216,32
  263.  paste<1 
  264.  127 
  265.  32,32,paste*32,32
  266. outline(
  267. (paste)+" ",1,30,127)
  268. whatone
  269.  paste<1 
  270. paste-=1
  271. "Splay_shlop2"
  272.  J%=1 
  273.  germs
  274.  xco>=germx(J%)-32 
  275.  xco<=germx(J%)+32 
  276.  yco>=germy(J%)-32 
  277.  yco<=germy(J%)+32 
  278.  germexist(J%)=
  279. germx(J%)=0
  280. germy(J%)=0
  281. germexist(J%)=
  282. score+=20
  283.  OSCLI"Splay_kill1a"
  284. J%=germs
  285. stilldown=
  286.  bonus=
  287.  xco>=592 
  288.  xco<=656 
  289.  yco>=492 
  290.  yco<=556 
  291.  paste>0 
  292.  bonus=
  293. 3,-15,100,100:paste+=20:score+=50
  294. print_teeth
  295.  z=1 
  296.  &2E,spop%+256,area%,"ttooth"+
  297. (decay(z)),tx(z),ty(z)+O%,8,scale%,0
  298.  &2E,spop%+256,area%,"btooth"+
  299. (decay(z+8)),tx(z+8),ty(z+8)+O%,8,scale%,0
  300. whatgerm=
  301. (germs)
  302.  germexist(whatgerm)=
  303.  exist(whatgerm)=
  304. germexist(whatgerm)=
  305. germtype=
  306.  germtype 
  307.  1:g$(whatgerm)="germa"
  308.  2:g$(whatgerm)="germb"
  309.  3:g$(whatgerm)="germa"
  310.  4:g$(whatgerm)="germd"
  311.  5:g$(whatgerm)="germe"
  312.  6:g$(whatgerm)="germf"
  313.  7:g$(whatgerm)="germg"
  314.  8:g$(whatgerm)="germg"
  315. %germx(whatgerm)=germpox(whatgerm)
  316. %germy(whatgerm)=germpoy(whatgerm)
  317. count(whatgerm)+=1
  318. loopy=
  319. print_germs
  320.  m=1 
  321.  germs
  322.  germexist(m):
  323. plot(g$(m)+
  324. (frame),germx(m),germy(m),8)
  325.  germexist(m) 
  326.  exist(m)=
  327. :count(m)+=1
  328. update_teeth
  329.  n=1 
  330.  teeth
  331.  exist(n) 
  332.  decay(n)<4 
  333.  count(n)>49:decay(n)+=1:count(n)=0:score-=1
  334.  germexist(n) 
  335.  count(n)=0 
  336.  n>0 
  337.  n<9 
  338.  germy(n)+=16:germpoy(n)+=16
  339.  n>8 
  340.  germy(n)-=16:germpoy(n)-=16
  341. 4,-15,10000+(total*500),1
  342. exist(n)=
  343. totalled(n)=1
  344. total+=totalled(n)
  345. score-=10
  346. decay(n)=4
  347. count(n)=0
  348.  total>13 
  349.  fin%=
  350. end_game
  351. text_size(16,16)
  352. outline("Game Over",11,15,23)
  353. text_size(8,8)
  354. plot(x$,x,y,m)
  355. &2E,spop%+256,area%,x$,x-32,y-32,m,scale%,0
  356. remove_sounds
  357.  sounds_loaded% 
  358. "RMKill jwvoice"
  359. "RMKill kill1a"
  360. "RMKill lovely"
  361. "RMKill ouch"
  362. "RMKill belch1"
  363. "RMKill shlop2"
  364.  OSCLI"RMKill gover"
  365.  I=1 
  366. "ChannelVoice "+
  367. (I)+" "+
  368. error
  369. *FX15,0
  370. remove_sounds
  371. "Desktop"
  372. "An error has been found. Jaw Wars will now remove itself from the icon bar;"
  373. '"Error type: ";
  374. '"Location  : ";
  375. '"Just in case, try resetting the machine, and run Jaw Wars again."
  376. '"If all else fails, consult the !ReadMe file for details on how to report bugs."
  377. '"Press space to return to the desktop..."
  378. "Desktop"
  379. swap_banks
  380.  "OS_Byte",113,scr
  381. scr=3-scr
  382.  "OS_Byte",112,scr
  383. reset_banks
  384.  "OS_Byte",112,2
  385.  "OS_Byte",113,2
  386. load_sprites
  387.  IF sprites_loaded% THEN ENDPROC
  388. s$="<JawWar$Dir>.Spriteys"
  389.  "OS_File",5,s$ 
  390.  ,,,,size%
  391.  area% size%+32
  392. area%!0=size%+32
  393. area%!4=0
  394. area%!8=16
  395. area%!12=16
  396.  &2E,256+9,area%
  397.  &2E,256+10,area%,s$
  398.  sprites_loaded%=TRUE
  399. load_sounds
  400.  IF sounds_loaded% THEN ENDPROC
  401. fx$="<JawWar$Dir>"
  402.  Oak Recorder Voices (use ChannelVoice on these)
  403. "RMLoad "+fx$+".belch1"
  404. "RMLoad "+fx$+".lovely"
  405. "RMLoad "+fx$+".ouch"
  406. "RMLoad "+fx$+".jwvoice"
  407.  OSCLI"RMLoad "+fx$+".gover"
  408.  SoundCon Voices (Use splay_NAME on these)
  409. "RMLoad "+fx$+".kill1a"
  410. "RMLoad "+fx$+".shlop2"
  411.  OSCLI"RMLoad "+fx$+".kill5"
  412.  OSCLI"RMLoad "+fx$+".munch1"
  413.  sounds_loaded%=TRUE
  414. "ChannelVoice 2 belch1"
  415. "ChannelVoice 3 lovely"
  416. "ChannelVoice 4 ouch"
  417. "ChannelVoice 5 jwvoice"
  418.  OSCLI"ChannelVoice 6 gover"
  419. "RMKill jwvoice"
  420. "RMKill kill1a"
  421. "RMKill lovely"
  422. "RMKill ouch"
  423. "RMKill belch1"
  424. "RMKill shlop2"
  425.  OSCLI"RMKill gover"
  426.  I=1 
  427. "ChannelVoice "+
  428. (I)+" "+
  429. title_screen
  430. fadein=0
  431. fadeout=0
  432. pressed=
  433. 6,112,fr
  434.  fadein>0 
  435.  200 
  436.  192:
  437. fade_in(fadein)
  438.  fadein<17 fadein+=1
  439. (-99) 
  440.  pressed=
  441. 6,113,fr:fr=3-fr
  442.  fadein>16 
  443.  pressed
  444. text_size(16,16)
  445. outline("Jaw Wars",12,1,127):
  446. 5,383,100,100
  447. text_size(4,8)
  448. line_x=0.5
  449. line_y=5
  450. pressed=
  451. (-99) 
  452.  pressed=
  453.  line$
  454.  line$="  Use the mouse to move the toothbrush" 
  455.  line_x=20.5:line_y=5
  456. outline(line$,line_x,line_y,45)
  457. line_y+=1.1
  458.  line$="Press the spacebar to play the game..." 
  459.  pressed
  460. text_size(8,8)
  461.  pressed:pressed=
  462. 26,4:
  463. outline("Directed by Stephen Scott",7.5,27,104)
  464. outline("Version 0.9841b (11th May, 1998)",4,28.1,104)
  465. outline("
  466.  tapestry multimedia 1993-1998",4.5,29.2,104)
  467. framtim=0:scr=0
  468. frame=0:soundtim=0
  469.  pressed=FALSE
  470. 24,440;200;904;264;
  471. plot("germa"+
  472. (frame),472,232,8):  
  473.  abdefg
  474. plot("germb"+
  475. (frame),552,232,8)
  476. plot("germd"+
  477. (frame),632,232,8)
  478. plot("germe"+
  479. (frame),712,232,8)
  480. plot("germf"+
  481. (frame),792,232,8)
  482. plot("germg"+
  483. (frame),872,232,8)
  484. framtim+=1:soundtim+=1
  485.  framtim>49 
  486.  200 
  487.  128:
  488. N frame+=1:
  489.  frame>3 
  490.  frame=0
  491. framtim=0
  492.  soundtim>299 
  493.  5,383,
  494. (100)+50,100
  495. soundtim=0
  496. (-99) 
  497.  pressed=
  498.  pressed 
  499.    ffffffffffffffffffffffffffffffffffffff
  500.  "  Thanks  for  your   support  in  the"
  501.  "development of  Jaw Wars. This game is"
  502.  "currently  in  the  beta  stages   and"
  503.  "therefore incomplete. Features may  be"
  504.  "added  and/or taken away with  further"
  505.  "releases. Send  me  ideas/bug reports/"
  506.  "improvements and you will get credited"
  507.  "in the final release later in 1998!"
  508.  "  I know I promised extra  playability"
  509.  "but this version  instead utilises the"
  510.  "GameModes module on the Risc PC to get"
  511.  "rid of letterboxing. The mouth graphic"
  512.  "has also been improved yet again."
  513.  "  Use the mouse to move the toothbrush"
  514.  "and wipe out the bad germs before your"
  515.  "teeth all  rot away.  Don't  forget to"
  516.  "recharge  your brush  with toothpaste."
  517.  "Extra tubes  will appear when you need"
  518.  "them!"
  519.  "  Click Select to activate your brush."
  520.  "And I mean  CLICK - you  cant  hold it"
  521.  "down and 'cheat' for now."
  522.  "  Press the TAB key at any time during"
  523.  "gameplay to return to the desktop."
  524.  "Press the spacebar to play the game..."
  525. text_size(x%,y%)
  526.  23,17,7,6,x%;y%|
  527. outline(t$,x,y,c)
  528. tx=x*32
  529.  A%=1:ty=1024-(y*32)
  530.  A%=2:ty=960-(y*30)
  531.  tx-4,ty:
  532.  tx+4,ty:
  533.  tx,ty+4:
  534.  tx,ty-4:
  535.  tx-4,ty-4:
  536.  tx+4,ty+4:
  537.  tx,ty:
  538. view_titles
  539. seen%=
  540. pressed=
  541. fadein=0
  542. fadeout=0
  543. s$="<JawWar$Dir>.title"
  544.  "OS_File",5,s$ 
  545.  ,,,,size1%
  546.  area1% size1%+32
  547. area1%!0=size1%+32
  548. area1%!4=0
  549. area1%!8=16
  550. area1%!12=16
  551.  &2E,256+9,area1%
  552.  &2E,256+10,area1%,s$
  553. 6,112,fr
  554.  fadein>0: 
  555.  192:
  556.  &2E,34+256,area1%,"tapestry",388,428,0
  557. fade_in(fadein)
  558.  fadein<17 fadein+=1
  559. (-99) 
  560.  pressed=
  561. 6,113,fr:fr=3-fr
  562.  fadein>16 
  563.  pressed
  564.  pressed 
  565. 6,112,fr
  566.  192:
  567.  &2E,34+256,area1%,"tapestry",388,428,0
  568. fade_out(fadeout)
  569.  fadeout<17 fadeout+=1
  570. (-99) 
  571.  pressed=
  572. 6,113,fr:fr=3-fr
  573.  fadeout>16 
  574.  pressed
  575.  pressed 
  576. fade_out(fadeout)
  577.  fadeout 
  578. 2,63 
  579.  3*64
  580. 2,63 
  581.  2*64
  582. 2,63 
  583.  1*64
  584. 2,63 
  585.  0*64
  586. 2,42 
  587.  3*64
  588. 2,42 
  589.  2*64
  590. 2,42 
  591.  1*64
  592. 2,42 
  593.  0*64
  594. 2,21 
  595.  3*64
  596. 2,21 
  597.  2*64
  598. 2,21 
  599.  1*64
  600. 2,21 
  601.  0*64
  602. 2,00 
  603.  3*64
  604. 2,00 
  605.  2*64
  606. 2,00 
  607.  1*64
  608. 2,00 
  609.  0*64
  610.  fadeout>0 
  611.  A%=1:
  612.  0,0,1280,1024
  613.  fadeout>0 
  614.  A%=2:
  615.  0,0,1280,960
  616. fade_in(fadein)
  617.  fadein 
  618. 2,00 
  619.  0*64
  620. 2,00 
  621.  1*64
  622. 2,00 
  623.  2*64
  624. 2,00 
  625.  3*64
  626. 2,21 
  627.  0*64
  628. 2,21 
  629.  1*64
  630. 2,21 
  631.  2*64
  632. 2,21 
  633.  3*64
  634. 2,42 
  635.  0*64
  636. 2,42 
  637.  1*64
  638. 2,42 
  639.  2*64
  640. 2,42 
  641.  3*64
  642. 2,63 
  643.  0*64
  644. 2,63 
  645.  1*64
  646. 2,63 
  647.  2*64
  648. 2,63 
  649.  3*64
  650.  fadein>0 
  651.  A%=1:
  652.  0,0,1280,1024
  653.  fadein>0 
  654.  A%=2:
  655.  0,0,1280,960
  656.