Prev: 40384 Up: Map Next: 40440
40414: Decrease Entity Counter
Used by the routines at UpdatePickupEntity and UpdateShotEntity.
Decreases the counter in the high nibble of field 22 of an entity by one. When the counter reaches zero the entity is freed and hidden.
Input
IX The entity
DecreaseEntityCounter 40414 LD A,(IX+22) Read field 22 of the entity.
40417 AND %11110000 Keep the counter.
40419 RET Z Return if it is zero.
40420 LD A,(IX+22) Read field 22 of the entity.
40423 SUB 16 Subtract one from the counter.
40425 LD (IX+22),A Store it.
40428 AND %11110000 Keep the counter.
40430 RET NZ Return if it is not zero.
40431 LD (IX+0),0 Set the type of the entity to 0 to free it.
40435 SET 7,(IX+1) Set bit 7 of the frame of the entity, to hide it.
40439 RET Return.
Prev: 40384 Up: Map Next: 40440