Prev: A8E4 Up: Map Next: A922
A8F5: Handler: Wulf Pouncing
Handles the first frame of the Wulf pouncing (sprite IDs 58 and 5C). The timer in IX+02 counts down while the player is not attacking in the direction the Wulf is facing, and when it runs out the Wulf moves on to the second frame, which is handled by HandlerWulfLanding. The Wulf can hurt the player in the same way as in HandlerWulf.
Input
IX Actor record of the Wulf
HandlerWulfPouncing A8F5 CALL StoreEntity Remember the previous position of the Wulf.
A8F8 LD A,($9703) Fetch the room of the player from 9703.
A8FB CP (IX+$01) Jump to HandlerWulfPouncing_Timer if the Wulf is in a different room to the player.
A8FE JR NZ,HandlerWulfPouncing_Timer
A900 LD A,($9702) Fetch the sprite ID of the player from ImmortalData.
A903 SUB $20 Subtract 20 (the first attacking Sabreman sprite ID).
A905 CP $10 Jump to HandlerWulfPouncing_Timer if the player is not attacking.
A907 JR NC,HandlerWulfPouncing_Timer
A909 RRCA Rotate right, so that the direction of the attack is in bit 2.
A90A AND %00000100 Keep only bit 2.
A90C XOR (IX+$00) Combine with the sprite ID of the Wulf, so bit 2 shows whether the directions differ.
A90F AND %00000100 Keep only bit 2.
A911 JR NZ,HandlerWulfPouncing_Touch Jump to HandlerWulfPouncing_Touch if the player is attacking in the other direction.
HandlerWulfPouncing_Timer A913 DEC (IX+$02) Decrease the pounce timer by one and jump to HandlerWulfPouncing_Touch if it is not zero.
A916 JR NZ,HandlerWulfPouncing_Touch
A918 INC (IX+$00) Move the Wulf on to the second frame of the pounce.
A91B LD (IX+$02),$08 Set the pounce timer of the Wulf to 08.
HandlerWulfPouncing_Touch A91F JP HandlerWulf_Touch Jump to HandlerWulf_Touch to test whether the Wulf is touching the player.
Prev: A8E4 Up: Map Next: A922