**************************************************************************** **************************************************************************** ** ** Monster for TI-89 / TI-92 Plus - Player/Screen Movement ** ** Copyright 2002 by Patrick Davidson. This software may be freely ** modified and/or copied with no restrictions. There is no warranty. ** ** by Patrick Davidson (pad@calc.org, http://pad.calc.org/) ** ** Last updated March 6, 2002 ** **************************************************************************** **************************************************************************** pause_msg: dc.b 'Paused - F1 resumes',0 EVEN *************************************** INPUT HANDLING Player_Move: GETEDGE 5,1,6,7 ; pause game bne.s no_pause tst.w pausedelay(a5) bne.s no_pause move.w #96,pausedelay(a5) st paused(a5) no_pause: tst.w pausedelay(a5) beq.s \ok subq.w #1,pausedelay(a5) \ok: GETEDGE 0,4,0,3 ; release ball bne.s no_release lea balls(a5),a6 moveq #b_num-1,d6 release_loop: cmp.w #2,(a6) bne.s \n move.w b_x(a6),d0 add.w paddlex(a5),d0 lsl.w #6,d0 move.w d0,b_x(a6) st b_voldy(a6) st b_oldy(a6) move.w #(11*TILE_HEIGHT)<<6,b_y(a6) bsr Paddle_Bounce \n: lea b_size(a6),a6 dbra d6,release_loop tst.w laserpower(a5) ble.s no_release bsr Fire_Lasers no_release: GETKEY 0,1,0,4 ; Move left bne.s \noleft moveq #3,d7 GETKEY 0,4,0,3 ; Move up bne.s \l moveq #0,d7 \l: bsr try_to_go_left dbra d7,\l \noleft: GETKEY 0,3,0,6 ; Move right bne.s \noright moveq #3,d7 GETKEY 0,4,0,3 ; Move up bne.s \r moveq #0,d7 \r: bsr try_to_go_right dbra d7,\r \noright: **************************************** SCREEN POSITION CALCULATION move.w paddlew(a5),d3 lsr.w #1,d3 add.w paddlex(a5),d3 sub.w #WIDTH_BYTES*4,d3 blt.s \leftside cmp.w #288-WIDTH_BYTES*8,d3 bgt.s \rightside move.w d3,screenx(a5) rts \leftside: clr.w screenx(a5) rts \rightside: move.w #288-WIDTH_BYTES*8,screenx(a5) rts **************************************** PADDLE MOVEMENT try_to_go_left: move.w paddlex(a5),d0 subq.w #1,d0 blt.s \q lsr.w #4,d0 lea map+11*18(a5),a0 tst.b 0(a0,d0.w) bne.s \q subq.w #1,paddlex(a5) \q: rts try_to_go_right: move.w paddlex(a5),d0 add.w paddlew(a5),d0 cmp.w #288,d0 bge.s \q lsr.w #4,d0 lea map+11*18(a5),a0 tst.b 0(a0,d0.w) bne.s \q addq.w #1,paddlex(a5) \q: rts **************************************** DISPLAY THE PADDLE Player_Display: move.w paddlex(a5),d0 moveq #11*TILE_HEIGHT-1,d1 cmp.w #34,paddlew(a5) beq.s \w lea small_paddle(pc),a0 bra Adjusted_Sprite \w: lea paddle_left(pc),a0 move.w d0,-(sp) bsr Adjusted_Sprite move.w (sp)+,d0 moveq #11*TILE_HEIGHT-1,d1 add.w #17,d0 lea paddle_right(pc),a0 bra Adjusted_Sprite