Prev: E286 Up: Map Next: E2D0
E2B0: Copy room item event data into working buffer
Used by the routines at CC27, CD88 and D09B.
Input
A Event number involving this object (stored at EB8F)
Also used for energy-affecting objects, e.g. orbs and mushrooms, 254 = energy drain, 253 = energy replenish
Uses room item event data sets at 7FB3 that will need checking for certain items/objects in the current room.
E2B0 LD C,A Copy event number ID into C register
E2B1 LD A,($EAD4) Horizontal position of object (high byte). This is 0 if object is on-screen. 1 means off-screen to the right, 255 means off-screen to the left.
E2B4 CP $00 If it's 0, it's on the current screen (viewport)
E2B6 JR NZ,$E2CF If not, this item is off-screen so no collisions/interactions with this object will need checking - jump straight to RET
E2B8 LD HL,($EAAD) Pointer to the event data sets at 7FB3
E2BB LD (HL),$02 Set the first byte of the set to 2, which means the event will be checked for 2 game cycles, mainly in case items are moving around.
E2BD INC HL Move along one byte
E2BE LD (HL),C Byte 2 of set - the event/interaction identifier/value to check for this item
E2BF INC HL
E2C0 LD A,($EAD3) Byte 3 of set - item's horizontal screen position (in pixels)
E2C3 LD (HL),A
E2C4 INC HL
E2C5 LD A,($EAD2) Byte 4 of set - item's vertical position (in pixels)
E2C8 LD (HL),A
E2C9 INC HL The event table is dynamic - it can shrink/expand and is recaculated each frame, so put a 255 at the start of the next set to mark the end of item sets
E2CA LD (HL),$FF
E2CC LD ($EAAD),HL Restore the address pointer at the start of this next set
E2CF RET
Prev: E286 Up: Map Next: E2D0