Prev: 37584 Up: Map Next: 37924
37876: GatherSameRoomSlots
Fill NearestCrewC with the current actor's slot (CrewIndex) and NearestCrewA/B with up to two other crew on the same spot (same room byte, same side of the ducts) — the same scan RecalcMorale uses for RoomMateA/B. GatherSlots_Scan is a direct entry with A = the slot to treat as "self".
Used by the routines at 37584, 37992, 40757, 40826 and 40941.
37876 LD HL,65535 NearestCrewA/B = 255/255 (none)
37879 LD (33696),HL
37882 LD DE,33696
37885 LD A,(33700) NearestCrewC = the current actor
37888 LD (33695),A
This entry point is used by the routine at 39256.
37891 LD HL,29575 HL -> slot 1's room byte (+1)
37894 LD C,1 C = candidate slot number
37896 EX AF,AF' keep "self" slot in A'
37897 LD A,(IX+1) A = the actor's spot
37900 LD B,7 scan the 7 crew slots
37902 CP (HL) on the same spot?
37903 JR NZ,37914 no: next slot
37905 EX AF,AF' is it "self"?
37906 CP C
37907 JR Z,37913 yes: skip it
37909 EX DE,HL record the slot
37910 LD (HL),C (NearestCrewA, then NearestCrewB)
37911 EX DE,HL
37912 INC DE
37913 EX AF,AF' (put the spot back in A)
37914 PUSH DE
37915 LD DE,8 step to the next record's room byte
37918 ADD HL,DE
37919 POP DE
37920 INC C
37921 DJNZ 37902
37923 RET
Prev: 37584 Up: Map Next: 37924