Prev: C6C2 Up: Map Next: C78F
C6D2: Draw Main Flame
Used by the routines at UpdateCrystalStack, DrawShipTop and ExplodeShip.
Does nothing unless part 05 has been fitted. Draws the flame under the ship, from the object at MainFlameObject: a larger one (type 11) when going up and a smaller one (type 12) when not. This is a best reading of the code.
DrawMainFlame C6D2 LD A,($F5F2) The fifth part flag.
C6D5 AND A Return if A is zero.
C6D6 RET Z
C6D7 LD IX,$C78F The main flame object.
C6DB LD HL,$0000 HL=00.
C6DE LD ($5C1C),HL No saved row count.
C6E1 LD ($A289),HL Update the row offsets.
C6E4 BIT 7,(IX+$03) Jump to DrawMainFlame_Update if bit 7 of offset 03 of IX is clear.
C6E8 JR Z,DrawMainFlame_Update
C6EA CALL FetchSpriteType Call FetchSpriteType.
C6ED LD ($5C1C),A The flame sprite's width.
C6F0 LD HL,($C790) Fetch the word at C790 into HL.
C6F3 LD IY,$A635 The third aligned-row erase.
C6F7 BIT 6,(IX+$03) Jump to DrawMainFlame_Update if bit 6 of offset 03 of IX is clear.
C6FB JR Z,DrawMainFlame_Update
C6FD LD IY,$A7B4 The third mirrored-row erase.
C701 LD B,$F9 B=F9.
DrawMainFlame_Update C703 RES 7,(IX+$03) Reset bit 7 of offset 03 of IX.
C707 EXX Switch to the alternate registers.
C708 LD A,($C6D0) The ship has landed.
C70B AND A Jump to DrawMainFlame_Draw if A is not zero.
C70C JR NZ,DrawMainFlame_Draw
C70E LD (IX+$00),$12 Store 12 at offset 00 of IX.
C712 LD A,($8F53) The ship state.
C715 CP $0A Jump to DrawMainFlame_Draw if A is 0A or more.
C717 JR NC,DrawMainFlame_Draw
C719 LD A,($5C37) The controls.
C71C AND %00001000 Keep the bits of A that are set in 08.
C71E JR Z,DrawMainFlame_Frame Jump to DrawMainFlame_Frame if the zero flag is set.
C720 LD (IX+$00),$11 Store 11 at offset 00 of IX.
DrawMainFlame_Frame C724 CALL FetchSpriteType Call FetchSpriteType.
C727 LD ($5C1D),A The flame sprite's width.
C72A LD A,(IX+$03) Read offset 03 of IX.
C72D XOR %01000000 Flip the bits of A that are set in 40.
C72F OR %10000000 Set the bits of A that are set in 80.
C731 LD (IX+$03),A Write A to offset 03 of IX.
C734 LD A,($96AB) The crystal-delivery flag.
C737 AND A Jump to DrawMainFlame_Position if A is zero.
C738 JR Z,DrawMainFlame_Position
C73A LD A,($96B2) The row of the crystal stack.
C73D ADD A,$13 Add 13 to A.
C73F LD H,A H=A.
C740 LD (IX+$00),$11 Store 11 at offset 00 of IX.
C744 JR DrawMainFlame_Side Jump to DrawMainFlame_Side.
DrawMainFlame_Position C746 LD A,($5C38) The ship row.
C749 ADD A,$1D Add 1D to A.
C74B LD H,A H=A.
C74C LD A,(IX+$00) Read offset 00 of IX.
C74F CP $11 Jump to DrawMainFlame_Side if A is 11.
C751 JR Z,DrawMainFlame_Side
C753 LD A,H A=H.
C754 SUB $08 Subtract 08 from A.
C756 LD H,A H=A.
DrawMainFlame_Side C757 LD L,$68 L=68.
C759 BIT 6,(IX+$03) Test bit 6 of offset 03 of IX.
C75D LD IX,$A682 The third aligned-row draw.
C761 JR Z,DrawMainFlame_Store Jump to DrawMainFlame_Store if the zero flag is set.
C763 LD IX,$A7E4 The third mirrored-row draw.
C767 LD B,$F9 B=F9.
C769 LD L,$80 L=80.
DrawMainFlame_Store C76B LD ($C793),HL The position of the main flame.
C76E CALL GetScreenAddress Call GetScreenAddress.
C771 LD ($C790),HL The screen address of the main flame.
DrawMainFlame_Draw C774 CALL DrawSpritesDirectly Call DrawSpritesDirectly.
C777 XOR A Clear A.
C778 LD ($C6D0),A The ship is no longer on the ground.
C77B LD A,($C792) The main flame faces left.
C77E AND %10000000 Keep the bits of A that are set in 80.
C780 RET Z Return if the zero flag is set.
C781 LD HL,($C793) Fetch the word at C793 into HL.
C784 LD A,H A=H.
C785 SUB $07 Subtract 07 from A.
C787 LD H,A H=A.
C788 LD L,$70 L=70.
C78A LD A,$07 A=07.
C78C JP SetFlameAttributes Jump to SetFlameAttributes.
Prev: C6C2 Up: Map Next: C78F