Prev: 899E Up: Map Next: 8A2D
89EB: Circular enemy movement: Move sprite along path
Used by the routine at handle_sprite_types_18_1C. Identical to code at move_animate_sprite_along_path
move_sprite_along_path 89EB LD A,(HL) Get path byte
89EC LD HL,(wave_data_address) Get wave data address
89EF BIT 0,(IX+$03) If bit 0 of counter is reset
89F3 JR Z,move_sprite_along_path_0 Then skip moving to next byte
89F5 INC HL Else move to next byte
move_sprite_along_path_0 89F6 BIT 7,(HL) Is bit 7 reset
89F8 JR Z,move_sprite_along_path_1 Then skip ahead
89FA AND $0F Isolate bits 0-3
89FC CP $01 If 1 (inc polar y)
89FE JR Z,move_sprite_along_path_1 Then skip ahead
8A00 CP $04 If 4 (dec polar y)
8A02 JR Z,move_sprite_along_path_1 Then skip ahead
8A04 XOR $0A Else flip bits 1 and 3
move_sprite_along_path_1 8A06 LD E,(IX+$02) Get polar x
8A09 LD D,(IX+$01) Get polar y
Identical to code at 895A except doesn't set sprite type
8A0C BIT 0,A If bit for incrementing polar y is reset
8A0E JR Z,move_sprite_along_path_2 Then skip next
8A10 INC D Increment polar y
move_sprite_along_path_2 8A11 BIT 2,A If bit for decrementing polar y is reset
8A13 JR Z,move_sprite_along_path_3 Then skip next
8A15 DEC D Decrement polar y
move_sprite_along_path_3 8A16 BIT 1,A If bit for decrementing polar x is reset
8A18 JR Z,move_sprite_along_path_4 Then skip next
8A1A DEC E Decrement polar x
move_sprite_along_path_4 8A1B BIT 3,A If bit for incrementing polar x is reset
8A1D JR Z,move_sprite_along_path_5 Then skip next
8A1F INC E Increment polar x
move_sprite_along_path_5 8A20 LD (IX+$01),D Set polar y
8A23 LD A,E Polar x
8A24 AND $3F Mod 64
8A26 LD (IX+$02),A Set polar x
8A29 INC (IX+$05) Mark for pattern reload
8A2C RET Return to return_from_sprite_handler
Prev: 899E Up: Map Next: 8A2D