pokered/scripts/Museum1F.asm

250 lines
4.8 KiB
NASM
Raw Normal View History

Museum1F_Script:
ld a, TRUE
2014-09-13 07:50:56 +00:00
ld [wAutoTextBoxDrawingControl], a
2014-05-18 18:19:10 +00:00
xor a
2014-09-13 07:50:56 +00:00
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, Museum1F_ScriptPointers
ld a, [wMuseum1FCurScript]
2014-05-18 18:19:10 +00:00
jp CallFunctionInTable
Museum1F_ScriptPointers:
def_script_pointers
dw_const Museum1FDefaultScript, SCRIPT_MUSEUM1F_DEFAULT
dw_const Museum1FNoopScript, SCRIPT_MUSEUM1F_NOOP
2014-05-18 18:19:10 +00:00
Museum1FDefaultScript:
2015-08-31 02:38:41 +00:00
ld a, [wYCoord]
cp 4
2014-05-18 18:19:10 +00:00
ret nz
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 9
jr z, .continue
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 10
2014-05-18 18:19:10 +00:00
ret nz
.continue
2014-05-18 18:19:10 +00:00
xor a
ldh [hJoyHeld], a
ld a, TEXT_MUSEUM1F_SCIENTIST1
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
jp DisplayTextID
Museum1FNoopScript:
2014-05-18 18:19:10 +00:00
ret
Museum1F_TextPointers:
def_text_pointers
dw_const Museum1FScientist1Text, TEXT_MUSEUM1F_SCIENTIST1
dw_const Museum1FGamblerText, TEXT_MUSEUM1F_GAMBLER
dw_const Museum1FScientist2Text, TEXT_MUSEUM1F_SCIENTIST2
dw_const Museum1FScientist3Text, TEXT_MUSEUM1F_SCIENTIST3
dw_const Museum1FOldAmberText, TEXT_MUSEUM1F_OLD_AMBER
Museum1FScientist1Text:
text_asm
2015-08-31 02:38:41 +00:00
ld a, [wYCoord]
cp 4
jr nz, .not_right_of_scientist
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 13
jp z, .behind_counter
jr .check_ticket
.not_right_of_scientist
cp 3
jr nz, .not_behind_counter
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 12
jp z, .behind_counter
.not_behind_counter
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BOUGHT_MUSEUM_TICKET
jr nz, .already_bought_ticket
ld hl, .GoToOtherSideText
2014-05-18 18:19:10 +00:00
call PrintText
jp .done
.check_ticket
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BOUGHT_MUSEUM_TICKET
jr z, .no_ticket
.already_bought_ticket
ld hl, .TakePlentyOfTimeText
2014-05-18 18:19:10 +00:00
call PrintText
jp .done
.no_ticket
2015-07-18 15:17:29 +00:00
ld a, MONEY_BOX
2015-02-07 10:43:08 +00:00
ld [wTextBoxID], a
2014-05-18 18:19:10 +00:00
call DisplayTextBoxID
xor a
ldh [hJoyHeld], a
ld hl, .WouldYouLikeToComeInText
2014-05-18 18:19:10 +00:00
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
2014-05-18 18:19:10 +00:00
and a
jr nz, .deny_entry
2014-05-18 18:19:10 +00:00
xor a
ldh [hMoney], a
ldh [hMoney + 1], a
2014-05-18 18:19:10 +00:00
ld a, $50
ldh [hMoney + 2], a
2014-05-18 18:19:10 +00:00
call HasEnoughMoney
jr nc, .buy_ticket
ld hl, .DontHaveEnoughMoneyText
2014-05-18 18:19:10 +00:00
call PrintText
jp .deny_entry
.buy_ticket
ld hl, .ThankYouText
2014-05-18 18:19:10 +00:00
call PrintText
2015-07-21 17:36:03 +00:00
SetEvent EVENT_BOUGHT_MUSEUM_TICKET
2014-05-18 18:19:10 +00:00
xor a
2015-07-19 03:49:52 +00:00
ld [wPriceTemp], a
ld [wPriceTemp + 1], a
2014-05-18 18:19:10 +00:00
ld a, $50
2015-07-19 03:49:52 +00:00
ld [wPriceTemp + 2], a
ld hl, wPriceTemp + 2
ld de, wPlayerMoney + 2
2014-05-18 18:19:10 +00:00
ld c, $3
predef SubBCDPredef
2015-07-18 15:17:29 +00:00
ld a, MONEY_BOX
2015-02-07 10:43:08 +00:00
ld [wTextBoxID], a
2014-05-18 18:19:10 +00:00
call DisplayTextBoxID
2015-07-19 08:46:12 +00:00
ld a, SFX_PURCHASE
2014-05-18 18:19:10 +00:00
call PlaySoundWaitForCurrent
call WaitForSoundToFinish
jr .allow_entry
.deny_entry
ld hl, .ComeAgainText
2014-05-18 18:19:10 +00:00
call PrintText
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
ld a, D_DOWN
ld [wSimulatedJoypadStatesEnd], a
call StartSimulatingJoypadStates
2014-05-18 18:19:10 +00:00
call UpdateSprites
jr .done
.allow_entry
ld a, SCRIPT_MUSEUM1F_NOOP
ld [wMuseum1FCurScript], a
jr .done
2014-05-18 18:19:10 +00:00
.behind_counter
ld hl, .DoYouKnowWhatAmberIsText
2014-05-18 18:19:10 +00:00
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
2014-05-18 18:19:10 +00:00
cp $0
jr nz, .explain_amber
ld hl, .TheresALabSomewhereText
2014-05-18 18:19:10 +00:00
call PrintText
jr .done
.explain_amber
ld hl, .AmberIsFossilizedTreeSapText
2014-05-18 18:19:10 +00:00
call PrintText
.done
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
.ComeAgainText:
text_far _Museum1FScientist1ComeAgainText
text_end
2014-05-18 18:19:10 +00:00
.WouldYouLikeToComeInText:
text_far _Museum1FScientist1WouldYouLikeToComeInText
text_end
2014-05-18 18:19:10 +00:00
.ThankYouText:
text_far _Museum1FScientist1ThankYouText
text_end
2014-05-18 18:19:10 +00:00
.DontHaveEnoughMoneyText:
text_far _Museum1FScientist1DontHaveEnoughMoneyText
text_end
2014-05-18 18:19:10 +00:00
.DoYouKnowWhatAmberIsText:
text_far _Museum1FScientist1DoYouKnowWhatAmberIsText
text_end
2014-05-18 18:19:10 +00:00
.TheresALabSomewhereText:
text_far _Museum1FScientist1TheresALabSomewhereText
text_end
2014-05-18 18:19:10 +00:00
.AmberIsFossilizedTreeSapText:
text_far _Museum1FScientist1AmberIsFossilizedTreeSapText
text_end
2014-05-18 18:19:10 +00:00
.GoToOtherSideText:
text_far _Museum1FScientist1GoToOtherSideText
text_end
2014-05-18 18:19:10 +00:00
.TakePlentyOfTimeText:
text_far _Museum1FScientist1TakePlentyOfTimeText
text_end
2014-05-18 18:19:10 +00:00
Museum1FGamblerText:
text_asm
ld hl, .Text
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
.Text:
text_far _Museum1FGamblerText
text_end
2014-05-18 18:19:10 +00:00
Museum1FScientist2Text:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_GOT_OLD_AMBER
jr nz, .got_item
ld hl, .TakeThisToAPokemonLabText
2014-05-18 18:19:10 +00:00
call PrintText
2015-08-05 21:20:29 +00:00
lb bc, OLD_AMBER, 1
2014-05-18 18:19:10 +00:00
call GiveItem
jr nc, .bag_full
2015-07-21 17:36:03 +00:00
SetEvent EVENT_GOT_OLD_AMBER
ld a, HS_OLD_AMBER
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef HideObject
ld hl, .ReceivedOldAmberText
jr .done
.bag_full
ld hl, .YouDontHaveSpaceText
jr .done
.got_item
ld hl, .GetTheOldAmberCheckText
.done
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
.TakeThisToAPokemonLabText:
text_far _Museum1FScientist2TakeThisToAPokemonLabText
text_end
2014-05-18 18:19:10 +00:00
.ReceivedOldAmberText:
text_far _Museum1FScientist2ReceivedOldAmberText
sound_get_item_1
text_end
2014-05-18 18:19:10 +00:00
.GetTheOldAmberCheckText:
text_far _Museum1FScientist2GetTheOldAmberCheckText
text_end
2014-05-18 18:19:10 +00:00
.YouDontHaveSpaceText:
text_far _Museum1FScientist2YouDontHaveSpaceText
text_end
2014-05-18 18:19:10 +00:00
Museum1FScientist3Text:
text_asm
ld hl, .Text
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
.Text:
text_far _Museum1FScientist3Text
text_end
2014-05-18 18:19:10 +00:00
Museum1FOldAmberText:
text_asm
ld hl, .Text
2014-05-18 18:19:10 +00:00
call PrintText
jp TextScriptEnd
.Text:
text_far _Museum1FOldAmberText
text_end