![]() |
Routines |
| Prev: D6D5 | Up: Map | Next: D70A |
|
Used by the routine at UpdateThrownItem.
Creates four fragments (objects of type 8C) at the position of an object, in the four objects from ObjectTable_Items. Each fragment flies off in a different direction.
|
||||||||
|
Create four fragments at the object's position.
|
||||||||
| CreateFragments | D6D6 | LD HL,$BCCE | Point HL at the first fragment, and set a counter for four fragments. | |||||
| D6D9 | LD B,$04 | |||||||
|
Copy the position and send this fragment on its way.
|
||||||||
| CreateFragments_Loop | D6DB | LD (HL),$8C | Set the type of the fragment. | |||||
| D6DD | INC HL | |||||||
| D6DE | PUSH IY | Point DE at the position of the object, and set a counter for four bytes. | ||||||
| D6E0 | POP DE | |||||||
| D6E1 | INC DE | |||||||
| D6E2 | LD C,$04 | |||||||
| CreateFragments_Position | D6E4 | LD A,(DE) | Copy the position of the object into the fragment, and loop back until all of it has been copied. | |||||
| D6E5 | INC DE | |||||||
| D6E6 | LD (HL),A | |||||||
| D6E7 | INC HL | |||||||
| D6E8 | DEC C | |||||||
| D6E9 | JR NZ,CreateFragments_Position | |||||||
| D6EB | LD (HL),$0C | Set the speed of the fragment to 0C. | ||||||
| D6ED | INC HL | |||||||
| D6EE | LD A,B | Work out the direction of the fragment from the counter, so that the four fragments fly off in different directions. | ||||||
| D6EF | DEC A | |||||||
| D6F0 | RRCA | |||||||
| D6F1 | RRCA | |||||||
| D6F2 | AND $C0 | |||||||
| D6F4 | LD (HL),A | Set the direction of the fragment, and move on to the width. | ||||||
| D6F5 | INC HL | |||||||
| D6F6 | INC HL | |||||||
| D6F7 | LD (HL),$10 | Set the width of the fragment to 10. | ||||||
| D6F9 | INC HL | |||||||
| D6FA | LD (HL),$10 | Set the depth of the fragment to 10. | ||||||
| D6FC | INC HL | Move on to the sprite offsets. | ||||||
| D6FD | INC HL | |||||||
| D6FE | INC HL | |||||||
| D6FF | LD (HL),$F4 | Set the X offset of the sprite. | ||||||
| D701 | INC HL | |||||||
| D702 | LD (HL),$04 | Set the Y offset of the sprite. | ||||||
| D704 | INC HL | Move on to the next fragment. | ||||||
| D705 | INC HL | |||||||
| D706 | INC HL | |||||||
| D707 | DJNZ CreateFragments_Loop | Loop back until all four fragments have been created. | ||||||
| D709 | RET | Return. | ||||||
| Prev: D6D5 | Up: Map | Next: D70A |