button_routines.s 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. *****************************************************************
  2. * MODULE TITLE :button_routines *
  3. * *
  4. * DESCRIPTION :Button display and handling software *
  5. * *
  6. * *
  7. * *
  8. * NAME DATE *
  9. * *
  10. * LIST OF ROUTINES :setup_button_list *
  11. * check_for_call_routine *
  12. * check_to_see_hit *
  13. * draw_buttons *
  14. * delete_buttons *
  15. * display_button *
  16. * remove_button *
  17. * display_button_list *
  18. * remove_button_list *
  19. * *
  20. *****************************************************************
  21. NOT_DEPRESSED equ 0
  22. DEPRESSED equ 1
  23. CUSTOM_BUTTON equ 1
  24. STANDARD_BUTTON equ 0
  25. TOGGLE_BUTTON equ 2
  26. HOLD_BUTTON equ 4
  27. NO_WAIT_BUTTON equ 8
  28. BUTTON_WIDTH equ 112
  29. BUTTON_HEIGHT equ 16
  30. OFFSET equ 3 ;to position in middle of button
  31. EDGE equ 4 ;bass relief edge size
  32. **************************************
  33. ***** SETUP BUTTON LIST *****
  34. **************************************
  35. setup_button_list
  36. move.l #$FFFFFFFF,button_list
  37. move.l #$FFFFFFFF,button_delete_list
  38. move.l #$FFFFFFFF,button_draw_list
  39. move.w #0,button_counter
  40. rts
  41. **************************************
  42. ***** CHECK FOR CALL ROUTINE *****
  43. **************************************
  44. check_for_call_routine
  45. cmp.l #$ffffffff,jump_routine
  46. beq.s end_call_routine
  47. move.l jump_routine,a0
  48. jsr (a0)
  49. end_call_routine
  50. move.l #$ffffffff,jump_routine
  51. rts
  52. jump_routine
  53. dc.l $ffffffff
  54. **************************************
  55. ***** CHECK TO SEE HIT *****
  56. **************************************
  57. check_to_see_hit
  58. cmp.w #1,mouse_button_ind
  59. bne button_not_down
  60. move.l clicked_button,a0 ;
  61. move.b button_type(a0),d0 ;
  62. btst #2,d0 ;
  63. beq.s not_a_hold_button ;
  64. btst #6,$bfe001 ;
  65. bne.s has_been_released ;
  66. btst #3,d0
  67. bne.s execute_button_proc
  68. cmp.w #0,button_wait_counter
  69. beq execute_button_proc
  70. subq.w #1,button_wait_counter
  71. bra quit_check_buttons
  72. execute_button_proc
  73. move.l button_proc(a0),jump_routine
  74. bra quit_check_buttons ;
  75. not_a_hold_button ;
  76. btst #6,$bfe001
  77. beq quit_check_buttons
  78. has_been_released ;
  79. move.w #0,mouse_button_ind
  80. move.l clicked_button,a1
  81. btst #1,button_type(a1) ;toggle button test
  82. bne.s jump_to_button_routine
  83. move.b #0,button_clicked(a1)
  84. move.l button_draw_ptr,a2
  85. move.l button_delete_ptr,a3
  86. move.l a1,(a2)+
  87. move.l a1,(a3)+
  88. move.l #$ffffffff,(a2)
  89. move.l #$ffffffff,(a3)
  90. move.l a2,button_draw_ptr
  91. move.l a3,button_delete_ptr
  92. jump_to_button_routine
  93. btst #2,button_type(a1) ;
  94. beq.s not_hold_button ;
  95. cmp.w #0,button_wait_counter
  96. bne.s not_hold_button ;give nice feel to hold button
  97. move.w #BUTTON_HOLD_WAIT,button_wait_counter
  98. move.l #$ffffffff,jump_routine ;
  99. bra quit_check_buttons ;
  100. not_hold_button
  101. move.w #BUTTON_HOLD_WAIT,button_wait_counter ;
  102. move.l button_proc(a1),jump_routine
  103. bra quit_check_buttons
  104. button_not_down
  105. btst #6,$bfe001 ;test only
  106. beq check_hits_by_user ;frig for editor only
  107. move.w #0,left_first
  108. bra quit_check_buttons
  109. check_hits_by_user
  110. move.l #button_list,a0
  111. check_buttons_loop
  112. cmp.l #$ffffffff,(a0)
  113. beq quit_check_buttons
  114. move.l (a0),a1
  115. move.w button_x(a1),d0
  116. move.w button_y(a1),d1
  117. test_current_window
  118. cmp.w #MAIN_BUTTON_SCREEN,current_frame ;jiggery pokery
  119. bne.s window_up
  120. cmp.w #MAIN_SCREEN,frame_type(a1)
  121. beq.s check_button_frame_type
  122. window_up
  123. move.w frame_type(a1),d7
  124. cmp.w current_frame,d7
  125. bne not_a_hit
  126. check_button_frame_type
  127. cmp.w #WINDOW,frame_type(a1) ;is button in window
  128. bne.s not_test_in_window
  129. cmp.w #0,window_count ;any windows up??
  130. beq.s check_that_button
  131. move.l window_list_ptr,a3
  132. move.l -(a3),a4
  133. cmp.l button_window(a1),a4
  134. bne not_a_hit
  135. move.w window_x(a4),d2
  136. add.w d2,d0
  137. add.w #BORDER_X,d0 ;allow for border
  138. add.w window_y(a4),d1
  139. add.w #BORDER_Y,d1 ;allow for window y border
  140. bra.s check_that_button
  141. not_test_in_window
  142. cmp.w #MAIN_BUTTON_SCREEN,frame_type(a1)
  143. bne.s check_that_button
  144. ***--- STUFF TO ALLOW MYLES FULLSCREEN MODE
  145. tst.w fullscreen_mode
  146. beq.s not_in_fc_mode
  147. bra not_a_hit
  148. not_in_fc_mode
  149. ***---
  150. add.w #BUTTON_WINDOW_OFFSET,d1
  151. check_that_button
  152. move.w d0,d2
  153. move.w d1,d3
  154. btst #0,button_type(a1) ;standard button test
  155. beq normal_check_button
  156. ***else get details***
  157. move.l button_custom(a1),a2
  158. add.w custom_button_x_size(a2),d2
  159. add.w custom_button_y_size(a2),d3
  160. bra.s check_for_click_in_button
  161. normal_check_button
  162. add.w #BUTTON_WIDTH,d2
  163. add.w #BUTTON_HEIGHT,d3
  164. check_for_click_in_button
  165. move.w mouse_x,d7
  166. ***--- Another frig for fullscreen mode
  167. cmp.w #MAIN_BUTTON_SCREEN,frame_type(a1)
  168. bne.s no_asr_needed
  169. ***---
  170. cmp.w #BUTTON_WINDOW_OFFSET,mouse_y
  171. ble.s no_asr_needed
  172. asl.w #1,d7
  173. no_asr_needed
  174. cmp.w d7,d0
  175. bgt.s not_a_hit
  176. cmp.w d7,d2
  177. blt.s not_a_hit
  178. cmp.w mouse_y,d1
  179. bgt.s not_a_hit
  180. cmp.w mouse_y,d3
  181. blt.s not_a_hit
  182. move.l a1,clicked_button
  183. move.w #1,mouse_button_ind
  184. cmp.b #1,button_clicked(a1)
  185. beq.s button_already_down
  186. move.b #1,button_clicked(a1)
  187. bra.s put_button_in_list
  188. button_already_down
  189. move.b #0,button_clicked(a1)
  190. put_button_in_list
  191. move.l button_draw_ptr,a2
  192. move.l button_delete_ptr,a3
  193. move.l a1,(a2)+
  194. move.l a1,(a3)+
  195. move.l #$ffffffff,(a2)
  196. move.l #$ffffffff,(a3)
  197. move.l a2,button_draw_ptr
  198. move.l a3,button_delete_ptr
  199. bra.s quit_check_buttons
  200. not_a_hit
  201. add.l #4,a0
  202. bra check_buttons_loop
  203. quit_check_buttons
  204. rts
  205. *delete buttons should always be run before draw buttons
  206. **************************************
  207. ***** DRAW BUTTONS *****
  208. **************************************
  209. *takes in the draw button list and draws these, clearing
  210. *the list as it goes. It is done like this (and for delete)
  211. *because then it will be synced up proper;y
  212. draw_buttons
  213. ifnd hard_only
  214. bsr own_the_blitter
  215. endc
  216. move.l #button_draw_list,a0
  217. draw_buttons_loop
  218. cmp.l #$ffffffff,(a0)
  219. beq quit_draw_buttons
  220. *****DRAW BLITS****
  221. move.l #button_window_struct,a4 ;default structure
  222. move.l screen_mem(a4),a2 ;default place to draw
  223. move.l (a0),a1
  224. cmp.w #WINDOW,frame_type(a1) ;are we drawing in window?
  225. bne.s not_window_button
  226. move.l window_list_ptr,a3
  227. move.l -(a3),a4
  228. move.l screen_mem(a4),a2 ;replace place to draw
  229. move.l #main_screen_struct,a4
  230. not_window_button
  231. moveq #0,d0
  232. moveq #0,d1
  233. move.w button_x(a1),d0
  234. move.w button_y(a1),d1
  235. move.w screen_x_size(a4),d4
  236. asr.w #3,d4
  237. mulu d4,d1 ;y pos
  238. add.l d1,a2
  239. move.w d0,d1
  240. andi.w #$000f,d1
  241. andi.w #$fff0,d0
  242. asr.w #3,d0
  243. move.l a2,a5 ;save for later
  244. add.l d0,a2 ;x pos
  245. ror.w #4,d1 ;shift
  246. or.w #$0dfc,d1 ;or blit
  247. btst.b #0,button_type(a1) ;standard button test
  248. beq.s normal_button
  249. *******get details about custom button
  250. move.l button_custom(a1),a5
  251. cmp.b #0,button_clicked(a1)
  252. beq.s unclicked_custom_butt
  253. tst.l custom_button_click_graphics(a5)
  254. beq do_next_button ;null graphics button
  255. move.l custom_button_click_graphics(a5),a3
  256. bra.s calc_custom_blit_details
  257. unclicked_custom_butt
  258. tst.l custom_button_graphics(a5)
  259. beq do_next_button ;null graphics button
  260. move.l custom_button_graphics(a5),a3
  261. calc_custom_blit_details
  262. move.w custom_planes(a5),d4
  263. subq.w #1,d4
  264. move.w custom_button_height(a5),d3 ;calc custom blit size
  265. asl.w #6,d3
  266. move.w custom_button_width(a5),d0
  267. add.w #16,d0
  268. asr.w #4,d0
  269. add.w d0,d3
  270. moveq #0,d6
  271. move.w screen_x_size(a4),d0 ;calculate custom modulus
  272. asr.w #3,d0
  273. move.w custom_button_width(a5),d7
  274. asr.w #3,d7
  275. move.w d7,d6
  276. addq.w #2,d7
  277. sub.w d7,d0
  278. mulu.w custom_button_height(a5),d6
  279. bra.s blit_on_button
  280. normal_button
  281. cmp.b #0,button_clicked(a1)
  282. beq.s unclicked_butt
  283. move.l #button_clicked_plane1,a3
  284. bra.s draw_the_butt
  285. unclicked_butt
  286. move.l #button_plane1,a3
  287. draw_the_butt
  288. move.w #3-1,d4 ;number of planes for normal_button
  289. move.w #BUTTON_HEIGHT,d3 ;calc blit size
  290. asl.w #6,d3
  291. move.w #BUTTON_WIDTH+16,d0
  292. asr.w #4,d0
  293. add.w d0,d3
  294. move.w screen_x_size(a4),d0 ;calculate modulus
  295. asr.w #3,d0
  296. sub.w #(BUTTON_WIDTH+16)/8,d0
  297. move.l #BUTTON_WIDTH/8*BUTTON_HEIGHT,d6
  298. blit_on_button
  299. btst #14,DMACONR(a6)
  300. bne.s blit_on_button
  301. move.l a3,bltapt(a6)
  302. move.l a2,bltdpt(a6)
  303. move.l a2,bltbpt(a6)
  304. move.w d0,bltdmod(a6)
  305. move.w d0,bltbmod(a6)
  306. move.w #-2,bltamod(a6)
  307. move.w d1,bltcon0(a6)
  308. clr.w bltcon1(a6)
  309. move.l #$ffff0000,bltafwm(a6)
  310. move.w d3,bltsize(a6)
  311. add.l d6,a3
  312. moveq #0,d7
  313. move.w screen_x_size(a4),d7
  314. asr.w #3,d7
  315. mulu screen_y_size(a4),d7
  316. add.l d7,a2
  317. dbra d4,blit_on_button
  318. btst.b #0,button_type(a1) ;custom button test
  319. bne do_next_button
  320. ***a5 contains y position on screen
  321. moveq #0,d7
  322. move.w screen_x_size(a4),d7
  323. asr.w #3,d7
  324. mulu #OFFSET,d7
  325. add.l d7,a5
  326. move.l a1,a3
  327. add.l #button_text,a3
  328. move.l a3,a2 ;**used to be a4 but i want to keep a4
  329. moveq #0,d7
  330. count_letters
  331. cmp.b #0,(a2)+
  332. beq.s counted_letters
  333. addq.w #1,d7
  334. bra.s count_letters
  335. counted_letters
  336. mulu #FONT_PIX_WIDTH,d7
  337. move.w #BUTTON_WIDTH-(EDGE*2),d6
  338. sub.w d7,d6
  339. asr.w #1,d6
  340. moveq #0,d0
  341. move.w button_x(a1),d7
  342. add.w #EDGE,d7 ;start in a bit
  343. add.w d6,d7 ;to centre text
  344. draw_in_text
  345. move.w d7,d0
  346. move.l a5,a2
  347. moveq #0,d1
  348. move.w d0,d1
  349. andi.w #$000f,d0
  350. andi.w #$fff0,d1
  351. ror.w #4,d0
  352. or.w #$0d0c,d0 ;not and b
  353. asr.w #3,d1
  354. add.l d1,a2
  355. moveq #0,d4
  356. move.b (a3)+,d4
  357. beq.s do_next_button
  358. movem.l a5,-(sp)
  359. move.l #button_font,a5
  360. sub.w #32,d4
  361. mulu #FONT_HEIGHT*4,d4 ;get letter in font
  362. add.l d4,a5
  363. blit_on_text
  364. btst #14,DMACONR(a6)
  365. bne.s blit_on_text
  366. move.l a5,bltapt(a6)
  367. move.l a2,bltdpt(a6)
  368. move.l a2,bltbpt(a6)
  369. move.w screen_x_size(a4),d4
  370. asr.w #3,d4
  371. subq.w #4,d4
  372. move.w d4,bltdmod(a6)
  373. move.w d4,bltbmod(a6)
  374. clr.w bltamod(a6)
  375. move.w d0,bltcon0(a6)
  376. clr.w bltcon1(a6)
  377. move.l #$ffffffff,bltafwm(a6)
  378. move.w #11<<6+2,bltsize(a6)
  379. movem.l (sp)+,a5
  380. add.w #FONT_PIX_WIDTH,d7
  381. bra.s draw_in_text
  382. do_next_button
  383. addq.l #4,a0
  384. bra draw_buttons_loop
  385. quit_draw_buttons
  386. move.l #$ffffffff,button_draw_list
  387. move.l #button_draw_list,button_draw_ptr
  388. ifnd hard_only
  389. bsr disown_the_blitter
  390. endc
  391. rts
  392. **************************************
  393. ***** DELETE BUTTONS *****
  394. **************************************
  395. delete_buttons
  396. ifnd hard_only
  397. bsr own_the_blitter
  398. endc
  399. move.l #button_delete_list,a0
  400. delete_buttons_loop
  401. cmp.l #$ffffffff,(a0)
  402. beq quit_delete_buttons
  403. *****CLEAR BLITS****
  404. move.l #button_window_struct,a4
  405. move.l screen_mem(a4),a2
  406. move.l (a0),a1
  407. cmp.w #WINDOW,frame_type(a1) ;are we checking in window?
  408. bne.s delete_not_window_button
  409. move.l window_list_ptr,a3
  410. move.l -(a3),a4
  411. move.l window_start(a4),a2 ;replace default drawing position
  412. move.l #main_screen_struct,a4
  413. delete_not_window_button
  414. moveq #0,d0
  415. moveq #0,d1
  416. move.w button_x(a1),d0
  417. move.w button_y(a1),d1
  418. move.w screen_x_size(a4),d3
  419. asr.w #3,d3
  420. mulu d3,d1 ;y pos
  421. add.l d1,a2
  422. move.w d0,d1
  423. andi.w #$000f,d1
  424. andi.w #$fff0,d0
  425. asr.w #3,d0
  426. add.l d0,a2 ;x pos
  427. ror.w #4,d1 ;shift
  428. or.w #$0d0c,d1 ;not a and b
  429. btst.b #0,button_type(a1) ;standard button test
  430. beq.s normal_delete_button
  431. *******get details about custom button
  432. move.l button_custom(a1),a5 ;get our pointer
  433. cmp.b #0,button_clicked(a1)
  434. beq delete_unclicked_custom_butt
  435. tst.l custom_button_graphics(a5)
  436. beq delete_next_button ;null graphics button
  437. move.l custom_button_graphics(a5),a3
  438. bra delete_calc_custom_blit_details
  439. delete_unclicked_custom_butt
  440. tst.l custom_button_click_graphics(a5)
  441. beq delete_next_button ;null graphics button
  442. move.l custom_button_click_graphics(a5),a3
  443. delete_calc_custom_blit_details
  444. move.w custom_planes(a5),d4
  445. subq.w #1,d4
  446. move.w custom_button_height(a5),d3 ;calc custom blit size
  447. asl.w #6,d3
  448. move.w custom_button_width(a5),d0
  449. add.w #16,d0
  450. asr.w #4,d0
  451. add.w d0,d3
  452. moveq #0,d6
  453. move.w screen_x_size(a4),d0 ;calculate custom modulus
  454. asr.w #3,d0
  455. move.w custom_button_width(a5),d7
  456. asr.w #3,d7
  457. move.w d7,d6
  458. addq.w #2,d7
  459. sub.w d7,d0
  460. mulu.w custom_button_height(a5),d6
  461. bra.s delete_on_button
  462. normal_delete_button
  463. cmp.b #0,button_clicked(a1)
  464. beq.s delete_clicked_butt
  465. move.l #button_plane1,a3
  466. bra.s delete_the_butt
  467. delete_clicked_butt
  468. move.l #button_clicked_plane1,a3
  469. delete_the_butt
  470. moveq.w #3-1,d4 ;number of planes for normal_button
  471. move.w #BUTTON_HEIGHT,d3
  472. asl.w #6,d3
  473. move.w #BUTTON_WIDTH+16,d0
  474. asr.w #4,d0
  475. add.w d0,d3
  476. move.w screen_x_size(a4),d0
  477. asr.w #3,d0
  478. sub.w #(BUTTON_WIDTH+16)/8,d0
  479. move.l #(BUTTON_WIDTH/8)*BUTTON_HEIGHT,d6
  480. delete_on_button
  481. btst #14,DMACONR(a6)
  482. bne.s delete_on_button
  483. move.l a3,bltapt(a6)
  484. move.l a2,bltdpt(a6)
  485. move.l a2,bltbpt(a6)
  486. move.w d0,bltdmod(a6)
  487. move.w d0,bltbmod(a6)
  488. move.w #-2,bltamod(a6)
  489. move.w d1,bltcon0(a6)
  490. clr.w bltcon1(a6)
  491. move.l #$ffff0000,bltafwm(a6)
  492. move.w d3,bltsize(a6)
  493. add.l d6,a3
  494. moveq #0,d7
  495. move.w screen_x_size(a4),d7
  496. asr.w #3,d7
  497. mulu screen_y_size(a4),d7
  498. add.l d7,a2
  499. dbra d4,delete_on_button
  500. delete_next_button
  501. addq.l #4,a0
  502. bra delete_buttons_loop
  503. quit_delete_buttons
  504. move.l #$ffffffff,button_delete_list
  505. move.l #button_delete_list,button_delete_ptr
  506. ifnd hard_only
  507. bsr disown_the_blitter
  508. endc
  509. rts
  510. **************************************
  511. ***** DISPLAY BUTTON *****
  512. **************************************
  513. display_button
  514. *send button pointer in a0
  515. movem.l a0-a3/d0/d7,-(sp)
  516. cmp.w #99,button_counter
  517. beq.s no_more_buttons_available
  518. move.l button_head_ptr,a1
  519. move.l button_draw_ptr,a2
  520. move.b button_start(a0),d7
  521. move.b d7,button_clicked(a0) ;reset
  522. move.l window_list_ptr,a3
  523. move.l -(a3),button_window(a0)
  524. move.l a0,(a1)+
  525. move.l a0,(a2)+
  526. move.l #$ffffffff,(a2)
  527. move.l #$ffffffff,(a1)
  528. move.l a2,button_draw_ptr
  529. move.l a1,button_head_ptr
  530. add.w #1,button_counter
  531. moveq #0,d0
  532. bra.s quit_display_button
  533. no_more_buttons_available
  534. moveq #-1,d0
  535. quit_display_button
  536. movem.l (sp)+,a0-a3/d0/d7
  537. rts
  538. **************************************
  539. ***** REMOVE BUTTON *****
  540. **************************************
  541. remove_button
  542. *send button in a0
  543. movem.l a0-a4/d0,-(sp)
  544. moveq #-1,d0
  545. move.l #button_list,a1
  546. move.l a1,a2
  547. check_for_button
  548. cmp.l #$ffffffff,(a1)
  549. beq.s quit_remove_button
  550. cmp.l (a1),a0
  551. beq.s found_button
  552. move.l (a1)+,(a2)+
  553. bra.s check_for_button
  554. found_button
  555. move.l button_delete_ptr,a4
  556. cmp.b #1,button_clicked(a0)
  557. beq.s set_to_zero
  558. move.b #1,button_clicked(a0)
  559. bra.s move_into_delete
  560. set_to_zero
  561. move.b #0,button_clicked(a0)
  562. move_into_delete
  563. move.l a0,(a4)+
  564. move.l #$ffffffff,(a4)
  565. move.l a4,button_delete_ptr
  566. moveq #0,d0 ;found ok
  567. sub.w #1,button_counter
  568. addq.l #4,a1
  569. bra.s check_for_button
  570. quit_remove_button
  571. move.l #-1,(a2)
  572. move.l a2,button_head_ptr
  573. movem.l (sp)+,a0-a4/d0
  574. rts
  575. **************************************
  576. ***** DISPLAY BUTTON LIST *****
  577. **************************************
  578. display_button_list
  579. *list in a0
  580. movem.l d0-d7/a1-a6,-(sp)
  581. move.l a0,a1
  582. insert_loop
  583. move.l (a1)+,a0
  584. cmp.l #$ffffffff,a0
  585. beq.s done_all_list
  586. bsr display_button
  587. bra.s insert_loop
  588. done_all_list
  589. movem.l (sp)+,d0-d7/a1-a6
  590. rts
  591. **************************************
  592. ***** REMOVE BUTTON LIST *****
  593. **************************************
  594. remove_button_list
  595. *list in a0
  596. movem.l d0-d7/a1-a6,-(sp)
  597. move.l a0,a1
  598. insert_loop2
  599. move.l (a1)+,a0
  600. cmp.l #$ffffffff,a0
  601. beq.s done_all_remove_list
  602. bsr remove_button
  603. bra.s insert_loop2
  604. done_all_remove_list
  605. movem.l (sp)+,d0-d7/a1-a6
  606. rts
  607. Force_Buttons
  608. bsr delete_buttons
  609. bsr draw_buttons
  610. rts
  611. *button details
  612. FIRST_ROW equ 0
  613. SECOND_ROW equ 16
  614. THIRD_ROW equ 32
  615. FOURTH_ROW equ 48
  616. BUTTON_1 equ 0
  617. BUTTON_2 equ 112
  618. BUTTON_3 equ 224
  619. BUTTON_4 equ 336
  620. BUTTON_5 equ 448
  621. MAIN_BUTTON_SCREEN equ 0
  622. WINDOW equ 1
  623. MAIN_SCREEN equ 2
  624. BUTTON_HOLD_WAIT EQU 10
  625. **************B U T T O N S T R U C T U R E *****************
  626. rsreset
  627. button_x rs.w 1
  628. button_y rs.w 1
  629. frame_type rs.w 1 ;specifies which buttons to search through
  630. button_type rs.b 1 ;0- standard, 1-custon
  631. button_start rs.b 1 ;0 or 1, 1 = down already
  632. button_data rs.b 1 ;associated button data
  633. button_clicked rs.b 1
  634. button_custom rs.l 1 ;if custom = pointer to custom struct
  635. button_window rs.l 1 ;if custom not required
  636. button_proc rs.l 1
  637. button_text rs.b 1 ;not if custom
  638. even
  639. **************C U S T O M B U T T O N S T R U C T U R E *****************
  640. rsreset
  641. custom_button_width rs.w 1
  642. custom_button_height rs.w 1
  643. custom_button_x_size rs.w 1
  644. custom_button_y_size rs.w 1
  645. custom_planes rs.w 1
  646. custom_button_graphics rs.l 1
  647. custom_button_click_graphics rs.l 1
  648. current_frame
  649. dc.w 0
  650. mouse_button_ind
  651. dc.w 0
  652. clicked_button
  653. dc.l 0
  654. button_list
  655. ds.l 100
  656. button_draw_list
  657. ds.l 100
  658. button_delete_list
  659. ds.l 100
  660. button_head_ptr
  661. dc.l button_list
  662. button_draw_ptr
  663. dc.l button_draw_list
  664. button_delete_ptr
  665. dc.l button_delete_list
  666. button_wait_counter
  667. dc.w BUTTON_HOLD_WAIT
  668. button_counter
  669. dc.w 0