Prev: 39041 Up: Map Next: 39159
39077: FireDamageTick — one burning engine room (E), fire bit in D
The number of extinguisher squirts needed grows with the damage already done (1, 2 from "60", 3 from "80"). Enough squirts put the fire out: clear its ShipSystemFlags bit, blank the on-screen fire label, msg #15. Not enough: the fire keeps burning and adds a damage point every 100 frames (FireSpreadCheck).
Used by the routine at 39041.
39077 PUSH AF
39078 PUSH DE
39079 LD C,1 C = squirts needed: 1,
39081 LD B,D (B = the engine's fire bit)
39082 LD D,0
39084 LD HL,30006 HL -> the room's damage tens digit
39087 ADD HL,DE
39088 ADD HL,DE
39089 LD A,(HL)
39090 CP 54 +1 from "60" damage,
39092 JR C,39100
39094 INC C
39095 CP 56 +1 more from "80"
39097 JR C,39100
39099 INC C
39100 LD HL,38334 A = squirts delivered so far
39103 ADD HL,DE (EngineFixCounts, base-17 indexed)
39104 LD A,(HL)
39105 CP C enough to put it out?
39106 JR C,39159 no: the fire keeps burning
39108 LD A,(31253) yes: clear the engine's fire bit
39111 XOR B
39112 LD (31253),A
39115 LD A,(31252) is the burning room on screen?
39118 CP 1
39120 JR NZ,39149
39122 LD A,(31242)
39125 CP E
39126 JR NZ,39149
39128 LD HL,65535 yes: blank the fire label —
39131 LD (29645),HL cells 15/16 = empty
39134 LD A,L
39135 LD HL,20502 and redraw those rows
39138 LD (31257),HL (screen rows 16/17, col 22)
39141 CALL 31634
39144 LD A,255
39146 CALL 31634
39149 POP HL L = the room
39150 PUSH HL
39151 LD A,15 msg #15 "Fire extinguished in {room}"
39153 CALL 37176
39156 POP DE
39157 POP AF
39158 RET
Prev: 39041 Up: Map Next: 39159