| Alien (BUGFIX 1.7) | Routines |
| Prev: 36150 | Up: Map | Next: 36283 |
|
After an actor moves: scan the 7 crew rooms for other actors on the same spot (same room, same side of the ducts), record up to two in RoomMateA/B, then run MoraleFromCompanion three times, rotating the (self, mateA, mateB) triple through NearestCrewC so each of the three has his morale recomputed with the other two as companions. A third room-mate's slot would spill past RoomMateB into RoomModeByte — PreActionCheck's 3-crew room cap is what keeps that from happening.
|
||||
| 36187 | LD HL,65535 | RoomMateA/B = 255/255 (none) | ||
| 36190 | LD (31250),HL | |||
| 36193 | LD HL,29575 | HL -> slot 1's room byte (+1) | ||
| 36196 | LD C,1 | C = candidate slot number | ||
| 36198 | LD A,(33700) | processing the alien (slot 0)? | ||
| 36201 | AND A | |||
| 36202 | RET Z | yes: it has no morale | ||
| 36203 | EX AF,AF' | keep own slot number in A' | ||
| 36204 | LD DE,31250 | DE -> RoomMateA | ||
| 36207 | LD A,(IX+1) | A = own spot (room + duct bit) | ||
| 36210 | LD B,7 | scan the 7 crew slots | ||
| 36212 | CP (HL) | on the same spot? | ||
| 36213 | JR NZ,36224 | no: next slot | ||
| 36215 | EX AF,AF' | is it our own record? | ||
| 36216 | CP C | |||
| 36217 | JR Z,36223 | yes: skip it | ||
| 36219 | EX DE,HL | record the room-mate's slot | ||
| 36220 | LD (HL),C | (RoomMateA, then RoomMateB) | ||
| 36221 | EX DE,HL | |||
| 36222 | INC DE | |||
| 36223 | EX AF,AF' | (put the spot back in A) | ||
| 36224 | PUSH DE | |||
| 36225 | LD DE,8 | step to the next record's room byte | ||
| 36228 | ADD HL,DE | |||
| 36229 | POP DE | |||
| 36230 | INC C | |||
| 36231 | DJNZ 36212 | |||
| 36233 | PUSH IX | |||
| 36235 | LD A,(33700) | seed the rotation: | ||
| 36238 | LD (33695),A | C-slot = self, | ||
| 36241 | LD HL,(31250) | A/B-slots = the two room-mates | ||
| 36244 | LD (33696),HL | |||
| 36247 | CALL 36283 | morale of self (companions: A and B) | ||
| 36250 | LD HL,(33696) | rotate the triple: (C,A,B) = | ||
| 36253 | LD A,(33695) | (mateA, mateB, self) | ||
| 36256 | LD (33697),A | |||
| 36259 | LD (33695),HL | |||
| 36262 | CALL 36283 | morale of mateA (companions: B, self) | ||
| 36265 | LD HL,(33696) | rotate again: (C,A,B) = | ||
| 36268 | LD A,(33695) | (mateB, self, mateA) | ||
| 36271 | LD (33697),A | |||
| 36274 | LD (33695),HL | |||
| 36277 | CALL 36283 | morale of mateB (companions: self, A) | ||
| 36280 | POP IX | |||
| 36282 | RET | |||
| Prev: 36150 | Up: Map | Next: 36283 |