bikeshop.asm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. BikeShopScript:
  2. jp EnableAutoTextBoxDrawing
  3. BikeShopTextPointers:
  4. dw BikeShopText1
  5. dw BikeShopText2
  6. dw BikeShopText3
  7. BikeShopText1:
  8. TX_ASM
  9. CheckEvent EVENT_GOT_BICYCLE
  10. jr z, .asm_260d4
  11. ld hl, BikeShopText_1d82f
  12. call PrintText
  13. jp .Done
  14. .asm_260d4
  15. ld b, BIKE_VOUCHER
  16. call IsItemInBag
  17. jr z, .asm_41190
  18. ld hl, BikeShopText_1d81f
  19. call PrintText
  20. lb bc, BICYCLE, 1
  21. call GiveItem
  22. jr nc, .BagFull
  23. ld a, BIKE_VOUCHER
  24. ld [$ffdb], a
  25. callba RemoveItemByID
  26. SetEvent EVENT_GOT_BICYCLE
  27. ld hl, BikeShopText_1d824
  28. call PrintText
  29. jr .Done
  30. .BagFull
  31. ld hl, BikeShopText_1d834
  32. call PrintText
  33. jr .Done
  34. .asm_41190
  35. ld hl, BikeShopText_1d810
  36. call PrintText
  37. xor a
  38. ld [wCurrentMenuItem], a
  39. ld [wLastMenuItem], a
  40. ld a, A_BUTTON | B_BUTTON
  41. ld [wMenuWatchedKeys], a
  42. ld a, $1
  43. ld [wMaxMenuItem], a
  44. ld a, $2
  45. ld [wTopMenuItemY], a
  46. ld a, $1
  47. ld [wTopMenuItemX], a
  48. ld hl, wd730
  49. set 6, [hl]
  50. coord hl, 0, 0
  51. ld b, $4
  52. ld c, $f
  53. call TextBoxBorder
  54. call UpdateSprites
  55. coord hl, 2, 2
  56. ld de, BikeShopMenuText
  57. call PlaceString
  58. coord hl, 8, 3
  59. ld de, BikeShopMenuPrice
  60. call PlaceString
  61. ld hl, BikeShopText_1d815
  62. call PrintText
  63. call HandleMenuInput
  64. bit 1, a
  65. jr nz, .cancel
  66. ld hl, wd730
  67. res 6, [hl]
  68. ld a, [wCurrentMenuItem]
  69. and a
  70. jr nz, .cancel
  71. ld hl, BikeShopCantAffordText
  72. call PrintText
  73. .cancel
  74. ld hl, BikeShopComeAgainText
  75. call PrintText
  76. .Done
  77. jp TextScriptEnd
  78. BikeShopMenuText:
  79. db "BICYCLE"
  80. next "CANCEL@"
  81. BikeShopMenuPrice:
  82. db "¥1000000@"
  83. BikeShopText_1d810:
  84. TX_FAR _BikeShopText_1d810
  85. db "@"
  86. BikeShopText_1d815:
  87. TX_FAR _BikeShopText_1d815
  88. db "@"
  89. BikeShopCantAffordText:
  90. TX_FAR _BikeShopCantAffordText
  91. db "@"
  92. BikeShopText_1d81f:
  93. TX_FAR _BikeShopText_1d81f
  94. db "@"
  95. BikeShopText_1d824:
  96. TX_FAR _BikeShopText_1d824
  97. TX_SFX_KEY_ITEM
  98. db "@"
  99. BikeShopComeAgainText:
  100. TX_FAR _BikeShopComeAgainText
  101. db "@"
  102. BikeShopText_1d82f:
  103. TX_FAR _BikeShopText_1d82f
  104. db "@"
  105. BikeShopText_1d834:
  106. TX_FAR _BikeShopText_1d834
  107. db "@"
  108. BikeShopText2:
  109. TX_ASM
  110. ld hl, BikeShopText_1d843
  111. call PrintText
  112. jp TextScriptEnd
  113. BikeShopText_1d843:
  114. TX_FAR _BikeShopText_1d843
  115. db "@"
  116. BikeShopText3:
  117. TX_ASM
  118. CheckEvent EVENT_GOT_BICYCLE
  119. ld hl, BikeShopText_1d861
  120. jr nz, .asm_34d2d
  121. ld hl, BikeShopText_1d85c
  122. .asm_34d2d
  123. call PrintText
  124. jp TextScriptEnd
  125. BikeShopText_1d85c:
  126. TX_FAR _BikeShopText_1d85c
  127. db "@"
  128. BikeShopText_1d861:
  129. TX_FAR _BikeShopText_1d861
  130. db "@"