Prev: 49580 Up: Map Next: 49785
49614: Check Item Delivery
Used by the routines at UpdateCrystalStack, RunFrame and ExplodeShip.
Does nothing unless the flag at 62967 is set, which happens when item number 9 has been picked up. Once the ship is at the bottom of zone 11, the item is delivered: it is no longer carried, and two pieces are made with CreatePiece in the last two slots of the map objects. Either way, carries on to draw the two pieces that are held at PieceVariables_FirstSprite and PieceVariables_SecondSprite and to set their attributes. This is a best reading of the code.
CheckItemDelivery 49614 LD A,(62967) The flag set when item 9 has been picked up.
49617 AND A Return if A is zero.
49618 RET Z
49619 LD A,(51433) The ship's map zone.
49622 CP 11 Jump to CheckItemDelivery_Pieces if A is not 11.
49624 JP NZ,CheckItemDelivery_Pieces
49627 LD A,(51434) The ship's vertical position.
49630 CP 167 Jump to CheckItemDelivery_Pieces if A is less than 167.
49632 JP C,CheckItemDelivery_Pieces
49635 LD A,(49785) The facing kept for the pieces.
49638 OR %01000000 Set the bits of A that are set in 64.
49640 LD (49785),A A piece is being delivered.
49643 XOR A Clear A.
49644 LD (62967),A Update the flag set when item 9 has been picked up.
49647 LD (51460),A Update the item the ship is about to pick up.
49650 LD A,(51433) The ship's map zone.
49653 LD D,A D=A.
49654 LD A,(51430) The ship's map column.
49657 LD E,A E=A.
49658 LD (63016),DE The tenth item site.
49662 LD (63020),DE The eleventh item site.
49666 LD A,(23608) The ship row.
49669 SUB 13 Subtract 13 from A.
49671 LD B,A B=A.
49672 LD A,(51459) The row the ship was drawn on.
49675 SUB B Subtract B from A.
49676 LD B,A B=A.
49677 LD A,(51434) The ship's vertical position.
49680 SUB B Subtract B from A.
49681 LD H,A H=A.
49682 LD A,(51431) The ship's horizontal position.
49685 ADD A,8 Add 8 to A.
49687 AND %11111000 Keep the bits of A that are set in 248.
49689 LD L,A L=A.
49690 LD (63018),HL The position of the tenth item site.
49693 LD A,L A=L.
49694 ADD A,16 Add 16 to A.
49696 LD L,A L=A.
49697 LD A,H A=H.
49698 SUB 35 Subtract 35 from A.
49700 LD H,A H=A.
49701 LD (63022),HL The position of the eleventh item site.
49704 LD HL,63016 The tenth item site.
49707 LD IX,43123 The fifth map-object slot.
49711 LD B,9 B=9.
49713 CALL CreatePiece Call CreatePiece.
49716 LD IX,43149 The sixth map-object slot.
49720 LD HL,63020 The eleventh item site.
49723 LD B,10 B=10.
49725 CALL CreatePiece Call CreatePiece.
CheckItemDelivery_Pieces 49728 LD IX,49787 The first piece beside the ship.
49732 LD DE,29752 The picture of type 12 frame 9.
49735 LD HL,1285 HL=1285.
49738 LD (23592),HL The first piece is five bytes wide.
49741 LD HL,8960 HL=8960.
49744 LD (23580),HL No rows saved, and the piece is 35 pixels high.
49747 CALL DrawPiece Call DrawPiece.
49750 LD IX,49789 The second piece beside the ship.
49754 LD DE,29929 The picture of type 12 frame 10.
49757 LD HL,771 HL=771.
49760 LD (23592),HL The second piece is three bytes wide.
49763 LD HL,12032 HL=12032.
49766 LD (23580),HL No rows saved, and the piece is 47 pixels high.
49769 CALL DrawPiece Call DrawPiece.
49772 LD A,(51453) The ship's facing.
49775 LD (49785),A The facing the pieces were drawn with.
49778 XOR A Clear A.
49779 LD (49786),A No piece has been drawn yet.
49782 JP SetPairAttributes Jump to SetPairAttributes.
Prev: 49580 Up: Map Next: 49785