| Alien (BUGFIX 1.7) | Routines |
| Prev: 40826 | Up: Map | Next: 41264 |
|
Android-side combat handler, called from CrewAction4_Handler (37542) when the state-4 actor stands in the Android's room (the slot picked by LongGameInit from LongGameTargetTable, id in AlienTargetID, record pointer in AlienTargetPtr). The parallel of CrewHitsAlien: same guards, same weapon dispatch on the attacker's front-hand item, but aimed at the Android and emitting messages #31 / #32 instead of #3 / #4.
Guards: strength (IX+4) >= 2 and morale (IX+6) >= 2 — a Collapsed or Broken/Shaken crew member cannot fight. Then the weapon decides:
|
||||||||||||||||||||
| 40941 | LD A,(IX+4) | attacker's strength >= 2? | ||||||||||||||||||
| 40944 | CP 2 | |||||||||||||||||||
| 40946 | RET C | no: too hurt to fight | ||||||||||||||||||
| 40947 | LD A,(IX+6) | attacker's morale >= 2? | ||||||||||||||||||
| 40950 | CP 2 | |||||||||||||||||||
| 40952 | RET C | no: too scared to fight | ||||||||||||||||||
| 40953 | LD A,(33700) | A = the attacker's slot | ||||||||||||||||||
| 40956 | CALL 31823 | FindHeldItems: what is he holding? | ||||||||||||||||||
| 40959 | LD A,(31248) | A = the front-hand weapon | ||||||||||||||||||
| 40962 | CP 17 | the Cat Box? | ||||||||||||||||||
| 40964 | JP Z,41229 | useless: silent no-op | ||||||||||||||||||
| 40967 | CP 20 | Cat in Net/Box, or bare hands (255)? | ||||||||||||||||||
| 40969 | JP NC,41229 | also useless | ||||||||||||||||||
| 40972 | CP 16 | the Net? | ||||||||||||||||||
| 40974 | JR NZ,40999 | no → "hits the Android" branch | ||||||||||||||||||
| 40976 | LD HL,(33701) | yes: stamp 255 into the Android's | ||||||||||||||||||
| 40979 | LD (HL),255 | countdown (+0) — netted, out of action | ||||||||||||||||||
| 40981 | CALL 37924 | the Net is used up (destroyed) | ||||||||||||||||||
| 40984 | LD A,(33700) | L = the attacker's slot, | ||||||||||||||||||
| 40987 | LD HL,(33702) | H = the Android's slot (the byte | ||||||||||||||||||
| 40990 | LD L,A | after AlienTargetPtr is AlienTargetID) | ||||||||||||||||||
| 40991 | LD A,31 | A = msg #31 "{actor} nets {target}" | ||||||||||||||||||
| 40993 | CALL 37176 | enqueue | ||||||||||||||||||
| 40996 | JP 41229 | |||||||||||||||||||
|
"{actor} hits the Android" branch (CrewHitsAndroid continued).
|
||||||||||||||||||||
| 40999 | PUSH AF | stash the weapon id across the message | ||||||||||||||||||
| 41000 | LD A,(33700) | A = the attacker's slot | ||||||||||||||||||
| 41003 | LD L,A | L = actor for the message | ||||||||||||||||||
| 41004 | LD A,32 | A = msg #32 "{actor} hits the Android" | ||||||||||||||||||
| 41006 | CALL 37176 | enqueue | ||||||||||||||||||
| 41009 | POP AF | A = the weapon again | ||||||||||||||||||
| 41010 | CP 6 | 0-5: a prod or an incinerator? | ||||||||||||||||||
| 41012 | JR C,41022 | |||||||||||||||||||
| 41014 | CP 18 | 18/19: a spanner? | ||||||||||||||||||
| 41016 | JR Z,41022 | |||||||||||||||||||
| 41018 | CP 19 | |||||||||||||||||||
| 41020 | JR NZ,41062 | anything else: weapon-specific handling | ||||||||||||||||||
| 41022 | LD HL,(33701) | wound the Android: | ||||||||||||||||||
| 41025 | LD DE,4 | its strength (+4) -1 | ||||||||||||||||||
| 41028 | ADD HL,DE | |||||||||||||||||||
| 41029 | DEC (HL) | |||||||||||||||||||
| 41030 | LD A,(HL) | still 2+ ? | ||||||||||||||||||
| 41031 | CP 2 | |||||||||||||||||||
| 41033 | JP NC,41229 | yes: it stays up | ||||||||||||||||||
| 41036 | INC HL | below 2: the Android collapses — | ||||||||||||||||||
| 41037 | INC HL | |||||||||||||||||||
| 41038 | INC HL | |||||||||||||||||||
| 41039 | LD (HL),2 | status (+7) = 2 (defeated, locked out | ||||||||||||||||||
| 41041 | LD DE,65529 | of re-activation), | ||||||||||||||||||
| 41044 | ADD HL,DE | countdown (+0) = 0 | ||||||||||||||||||
| 41045 | LD (HL),0 | |||||||||||||||||||
| 41047 | LD A,(33703) | L = the Android, | ||||||||||||||||||
| 41050 | LD L,A | |||||||||||||||||||
| 41051 | LD A,21 | msg #21 "{actor} has collapsed" | ||||||||||||||||||
| 41053 | CALL 37176 | |||||||||||||||||||
| 41056 | CALL 45148 | put the Special row back to the grille | ||||||||||||||||||
| 41059 | LD (HL),0 | state, and clear AlienActiveFlag | ||||||||||||||||||
| 41061 | RET | (RefreshGrilleRow returns HL -> it) | ||||||||||||||||||
| 41062 | CP 8 | 6/7: a tracker? | ||||||||||||||||||
| 41064 | JR NC,41079 | |||||||||||||||||||
| 41066 | CALL 37924 | yes: it shatters — destroyed, | ||||||||||||||||||
| 41069 | LD A,5 | msg #5 "{actor}'s Tracker is broken" | ||||||||||||||||||
| 41071 | LD HL,(33700) | |||||||||||||||||||
| 41074 | CALL 37176 | |||||||||||||||||||
| 41077 | JR 41022 | and it still wounds the Android | ||||||||||||||||||
| 41079 | CP 12 | 8-11: an extinguisher? | ||||||||||||||||||
| 41081 | JR NC,41109 | |||||||||||||||||||
| 41083 | LD HL,33746 | yes: HL -> its ItemCharges entry | ||||||||||||||||||
| 41086 | LD E,A | |||||||||||||||||||
| 41087 | LD D,0 | |||||||||||||||||||
| 41089 | ADD HL,DE | |||||||||||||||||||
| 41090 | LD A,(HL) | any CO2 left? | ||||||||||||||||||
| 41091 | AND A | |||||||||||||||||||
| 41092 | JR Z,41098 | |||||||||||||||||||
| 41094 | DEC (HL) | yes: spend a charge — no effect | ||||||||||||||||||
| 41095 | JP 41229 | on the Android | ||||||||||||||||||
| 41098 | LD HL,(33700) | empty: L = actor, | ||||||||||||||||||
| 41101 | LD A,6 | msg #6 "{actor}'s extinguisher is empty" | ||||||||||||||||||
| 41103 | CALL 37176 | |||||||||||||||||||
| 41106 | JP 41229 | |||||||||||||||||||
| 41109 | JP NZ,41195 | weapon != 12 → 13-15, the laser branch | ||||||||||||||||||
| 41112 | CALL 37876 | the Harpoon Gun: gather the attacker | ||||||||||||||||||
| 41115 | LD DE,33695 | + room-mates as blast victims | ||||||||||||||||||
| 41118 | LD B,3 | all three gathered slots: | ||||||||||||||||||
| 41120 | PUSH BC | |||||||||||||||||||
| 41121 | PUSH DE | |||||||||||||||||||
| 41122 | LD A,(DE) | A = victim slot (255 = none) | ||||||||||||||||||
| 41123 | CP 255 | |||||||||||||||||||
| 41125 | JR Z,41179 | |||||||||||||||||||
| 41127 | PUSH AF | |||||||||||||||||||
| 41128 | ADD A,128 | E = victim's back-hand marker | ||||||||||||||||||
| 41130 | LD E,A | |||||||||||||||||||
| 41131 | ADD A,32 | D = victim's front-hand marker | ||||||||||||||||||
| 41133 | LD D,A | |||||||||||||||||||
| 41134 | LD C,(IX+1) | C = the room | ||||||||||||||||||
| 41137 | LD HL,29940 | item wipe — NB the room test below is | ||||||||||||||||||
| 41140 | LD B,22 | INVERTED vs the alien side (37763): | ||||||||||||||||||
| 41142 | LD A,(HL) | |||||||||||||||||||
| 41143 | CP D | held by the victim: wiped | ||||||||||||||||||
| 41144 | JR Z,41152 | |||||||||||||||||||
| 41146 | CP E | |||||||||||||||||||
| 41147 | JR Z,41152 | |||||||||||||||||||
| 41149 | CP C | lying in this room: SURVIVES — | ||||||||||||||||||
| 41150 | JR Z,41154 | but everything else on the ship | ||||||||||||||||||
| 41152 | LD (HL),255 | falls through and is destroyed | ||||||||||||||||||
| 41154 | INC HL | (original-game bug, see the header) | ||||||||||||||||||
| 41155 | DJNZ 41142 | |||||||||||||||||||
| 41157 | POP AF | HL -> the victim's status byte (+7) | ||||||||||||||||||
| 41158 | LD HL,29573 | |||||||||||||||||||
| 41161 | ADD A,A | |||||||||||||||||||
| 41162 | ADD A,A | |||||||||||||||||||
| 41163 | ADD A,A | |||||||||||||||||||
| 41164 | LD E,A | |||||||||||||||||||
| 41165 | LD D,0 | |||||||||||||||||||
| 41167 | ADD HL,DE | |||||||||||||||||||
| 41168 | XOR A | still alive? | ||||||||||||||||||
| 41169 | CP (HL) | |||||||||||||||||||
| 41170 | JR NZ,41179 | |||||||||||||||||||
| 41172 | LD (HL),1 | yes: killed by the blast (+7 = 1), | ||||||||||||||||||
| 41174 | LD DE,65529 | countdown (+0) = 0 | ||||||||||||||||||
| 41177 | ADD HL,DE | |||||||||||||||||||
| 41178 | LD (HL),A | |||||||||||||||||||
| 41179 | POP DE | |||||||||||||||||||
| 41180 | INC DE | |||||||||||||||||||
| 41181 | POP BC | |||||||||||||||||||
| 41182 | DJNZ 41120 | |||||||||||||||||||
| 41184 | LD A,15 | the blast wrecks the room: | ||||||||||||||||||
| 41186 | LD E,(IX+1) | +15 damage points | ||||||||||||||||||
| 41189 | CALL 38186 | |||||||||||||||||||
| 41192 | JP 31417 | rebuild the ship view | ||||||||||||||||||
| 41195 | LD E,A | 13-15, a laser pistol: | ||||||||||||||||||
| 41196 | LD D,0 | |||||||||||||||||||
| 41198 | LD HL,33746 | HL -> its ItemCharges entry | ||||||||||||||||||
| 41201 | ADD HL,DE | |||||||||||||||||||
| 41202 | XOR A | any shots left? | ||||||||||||||||||
| 41203 | CP (HL) | |||||||||||||||||||
| 41204 | JR Z,41218 | |||||||||||||||||||
| 41206 | DEC (HL) | yes: spend one, | ||||||||||||||||||
| 41207 | LD A,6 | +6 room damage, | ||||||||||||||||||
| 41209 | LD E,(IX+1) | |||||||||||||||||||
| 41212 | CALL 38186 | |||||||||||||||||||
| 41215 | JP 41022 | and wound the Android | ||||||||||||||||||
| 41218 | LD HL,(33700) | out of shots: L = actor, | ||||||||||||||||||
| 41221 | LD A,7 | msg #7 "{actor}'s Laser is exhausted" | ||||||||||||||||||
| 41223 | CALL 37176 | |||||||||||||||||||
| 41226 | JP 41229 | |||||||||||||||||||
| 41229 | LD A,(31252) | room view on screen (mode 1)? | ||||||||||||||||||
| 41232 | CP 1 | |||||||||||||||||||
| 41234 | RET NZ | no: done | ||||||||||||||||||
| 41235 | LD A,(31241) | is the attacker the viewed crew member? | ||||||||||||||||||
| 41238 | LD HL,33700 | |||||||||||||||||||
| 41241 | CP (HL) | |||||||||||||||||||
| 41242 | RET NZ | no: done | ||||||||||||||||||
| 41243 | LD A,(33704) | Android hostility still on? | ||||||||||||||||||
| 41246 | AND A | |||||||||||||||||||
| 41247 | LD A,(HL) | (leftover load, unused) | ||||||||||||||||||
| 41248 | RET Z | no: leave the Special row alone | ||||||||||||||||||
| 41249 | LD A,52 | yes: keep " ATTACK " on the Special | ||||||||||||||||||
| 41251 | CALL 45269 | slot and redraw the special row | ||||||||||||||||||
| 41254 | LD HL,18646 | (screen row 14, col 22) | ||||||||||||||||||
| 41257 | LD (31257),HL | |||||||||||||||||||
| 41260 | CALL 31634 | |||||||||||||||||||
| 41263 | RET | |||||||||||||||||||
| Prev: 40826 | Up: Map | Next: 41264 |