remove_pokemon.asm 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. _RemovePokemon:
  2. ld hl, wPartyCount
  3. ld a, [wRemoveMonFromBox]
  4. and a
  5. jr z, .asm_7b74
  6. ld hl, wNumInBox
  7. .asm_7b74
  8. ld a, [hl]
  9. dec a
  10. ld [hli], a
  11. ld a, [wWhichPokemon]
  12. ld c, a
  13. ld b, $0
  14. add hl, bc
  15. ld e, l
  16. ld d, h
  17. inc de
  18. .asm_7b81
  19. ld a, [de]
  20. inc de
  21. ld [hli], a
  22. inc a
  23. jr nz, .asm_7b81
  24. ld hl, wPartyMonOT
  25. ld d, $5
  26. ld a, [wRemoveMonFromBox]
  27. and a
  28. jr z, .asm_7b97
  29. ld hl, wBoxMonOT
  30. ld d, $13
  31. .asm_7b97
  32. ld a, [wWhichPokemon]
  33. call SkipFixedLengthTextEntries
  34. ld a, [wWhichPokemon]
  35. cp d
  36. jr nz, .asm_7ba6
  37. ld [hl], $ff
  38. ret
  39. .asm_7ba6
  40. ld d, h
  41. ld e, l
  42. ld bc, NAME_LENGTH
  43. add hl, bc
  44. ld bc, wPartyMonNicks
  45. ld a, [wRemoveMonFromBox]
  46. and a
  47. jr z, .asm_7bb8
  48. ld bc, wBoxMonNicks
  49. .asm_7bb8
  50. call CopyDataUntil
  51. ld hl, wPartyMons
  52. ld bc, wPartyMon2 - wPartyMon1
  53. ld a, [wRemoveMonFromBox]
  54. and a
  55. jr z, .asm_7bcd
  56. ld hl, wBoxMons
  57. ld bc, wBoxMon2 - wBoxMon1
  58. .asm_7bcd
  59. ld a, [wWhichPokemon]
  60. call AddNTimes
  61. ld d, h
  62. ld e, l
  63. ld a, [wRemoveMonFromBox]
  64. and a
  65. jr z, .asm_7be4
  66. ld bc, wBoxMon2 - wBoxMon1
  67. add hl, bc
  68. ld bc, wBoxMonOT
  69. jr .asm_7beb
  70. .asm_7be4
  71. ld bc, wPartyMon2 - wPartyMon1
  72. add hl, bc
  73. ld bc, wPartyMonOT
  74. .asm_7beb
  75. call CopyDataUntil
  76. ld hl, wPartyMonNicks
  77. ld a, [wRemoveMonFromBox]
  78. and a
  79. jr z, .asm_7bfa
  80. ld hl, wBoxMonNicks
  81. .asm_7bfa
  82. ld bc, NAME_LENGTH
  83. ld a, [wWhichPokemon]
  84. call AddNTimes
  85. ld d, h
  86. ld e, l
  87. ld bc, NAME_LENGTH
  88. add hl, bc
  89. ld bc, wPokedexOwned
  90. ld a, [wRemoveMonFromBox]
  91. and a
  92. jr z, .asm_7c15
  93. ld bc, wBoxMonNicksEnd
  94. .asm_7c15
  95. jp CopyDataUntil