Prev: 39150 Up: Map Next: 39278
39151: Update state of hatch (level 3)
Used by the routine at 39137.
39151 LD IX,(34240) Load IX with address of current level's complex state data for Berk
39155 LD HL,39150 If hatch state index is zero...
39158 LD A,(HL) ...
39159 OR A ...
39160 JR Z,39176 ...then skip ahead to 39176
Hatch state index is not zero
39162 INC (HL) Increase hatch state index
39163 CP 2 If hatch state index is 2 (Berk was thrown 1 cycle ago)...
39165 JR Z,39264 ...then skip ahead to 39264
39167 CP 10 If hatch state index is 10 (Berk was thrown 9 cycles ago)...
39169 JR Z,39259 ...then skip ahead to 39259
39171 CP 11 If hatch state index is 11 (Berk was thrown 10 cycles ago)...
39173 JR Z,39269 ...then skip ahead to 39269
39175 RET Return
Hatch state index is zero
39176 BIT 0,(IX+9) If Berk's must-process-current-script-data flag is set...
39180 RET NZ ...then return
39181 LD A,(IX+0) If Berk's room is not 4 (hatch room)...
39184 CP 4 ...
39186 RET NZ ...then return
39187 LD A,(IX+6) If y-coordinate of Berk's bottom edge is not 121...
39190 CP 121 ...
39192 RET NZ ...then return
39193 LD A,(IX+5) If x-coordinate of Berk's left edge is less than 109...
39196 CP 109 ...
39198 RET C ...then return
39199 LD A,(IX+7) If x-coordinate of Berk's right edge is 120 or greater...
39202 CP 120 ...
39204 RET NC ...then return
At this point, Berk is standing on the hatch
39205 LD A,(34221) If Berk is holding the weight...
39208 CP 12 ...
39210 RET Z ...then return
39211 INC (HL) Increase hatch state index to 1
39212 CALL 36296 Make Berk drop the entity he is holding and load IY with its complex state data address
39215 LD A,(34220) If Berk's current power is not invisibility (level 3)...
39218 CP 11 ...
39220 JR NZ,39225 ...then skip ahead to 39225
39222 CALL 48417 Remove Berk's invisibility and reset corresponding edible eyes to their original position
39225 LD B,4 Move Berk up four characters...
39227 CALL 39442 ...
39230 DJNZ 39227 ...
39232 LD (IX+5),107 Set x-coordinate of Berk's left edge to 107
39236 LD (IX+7),112 Set x-coordinate of Berk's right edge to 112
39240 SET 0,(IX+9) Set Berk's must-process-current-script-data flag
39244 LD HL,59048 Set Berk's graphic layout data address to 59048...
39247 LD (IX+2),L ...(Berk being thrown left)...
39250 LD (IX+3),H ...
39253 LD HL,35523 Set current position in Berk's script data to 35523...
39256 LD (35687),HL (Berk being thrown left by hatch)
Hatch state index is 10 (Berk was thrown 9 cycles ago)
39259 LD HL,41115 Load HL with graphic layout data address of hatch half open with bat (animated)
39262 JR 39274 Skip ahead to 39274 (set hatch's GLD address to value in HL and return)
Hatch state index is 2 (Berk was thrown 1 cycle ago)
39264 LD HL,41099 Load HL with graphic layout data address of hatch fully open with bat (animated)
39267 JR 39274 Skip ahead to 39274 (set hatch's GLD address to value in HL and return)
Hatch state index is 11 (Berk was thrown 10 cycles ago)
39269 LD (HL),0 Set hatch state index to zero
39271 LD HL,41090 Load HL with graphic layout data address of hatch closed
39274 LD (44792),HL Set hatch's graphic layout data address to value in HL
39277 RET Return
Prev: 39150 Up: Map Next: 39278