home *** CD-ROM | disk | FTP | other *** search
/ ISV Strong Games / ISV_STRONG_GAMES.iso / arcade / jawwars / !JawWars / !RunImage2 (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1998-04-19  |  17KB  |  651 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.  CASE A% OF
  152.  WHEN 1:
  153. spop%=34
  154. scale%!0=1
  155. scale%!4=1
  156.  WHEN 2:
  157.  MODE49
  158.  spop%=52
  159.  scale%!0=1
  160.  scale%!4=2
  161.  ENDCASE
  162.  seen%=
  163. view_titles
  164. score=0
  165. title_screen
  166. reset_banks
  167. germexist()=
  168. exist()=
  169. fin%=
  170. g$()=""
  171. totalled()=0
  172. total=0
  173. decay()=0
  174. count()=0
  175. count2=0
  176. offset=0
  177. pressed=
  178. bonus=
  179. time=0
  180. frame=0:framtim=0
  181. score=0:loopy=
  182. /paste=9 : 
  183.  Number of shots of toothpaste+1
  184. max=paste 
  185.  data=1 
  186.  teeth
  187.  tx(data),ty(data)
  188.  170,586,308,574
  189.  398,606,496,600
  190.  626,600,748,606
  191.  856,574,932,586: REM Top set
  192.  302,292,374,272
  193.  464,274,548,272
  194.  624,272,702,274
  195.  786,272,878,292: REM Bottom set
  196.  data2=1 
  197.  germs
  198.  germpox(data2),germpoy(data2)
  199.  270,600,351,600
  200.  438,618,558,618
  201.  688,618,800,618
  202.  888,600,970,600: REM Top coords
  203.  342,372,420,372
  204.  500,348,582,348
  205.  660,348,738,348
  206.  825,372,909,372: REM Bottom coords
  207. &2E,spop%+256,area%,"mouth",0,0,0,scale%,0
  208. print_teeth
  209. text_size(16,16)
  210. outline("Ready?",14,15,23)
  211. text_size(8,8):
  212. VDU4:OFF
  213.  xco,yco,butty
  214. 6,112,fr
  215.  xco,yco,butty
  216. &2E,spop%+256,area%,"mouth",0,0,0,scale%,0
  217. print_teeth
  218. print_germs
  219. print_stats
  220. update_teeth
  221. framtim+=1
  222.  framtim>4 
  223. / frame+=1:
  224.  frame>3 
  225.  frame=0
  226. framtim=0
  227.  bonus=
  228.  paste<10 
  229. (40)=11:bonus=
  230. 2,383,100,100:time=0:blown=
  231. (40)+10
  232.  bonus:
  233. plot("paste",624,524,8):time+=1:
  234.  time>=blown:bonus=
  235. plot("ptr_brush",(xco+offset),(yco-offset),8)
  236. (15)=2:
  237.  butty=4 
  238.  pressed=
  239. pressed=
  240. offset=16
  241. whatone
  242.  butty=4 
  243.  pressed=
  244. :pressed=
  245. :offset=16:
  246. whatone
  247.  butty=4 
  248.  pressed 
  249.  pressed=
  250. :offset=0
  251.  butty=0 
  252.  pressed 
  253.  pressed=
  254. :offset=0
  255.  butty=0:
  256.  paste>-2 
  257.  paste<max:count2+=1:
  258.  count2>=30:paste+=1:count2=0
  259. (-97) 
  260. 6,113,fr:fr=3-fr
  261.  fin%
  262. end_game
  263. fin%=
  264. print_stats
  265. outline("Score: "+
  266. (score)+" ",1,1,127)
  267. outline("Teeth: "+
  268. (13-total)+" ",30,1,127)
  269.  32,32,1216,32
  270.  paste<1 
  271.  127 
  272.  32,32,paste*32,32
  273. 1,30);paste;" ";
  274. whatone
  275. LOCAL val
  276.  paste<1 
  277. "Splay_shlop2"
  278. paste-=1
  279.  loopy=
  280. val=1:hit=
  281. ^'gx1=germx(val)-32:gx2=germx(val)+32
  282. _'gy1=germy(val)-32:gy2=germy(val)+32
  283.  xco>=gx1:
  284.  xco<=gx2:
  285.  yco>=gy1:
  286.  yco<=gy2:germexist(val)=
  287. :germx(val)=0:germy(val)=0:score+=20:hit=
  288. val+=1
  289.  val=(germs+1) 
  290.  hit:hit=
  291. :gx1=0:gx2=0:gy1=0:gy2=0:
  292. "Splay_kill1a":hit=
  293.  bonus=
  294.  xco>=592 
  295.  xco<=656 
  296.  yco>=492 
  297.  yco<=556 
  298.  paste>0 
  299.  bonus=
  300. 3,-15,100,100:paste+=20:score+=50
  301. OSCLI"Splay_shlop2"
  302.  xco-32,yco-32,64,64
  303. FOR blow=1 TO germs
  304. IF xco>=germx(blow)-32 AND xco<=germx(blow)+32 AND yco>=germy(blow)-32 AND yco<=germy(blow)+32 AND paste>=0:germexist(blow)=FALSE:germx(blow)=0:germy(blow)=0:score+=20:NEXT:REMOSCLI"Splay_kill1a":
  305. print_teeth
  306.  z=1 
  307.  &2E,spop%+256,area%,"ttooth"+
  308. (decay(z)),tx(z),ty(z),8,scale%,0
  309.  &2E,spop%+256,area%,"btooth"+
  310. (decay(z+8)),tx(z+8),ty(z+8),8,scale%,0
  311. whatgerm=
  312. (germs)
  313.  germexist(whatgerm)=
  314.  exist(whatgerm)=
  315. germexist(whatgerm)=
  316. germtype=
  317.  germtype 
  318.  1:g$(whatgerm)="germa"
  319.  2:g$(whatgerm)="germb"
  320.  3:g$(whatgerm)="germa"
  321.  4:g$(whatgerm)="germd"
  322.  5:g$(whatgerm)="germe"
  323.  6:g$(whatgerm)="germf"
  324.  7:g$(whatgerm)="germg"
  325.  8:g$(whatgerm)="germg"
  326. %germx(whatgerm)=germpox(whatgerm)
  327. %germy(whatgerm)=germpoy(whatgerm)
  328. count(whatgerm)+=1
  329. loopy=
  330. print_germs
  331.  m=1 
  332.  germs
  333.  germexist(m):
  334. plot(g$(m)+
  335. (frame),germx(m),germy(m),8)
  336.  germexist(m) 
  337.  exist(m)=
  338. :count(m)+=1
  339. update_teeth
  340.  n=1 
  341.  teeth
  342.  exist(n) 
  343.  decay(n)<=3 
  344.  count(n)>=50:decay(n)+=1:count(n)=0:score-=1
  345.  germexist(n) 
  346.  count(n)=0 
  347.  n>=1 
  348.  n<=8 
  349.  germy(n)+=16:germpoy(n)+=16
  350.  n>=9 
  351.  germy(n)-=16:germpoy(n)-=16
  352. 4,-15,10000+(total*500),1
  353. exist(n)=
  354. totalled(n)=1
  355. total+=totalled(n)
  356. score-=100
  357. decay(n)=4
  358. count(n)=0
  359.  total>=14 
  360.  fin%=
  361. end_game
  362. text_size(16,16)
  363. outline("Game Over",11,15,23)
  364. text_size(8,8)
  365. plot(x$,x,y,m)
  366. &2E,spop%+256,area%,x$,x-32,y-32,m,scale%,0
  367. remove_sounds
  368.  sounds_loaded% 
  369. "RMKill jwvoice"
  370. "RMKill kill1a"
  371. "RMKill lovely"
  372. "RMKill ouch"
  373. "RMKill belch1"
  374. "RMKill shlop2"
  375.  OSCLI"RMKill gover"
  376.  I=1 
  377. "ChannelVoice "+
  378. (I)+" "+
  379. error
  380. remove_sounds
  381. "Desktop"
  382. "An error has been found. Jaw Wars will now remove itself from the icon bar;"
  383. '"Error type: ";
  384. '"Location  : ";
  385. '"Just in case, try resetting the machine, and run Jaw Wars again."
  386. '"If all else fails, consult the !ReadMe file for details on how to report bugs."
  387. '"Press space to return to the desktop..."
  388. "Desktop"
  389. swap_banks
  390.  "OS_Byte",113,scr
  391. scr=3-scr
  392.  "OS_Byte",112,scr
  393. reset_banks
  394.  "OS_Byte",112,2
  395.  "OS_Byte",113,2
  396. load_sprites
  397.  IF sprites_loaded% THEN ENDPROC
  398. s$="<JawWar$Dir>.Spriteys"
  399.  "OS_File",5,s$ 
  400.  ,,,,size%
  401.  area% size%+32
  402. area%!0=size%+32
  403. area%!4=0
  404. area%!8=16
  405. area%!12=16
  406.  &2E,256+9,area%
  407.  &2E,256+10,area%,s$
  408.  sprites_loaded%=TRUE
  409. load_sounds
  410.  IF sounds_loaded% THEN ENDPROC
  411. fx$="<JawWar$Dir>"
  412.  Oak Recorder Voices (use ChannelVoice on these)
  413. "RMLoad "+fx$+".belch1"
  414. "RMLoad "+fx$+".lovely"
  415. "RMLoad "+fx$+".ouch"
  416. "RMLoad "+fx$+".jwvoice"
  417.  OSCLI"RMLoad "+fx$+".gover"
  418.  SoundCon Voices (Use splay_NAME on these)
  419. "RMLoad "+fx$+".kill1a"
  420. "RMLoad "+fx$+".shlop2"
  421.  OSCLI"RMLoad "+fx$+".kill5"
  422.  OSCLI"RMLoad "+fx$+".munch1"
  423.  sounds_loaded%=TRUE
  424. "ChannelVoice 2 belch1"
  425. "ChannelVoice 3 lovely"
  426. "ChannelVoice 4 ouch"
  427. "ChannelVoice 5 jwvoice"
  428.  OSCLI"ChannelVoice 6 gover"
  429. "RMKill jwvoice"
  430. "RMKill kill1a"
  431. "RMKill lovely"
  432. "RMKill ouch"
  433. "RMKill belch1"
  434. "RMKill shlop2"
  435.  OSCLI"RMKill gover"
  436.  I=1 
  437. "ChannelVoice "+
  438. (I)+" "+
  439. title_screen
  440. fadein=0
  441. fadeout=0
  442. pressed=
  443.  fadein>0 
  444.  200 
  445.  192:
  446. fade_in(fadein)
  447.  fadein<17 fadein+=1
  448. (-99) 
  449.  pressed=
  450.  fadein>16 
  451.  pressed
  452. text_size(16,16)
  453. outline("Jaw Wars",12,1,127):
  454. 5,383,100,100
  455. text_size(4,8)
  456. line_x=0.5
  457. line_y=5
  458. pressed=
  459. (-99) 
  460.  pressed=
  461.  line$
  462.  line$="  Use the mouse to move the toothbrush" 
  463.  line_x=20.5:line_y=5
  464. outline(line$,line_x,line_y,45)
  465. line_y+=1.1
  466.  line$="Press the spacebar to play the game..." 
  467.  pressed
  468. text_size(8,8)
  469.  pressed:pressed=
  470. 26,4:
  471. outline("Directed by Stephen Scott",7.5,27,104)
  472. outline("Version 0.9841b (19th April, 1998)",3,28.1,104)
  473. outline("
  474.  tapestry multimedia 1993-1998",4.5,29.2,104)
  475. framtim=0:scr=0
  476. frame=0:soundtim=0
  477.  pressed=FALSE
  478. 24,440;200;904;264;
  479. plot("germa"+
  480. (frame),472,232,8):  
  481.  abdefg
  482. plot("germb"+
  483. (frame),552,232,8)
  484. plot("germd"+
  485. (frame),632,232,8)
  486. plot("germe"+
  487. (frame),712,232,8)
  488. plot("germf"+
  489. (frame),792,232,8)
  490. plot("germg"+
  491. (frame),872,232,8)
  492. framtim+=1:soundtim+=1
  493.  framtim>49 
  494.  200 
  495.  128:
  496. O frame+=1:
  497.  frame>3 
  498.  frame=0
  499. framtim=0
  500.  soundtim>299 
  501.  5,383,
  502. (100)+50,100
  503. soundtim=0
  504. (-99) 
  505.  pressed=
  506.  pressed 
  507.    ffffffffffffffffffffffffffffffffffffff
  508.  "  Thanks  for  your   support  in  the"
  509.  "development of  Jaw Wars. This game is"
  510.  "currently  in  the  beta  stages   and"
  511.  "therefore incomplete. Features may  be"
  512.  "added  and/or taken away with  further"
  513.  "releases. Send  me  ideas/bug reports/"
  514.  "improvements and you will get credited"
  515.  "in the final release later in 1998!"
  516.  "  I know I promised extra  playability"
  517.  "but this version  instead utilises the"
  518.  "GameModes module on the Risc PC to get"
  519.  "rid of letterboxing. The mouth graphic"
  520.  "has also been improved yet again."
  521.  "  Use the mouse to move the toothbrush"
  522.  "and wipe out the bad germs before your"
  523.  "teeth all  rot away.  Don't  forget to"
  524.  "recharge  your brush  with toothpaste."
  525.  "Extra tubes  will  appear when you need"
  526.  "them!"
  527.  "  Click Select to activate your brush."
  528.  "And I mean  CLICK - you  cant  hold it"
  529.  "down and 'cheat' for now."
  530.  "  Press the TAB key at any time during"
  531.  "gameplay to return to the desktop."
  532.  "Press the spacebar to play the game..."
  533. text_size(x%,y%)
  534.  23,17,7,6,x%;y%|
  535. outline(t$,x,y,c)
  536. tx=x*32:ty=1024-(y*32)
  537.  tx-4,ty:
  538.  tx+4,ty:
  539.  tx,ty+4:
  540.  tx,ty-4:
  541.  tx-4,ty-4:
  542.  tx+4,ty+4:
  543.  tx,ty:
  544. view_titles
  545. seen%=
  546. pressed=
  547. fadein=0
  548. fadeout=0
  549. s$="<JawWar$Dir>.title"
  550.  "OS_File",5,s$ 
  551.  ,,,,size1%
  552.  area1% size1%+32
  553. area1%!0=size1%+32
  554. area1%!4=0
  555. area1%!8=16
  556. area1%!12=16
  557.  &2E,256+9,area1%
  558.  &2E,256+10,area1%,s$
  559.  PROCfade_in(0)
  560.  fadein>0 
  561.  192:
  562.  &2E,34+256,area1%,"tapestry",388,428,0
  563. fade_in(fadein)
  564.  fadein<17 fadein+=1
  565. (-99) 
  566.  pressed=
  567.  fadein>16 
  568.  pressed
  569.  pressed 
  570.  192:
  571.  &2E,34+256,area1%,"tapestry",388,428,0
  572. fade_out(fadeout)
  573.  fadeout<17 fadeout+=1
  574. (-99) 
  575.  pressed=
  576.  fadeout>16 
  577.  pressed
  578.  pressed 
  579. fade_out(fadeout)
  580.  fadeout 
  581. 2,63 
  582.  3*64
  583. 2,63 
  584.  2*64
  585. 2,63 
  586.  1*64
  587. 2,63 
  588.  0*64
  589. 2,42 
  590.  3*64
  591. 2,42 
  592.  2*64
  593. 2,42 
  594.  1*64
  595. 2,42 
  596.  0*64
  597. 2,21 
  598.  3*64
  599. 2,21 
  600.  2*64
  601. 2,21 
  602.  1*64
  603. 2,21 
  604.  0*64
  605. 2,00 
  606.  3*64
  607. 2,00 
  608.  2*64
  609. 2,00 
  610.  1*64
  611. 2,00 
  612.  0*64
  613.  fadeout>0 
  614.  0,0,1280,1024
  615. fade_in(fadein)
  616.  fadein 
  617. 2,00 
  618.  0*64
  619. 2,00 
  620.  1*64
  621. 2,00 
  622.  2*64
  623. 2,00 
  624.  3*64
  625. 2,21 
  626.  0*64
  627. 2,21 
  628.  1*64
  629. 2,21 
  630.  2*64
  631. 2,21 
  632.  3*64
  633. 2,42 
  634.  0*64
  635. 2,42 
  636.  1*64
  637. 2,42 
  638.  2*64
  639. 2,42 
  640.  3*64
  641. 2,63 
  642.  0*64
  643. 2,63 
  644.  1*64
  645. 2,63 
  646.  2*64
  647. 2,63 
  648.  3*64
  649.  fadein>0 
  650.  0,0,1280,1024
  651.