Routines

28160: Update SRB for ERIC and scroll screen if necessary


Used by several routines

28160 26D2 LD H,210 210=ERIC
28162 CDB461 CALL 25012 Update SRB for ERIC's current animatory state and location
28165 2E03 LD L,3
28167 7E LD A,(HL) A=ERIC's next animatory state
28168 2C INC L
28169 5E LD E,(HL) E=ERIC's next x-coordinate
28170 2C INC L
28171 56 LD D,(HL) D=ERIC's next y-coordinate
28172 CD3061 CALL 24880 Update SRB for ERIC's new animatory state and location
28175 CD5471 CALL 29012 Make sound effect

This entry point is used by the routine at 31723:
28178 2E00 LD L,0
28180 3AFF7F LD A,(32767) A=column of play area at far left of screen
28183 CB7E BIT 7,(HL)
28185 2E01 LD L,1
28187 280D JR Z,28202 Jump if ERIC's facing left
28189 FEA0 CP 160 Is the whole of the girls' skool on-screen?
28191 C8 RET Z Return if so (no need to scroll screen)
28192 96 SUB (HL)
28193 FEEB CP 235
28195 D0 RET NC
28196 CDA062 CALL 25248 Update the display
28199 C3C261 JP 25026 Scroll the screen to the left
28202 A7 AND A Is ERIC close to the far left of the boys' skool?
28203 C8 RET Z Return if so (no need to scroll screen)
28204 96 SUB (HL)
28205 FEF7 CP 247
28207 D8 RET C
28208 CDA062 CALL 25248 Update the display
28211 C3F861 JP 25080 Scroll the screen to the right