pc.asm 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. ActivatePC:
  2. call SaveScreenTilesToBuffer2
  3. ld a, SFX_TURN_ON_PC
  4. call PlaySound
  5. ld hl, TurnedOnPC1Text
  6. call PrintText
  7. call WaitForSoundToFinish
  8. ld hl, wFlags_0xcd60
  9. set 3, [hl]
  10. call LoadScreenTilesFromBuffer2
  11. call Delay3
  12. PCMainMenu:
  13. callba DisplayPCMainMenu
  14. ld hl, wFlags_0xcd60
  15. set 5, [hl]
  16. call HandleMenuInput
  17. bit 1, a ;if player pressed B
  18. jp nz, LogOff
  19. ld a, [wMaxMenuItem]
  20. cp 2
  21. jr nz, .next ;if not 2 menu items (not counting log off) (2 occurs before you get the pokedex)
  22. ld a, [wCurrentMenuItem]
  23. and a
  24. jp z, BillsPC ;if current menu item id is 0, it's bills pc
  25. cp 1
  26. jr z, .playersPC ;if current menu item id is 1, it's players pc
  27. jp LogOff ;otherwise, it's 2, and you're logging off
  28. .next
  29. cp 3
  30. jr nz, .next2 ;if not 3 menu items (not counting log off) (3 occurs after you get the pokedex, before you beat the pokemon league)
  31. ld a, [wCurrentMenuItem]
  32. and a
  33. jp z, BillsPC ;if current menu item id is 0, it's bills pc
  34. cp 1
  35. jr z, .playersPC ;if current menu item id is 1, it's players pc
  36. cp 2
  37. jp z, OaksPC ;if current menu item id is 2, it's oaks pc
  38. jp LogOff ;otherwise, it's 3, and you're logging off
  39. .next2
  40. ld a, [wCurrentMenuItem]
  41. and a
  42. jp z, BillsPC ;if current menu item id is 0, it's bills pc
  43. cp 1
  44. jr z, .playersPC ;if current menu item id is 1, it's players pc
  45. cp 2
  46. jp z, OaksPC ;if current menu item id is 2, it's oaks pc
  47. cp 3
  48. jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague
  49. jp LogOff ;otherwise, it's 4, and you're logging off
  50. .playersPC
  51. ld hl, wFlags_0xcd60
  52. res 5, [hl]
  53. set 3, [hl]
  54. ld a, SFX_ENTER_PC
  55. call PlaySound
  56. call WaitForSoundToFinish
  57. ld hl, AccessedMyPCText
  58. call PrintText
  59. callba PlayerPC
  60. jr ReloadMainMenu
  61. OaksPC:
  62. ld a, SFX_ENTER_PC
  63. call PlaySound
  64. call WaitForSoundToFinish
  65. callba OpenOaksPC
  66. jr ReloadMainMenu
  67. PKMNLeague:
  68. ld a, SFX_ENTER_PC
  69. call PlaySound
  70. call WaitForSoundToFinish
  71. callba PKMNLeaguePC
  72. jr ReloadMainMenu
  73. BillsPC:
  74. ld a, SFX_ENTER_PC
  75. call PlaySound
  76. call WaitForSoundToFinish
  77. CheckEvent EVENT_MET_BILL
  78. jr nz, .billsPC ;if you've met bill, use that bill's instead of someone's
  79. ld hl, AccessedSomeonesPCText
  80. jr .printText
  81. .billsPC
  82. ld hl, AccessedBillsPCText
  83. .printText
  84. call PrintText
  85. callba BillsPC_
  86. ReloadMainMenu:
  87. xor a
  88. ld [wDoNotWaitForButtonPressAfterDisplayingText], a
  89. call ReloadMapData
  90. call UpdateSprites
  91. jp PCMainMenu
  92. LogOff:
  93. ld a, SFX_TURN_OFF_PC
  94. call PlaySound
  95. call WaitForSoundToFinish
  96. ld hl, wFlags_0xcd60
  97. res 3, [hl]
  98. res 5, [hl]
  99. ret
  100. TurnedOnPC1Text:
  101. TX_FAR _TurnedOnPC1Text
  102. db "@"
  103. AccessedBillsPCText:
  104. TX_FAR _AccessedBillsPCText
  105. db "@"
  106. AccessedSomeonesPCText:
  107. TX_FAR _AccessedSomeonesPCText
  108. db "@"
  109. AccessedMyPCText:
  110. TX_FAR _AccessedMyPCText
  111. db "@"
  112. ; removes one of the specified item ID [hItemToRemoveID] from bag (if existent)
  113. RemoveItemByID:
  114. ld hl, wBagItems
  115. ld a, [hItemToRemoveID]
  116. ld b, a
  117. xor a
  118. ld [hItemToRemoveIndex], a
  119. .loop
  120. ld a, [hli]
  121. cp -1 ; reached terminator?
  122. ret z
  123. cp b
  124. jr z, .foundItem
  125. inc hl
  126. ld a, [hItemToRemoveIndex]
  127. inc a
  128. ld [hItemToRemoveIndex], a
  129. jr .loop
  130. .foundItem
  131. ld a, $1
  132. ld [wItemQuantity], a
  133. ld a, [hItemToRemoveIndex]
  134. ld [wWhichPokemon], a
  135. ld hl, wNumBagItems
  136. jp RemoveItemFromInventory