Prev: C4EB Up: Map Next: C556
C520: Routine at C520
Used by the routine at EF54.
C520 LD C,A C=A.
C521 LD A,($BD30) B=*Count_ScenicEvents.
C524 LD B,A
C525 LD A,($BCCB) A=*CurrentRoom.
C528 LD HL,$BC78 HL=Table_ScenicEventLocations.
C52B JR $C52E Jump to C52E.
C52D INC HL Increment HL by one.
C52E CP (HL) Jump to C532 if A is not equal to *HL.
C52F JR NZ,$C532
C531 LD (HL),C Write C to *HL.
C532 DJNZ $C52D Decrease counter by one and loop back to C52D until counter is zero.
C534 LD A,C A=C.
C535 LD ($BCCB),A Write A to *CurrentRoom.
C538 LD A,($BC6F) A=*Flag_EventState.
C53B AND A Jump to C555 if A is zero.
C53C JR Z,$C555
C53E LD B,$08 B=08.
C540 LD HL,$BC70 HL=BC70.
C543 LD C,A C=A.
C544 JR $C547 Jump to C547.
C546 INC HL Increment HL by one.
C547 SRL C Shift C right.
C549 JR NC,$C553 Jump to C553 if HL is greater than or equal to A.
C54B LD A,(HL) A=*HL.
C54C PUSH HL Stash HL and BC on the stack.
C54D PUSH BC
C54E CALL Handler_UpdateItemEventCurrentRoom Call Handler_UpdateItemEventCurrentRoom.
C551 POP BC Restore BC and HL from the stack.
C552 POP HL
C553 DJNZ $C546 Decrease counter by one and loop back to C546 until counter is zero.
C555 RET Return.
Prev: C4EB Up: Map Next: C556