Routines |
Prev: 7BB5 | Up: Map | Next: 7BE4 |
Calculate isometric screen position for exterior item.
Used by the routine at item_discovered.
|
||||||||
Set C to ($40 + y - x) * 2
|
||||||||
calc_exterior_item_iso_pos | 7BD0 | DEC HL | Step HL back to itemstruct.pos.y | |||||
7BD1 | LD A,$40 | Start with $40 | ||||||
7BD3 | ADD A,(HL) | Add pos.y | ||||||
7BD4 | DEC HL | Subtract pos.x | ||||||
7BD5 | SUB (HL) | |||||||
7BD6 | ADD A,A | Double the result | ||||||
7BD7 | LD C,A | Save it in C | ||||||
Set B to ($200 - x - y - height)
|
||||||||
7BD8 | XOR A | Zero the result; this acts like $200 for our purposes | ||||||
7BD9 | SUB (HL) | Subtract pos.x | ||||||
7BDA | INC HL | Subtract pos.y | ||||||
7BDB | SUB (HL) | |||||||
7BDC | INC HL | Subtract pos.height | ||||||
7BDD | SUB (HL) | |||||||
7BDE | LD B,A | Save it in B | ||||||
Write the result to itemstruct.iso_pos
|
||||||||
7BDF | INC HL | Point HL at itemstruct.iso_pos | ||||||
7BE0 | LD (HL),C | Store BC | ||||||
7BE1 | INC HL | |||||||
7BE2 | LD (HL),B | |||||||
7BE3 | RET | Return |
Prev: 7BB5 | Up: Map | Next: 7BE4 |