| Alien (BUGFIX 1.7) | Routines |
| Prev: 40757 | Up: Map | Next: 40941 |
|
Per-frame Android activation check. Once TriggerAlienEvent has set AlienActiveFlag — the crew has wounded the alien 6+ times — this routine pulls the alien_target slot into action state 7 (attack), turning the Android from a normal-looking crew member into a hostile actor that wounds the crew in its room.
Returns immediately if any of:
In other words: the routine re-fires every time the Android's countdown parks at 0 while AlienActiveFlag is set — once per attack/wander cycle, not once per game — until the collapse lockout lands. (LongGameCrewInit issues every slot with +0 = +7 = 0, so the first firing is the frame the trigger is set.)
When all guards pass:
Once the Android is in state 7, subsequent ResetCrewTimers frames dispatch it through CrewAction7_Handler which wounds a live crew member in its room and can collapse them via 39400 (msg #21 "{actor} has collapsed").
This routine is NOT the alien's own attack: the alien kills crew that end up in its room (slot 0 record byte +1) — see the attack tick at 39328.
Used by the routine at 36457.
|
||||
| 40826 | LD A,(33704) | A = AlienActiveFlag | ||
| 40829 | AND A | alien loose on ship? | ||
| 40830 | RET Z | no: no encounter yet, nothing to activate | ||
| 40831 | LD HL,(33701) | HL = alien_target record (AlienTargetPtr) | ||
| 40834 | LD A,(HL) | A = byte +0 | ||
| 40835 | AND A | Android already activated (+0 stamped to 80)? | ||
| 40836 | RET NZ | yes: this routine has already fired once, skip | ||
| 40837 | LD DE,7 | offset to byte +7 (defeated-lockout sentinel) | ||
| 40840 | ADD HL,DE | HL → +7 | ||
| 40841 | CP (HL) | A=0 here; Z iff byte +7 == 0 (template, not defeated) | ||
| 40842 | RET NZ | +7 != 0: Android collapsed earlier, stay dormant | ||
| 40843 | PUSH IX | save caller's IX | ||
| 40845 | LD IX,(33701) | IX = Android record (= alien_target) | ||
| 40849 | LD (IX+0),80 | stamp +0 = 80 — activation marker / blocks re-entry | ||
| 40853 | LD A,(33703) | A = AlienTargetID (= Android slot index) | ||
| 40856 | LD (33700),A | CrewIndex = AlienTargetID (Android's slot) | ||
| 40859 | CALL 37876 | gather up to two other crew standing in the Android's room as its victims | ||
| 40862 | LD A,(33696) | A = first room-mate (33696) | ||
| 40865 | CP 255 | $FF = nobody there | ||
| 40867 | JR Z,40906 | no primary target: wander | ||
| 40869 | LD C,A | C = victim slot | ||
| 40870 | ADD A,A | A × 8 (crew record size) | ||
| 40871 | ADD A,A | |||
| 40872 | ADD A,A | |||
| 40873 | LD E,A | |||
| 40874 | LD D,0 | |||
| 40876 | LD HL,29573 | HL -> that slot's status byte | ||
| 40879 | ADD HL,DE | (+7, base $7385) | ||
| 40880 | XOR A | alive (status 0)? | ||
| 40881 | CP (HL) | |||
| 40882 | JR Z,40920 | yes: attack him | ||
| 40884 | LD A,(33697) | A = second room-mate | ||
| 40887 | CP 255 | |||
| 40889 | JR Z,40906 | no secondary target either: wander | ||
| 40891 | LD C,A | C = victim slot | ||
| 40892 | ADD A,A | HL -> his status byte (+7) | ||
| 40893 | ADD A,A | |||
| 40894 | ADD A,A | |||
| 40895 | LD E,A | |||
| 40896 | LD D,0 | |||
| 40898 | LD HL,29573 | |||
| 40901 | ADD HL,DE | |||
| 40902 | XOR A | alive (status 0)? | ||
| 40903 | CP (HL) | |||
| 40904 | JR Z,40920 | yes: attack him | ||
| 40906 | CALL 36717 | nobody to attack: pick a room to | ||
| 40909 | LD (IX+3),1 | wander to (action state 1) | ||
| 40913 | LD (IX+0),60 | with timer 60 frames | ||
| 40917 | POP IX | |||
| 40919 | RET | |||
| 40920 | LD H,C | H = the victim slot (message target) | ||
| 40921 | LD A,(33703) | A = AlienTargetID | ||
| 40924 | LD L,A | L = Android slot index (message actor) | ||
| 40925 | LD A,30 | A = message #30 "{actor} is attacking {target}" | ||
| 40927 | CALL 37176 | enqueue: "{Android name} is attacking {nearest}" | ||
| 40930 | LD (IX+3),7 | Android slot → action state 7 (attack) | ||
| 40934 | LD (IX+0),40 | with timer 40 frames (next dispatch runs the attack) | ||
| 40938 | POP IX | |||
| 40940 | RET | |||
| Prev: 40757 | Up: Map | Next: 40941 |