Prev: 36625 Up: Map Next: 36753
36638: Advance to next level and if back to level 1 then exit calling routine and make Berk start falling
Used by the routine at 36390.
36638 LD A,(34208) Set update-scores-and-display flag...
36641 SET 5,A ...
36643 LD (34208),A ...
36646 LD IY,(34256) Load IY with address of complex state data for door just interacted with
36650 LD A,(IY+9) Load A with destination level from door's state data...
36653 LD (34207),A ...and set current level to this value
36656 CP 1 If destination level is not level 1...
36658 JR NZ,36725 ...then skip ahead to 36725
Destination level is level 1 (i.e. level 4 completed)
36660 CALL 36753 Load IX with address of Berk's complex state data and set his horizontal position to match level 1's entry door
36663 SET 2,(IX+10) Set back-to-level-1 flag
36667 LD (IX+0),10 Set Berk's room to 10
36671 LD (IX+4),103 Set y-coordinate of Berk's top edge to 103
36675 LD (IX+6),109 Set y-coordinate of Berk's bottom edge to 109
36679 LD IY,43606 Load IY with address of Boni's entry in level 1's state data for complex entities...
36683 LD (34256),IY ...and store at 34256
36687 CALL 48850 Have Berk hold Boni, and position him appropriately between Berk's hands
36690 LD (IY+1),1 Set Boni's depth to 1
36694 LD (IY+0),10 Set Boni's room to 10
36698 CALL 36296 Make Berk drop the entity he is holding and load IY with its complex state data address
36701 CALL 55516 Set Berk's can-fall flag and set his initial velocity factor to 2
36704 CALL 36739 Lock level 1's exit door and cycle attributes (full-screen)
36707 POP BC Remove top value from stack (i.e. return address to routine that called this routine)
36708 LD HL,36625 Overwrite Drutt's entry in level 1's state data for complex entities with data at 36625...
36711 LD DE,43671 ...
36714 LD BC,13 ...
36717 LDIR ...
36719 LD HL,35359 Point HL at script data for Berk starting to fall downwards...
36722 JP 48098 ...and execute
Destination level is not level 1
36725 CALL 36753 Set Berk's horizontal position to match level 1's entry door
36728 LD IY,(34242) Load IY with address of current level's complex state data for Drutt...
36732 LD (34256),IY ...and store at 34256
36736 CALL 48850 Have Berk hold Drutt, and position him appropriately between Berk's hands
36739 LD HL,34208 Reset level-exit-door-unlocked flag...
36742 RES 4,(HL) ...
36744 LD A,5 Set door colour to 5 (cyan, i.e. locked)...
36746 LD (50712),A ...
36749 CALL 36616 Cycle attributes (full-screen), clear display buffers and paint red areas outside current room
36752 RET Return
Prev: 36625 Up: Map Next: 36753