Prev: A623 Up: Map Next: A692
A630: Create Puff
Used by the routine at RunFrame.
Makes an entity of the type 05 (see UpdatePuffEntity) at the position of another entity, using one of the two hidden entities from B5FE, and plays a buzz. Does nothing if both entities are in use.
Input
IX The other entity
CreatePuff A630 LD IY,$B5FE Point IY at the first of the two entities which can be used.
A634 LD B,$02 Look at 02 entities.
A636 CALL FindHiddenEntity Call FindHiddenEntity to find a hidden entity.
A639 RET Z Return if there is not one.
A63A LD (IY+$01),$00 Set the frame of the new entity to 00.
A63E LD (IY+$00),$05 Set the type of the new entity to 05.
A642 LD H,(IX+$02) Fetch the first byte of the first coordinate of the other entity.
A645 LD L,(IX+$03) Fetch the second byte of the first coordinate of the other entity.
A648 LD E,(IX+$0B) Fetch the first size of the other entity.
A64B LD D,$00 Clear D.
A64D SRL E Halve the size.
A64F DEC E Subtract one.
A650 ADD HL,DE Add it to the first coordinate, to find the middle.
A651 LD (IY+$02),H Store the first byte of the first coordinate of the new entity.
A654 LD (IY+$03),L Store the second byte of the first coordinate of the new entity.
A657 LD H,(IX+$05) Fetch the first byte of the second coordinate of the other entity.
A65A LD L,(IX+$06) Fetch the second byte of the second coordinate of the other entity.
A65D LD E,(IX+$0C) Fetch the second size of the other entity.
A660 SRL E Halve the size.
A662 DEC E Subtract one.
A663 ADD HL,DE Add it to the second coordinate, to find the middle.
A664 LD (IY+$05),H Store the first byte of the second coordinate of the new entity.
A667 LD (IY+$06),L Store the second byte of the second coordinate of the new entity.
A66A LD H,(IX+$08) Fetch the first byte of the third coordinate of the other entity.
A66D LD L,(IX+$09) Fetch the second byte of the third coordinate of the other entity.
A670 LD E,(IX+$0D) Fetch the third size of the other entity (which is not used).
A673 LD E,$00 Set the offset to 00.
A675 ADD HL,DE Add it to the third coordinate.
A676 INC HL Add one.
A677 LD (IY+$08),H Store the first byte of the third coordinate of the new entity.
A67A LD (IY+$09),L Store the second byte of the third coordinate of the new entity.
A67D LD A,(IX+$11) Fetch the heading of the other entity.
A680 LD (IY+$11),A Copy it to the new entity.
A683 LD (IY+$10),$88 Set field 10 of the new entity to 88.
A687 LD (IY+$1B),$40 Set field 1B of the new entity to 40.
A68B LD (IY+$17),$06 Set field 17 of the new entity to 06.
A68F JP PlayShortBuzz Jump to PlayShortBuzz to play a buzz.
Prev: A623 Up: Map Next: A692