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

  1.  
  2. PLR1_clicked: dc.b 0
  3. PLR2_clicked: dc.b 0
  4. popping: ds.l 5*4
  5. targdist: dc.w 0
  6. targetydiff: dc.l 0
  7. PLR1_TimeToShoot: dc.w 0
  8. PLR2_TimeToShoot: dc.w 0
  9.  
  10. tempangpos: dc.w 0
  11.  
  12. MaxFrame: dc.w 0
  13. BULTYPE: dc.w 0
  14. AmmoInMyGun: dc.w 0
  15.  
  16. Player1Shot:
  17.  
  18.  tst.w PLR1_TimeToShoot
  19.  beq.s okcanfire
  20.  
  21.  move.w TempFrames,d0
  22.  sub.w d0,PLR1_TimeToShoot
  23.  bge PLR1_nofire
  24.  move.w #0,PLR1_TimeToShoot
  25.  bra PLR1_nofire
  26.  
  27. okcanfire:
  28.  
  29.  moveq #0,d0
  30.  move.b p1_gunselected,d0
  31.  move.b d0,tempgun
  32.  
  33.  
  34.  move.l LINKFILE,a6
  35.  lea GunBulletTypes(a6),a6
  36.  lea BulletAnimData-GunBulletTypes(a6),a5
  37.  lea (a6,d0.w*8),a6
  38.  move.w G_BulletType(a6),d0 ; bullet type
  39.  move.w d0,BULTYPE
  40.  move.l #PLAYERONEAMMO,a0
  41.  move.w (a0,d0.w*2),AmmoInMyGun
  42.  
  43.  muls #B_BulStatLen,d0
  44.  add.w d0,a5
  45.  
  46.  move.w B_MovementSpeed+2(a5),BulletSpd
  47.  
  48. ; tst.w (a6)
  49. ; beq.s .itsaclick
  50.  
  51.  tst.b p1_fire
  52.  beq PLR1_nofire
  53. ; bra .itsahold
  54. ;
  55. ;.itsaclick:
  56. ; tst.b p1_clicked
  57. ; beq PLR1_nofire
  58. ;
  59. ;.itsahold:
  60.  
  61.  move.w PLR1_angpos,d0
  62.  move.w d0,tempangpos
  63.  move.l #SineTable,a0
  64.  lea (a0,d0.w),a0
  65.  move.w (a0),tempxdir 
  66.  move.w 2048(a0),tempzdir
  67.  move.w PLR1_xoff,tempxoff
  68.  move.w PLR1_zoff,tempzoff
  69.  move.l PLR1_yoff,tempyoff
  70.  add.l #10*128,tempyoff
  71.  move.b PLR1_StoodInTop,tempStoodInTop
  72.  move.l PLR1_Roompt,tempRoompt
  73.  move.l #%100011,d7
  74.  move.w #-1,d0
  75.  move.l #0,targetydiff
  76.  move.l #$7fff,d1
  77.  
  78.  move.l ZoneAdds,a3
  79.  
  80.  move.l #PLR1_ObsInLine,a1
  81.  move.l ObjectData,a0
  82.  move.l #PLR1_ObjDists,a2
  83. findclosestinline
  84.  
  85.  tst.w (a0)
  86.  blt outofline
  87.  
  88.  cmp.b #3,16(a0)
  89.  beq notlinedup
  90.  
  91.  tst.b (a1)+
  92.  beq.s notlinedup
  93.  btst #0,17(a0)
  94.  beq.s notlinedup
  95.  tst.w 12(a0)
  96.  blt.s notlinedup
  97.  move.b 16(a0),d6
  98.  btst d6,d7
  99.  beq.s notlinedup
  100.  
  101.  tst.b numlives(a0)
  102.  beq.s notlinedup
  103.  move.w (a0),d5
  104.  move.w (a2,d5.w*2),d6
  105.  move.w 4(a0),d2
  106.  ext.l d2
  107.  asl.l #7,d2
  108.  sub.l PLR1_yoff,d2
  109.  move.l d2,d3
  110.  bge.s .oknotneg
  111.  neg.l d2
  112. .oknotneg:
  113.  divs #44,d2
  114.  cmp.w d6,d2
  115.  bgt.s notlinedup
  116.  
  117.  cmp.w d6,d1
  118.  blt.s notlinedup
  119.  move.w d6,d1
  120.  move.l a0,a4
  121.  
  122. ; We have a closer enemy lined up.
  123.  move.l d3,targetydiff 
  124.  move.w d5,d0
  125.  
  126. notlinedup:
  127.  add.w #64,a0
  128.  bra findclosestinline
  129.  
  130. outofline:
  131.  
  132.  
  133.  move.w d1,targdist
  134.  
  135.  move.l targetydiff,d5
  136.  sub.l PLR1_height,d5
  137.  add.l #18*256,d5
  138.  move.w d1,closedist
  139.  
  140.  move.w BulletSpd,d2
  141.  asr.w d2,d1
  142.  tst.w d1
  143.  bgt.s okdistthing
  144.  moveq #1,d1
  145. okdistthing
  146.  divs d1,d5
  147.  move.w d5,bulyspd
  148.  
  149.  move.w AmmoInMyGun,d2
  150.  move.w G_BulletsPerShot(a6),d1
  151.  cmp.w d1,d2
  152.  bge.s .okcanshoot
  153.  
  154.  move.l PLR1_Obj,a2
  155.  move.w (a2),d0
  156.  move.l #ObjRotated,a2
  157.  move.l (a2,d0.w*8),Noisex
  158.  move.w #100,Noisevol
  159.  move.w #100,PLAYERONENOISEVOL
  160.  move.w #12,Samplenum
  161.  clr.b notifplaying
  162.  move.b #$fb,IDNUM
  163.  jsr MakeSomeNoise
  164.  
  165.  rts
  166.  
  167. .okcanshoot:
  168.  
  169.  cmp.b #'s',mors
  170.  beq.s .notplr1
  171.  move.l PLR1_Obj,a2
  172.  move.w #1,ObjTimer+128(a2)
  173. .notplr1
  174.  
  175.  move.w G_DelayBetweenShots(a6),PLR1_TimeToShoot
  176.  
  177.  move.b MaxFrame,PLR1_GunFrame
  178.  sub.w d1,d2
  179.  
  180.  move.l #PLAYERONEAMMO,a2
  181.  add.w BULTYPE,a2
  182.  add.w BULTYPE,a2
  183.  move.w d2,(a2)
  184.  
  185.  move.l PLR1_Obj,a2
  186.  move.w (a2),d2
  187.  move.l #ObjRotated,a2
  188.  move.l (a2,d2.w*8),Noisex
  189.  move.w #100,PLAYERONENOISEVOL
  190.  move.w #300,Noisevol
  191.  move.w G_SoundEffect(a6),Samplenum
  192.  move.b #2,chanpick
  193.  clr.b notifplaying
  194.  movem.l d0/a0/d5/d6/d7/a6/a4/a5,-(a7)
  195.  move.b #$fb,IDNUM
  196.  jsr MakeSomeNoise
  197.  movem.l (a7)+,d0/a0/d5/d6/d7/a6/a4/a5
  198.  
  199.  tst.w d0
  200.  blt nothingtoshoot
  201.  
  202.  tst.l B_Gravity(a5)
  203.  beq.s .notuseaim
  204.  move.w PLR1_AIMSPD,d2
  205.  move.w #8,d1
  206.  sub.w BulletSpd,d1
  207.  asr.w d1,d2
  208.  move.w d2,bulyspd
  209. .notuseaim
  210.  
  211.  tst.w B_VisibleOrInstant+2(a5)
  212.  beq PLR1FIREBULLET
  213.  
  214. ; instant effect: check for hitting:
  215.  
  216.  move.w G_BulletsPerShot(a6),d7
  217.  
  218. FIREBULLETS:
  219.  
  220.  movem.l a0/a1/d7/d0/a4/a5,-(a7)
  221.  jsr GetRand
  222.  
  223.  move.l ObjectPoints,a1
  224.  move.w (a4),d1
  225.  lea (a1,d1.w*8),a1
  226.  
  227.  and.w #$7fff,d0
  228.  move.w (a1),d1
  229.  sub.w PLR1_xoff,d1
  230.  muls d1,d1
  231.  move.w 4(a1),d2
  232.  sub.w PLR1_zoff,d2
  233.  muls d2,d2
  234.  add.l d2,d1
  235.  asr.l #6,d1
  236.  ext.l d0
  237.  asl.l #1,d0
  238.  cmp.l d1,d0
  239.  bgt.s .hitplr
  240.  
  241.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  242.  move.l d0,-(a7)
  243.  bsr PLR1MISSINSTANT
  244.  move.l (a7)+,d0
  245.  
  246.  bra.s .missplr
  247. .hitplr: 
  248.  
  249.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  250.  move.l d0,-(a7)
  251.  bsr PLR1HITINSTANT
  252.  move.l (a7)+,d0
  253.  
  254. .missplr:
  255.  
  256.  subq #1,d7
  257.  bgt.s FIREBULLETS
  258.  
  259.  rts
  260.  
  261. PLR1_AIMSPD: dc.l 0
  262.  
  263. nothingtoshoot:
  264.  move.w PLR1_AIMSPD,d0
  265.  move.w #8,d1
  266.  sub.w BulletSpd,d1
  267.  asr.w d1,d0
  268.  move.w d0,bulyspd
  269.  tst.w B_VisibleOrInstant+2(a5)
  270.  beq PLR1FIREBULLET
  271.  
  272.  move.w #0,bulyspd
  273.  
  274.  move.w PLR1_xoff,oldx
  275.  move.w PLR1_zoff,oldz
  276.  move.w PLR1_sinval,d0
  277.  asr.w #7,d0
  278.  add.w oldx,d0
  279.  move.w d0,newx
  280.  move.w PLR1_cosval,d0
  281.  asr.w #7,d0
  282.  add.w oldz,d0
  283.  move.w d0,newz
  284.  move.l PLR1_yoff,d0
  285.  add.l #10*128,d0
  286.  move.l d0,oldy
  287.  
  288.  move.l d0,d1
  289.  jsr GetRand
  290.  and.w #$fff,d0
  291.  sub.w #$800,d0
  292.  ext.l d0
  293.  add.l d0,d1
  294.  
  295.  move.l d1,newy
  296.  
  297.  st exitfirst
  298.  clr.b wallbounce
  299.  move.w #0,extlen
  300.  move.b #$ff,awayfromwall
  301.  move.w #%0000010000000000,wallflags
  302.  move.l #0,StepUpVal
  303.  move.l #$1000000,StepDownVal
  304.  move.l #0,thingheight
  305.  move.l PLR1_Roompt,objroom
  306.  movem.l d0-d7/a0-a6,-(a7)
  307.  
  308. .again:
  309.  jsr MoveObject
  310.  tst.b hitwall
  311.  bne.s .nofurther
  312.  move.w newx,d0
  313.  sub.w oldx,d0
  314.  add.w d0,oldx
  315.  add.w d0,newx
  316.  move.w newz,d0
  317.  sub.w oldz,d0
  318.  add.w d0,oldz
  319.  add.w d0,newz
  320.  move.l newy,d0
  321.  sub.l oldy,d0
  322.  add.l d0,oldy
  323.  add.l d0,newy
  324.  bra .again
  325.  
  326. .nofurther:
  327.  
  328.  movem.l (a7)+,d0-d7/a0-a6
  329.  
  330.  move.l PlayerShotData,a0
  331.  move.w #19,d1
  332. .findonefree2
  333.  move.w 12(a0),d2
  334.  blt.s .foundonefree2
  335.  adda.w #64,a0
  336.  dbra d1,.findonefree2
  337.  
  338.  rts
  339.  
  340. .foundonefree2:
  341.  
  342.  move.l ObjectPoints,a1
  343.  move.w (a0),d2
  344.  move.w newx,(a1,d2.w*8)
  345.  move.w newz,4(a1,d2.w*8)
  346.  move.b #1,shotstatus(a0)
  347.  move.w #0,shotgrav(a0)
  348.  move.b BULTYPE+1,shotsize(a0)
  349.  move.b #0,shotanim(a0)
  350.  
  351.  move.l objroom,a1
  352.  move.w (a1),12(a0)
  353.  st worry(a0)
  354.  move.l wallhitheight,d0
  355.  move.l d0,accypos(a0)
  356.  asr.l #7,d0
  357.  move.w d0,4(a0)
  358.  
  359.  rts
  360.  
  361. PLR1_nofire:
  362.  
  363.  rts
  364.  
  365. TESTY: dc.l 0,0,0,0
  366.  
  367. Player2Shot:
  368.  
  369.  tst.w PLR2_TimeToShoot
  370.  beq.s okcanfire2
  371.  
  372.  move.w TempFrames,d0
  373.  sub.w d0,PLR2_TimeToShoot
  374.  bge PLR2_nofire
  375.  move.w #0,PLR2_TimeToShoot
  376.  bra PLR2_nofire
  377.  
  378. okcanfire2:
  379.  
  380.  moveq #0,d0
  381.  move.b p2_gunselected,d0
  382.  move.b d0,tempgun
  383.  
  384.  
  385.  move.l LINKFILE,a6
  386.  lea GunBulletTypes(a6),a6
  387.  lea BulletAnimData-GunBulletTypes(a6),a5
  388.  lea (a6,d0.w*8),a6
  389.  move.w G_BulletType(a6),d0 ; bullet type
  390.  move.w d0,BULTYPE
  391.  move.l #PLAYERTWOAMMO,a0
  392.  move.w (a0,d0.w*2),AmmoInMyGun
  393.  
  394.  muls #B_BulStatLen,d0
  395.  add.w d0,a5
  396.  
  397.  move.w B_MovementSpeed+2(a5),BulletSpd
  398.  
  399. ; tst.w 12(a6)
  400. ; beq.s .itsaclick
  401.  
  402.  tst.b p2_fire
  403.  beq PLR2_nofire
  404. ; bra .itsahold
  405. ;
  406. ;.itsaclick:
  407. ; tst.b p2_clicked
  408. ; beq PLR2_nofire
  409. ;
  410. ;.itsahold:
  411.  
  412.  move.w PLR2_angpos,d0
  413.  move.w d0,tempangpos
  414.  move.l #SineTable,a0
  415.  lea (a0,d0.w),a0
  416.  move.w (a0),tempxdir 
  417.  move.w 2048(a0),tempzdir
  418.  move.w PLR2_xoff,tempxoff
  419.  move.w PLR2_zoff,tempzoff
  420.  move.l PLR2_yoff,tempyoff
  421.  add.l #10*128,tempyoff
  422.  move.b PLR2_StoodInTop,tempStoodInTop
  423.  move.l PLR2_Roompt,tempRoompt
  424.  move.l #%10011,d7
  425.  move.w #-1,d0
  426.  move.l #0,targetydiff
  427.  move.l #$7fff,d1
  428.  
  429.  move.l ZoneAdds,a3
  430.  
  431.  move.l #PLR2_ObsInLine,a1
  432.  move.l ObjectData,a0
  433.  move.l #PLR2_ObjDists,a2
  434. findclosestinline2
  435.  
  436.  tst.w (a0)
  437.  blt outofline2
  438.  
  439.  cmp.b #3,16(a0)
  440.  beq notlinedup2
  441.  
  442.  tst.b (a1)+
  443.  beq.s notlinedup2
  444.  btst #1,17(a0)
  445.  beq.s notlinedup2
  446.  tst.w 12(a0)
  447.  blt.s notlinedup2
  448.  move.b 16(a0),d6
  449.  btst d6,d7
  450.  beq.s notlinedup2
  451.  
  452.  tst.b numlives(a0)
  453.  beq.s notlinedup2
  454.  move.w (a0),d5
  455.  move.w (a2,d5.w*2),d6
  456.  move.w 4(a0),d2
  457.  ext.l d2
  458.  asl.l #7,d2
  459.  sub.l PLR2_yoff,d2
  460.  move.l d2,d3
  461.  bge.s .oknotneg
  462.  neg.l d2
  463. .oknotneg:
  464.  divs #44,d2
  465.  cmp.w d6,d2
  466.  bgt.s notlinedup2
  467.  
  468.  cmp.w d6,d1
  469.  blt.s notlinedup2
  470.  move.w d6,d1
  471.  move.l a0,a4
  472.  
  473. ; We have a closer enemy lined up.
  474.  move.l d3,targetydiff 
  475.  move.w d5,d0
  476.  
  477. notlinedup2:
  478.  add.w #64,a0
  479.  bra findclosestinline2
  480.  
  481. outofline2:
  482.  
  483.  
  484.  move.w d1,targdist
  485.  
  486.  move.l targetydiff,d5
  487.  sub.l PLR2_height,d5
  488.  add.l #18*256,d5
  489.  move.w d1,closedist
  490.  
  491.  move.w BulletSpd,d2
  492.  asr.w d2,d1
  493.  tst.w d1
  494.  bgt.s okdistthing2
  495.  moveq #1,d1
  496. okdistthing2
  497.  divs d1,d5
  498.  move.w d5,bulyspd
  499.  
  500.  move.w AmmoInMyGun,d2
  501.  move.w G_BulletsPerShot(a6),d1
  502.  cmp.w d1,d2
  503.  bge.s .okcanshoot
  504.  
  505.  move.l PLR2_Obj,a2
  506.  move.w (a2),d0
  507.  move.l #ObjRotated,a2
  508.  move.l (a2,d0.w*8),Noisex
  509.  move.w #300,Noisevol
  510.  move.w #100,PLAYERTWONOISEVOL
  511.  move.w #12,Samplenum
  512.  clr.b notifplaying
  513.  move.b #$fb,IDNUM
  514.  jsr MakeSomeNoise
  515.  
  516.  rts
  517.  
  518. .okcanshoot:
  519.  
  520.  cmp.b #'s',mors
  521.  bne.s .notplr2
  522.  move.l PLR1_Obj,a2
  523.  move.w #1,ObjTimer+128(a2)
  524. .notplr2:
  525.  
  526.  move.w G_DelayBetweenShots(a6),PLR2_TimeToShoot
  527.  
  528.  move.b MaxFrame,PLR2_GunFrame
  529.  sub.w d1,d2
  530.  
  531.  move.l #PLAYERTWOAMMO,a2
  532.  add.w BULTYPE,a2
  533.  add.w BULTYPE,a2
  534.  move.w d2,(a2)
  535.  
  536.  move.l PLR2_Obj,a2
  537.  move.w (a2),d2
  538.  move.l #ObjRotated,a2
  539.  move.l (a2,d2.w*8),Noisex
  540.  move.w #100,PLAYERTWONOISEVOL
  541.  move.w #300,Noisevol
  542.  move.w G_SoundEffect(a6),Samplenum
  543.  move.b #2,chanpick
  544.  clr.b notifplaying
  545.  movem.l d0/a0/d5/d6/d7/a6/a4/a5,-(a7)
  546.  move.b #$fb,IDNUM
  547.  jsr MakeSomeNoise
  548.  movem.l (a7)+,d0/a0/d5/d6/d7/a6/a4/a5
  549.  
  550.  tst.w d0
  551.  blt nothingtoshoot2
  552.  
  553.  tst.l B_Gravity(a5)
  554.  beq.s .notuseaim
  555.  move.w PLR2_AIMSPD,d2
  556.  move.w #8,d1
  557.  sub.w BulletSpd,d1
  558.  asr.w d1,d2
  559.  move.w d2,bulyspd
  560. .notuseaim
  561.  
  562.  tst.w B_VisibleOrInstant+2(a5)
  563.  beq PLR2FIREBULLET
  564.  
  565. ; instant effect: check for hitting:
  566.  
  567.  move.w G_BulletsPerShot(a6),d7
  568.  
  569. FIREBULLETS2:
  570.  
  571.  movem.l a0/a1/d7/d0/a4/a5,-(a7)
  572.  jsr GetRand
  573.  
  574.  move.l ObjectPoints,a1
  575.  move.w (a4),d1
  576.  lea (a1,d1.w*8),a1
  577.  
  578.  and.w #$7fff,d0
  579.  move.w (a1),d1
  580.  sub.w PLR2_xoff,d1
  581.  muls d1,d1
  582.  move.w 4(a1),d2
  583.  sub.w PLR2_zoff,d2
  584.  muls d2,d2
  585.  add.l d2,d1
  586.  asr.l #6,d1
  587.  ext.l d0
  588.  asl.l #1,d0
  589.  cmp.l d1,d0
  590.  bgt.s .hitplr
  591.  
  592.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  593.  move.l d0,-(a7)
  594.  bsr PLR2MISSINSTANT
  595.  move.l (a7)+,d0
  596.  
  597.  bra.s .missplr
  598. .hitplr: 
  599.  
  600.  movem.l (a7)+,a0/a1/d7/d0/a5/a4
  601.  move.l d0,-(a7)
  602.  bsr PLR2HITINSTANT
  603.  move.l (a7)+,d0
  604.  
  605. .missplr:
  606.  
  607.  subq #1,d7
  608.  bgt.s FIREBULLETS2
  609.  
  610.  rts
  611.  
  612. PLR2_AIMSPD: dc.l 0
  613.  
  614. nothingtoshoot2:
  615.  move.w PLR2_AIMSPD,d0
  616.  move.w #8,d1
  617.  sub.w BulletSpd,d1
  618.  asr.w d1,d0
  619.  move.w d0,bulyspd
  620.  tst.w B_VisibleOrInstant+2(a5)
  621.  beq PLR2FIREBULLET
  622.  
  623.  move.w #0,bulyspd
  624.  
  625.  move.w PLR2_xoff,oldx
  626.  move.w PLR2_zoff,oldz
  627.  move.w PLR2_sinval,d0
  628.  asr.w #7,d0
  629.  add.w oldx,d0
  630.  move.w d0,newx
  631.  move.w PLR2_cosval,d0
  632.  asr.w #7,d0
  633.  add.w oldz,d0
  634.  move.w d0,newz
  635.  move.l PLR2_yoff,d0
  636.  add.l #10*128,d0
  637.  move.l d0,oldy
  638.  
  639.  move.l d0,d1
  640.  jsr GetRand
  641.  and.w #$fff,d0
  642.  sub.w #$800,d0
  643.  ext.l d0
  644.  add.l d0,d1
  645.  
  646.  move.l d1,newy
  647.  
  648.  st exitfirst
  649.  clr.b wallbounce
  650.  move.w #0,extlen
  651.  move.b #$ff,awayfromwall
  652.  move.w #%0000010000000000,wallflags
  653.  move.l #0,StepUpVal
  654.  move.l #$1000000,StepDownVal
  655.  move.l #0,thingheight
  656.  move.l PLR2_Roompt,objroom
  657.  movem.l d0-d7/a0-a6,-(a7)
  658.  
  659. .again:
  660.  jsr MoveObject
  661.  tst.b hitwall
  662.  bne.s .nofurther
  663.  move.w newx,d0
  664.  sub.w oldx,d0
  665.  add.w d0,oldx
  666.  add.w d0,newx
  667.  move.w newz,d0
  668.  sub.w oldz,d0
  669.  add.w d0,oldz
  670.  add.w d0,newz
  671.  move.l newy,d0
  672.  sub.l oldy,d0
  673.  add.l d0,oldy
  674.  add.l d0,newy
  675.  bra .again
  676.  
  677. .nofurther:
  678.  
  679.  movem.l (a7)+,d0-d7/a0-a6
  680.  
  681.  move.l PlayerShotData,a0
  682.  move.w #19,d1
  683. .findonefree2
  684.  move.w 12(a0),d2
  685.  blt.s .foundonefree2
  686.  adda.w #64,a0
  687.  dbra d1,.findonefree2
  688.  
  689.  rts
  690.  
  691. .foundonefree2:
  692.  
  693.  move.l ObjectPoints,a1
  694.  move.w (a0),d2
  695.  move.w newx,(a1,d2.w*8)
  696.  move.w newz,4(a1,d2.w*8)
  697.  move.b #1,shotstatus(a0)
  698.  move.w #0,shotgrav(a0)
  699.  move.b BULTYPE+1,shotsize(a0)
  700.  move.b #0,shotanim(a0)
  701.  
  702.  move.l objroom,a1
  703.  move.w (a1),12(a0)
  704.  st worry(a0)
  705.  move.l wallhitheight,d0
  706.  move.l d0,accypos(a0)
  707.  asr.l #7,d0
  708.  move.w d0,4(a0)
  709.  
  710.  rts
  711.  
  712. PLR2_nofire:
  713.  
  714.  rts
  715.  
  716.  
  717. BulletSpd: dc.w 0
  718.  
  719. *******************************************************
  720.  
  721. tempyoff: dc.l 0
  722. tempStoodInTop: dc.w 0
  723. tempxdir: dc.w 0
  724. tempzdir: dc.w 0
  725. tempgun: dc.w 0
  726. tstfire: dc.w 0
  727. PLR1FIREBULLET:
  728.  
  729.  move.l #%100011,d7
  730.  
  731.  move.b MaxFrame,PLR1_GunFrame
  732.  move.l PLR1_Obj,a2
  733.  move.w G_BulletsPerShot(a6),d5
  734.  
  735.  move.w d5,d6
  736.  subq #1,d6
  737.  muls #128,d6
  738.  neg.w d6
  739.  add.w tempangpos,d6
  740.  and.w #8190,d6
  741.  
  742.  bra firefive
  743.  
  744. PLR2FIREBULLET:
  745.  move.l #%10011,d7
  746.  
  747.  move.b MaxFrame,PLR2_GunFrame
  748.  move.l PLR2_Obj,a2
  749.  move.w G_BulletsPerShot(a6),d5
  750.  
  751.  move.w d5,d6
  752.  subq #1,d6
  753.  muls #128,d6
  754.  neg.w d6
  755.  add.w tempangpos,d6
  756.  and.w #8190,d6
  757.  
  758. firefive:
  759.  
  760.  move.l PlayerShotData,a0
  761.  move.w #19,d1
  762. .findonefree
  763.  move.w 12(a0),d0
  764.  blt.s .foundonefree
  765.  adda.w #64,a0
  766.  dbra d1,.findonefree
  767.  
  768.  rts
  769.  
  770. .foundonefree
  771.  move.w B_Gravity+2(a5),shotgrav(a0)
  772.  move.b B_BounceOffWalls+3(a5),shotflags(a0)
  773.  move.b B_BounceOffFloors+3(a5),shotflags+1(a0)
  774.  
  775.  move.w bulyspd,d0
  776.  
  777.  cmp.w #20*128,d0
  778.  blt.s .okdownspd
  779.  move.w #20*128,d0
  780. .okdownspd:
  781.  
  782.  cmp.w #-20*128,d0
  783.  bgt.s .okupspd
  784.  move.w #-20*128,d0
  785. .okupspd:
  786.  
  787. ; add.w G_InitialYVel(a6),d0
  788.  
  789.  move.w d0,bulyspd
  790.  
  791.  move.l #ObjRotated,a2
  792.  move.b BULTYPE+1,shotsize(a0)
  793.  move.b B_DamageToTarget+3(a5),shotpower(a0)
  794.  
  795.  move.l ObjectPoints,a1
  796.  move.w (a0),d1
  797.  lea (a1,d1.w*8),a1
  798.  move.w tempxoff,(a1)
  799.  move.w tempzoff,4(a1)
  800.  
  801.  move.l #SineTable,a1
  802.  move.w (a1,d6.w),d0
  803.  ext.l d0
  804.  add.w #2048,a1
  805.  move.w (a1,d6.w),d2
  806.  ext.l d2
  807.  
  808.  add.w #256,d6
  809.  and.w #8190,d6
  810.  
  811.  move.w BulletSpd,d1
  812.  asl.l d1,d0
  813.  move.l d0,shotxvel(a0)
  814.  ext.l d2
  815.  asl.l d1,d2
  816.  move.b #2,16(a0)
  817.  move.l d2,shotzvel(a0)
  818.  move.w bulyspd,shotyvel(a0)
  819.  move.b tempStoodInTop,ObjInTop(a0)
  820.  move.w #0,shotlife(a0)
  821.  move.l d7,EnemyFlags(a0)
  822.  move.l tempRoompt,a2
  823.  move.w (a2),12(a0)
  824.  move.l tempyoff,d0
  825.  add.l #20*128,d0
  826.  move.l d0,accypos(a0)
  827.  st worry(a0)
  828.  asr.l #7,d0
  829.  move.w d0,4(a0)
  830.  
  831.  sub.w #1,d5
  832.  bgt firefive
  833.  
  834.  rts
  835.  
  836. PLR1HITINSTANT:
  837.  
  838. ; Just blow it up.
  839.  
  840.  move.l PlayerShotData,a0
  841.  move.w #19,d1
  842. .findonefree
  843.  move.w 12(a0),d2
  844.  blt.s .foundonefree
  845.  adda.w #64,a0
  846.  dbra d1,.findonefree
  847.  
  848.  rts
  849.  
  850. .foundonefree:
  851.  
  852.  move.b #2,16(a0)
  853.  move.l ObjectPoints,a1
  854.  move.w (a0),d2
  855.  move.l (a1,d0.w*8),(a1,d2.w*8)
  856.  move.l 4(a1,d0.w*8),4(a1,d2.w*8)
  857.  move.b #1,shotstatus(a0)
  858.  move.w #0,shotgrav(a0)
  859.  move.b BULTYPE+1,shotsize(a0)
  860.  move.b #0,shotanim(a0)
  861.  
  862.  move.w 4(a4),d1
  863.  ext.l d1
  864.  asl.l #7,d1
  865.  move.l d1,accypos(a0)
  866.  move.w 12(a4),12(a0)
  867.  st worry(a0)
  868.  move.w 4(a4),4(a0)
  869.  
  870.  move.w B_DamageToTarget+2(a5),d0
  871.  add.b d0,damagetaken(a4)
  872.  
  873.  move.w tempxdir,d1
  874.  ext.l d1
  875.  asl.l #3,d1
  876.  swap d1
  877.  move.w d1,ImpactX(a4)
  878.  move.w tempzdir,d1
  879.  ext.l d1
  880.  asl.l #3,d1
  881.  swap d1
  882.  move.w d1,ImpactZ(a4)
  883.  
  884.  rts
  885.  
  886. PLR1MISSINSTANT: 
  887.  
  888.  move.w PLR1_xoff,oldx
  889.  move.w PLR1_zoff,oldz
  890.  move.l PLR1_yoff,d1
  891.  add.l #10*128,d1
  892.  move.l d1,oldy
  893.  
  894.  move.w (a4),d0
  895.  move.l ObjectPoints,a1
  896.  move.w (a1,d0.w*8),d2
  897.  sub.w oldx,d2
  898.  asr.w #1,d2
  899.  add.w oldx,d2
  900.  move.w d2,newx
  901.  move.w 4(a1,d0.w*8),d2
  902.  sub.w oldz,d2
  903.  asr.w #1,d2
  904.  add.w oldz,d2
  905.  move.w d2,newz
  906.  
  907.  move.w 4(a0),d2
  908.  ext.l d2
  909.  asl.l #7,d2
  910.  move.l d2,newy
  911.  
  912.  st exitfirst
  913.  clr.b wallbounce
  914.  move.w #0,extlen
  915.  move.b #$ff,awayfromwall
  916.  move.w #%0000010000000000,wallflags
  917.  move.l #0,StepUpVal
  918.  move.l #$1000000,StepDownVal
  919.  move.l #0,thingheight
  920.  move.l PLR1_Roompt,objroom
  921.  movem.l d0-d7/a0-a6,-(a7)
  922.  
  923. .again:
  924.  jsr MoveObject
  925.  tst.b hitwall
  926.  bne.s .nofurther
  927.  move.w newx,d1
  928.  sub.w oldx,d1
  929.  add.w d1,oldx
  930.  add.w d1,newx
  931.  move.w newz,d1
  932.  sub.w oldz,d1
  933.  add.w d1,oldz
  934.  add.w d1,newz
  935.  move.l newy,d1
  936.  sub.l oldy,d1
  937.  add.l d1,oldy
  938.  add.l d1,newy
  939.  bra .again
  940.  
  941. .nofurther:
  942.  
  943.  movem.l (a7)+,d0-d7/a0-a6
  944.  
  945.  move.l PlayerShotData,a0
  946.  move.w #19,d1
  947. .findonefree2
  948.  move.w 12(a0),d2
  949.  blt.s .foundonefree2
  950.  adda.w #64,a0
  951.  dbra d1,.findonefree2
  952.  
  953.  rts
  954.  
  955. .foundonefree2:
  956.  
  957.  move.b #2,16(a0)
  958.  move.l ObjectPoints,a1
  959.  move.w (a0),d2
  960.  move.w newx,(a1,d2.w*8)
  961.  move.w newz,4(a1,d2.w*8)
  962.  move.b #1,shotstatus(a0)
  963.  move.w #0,shotgrav(a0)
  964.  move.b BULTYPE+1,shotsize(a0)
  965.  move.b #0,shotanim(a0)
  966.  
  967.  move.l objroom,a1
  968.  move.w (a1),12(a0)
  969.  st worry(a0)
  970.  move.l newy,d1
  971.  move.l d1,accypos(a0)
  972.  asr.l #7,d1
  973.  move.w d1,4(a0)
  974.  
  975.  rts
  976.  
  977.  
  978. PLR2HITINSTANT:
  979.  
  980. ; Just blow it up.
  981.  
  982.  move.l PlayerShotData,a0
  983.  move.w #19,d1
  984. .findonefree
  985.  move.w 12(a0),d2
  986.  blt.s .foundonefree
  987.  adda.w #64,a0
  988.  dbra d1,.findonefree
  989.  
  990.  rts
  991.  
  992. .foundonefree:
  993.  
  994.  move.b #2,16(a0)
  995.  move.l ObjectPoints,a1
  996.  move.w (a0),d2
  997.  move.l (a1,d0.w*8),(a1,d2.w*8)
  998.  move.l 4(a1,d0.w*8),4(a1,d2.w*8)
  999.  move.b #1,shotstatus(a0)
  1000.  move.w #0,shotgrav(a0)
  1001.  move.b BULTYPE+1,shotsize(a0)
  1002.  move.b #0,shotanim(a0)
  1003.  
  1004.  move.w 4(a4),d1
  1005.  ext.l d1
  1006.  asl.l #7,d1
  1007.  move.l d1,accypos(a0)
  1008.  move.w 12(a4),12(a0)
  1009.  st worry(a0)
  1010.  move.w 4(a4),4(a0)
  1011.  
  1012.  move.w B_DamageToTarget+2(a5),d0
  1013.  add.b d0,damagetaken(a4)
  1014.  
  1015.  move.w tempxdir,d1
  1016.  ext.l d1
  1017.  asl.l #3,d1
  1018.  swap d1
  1019.  move.w d1,ImpactX(a4)
  1020.  move.w tempzdir,d1
  1021.  ext.l d1
  1022.  asl.l #3,d1
  1023.  swap d1
  1024.  move.w d1,ImpactZ(a4)
  1025.  
  1026.  rts
  1027.  
  1028. PLR2MISSINSTANT: 
  1029.  
  1030.  move.w PLR2_xoff,oldx
  1031.  move.w PLR2_zoff,oldz
  1032.  move.l PLR2_yoff,d1
  1033.  add.l #10*128,d1
  1034.  move.l d1,oldy
  1035.  
  1036.  move.w (a4),d0
  1037.  move.l ObjectPoints,a1
  1038.  move.w (a1,d0.w*8),d2
  1039.  sub.w oldx,d2
  1040.  asr.w #1,d2
  1041.  add.w oldx,d2
  1042.  move.w d2,newx
  1043.  move.w 4(a1,d0.w*8),d2
  1044.  sub.w oldz,d2
  1045.  asr.w #1,d2
  1046.  add.w oldz,d2
  1047.  move.w d2,newz
  1048.  
  1049.  move.w 4(a0),d2
  1050.  ext.l d2
  1051.  asl.l #7,d2
  1052.  move.l d2,newy
  1053.  
  1054.  st exitfirst
  1055.  clr.b wallbounce
  1056.  move.w #0,extlen
  1057.  move.b #$ff,awayfromwall
  1058.  move.w #%0000010000000000,wallflags
  1059.  move.l #0,StepUpVal
  1060.  move.l #$1000000,StepDownVal
  1061.  move.l #0,thingheight
  1062.  move.l PLR2_Roompt,objroom
  1063.  movem.l d0-d7/a0-a6,-(a7)
  1064.  
  1065. .again:
  1066.  jsr MoveObject
  1067.  tst.b hitwall
  1068.  bne.s .nofurther
  1069.  move.w newx,d1
  1070.  sub.w oldx,d1
  1071.  add.w d1,oldx
  1072.  add.w d1,newx
  1073.  move.w newz,d1
  1074.  sub.w oldz,d1
  1075.  add.w d1,oldz
  1076.  add.w d1,newz
  1077.  move.l newy,d1
  1078.  sub.l oldy,d1
  1079.  add.l d1,oldy
  1080.  add.l d1,newy
  1081.  bra .again
  1082.  
  1083. .nofurther:
  1084.  
  1085.  movem.l (a7)+,d0-d7/a0-a6
  1086.  
  1087.  move.l PlayerShotData,a0
  1088.  move.w #19,d1
  1089. .findonefree2
  1090.  move.w 12(a0),d2
  1091.  blt.s .foundonefree2
  1092.  adda.w #64,a0
  1093.  dbra d1,.findonefree2
  1094.  
  1095.  rts
  1096.  
  1097. .foundonefree2:
  1098.  
  1099.  move.b #2,16(a0)
  1100.  move.l ObjectPoints,a1
  1101.  move.w (a0),d2
  1102.  move.w newx,(a1,d2.w*8)
  1103.  move.w newz,4(a1,d2.w*8)
  1104.  move.b #1,shotstatus(a0)
  1105.  move.w #0,shotgrav(a0)
  1106.  move.b BULTYPE+1,shotsize(a0)
  1107.  move.b #0,shotanim(a0)
  1108.  
  1109.  move.l objroom,a1
  1110.  move.w (a1),12(a0)
  1111.  st worry(a0)
  1112.  move.l newy,d1
  1113.  move.l d1,accypos(a0)
  1114.  asr.l #7,d1
  1115.  move.w d1,4(a0)
  1116.  
  1117.  rts
  1118.