Prev: C4ED Up: Map Next: C6C2
C5FF: Draw Side Flames
Used by the routines at CheckPauseAndSilence and DrawShipTop.
Does nothing unless part 04 has been fitted. Draws the flame at the side of the ship when it is moving to the left or to the right, from the object at SideFlameObject, and sets its attribute with SetFlameAttributes. This is a best reading of the code.
DrawSideFlames C5FF LD A,($F5F1) The fourth part flag.
C602 AND A Return if A is zero.
C603 RET Z
C604 LD IX,$C6C2 The side flame object.
C608 LD HL,$0000 HL=00.
C60B LD ($5C1C),HL No saved row count.
C60E BIT 7,(IX+$03) Jump to DrawSideFlames_Flame if bit 7 of offset 03 of IX is set.
C612 JR NZ,DrawSideFlames_Flame
C614 LD A,($5C37) The controls.
C617 AND %00000011 Keep the bits of A that are set in 03.
C619 RET Z Return if the zero flag is set.
C61A JR DrawSideFlames_Update Jump to DrawSideFlames_Update.
DrawSideFlames_Flame C61C CALL FetchSpriteType Call FetchSpriteType.
C61F LD ($5C1C),A The flame sprite's width.
C622 LD HL,($C6C3) Fetch the word at C6C3 into HL.
C625 LD IY,$A641 The fifth aligned-row erase.
C629 BIT 6,(IX+$03) Jump to DrawSideFlames_Update if bit 6 of offset 03 of IX is clear.
C62D JR Z,DrawSideFlames_Update
C62F LD IY,$A7C4 The fifth mirrored-row erase.
C633 LD B,$F9 B=F9.
DrawSideFlames_Update C635 EXX Switch to the alternate registers.
C636 LD (IX+$03),$00 Store 00 at offset 03 of IX.
C63A LD A,($5C37) The controls.
C63D AND %00000011 Keep the bits of A that are set in 03.
C63F JP Z,DrawSideFlames_Draw Jump to DrawSideFlames_Draw if the zero flag is set.
C642 LD A,($8F53) The ship state.
C645 CP $0A Jump to DrawSideFlames_Draw if A is 0A or more.
C647 JR NC,DrawSideFlames_Draw
C649 LD A,(IX+$06) Read offset 06 of IX.
C64C INC A Advance A.
C64D AND %00000111 Keep the bits of A that are set in 07.
C64F LD (IX+$06),A Write A to offset 06 of IX.
C652 LD HL,$C7A9 The flame frames.
C655 CALL AddAToHL Call AddAToHL.
C658 LD A,(HL) Read HL.
C659 ADD A,$0E Add 0E to A.
C65B LD (IX+$00),A Write A to offset 00 of IX.
C65E CALL FetchSpriteType Call FetchSpriteType.
C661 LD ($5C1D),A The flame sprite's width.
C664 LD (IX+$03),$80 Store 80 at offset 03 of IX.
C668 LD IX,$A68C The fifth aligned-row draw.
C66C LD A,($5C38) The ship row.
C66F ADD A,$08 Add 08 to A.
C671 LD H,A H=A.
C672 LD L,$50 L=50.
C674 LD A,($5C37) The controls.
C677 BIT 1,A Jump to DrawSideFlames_Draw2 if bit 1 of A is clear.
C679 JR Z,DrawSideFlames_Draw2
C67B LD L,$98 L=98.
C67D LD B,$F9 B=F9.
C67F LD A,$C0 A=C0.
C681 LD ($C6C5),A The side flame faces left.
C684 LD IX,$A7F2 The fifth mirrored-row draw.
DrawSideFlames_Draw2 C688 LD ($C6C6),HL The position of the side flame.
C68B CALL GetScreenAddress Call GetScreenAddress.
C68E LD ($C6C3),HL The screen address of the side flame.
DrawSideFlames_Draw C691 CALL DrawSpritesDirectly Call DrawSpritesDirectly.
C694 LD A,($C6C5) The side flame faces left.
C697 AND %10000000 Keep the bits of A that are set in 80.
C699 RET Z Return if the zero flag is set.
C69A LD HL,($C6C6) Fetch the word at C6C6 into HL.
C69D LD A,L A=L.
C69E AND %11110000 Keep the bits of A that are set in F0.
C6A0 LD L,A L=A.
C6A1 LD A,H A=H.
C6A2 SUB $04 Subtract 04 from A.
C6A4 LD H,A H=A.
C6A5 LD A,($C6C8) The flame attribute.
This entry point is used by the routine at DrawMainFlame.
SetFlameAttributes C6A8 EX DE,HL Swap DE and HL.
C6A9 LD HL,$0202 HL=0202.
C6AC LD ($AF01),HL Update the attribute area.
C6AF LD HL,$C79B The flame attributes.
C6B2 AND %00000111 Keep the bits of A that are set in 07.
C6B4 CALL AddAToHL Call AddAToHL.
C6B7 LD A,(HL) Read HL.
C6B8 EX DE,HL Swap DE and HL.
C6B9 LD ($AF03),A The attribute of the side flame.
C6BC LD DE,$AF01 The attribute area.
C6BF JP FillAttributes Jump to FillAttributes.
Prev: C4ED Up: Map Next: C6C2