Prev: 37992 Up: Map Next: 38317
38182: AddAlienRoomDamage
Add A damage points to the ALIEN's current room (then fall into the general AddRoomDamage below).
Used by the routines at 37018 and 37584.
38182 LD HL,29567 E = the alien's current room
38185 LD E,(HL)
This entry point is used by the routines at 39159 and 40941. AddRoomDamage: add A damage points to room E's damage meter — a 2-digit ASCII pair in (RoomDamageDigits; tens digit is the severity the engine scan at 39041 compares against). Crossing "30" raises the room-specific alarm messages #22-#25.
38186 BIT 6,E no damage meters in the duct network
38188 RET NZ
38189 LD HL,30006 per-room ASCII damage digits (tens,units)
38192 LD D,0
38194 ADD HL,DE
38195 ADD HL,DE
38196 INC HL HL -> units digit
38197 LD B,A B = damage points to add
38198 PUSH BC per damage point: the meter climbs
38199 PUSH HL in half-steps of the tens digit —
38200 PUSH DE
38201 LD A,(HL) units already '5'?
38202 CP 53
38204 JR Z,38210
38206 LD (HL),53 no: units 0 -> 5
38208 JR 38298
38210 LD (HL),48 yes: units '5' -> '0',
38212 DEC HL carry into the tens digit
38213 INC (HL)
38214 LD A,(HL) tens reached '3'?
38215 CP 51
38217 JR NZ,38281
38219 LD A,E damage tens digit reached '3': room alarms
38220 CP 6 CommdCentr?
38222 JR NZ,38228
38224 LD A,22 msg #22 "Partial loss of control systems"
38226 JR 38288
38228 CP 7 Computer room?
38230 JR NZ,38236
38232 LD A,23 msg #23 "Computer Malfunction detected"
38234 JR 38288
38236 CP 25 Life Support?
38238 JR NZ,38244
38240 LD A,24 msg #24 "Environmental irregularities"
38242 JR 38288
38244 CP 34 the Narcissus?
38246 JR NZ,38252
38248 LD A,25 msg #25 "Narcissus status RED"
38250 JR 38288
38252 CP 17 an engine room (17-19)?
38254 JR C,38298
38256 CP 20
38258 JR NC,38298 other rooms: no "30" alarm
38260 AND 3 room 17/18/19 -> flag bit 3/4/5:
38262 LD B,A
38263 LD A,4
38265 ADD A,A A = 4 << (room & 3)
38266 DJNZ 38265
38268 LD HL,31253 the engine room catches FIRE —
38271 OR (HL) set its ShipSystemFlags bit
38272 LD (HL),A
38273 LD L,E L = room for the {room} field
38274 LD A,9 msg #9 "WARNING: Fire in {room}"
38276 CALL 37176
38279 JR 38298
38281 CP 55 tens reached '7' (70 damage)?
38283 JR NZ,38293
38285 LD L,E L = room
38286 LD A,8 msg #8 "Structural Damage in {room}"
38288 CALL 37176
38291 JR 38298
38293 CP 58 tens past '9' (100 damage)?
38295 CALL Z,38317 the ship breaks up - game over
38298 POP DE
38299 POP HL
38300 POP BC
38301 DJNZ 38198 next damage point
38303 LD A,(31252) is the damaged room the one on
38306 CP 1 screen?
38308 RET NZ
38309 LD A,(31242)
38312 CP E
38313 CALL Z,32143 yes: redraw the title/damage line
38316 RET
Prev: 37992 Up: Map Next: 38317