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

  1.  
  2. PLR1_mouse_control
  3.  jsr ReadMouse
  4.  
  5.  move.l #SineTable,a0
  6.  move.w PLR1s_angspd,d1
  7.  move.w angpos,d0
  8.  and.w #8190,d0
  9.  move.w d0,PLR1s_angpos
  10.  move.w (a0,d0.w),PLR1s_sinval
  11.  adda.w #2048,a0
  12.  move.w (a0,d0.w),PLR1s_cosval
  13.  
  14.  move.l PLR1s_xspdval,d6
  15.  move.l PLR1s_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,PLR1_AIMSPD
  53.  add.w d3,d0
  54.  cmp.w #-80,d0
  55.  bgt.s .nolookup
  56.  move.w #-512*20,PLR1_AIMSPD
  57.  move.w #-80,d0
  58. .nolookup:
  59.  cmp.w #80,d0
  60.  blt.s .nolookdown
  61.  move.w #512*20,PLR1_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 PLR1_keyboard_control
  84.  
  85.  move.w #-20,d2
  86.  
  87.  tst.b PLR1_Squished
  88.  bne.s .halve
  89.  tst.b PLR1_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 PLR1s_sinval,d1
  107.  move.w PLR1s_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,PLR1s_xspdval
  122.  add.l d7,PLR1s_zspdval
  123.  move.l PLR1s_xspdval,d6
  124.  move.l PLR1s_zspdval,d7
  125.  add.l d6,PLR1s_xoff
  126.  add.l d7,PLR1s_zoff
  127.  
  128.  tst.b PLR1_fire
  129.  beq.s .firenotpressed
  130. ; fire was pressed last time.
  131.  btst #7,$bfe001
  132.  bne.s .firenownotpressed
  133. ; fire is still pressed this time.
  134.  st PLR1_fire
  135.  bra .doneplr1
  136.  
  137. .firenownotpressed:
  138. ; fire has been released.
  139.  clr.b PLR1_fire
  140.  bra .doneplr1
  141.  
  142. .firenotpressed
  143.  
  144. ; fire was not pressed last frame...
  145.  
  146.  btst #7,$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 PLR1_clicked
  152.  st PLR1_fire
  153.  
  154. .doneplr1:
  155.  
  156.  bsr PLR1_fall
  157.  
  158.  rts
  159.  
  160. ADDTOBOBBLE: dc.w 0
  161.  
  162. PLR1_follow_path:
  163.  
  164.  move.l pathpt,a0
  165.  move.w (a0),d1
  166.  move.w d1,PLR1s_xoff
  167.  move.w 2(a0),d1
  168.  move.w d1,PLR1s_zoff
  169.  move.w 4(a0),d0
  170.  add.w d0,d0
  171.  and.w #8190,d0
  172.  move.w d0,PLR1_angpos
  173.  
  174.  move.w TempFrames,d0
  175.  asl.w #3,d0
  176.  adda.w d0,a0
  177.  
  178.  cmp.l #endpath,a0
  179.  blt notrestartpath
  180.  move.l #Path,a0
  181. notrestartpath:
  182.  move.l a0,pathpt
  183.  
  184.  rts
  185.  
  186. gunheldlast:
  187.  dc.w 0
  188.  
  189. PLR1_alwayskeys
  190.  move.l #KeyMap,a5
  191.  moveq #0,d7
  192.  
  193.  move.b next_weapon_key,d7
  194.  tst.b (a5,d7.w)
  195.  beq.s .nonextweappre
  196.  
  197. ; tst.w PLR1_TimeToShoot
  198. ; bne.s .nonextweappre
  199.  
  200.  tst.b gunheldlast
  201.  bne.s .nonextweap
  202.  st gunheldlast
  203.  
  204.  moveq #0,d0
  205.  move.b PLR1_GunSelected,d0
  206.  move.l #PLAYERONEGUNS,a0
  207.  
  208. .findnext
  209.  addq #1,d0
  210.  cmp.w #9,d0
  211.  ble.s .okgun
  212.  moveq #0,d0
  213. .okgun:
  214.  tst.w (a0,d0.w*2)
  215.  beq.s .findnext
  216.  
  217.  move.b d0,PLR1_GunSelected 
  218.  bsr SHOWPLR1GUNNAME
  219.   
  220.  bra .nonextweap
  221.  
  222. .nonextweappre:
  223.  clr.b gunheldlast
  224. .nonextweap:
  225.  
  226.  
  227.  move.b operate_key,d7
  228.  move.b (a5,d7.w),d1
  229.  beq.s nottapped
  230.  tst.b OldSpace
  231.  bne.s nottapped
  232.  st PLR1_SPCTAP
  233. nottapped:
  234.  move.b d1,OldSpace
  235.  
  236.  move.b duck_key,d7
  237.  tst.b (a5,d7.w)
  238.  beq.s notduck
  239.  clr.b (a5,d7.w)
  240.  move.l #playerheight,PLR1s_targheight
  241.  not.b PLR1_Ducked
  242.  beq.s notduck
  243.  move.l #playercrouched,PLR1s_targheight
  244. notduck:
  245.  
  246.  move.l PLR1_Roompt,a4
  247.  move.l ToZoneFloor(a4),d0
  248.  sub.l ToZoneRoof(a4),d0
  249.  tst.b PLR1_StoodInTop
  250.  beq.s usebottom
  251.  move.l ToUpperFloor(a4),d0
  252.  sub.l ToUpperRoof(a4),d0
  253. usebottom:
  254.  
  255.  clr.b PLR1_Squished
  256.  move.l #playerheight,PLR1s_SquishedHeight
  257.  
  258.  cmp.l #playerheight+3*1024,d0
  259.  bgt.s oktostand
  260.  st PLR1_Squished
  261.  move.l #playercrouched,PLR1s_SquishedHeight
  262. oktostand:
  263.  
  264.  move.l PLR1s_targheight,d1
  265.  move.l PLR1s_SquishedHeight,d0
  266.  cmp.l d0,d1
  267.  blt.s .notsqu
  268.  move.l d0,d1
  269. .notsqu:
  270.  
  271.  move.l PLR1s_height,d0
  272.  cmp.l d1,d0
  273.  beq.s noupordown
  274.  bgt.s crouch
  275.  add.l #1024,d0
  276.  bra noupordown
  277. crouch:
  278.  sub.l #1024,d0
  279. noupordown:
  280.  move.l d0,PLR1s_height
  281.  
  282.  tst.b $27(a5)
  283.  beq.s notselkey
  284.  st PLR1KEYS
  285.  clr.b PLR1PATH
  286.  clr.b PLR1MOUSE
  287.  clr.b PLR1JOY
  288. notselkey:
  289.  
  290.  tst.b $26(a5)
  291.  beq.s notseljoy
  292.  clr.b PLR1KEYS
  293.  clr.b PLR1PATH
  294.  clr.b PLR1MOUSE
  295.  st PLR1JOY
  296. notseljoy:
  297.  
  298.  tst.b $37(a5)
  299.  beq.s notselmouse
  300.  clr.b PLR1KEYS
  301.  clr.b PLR1PATH
  302.  st PLR1MOUSE
  303.  clr.b PLR1JOY
  304. notselmouse:
  305.  
  306.  lea 1(a5),a4
  307.  move.l #PLAYERONEGUNS,a2
  308.  move.l PLR1_Obj,a3
  309.  move.w #9,d1
  310.  move.w #0,d2
  311. pickweap
  312.  move.w (a2)+,d0
  313.  and.b (a4)+,d0
  314.  beq.s notgotweap
  315.  move.b d2,PLR1_GunSelected
  316.  move.w #0,ObjTimer+128(a3)
  317.  
  318.  
  319. ; SCROLLPOINTER
  320. ; move.w #0,SCROLLXPOS
  321. ; move.l #TEMPSCROLL+160,ENDSCROLL
  322. ; move.w #40,SCROLLTIMER
  323.  
  324. ; d2=number of gun.
  325.  
  326.  bsr SHOWPLR1GUNNAME
  327.  
  328.  bra.s gogog
  329.  
  330. notgotweap
  331.  addq #1,d2
  332.  dbra d1,pickweap
  333.  
  334. gogog:
  335.  
  336.  ifeq CHEESEY
  337.  tst.b $43(a5)
  338.  beq.s .notswapscr
  339.  tst.b lastscr
  340.  bne.s .notswapscr2
  341.  st lastscr
  342.  
  343.  not.b FULLSCRTEMP
  344.  
  345.  bra.s .notswapscr2
  346.  
  347. .notswapscr:
  348.  clr.b lastscr
  349. .notswapscr2:
  350.  
  351.  endc
  352.  
  353.  rts
  354.  
  355. FULLSCRTEMP: dc.w 0
  356.  
  357. WIPEDISPLAY:
  358.  move.l #231,d0
  359.  moveq #0,d1
  360.  
  361.  move.w #7,d2
  362. planel:
  363.  move.l #231,d0
  364.  
  365. wipe:
  366.  move.l d1,2(a0)
  367.  move.l d1,6(a0)
  368.  move.l d1,10(a0)
  369.  move.l d1,14(a0)
  370.  move.l d1,18(a0)
  371.  move.l d1,22(a0)
  372.  move.l d1,26(a0)
  373.  move.l d1,30(a0)
  374.  move.l d1,34(a0)
  375.  add.w #40,a0
  376.  dbra d0,wipe
  377.  add.w #40*24,a0
  378.  dbra d2,planel
  379.  
  380.  rts
  381.  
  382. SHOWPLR1GUNNAME:
  383.  moveq #0,d2
  384.  move.b PLR1_GunSelected,d2
  385.  
  386.  move.l LINKFILE,a4
  387.  add.l #GunNames,a4
  388.  muls #20,d2
  389.  add.l d2,a4
  390.  move.l #TEMPSCROLL,a2
  391.  move.w #19,d2
  392.  
  393. .copyname:
  394.  move.b (a4)+,d3
  395.  bne.s .oklet
  396.  move.b #32,d3
  397. .oklet:
  398.  move.b d3,(a2)+
  399.  
  400.  dbra d2,.copyname
  401.  
  402.  move.l #TEMPSCROLL,d0
  403.  jsr SENDMESSAGENORET
  404.  rts
  405.  
  406.  
  407. GUNVALS: 
  408. ; machine gun
  409.  dc.b 0
  410. ; shotgun
  411.  dc.b 7
  412. ; plasma
  413.  dc.b 1
  414. ; grenade
  415.  dc.b 4
  416. ; rocket
  417.  dc.b 2
  418.  
  419. TOTHEMIDDLE: dc.w 0
  420. BIGsmall: dc.b 0
  421. lastscr: dc.b 0
  422. BOTTOMY: dc.w 0
  423.  even
  424.  
  425. PLR1_keyboard_control:
  426.  
  427.  move.l #SineTable,a0
  428.  
  429.  jsr PLR1_alwayskeys
  430.  move.l #KeyMap,a5
  431.  
  432.  move.w STOPOFFSET,d0
  433.  moveq #0,d7
  434.  move.b look_up_key,d7
  435.  tst.b (a5,d7.w)
  436.  beq.s .nolookup
  437.  
  438.  sub.w #512,PLR1_AIMSPD
  439.  sub.w #4,d0
  440.  cmp.w #-80,d0
  441.  bgt.s .nolookup
  442.  move.w #-512*20,PLR1_AIMSPD
  443.  move.w #-80,d0
  444. .nolookup:
  445.  moveq #0,d7
  446.  move.b look_down_key,d7
  447.  tst.b (a5,d7.w)
  448.  beq.s .nolookdown
  449.  add.w #512,PLR1_AIMSPD
  450.  add.w #4,d0
  451.  cmp.w #80,d0
  452.  blt.s .nolookdown
  453.  move.w #512*20,PLR1_AIMSPD
  454.  move.w #80,d0
  455. .nolookdown:
  456.  
  457.  move.b centre_view_key,d7
  458.  tst.b (a5,d7.w)
  459.  beq.s .nocent
  460.  
  461.  tst.b OLDCENT
  462.  bne.s .nocent2
  463.  st OLDCENT
  464.  
  465.  move.w #0,d0
  466.  move.w #0,PLR1_AIMSPD
  467.  
  468.  bra.s .nocent2
  469.  
  470. .nocent:
  471.  clr.b OLDCENT
  472. .nocent2:
  473.  
  474.  
  475.  move.w d0,STOPOFFSET
  476.  neg.w d0
  477.  add.w TOTHEMIDDLE,d0
  478.  move.w d0,SMIDDLEY
  479.  muls #320,d0
  480.  move.l d0,SBIGMIDDLEY
  481.  
  482.  move.w PLR1s_angpos,d0
  483.  move.w PLR1s_angspd,d3
  484.  move.w #35,d1
  485.  move.w #2,d2
  486.  move.w #10,TURNSPD
  487.  moveq #0,d7
  488.  move.b run_key,d7
  489.  tst.b (a5,d7.w)
  490.  beq.s nofaster
  491.  move.w #60,d1
  492.  move.w #3,d2
  493.  move.w #14,TURNSPD
  494. nofaster:
  495.  tst.b PLR1_Squished
  496.  bne.s .halve
  497.  tst.b PLR1_Ducked
  498.  beq.s .nohalve
  499. .halve
  500.  asr.w #1,d2
  501. .nohalve
  502.  
  503.  moveq #0,d4 
  504.  
  505.  tst.b SLOWDOWN
  506.  beq.s .nofric
  507.  move.w d3,d5
  508.  add.w d5,d5
  509.  add.w d5,d3
  510.  asr.w #2,d3
  511.  bge.s .nneg
  512.  addq #1,d3
  513. .nneg:
  514. .nofric:
  515.  
  516.  move.b turn_left_key,templeftkey
  517.  move.b turn_right_key,temprightkey
  518.  move.b sidestep_left_key,tempslkey
  519.  move.b sidestep_right_key,tempsrkey
  520.  
  521.  move.b force_sidestep_key,d7
  522.  tst.b (a5,d7.w)
  523.  beq .noalwayssidestep
  524.  
  525.  move.b templeftkey,tempslkey
  526.  move.b temprightkey,tempsrkey
  527.  move.b #255,templeftkey
  528.  move.b #255,temprightkey
  529.  
  530. .noalwayssidestep:
  531.  
  532.  tst.b SLOWDOWN
  533.  beq.s noturnposs
  534.  
  535.  
  536.  move.b templeftkey,d7
  537.  tst.b (a5,d7.w)
  538.  beq.s noleftturn
  539.  sub.w TURNSPD,d3
  540. noleftturn
  541.  move.l #KeyMap,a5
  542.  move.b temprightkey,d7
  543.  tst.b (a5,d7.w)
  544.  beq.s norightturn
  545.  add.w TURNSPD,d3
  546. norightturn
  547.  
  548.  cmp.w d1,d3
  549.  ble.s .okrspd
  550.  move.w d1,d3
  551. .okrspd:
  552.  neg.w d1
  553.  cmp.w d1,d3
  554.  bge.s .oklspd
  555.  move.w d1,d3
  556. .oklspd:
  557.  
  558. noturnposs:
  559.  
  560.  add.w d3,d0
  561.  add.w d3,d0
  562.  move.w d3,PLR1s_angspd
  563.  
  564.  move.b tempslkey,d7
  565.  tst.b (a5,d7.w)
  566.  beq.s noleftslide
  567.  add.w d2,d4
  568.  add.w d2,d4
  569.  asr.w #1,d4
  570. noleftslide
  571.  move.l #KeyMap,a5
  572.  move.b tempsrkey,d7
  573.  tst.b (a5,d7.w)
  574.  beq.s norightslide
  575.  add.w d2,d4
  576.  add.w d2,d4
  577.  asr.w #1,d4
  578.  neg.w d4
  579. norightslide
  580.   
  581. noslide:
  582.   
  583.  and.w #8191,d0
  584.  move.w d0,PLR1s_angpos
  585.  
  586.  move.w (a0,d0.w),PLR1s_sinval
  587.  adda.w #2048,a0
  588.  move.w (a0,d0.w),PLR1s_cosval
  589.  
  590.  move.l PLR1s_xspdval,d6
  591.  move.l PLR1s_zspdval,d7
  592.  
  593.  tst.b SLOWDOWN
  594.  beq.s .nofriction
  595.  
  596.  neg.l d6
  597.  ble.s .nobug1
  598.  asr.l #3,d6
  599.  add.l #1,d6
  600.  bra.s .bug1
  601. .nobug1
  602.  asr.l #3,d6
  603. .bug1:
  604.  
  605.  neg.l d7
  606.  ble.s .nobug2
  607.  asr.l #3,d7
  608.  add.l #1,d7
  609.  bra.s .bug2
  610. .nobug2
  611.  asr.l #3,d7
  612. .bug2: 
  613.  
  614. .nofriction:
  615.  
  616.  moveq #0,d3
  617.  
  618.  moveq #0,d5
  619.  move.b forward_key,d5
  620.  tst.b (a5,d5.w)
  621.  beq.s noforward
  622.  neg.w d2
  623.  move.w d2,d3
  624.  
  625. noforward:
  626.  move.b backward_key,d5
  627.  tst.b (a5,d5.w)
  628.  beq.s nobackward
  629.  move.w d2,d3
  630. nobackward:
  631.  
  632.  move.w d3,d2
  633.  asl.w #6,d2
  634.  move.w d2,d1
  635. ; add.w d2,d1
  636. ; add.w d2,d1
  637.  move.w d1,ADDTOBOBBLE
  638.  
  639.  move.w PLR1s_sinval,d1
  640.  muls d3,d1
  641.  move.w PLR1s_cosval,d2
  642.  muls d3,d2
  643.  
  644.  sub.l d1,d6
  645.  sub.l d2,d7
  646.  move.w PLR1s_sinval,d1
  647.  muls d4,d1
  648.  move.w PLR1s_cosval,d2
  649.  muls d4,d2
  650.  sub.l d2,d6
  651.  add.l d1,d7
  652.  
  653.  tst.b SLOWDOWN
  654.  beq.s .nocontrolposs
  655.  add.l d6,PLR1s_xspdval
  656.  add.l d7,PLR1s_zspdval
  657. .nocontrolposs
  658.  move.l PLR1s_xspdval,d6
  659.  move.l PLR1s_zspdval,d7
  660.  add.l d6,PLR1s_xoff
  661.  add.l d7,PLR1s_zoff
  662.  
  663.  move.b fire_key,d5
  664.  tst.b PLR1_fire
  665.  beq.s .firenotpressed
  666. ; fire was pressed last time.
  667.  tst.b (a5,d5.w)
  668.  beq.s .firenownotpressed
  669. ; fire is still pressed this time.
  670.  st PLR1_fire
  671.  bra .doneplr1
  672.  
  673. .firenownotpressed:
  674. ; fire has been released.
  675.  clr.b PLR1_fire
  676.  bra .doneplr1
  677.  
  678. .firenotpressed
  679.  
  680. ; fire was not pressed last frame...
  681.  
  682.  tst.b (a5,d5.w)
  683. ; if it has still not been pressed, go back above
  684.  beq.s .firenownotpressed
  685. ; fire was not pressed last time, and was this time, so has
  686. ; been clicked.
  687.  st PLR1_clicked
  688.  st PLR1_fire
  689.  
  690. .doneplr1:
  691.  
  692.  bsr PLR1_fall
  693.  
  694.  rts
  695.  
  696. TEMPSCROLL
  697.  dcb.b 160,32
  698.  
  699. passspace:
  700.  ds.l 400 
  701.  
  702. PLR1_JoyStick_control:
  703.  
  704.  jsr _ReadJoy1
  705.  bra PLR1_keyboard_control
  706.  
  707. PLR1_clumptime: dc.w 0
  708.  
  709. PLR1clump:
  710.  
  711.  movem.l d0-d7/a0-a6,-(a7)
  712.  move.l PLR1_Roompt,a0
  713.  move.w ToFloorNoise(a0),d0
  714.  
  715.  move.l ToZoneWater(a0),d1
  716.  cmp.l ToZoneFloor(a0),d1
  717.  bge.s THERESNOWATER
  718.  
  719.  cmp.l PLR1_yoff,d1
  720.  blt.s THERESNOWATER
  721.  
  722.  tst.b PLR1_StoodInTop
  723.  bne.s THERESNOWATER
  724.  
  725.  move.w #6,d0
  726.  bra.s THERESWATER
  727.  
  728. THERESNOWATER:
  729.  
  730.  tst.b PLR1_StoodInTop
  731.  beq.s .okinbot
  732.  move.w ToUpperFloorNoise(a0),d0
  733. .okinbot:
  734.  
  735.  move.l LINKFILE,a0
  736.  add.l #FloorData,a0
  737.  move.w 2(a0,d0.w*4),d0    ; sample number.
  738.  
  739.  subq #1,d0
  740.  blt.s nofootsound
  741.  
  742. THERESWATER:
  743.  move.w d0,Samplenum
  744.  move.w #0,Noisex
  745.  move.w #100,Noisez
  746.  move.w #80,Noisevol
  747.  move.w #$fff8,IDNUM
  748.  clr.b notifplaying
  749.  move.b PLR1_Echo,SourceEcho
  750.  jsr MakeSomeNoise
  751.  
  752. nofootsound:
  753.  movem.l (a7)+,d0-d7/a0-a6
  754.  
  755.  rts
  756.