| Alien (BUGFIX 1.7) | Routines |
| Prev: 36457 | Up: Map | Next: 36717 |
|
Called by DispatchCrewAction just before an actor's queued action fires; returns A = 0 to cancel the dispatch, nonzero to let it proceed.
Used by the routine at 36014.
|
||||
| 36579 | LD A,(33700) | processing the alien (slot 0)? | ||
| 36582 | AND A | |||
| 36583 | CPL | (A = 255: proceed) | ||
| 36584 | RET Z | yes: always allowed, no checks | ||
| 36585 | XOR A | action state 0 (parked)? | ||
| 36586 | CP (IX+3) | |||
| 36589 | RET Z | yes: A = 0, nothing to fire | ||
| 36590 | LD A,(33703) | is this actor the Android? | ||
| 36593 | LD HL,33700 | |||
| 36596 | CP (HL) | |||
| 36597 | JR Z,36554 | yes: combat-refusal branch | ||
| 36599 | XOR A | morale 0 (Broken)? | ||
| 36600 | CP (IX+6) | |||
| 36603 | JR Z,36664 | yes: panic | ||
| 36605 | LD A,(IX+3) | states 3+ (grille/combat/...) | ||
| 36608 | CP 3 | fire unchecked; | ||
| 36610 | RET NC | moves go through the checks: | ||
| 36611 | LD A,(IX+2) | A = the pending destination | ||
| 36614 | LD HL,29575 | HL -> slot 1's room byte (+1) | ||
| 36617 | LD DE,8 | |||
| 36620 | LD BC,1792 | B = 7 slots, C = 0 occupants | ||
| 36623 | CP (HL) | count the crew already at | ||
| 36624 | JR NZ,36627 | the destination spot | ||
| 36626 | INC C | |||
| 36627 | ADD HL,DE | |||
| 36628 | DJNZ 36623 | |||
| 36630 | LD A,(IX+2) | heading into the duct network? | ||
| 36633 | BIT 6,A | |||
| 36635 | JR Z,36650 | |||
| 36637 | LD A,(IX+6) | too shaken for the ducts | ||
| 36640 | CP 2 | (morale < 2)? | ||
| 36642 | JR C,36664 | yes: panic | ||
| 36644 | LD A,C | duct cell already occupied? | ||
| 36645 | AND A | |||
| 36646 | JR NZ,36657 | yes: wait and retry | ||
| 36648 | CPL | no: A nonzero, proceed | ||
| 36649 | RET | |||
| 36650 | LD A,C | already 3 crew in the room? | ||
| 36651 | CP 3 | (the room-occupancy cap) | ||
| 36653 | JR NC,36657 | yes: wait and retry | ||
| 36655 | CPL | no: A nonzero, proceed | ||
| 36656 | RET | |||
| 36657 | LD A,32 | re-arm the countdown (32 + the | ||
| 36659 | CALL 35814 | usual adjustments) and | ||
| 36662 | XOR A | cancel this dispatch | ||
| 36663 | RET | |||
| 36664 | BIT 6,(IX+1) | panicking in the ducts? | ||
| 36668 | JR Z,36684 | |||
| 36670 | LD A,(IX+3) | only a pending move (state 1) | ||
| 36673 | CP 1 | is replaced | ||
| 36675 | RET NZ | |||
| 36676 | CALL 36150 | bail out: open this room's grille | ||
| 36679 | CALL 35560 | queue the climb out of the ducts | ||
| 36682 | XOR A | and cancel this dispatch | ||
| 36683 | RET | |||
| 36684 | LD HL,29940 | panicking in a room: scan ItemLocations | ||
| 36687 | LD A,(33700) | |||
| 36690 | ADD A,128 | E = own back-hand marker (128+slot) | ||
| 36692 | LD E,A | |||
| 36693 | ADD A,32 | D = own front-hand marker (160+slot) | ||
| 36695 | LD D,A | |||
| 36696 | LD C,(IX+1) | C = current room | ||
| 36699 | LD B,22 | all 22 items: | ||
| 36701 | LD A,(HL) | |||
| 36702 | CP E | held in either hand? | ||
| 36703 | JR Z,36708 | |||
| 36705 | CP D | |||
| 36706 | JR NZ,36709 | |||
| 36708 | LD (HL),C | yes: drop it on the floor here | ||
| 36709 | INC HL | |||
| 36710 | DJNZ 36701 | |||
| 36712 | CALL 36717 | flee: pick a random adjacent room | ||
| 36715 | JR 36611 | and re-run the occupancy checks | ||
| Prev: 36457 | Up: Map | Next: 36717 |