Prev: 48417 Up: Map Next: 48567
48487: Script routine: (32) Update Berk's position and state (flying) depending upon control input
Used by the routine at 48096.
Input
IX (Entry at 48487 only) Address of complex state data (current level) for Berk
IX (Entry at 48541 only) Address of complex state data for an entity
Output
HL Address of next script instruction to execute
48487 CALL 48388 Decrease remaining time for current power and if zero, exit this routine and run script data for removal of power
48490 CALL 54768 Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set...
48493 CP 130 ...and if collision was not with entity of class 130 (causes Berk and Drutt to bounce off or bang head)...
48495 JR NZ,48507 ...then skip ahead to 48507
48497 RES 6,(IX+9) Reset entity's is-flying flag
48501 LD HL,35359 Load HL with script data address for Berk starting to fall downwards
48504 JP 48096 Advance HL to next script instruction and execute
48507 LD A,(IX+6) If y-coordinate of Berk's bottom edge is 121 or greater...
48510 CP 121 ...
48512 JR NC,48527 ...then skip ahead to 48527
48514 LD A,(34219) Load A with control input
48517 BIT 0,A If right pressed...
48519 JP NZ,48593 ...then move Berk right one character, and into new room if appropriate
48522 BIT 1,A If left pressed...
48524 JP NZ,48641 ...then move Berk left one character, and into new room if appropriate
48527 LD A,(IX+6) If y-coordinate of Berk's bottom edge is less than 98...
48530 CP 98 ...
48532 JP C,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
48535 CALL 55433 Change Berk's room up one if appropriate
48538 CALL 48710 Move carried entity in front of Berk as he faces out of screen
This entry point is used by the routines at 37718 and 48096.
This entry point serves as the start of the routine triggered by instruction 34 in script data.
48541 DEC (IX+4) Decrease y-coordinates of entity's top and bottom edges by one character...
48544 DEC (IX+6) ...
48547 BIT 4,(IX+9) If entity is Berk and his carrying-something flag is reset...
48551 JP Z,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
48554 LD IY,(34260) Load IY with address of complex state data for entity held by Berk...
48558 DEC (IY+4) ...and decrease its top and bottom y-coordinates by one character...
48561 DEC (IY+6) ...
48564 JP 48096 Advance HL to next script instruction and execute
Prev: 48417 Up: Map Next: 48567