Prev: 54997 Up: Map Next: 55050
54998: Create Fragments
Used by the routine at UpdateThrownItem.
Creates four fragments (objects of type 140) at the position of an object, in the four objects from ObjectTable_Items. Each fragment flies off in a different direction.
Input
IY Object
Create four fragments at the object's position.
CreateFragments 54998 LD HL,48334 Point HL at the first fragment, and set a counter for four fragments.
55001 LD B,4
Copy the position and send this fragment on its way.
CreateFragments_Loop 55003 LD (HL),140 Set the type of the fragment.
55005 INC HL
55006 PUSH IY Point DE at the position of the object, and set a counter for four bytes.
55008 POP DE
55009 INC DE
55010 LD C,4
CreateFragments_Position 55012 LD A,(DE) Copy the position of the object into the fragment, and loop back until all of it has been copied.
55013 INC DE
55014 LD (HL),A
55015 INC HL
55016 DEC C
55017 JR NZ,CreateFragments_Position
55019 LD (HL),12 Set the speed of the fragment to 12.
55021 INC HL
55022 LD A,B Work out the direction of the fragment from the counter, so that the four fragments fly off in different directions.
55023 DEC A
55024 RRCA
55025 RRCA
55026 AND 192
55028 LD (HL),A Set the direction of the fragment, and move on to the width.
55029 INC HL
55030 INC HL
55031 LD (HL),16 Set the width of the fragment to 16.
55033 INC HL
55034 LD (HL),16 Set the depth of the fragment to 16.
55036 INC HL Move on to the sprite offsets.
55037 INC HL
55038 INC HL
55039 LD (HL),244 Set the X offset of the sprite.
55041 INC HL
55042 LD (HL),4 Set the Y offset of the sprite.
55044 INC HL Move on to the next fragment.
55045 INC HL
55046 INC HL
55047 DJNZ CreateFragments_Loop Loop back until all four fragments have been created.
55049 RET Return.
Prev: 54997 Up: Map Next: 55050