Prev: 36385 Up: Map Next: 36471
36390: Script routine: (58) Have Berk interact appropriately with a door in front of him
Used by the routine at 48096.
Input
BC (entry at 36393 only) Address of script data to execute upon arrival of new level
36390 LD BC,35081 Load BC with address of script data for Berk facing out of screen, ready to respond to control input
This entry point is used by the routine at 36385.
36393 LD (34266),BC Store script data address in BC at 34266
36397 LD A,(34208) Load E with game flags...
36400 LD E,A ...
36401 LD A,(34221) Load A with class of entity currently held by Berk...
36404 CP 17 ...and if this is not 17 (key)...
36406 JR NZ,36429 ...then skip ahead to 36429
Berk is holding a key
36408 LD A,7 Set door colour to 7 (white, i.e. unlocked)...
36410 LD (50712),A ...
36413 CALL 36296 Make Berk drop the key and load IY with its complex state data address
36416 LD (IY+1),0 Set depth of key to 0 (i.e. out of display)
36420 SET 4,E Set level-exit-door-unlocked flag...
36422 LD A,E ...
36423 LD (34208),A ...
36426 JP 48096 Advance HL to next script instruction and execute
Berk is not holding a key
36429 BIT 4,E If level-exit-door-unlocked flag is reset...
36431 JR Z,36462 ...then skip ahead to 36462
36433 LD D,A Load D with class of entity currently held by Berk
36434 LD A,(34207) Set zero flag if current level is level 4...
36437 CP 4 ...
36439 LD A,D Load A with class of entity currently held by Berk
36440 JR NZ,36446 If zero flag is not set (i.e. we are not on level 4) then skip ahead to 36446
Level 4
36442 CP 19 Set zero flag if class of entity currently held by Berk is 19 (Boni)
36444 JR 36448 Skip ahead to 36448
Not level 4
36446 CP 18 Set zero flag if class of entity currently held by Berk is 18 (Drutt)
36448 JR NZ,36462 If zero flag is not set (i.e. Berk is not holding Drutt on levels 1-3 or Boni on level 4) then skip ahead to 36462
Berk is holding the correct character
36450 CALL 48417 Remove Berk's current power and reset sweet / mushroom / edible eyes / sausage to its original state
36453 CALL 36638 Advance to next level and if back-to-level-1 then exit this routine and make Berk start falling
New level is not level 1
36456 LD HL,(34266) Load HL with script data address stored at 34266...
36459 JP 48098 ...and execute
Door is locked or Berk is not holding the correct character
36462 CALL 36296 Make Berk drop the entity he is holding and load IY with its complex state data address
36465 CALL 53667 Set Berk-has-been-killed flag
36468 JP 48096 Advance HL to next script instruction and execute
Prev: 36385 Up: Map Next: 36471