![]() |
Routines |
| Prev: E31C | Up: Map | Next: E360 |
|
Used by the routine at Spawn_Tracked_Enemy_Entities.
Reads the direction byte from (DE), and uses it as an index into the direction animation table at Direction_Animation_Offset_Table (direction × 4). Adds the Y delta at table[index] to the byte at (DE+1) and the X delta at table[index+1] to the byte at (DE+2), writing the updated coordinates back in place. Called from Spawn_Tracked_Enemy_Entities_Record when building entity records.
|
||||
| Apply_Direction_Delta | E346 | EX DE,HL | Exchange DE and HL and load the direction table base at Direction_Animation_Offset_Table. | |
| E347 | LD HL,$E7AF | |||
| E34A | LD A,(DE) | |||
| E34B | AND %00000111 | Mask the direction byte to 3 bits. | ||
| E34D | RLA | Double the index (two left shifts) and form the zero-extended byte offset in BC. | ||
| E34E | RLA | |||
| E34F | LD C,A | |||
| E350 | LD B,$00 | |||
| E352 | ADD HL,BC | |||
| E353 | INC DE | Apply the Y delta to (DE+1) and the X delta to (DE+2) and write both coordinates back in place. | ||
| E354 | LD A,(DE) | |||
| E355 | ADD A,(HL) | |||
| E356 | LD (DE),A | |||
| E357 | INC HL | |||
| E358 | INC DE | |||
| E359 | LD A,(DE) | |||
| E35A | ADD A,(HL) | |||
| E35B | LD (DE),A | |||
| E35C | DEC DE | |||
| E35D | DEC DE | |||
| E35E | EX DE,HL | Exchange DE and HL to restore the entity pointer and return. | ||
| E35F | RET | |||
| Prev: E31C | Up: Map | Next: E360 |