Prev: C1AC Up: Map Next: C279
C1CE: Check Item Delivery
Used by the routines at UpdateCrystalStack, RunFrame and ExplodeShip.
Does nothing unless the flag at F5F7 is set, which happens when item number 09 has been picked up. Once the ship is at the bottom of zone 0B, 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 C1CE LD A,($F5F7) The flag set when item 09 has been picked up.
C1D1 AND A Return if A is zero.
C1D2 RET Z
C1D3 LD A,($C8E9) The ship's map zone.
C1D6 CP $0B Jump to CheckItemDelivery_Pieces if A is not 0B.
C1D8 JP NZ,CheckItemDelivery_Pieces
C1DB LD A,($C8EA) The ship's vertical position.
C1DE CP $A7 Jump to CheckItemDelivery_Pieces if A is less than A7.
C1E0 JP C,CheckItemDelivery_Pieces
C1E3 LD A,($C279) The facing kept for the pieces.
C1E6 OR %01000000 Set the bits of A that are set in 40.
C1E8 LD ($C279),A A piece is being delivered.
C1EB XOR A Clear A.
C1EC LD ($F5F7),A Update the flag set when item 09 has been picked up.
C1EF LD ($C904),A Update the item the ship is about to pick up.
C1F2 LD A,($C8E9) The ship's map zone.
C1F5 LD D,A D=A.
C1F6 LD A,($C8E6) The ship's map column.
C1F9 LD E,A E=A.
C1FA LD ($F628),DE The tenth item site.
C1FE LD ($F62C),DE The eleventh item site.
C202 LD A,($5C38) The ship row.
C205 SUB $0D Subtract 0D from A.
C207 LD B,A B=A.
C208 LD A,($C903) The row the ship was drawn on.
C20B SUB B Subtract B from A.
C20C LD B,A B=A.
C20D LD A,($C8EA) The ship's vertical position.
C210 SUB B Subtract B from A.
C211 LD H,A H=A.
C212 LD A,($C8E7) The ship's horizontal position.
C215 ADD A,$08 Add 08 to A.
C217 AND %11111000 Keep the bits of A that are set in F8.
C219 LD L,A L=A.
C21A LD ($F62A),HL The position of the tenth item site.
C21D LD A,L A=L.
C21E ADD A,$10 Add 10 to A.
C220 LD L,A L=A.
C221 LD A,H A=H.
C222 SUB $23 Subtract 23 from A.
C224 LD H,A H=A.
C225 LD ($F62E),HL The position of the eleventh item site.
C228 LD HL,$F628 The tenth item site.
C22B LD IX,$A873 The fifth map-object slot.
C22F LD B,$09 B=09.
C231 CALL CreatePiece Call CreatePiece.
C234 LD IX,$A88D The sixth map-object slot.
C238 LD HL,$F62C The eleventh item site.
C23B LD B,$0A B=0A.
C23D CALL CreatePiece Call CreatePiece.
CheckItemDelivery_Pieces C240 LD IX,$C27B The first piece beside the ship.
C244 LD DE,$7438 The picture of type 0C frame 09.
C247 LD HL,$0505 HL=0505.
C24A LD ($5C28),HL The first piece is five bytes wide.
C24D LD HL,$2300 HL=2300.
C250 LD ($5C1C),HL No rows saved, and the piece is 23 pixels high.
C253 CALL DrawPiece Call DrawPiece.
C256 LD IX,$C27D The second piece beside the ship.
C25A LD DE,$74E9 The picture of type 0C frame 0A.
C25D LD HL,$0303 HL=0303.
C260 LD ($5C28),HL The second piece is three bytes wide.
C263 LD HL,$2F00 HL=2F00.
C266 LD ($5C1C),HL No rows saved, and the piece is 2F pixels high.
C269 CALL DrawPiece Call DrawPiece.
C26C LD A,($C8FD) The ship's facing.
C26F LD ($C279),A The facing the pieces were drawn with.
C272 XOR A Clear A.
C273 LD ($C27A),A No piece has been drawn yet.
C276 JP SetPairAttributes Jump to SetPairAttributes.
Prev: C1AC Up: Map Next: C279