button_routines.s 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  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 .skip
  169. cmp.w #BUTTON_WINDOW_OFFSET,mouse_y
  170. ble.s .skip
  171. btst #INTB_HIRES,screen_mode
  172. bne.s .skip
  173. asl.w #1,d7
  174. .skip
  175. cmp.w d7,d0
  176. bgt.s not_a_hit
  177. cmp.w d7,d2
  178. blt.s not_a_hit
  179. cmp.w mouse_y,d1
  180. bgt.s not_a_hit
  181. cmp.w mouse_y,d3
  182. blt.s not_a_hit
  183. move.l a1,clicked_button
  184. move.w #1,mouse_button_ind
  185. cmp.b #1,button_clicked(a1)
  186. beq.s button_already_down
  187. move.b #1,button_clicked(a1)
  188. bra.s put_button_in_list
  189. button_already_down
  190. move.b #0,button_clicked(a1)
  191. put_button_in_list
  192. move.l button_draw_ptr,a2
  193. move.l button_delete_ptr,a3
  194. move.l a1,(a2)+
  195. move.l a1,(a3)+
  196. move.l #$ffffffff,(a2)
  197. move.l #$ffffffff,(a3)
  198. move.l a2,button_draw_ptr
  199. move.l a3,button_delete_ptr
  200. bra.s quit_check_buttons
  201. not_a_hit
  202. add.l #4,a0
  203. bra check_buttons_loop
  204. quit_check_buttons
  205. rts
  206. *delete buttons should always be run before draw buttons
  207. **************************************
  208. ***** DRAW BUTTONS *****
  209. **************************************
  210. *takes in the draw button list and draws these, clearing
  211. *the list as it goes. It is done like this (and for delete)
  212. *because then it will be synced up proper;y
  213. draw_buttons
  214. ifnd hard_only
  215. bsr own_the_blitter
  216. endc
  217. move.l #button_draw_list,a0
  218. draw_buttons_loop
  219. cmp.l #$ffffffff,(a0)
  220. beq quit_draw_buttons
  221. *****DRAW BLITS****
  222. move.l #button_window_struct,a4 ;default structure
  223. move.l screen_mem(a4),a2 ;default place to draw
  224. move.l (a0),a1
  225. cmp.w #WINDOW,frame_type(a1) ;are we drawing in window?
  226. bne.s not_window_button
  227. move.l window_list_ptr,a3
  228. move.l -(a3),a4
  229. move.l screen_mem(a4),a2 ;replace place to draw
  230. move.l #main_screen_struct,a4
  231. not_window_button
  232. moveq #0,d0
  233. moveq #0,d1
  234. move.w button_x(a1),d0
  235. move.w button_y(a1),d1
  236. move.w screen_x_size(a4),d4
  237. asr.w #3,d4
  238. mulu d4,d1 ;y pos
  239. add.l d1,a2
  240. move.w d0,d1
  241. andi.w #$000f,d1
  242. andi.w #$fff0,d0
  243. asr.w #3,d0
  244. move.l a2,a5 ;save for later
  245. add.l d0,a2 ;x pos
  246. ror.w #4,d1 ;shift
  247. or.w #$0dfc,d1 ;or blit
  248. btst.b #0,button_type(a1) ;standard button test
  249. beq.s normal_button
  250. *******get details about custom button
  251. move.l button_custom(a1),a5
  252. cmp.b #0,button_clicked(a1)
  253. beq.s unclicked_custom_butt
  254. tst.l custom_button_click_graphics(a5)
  255. beq do_next_button ;null graphics button
  256. move.l custom_button_click_graphics(a5),a3
  257. bra.s calc_custom_blit_details
  258. unclicked_custom_butt
  259. tst.l custom_button_graphics(a5)
  260. beq do_next_button ;null graphics button
  261. move.l custom_button_graphics(a5),a3
  262. calc_custom_blit_details
  263. move.w custom_planes(a5),d4
  264. subq.w #1,d4
  265. move.w custom_button_height(a5),d3 ;calc custom blit size
  266. asl.w #6,d3
  267. move.w custom_button_width(a5),d0
  268. add.w #16,d0
  269. asr.w #4,d0
  270. add.w d0,d3
  271. moveq #0,d6
  272. move.w screen_x_size(a4),d0 ;calculate custom modulus
  273. asr.w #3,d0
  274. move.w custom_button_width(a5),d7
  275. asr.w #3,d7
  276. move.w d7,d6
  277. addq.w #2,d7
  278. sub.w d7,d0
  279. mulu.w custom_button_height(a5),d6
  280. bra.s blit_on_button
  281. normal_button
  282. cmp.b #0,button_clicked(a1)
  283. beq.s unclicked_butt
  284. move.l #button_clicked_plane1,a3
  285. bra.s draw_the_butt
  286. unclicked_butt
  287. move.l #button_plane1,a3
  288. draw_the_butt
  289. move.w #3-1,d4 ;number of planes for normal_button
  290. move.w #BUTTON_HEIGHT,d3 ;calc blit size
  291. asl.w #6,d3
  292. move.w #BUTTON_WIDTH+16,d0
  293. asr.w #4,d0
  294. add.w d0,d3
  295. move.w screen_x_size(a4),d0 ;calculate modulus
  296. asr.w #3,d0
  297. sub.w #(BUTTON_WIDTH+16)/8,d0
  298. move.l #BUTTON_WIDTH/8*BUTTON_HEIGHT,d6
  299. blit_on_button
  300. btst #14,DMACONR(a6)
  301. bne.s blit_on_button
  302. move.l a3,bltapt(a6)
  303. move.l a2,bltdpt(a6)
  304. move.l a2,bltbpt(a6)
  305. move.w d0,bltdmod(a6)
  306. move.w d0,bltbmod(a6)
  307. move.w #-2,bltamod(a6)
  308. move.w d1,bltcon0(a6)
  309. clr.w bltcon1(a6)
  310. move.l #$ffff0000,bltafwm(a6)
  311. move.w d3,bltsize(a6)
  312. add.l d6,a3
  313. moveq #0,d7
  314. move.w screen_x_size(a4),d7
  315. asr.w #3,d7
  316. mulu screen_y_size(a4),d7
  317. add.l d7,a2
  318. dbra d4,blit_on_button
  319. btst.b #0,button_type(a1) ;custom button test
  320. bne do_next_button
  321. ***a5 contains y position on screen
  322. moveq #0,d7
  323. move.w screen_x_size(a4),d7
  324. asr.w #3,d7
  325. mulu #OFFSET,d7
  326. add.l d7,a5
  327. move.l a1,a3
  328. add.l #button_text,a3
  329. move.l a3,a2 ;**used to be a4 but i want to keep a4
  330. moveq #0,d7
  331. count_letters
  332. cmp.b #0,(a2)+
  333. beq.s counted_letters
  334. addq.w #1,d7
  335. bra.s count_letters
  336. counted_letters
  337. mulu #FONT_PIX_WIDTH,d7
  338. move.w #BUTTON_WIDTH-(EDGE*2),d6
  339. sub.w d7,d6
  340. asr.w #1,d6
  341. moveq #0,d0
  342. move.w button_x(a1),d7
  343. add.w #EDGE,d7 ;start in a bit
  344. add.w d6,d7 ;to centre text
  345. draw_in_text
  346. move.w d7,d0
  347. move.l a5,a2
  348. moveq #0,d1
  349. move.w d0,d1
  350. andi.w #$000f,d0
  351. andi.w #$fff0,d1
  352. ror.w #4,d0
  353. or.w #$0d0c,d0 ;not and b
  354. asr.w #3,d1
  355. add.l d1,a2
  356. moveq #0,d4
  357. move.b (a3)+,d4
  358. beq.s do_next_button
  359. movem.l a5,-(sp)
  360. move.l #button_font,a5
  361. sub.w #32,d4
  362. mulu #FONT_HEIGHT*4,d4 ;get letter in font
  363. add.l d4,a5
  364. blit_on_text
  365. btst #14,DMACONR(a6)
  366. bne.s blit_on_text
  367. move.l a5,bltapt(a6)
  368. move.l a2,bltdpt(a6)
  369. move.l a2,bltbpt(a6)
  370. move.w screen_x_size(a4),d4
  371. asr.w #3,d4
  372. subq.w #4,d4
  373. move.w d4,bltdmod(a6)
  374. move.w d4,bltbmod(a6)
  375. clr.w bltamod(a6)
  376. move.w d0,bltcon0(a6)
  377. clr.w bltcon1(a6)
  378. move.l #$ffffffff,bltafwm(a6)
  379. move.w #11<<6+2,bltsize(a6)
  380. movem.l (sp)+,a5
  381. add.w #FONT_PIX_WIDTH,d7
  382. bra.s draw_in_text
  383. do_next_button
  384. addq.l #4,a0
  385. bra draw_buttons_loop
  386. quit_draw_buttons
  387. move.l #$ffffffff,button_draw_list
  388. move.l #button_draw_list,button_draw_ptr
  389. ifnd hard_only
  390. bsr disown_the_blitter
  391. endc
  392. rts
  393. **************************************
  394. ***** DELETE BUTTONS *****
  395. **************************************
  396. delete_buttons
  397. ifnd hard_only
  398. bsr own_the_blitter
  399. endc
  400. move.l #button_delete_list,a0
  401. delete_buttons_loop
  402. cmp.l #$ffffffff,(a0)
  403. beq quit_delete_buttons
  404. *****CLEAR BLITS****
  405. move.l #button_window_struct,a4
  406. move.l screen_mem(a4),a2
  407. move.l (a0),a1
  408. cmp.w #WINDOW,frame_type(a1) ;are we checking in window?
  409. bne.s delete_not_window_button
  410. move.l window_list_ptr,a3
  411. move.l -(a3),a4
  412. move.l window_start(a4),a2 ;replace default drawing position
  413. move.l #main_screen_struct,a4
  414. delete_not_window_button
  415. moveq #0,d0
  416. moveq #0,d1
  417. move.w button_x(a1),d0
  418. move.w button_y(a1),d1
  419. move.w screen_x_size(a4),d3
  420. asr.w #3,d3
  421. mulu d3,d1 ;y pos
  422. add.l d1,a2
  423. move.w d0,d1
  424. andi.w #$000f,d1
  425. andi.w #$fff0,d0
  426. asr.w #3,d0
  427. add.l d0,a2 ;x pos
  428. ror.w #4,d1 ;shift
  429. or.w #$0d0c,d1 ;not a and b
  430. btst.b #0,button_type(a1) ;standard button test
  431. beq.s normal_delete_button
  432. *******get details about custom button
  433. move.l button_custom(a1),a5 ;get our pointer
  434. cmp.b #0,button_clicked(a1)
  435. beq delete_unclicked_custom_butt
  436. tst.l custom_button_graphics(a5)
  437. beq delete_next_button ;null graphics button
  438. move.l custom_button_graphics(a5),a3
  439. bra delete_calc_custom_blit_details
  440. delete_unclicked_custom_butt
  441. tst.l custom_button_click_graphics(a5)
  442. beq delete_next_button ;null graphics button
  443. move.l custom_button_click_graphics(a5),a3
  444. delete_calc_custom_blit_details
  445. move.w custom_planes(a5),d4
  446. subq.w #1,d4
  447. move.w custom_button_height(a5),d3 ;calc custom blit size
  448. asl.w #6,d3
  449. move.w custom_button_width(a5),d0
  450. add.w #16,d0
  451. asr.w #4,d0
  452. add.w d0,d3
  453. moveq #0,d6
  454. move.w screen_x_size(a4),d0 ;calculate custom modulus
  455. asr.w #3,d0
  456. move.w custom_button_width(a5),d7
  457. asr.w #3,d7
  458. move.w d7,d6
  459. addq.w #2,d7
  460. sub.w d7,d0
  461. mulu.w custom_button_height(a5),d6
  462. bra.s delete_on_button
  463. normal_delete_button
  464. cmp.b #0,button_clicked(a1)
  465. beq.s delete_clicked_butt
  466. move.l #button_plane1,a3
  467. bra.s delete_the_butt
  468. delete_clicked_butt
  469. move.l #button_clicked_plane1,a3
  470. delete_the_butt
  471. moveq #3-1,d4 ;number of planes for normal_button
  472. move.w #BUTTON_HEIGHT,d3
  473. asl.w #6,d3
  474. move.w #BUTTON_WIDTH+16,d0
  475. asr.w #4,d0
  476. add.w d0,d3
  477. move.w screen_x_size(a4),d0
  478. asr.w #3,d0
  479. sub.w #(BUTTON_WIDTH+16)/8,d0
  480. move.l #(BUTTON_WIDTH/8)*BUTTON_HEIGHT,d6
  481. delete_on_button
  482. btst #14,DMACONR(a6)
  483. bne.s delete_on_button
  484. move.l a3,bltapt(a6)
  485. move.l a2,bltdpt(a6)
  486. move.l a2,bltbpt(a6)
  487. move.w d0,bltdmod(a6)
  488. move.w d0,bltbmod(a6)
  489. move.w #-2,bltamod(a6)
  490. move.w d1,bltcon0(a6)
  491. clr.w bltcon1(a6)
  492. move.l #$ffff0000,bltafwm(a6)
  493. move.w d3,bltsize(a6)
  494. add.l d6,a3
  495. moveq #0,d7
  496. move.w screen_x_size(a4),d7
  497. asr.w #3,d7
  498. mulu screen_y_size(a4),d7
  499. add.l d7,a2
  500. dbra d4,delete_on_button
  501. delete_next_button
  502. addq.l #4,a0
  503. bra delete_buttons_loop
  504. quit_delete_buttons
  505. move.l #$ffffffff,button_delete_list
  506. move.l #button_delete_list,button_delete_ptr
  507. ifnd hard_only
  508. bsr disown_the_blitter
  509. endc
  510. rts
  511. **************************************
  512. ***** DISPLAY BUTTON *****
  513. **************************************
  514. display_button
  515. *send button pointer in a0
  516. movem.l a0-a3/d0/d7,-(sp)
  517. cmp.w #99,button_counter
  518. beq.s no_more_buttons_available
  519. move.l button_head_ptr,a1
  520. move.l button_draw_ptr,a2
  521. move.b button_start(a0),d7
  522. move.b d7,button_clicked(a0) ;reset
  523. move.l window_list_ptr,a3
  524. move.l -(a3),button_window(a0)
  525. move.l a0,(a1)+
  526. move.l a0,(a2)+
  527. move.l #$ffffffff,(a2)
  528. move.l #$ffffffff,(a1)
  529. move.l a2,button_draw_ptr
  530. move.l a1,button_head_ptr
  531. add.w #1,button_counter
  532. moveq #0,d0
  533. bra.s quit_display_button
  534. no_more_buttons_available
  535. moveq #-1,d0
  536. quit_display_button
  537. movem.l (sp)+,a0-a3/d0/d7
  538. rts
  539. **************************************
  540. ***** REMOVE BUTTON *****
  541. **************************************
  542. remove_button
  543. *send button in a0
  544. movem.l a0-a4/d0,-(sp)
  545. moveq #-1,d0
  546. move.l #button_list,a1
  547. move.l a1,a2
  548. check_for_button
  549. cmp.l #$ffffffff,(a1)
  550. beq.s quit_remove_button
  551. cmp.l (a1),a0
  552. beq.s found_button
  553. move.l (a1)+,(a2)+
  554. bra.s check_for_button
  555. found_button
  556. move.l button_delete_ptr,a4
  557. cmp.b #1,button_clicked(a0)
  558. beq.s set_to_zero
  559. move.b #1,button_clicked(a0)
  560. bra.s move_into_delete
  561. set_to_zero
  562. move.b #0,button_clicked(a0)
  563. move_into_delete
  564. move.l a0,(a4)+
  565. move.l #$ffffffff,(a4)
  566. move.l a4,button_delete_ptr
  567. moveq #0,d0 ;found ok
  568. sub.w #1,button_counter
  569. addq.l #4,a1
  570. bra.s check_for_button
  571. quit_remove_button
  572. move.l #-1,(a2)
  573. move.l a2,button_head_ptr
  574. movem.l (sp)+,a0-a4/d0
  575. rts
  576. **************************************
  577. ***** DISPLAY BUTTON LIST *****
  578. **************************************
  579. display_button_list
  580. *list in a0
  581. movem.l d0-d7/a1-a6,-(sp)
  582. move.l a0,a1
  583. insert_loop
  584. move.l (a1)+,a0
  585. cmp.l #$ffffffff,a0
  586. beq.s done_all_list
  587. bsr display_button
  588. bra.s insert_loop
  589. done_all_list
  590. movem.l (sp)+,d0-d7/a1-a6
  591. rts
  592. **************************************
  593. ***** REMOVE BUTTON LIST *****
  594. **************************************
  595. remove_button_list
  596. *list in a0
  597. movem.l d0-d7/a1-a6,-(sp)
  598. move.l a0,a1
  599. insert_loop2
  600. move.l (a1)+,a0
  601. cmp.l #$ffffffff,a0
  602. beq.s done_all_remove_list
  603. bsr remove_button
  604. bra.s insert_loop2
  605. done_all_remove_list
  606. movem.l (sp)+,d0-d7/a1-a6
  607. rts
  608. Force_Buttons
  609. bsr delete_buttons
  610. bsr draw_buttons
  611. rts
  612. *button details
  613. FIRST_ROW equ 0
  614. SECOND_ROW equ 16
  615. THIRD_ROW equ 32
  616. FOURTH_ROW equ 48
  617. BUTTON_1 equ 0
  618. BUTTON_2 equ 112
  619. BUTTON_3 equ 224
  620. BUTTON_4 equ 336
  621. BUTTON_5 equ 448
  622. MAIN_BUTTON_SCREEN equ 0
  623. WINDOW equ 1
  624. MAIN_SCREEN equ 2
  625. BUTTON_HOLD_WAIT EQU 10
  626. **************B U T T O N S T R U C T U R E *****************
  627. rsreset
  628. button_x rs.w 1
  629. button_y rs.w 1
  630. frame_type rs.w 1 ;specifies which buttons to search through
  631. button_type rs.b 1 ;0- standard, 1-custon
  632. button_start rs.b 1 ;0 or 1, 1 = down already
  633. button_data rs.b 1 ;associated button data
  634. button_clicked rs.b 1
  635. button_custom rs.l 1 ;if custom = pointer to custom struct
  636. button_window rs.l 1 ;if custom not required
  637. button_proc rs.l 1
  638. button_text rs.b 1 ;not if custom
  639. even
  640. **************C U S T O M B U T T O N S T R U C T U R E *****************
  641. rsreset
  642. custom_button_width rs.w 1
  643. custom_button_height rs.w 1
  644. custom_button_x_size rs.w 1
  645. custom_button_y_size rs.w 1
  646. custom_planes rs.w 1
  647. custom_button_graphics rs.l 1
  648. custom_button_click_graphics rs.l 1
  649. current_frame
  650. dc.w 0
  651. mouse_button_ind
  652. dc.w 0
  653. clicked_button
  654. dc.l 0
  655. button_list
  656. ds.l 100
  657. button_draw_list
  658. ds.l 100
  659. button_delete_list
  660. ds.l 100
  661. button_head_ptr
  662. dc.l button_list
  663. button_draw_ptr
  664. dc.l button_draw_list
  665. button_delete_ptr
  666. dc.l button_delete_list
  667. button_wait_counter
  668. dc.w BUTTON_HOLD_WAIT
  669. button_counter
  670. dc.w 0