doors.asm 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ; returns whether the player is standing on a door tile in carry
  2. IsPlayerStandingOnDoorTile:
  3. push de
  4. ld hl, DoorTileIDPointers
  5. ld a, [wCurMapTileset]
  6. ld de, $3
  7. call IsInArray
  8. pop de
  9. jr nc, .notStandingOnDoor
  10. inc hl
  11. ld a, [hli]
  12. ld h, [hl]
  13. ld l, a
  14. aCoord 8, 9 ; a = lower left background tile under player's sprite
  15. ld b, a
  16. .loop
  17. ld a, [hli]
  18. and a
  19. jr z, .notStandingOnDoor
  20. cp b
  21. jr nz, .loop
  22. scf
  23. ret
  24. .notStandingOnDoor
  25. and a
  26. ret
  27. DoorTileIDPointers:
  28. dbw OVERWORLD, OverworldDoorTileIDs
  29. dbw FOREST, ForestDoorTileIDs
  30. dbw MART, MartDoorTileIDs
  31. dbw HOUSE, HouseDoorTileIDs
  32. dbw FOREST_GATE, TilesetMuseumDoorTileIDs
  33. dbw MUSEUM, TilesetMuseumDoorTileIDs
  34. dbw GATE, TilesetMuseumDoorTileIDs
  35. dbw SHIP, ShipDoorTileIDs
  36. dbw LOBBY, LobbyDoorTileIDs
  37. dbw MANSION, MansionDoorTileIDs
  38. dbw LAB, LabDoorTileIDs
  39. dbw FACILITY, FacilityDoorTileIDs
  40. dbw PLATEAU, PlateauDoorTileIDs
  41. db $ff
  42. OverworldDoorTileIDs:
  43. db $1B,$58,$00
  44. ForestDoorTileIDs:
  45. db $3a,$00
  46. MartDoorTileIDs:
  47. db $5e,$00
  48. HouseDoorTileIDs:
  49. db $54,$00
  50. TilesetMuseumDoorTileIDs:
  51. db $3b,$00
  52. ShipDoorTileIDs:
  53. db $1e,$00
  54. LobbyDoorTileIDs:
  55. db $1c,$38,$1a,$00
  56. MansionDoorTileIDs:
  57. db $1a,$1c,$53,$00
  58. LabDoorTileIDs:
  59. db $34,$00
  60. FacilityDoorTileIDs:
  61. db $43,$58,$1b,$00
  62. PlateauDoorTileIDs:
  63. db $3b,$1b,$00