Prev: 50882 Up: Map Next: 51087
50898: Draw Main Flame
Used by the routines at UpdateCrystalStack, DrawShipTop and ExplodeShip.
Does nothing unless part 5 has been fitted. Draws the flame under the ship, from the object at MainFlameObject: a larger one (type 17) when going up and a smaller one (type 18) when not. This is a best reading of the code.
DrawMainFlame 50898 LD A,(62962) The fifth part flag.
50901 AND A Return if A is zero.
50902 RET Z
50903 LD IX,51087 The main flame object.
50907 LD HL,0 HL=0.
50910 LD (23580),HL No saved row count.
50913 LD (41609),HL Update the row offsets.
50916 BIT 7,(IX+3) Jump to DrawMainFlame_Update if bit 7 of offset 3 of IX is clear.
50920 JR Z,DrawMainFlame_Update
50922 CALL FetchSpriteType Call FetchSpriteType.
50925 LD (23580),A The flame sprite's width.
50928 LD HL,(51088) Fetch the word at 51088 into HL.
50931 LD IY,42549 The third aligned-row erase.
50935 BIT 6,(IX+3) Jump to DrawMainFlame_Update if bit 6 of offset 3 of IX is clear.
50939 JR Z,DrawMainFlame_Update
50941 LD IY,42932 The third mirrored-row erase.
50945 LD B,249 B=249.
DrawMainFlame_Update 50947 RES 7,(IX+3) Reset bit 7 of offset 3 of IX.
50951 EXX Switch to the alternate registers.
50952 LD A,(50896) The ship has landed.
50955 AND A Jump to DrawMainFlame_Draw if A is not zero.
50956 JR NZ,DrawMainFlame_Draw
50958 LD (IX+0),18 Store 18 at offset 0 of IX.
50962 LD A,(36691) The ship state.
50965 CP 10 Jump to DrawMainFlame_Draw if A is 10 or more.
50967 JR NC,DrawMainFlame_Draw
50969 LD A,(23607) The controls.
50972 AND %00001000 Keep the bits of A that are set in 8.
50974 JR Z,DrawMainFlame_Frame Jump to DrawMainFlame_Frame if the zero flag is set.
50976 LD (IX+0),17 Store 17 at offset 0 of IX.
DrawMainFlame_Frame 50980 CALL FetchSpriteType Call FetchSpriteType.
50983 LD (23581),A The flame sprite's width.
50986 LD A,(IX+3) Read offset 3 of IX.
50989 XOR %01000000 Flip the bits of A that are set in 64.
50991 OR %10000000 Set the bits of A that are set in 128.
50993 LD (IX+3),A Write A to offset 3 of IX.
50996 LD A,(38571) The crystal-delivery flag.
50999 AND A Jump to DrawMainFlame_Position if A is zero.
51000 JR Z,DrawMainFlame_Position
51002 LD A,(38578) The row of the crystal stack.
51005 ADD A,19 Add 19 to A.
51007 LD H,A H=A.
51008 LD (IX+0),17 Store 17 at offset 0 of IX.
51012 JR DrawMainFlame_Side Jump to DrawMainFlame_Side.
DrawMainFlame_Position 51014 LD A,(23608) The ship row.
51017 ADD A,29 Add 29 to A.
51019 LD H,A H=A.
51020 LD A,(IX+0) Read offset 0 of IX.
51023 CP 17 Jump to DrawMainFlame_Side if A is 17.
51025 JR Z,DrawMainFlame_Side
51027 LD A,H A=H.
51028 SUB 8 Subtract 8 from A.
51030 LD H,A H=A.
DrawMainFlame_Side 51031 LD L,104 L=104.
51033 BIT 6,(IX+3) Test bit 6 of offset 3 of IX.
51037 LD IX,42626 The third aligned-row draw.
51041 JR Z,DrawMainFlame_Store Jump to DrawMainFlame_Store if the zero flag is set.
51043 LD IX,42980 The third mirrored-row draw.
51047 LD B,249 B=249.
51049 LD L,128 L=128.
DrawMainFlame_Store 51051 LD (51091),HL The position of the main flame.
51054 CALL GetScreenAddress Call GetScreenAddress.
51057 LD (51088),HL The screen address of the main flame.
DrawMainFlame_Draw 51060 CALL DrawSpritesDirectly Call DrawSpritesDirectly.
51063 XOR A Clear A.
51064 LD (50896),A The ship is no longer on the ground.
51067 LD A,(51090) The main flame faces left.
51070 AND %10000000 Keep the bits of A that are set in 128.
51072 RET Z Return if the zero flag is set.
51073 LD HL,(51091) Fetch the word at 51091 into HL.
51076 LD A,H A=H.
51077 SUB 7 Subtract 7 from A.
51079 LD H,A H=A.
51080 LD L,112 L=112.
51082 LD A,7 A=7.
51084 JP SetFlameAttributes Jump to SetFlameAttributes.
Prev: 50882 Up: Map Next: 51087