Prev: 38616 Up: Map Next: 38845
38692: Start Crystal Object
Used by the routine at RunFrame.
Purpose not yet known. Starts an object of type 30 at a fixed map position when the player is in the right place and the value at 62977 is not 255.
StartCrystalObject 38692 LD A,(62977) Fetch the value from 62977.
38695 INC A Increment it.
38696 RET Z Return if it was 255.
38697 LD A,(51433) Fetch the map zone of the player from 51433.
38700 CP 11 Is it 11 or more?
38702 RET NC Return if so.
38703 LD A,(51430) Fetch the map column of the player from 51430.
38706 CP 82 Is it 82?
38708 RET NZ Return if not.
38709 LD A,(51431) Fetch the horizontal position of the player from 51431.
38712 CP 92 Is it 92?
38714 RET NZ Return if not.
38715 LD A,(62977) Fetch the value from 62977.
38718 CP 6 Jump to StartCrystalObject_Set if it is not six.
38720 JR NZ,StartCrystalObject_Set
38722 LD A,(51461) Fetch the value from StackHeight.
38725 CP 18 Is it 18?
38727 RET NZ Return if not.
38728 LD A,8 Use 8.
StartCrystalObject_Set 38730 OR %10000000 Set bit 7.
38732 LD (51460),A Store the value in 51460.
38735 CALL FindFreeEnemySlot Find a free slot.
38738 CALL FreeObjectSlot Clear the slot.
38741 LD HL,(51456) Fetch the value from 51456.
38744 LD A,L Swap the bytes...
38745 LD L,H
38746 LD H,A
38747 CALL NegateNumber ...and negate the result.
38750 LD (IX+9),H Set the vertical speed of the object.
38753 LD (IX+10),L
38756 LD (IX+16),35 Set the flags of the object to 35.
38760 LD (IX+15),27 Set the vertical acceleration of the object.
38764 LD (IX+0),30 Set the type of the object to 30.
38768 LD A,(62977) Fetch the value from 62977.
38771 LD (IX+19),A Set the first state byte of the object.
38774 LD B,A Keep a copy in B.
38775 ADD A,A Multiply it by five.
38776 ADD A,A
38777 ADD A,B
38778 ADD A,4 Add four.
38780 LD HL,38576 Use the table at UpdateCrystalStack_Table.
38783 CALL AddAToHL Add the offset to the address.
38786 LD B,(HL) Fetch the value from the table.
38787 LD A,115 Add 115.
38789 ADD A,B
38790 LD (IX+22),A Set the third state byte of the object.
38793 LD A,(51433) Fetch the map zone of the player from 51433.
38796 LD (IX+4),A Set the map zone of the object.
38799 LD (IX+1),82 Set the map column of the object to 82.
38803 LD (IX+2),104 Set the horizontal position of the object to 104.
38807 LD A,(51434) Fetch the vertical position of the player from 51434.
38810 LD (IX+5),A Set the vertical position of the object.
38813 LD (IX+13),255 Make the attribute of the object 255.
38817 LD (IX+21),10 Set the lifetime of the object to ten.
38821 LD A,(62977) Fetch the value from 62977.
38824 CP 6 Jump to StartCrystalObject_Done if it is not six.
38826 JR NZ,StartCrystalObject_Done
38828 LD (IX+19),8 Set the first state byte of the object to eight.
38832 XOR A Clear StackHeight.
38833 LD (51461),A
38836 LD (62976),A Clear 62976.
StartCrystalObject_Done 38839 LD A,255 Set 62977 to 255.
38841 LD (62977),A
38844 RET Return.
Prev: 38616 Up: Map Next: 38845