Prev: 42531 Up: Map Next: 42642
42544: Create Puff
Used by the routine at RunFrame.
Makes an entity of the type 5 (see UpdatePuffEntity) at the position of another entity, using one of the two hidden entities from 46590, and plays a buzz. Does nothing if both entities are in use.
Input
IX The other entity
CreatePuff 42544 LD IY,46590 Point IY at the first of the two entities which can be used.
42548 LD B,2 Look at 2 entities.
42550 CALL FindHiddenEntity Call FindHiddenEntity to find a hidden entity.
42553 RET Z Return if there is not one.
42554 LD (IY+1),0 Set the frame of the new entity to 0.
42558 LD (IY+0),5 Set the type of the new entity to 5.
42562 LD H,(IX+2) Fetch the first byte of the first coordinate of the other entity.
42565 LD L,(IX+3) Fetch the second byte of the first coordinate of the other entity.
42568 LD E,(IX+11) Fetch the first size of the other entity.
42571 LD D,0 Clear D.
42573 SRL E Halve the size.
42575 DEC E Subtract one.
42576 ADD HL,DE Add it to the first coordinate, to find the middle.
42577 LD (IY+2),H Store the first byte of the first coordinate of the new entity.
42580 LD (IY+3),L Store the second byte of the first coordinate of the new entity.
42583 LD H,(IX+5) Fetch the first byte of the second coordinate of the other entity.
42586 LD L,(IX+6) Fetch the second byte of the second coordinate of the other entity.
42589 LD E,(IX+12) Fetch the second size of the other entity.
42592 SRL E Halve the size.
42594 DEC E Subtract one.
42595 ADD HL,DE Add it to the second coordinate, to find the middle.
42596 LD (IY+5),H Store the first byte of the second coordinate of the new entity.
42599 LD (IY+6),L Store the second byte of the second coordinate of the new entity.
42602 LD H,(IX+8) Fetch the first byte of the third coordinate of the other entity.
42605 LD L,(IX+9) Fetch the second byte of the third coordinate of the other entity.
42608 LD E,(IX+13) Fetch the third size of the other entity (which is not used).
42611 LD E,0 Set the offset to 0.
42613 ADD HL,DE Add it to the third coordinate.
42614 INC HL Add one.
42615 LD (IY+8),H Store the first byte of the third coordinate of the new entity.
42618 LD (IY+9),L Store the second byte of the third coordinate of the new entity.
42621 LD A,(IX+17) Fetch the heading of the other entity.
42624 LD (IY+17),A Copy it to the new entity.
42627 LD (IY+16),136 Set field 16 of the new entity to 136.
42631 LD (IY+27),64 Set field 27 of the new entity to 64.
42635 LD (IY+23),6 Set field 23 of the new entity to 6.
42639 JP PlayShortBuzz Jump to PlayShortBuzz to play a buzz.
Prev: 42531 Up: Map Next: 42642