![]() |
Routines |
Prev: 33289 | Up: Map | Next: 33521 |
Used by the routine at HandlerSword.
|
||||
Set the sword direction to match the players direction.
|
||||
SwordDirection | 33475 | LD C,0 | C=0 (down). | |
33477 | LD A,(HL) | If the byte at HL is zero then jump to SwordDirection_3. | ||
33478 | AND A | |||
33479 | JR Z,SwordDirection_3 | |||
33481 | JP P,SwordDirection_0 | |||
33484 | LD C,4 | C=4 (up). | ||
SwordDirection_0 | 33486 | DEC HL | ||
33487 | LD A,(HL) | |||
33488 | AND A | |||
33489 | JR Z,SwordDirection_1 | |||
33491 | JP P,SwordDirection_2 | |||
33494 | DEC C | |||
SwordDirection_1 | 33495 | LD A,C | ||
33496 | AND %00000111 | Keep only bits 0-2 (there are 8 animation frames). | ||
33498 | ADD A,56 | Add 56 to point to the correct frame/ sprite ID (the sword base sprite ID is: 56). | ||
33500 | LD HL,60056 | Write the new frame/ sprite ID back to PlayerWeapon. | ||
33503 | LD (HL),A | |||
33504 | RET | Return. | ||
SwordDirection_2 | 33505 | INC C | ||
33506 | JR SwordDirection_1 | Jump to SwordDirection_1. | ||
SwordDirection_3 | 33508 | DEC HL | ||
33509 | BIT 7,(HL) | |||
33511 | JR Z,SwordDirection_4 | |||
33513 | LD C,6 | C=6 (left). | ||
33515 | JR SwordDirection_1 | Jump to SwordDirection_1. | ||
SwordDirection_4 | 33517 | LD C,2 | C=2 (right). | |
33519 | JR SwordDirection_1 | Jump to SwordDirection_1. |
Prev: 33289 | Up: Map | Next: 33521 |