home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / games2 / solutions / !Solutions / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1994-05-21  |  7KB  |  324 lines

  1.  >!RunImage
  2. taskname$="Solutions"
  3. dirname$="<solutions$dir>"
  4. iconname$="!Solutions"
  5. menuname$="Solns"
  6. nagg(
  7. $+" at line "+
  8.  taskid% 8:$taskid%="TASK"
  9. "Wimp_Initialise",200,!taskid%,taskname$ 
  10.  version%,taskhand%
  11.  block% 1024,menu% 127,command% 80,wblk% 2048
  12. "Hourglass_On"
  13. sprites
  14. templates
  15. setupmenu
  16. initsol
  17. iconid%=
  18. "Hourglass_Off"
  19. "Wimp_Poll",1,block% 
  20.  reason%
  21.  reason% 
  22.  2 : 
  23.  "Wimp_OpenWindow",,block%
  24.  1 : 
  25.  "Wimp_RedrawWindow",,block%
  26.  3 : 
  27.  "Wimp_CloseWindow",,block%
  28.  9 : 
  29.  !block%=1 
  30.  block%!4=-1 
  31. savestatus:
  32.  6 : 
  33. iconclicked(block%!12,block%!16)
  34.  8 : 
  35. keypressed(block%!24)
  36.  17,18:
  37. keypressed(code%)
  38. "Wimp_ProcessKey",code%
  39. nagg(nagg$)
  40. "Wimp_ReportError","    "+nagg$,1<<4,taskname$
  41. iconclicked(window%,icon%)
  42.  window%<0 
  43.  icon%=iconid% 
  44. click_type:
  45.  (block%!8)=2 
  46. popupmenu((icon%=iconid%)
  47. (window%=-2)):
  48.  window%<>main% 
  49.  icon%>7 
  50.  icon%<10 
  51. move(icon%=9)
  52. block%!0=-1
  53. block%!4=0
  54. block%!8=0 : 
  55.  Y DIRECTION
  56. 7 block%!12=74 : 
  57.  X DIRECTION
  58. block%!16=96
  59. block%!20=&2002
  60. $(block%+24)=iconname$
  61.  "Wimp_CreateIcon",,block% 
  62.  icon%
  63. =icon%
  64. nagg("Error in death throes!"):
  65.  b%=1 
  66.  (b%?fontarray%)>0 
  67. B     
  68.  i%=1 
  69.  (b%?fontarray%)
  70.       
  71. "Font_LoseFont",b%
  72. D        
  73. "Wimp_CloseDown",taskhand%,!taskid%
  74. click_type
  75. c%=block%!8
  76.  c%=4 
  77. select
  78.  c%=2 
  79. popupmenu(
  80.  c%=1 
  81. adjust
  82.  block%!16=0 
  83. savestatus:
  84. file(where%)
  85. file$=""
  86.  ?where%
  87. file$+=
  88. (?where%)
  89. where%+=1
  90. =file$
  91. setupmenu
  92. _4$menu%=menuname$:                 : 
  93.  menu title
  94. `Emenu%?12=7:menu%?13=2           : 
  95.  title foreground & background
  96. aEmenu%?14=7:menu%?15=0           : 
  97.  menu  foreground & background
  98. (menuname$)>5 
  99. c"  menu%!16=(
  100. (menuname$)+1)*16
  101.   menu%!16=6*16
  102. g2menu%!20=44        : 
  103.  width & height of items
  104. h@menu%!24=0                      : 
  105.  vertical gap twixt items
  106. menu%!28=0
  107. menu%!32=inf_win%
  108. menu%!36=&7000021
  109. $(menu%+40)="Info"
  110. menu%!52=128
  111. menu%!56=-1
  112. menu%!60=&7000021
  113. $(menu%+64)="Quit"
  114. popupmenu(bar%)
  115.  "Wimp_GetPointerInfo",,block%
  116. q=!block%:w=block%!4
  117.  bar% 
  118.  w=96+44+44 
  119.  w+=22
  120.  "Wimp_CreateMenu",,menu%,q-64,w
  121. templates
  122.  fontarray% 256
  123.  b%=0 
  124.  252 
  125. b%!fontarray%=0
  126.  infb% 600,infi% 200
  127.  mainb% 1024,maini% 512
  128. "Wimp_OpenTemplate",,dirname$+".<sols$templates>"
  129. :inf_win%=
  130. template("info",infb%,infi%,200,-1,sprites%)
  131. <main%=
  132. template("chooser",mainb%,maini%,512,-1,sprites%)
  133. "Wimp_CloseTemplate"
  134. template(name$,buf%,ind%,len%,fonts%,sprs%)
  135. "Wimp_LoadTemplate",,buf%,ind%,ind%+len%,fonts%,name$,0
  136. buf%!64=sprs%
  137. "Wimp_CreateWindow",,buf% 
  138.  handle%
  139. =handle%
  140. sprites
  141. #file%=
  142. (dirname$+".SpriteFile")
  143.  file%=0 
  144. nagg("Can't find spritefile!"):
  145. #file%)+128
  146. #file%
  147.  sprites% S%
  148. sprites%!0=S%
  149. sprites%!8=16
  150. "OS_SpriteOp",9+256,sprites%
  151. "OS_SpriteOp",10+256,sprites%,dirname$+".SPRITEFILE"
  152. select
  153. openwindow(main%)
  154. adjust
  155. openwindow(main%)
  156. openwindow(window%)
  157. !wblk%=window%
  158. "Wimp_GetWindowState",,wblk%
  159. wblk%!28=-1
  160. flags%=wblk%!32
  161.  (flags% 
  162.  1<<16)=0 
  163.   !wblk%=window%
  164. "Wimp_GetWindowInfo",,wblk%
  165. !  width%=(wblk%!12)-(wblk%!4)
  166.  wide%=2111 
  167.  wide%=1279
  168. "  wblk%!4=wide% 
  169. 2 - width% 
  170.   wblk%!12=(wblk%!4)+width%
  171.   wblk%!28=-1
  172. "Wimp_OpenWindow",,wblk%
  173. pii(window%,icon%,text$)
  174. !wblk%=window%
  175. wblk%!4=icon%
  176. "Wimp_GetIconState",,wblk%
  177. $(wblk%!28)=text$
  178. wblk%!8=0
  179. wblk%!12=0
  180. "Wimp_SetIconState",,wblk%
  181. pii2(window%,icon%,text$)
  182. !wblk%=window%
  183. wblk%!4=icon%
  184. "Wimp_GetIconState",,wblk%
  185. $(wblk%!28)=text$
  186. contents(window%,icon%)
  187. !wblk%=window%
  188. wblk%!4=icon%
  189. "Wimp_GetIconState",,wblk%
  190. =$(wblk%!28)
  191. shade(window%,icon%,shade%)
  192. !wblk%=window%
  193. wblk%!4=icon%
  194. "Wimp_GetIconState",,wblk%
  195. wblk%!12=1<<22
  196. wblk%!8=(-shade%)<<22
  197. "Wimp_SetIconState",,wblk%
  198. closewindow(window%)
  199. !wblk%=window%
  200. "Wimp_CloseWindow",,wblk%
  201. output(sprite$)
  202.  sprite$="" 
  203. "OS_SpriteOp",or0%,or1%,or2%,or3%
  204. "OS_SpriteOp",256+60,sprites%,sprite$,0 
  205.  or0%,or1%,or2%,or3%
  206. changeval(window%,icon%,to$)
  207. !wblk%=window%
  208. wblk%!4=icon%
  209. "Wimp_GetIconState",,wblk%
  210. $(wblk%!32)=to$
  211. wblk%!8=0
  212. wblk%!12=0
  213. "Wimp_SetIconState",,wblk%
  214. selected(window%,icon%,well%)
  215. !wblk%=window%
  216. wblk%!4=icon%
  217. wblk%!12=1<<21
  218. wblk%!8=(-well%)<<21
  219. "Wimp_SetIconState",,wblk%
  220. isselected(win%,icon%)
  221.  !wblk%=window%:wblk%!4=icon%
  222. "Wimp_GetIconState",,wblk%
  223. =((wblk%!24) 
  224.  1<<21)
  225. buttontype(window%,icon%,bt%)
  226. !wblk%=window%
  227. wblk%!4=icon%
  228. wblk%!12=%1111<<12
  229. wblk%!8=bt%<<12
  230. "Wimp_SetIconState",,wblk%
  231. initsol
  232. currentclue%=0
  233.  sys$(100),plan$(100),shape$(100),note$(100)
  234. @sys$()="Unknown":shape$()="N/A":plan$()="Unknown":note$()=""
  235. dsys$(0)="":plan$(0)="":shape$(0)="":note$(0)="Welcome to !Solutions by the Angelos
  236. Thanatou"
  237. file%=
  238. (dirname$+".soldat")
  239.  file%=0 
  240. nagg("Where're my resources!"):
  241. #file%
  242.   line$=
  243. #file%
  244.   solnum%=
  245. (line$)
  246. 6  line$=
  247. line$,
  248. (line$)-5) :
  249.  skip the "XX : " bit
  250.   sys$(solnum%)=""
  251. line$,1)<>
  252.  line$<>""
  253.      sys$(solnum%)+=
  254. line$,1)
  255.      line$=
  256. line$,
  257. (line$)-1)
  258. .  line$=
  259. line$,
  260. (line$)-1) :
  261.  skip the TAB
  262.   plan$(solnum%)=""
  263. line$,1)<>
  264.  line$<>""
  265. !    plan$(solnum%)+=
  266. line$,1)
  267.      line$=
  268. line$,
  269. (line$)-1)
  270. ;  line$=
  271. line$,
  272. (line$)-1) :
  273.  skip the TAB (if present)
  274.  line$<>"" 
  275.  shape$(solnum%)=line$ 
  276.  shape$(solnum%)="n/a"
  277. #file%
  278.  file%=
  279. (dirname$+".notedat")
  280.  file%=0 
  281. nagg("Where're my resources!"):
  282. #file%
  283.   line$=
  284. #file%
  285. !*  notenum%=
  286. (line$):note$(notenum%)=""
  287.     note$=
  288. #file%
  289. $$    note$(notenum%)+=(note$+" ")
  290. #file% 
  291.  note$=""
  292. note$(solnum%),1)=" "
  293. ';    note$(solnum%)=
  294. note$(solnum%),
  295. (note$(solnum%))-1)
  296. #file%
  297. file%=
  298. (dirname$+".status")
  299.  file% 
  300.  currentclue%=
  301. #file%:
  302. #file%
  303. clue(currentclue%)
  304. clue(num%)
  305. pii(main%,7,
  306. (num%))
  307. pii(main%,2,sys$(num%))
  308. pii(main%,11,shape$(num%))
  309. pii(main%,4,plan$(num%))
  310. contents(main%,6)<>note$(num%) 
  311. pii(main%,6,note$(num%))
  312. savestatus
  313.   ?block%=currentclue%
  314. "XOS_CLI","SAVE "+dirname$+".status "+
  315. ~block%+" +1"
  316. "XOS_CLI","STAMP "+dirname$+".status"
  317. move(dir%)
  318.  dir%=0 
  319.  dir%=1
  320.  currentclue%+dir%>0 
  321.  currentclue%+dir%<101 
  322.  currentclue%+=dir%:
  323. clue(currentclue%)
  324.