Prev: 31690 Up: Map Next: 31759
31721: SelectSlotByDrawIdx
Re-points IX at the 8-byte record indexed by (31241) and loads the slot's identity into (31242) for downstream lookups. Critically, if the slot wears the HostMarker (byte+1 == $FF), the routine returns immediately without writing 31242 / 31243 — every per-frame caller that walks into this entry point therefore skips that slot during routine corridor processing. In the Long Game this means the chestburster host is excluded from normal crew handling; in the Short Game the same exclusion applies to all four pre-stamped slots.
Input
This entry point is used by the routine at 35163.
31721 LD A,(31241) A = current draw index (slot 0..7)
31724 ADD A,A
31725 ADD A,A
31726 ADD A,A A *= 8 (record stride)
31727 LD E,A
31728 LD D,0
31730 LD IX,29566 IX = $7376 (slot table base)
31734 ADD IX,DE IX = &slot[index]
31736 LD A,(IX+1) A = slot.byte+1
31739 CP 255 HostMarker?
31741 RET Z yes → bail out (slot is not a normal crew member)
31742 LD (31242),A cache slot identity for the rest of the room handler
31745 AND 63 mask off direction bit → raw crew ID (0..63)
31747 LD E,A
31748 LD D,0
31750 LD HL,29905 RoomTypeTable[crew's room]
31753 ADD HL,DE
31754 LD A,(HL)
31755 LD (31243),A RoomTypeByte for this crew
31758 RET
Prev: 31690 Up: Map Next: 31759