safarizoneentrance.asm 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. SafariZoneEntranceScript:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, SafariZoneEntranceScriptPointers
  4. ld a, [wSafariZoneEntranceCurScript]
  5. jp CallFunctionInTable
  6. SafariZoneEntranceScriptPointers:
  7. dw .SafariZoneEntranceScript0
  8. dw .SafariZoneEntranceScript1
  9. dw .SafariZoneEntranceScript2
  10. dw .SafariZoneEntranceScript3
  11. dw .SafariZoneEntranceScript4
  12. dw .SafariZoneEntranceScript5
  13. dw .SafariZoneEntranceScript6
  14. .SafariZoneEntranceScript0
  15. ld hl, .CoordsData_75221
  16. call ArePlayerCoordsInArray
  17. ret nc
  18. ld a, $3
  19. ld [hSpriteIndexOrTextID], a
  20. call DisplayTextID
  21. ld a, $ff
  22. ld [wJoyIgnore], a
  23. xor a
  24. ld [hJoyHeld], a
  25. ld a, SPRITE_FACING_RIGHT
  26. ld [wSpriteStateData1 + 9], a
  27. ld a, [wCoordIndex]
  28. cp $1
  29. jr z, .asm_7520f
  30. ld a, $2
  31. ld [wSafariZoneEntranceCurScript], a
  32. ret
  33. .asm_7520f
  34. ld a, D_RIGHT
  35. ld c, $1
  36. call SafariZoneEntranceAutoWalk
  37. ld a, $f0
  38. ld [wJoyIgnore], a
  39. ld a, $1
  40. ld [wSafariZoneEntranceCurScript], a
  41. ret
  42. .CoordsData_75221:
  43. db $02,$03
  44. db $02,$04
  45. db $FF
  46. .SafariZoneEntranceScript1
  47. call SafariZoneEntranceScript_752b4
  48. ret nz
  49. .SafariZoneEntranceScript2
  50. xor a
  51. ld [hJoyHeld], a
  52. ld [wJoyIgnore], a
  53. call UpdateSprites
  54. ld a, $4
  55. ld [hSpriteIndexOrTextID], a
  56. call DisplayTextID
  57. ld a, $ff
  58. ld [wJoyIgnore], a
  59. ret
  60. .SafariZoneEntranceScript3
  61. call SafariZoneEntranceScript_752b4
  62. ret nz
  63. xor a
  64. ld [wJoyIgnore], a
  65. ld a, $5
  66. ld [wSafariZoneEntranceCurScript], a
  67. ret
  68. .SafariZoneEntranceScript5
  69. ld a, PLAYER_DIR_DOWN
  70. ld [wPlayerMovingDirection], a
  71. CheckAndResetEvent EVENT_SAFARI_GAME_OVER
  72. jr z, .asm_7527f
  73. ResetEventReuseHL EVENT_IN_SAFARI_ZONE
  74. call UpdateSprites
  75. ld a, $f0
  76. ld [wJoyIgnore], a
  77. ld a, $6
  78. ld [hSpriteIndexOrTextID], a
  79. call DisplayTextID
  80. xor a
  81. ld [wNumSafariBalls], a
  82. ld a, D_DOWN
  83. ld c, $3
  84. call SafariZoneEntranceAutoWalk
  85. ld a, $4
  86. ld [wSafariZoneEntranceCurScript], a
  87. jr .asm_75286
  88. .asm_7527f
  89. ld a, $5
  90. ld [hSpriteIndexOrTextID], a
  91. call DisplayTextID
  92. .asm_75286
  93. ret
  94. .SafariZoneEntranceScript4
  95. call SafariZoneEntranceScript_752b4
  96. ret nz
  97. xor a
  98. ld [wJoyIgnore], a
  99. ld a, $0
  100. ld [wSafariZoneEntranceCurScript], a
  101. ret
  102. .SafariZoneEntranceScript6
  103. call SafariZoneEntranceScript_752b4
  104. ret nz
  105. call Delay3
  106. ld a, [wcf0d]
  107. ld [wSafariZoneEntranceCurScript], a
  108. ret
  109. SafariZoneEntranceAutoWalk:
  110. push af
  111. ld b, 0
  112. ld a, c
  113. ld [wSimulatedJoypadStatesIndex], a
  114. ld hl, wSimulatedJoypadStatesEnd
  115. pop af
  116. call FillMemory
  117. jp StartSimulatingJoypadStates
  118. SafariZoneEntranceScript_752b4:
  119. ld a, [wSimulatedJoypadStatesIndex]
  120. and a
  121. ret
  122. SafariZoneEntranceTextPointers:
  123. dw .SafariZoneEntranceText1
  124. dw .SafariZoneEntranceText2
  125. dw .SafariZoneEntranceText1
  126. dw .SafariZoneEntranceText4
  127. dw .SafariZoneEntranceText5
  128. dw .SafariZoneEntranceText6
  129. .SafariZoneEntranceText1
  130. TX_FAR _SafariZoneEntranceText1
  131. db "@"
  132. .SafariZoneEntranceText4
  133. TX_FAR SafariZoneEntranceText_9e6e4
  134. TX_ASM
  135. ld a, MONEY_BOX
  136. ld [wTextBoxID], a
  137. call DisplayTextBoxID
  138. call YesNoChoice
  139. ld a, [wCurrentMenuItem]
  140. and a
  141. jp nz, .PleaseComeAgain
  142. xor a
  143. ld [hMoney], a
  144. ld a, $05
  145. ld [hMoney + 1], a
  146. ld a, $00
  147. ld [hMoney + 2], a
  148. call HasEnoughMoney
  149. jr nc, .success
  150. ld hl, .NotEnoughMoneyText
  151. call PrintText
  152. jr .CantPayWalkDown
  153. .success
  154. xor a
  155. ld [wPriceTemp], a
  156. ld a, $05
  157. ld [wPriceTemp + 1], a
  158. ld a, $00
  159. ld [wPriceTemp + 2], a
  160. ld hl, wPriceTemp + 2
  161. ld de, wPlayerMoney + 2
  162. ld c, 3
  163. predef SubBCDPredef
  164. ld a, MONEY_BOX
  165. ld [wTextBoxID], a
  166. call DisplayTextBoxID
  167. ld hl, .MakePaymentText
  168. call PrintText
  169. ld a, 30
  170. ld [wNumSafariBalls], a
  171. ld a, 502 / $100
  172. ld [wSafariSteps], a
  173. ld a, 502 % $100
  174. ld [wSafariSteps + 1], a
  175. ld a, D_UP
  176. ld c, 3
  177. call SafariZoneEntranceAutoWalk
  178. SetEvent EVENT_IN_SAFARI_ZONE
  179. ResetEventReuseHL EVENT_SAFARI_GAME_OVER
  180. ld a, 3
  181. ld [wSafariZoneEntranceCurScript], a
  182. jr .done
  183. .PleaseComeAgain
  184. ld hl, .PleaseComeAgainText
  185. call PrintText
  186. .CantPayWalkDown
  187. ld a, D_DOWN
  188. ld c, 1
  189. call SafariZoneEntranceAutoWalk
  190. ld a, 4
  191. ld [wSafariZoneEntranceCurScript], a
  192. .done
  193. jp TextScriptEnd
  194. .MakePaymentText
  195. TX_FAR SafariZoneEntranceText_9e747
  196. TX_SFX_ITEM_1
  197. TX_FAR _SafariZoneEntranceText_75360
  198. db "@"
  199. .PleaseComeAgainText
  200. TX_FAR _SafariZoneEntranceText_75365
  201. db "@"
  202. .NotEnoughMoneyText
  203. TX_FAR _SafariZoneEntranceText_7536a
  204. db "@"
  205. .SafariZoneEntranceText5
  206. TX_FAR SafariZoneEntranceText_9e814
  207. TX_ASM
  208. call YesNoChoice
  209. ld a, [wCurrentMenuItem]
  210. and a
  211. jr nz, .asm_7539c
  212. ld hl, .SafariZoneEntranceText_753bb
  213. call PrintText
  214. xor a
  215. ld [wSpriteStateData1 + 9], a
  216. ld a, D_DOWN
  217. ld c, $3
  218. call SafariZoneEntranceAutoWalk
  219. ResetEvents EVENT_SAFARI_GAME_OVER, EVENT_IN_SAFARI_ZONE
  220. ld a, $0
  221. ld [wcf0d], a
  222. jr .asm_753b3
  223. .asm_7539c
  224. ld hl, .SafariZoneEntranceText_753c0
  225. call PrintText
  226. ld a, SPRITE_FACING_UP
  227. ld [wSpriteStateData1 + 9], a
  228. ld a, D_UP
  229. ld c, $1
  230. call SafariZoneEntranceAutoWalk
  231. ld a, $5
  232. ld [wcf0d], a
  233. .asm_753b3
  234. ld a, $6
  235. ld [wSafariZoneEntranceCurScript], a
  236. jp TextScriptEnd
  237. .SafariZoneEntranceText_753bb
  238. TX_FAR _SafariZoneEntranceText_753bb
  239. db "@"
  240. .SafariZoneEntranceText_753c0
  241. TX_FAR _SafariZoneEntranceText_753c0
  242. db "@"
  243. .SafariZoneEntranceText6
  244. TX_FAR _SafariZoneEntranceText_753c5
  245. db "@"
  246. .SafariZoneEntranceText2
  247. TX_ASM
  248. ld hl, .FirstTimeQuestionText
  249. call PrintText
  250. call YesNoChoice
  251. ld a, [wCurrentMenuItem]
  252. and a
  253. ld hl, .RegularText
  254. jr nz, .Explanation
  255. ld hl, .ExplanationText
  256. .Explanation
  257. call PrintText
  258. jp TextScriptEnd
  259. .FirstTimeQuestionText
  260. TX_FAR _SafariZoneEntranceText_753e6
  261. db "@"
  262. .ExplanationText
  263. TX_FAR _SafariZoneEntranceText_753eb
  264. db "@"
  265. .RegularText
  266. TX_FAR _SafariZoneEntranceText_753f0
  267. db "@"