home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1997 #2 / amigaacscoverdisc / games / alienbreed3d2 / source_4000 / plr3control.s < prev    next >
Text File  |  1997-01-31  |  10KB  |  746 lines

  1.  
  2. PLR3_mouse_control
  3.  jsr ReadMouse
  4.  
  5.  move.l #SineTable,a0
  6.  move.w PLR3s_angspd,d1
  7.  move.w angpos,d0
  8.  and.w #8190,d0
  9.  move.w d0,PLR3s_angpos
  10.  move.w (a0,d0.w),PLR3s_sinval
  11.  adda.w #2048,a0
  12.  move.w (a0,d0.w),PLR3s_cosval
  13.  
  14.  move.l PLR3s_xspdval,d6
  15.  move.l PLR3s_zspdval,d7
  16.  
  17.  neg.l d6
  18.  ble.s .nobug1
  19.  asr.l #1,d6
  20.  add.l #1,d6
  21.  bra.s .bug1
  22. .nobug1
  23.  asr.l #1,d6
  24. .bug1:
  25.  
  26.  neg.l d7
  27.  ble.s .nobug2
  28.  asr.l #1,d7
  29.  add.l #1,d7
  30.  bra.s .bug2
  31. .nobug2
  32.  asr.l #1,d7
  33. .bug2: 
  34.  
  35.  move.w ymouse,d3
  36.  sub.w oldymouse,d3
  37.  add.w d3,oldymouse
  38. ; asr.w #1,d3
  39. ; cmp.w #50,d3
  40. ; ble.s .nofastfor
  41. ; move.w #50,d3
  42. ;.nofastfor:
  43. ; cmp.w #-50,d3
  44. ; bge.s .nofastback
  45. ; move.w #-50,d3
  46. ;.nofastback:
  47.  
  48.  move.w STOPOFFSET,d0
  49.  move.w d3,d2
  50.  asl.w #7,d2
  51.  
  52.  add.w d2,PLR3_AIMSPD
  53.  add.w d3,d0
  54.  cmp.w #-80,d0
  55.  bgt.s .nolookup
  56.  move.w #-512*20,PLR3_AIMSPD
  57.  move.w #-80,d0
  58. .nolookup:
  59.  cmp.w #80,d0
  60.  blt.s .nolookdown
  61.  move.w #512*20,PLR3_AIMSPD
  62.  move.w #80,d0
  63. .nolookdown
  64.  
  65.  move.w d0,STOPOFFSET
  66.  neg.w d0
  67.  add.w TOTHEMIDDLE,d0
  68.  move.w d0,SMIDDLEY
  69.  muls #320,d0
  70.  move.l d0,SBIGMIDDLEY
  71.  
  72.  move.l #KeyMap,a5
  73.  moveq #0,d7
  74.  move.b forward_key,d7
  75.  
  76.  btst #6,$bfe001
  77.  seq.s (a5,d7.w)
  78.  
  79.  move.b fire_key,d7
  80.  btst #2,$dff016
  81.  seq.s (a5,d7.w)
  82.  
  83.  bra PLR3_keyboard_control
  84.  
  85.  move.w #-20,d2
  86.  
  87.  tst.b PLR2_Squished
  88.  bne.s .halve
  89.  tst.b PLR2_Ducked
  90.  beq.s .nohalve
  91. .halve
  92.  asr.w #1,d2
  93. .nohalve
  94.  
  95.  btst #6,$bfe001
  96.  beq.s .moving
  97.  moveq #0,d2
  98. .moving:
  99.  
  100.  move.w d2,d3
  101.  asl.w #4,d2
  102.  move.w d2,d1
  103.  
  104.  move.w d1,ADDTOBOBBLE
  105.  
  106.  move.w PLR2s_sinval,d1
  107.  move.w PLR2s_cosval,d2
  108.  
  109.  move.w d2,d4
  110.  move.w d1,d5
  111.  muls lrs,d4
  112.  muls lrs,d5
  113.  
  114.  muls d3,d2
  115.  muls d3,d1
  116.  sub.l d4,d1
  117.  add.l d5,d2
  118.  
  119.  sub.l d1,d6
  120.  sub.l d2,d7
  121.  add.l d6,PLR2s_xspdval
  122.  add.l d7,PLR2s_zspdval
  123.  move.l PLR2s_xspdval,d6
  124.  move.l PLR2s_zspdval,d7
  125.  add.l d6,PLR2s_xoff
  126.  add.l d7,PLR2s_zoff
  127.  
  128.  tst.b PLR2_fire
  129.  beq.s .firenotpressed
  130. ; fire was pressed last time.
  131.  btst #6,$bfe001
  132.  bne.s .firenownotpressed
  133. ; fire is still pressed this time.
  134.  st PLR2_fire
  135.  bra .donePLR2
  136.  
  137. .firenownotpressed:
  138. ; fire has been released.
  139.  clr.b PLR2_fire
  140.  bra .donePLR2
  141.  
  142. .firenotpressed
  143.  
  144. ; fire was not pressed last frame...
  145.  
  146.  btst #6,$bfe001
  147. ; if it has still not been pressed, go back above
  148.  bne.s .firenownotpressed
  149. ; fire was not pressed last time, and was this time, so has
  150. ; been clicked.
  151.  st PLR2_clicked
  152.  st PLR2_fire
  153.  
  154. .donePLR2:
  155.  
  156.  bsr PLR2_fall
  157.  
  158.  rts
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186. PLR3_alwayskeys
  187.  move.l #KeyMap,a5
  188.  moveq #0,d7
  189.  
  190.  move.b next_weapon_key,d7
  191.  tst.b (a5,d7.w)
  192.  beq.s .nonextweappre
  193.  
  194. ; tst.b PLR2_GunFrame
  195. ; bne.s .nonextweappre
  196.  
  197.  tst.b gunheldlast
  198.  bne.s .nonextweap
  199.  st gunheldlast
  200.  
  201.  moveq #0,d0
  202.  move.b PLR3_GunSelected,d0
  203.  move.l #PLAYERTHREEGUNS,a0
  204.  
  205. .findnext
  206.  addq #1,d0
  207.  cmp.w #9,d0
  208.  ble.s .okgun
  209.  moveq #0,d0
  210. .okgun:
  211.  tst.w (a0,d0.w*2)
  212.  beq.s .findnext
  213.  
  214.  move.b d0,PLR3_GunSelected 
  215.  bsr SHOWPLR3GUNNAME
  216.   
  217.  bra .nonextweap
  218.  
  219. .nonextweappre:
  220.  clr.b gunheldlast
  221. .nonextweap:
  222.  
  223.  
  224.  move.b operate_key,d7
  225.  move.b (a5,d7.w),d1
  226.  beq.s .nottapped
  227.  tst.b OldSpace
  228.  bne.s .nottapped
  229.  st PLR3_SPCTAP
  230. .nottapped:
  231.  move.b d1,OldSpace
  232.  
  233.  move.b duck_key,d7
  234.  tst.b (a5,d7.w)
  235.  beq.s .notduck
  236.  clr.b (a5,d7.w)
  237.  move.l #playerheight,PLR3s_targheight
  238.  not.b PLR3_Ducked
  239.  beq.s .notduck
  240.  move.l #playercrouched,PLR3s_targheight
  241. .notduck:
  242.  
  243.  move.l PLR3_Roompt,a4
  244.  move.l ToZoneFloor(a4),d0
  245.  sub.l ToZoneRoof(a4),d0
  246.  tst.b PLR3_StoodInTop
  247.  beq.s .usebottom
  248.  move.l ToUpperFloor(a4),d0
  249.  sub.l ToUpperRoof(a4),d0
  250. .usebottom:
  251.  
  252.  clr.b PLR3_Squished
  253.  move.l #playerheight,PLR3s_SquishedHeight
  254.  
  255.  cmp.l #playerheight+3*1024,d0
  256.  bgt.s oktostand3
  257.  st PLR3_Squished
  258.  move.l #playercrouched,PLR3s_SquishedHeight
  259. oktostand3:
  260.  
  261.  move.l PLR3s_targheight,d1
  262.  move.l PLR3s_SquishedHeight,d0
  263.  cmp.l d0,d1
  264.  blt.s .notsqu
  265.  move.l d0,d1
  266. .notsqu:
  267.  
  268.  move.l PLR3s_height,d0
  269.  cmp.l d1,d0
  270.  beq.s .noupordown
  271.  bgt.s .crouch
  272.  add.l #1024,d0
  273.  bra .noupordown
  274. .crouch:
  275.  sub.l #1024,d0
  276. .noupordown:
  277.  move.l d0,PLR3s_height
  278.  
  279.  tst.b $27(a5)
  280.  beq.s .notselkey
  281.  st PLR3KEYS
  282.  clr.b PLR3PATH
  283.  clr.b PLR3MOUSE
  284.  clr.b PLR3JOY
  285. .notselkey:
  286.  
  287.  tst.b $26(a5)
  288.  beq.s .notseljoy
  289.  clr.b PLR3KEYS
  290.  clr.b PLR3PATH
  291.  clr.b PLR3MOUSE
  292.  st PLR3JOY
  293. .notseljoy:
  294.  
  295.  tst.b $37(a5)
  296.  beq.s .notselmouse
  297.  clr.b PLR3KEYS
  298.  clr.b PLR3PATH
  299.  st PLR3MOUSE
  300.  clr.b PLR3JOY
  301. .notselmouse:
  302.  
  303.  lea 1(a5),a4
  304.  move.l #PLAYERTHREEGUNS,a2
  305.  move.l GUN_OBJ,a3
  306.  move.w #9,d1
  307.  move.w #0,d2
  308. pickweap3
  309.  move.w (a2)+,d0
  310.  and.b (a4)+,d0
  311.  beq.s notgotweap3
  312.  move.b d2,PLR3_GunSelected
  313.  move.w #0,ObjTimer(a3)
  314.  
  315. ; move.l #TEMPSCROLL,SCROLLPOINTER
  316. ; move.w #0,SCROLLXPOS
  317. ; move.l #TEMPSCROLL+160,ENDSCROLL
  318. ; move.w #40,SCROLLTIMER
  319.  
  320. ; d2=number of gun.
  321.  
  322.  bsr SHOWPLR3GUNNAME
  323.  
  324.  bra.s gogogogog3
  325.  
  326. notgotweap3
  327.  addq #1,d2
  328.  dbra d1,pickweap3
  329.  
  330. gogogogog3:
  331.  
  332.  ifeq CHEESEY
  333.  
  334.  tst.b $43(a5)
  335.  beq.s .notswapscr
  336.  tst.b lastscr
  337.  bne.s .notswapscr2
  338.  st lastscr
  339.  
  340.  not.b FULLSCRTEMP
  341.  
  342.  bra.s .notswapscr2
  343.  
  344. .notswapscr:
  345.  clr.b lastscr
  346. .notswapscr2:
  347.  
  348.  endc
  349.  
  350.  rts
  351.  
  352. SHOWPLR3GUNNAME:
  353.  moveq #0,d2
  354.  move.b PLR3_GunSelected,d2
  355.  
  356.  move.l LINKFILE,a4
  357.  add.l #GunNames,a4
  358.  muls #20,d2
  359.  add.l d2,a4
  360.  move.l #TEMPSCROLL,a2
  361.  move.w #19,d2
  362.  
  363. .copyname:
  364.  move.b (a4)+,d3
  365.  bne.s .oklet
  366.  move.b #32,d3
  367. .oklet:
  368.  move.b d3,(a2)+
  369.  
  370.  dbra d2,.copyname
  371.  
  372.  move.l #TEMPSCROLL,d0
  373.  jsr SENDMESSAGENORET
  374.  rts
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420. PLR3_keyboard_control:
  421.  
  422.  move.l #SineTable,a0
  423.  
  424.  jsr PLR3_alwayskeys
  425.  move.l #KeyMap,a5
  426.  
  427.  move.w STOPOFFSET,d0
  428.  moveq #0,d7
  429.  move.b look_up_key,d7
  430.  tst.b (a5,d7.w)
  431.  beq.s .nolookup
  432.  
  433.  sub.w #512,PLR3_AIMSPD
  434.  sub.w #4,d0
  435.  cmp.w #-80,d0
  436.  bgt.s .nolookup
  437.  move.w #-512*20,PLR3_AIMSPD
  438.  move.w #-80,d0
  439. .nolookup:
  440.  moveq #0,d7
  441.  move.b look_down_key,d7
  442.  tst.b (a5,d7.w)
  443.  beq.s .nolookdown
  444.  add.w #512,PLR3_AIMSPD
  445.  add.w #4,d0
  446.  cmp.w #80,d0
  447.  blt.s .nolookdown
  448.  move.w #512*20,PLR3_AIMSPD
  449.  move.w #80,d0
  450. .nolookdown:
  451.  
  452.  move.b centre_view_key,d7
  453.  tst.b (a5,d7.w)
  454.  beq.s .nocent
  455.  
  456.  tst.b OLDCENT
  457.  bne.s .nocent3
  458.  st OLDCENT
  459.  
  460.  move.w #0,d0
  461.  move.w #0,PLR3_AIMSPD
  462.  
  463.  bra.s .nocent3
  464.  
  465. .nocent:
  466.  clr.b OLDCENT
  467. .nocent3:
  468.  
  469.  
  470.  move.w d0,STOPOFFSET
  471.  neg.w d0
  472.  add.w TOTHEMIDDLE,d0
  473.  move.w d0,SMIDDLEY
  474.  muls #320,d0
  475.  move.l d0,SBIGMIDDLEY
  476.  
  477.  move.w PLR3s_angpos,d0
  478.  move.w PLR3s_angspd,d3
  479.  move.w #35,d1
  480.  move.w #2,d2
  481.  move.w #10,TURNSPD
  482.  moveq #0,d7
  483.  move.b run_key,d7
  484.  tst.b (a5,d7.w)
  485.  beq.s .nofaster
  486.  move.w #60,d1
  487.  move.w #3,d2
  488.  move.w #14,TURNSPD
  489. .nofaster:
  490.  tst.b PLR3_Squished
  491.  bne.s .halve
  492.  tst.b PLR3_Ducked
  493.  beq.s .nohalve
  494. .halve:
  495.  asr.w #1,d2
  496. .nohalve
  497.  
  498.  moveq #0,d4 
  499.  
  500.  tst.b SLOWDOWN
  501.  beq.s .nofric
  502.  move.w d3,d5
  503.  add.w d5,d5
  504.  add.w d5,d3
  505.  asr.w #2,d3
  506.  bge.s .nneg
  507.  addq #1,d3
  508. .nneg:
  509. .nofric:
  510.  
  511.  move.b turn_left_key,templeftkey
  512.  move.b turn_right_key,temprightkey
  513.  move.b sidestep_left_key,tempslkey
  514.  move.b sidestep_right_key,tempsrkey
  515.  
  516.  move.b force_sidestep_key,d7
  517.  tst.b (a5,d7.w)
  518.  beq .noalwayssidestep
  519.  
  520.  move.b templeftkey,tempslkey
  521.  move.b temprightkey,tempsrkey
  522.  move.b #255,templeftkey
  523.  move.b #255,temprightkey
  524.  
  525. .noalwayssidestep:
  526.  
  527.  tst.b SLOWDOWN
  528.  beq.s noturnposs3
  529.  
  530.  
  531.  move.b templeftkey,d7
  532.  tst.b (a5,d7.w)
  533.  beq.s .noleftturn
  534.  sub.w TURNSPD,d3
  535. .noleftturn
  536.  move.l #KeyMap,a5
  537.  move.b temprightkey,d7
  538.  tst.b (a5,d7.w)
  539.  beq.s .norightturn
  540.  add.w TURNSPD,d3
  541. .norightturn
  542.  
  543.  cmp.w d1,d3
  544.  ble.s .okrspd
  545.  move.w d1,d3
  546. .okrspd:
  547.  neg.w d1
  548.  cmp.w d1,d3
  549.  bge.s .oklspd
  550.  move.w d1,d3
  551. .oklspd:
  552.  
  553. noturnposs3:
  554.  
  555.  add.w d3,d0
  556.  add.w d3,d0
  557.  move.w d3,PLR3s_angspd
  558.  
  559.  move.b tempslkey,d7
  560.  tst.b (a5,d7.w)
  561.  beq.s .noleftslide
  562.  add.w d2,d4
  563.  add.w d2,d4
  564.  asr.w #1,d4
  565. .noleftslide
  566.  move.l #KeyMap,a5
  567.  move.b tempsrkey,d7
  568.  tst.b (a5,d7.w)
  569.  beq.s .norightslide
  570.  add.w d2,d4
  571.  add.w d2,d4
  572.  asr.w #1,d4
  573.  neg.w d4
  574. .norightslide
  575.   
  576. noslide3:
  577.   
  578.  and.w #8191,d0
  579.  move.w d0,PLR3s_angpos
  580.  
  581.  move.w (a0,d0.w),PLR3s_sinval
  582.  adda.w #2048,a0
  583.  move.w (a0,d0.w),PLR3s_cosval
  584.  
  585.  move.l PLR3s_xspdval,d6
  586.  move.l PLR3s_zspdval,d7
  587.  
  588.  tst.b SLOWDOWN
  589.  beq.s .nofriction
  590.  
  591.  neg.l d6
  592.  ble.s .nobug1
  593.  asr.l #3,d6
  594.  add.l #1,d6
  595.  bra.s .bug1
  596. .nobug1
  597.  asr.l #3,d6
  598. .bug1:
  599.  
  600.  neg.l d7
  601.  ble.s .nobug2
  602.  asr.l #3,d7
  603.  add.l #1,d7
  604.  bra.s .bug2
  605. .nobug2
  606.  asr.l #3,d7
  607. .bug2: 
  608.  
  609. .nofriction
  610.  
  611.  moveq #0,d3
  612.  
  613.  moveq #0,d5
  614.  move.b forward_key,d5
  615.  tst.b (a5,d5.w)
  616.  beq.s .noforward
  617.  neg.w d2
  618.  move.w d2,d3
  619.  
  620. .noforward:
  621.  move.b backward_key,d5
  622.  tst.b (a5,d5.w)
  623.  beq.s .nobackward
  624.  move.w d2,d3
  625. .nobackward:
  626.  
  627.  move.w d3,d2
  628.  asl.w #6,d2
  629.  move.w d2,d1
  630. ; add.w d2,d1
  631. ; add.w d2,d1
  632.  move.w d1,ADDTOBOBBLE
  633.  
  634.  move.w PLR3s_sinval,d1
  635.  muls d3,d1
  636.  move.w PLR3s_cosval,d2
  637.  muls d3,d2
  638.  
  639.  sub.l d1,d6
  640.  sub.l d2,d7
  641.  move.w PLR3s_sinval,d1
  642.  muls d4,d1
  643.  move.w PLR3s_cosval,d2
  644.  muls d4,d2
  645.  sub.l d2,d6
  646.  add.l d1,d7
  647.  
  648.  tst.b SLOWDOWN
  649.  beq.s .nocontrolposs
  650.  add.l d6,PLR3s_xspdval
  651.  add.l d7,PLR3s_zspdval
  652. .nocontrolposs:
  653.  move.l PLR3s_xspdval,d6
  654.  move.l PLR3s_zspdval,d7
  655.  add.l d6,PLR3s_xoff
  656.  add.l d7,PLR3s_zoff
  657.  
  658.  move.b fire_key,d5
  659.  tst.b PLR3_fire
  660.  beq.s .firenotpressed
  661. ; fire was pressed last time.
  662.  tst.b (a5,d5.w)
  663.  beq.s .firenownotpressed
  664. ; fire is still pressed this time.
  665.  st PLR3_fire
  666.  bra .doneplr3
  667.  
  668. .firenownotpressed:
  669. ; fire has been released.
  670.  clr.b PLR3_fire
  671.  bra .doneplr3
  672.  
  673. .firenotpressed
  674.  
  675. ; fire was not pressed last frame...
  676.  
  677.  tst.b (a5,d5.w)
  678. ; if it has still not been pressed, go back above
  679.  beq.s .firenownotpressed
  680. ; fire was not pressed last time, and was this time, so has
  681. ; been clicked.
  682.  st PLR3_clicked
  683.  st PLR3_fire
  684.  
  685. .doneplr3:
  686.  
  687.  bsr PLR3_fall
  688.  
  689.  rts
  690.  
  691.  
  692.   
  693. PLR3_JoyStick_control:
  694.  
  695. ; jsr _ReadJoy3
  696.  bra PLR3_keyboard_control
  697.  
  698. PLR3_clumptime: dc.w 0
  699.  
  700. PLR3clump:
  701.  
  702.  movem.l d0-d7/a0-a6,-(a7)
  703.  move.l PLR3_Roompt,a0
  704.  move.w ToFloorNoise(a0),d0
  705.  
  706.  move.l ToZoneWater(a0),d1
  707.  cmp.l ToZoneFloor(a0),d1
  708.  bge.s THERESNOWATER3
  709.  
  710.  cmp.l PLR3_yoff,d1
  711.  blt.s THERESNOWATER3
  712.  
  713.  tst.b PLR3_StoodInTop
  714.  bne.s THERESNOWATER3
  715.  
  716.  move.w #6,d0
  717.  bra.s THERESWATER3
  718.  
  719. THERESNOWATER3:
  720.  
  721.  tst.b PLR3_StoodInTop
  722.  beq.s .okinbot
  723.  move.w ToUpperFloorNoise(a0),d0
  724. .okinbot:
  725.  
  726.  move.l LINKFILE,a0
  727.  add.l #FloorData,a0
  728.  move.w 2(a0,d0.w*4),d0    ; sample number.
  729.  
  730.  subq #1,d0
  731.  blt.s nofootsound3
  732.  
  733. THERESWATER3:
  734.  move.w d0,Samplenum
  735.  move.w #0,Noisex
  736.  move.w #100,Noisez
  737.  move.w #80,Noisevol
  738.  move.w #$fff8,IDNUM
  739.  clr.b notifplaying
  740.  move.b PLR3_Echo,SourceEcho
  741.  jsr MakeSomeNoise
  742.  
  743. nofootsound3:
  744.  movem.l (a7)+,d0-d7/a0-a6
  745.  
  746.  rts