![]() |
Routines |
| Prev: E3E4 | Up: Map | Next: E55B |
|
Krumlinde's RTN_Iso_Project. The new position is compared with the record's (+6 to +8), field by field, and the sprite's place on the screen (+0, +1) moved by the difference, projected: a step along +6 moves it one pixel right and half a row up, a step along +8 one pixel left and half a row up, and a step up in +7 (the height) one row up. So, give or take a constant, x is +6 less +8 and y is (+6 plus +8) / 2 plus +7, and the far corner of a room is at the top of the screen.
Half rows are rounded towards zero, and C remembers whether +6's half was rounded: when both +6 and +8 move an odd amount the same way, the two halves make a whole row between them. An odd move along one axis alone would lose its half row, but the knight moves two at a step (measured, walking each way in the simulator: x by 2 and y by 1 a step).
Called when an object is made for a room (PLACE_FROM_TEMPLATE, after setting its record to 50, its height plus 50, 50, the position its template's screen place is drawn for) and when things move (CREATURE_UPDATE, ANIMATE_AND_MOVE, BUMPED).
|
||||||||||||||
| ISO_MOVE | E4F7 | PUSH HL | Keep H, the new +8; HL: the sprite's place on the screen, x and y. | |||||||||||
| E4F8 | LD C,$00 | |||||||||||||
| E4FA | LD L,(IX+OBJ_SCREEN_X) | |||||||||||||
| E4FD | LD H,(IX+OBJ_SCREEN_Y) | |||||||||||||
| E500 | LD A,B | How far +6 moves (not at all: on to the height). | ||||||||||||
| E501 | SUB (IX+OBJ_X) | |||||||||||||
| E504 | JR Z,ISO_MOVE_3 | |||||||||||||
| E506 | LD E,A | Further: half of it, rounded down; bit 0 of C set if it was odd. | ||||||||||||
| E507 | JR C,ISO_MOVE_0 | |||||||||||||
| E509 | SRL A | |||||||||||||
| E50B | JR NC,ISO_MOVE_2 | |||||||||||||
| E50D | SET 0,C | |||||||||||||
| E50F | JR ISO_MOVE_2 | |||||||||||||
| ISO_MOVE_0 | E511 | NEG | Back: half of it, rounded towards zero; bit 1 of C set if it was odd. | |||||||||||
| E513 | SRL A | |||||||||||||
| E515 | JR NC,ISO_MOVE_1 | |||||||||||||
| E517 | SET 1,C | |||||||||||||
| ISO_MOVE_1 | E519 | NEG | ||||||||||||
| ISO_MOVE_2 | E51B | ADD A,H | y up by the half, x right by the whole; the new +6. | |||||||||||
| E51C | LD H,A | |||||||||||||
| E51D | LD A,E | |||||||||||||
| E51E | ADD A,L | |||||||||||||
| E51F | LD L,A | |||||||||||||
| E520 | LD (IX+OBJ_X),B | |||||||||||||
| ISO_MOVE_3 | E523 | LD A,D | y up by the change in the height; the new +7. | |||||||||||
| E524 | SUB (IX+OBJ_TOP) | |||||||||||||
| E527 | ADD A,H | |||||||||||||
| E528 | LD H,A | |||||||||||||
| E529 | LD (IX+OBJ_TOP),D | |||||||||||||
| E52C | POP DE | How far +8 moves. | ||||||||||||
| E52D | LD A,D | |||||||||||||
| E52E | SUB (IX+OBJ_Z) | |||||||||||||
| E531 | LD E,A | |||||||||||||
| E532 | JR C,ISO_MOVE_4 | Further: half of it, and a row more if +6 moved an odd amount the same way. | ||||||||||||
| E534 | SRL A | |||||||||||||
| E536 | JR NC,ISO_MOVE_6 | |||||||||||||
| E538 | BIT 0,C | |||||||||||||
| E53A | JR Z,ISO_MOVE_6 | |||||||||||||
| E53C | INC A | |||||||||||||
| E53D | JR ISO_MOVE_6 | |||||||||||||
| ISO_MOVE_4 | E53F | NEG | Back: the same, the other way. | |||||||||||
| E541 | SRL A | |||||||||||||
| E543 | JR NC,ISO_MOVE_5 | |||||||||||||
| E545 | BIT 1,C | |||||||||||||
| E547 | JR Z,ISO_MOVE_5 | |||||||||||||
| E549 | INC A | |||||||||||||
| ISO_MOVE_5 | E54A | NEG | ||||||||||||
| ISO_MOVE_6 | E54C | ADD A,H | y up by the half, x left by the whole. | |||||||||||
| E54D | LD H,A | |||||||||||||
| E54E | LD A,L | |||||||||||||
| E54F | SUB E | |||||||||||||
| E550 | LD L,A | |||||||||||||
| E551 | LD (IX+OBJ_Z),D | The new +8, and the sprite's new place. | ||||||||||||
| E554 | LD (IX+OBJ_SCREEN_X),L | |||||||||||||
| E557 | LD (IX+OBJ_SCREEN_Y),H | |||||||||||||
| E55A | RET | |||||||||||||
| Prev: E3E4 | Up: Map | Next: E55B |