Prev: 40440 Up: Map Next: 40518
40471: Update Puff Entity
Updates an entity of the type 5. When it is in frame 1 the low nibble of field 35 counts down, and when that runs out the entity is freed.
Input
IX The entity
UpdatePuffEntity 40471 LD A,(IX+1) Fetch the frame of the entity.
40474 AND %00001111 Use bits 0-3.
40476 DEC A Subtract one.
40477 JR NZ,UpdatePuffEntity_Test Jump to UpdatePuffEntity_Test unless it is frame 1.
40479 LD (IX+16),A Set the speed to 0.
40482 LD A,(IX+35) Read field 35 of the entity.
40485 LD B,A Keep it in B.
40486 AND %00001111 Keep the low nibble.
40488 SUB 1 Subtract one.
40490 JR C,FreeEntity Jump to FreeEntity if it was zero.
40492 LD C,A Keep the new count in C.
40493 LD A,B Read field 35 of the entity.
40494 AND %11110000 Keep the high nibble.
40496 OR C Combine it with the new count.
40497 LD (IX+35),A Store it in field 35 of the entity.
This entry point is used by the routine at UpdateShotEntity.
UpdatePuffEntity_Test 40500 BIT 7,(IX+1) Jump to UpdateEntity if bit 7 of the frame of the entity is not set.
40504 JP Z,UpdateEntity
This entry point is used by the routine at UpdateDomeEntity.
FreeEntity 40507 LD (IX+0),0 Set the type of the entity to 0 to free it.
40511 SET 7,(IX+1) Set bit 7 of the frame of the entity, to hide it.
40515 JP UpdateEntity_Done Jump to UpdateEntity_Done.
Prev: 40440 Up: Map Next: 40518