lab4.asm 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Lab4Script:
  2. jp EnableAutoTextBoxDrawing
  3. Lab4TextPointers:
  4. dw Lab4Text1
  5. dw Lab4Text2
  6. Lab4Script_GetFossilsInBag:
  7. ; construct a list of all fossils in the player's bag
  8. xor a
  9. ld [wFilteredBagItemsCount], a
  10. ld de, wFilteredBagItems
  11. ld hl, FossilsList
  12. .loop
  13. ld a, [hli]
  14. and a
  15. jr z, .done
  16. push hl
  17. push de
  18. ld [wd11e], a
  19. ld b, a
  20. predef GetQuantityOfItemInBag
  21. pop de
  22. pop hl
  23. ld a, b
  24. and a
  25. jr z, .loop
  26. ; A fossil's in the bag
  27. ld a, [wd11e]
  28. ld [de], a
  29. inc de
  30. push hl
  31. ld hl, wFilteredBagItemsCount
  32. inc [hl]
  33. pop hl
  34. jr .loop
  35. .done
  36. ld a, $ff
  37. ld [de], a
  38. ret
  39. FossilsList:
  40. db DOME_FOSSIL
  41. db HELIX_FOSSIL
  42. db OLD_AMBER
  43. db $00
  44. Lab4Text1:
  45. TX_ASM
  46. CheckEvent EVENT_GAVE_FOSSIL_TO_LAB
  47. jr nz, .asm_75d96
  48. ld hl, Lab4Text_75dc6
  49. call PrintText
  50. call Lab4Script_GetFossilsInBag
  51. ld a, [wFilteredBagItemsCount]
  52. and a
  53. jr z, .asm_75d8d
  54. callba GiveFossilToCinnabarLab
  55. jr .asm_75d93
  56. .asm_75d8d
  57. ld hl, Lab4Text_75dcb
  58. call PrintText
  59. .asm_75d93
  60. jp TextScriptEnd
  61. .asm_75d96
  62. CheckEventAfterBranchReuseA EVENT_LAB_STILL_REVIVING_FOSSIL, EVENT_GAVE_FOSSIL_TO_LAB
  63. jr z, .asm_75da2
  64. ld hl, Lab4Text_75dd0
  65. call PrintText
  66. jr .asm_75d93
  67. .asm_75da2
  68. call LoadFossilItemAndMonNameBank1D
  69. ld hl, Lab4Text_75dd5
  70. call PrintText
  71. SetEvent EVENT_LAB_HANDING_OVER_FOSSIL_MON
  72. ld a, [wFossilMon]
  73. ld b, a
  74. ld c, 30
  75. call GivePokemon
  76. jr nc, .asm_75d93
  77. ResetEvents EVENT_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL, EVENT_LAB_HANDING_OVER_FOSSIL_MON
  78. jr .asm_75d93
  79. Lab4Text_75dc6:
  80. TX_FAR _Lab4Text_75dc6
  81. db "@"
  82. Lab4Text_75dcb:
  83. TX_FAR _Lab4Text_75dcb
  84. db "@"
  85. Lab4Text_75dd0:
  86. TX_FAR _Lab4Text_75dd0
  87. db "@"
  88. Lab4Text_75dd5:
  89. TX_FAR _Lab4Text_75dd5
  90. db "@"
  91. Lab4Text2:
  92. TX_ASM
  93. ld a, $3
  94. ld [wWhichTrade], a
  95. predef DoInGameTradeDialogue
  96. jp TextScriptEnd
  97. LoadFossilItemAndMonNameBank1D:
  98. jpba LoadFossilItemAndMonName