![]() |
Routines |
| Prev: C2F6 | Up: Map | Next: C32F |
|
Used by the routines at HandleTurning and SetPlayerSpeed.
Works out the direction that an object is facing from the horizontal flip flag and bit 2 of the sprite number: bit 6 of the flags of the object is made into bit 1 of the direction, and bit 2 of the sprite number into bit 0. The direction is 00 west, 01 east, 02 north and 03 south.
|
||||||||||||
|
Bit 6 of the flags to bit 1.
|
||||||||||||
| GetFacingDirection | C319 | PUSH HL | Stash HL on the stack. | |||||||||
| C31A | LD A,(IX+$07) | Fetch the flags of the object. | ||||||||||
| C31D | RRCA | Rotate bit 6 into bit 3. | ||||||||||
| C31E | RRCA | |||||||||||
| C31F | RRCA | |||||||||||
| C320 | AND %00001000 | Keep only bit 3. | ||||||||||
| C322 | LD L,A | Copy it to L. | ||||||||||
|
Bit 2 of the sprite to bit 0.
|
||||||||||||
| C323 | LD A,(IX+$00) | Fetch the sprite number of the object. | ||||||||||
| C326 | AND %00000100 | Keep only bit 2. | ||||||||||
| C328 | OR L | Merge L. | ||||||||||
| C329 | RRCA | Rotate the two bits into place. | ||||||||||
| C32A | RRCA | |||||||||||
| C32B | AND %00000011 | Keep only bits 0 and 1. | ||||||||||
| C32D | POP HL | Restore HL from the stack. | ||||||||||
| C32E | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: C2F6 | Up: Map | Next: C32F |