home *** CD-ROM | disk | FTP | other *** search
/ ISV Strong Games / ISV_STRONG_GAMES.iso / arcade / bombs / !Bombs / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1993-03-24  |  13KB  |  569 lines

  1.  > !RunImage
  2. new_sprites%=
  3. $+" at line "+
  4.  "Wimp_Poll",grabkey% 
  5.  1,poll 
  6.  grabkey% 
  7. grabkey
  8. redraww
  9. openw
  10. closew
  11. exitw
  12. enterw
  13. click
  14. enddrag
  15. menuselect
  16. losec
  17. gainc
  18.  17,18,19:
  19. message
  20. $;" at line ";
  21. -isize%=512:menusize%=512:spritesize%=4096
  22.  string isize%,menu menusize%,menuh%(2),blk 1024,poll 256,handle%(9),subptr%(4),task 24,game 320<<10,sprites% spritesize%
  23. $blk="TASK":$task="Bombs"
  24.  "Wimp_Initialise",200,blk!0,$task 
  25.  ,task%
  26. "eblk!0=-1:blk!4=0:blk!8=0:blk!12=64:blk!16=68:blk!20=(7<<28)+(3<<12)+(1<<4)+10:$(blk+24)="!"+$task
  27.  "Wimp_CreateIcon",,blk 
  28.  iconbar%
  29.  "Wimp_SlotSize",-1,-1 
  30.  appsize%
  31. %0string%=string:menu%=menu:inerr%=
  32. :ingame%=
  33.  "Wimp_CloseTemplate":
  34.  "Wimp_OpenTemplate",,"<"+$task+"$Dir>.Templates"
  35. loadwin("infobox",0,-1)
  36. loadwin("options",1,sprites%)
  37. loadwin("keydef",2,sprites%)
  38. loadwin("highs",3,-1)
  39. loadwin("name",4,-1)
  40.  "Wimp_CloseTemplate"
  41. blk!0=handle%(1)
  42. /$blk!4=1:blk!8=1<<21:blk!12=1<<21
  43.  "Wimp_SetIconState",,blk
  44. 1Dsprites%!0=spritesize%:sprites%!4=0:sprites%!8=16:sprites%!12=16
  45.  "OS_SpriteOp",256+10,sprites%,"<"+$task+"$Dir>.WimpSpr"
  46. 3"grabkey%=0:paused%=
  47. :ingame%=
  48. crmenu(1,"Keys/s2Define keys/Save keys/")
  49.  new_sprites% 
  50. crmenu(0,$task+"/s0Info/s1Options/sm1Keys/s3Highscores/Play/dContinue/dNew sprites/Quit/")
  51. crmenu(0,$task+"/s0Info/s1Options/sm1Keys/s3Highscores/Play/dContinue/Quit/")
  52.  "OS_File",5,"<Bombs$Dir>.GameCode" 
  53.  ex%=0 
  54.  ex%=2 
  55.  1,"Can't find main code"
  56.  "OS_File",&FF,"<Bombs$Dir>.GameCode",game
  57.  "OS_File",5,"<Bombs$Dir>.GameSpr" 
  58.  ex%,,,,game!(game!32)
  59.  ex%=0 
  60.  ex%=2 
  61.  1,"Can't find sprites"
  62.  "OS_File",&FF,"<Bombs$Dir>.GameSpr",game+game!12+game!(game!20)
  63.  "OS_File",5,"<Bombs$Dir>.Levels.Default" 
  64. fileok%=(ex%=1)
  65.  "XOS_File",&FF,"<Bombs$Dir>.Levels.Default",game+game!12
  66.  "OS_File",5,"<Bombs$Dir>.Keys" 
  67.  ex%,,,,len%
  68.  ex%=1 
  69.  len%=6 
  70. ptr%=game+game!8
  71.  "OS_File",&FF,"<Bombs$Dir>.Keys",ptr%
  72.  icon%=0 
  73.  A%,$(blk+256)
  74.  A%=ptr%?icon% 
  75.  A%=&FF
  76.  icon%<2 
  77. getstr(handle%(2),1-icon%+6)=$(blk+256) 
  78. getstr(handle%(2),icon%+6)=$(blk+256)
  79.  "OS_File",5,"<Bombs$Dir>.High" 
  80.  A%=1 
  81.  "OS_File",&FF,"<Bombs$Dir>.High",blk+512
  82. ptr%=blk+512
  83.  icon%=0 
  84. getstr(handle%(3),icon%*2)=$ptr%
  85. ptr%+=
  86. $(ptr%)+1
  87. getstr(handle%(3),icon%*2+1)=
  88. (ptr%?0+ptr%?1*256+ptr%?2*256*256)
  89. ptr%+=3
  90.  hi%=0 
  91. getstr(handle%(3),hi%*2)=
  92. (hi%+1)+" --------"
  93. getstr(handle%(3),hi%*2+1)=
  94. (4000+4000*(4-hi%))
  95. loadwin($poll,n%,area%)
  96.  "Wimp_LoadTemplate",,blk,string%,string+isize%,-1,poll 
  97.  ,,string%,,,,ok%
  98.  ok%=0 
  99. err("Template "+$poll+" not found",2)
  100.  area%<>-1 
  101.  blk!64=area%
  102.  "Wimp_CreateWindow",,blk 
  103.  handle%(n%)
  104. redraww
  105. openw
  106.  "Wimp_OpenWindow",,poll
  107. closew
  108.  "Wimp_CloseWindow",,poll
  109. exitw
  110.  poll!0=handle%(2) 
  111.  grabkey%=0
  112. enterw
  113.  poll!0=handle%(2) 
  114.  grabkey%=1
  115. click
  116.  (poll!8 
  117.  4)<>0
  118.  poll!12 
  119.  paused% 
  120. continue 
  121.  handle%(1)
  122.  poll!16 
  123.  0,1,2
  124. blk!0=poll!12:blk!12=1<<21
  125.  icon%=0 
  126. blk!4=icon%
  127. blk!8=-(icon%=poll!16)<<21
  128.  "Wimp_SetIconState",,blk
  129.  (poll!8 
  130.  2)<>0
  131.  poll!12 
  132. openmenu(0,poll!0-96,96+height%)
  133.  (poll!8 
  134.  1)<>0
  135.  (poll!8 
  136.  &10)<>0 
  137.  (poll!8 
  138.  &40)<>0
  139. enddrag
  140.  poll!0 
  141.  handle%(1)
  142. oldic%=poll!4
  143.  poll!24 
  144.  13,&18E
  145. poll!4+=1
  146.  poll!4=7 
  147.  poll!24=13 
  148.  "Wimp_CreateMenu",,-1:
  149. play 
  150. setc(poll!0,poll!4)
  151.  &18F
  152. poll!4-=1
  153.  poll!4=4 
  154.  poll!4=6
  155. setc(poll!0,poll!4)
  156.  handle%(4)
  157.  poll!24 
  158. getstr(handle%(3),hi%*2)+=$
  159. getstr(handle%(4),2)
  160. ptr%=blk+512
  161.  icon%=0 
  162. &$ptr%=$
  163. getstr(handle%(3),icon%*2)
  164. ptr%+=
  165. $ptr%+1
  166. *ptr%!0=
  167. getstr(handle%(3),icon%*2+1)
  168. ptr%+=3
  169.  "OS_File",10,"<Bombs$Dir>.High",&FFD,,blk+512,ptr%
  170.  "Wimp_CreateMenu",,-1
  171. menuselect
  172.  "Wimp_DecodeMenu",,menuh%(menuh%),poll,blk
  173. subptr%(0)=blk
  174.     A%=-1
  175.     A%+=1
  176. subptr%(A%+1)=subptr%(A%)
  177. subptr%(A%+1)+=1
  178.  ?subptr%(A%+1)=
  179.  ?subptr%(A%+1)=&D
  180.  ?subptr%(A%+1)=
  181.  ?subptr%(A%+1)=13:subptr%(A%+1)+=1
  182.  ?subptr%(A%+1)=&D
  183. $(blk+256)=$menuh%(menuh%)
  184.  $(blk+256) 
  185.  $task
  186.  $subptr%(0) 
  187.  "Keys"
  188.  $subptr%(1) 
  189.  "Save keys"
  190.  "OS_File",10,"<Bombs$Dir>.Keys",&FFD,,game+game!8,game+game!8+6
  191.  "Play"
  192.  "Continue"
  193. continue
  194.  "New sprites"
  195.  "Wimp_StartTask","/<Bombs$Dir>.Code.GetSprs"
  196. paused%=
  197.  "OS_File",5,"<Bombs$Dir>.GameSpr" 
  198.  ex%,,,,len%
  199.  ex%=0 
  200.  ex%=2 
  201.  1,"Can't find sprites"
  202. game!(game!32)=len%
  203.  "OS_File",&FF,"<Bombs$Dir>.GameSpr",game+game!12+game!(game!20)
  204.  "Quit":
  205.  "Wimp_GetPointerInfo",,blk
  206.  (blk!8 
  207. 1)=1 
  208. openmenu(menuh%,menux%,menuy%)
  209. losec
  210. gainc
  211. message
  212. taskref%=poll!4:ref%=poll!8
  213.  poll!16 
  214.  poll!40<>&FFD 
  215. err("This is not a data file",1)
  216. bufsize%=poll!36
  217.  bufsize%>game!(game!20) 
  218. err("File too big",1)
  219.  bufsize%=-1 
  220.  bufsize%=game!(game!20)
  221. buf=game+game!12
  222. poll!20=buf
  223. poll!24=bufsize%
  224. saveptr%=0
  225. reply(18,6)
  226. paused%=
  227.  "Wimp_GetPointerInfo",,blk
  228.  poll!12=0 
  229.  "OS_File",5,poll+44 
  230.  blk!0,,blk!4,,blk!8
  231.  blk!0=1 
  232.  (blk!4>>>8)=&FFFFFD 
  233.  blk!8>game!(game!20) 
  234. err("File too big",1)
  235.  "OS_File",&FF,poll+44,game+game!12
  236. $blk=""
  237.  icon%=0 
  238. $blk+=
  239. game?(game!12+icon%)
  240. fileok%=($blk="Level_File")
  241. paused%=
  242. fileok% 
  243. err("This is not a level file !",1)
  244.  fileok% 
  245.  blk!12=0 
  246.  fileok%=
  247. err("This file contains no levels!",1)
  248. reply(17,4)
  249. err("This is not a data file",1)
  250. saveptr%+=poll!24
  251.  saveptr%>bufsize% 
  252. %bufsize%+=game!(game!20)-saveptr%
  253. poll!20=buf+saveptr%
  254. poll!24=bufsize%-saveptr%
  255.  saveptr%>=game!(game!20) 
  256. err("File too big",1)
  257. fileok%=
  258. paused%=
  259. reply(18,6)
  260. $blk=""
  261.  icon%=0 
  262. $blk+=
  263. game?(game!12+icon%)
  264. fileok%=($blk="Level_File")
  265. fileok% 
  266. err("This is not a level file !",1)
  267.  fileok% 
  268.  blk!12=0 
  269.  fileok%=
  270. err("This file contains no levels!",1)
  271. reply(17,4)
  272.  &400C0
  273.  poll!20 
  274.  handle%(1)
  275.  &43F40 
  276.  1<<17 
  277. blk!0=poll!20
  278. blk!4=2
  279. blk!8=(F% 
  280.  1)<<22
  281. blk!12=1<<22
  282.  "Wimp_SetIconState",,blk
  283.  "Wimp_CreateSubMenu",,poll!20,poll!24,poll!28
  284. openmenu(h%,x%,y%)
  285. C!menuh%=h%:menux%=x%:menuy%=y%
  286. grey(0,"Play",
  287. fileok%)
  288. grey(0,"Continue",
  289. (paused% 
  290.  fileok%))
  291.  "Wimp_CreateMenu",,menuh%(menuh%),menux%,menuy%
  292. grey(h%,$(blk+512),set%)
  293. ptr%=menuh%(h%)+28
  294.  (ptr%!8 
  295.  256)=256 
  296.  ptr2%=ptr%!12 
  297.  ptr2%=ptr%+12
  298. ptr%+=24
  299.  $ptr2%=$(blk+512)
  300. ptr%-=24
  301. P-ptr%!8=ptr%!8 
  302. (1<<22) 
  303.  -(set%<>0)<<22
  304. err($(blk+4),?blk)
  305.  inerr% 
  306. inerr%=
  307.  ingame% 
  308.  "Wimp_SetMode",mode%
  309.  ?blk 
  310.  2:$(blk+4)="Fatal error: "+$(blk+4)+" - "+$task+" is terminating"
  311.  3:$(blk+4)+=" - (Cancel to quit)"
  312.  "Wimp_ReportError",blk,?blk,$task 
  313.  ,?blk
  314.  (?blk 
  315. inerr%=
  316.  "Wimp_CloseDown",,task%
  317. crmenu(handle%,$blk)
  318. item=blk+256:val=blk+512
  319. f"$item=
  320. $blk,
  321. $blk,"/")-1),12)
  322. max%=
  323. $item
  324. $menu%=$item
  325. $blk=
  326. $blk,
  327. $item+2)
  328. menu%?12=7
  329. menu%?13=2
  330. menu%?14=7
  331. menu%?15=0
  332. menu%!16=172
  333. menu%!20=44
  334. menu%!24=0
  335. ptr%=menu%+28
  336. dotted%=0
  337. menuitems%=0
  338. menuitems%+=1
  339. v#grey%=0:tick%=0:dot%=0:write%=0
  340. w!validate%=0:sub%=-1:centre%=0
  341.  ptr%-menu>menusize%-24 
  342. err("Not enough menu space",2)
  343. found%=
  344. $blk,1) 
  345.  "g":grey%=1<<22:
  346.  "t":tick%=1:
  347.  "d":dot%=2:dotted%+=1:
  348.  "c":
  349. next:centre%=centre% 
  350.  "s":
  351. next:sub%=1
  352. $blk,1,1)="m" 
  353. next:sub%+=1
  354. $item=""
  355. $blk,1,1)>="0" 
  356. $blk,1,1)<="9"
  357. $item+=
  358. $blk,1,1)
  359. $blk=
  360. $blk,2)
  361.  sub%=1 
  362.  sub%=handle%(
  363. $item) 
  364.  sub%=menuh%(
  365. $item)
  366.  "v":validate%=1:
  367. $val=""
  368. $blk,1,1)<>"," 
  369.  $blk<>""
  370. $val+=
  371. $blk,1,1)
  372. $blk=
  373. $blk,2)
  374. $blk=
  375. $blk,2)
  376.  "w":write%=1:
  377. $item=""
  378. $blk,1,1)<>"," 
  379.  $blk<>""
  380. $item+=
  381. $blk,1,1)
  382. $blk=
  383. $blk,2)
  384. $blk=
  385. $blk,2)
  386. writelen%=
  387. $item
  388.  found%=
  389. $item=
  390. $blk,
  391. $blk,"/")-1)
  392.  write% 
  393. $item>12 
  394.  validate% 
  395.  write%=0 
  396.  writelen%=
  397. $item
  398. ptr%!12=string%
  399. ptr%!20=writelen%+1
  400. string%+=writelen%+1
  401.  validate% 
  402.  ptr%!16=string%:string%+=1+
  403. $val 
  404.  ptr%!16=-1
  405.  string%>string+isize% 
  406. err("Not enough string space",2)
  407. $ptr%!12=$item
  408.  validate% 
  409.  $ptr%!16=$val
  410. $item>max% 
  411.  write%=0 
  412.  max%=
  413. $item
  414. indirect%=1
  415. $(ptr%+12)=$item
  416. $item>max% 
  417.  max%=
  418. $item
  419. indirect%=0
  420. $blk=
  421. $blk,
  422. $blk,"/")+1)
  423. >ptr%!0=tick% 
  424.  dot% 
  425.  write%<<2 
  426.  1<<3 
  427.  (&80 
  428.  ($blk=""))
  429. ptr%!4=sub%
  430. Vptr%!8=grey% 
  431.  (indirect% 
  432.  validate%)<<8 
  433.  &10021 
  434.  write%<<3 
  435. centre%<<3 
  436.  7<<24
  437. ptr%+=24
  438.  $blk=""
  439. menu%!16=(max%+2)*16
  440. menuh%(handle%)=menu%
  441.  $menu%=$task 
  442.  height%=44*menuitems%+24*dotted%
  443. menu%+=28+24*menuitems%
  444. $blk=
  445. $blk,2)
  446. found%=
  447.  *** Library routines and main program ***
  448. reply(type%,poll!16)
  449. poll!12=ref%
  450.  "Wimp_SendMessage",type%,poll,taskref%
  451. setc(wh%,icon%)
  452.  "Wimp_SetCaretPosition",wh%,icon%,0,-1,-1,
  453. getstr(wh%,icon%)
  454. getstr(win%,icon%)
  455. blk!0=win%:blk!4=icon%
  456.  "Wimp_GetIconState",,blk
  457.  (blk!24 
  458.  256)<>0 
  459.  =blk!28 
  460.  =blk+28
  461. ptr%=game
  462. ~game!(ptr%!28)
  463. icon%=-1
  464. icon%+=1
  465. getstr(handle%(3),icon%*2+1) 
  466.  icon%=4
  467. getstr(handle%(3),icon%*2+1) 
  468.  icon%<4 
  469.  T%=4 
  470.  icon%+1 
  471. getstr(handle%(3),T%*2)+2)=$(
  472. getstr(handle%(3),T%*2-2)+2)
  473. getstr(handle%(3),T%*2+1)=$
  474. getstr(handle%(3),T%*2-1)
  475. getstr(handle%(3),icon%*2+1)=
  476. getstr(handle%(3),icon%*2)=
  477. (icon%+1)+" "
  478. hi%=icon%
  479. getstr(handle%(4),2)=""
  480.  "Wimp_CreateMenu",,handle%(4),640,512
  481. "Pointer 1":
  482.  fileok% 
  483. ptr%=game
  484. getstr(handle%(1),5)
  485.     l%=-1
  486. f%=game+ptr%!12
  487. ?game!(ptr%!0)=(m% 
  488.  100)<<8 
  489.  (m% 
  490.  10)<<4 
  491.  (m% 
  492. getstr(handle%(1),6)
  493. ?game!(ptr%!4)=(m% 
  494.  100)<<8 
  495.  (m% 
  496.  10)<<4 
  497.  (m% 
  498. mode%=
  499. icon%=-1
  500.  icon%+=1
  501.  blk!0=handle%(1):blk!4=icon%
  502.  "Wimp_GetIconState",,blk
  503.  (blk!24 
  504.  1<<21)
  505. game?(ptr%!24)=icon%
  506.  icon%=0 
  507.  "OS_SpriteOp",256+36,sprites%,"cursor",2 
  508.  3<<5,7,5
  509. ingame%=
  510. (game+512)
  511. ingame%=
  512. paused%=(R%=3)
  513.  "Wimp_SetMode",mode%
  514. paused% 
  515. continue
  516. "Pointer 1":
  517.  fileok% 
  518. ptr%=game
  519. mode%=
  520. icon%=-1
  521.  icon%+=1
  522.  blk!0=handle%(1):blk!4=icon%
  523.  "Wimp_GetIconState",,blk
  524.  (blk!24 
  525.  1<<21)
  526. game?(ptr%!24)=icon%
  527.  icon%=0 
  528.  "OS_SpriteOp",256+36,sprites%,"cursor",2 
  529.  3<<5,7,5
  530. ingame%=
  531. (game+128)
  532. ingame%=
  533. paused%=(R%=3)
  534.  "Wimp_SetMode",mode%
  535. paused% 
  536. grabkey
  537.  "Wimp_GetPointerInfo",,blk
  538.  "OS_Byte",&79 
  539.  ,pressed%
  540.  pressed%<>&FF 
  541.  blk!16<>-1 
  542.  blk!16<12 
  543. icon%=blk!16 
  544.  A%,$(blk+256)
  545.  A%=&FF 
  546.  A%=pressed%
  547.  item%=0 
  548.  $(blk+256)=$
  549. getstr(handle%(2),item%+6) 
  550.  item%=255
  551.  item%<255 
  552.  A%<>&FF 
  553. getstr(handle%(2),icon%+6)=$(blk+256)
  554. !"blk!0=handle%(2):blk!4=icon%+6
  555. blk!8=0:blk!12=0
  556.  "Wimp_SetIconState",,blk
  557. ptr%=game
  558.  icon%<2 
  559.  icon%=1-icon%
  560. game?(ptr%!8+icon%)=A%
  561.  65,"A", 100,"B", 82,"C", 50,"D", 34,"E", 67,"F", 83,"G", 84,"H", 37,"I", 69,"J", 70,"K", 86,"L", 101,"M", 85,"N", 54,"O", 55,"P", 16,"Q", 51,"R", 81,"S", 35,"T", 53,"U", 99,"V", 33,"W", 66,"X", 68,"Y", 97,"Z"
  562.  48,"1", 49,"2", 17,"3", 18,"4", 19,"5", 24,"6", 36,"7", 21,"8", 38,"9", 39,"0", 45,"`", 23,"-", 93,"=", 46,"
  563. ", 56,"[", 88,"]", 120,"\", 72,";", 79,"'", 102,",", 103,".", 104,"/" ,98,"Space"
  564.  32,"Print", 113,"f1", 114,"f2", 115,"f3", 20,"f4", 116,"f5", 117,"f6", 22,"f7", 118,"f8", 119,"f9", 30,"f10", 28,"f11", 29,"f12"
  565.  107,"Keypad 1", 124,"Keypad 2", 108,"Keypad 3", 122,"Keypad 4", 123,"Keypad 5", 26,"Keypad 6", 27,"Keypad 7", 42,"Keypad 8", 43,"Keypad 9", 106,"Keypad 0"
  566.  74,"Keypad /", 91,"Keypad *", 90,"Keypad #", 59,"Keypad -", 58,"Keypad +", 76,"Keypad .", 60,"Keypad Enter", 77,"Num Lock"
  567.  112,"Escape", 31,"Scroll Lock", 44,"Break", 61,"Insert", 62,"Home", 63,"Page Up", 89,"Delete", 105,"Copy", 78,"Page Down", 73,"Enter", 47,"BackSpace", 96,"Tab", 1,"CTRL", 0,"Shift", 64,"Caps Lock", 2,"Alt", 57,"Up", 25,"Left", 41,"Down", 121,"Right"
  568.  &FF,"Unknown !"
  569.