Routines |
Prev: 8209 | Up: Map | Next: 82F1 |
Used by the routine at HandlerSword.
|
||||
Set the sword direction to match the players direction.
|
||||
SwordDirection | 82C3 | LD C,$00 | C=00 (down). | |
82C5 | LD A,(HL) | If the byte at HL is zero then jump to SwordDirection_3. | ||
82C6 | AND A | |||
82C7 | JR Z,SwordDirection_3 | |||
82C9 | JP P,SwordDirection_0 | |||
82CC | LD C,$04 | C=04 (up). | ||
SwordDirection_0 | 82CE | DEC HL | ||
82CF | LD A,(HL) | |||
82D0 | AND A | |||
82D1 | JR Z,SwordDirection_1 | |||
82D3 | JP P,SwordDirection_2 | |||
82D6 | DEC C | |||
SwordDirection_1 | 82D7 | LD A,C | ||
82D8 | AND %00000111 | Keep only bits 0-2 (there are 8 animation frames). | ||
82DA | ADD A,$38 | Add 38 to point to the correct frame/ sprite ID (the sword base sprite ID is: 38). | ||
82DC | LD HL,$EA98 | Write the new frame/ sprite ID back to PlayerWeapon. | ||
82DF | LD (HL),A | |||
82E0 | RET | Return. | ||
SwordDirection_2 | 82E1 | INC C | ||
82E2 | JR SwordDirection_1 | Jump to SwordDirection_1. | ||
SwordDirection_3 | 82E4 | DEC HL | ||
82E5 | BIT 7,(HL) | |||
82E7 | JR Z,SwordDirection_4 | |||
82E9 | LD C,$06 | C=06 (left). | ||
82EB | JR SwordDirection_1 | Jump to SwordDirection_1. | ||
SwordDirection_4 | 82ED | LD C,$02 | C=02 (right). | |
82EF | JR SwordDirection_1 | Jump to SwordDirection_1. |
Prev: 8209 | Up: Map | Next: 82F1 |