pokered/scripts/CeladonMartRoof.asm

258 lines
5.6 KiB
NASM
Raw Permalink Normal View History

CeladonMartRoof_Script:
2014-05-18 18:19:10 +00:00
jp EnableAutoTextBoxDrawing
CeladonMartRoofScript_GetDrinksInBag:
2015-08-13 05:14:31 +00:00
; construct a list of all drinks in the player's bag
2014-05-18 18:19:10 +00:00
xor a
2015-08-13 05:14:31 +00:00
ld [wFilteredBagItemsCount], a
ld de, wFilteredBagItems
ld hl, CeladonMartRoofDrinkList
2015-08-13 05:14:31 +00:00
.loop
2014-05-18 18:19:10 +00:00
ld a, [hli]
and a
2015-08-13 05:14:31 +00:00
jr z, .done
2014-05-18 18:19:10 +00:00
push hl
push de
ld [wTempByteValue], a
2014-05-18 18:19:10 +00:00
ld b, a
2015-08-13 05:14:31 +00:00
predef GetQuantityOfItemInBag
2014-05-18 18:19:10 +00:00
pop de
pop hl
ld a, b
and a
jr z, .loop
; A drink is in the bag
ld a, [wTempByteValue]
2014-05-18 18:19:10 +00:00
ld [de], a
inc de
push hl
2015-08-13 05:14:31 +00:00
ld hl, wFilteredBagItemsCount
2014-05-18 18:19:10 +00:00
inc [hl]
pop hl
2015-08-13 05:14:31 +00:00
jr .loop
.done
2014-05-18 18:19:10 +00:00
ld a, $ff
ld [de], a
ret
CeladonMartRoofDrinkList:
2014-05-18 18:19:10 +00:00
db FRESH_WATER
db SODA_POP
db LEMONADE
db 0 ; end
2014-05-18 18:19:10 +00:00
CeladonMartRoofScript_GiveDrinkToGirl:
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
ld hl, CeladonMartRoofLittleGirlGiveHerWhichDrinkText
2014-05-18 18:19:10 +00:00
call PrintText
xor a
ld [wCurrentMenuItem], a
2015-08-11 05:34:32 +00:00
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
2015-08-13 05:14:31 +00:00
ld a, [wFilteredBagItemsCount]
2014-05-18 18:19:10 +00:00
dec a
ld [wMaxMenuItem], a
2015-08-13 05:14:31 +00:00
ld a, 2
ld [wTopMenuItemY], a
2015-08-13 05:14:31 +00:00
ld a, 1
ld [wTopMenuItemX], a
2015-08-13 05:14:31 +00:00
ld a, [wFilteredBagItemsCount]
2014-05-18 18:19:10 +00:00
dec a
2015-08-13 05:14:31 +00:00
ld bc, 2
ld hl, 3
2014-05-18 18:19:10 +00:00
call AddNTimes
dec l
ld b, l
2015-08-13 05:14:31 +00:00
ld c, 12
hlcoord 0, 0
2014-05-18 18:19:10 +00:00
call TextBoxBorder
call UpdateSprites
2015-08-13 05:14:31 +00:00
call CeladonMartRoofScript_PrintDrinksInBag
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
2014-05-18 18:19:10 +00:00
call HandleMenuInput
2020-11-06 15:33:58 +00:00
bit BIT_B_BUTTON, a
2014-05-18 18:19:10 +00:00
ret nz
2015-08-13 05:14:31 +00:00
ld hl, wFilteredBagItems
ld a, [wCurrentMenuItem]
2015-08-13 05:14:31 +00:00
ld d, 0
2014-05-18 18:19:10 +00:00
ld e, a
add hl, de
ld a, [hl]
ldh [hItemToRemoveID], a
2014-05-18 18:19:10 +00:00
cp FRESH_WATER
2015-08-13 05:14:31 +00:00
jr z, .gaveFreshWater
2014-05-18 18:19:10 +00:00
cp SODA_POP
2015-08-13 05:14:31 +00:00
jr z, .gaveSodaPop
; gave Lemonade
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_GOT_TM49
2015-08-13 05:14:31 +00:00
jr nz, .alreadyGaveDrink
ld hl, CeladonMartRoofLittleGirlYayLemonadeText
2014-05-18 18:19:10 +00:00
call PrintText
call RemoveItemByIDBank12
2020-07-06 02:52:27 +00:00
lb bc, TM_TRI_ATTACK, 1
2014-05-18 18:19:10 +00:00
call GiveItem
2015-08-13 05:14:31 +00:00
jr nc, .bagFull
ld hl, CeladonMartRoofLittleGirlReceivedTM49Text
2014-05-18 18:19:10 +00:00
call PrintText
2015-07-21 17:36:03 +00:00
SetEvent EVENT_GOT_TM49
2014-05-18 18:19:10 +00:00
ret
2015-08-13 05:14:31 +00:00
.gaveSodaPop
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_GOT_TM48
2015-08-13 05:14:31 +00:00
jr nz, .alreadyGaveDrink
ld hl, CeladonMartRoofLittleGirlYaySodaPopText
2014-05-18 18:19:10 +00:00
call PrintText
call RemoveItemByIDBank12
2020-07-06 02:52:27 +00:00
lb bc, TM_ROCK_SLIDE, 1
2014-05-18 18:19:10 +00:00
call GiveItem
2015-08-13 05:14:31 +00:00
jr nc, .bagFull
ld hl, CeladonMartRoofLittleGirlReceivedTM48Text
2014-05-18 18:19:10 +00:00
call PrintText
2015-07-21 17:36:03 +00:00
SetEvent EVENT_GOT_TM48
2014-05-18 18:19:10 +00:00
ret
2015-08-13 05:14:31 +00:00
.gaveFreshWater
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_GOT_TM13
2015-08-13 05:14:31 +00:00
jr nz, .alreadyGaveDrink
ld hl, CeladonMartRoofLittleGirlYayFreshWaterText
2014-05-18 18:19:10 +00:00
call PrintText
call RemoveItemByIDBank12
2020-07-06 02:52:27 +00:00
lb bc, TM_ICE_BEAM, 1
2014-05-18 18:19:10 +00:00
call GiveItem
2015-08-13 05:14:31 +00:00
jr nc, .bagFull
ld hl, CeladonMartRoofLittleGirlReceivedTM13Text
2014-05-18 18:19:10 +00:00
call PrintText
2015-07-21 17:36:03 +00:00
SetEvent EVENT_GOT_TM13
2014-05-18 18:19:10 +00:00
ret
2015-08-13 05:14:31 +00:00
.bagFull
ld hl, CeladonMartRoofLittleGirlNoRoomText
2014-05-18 18:19:10 +00:00
jp PrintText
2015-08-13 05:14:31 +00:00
.alreadyGaveDrink
ld hl, CeladonMartRoofLittleGirlImNotThirstyText
2014-05-18 18:19:10 +00:00
jp PrintText
RemoveItemByIDBank12:
farjp RemoveItemByID
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlGiveHerWhichDrinkText:
text_far _CeladonMartRoofLittleGirlGiveHerWhichDrinkText
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlYayFreshWaterText:
text_far _CeladonMartRoofLittleGirlYayFreshWaterText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlReceivedTM13Text:
text_far _CeladonMartRoofLittleGirlReceivedTM13Text
sound_get_item_1
text_far _CeladonMartRoofLittleGirlTM13ExplanationText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlYaySodaPopText:
text_far _CeladonMartRoofLittleGirlYaySodaPopText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlReceivedTM48Text:
text_far _CeladonMartRoofLittleGirlReceivedTM48Text
sound_get_item_1
text_far _CeladonMartRoofLittleGirlTM48ExplanationText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlYayLemonadeText:
text_far _CeladonMartRoofLittleGirlYayLemonadeText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlReceivedTM49Text:
text_far _CeladonMartRoofLittleGirlReceivedTM49Text
sound_get_item_1
text_far _CeladonMartRoofLittleGirlTM49ExplanationText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlNoRoomText:
text_far _CeladonMartRoofLittleGirlNoRoomText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlImNotThirstyText:
text_far _CeladonMartRoofLittleGirlImNotThirstyText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofScript_PrintDrinksInBag:
2015-08-13 05:14:31 +00:00
ld hl, wFilteredBagItems
2014-05-18 18:19:10 +00:00
xor a
ldh [hItemCounter], a
2015-08-13 05:14:31 +00:00
.loop
2014-05-18 18:19:10 +00:00
ld a, [hli]
cp $ff
ret z
push hl
ld [wNamedObjectIndex], a
2014-05-18 18:19:10 +00:00
call GetItemName
hlcoord 2, 2
ldh a, [hItemCounter]
2015-07-14 07:16:19 +00:00
ld bc, SCREEN_WIDTH * 2
2014-05-18 18:19:10 +00:00
call AddNTimes
ld de, wNameBuffer
2014-05-18 18:19:10 +00:00
call PlaceString
2015-08-13 05:14:31 +00:00
ld hl, hItemCounter
2014-05-18 18:19:10 +00:00
inc [hl]
pop hl
2015-08-13 05:14:31 +00:00
jr .loop
2014-05-18 18:19:10 +00:00
CeladonMartRoof_TextPointers:
def_text_pointers
dw_const CeladonMartRoofSuperNerdText, TEXT_CELADONMARTROOF_SUPER_NERD
dw_const CeladonMartRoofLittleGirlText, TEXT_CELADONMARTROOF_LITTLE_GIRL
dw_const CeladonMartRoofVendingMachineText, TEXT_CELADONMARTROOF_VENDING_MACHINE1
dw_const CeladonMartRoofVendingMachineText, TEXT_CELADONMARTROOF_VENDING_MACHINE2
dw_const CeladonMartRoofVendingMachineText, TEXT_CELADONMARTROOF_VENDING_MACHINE3
dw_const CeladonMartRoofCurrentFloorSignText, TEXT_CELADONMARTROOF_CURRENT_FLOOR_SIGN
CeladonMartRoofSuperNerdText:
text_far _CeladonMartRoofSuperNerdText
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofLittleGirlText:
text_asm
2015-08-13 05:14:31 +00:00
call CeladonMartRoofScript_GetDrinksInBag
ld a, [wFilteredBagItemsCount]
2014-05-18 18:19:10 +00:00
and a
2015-08-13 05:14:31 +00:00
jr z, .noDrinksInBag
ld a, 1
2014-09-13 07:50:56 +00:00
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, .GiveHerADrinkText
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
2015-08-13 05:14:31 +00:00
jr nz, .done
call CeladonMartRoofScript_GiveDrinkToGirl
jr .done
.noDrinksInBag
ld hl, .ImThirstyText
2014-05-18 18:19:10 +00:00
call PrintText
2015-08-13 05:14:31 +00:00
.done
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
.ImThirstyText:
text_far _CeladonMartRoofLittleGirlImThirstyText
text_end
2014-05-18 18:19:10 +00:00
.GiveHerADrinkText:
text_far _CeladonMartRoofLittleGirlGiveHerADrinkText
text_end
2014-05-18 18:19:10 +00:00
CeladonMartRoofVendingMachineText:
script_vending_machine
2014-05-18 18:19:10 +00:00
CeladonMartRoofCurrentFloorSignText:
text_far _CeladonMartRoofCurrentFloorSignText
text_end