pokecrystal-board/engine/specials.asm

472 lines
6.8 KiB
NASM
Raw Normal View History

2015-02-11 15:09:35 -08:00
Special:: ; c01b
; Run script special de.
ld hl, SpecialsPointers
add hl, de
add hl, de
add hl, de
2015-02-11 15:09:35 -08:00
ld b, [hl]
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
ld a, b
rst FarCall
ret
; c029
INCLUDE "data/special_pointers.asm"
2015-02-11 15:09:35 -08:00
2018-01-05 02:05:01 -08:00
DummySpecial_c224: ; c224
2015-02-11 15:09:35 -08:00
ret
; c225
2015-11-17 09:29:37 -08:00
Special_SetPlayerPalette: ; c225
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
ld d, a
2017-12-24 09:47:30 -08:00
farcall SetPlayerPalette
2015-02-11 15:09:35 -08:00
ret
; c230
Special_GameCornerPrizeMonCheckDex: ; c230
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
dec a
call CheckCaughtMon
ret nz
ld a, [ScriptVar]
dec a
call SetSeenAndCaughtMon
call FadeToMenu
ld a, [ScriptVar]
ld [wd265], a
farcall NewPokedexEntry
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c252
2018-01-02 08:13:57 -08:00
UnusedSpecial_SeenMon: ; c252
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
dec a
call SetSeenMon
ret
; c25a
2015-10-01 13:55:24 -07:00
Special_FindGreaterThanThatLevel: ; c25a
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
ld b, a
2017-12-24 09:47:30 -08:00
farcall _FindGreaterThanThatLevel
2015-10-01 13:55:24 -07:00
jr z, FoundNone
jr FoundOne
2015-02-11 15:09:35 -08:00
2015-10-01 13:55:24 -07:00
Special_FindAtLeastThatHappy: ; c268
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
ld b, a
2017-12-24 09:47:30 -08:00
farcall _FindAtLeastThatHappy
2015-10-01 13:55:24 -07:00
jr z, FoundNone
jr FoundOne
2015-02-11 15:09:35 -08:00
2015-10-01 13:55:24 -07:00
Special_FindThatSpecies: ; c276
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
ld b, a
2017-12-24 09:47:30 -08:00
farcall _FindThatSpecies
2015-10-01 13:55:24 -07:00
jr z, FoundNone
jr FoundOne
2015-02-11 15:09:35 -08:00
2015-10-01 13:55:24 -07:00
Special_FindThatSpeciesYourTrainerID: ; c284
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
ld b, a
2017-12-24 09:47:30 -08:00
farcall _FindThatSpeciesYourTrainerID
2015-10-01 13:55:24 -07:00
jr z, FoundNone
jr FoundOne
2015-02-11 15:09:35 -08:00
2015-10-01 13:55:24 -07:00
FoundOne: ; c292
2015-12-11 08:50:49 -08:00
ld a, TRUE
2015-02-11 15:09:35 -08:00
ld [ScriptVar], a
ret
2015-10-01 13:55:24 -07:00
FoundNone: ; c298
2015-02-11 15:09:35 -08:00
xor a
ld [ScriptVar], a
ret
; c29d
2018-01-02 08:13:57 -08:00
Special_NameRival: ; 0xc29d
2015-02-11 15:09:35 -08:00
ld b, $2 ; rival
ld de, RivalName
2017-12-24 09:47:30 -08:00
farcall _NamingScreen
2015-02-11 15:09:35 -08:00
; default to "SILVER"
ld hl, RivalName
ld de, DefaultRivalName
call InitName
ret
; 0xc2b2
DefaultRivalName: ; 0xc2b2
db "SILVER@"
2018-01-02 08:13:57 -08:00
Special_NameRater: ; c2b9
2017-12-24 09:47:30 -08:00
farcall NameRater
2015-02-11 15:09:35 -08:00
ret
; c2c0
Special_TownMap: ; c2c0
2015-02-11 15:09:35 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall _TownMap
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c2cd
Special_UnownPrinter: ; c2cd
2015-02-11 15:09:35 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall UnownPrinter
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c2da
2015-11-16 19:29:54 -08:00
Special_DisplayLinkRecord: ; c2da
2015-02-11 15:09:35 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall DisplayLinkRecord
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c2e7
Special_KrissHousePC: ; c2e7
2015-02-11 15:09:35 -08:00
xor a
ld [ScriptVar], a
2017-12-24 09:47:30 -08:00
farcall _KrissHousePC
2015-02-11 15:09:35 -08:00
ld a, c
ld [ScriptVar], a
ret
; c2f6
Special_CheckMysteryGift: ; c2f6
2015-10-04 11:14:51 -07:00
ld a, BANK(sMysteryGiftItem)
2015-02-11 15:09:35 -08:00
call GetSRAMBank
2015-10-04 11:14:51 -07:00
ld a, [sMysteryGiftItem]
2015-02-11 15:09:35 -08:00
and a
jr z, .no
2015-02-11 15:09:35 -08:00
inc a
.no
2015-02-11 15:09:35 -08:00
ld [ScriptVar], a
call CloseSRAM
ret
; c309
Special_GetMysteryGiftItem: ; c309
2015-10-04 11:14:51 -07:00
ld a, BANK(sMysteryGiftItem)
2015-02-11 15:09:35 -08:00
call GetSRAMBank
2015-10-04 11:14:51 -07:00
ld a, [sMysteryGiftItem]
2015-02-11 15:09:35 -08:00
ld [CurItem], a
2015-12-11 08:50:49 -08:00
ld a, 1
2015-11-01 15:13:31 -08:00
ld [wItemQuantityChangeBuffer], a
2015-02-11 15:09:35 -08:00
ld hl, NumItems
call ReceiveItem
2015-12-11 08:50:49 -08:00
jr nc, .no_room
2015-02-11 15:09:35 -08:00
xor a
2015-10-04 11:14:51 -07:00
ld [sMysteryGiftItem], a
2015-02-11 15:09:35 -08:00
call CloseSRAM
ld a, [CurItem]
ld [wd265], a
call GetItemName
2015-10-04 11:14:51 -07:00
ld hl, .ReceiveItemText
2015-02-11 15:09:35 -08:00
call PrintText
2015-12-11 08:50:49 -08:00
ld a, TRUE
2015-02-11 15:09:35 -08:00
ld [ScriptVar], a
ret
2015-12-11 08:50:49 -08:00
.no_room
2015-02-11 15:09:35 -08:00
call CloseSRAM
xor a
ld [ScriptVar], a
ret
; c345
2015-10-04 11:14:51 -07:00
.ReceiveItemText: ; 0xc345
2015-02-11 15:09:35 -08:00
; received item
text_jump UnknownText_0x1bd3be
db "@"
; 0xc34a
2018-01-02 08:13:57 -08:00
Special_BugContestJudging: ; c34a
farcall _BugContestJudging
2015-02-11 15:09:35 -08:00
ld a, b
ld [ScriptVar], a
ret
; c355
2018-01-02 08:13:57 -08:00
Special_MapRadio: ; c355
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
ld e, a
2017-12-24 09:47:30 -08:00
farcall PlayRadio
2015-02-11 15:09:35 -08:00
ret
; c360
Special_UnownPuzzle: ; c360
2015-02-11 15:09:35 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall UnownPuzzle
2015-12-11 08:33:14 -08:00
ld a, [wSolvedUnownPuzzle]
2015-02-11 15:09:35 -08:00
ld [ScriptVar], a
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c373
Special_SlotMachine: ; c373
call Special_CheckCoins
2015-02-11 15:09:35 -08:00
ret c
ld a, BANK(_SlotMachine)
ld hl, _SlotMachine
call Special_StartGameCornerGame
2015-02-11 15:09:35 -08:00
ret
; c380
Special_CardFlip: ; c380
call Special_CheckCoins
2015-02-11 15:09:35 -08:00
ret c
ld a, BANK(_CardFlip)
ld hl, _CardFlip
call Special_StartGameCornerGame
2015-02-11 15:09:35 -08:00
ret
; c38d
Special_DummyNonfunctionalGameCornerGame: ; c38d
call Special_CheckCoins
2015-02-11 15:09:35 -08:00
ret c
ld a, BANK(_DummyGame)
ld hl, _DummyGame
call Special_StartGameCornerGame
2015-02-11 15:09:35 -08:00
ret
; c39a
Special_StartGameCornerGame: ; c39a
2015-11-01 09:44:30 -08:00
call FarQueueScript
2015-02-11 15:09:35 -08:00
call FadeToMenu
2015-11-01 09:44:30 -08:00
ld hl, wQueuedScriptBank
2015-02-11 15:09:35 -08:00
ld a, [hli]
push af
ld a, [hli]
ld h, [hl]
ld l, a
pop af
rst FarCall
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c3ae
Special_CheckCoins: ; c3ae
2015-02-11 15:09:35 -08:00
ld hl, Coins
ld a, [hli]
or [hl]
2015-12-11 08:50:49 -08:00
jr z, .no_coins
2015-02-11 15:09:35 -08:00
ld a, COIN_CASE
ld [CurItem], a
ld hl, NumItems
call CheckItem
2015-12-11 08:50:49 -08:00
jr nc, .no_coin_case
2015-02-11 15:09:35 -08:00
and a
ret
2015-12-11 08:50:49 -08:00
.no_coins
ld hl, .NoCoinsText
jr .print
2015-02-11 15:09:35 -08:00
2015-12-11 08:50:49 -08:00
.no_coin_case
ld hl, .NoCoinCaseText
2015-02-11 15:09:35 -08:00
2015-12-11 08:50:49 -08:00
.print
2015-02-11 15:09:35 -08:00
call PrintText
scf
ret
; c3d1
2015-12-11 08:50:49 -08:00
.NoCoinsText: ; 0xc3d1
2015-02-11 15:09:35 -08:00
; You have no coins.
text_jump UnknownText_0x1bd3d7
db "@"
; 0xc3d6
2015-12-11 08:50:49 -08:00
.NoCoinCaseText: ; 0xc3d6
2015-02-11 15:09:35 -08:00
; You don't have a COIN CASE.
text_jump UnknownText_0x1bd3eb
db "@"
; 0xc3db
2015-11-11 20:38:57 -08:00
Special_ClearBGPalettesBufferScreen: ; c3db
call ClearBGPalettes
call BufferScreen
2015-02-11 15:09:35 -08:00
ret
; c3e2
ScriptReturnCarry: ; c3e2
jr c, .carry
xor a
ld [ScriptVar], a
ret
.carry
ld a, 1
ld [ScriptVar], a
ret
; c3ef
2018-01-02 08:13:57 -08:00
UnusedSpecial_CheckUnusedTwoDayTimer: ; c3ef
2017-12-24 09:47:30 -08:00
farcall CheckUnusedTwoDayTimer
2015-10-24 07:34:19 -07:00
ld a, [wUnusedTwoDayTimer]
2015-02-11 15:09:35 -08:00
ld [ScriptVar], a
ret
; c3fc
2015-10-16 10:35:43 -07:00
Special_ActivateFishingSwarm: ; c3fc
2015-02-11 15:09:35 -08:00
ld a, [ScriptVar]
2015-10-16 10:35:43 -07:00
ld [wFishingSwarmFlag], a
2015-02-11 15:09:35 -08:00
ret
; c403
2015-12-09 08:38:40 -08:00
StoreSwarmMapIndices:: ; c403
2015-02-11 15:09:35 -08:00
ld a, c
and a
2015-12-09 08:38:40 -08:00
jr nz, .yanma
; swarm dark cave violet entrance
2015-02-11 15:09:35 -08:00
ld a, d
2015-12-09 08:38:40 -08:00
ld [wDunsparceMapGroup], a
2015-02-11 15:09:35 -08:00
ld a, e
2015-12-09 08:38:40 -08:00
ld [wDunsparceMapNumber], a
2015-02-11 15:09:35 -08:00
ret
2015-12-09 08:38:40 -08:00
.yanma
2015-02-11 15:09:35 -08:00
ld a, d
2015-12-09 08:38:40 -08:00
ld [wYanmaMapGroup], a
2015-02-11 15:09:35 -08:00
ld a, e
2015-12-09 08:38:40 -08:00
ld [wYanmaMapNumber], a
2015-02-11 15:09:35 -08:00
ret
; c419
2018-01-02 08:13:57 -08:00
Special_CheckPokerus: ; c419
2015-02-11 15:09:35 -08:00
; Check if a monster in your party has Pokerus
2017-12-24 09:47:30 -08:00
farcall CheckPokerus
2015-02-11 15:09:35 -08:00
jp ScriptReturnCarry
; c422
Special_ResetLuckyNumberShowFlag: ; c422
2017-12-24 09:47:30 -08:00
farcall RestartLuckyNumberCountdown
ld hl, wLuckyNumberShowFlag
2015-02-11 15:09:35 -08:00
res 0, [hl]
2017-12-24 09:47:30 -08:00
farcall LoadOrRegenerateLuckyIDNumber
2015-02-11 15:09:35 -08:00
ret
; c434
Special_CheckLuckyNumberShowFlag: ; c434
2017-12-24 09:47:30 -08:00
farcall CheckLuckyNumberShowFlag
2015-02-11 15:09:35 -08:00
jp ScriptReturnCarry
; c43d
2018-01-02 08:13:57 -08:00
Special_SnorlaxAwake: ; 0xc43d
2015-02-11 15:09:35 -08:00
; Check if the Poké Flute channel is playing, and if the player is standing
; next to Snorlax.
; outputs:
; ScriptVar is 1 if the conditions are met, otherwise 0.
; check background music
ld a, [wMapMusic]
cp MUSIC_POKE_FLUTE_CHANNEL
jr nz, .nope
ld a, [XCoord]
ld b, a
ld a, [YCoord]
ld c, a
ld hl, .ProximityCoords
.loop
ld a, [hli]
2015-12-11 08:50:49 -08:00
cp -1
2015-02-11 15:09:35 -08:00
jr z, .nope
cp b
jr nz, .nextcoord
ld a, [hli]
cp c
jr nz, .loop
2015-12-11 08:50:49 -08:00
ld a, TRUE
2015-02-11 15:09:35 -08:00
jr .done
.nextcoord
inc hl
jr .loop
.nope
xor a
.done
ld [ScriptVar], a
ret
.ProximityCoords:
2015-02-11 15:09:35 -08:00
; x, y
db 33, 8 ; left
db 34, 10 ; below
db 35, 10 ; below
db 36, 8 ; right
db 36, 9 ; right
2015-12-11 08:50:49 -08:00
db -1
2015-02-11 15:09:35 -08:00
2018-01-02 08:13:57 -08:00
Special_PlayCurMonCry: ; c472
2015-02-11 15:09:35 -08:00
ld a, [CurPartySpecies]
jp PlayMonCry
2015-02-11 15:09:35 -08:00
; c478
2018-01-02 08:13:57 -08:00
Special_GameboyCheck: ; c478
2015-02-11 15:09:35 -08:00
ld a, [hCGB]
and a
jr nz, .cgb
ld a, [hSGB]
and a
jr nz, .sgb
.gb
2018-01-11 22:40:20 -08:00
xor a ; GBCHECK_GB
2015-02-11 15:09:35 -08:00
jr .done
.sgb
2018-01-11 22:40:20 -08:00
ld a, GBCHECK_SGB
2015-02-11 15:09:35 -08:00
jr .done
.cgb
2018-01-11 22:40:20 -08:00
ld a, GBCHECK_CGB
2015-02-11 15:09:35 -08:00
.done
ld [ScriptVar], a
ret
Special_FadeOutMusic: ; c48f
ld a, LOW(MUSIC_NONE)
ld [MusicFadeID], a
ld a, HIGH(MUSIC_NONE)
ld [MusicFadeID + 1], a
2015-02-11 15:09:35 -08:00
ld a, $2
ld [MusicFade], a
ret
; c49f
Special_Diploma: ; c49f
2015-02-11 15:09:35 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall _Diploma
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c4ac
Special_PrintDiploma: ; c4ac
2015-02-11 15:09:35 -08:00
call FadeToMenu
2017-12-24 09:47:30 -08:00
farcall _PrintDiploma
2015-11-17 14:56:49 -08:00
call ExitAllMenus
2015-02-11 15:09:35 -08:00
ret
; c4b9
2018-01-02 08:13:57 -08:00
Special_TrainerHouse: ; 0xc4b9
2015-10-04 11:14:51 -07:00
ld a, BANK(sMysteryGiftTrainerHouseFlag)
2015-02-11 15:09:35 -08:00
call GetSRAMBank
2015-10-04 11:14:51 -07:00
ld a, [sMysteryGiftTrainerHouseFlag]
2015-02-11 15:09:35 -08:00
ld [ScriptVar], a
jp CloseSRAM