More BankF documentation

Also introduce bit direction constants and setpal macros
This commit is contained in:
luckytyphlosion
2015-12-29 14:53:57 -05:00
parent 47979336e2
commit f0915e2b66
25 changed files with 1205 additions and 118 deletions

View File

@@ -26,6 +26,16 @@ D_LEFT EQU %00100000
D_UP EQU %01000000
D_DOWN EQU %10000000
const_value set 0
const BIT_A_BUTTON
const BIT_B_BUTTON
const BIT_SELECT
const BIT_START
const BIT_D_RIGHT
const BIT_D_LEFT
const BIT_D_UP
const BIT_D_DOWN
SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18
@@ -207,5 +217,5 @@ const_value set 1
const PIKAHAPPY_DEPOSITED
const PIKAHAPPY_FAINTED
const PIKAHAPPY_PSNFNT
const PIKAHAPPY_10
const PIKAHAPPY_CARELESSTRAINER
const PIKAHAPPY_TRADE

View File

@@ -2,7 +2,7 @@ const_value = 0
predef_const DrawPlayerHUDAndHPBar
predef_const CopyUncompressedPicToTilemap
predef_const Func_3f073
predef_const AnimateSendingOutMon
predef_const ScaleSpriteByTwo
predef_const LoadMonBackPic
predef_const Func_79aba

View File

@@ -60,14 +60,14 @@ ModifyPikachuHappiness:: ; f430a (3d:430a)
cp PIKAHAPPY_WALKING
jr z, .checkanywhereinparty
push de
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
pop de
ret nc
jr .proceed
.checkanywhereinparty
push de
callab IsPikachuInOurParty
callab IsStarterPikachuInOurParty
pop de
ret nc

View File

@@ -10,7 +10,7 @@ Func_fc4dd:: ; fc4dd (3f:44dd)
ld a,[wd430]
bit 7,a
jr nz,.asm_fc4f8
call IsPikachuInOurParty
call IsStarterPikachuInOurParty
jr nc,.asm_fc4f8
ld a,[wWalkBikeSurfState]
and a
@@ -1477,7 +1477,7 @@ Func_fcdad: ; fcdad (3f:4dad)
pop bc
ret
IsPikachuInOurParty:: ; fcdb8 (3f:4db8)
IsStarterPikachuInOurParty:: ; fcdb8 (3f:4db8)
ld hl,wPartySpecies
ld de,wPartyMon1OTID
ld bc,wPartyMonOT
@@ -1541,13 +1541,13 @@ IsPikachuInOurParty:: ; fcdb8 (3f:4db8)
and a
ret
Func_fce0d:: ; fce0d (3f:4e0d)
IsThisPartymonStarterPikachu_Box:: ; fce0d (3f:4e0d)
ld hl,wBoxMon1
ld bc,wBoxMon2 - wBoxMon1
ld de,wBoxMonOT
jr asm_fce21
IsThisPartymonOurPikachu:: ; fce18 (3f:4e18)
IsThisPartymonStarterPikachu_Party:: ; fce18 (3f:4e18)
ld hl,wPartyMon1
ld bc,wPartyMon2 - wPartyMon1
ld de,wPartyMonOT
@@ -1590,7 +1590,7 @@ asm_fce21: ; fce21 (3f:4e21)
Func_fce5a:: ; fce5a (3f:4e5a)
push de
call IsPikachuInOurParty
call IsStarterPikachuInOurParty
pop de
ret nc
ld a,d
@@ -1619,7 +1619,7 @@ Func_fce73:: ; fce73 (3f:4e73)
cp $ff
jr z,.asm_fcea9
push hl
call IsThisPartymonOurPikachu
call IsThisPartymonStarterPikachu_Party
pop hl
jr nc,.asm_fce9e
ld a,[wWhichPokemon]

View File

@@ -565,7 +565,7 @@ MainInBattleLoop: ; 3c249 (f:4249)
call CheckNumAttacksLeft
jp MainInBattleLoop
HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd)
HandlePoisonBurnLeechSeed: ; 3c3d3 (f:43d3)
ld hl, wBattleMonHP
ld de, wBattleMonStatus
ld a, [H_WHOSETURN]
@@ -629,15 +629,15 @@ HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd)
xor a
ret
HurtByPoisonText: ; 3c42e (f:442e)
HurtByPoisonText: ; 3c444 (f:4444)
TX_FAR _HurtByPoisonText
db "@"
HurtByBurnText: ; 3c433 (f:4433)
HurtByBurnText: ; 3c449 (f:4449)
TX_FAR _HurtByBurnText
db "@"
HurtByLeechSeedText: ; 3c438 (f:4438)
HurtByLeechSeedText: ; 3c44e (f:444e)
TX_FAR _HurtByLeechSeedText
db "@"
@@ -668,12 +668,12 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: ; 3c43d (f:443d)
inc c ; damage is at least 1
.nonZeroDamage
ld hl, wPlayerBattleStatus3
ld de, W_PLAYERTOXICCOUNTER
ld de, wPlayerToxicCounter
ld a, [H_WHOSETURN]
and a
jr z, .playersTurn
ld hl, wEnemyBattleStatus3
ld de, W_ENEMYTOXICCOUNTER
ld de, wEnemyToxicCounter
.playersTurn
bit BadlyPoisoned, [hl]
jr z, .noToxic
@@ -713,7 +713,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: ; 3c43d (f:443d)
; adds bc to enemy HP
; bc isn't updated if HP substracted was capped to prevent overkill
HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4a3 (f:44a3)
HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4b9 (f:44b9)
push hl
ld hl, wEnemyMonMaxHP
ld a, [H_WHOSETURN]
@@ -763,7 +763,7 @@ HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4a3 (f:44a3)
pop hl
ret
UpdateCurMonHPBar: ; 3c4f6 (f:44f6)
UpdateCurMonHPBar: ; 3c50c (f:450c)
coord hl, 10, 9 ; tile pointer to player HP bar
ld a, [H_WHOSETURN]
and a
@@ -778,7 +778,7 @@ UpdateCurMonHPBar: ; 3c4f6 (f:44f6)
pop bc
ret
CheckNumAttacksLeft: ; 3c50f (f:450f)
CheckNumAttacksLeft: ; 3c525 (f:4525)
ld a, [wPlayerNumAttacksLeft]
and a
jr nz, .checkEnemy
@@ -794,7 +794,7 @@ CheckNumAttacksLeft: ; 3c50f (f:450f)
res UsingTrappingMove, [hl] ; enemy not using multi-turn attack like wrap any more
ret
HandleEnemyMonFainted: ; 3c525 (f:4525)
HandleEnemyMonFainted: ; 3c53b (f:453b)
xor a
ld [wInHandlePlayerMonFainted], a
call FaintEnemyPokemon
@@ -827,7 +827,7 @@ HandleEnemyMonFainted: ; 3c525 (f:4525)
ld [wActionResultOrTookBattleTurn], a
jp MainInBattleLoop
FaintEnemyPokemon: ; 0x3c567
FaintEnemyPokemon: ; 3c57d (f:457d)
call ReadPlayerMonCurHPAndStatus
ld a, [wIsInBattle]
dec a
@@ -892,6 +892,8 @@ FaintEnemyPokemon: ; 0x3c567
ld a, MUSIC_DEFEATED_WILD_MON
call PlayBattleVictoryMusic
.sfxplayed
; bug: win sfx is played for wild battles before checking for player mon HP
; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle
ld hl, wBattleMonHP
ld a, [hli]
or [hl]
@@ -953,11 +955,11 @@ FaintEnemyPokemon: ; 0x3c567
ld [wPartyGainExpFlags], a
jpab GainExperience
EnemyMonFaintedText: ; 0x3c63e
EnemyMonFaintedText: ; 3c654 (f:4654)
TX_FAR _EnemyMonFaintedText
db "@"
EndLowHealthAlarm: ; 3c643 (f:4643)
EndLowHealthAlarm: ; 3c659 (f:4659)
; This function is called when the player has the won the battle. It turns off
; the low health alarm and prevents it from reactivating until the next battle.
xor a
@@ -967,7 +969,7 @@ EndLowHealthAlarm: ; 3c643 (f:4643)
ld [wLowHealthAlarmDisabled], a ; prevent it from reactivating
ret
AnyEnemyPokemonAliveCheck: ; 3c64f (f:464f)
AnyEnemyPokemonAliveCheck: ; 3c665 (f:4665)
ld a, [wEnemyPartyCount]
ld b, a
xor a
@@ -985,10 +987,15 @@ AnyEnemyPokemonAliveCheck: ; 3c64f (f:464f)
ret
; stores whether enemy ran in Z flag
ReplaceFaintedEnemyMon: ; 3c664 (f:4664)
ReplaceFaintedEnemyMon: ; 3c67a (f:467a)
ld hl, wEnemyHPBarColor
ld e, $30
call GetBattleHealthBarColor
setpal SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
ld [rOBP0], a
ld [rOBP1], a
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
callab DrawEnemyPokeballs
ld a, [wLinkState]
cp LINK_STATE_BATTLING
@@ -1008,7 +1015,7 @@ ReplaceFaintedEnemyMon: ; 3c664 (f:4664)
inc a ; reset Z flag
ret
TrainerBattleVictory: ; 3c696 (f:4696)
TrainerBattleVictory: ; 3c6b8 (f:46b8)
call EndLowHealthAlarm
ld b, MUSIC_DEFEATED_GYM_LEADER
ld a, [wGymLeaderNo]
@@ -1020,7 +1027,7 @@ TrainerBattleVictory: ; 3c696 (f:4696)
cp SONY3 ; final battle against rival
jr nz, .notrival
ld b, MUSIC_DEFEATED_GYM_LEADER
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
set 1, [hl]
.notrival
ld a, [wLinkState]
@@ -1044,25 +1051,23 @@ TrainerBattleVictory: ; 3c696 (f:4696)
ld c, $3
predef_jump AddBCDPredef
MoneyForWinningText: ; 3c6e4 (f:46e4)
MoneyForWinningText: ; 3c706 (f:4706)
TX_FAR _MoneyForWinningText
db "@"
TrainerDefeatedText: ; 3c6e9 (f:46e9)
TrainerDefeatedText: ; 3c70b (f:470b)
TX_FAR _TrainerDefeatedText
db "@"
PlayBattleVictoryMusic: ; 3c6ee (f:46ee)
PlayBattleVictoryMusic: ; 3c710 (f:4710)
push af
ld a, $ff
ld [wNewSoundID], a
call PlaySoundWaitForCurrent
call StopAllMusic
ld c, BANK(Music_DefeatedTrainer)
pop af
call PlayMusic
jp Delay3
HandlePlayerMonFainted: ; 3c700 (f:4700)
HandlePlayerMonFainted: ; 3c71d (f:471d)
ld a, 1
ld [wInHandlePlayerMonFainted], a
call RemoveFaintedPlayerMon
@@ -1096,7 +1101,7 @@ HandlePlayerMonFainted: ; 3c700 (f:4700)
jp MainInBattleLoop
; resets flags, slides mon's pic down, plays cry, and prints fainted message
RemoveFaintedPlayerMon: ; 3c741 (f:4741)
RemoveFaintedPlayerMon: ; 3c75e (f:475e)
ld a, [wPlayerMonNumber]
ld c, a
ld hl, wPartyGainExpFlags
@@ -1134,18 +1139,42 @@ RemoveFaintedPlayerMon: ; 3c741 (f:4741)
and a ; was this called by HandleEnemyMonFainted?
ret z ; if so, return
ld a, [wPlayerMonIndex]
ld [wWhichPokemon], a
callab IsThisPartymonStarterPikachu_Party
jr nc, .notPlayerPikachu
ld e, $3
callab PlayPikachuSoundClip
jr .printText
.notPlayerPikachu
ld a, [wBattleMonSpecies]
call PlayCry
.printText
ld hl, PlayerMonFaintedText
jp PrintText
PlayerMonFaintedText: ; 3c796 (f:4796)
call PrintText
ld a, [wPlayerMonIndex]
ld [wWhichPokemon], a
ld a, [wBattleMonLevel]
ld b, a
ld a, [wEnemyMonLevel]
sub b ; enemylevel - playerlevel
; are we stronger than the opposing pokemon?
jr c, .carelessTrainer ; if so, punish the player for being careless, as they had a level advantage
cp 30 ; is the enemy 30 levels greater than us?
jr nc, .carelessTrainer ; if so, punish the player for being careless, as they shouldn't be fighting a very high leveled trainer with such a level difference
callabd_ModifyPikachuHappiness PIKAHAPPY_FAINTED
ret
.carelessTrainer
calladb_ModifyPikachuHappiness PIKAHAPPY_CARELESSTRAINER
ret
PlayerMonFaintedText: ; 3c7fa (f:47fa)
TX_FAR _PlayerMonFaintedText
db "@"
; asks if you want to use next mon
; stores whether you ran in C flag
DoUseNextMonDialogue: ; 3c79b (f:479b)
DoUseNextMonDialogue: ; 3c7ff (f:47ff)
call PrintEmptyString
call SaveScreenTilesToBuffer1
ld a, [wIsInBattle]
@@ -1173,13 +1202,13 @@ DoUseNextMonDialogue: ; 3c79b (f:479b)
ld de, wEnemyMonSpeed
jp TryRunningFromBattle
UseNextMonText: ; 3c7d3 (f:47d3)
UseNextMonText: ; 3c837 (f:4837)
TX_FAR _UseNextMonText
db "@"
; choose next player mon to send out
; stores whether enemy mon has no HP left in Z flag
ChooseNextMon: ; 3c7d8 (f:47d8)
ChooseNextMon: ; 3c83c (f:483c)
ld a, BATTLE_PARTY_MENU
ld [wPartyMenuTypeOrMessageID], a
call DisplayPartyMenu
@@ -1225,7 +1254,7 @@ ChooseNextMon: ; 3c7d8 (f:47d8)
; called when player is out of usable mons.
; prints approriate lose message, sets carry flag if player blacked out (special case for initial rival fight)
HandlePlayerBlackOut: ; 3c837 (f:4837)
HandlePlayerBlackOut: ; 3c89c (f:489c)
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .notSony1Battle
@@ -1260,21 +1289,21 @@ HandlePlayerBlackOut: ; 3c837 (f:4837)
scf
ret
Sony1WinText: ; 3c884 (f:4884)
Sony1WinText: ; 3c8e9 (f:48e9)
TX_FAR _Sony1WinText
db "@"
PlayerBlackedOutText2: ; 3c889 (f:4889)
PlayerBlackedOutText2: ; 3c8ee (f:48ee)
TX_FAR _PlayerBlackedOutText2
db "@"
LinkBattleLostText: ; 3c88e (f:488e)
LinkBattleLostText: ; 3c8f3 (f:48f3)
TX_FAR _LinkBattleLostText
db "@"
; slides pic of fainted mon downwards until it disappears
; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing
SlideDownFaintedMonPic: ; 3c893 (f:4893)
SlideDownFaintedMonPic: ; 3c8f8 (f:48f8)
ld a, [wd730]
push af
set 6, a
@@ -1293,7 +1322,7 @@ SlideDownFaintedMonPic: ; 3c893 (f:4893)
call CopyData
pop de
pop hl
ld bc, -20
ld bc, -SCREEN_WIDTH
add hl, bc
push hl
ld h, d
@@ -1305,7 +1334,7 @@ SlideDownFaintedMonPic: ; 3c893 (f:4893)
pop bc
dec b
jr nz, .rowLoop
ld bc, 20
ld bc, SCREEN_WIDTH
add hl, bc
ld de, SevenSpacesText
call PlaceString
@@ -1320,14 +1349,14 @@ SlideDownFaintedMonPic: ; 3c893 (f:4893)
ld [wd730], a
ret
SevenSpacesText: ; 3c8d7 (f:48d7)
SevenSpacesText: ; 3c93c (f:493c)
db " @"
; slides the player or enemy trainer off screen
; a is the number of tiles to slide it horizontally (always 9 for the player trainer or 8 for the enemy trainer)
; if a is 8, the slide is to the right, else it is to the left
; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing
SlideTrainerPicOffScreen: ; 3c8df (f:48df)
SlideTrainerPicOffScreen: ; 3c944 (f:4944)
ld [hSlideAmount], a
ld c, a
.slideStepLoop ; each iteration, the trainer pic is slid one tile left/right
@@ -1368,7 +1397,7 @@ SlideTrainerPicOffScreen: ; 3c8df (f:48df)
ret
; send out a trainer's mon
EnemySendOut: ; 3c90e (f:490e)
EnemySendOut: ; 3c973 (f:4973)
ld hl,wPartyGainExpFlags
xor a
ld [hl],a
@@ -1384,7 +1413,7 @@ EnemySendOut: ; 3c90e (f:490e)
predef FlagActionPredef
; don't change wPartyGainExpFlags or wPartyFoughtCurrentEnemyFlags
EnemySendOutFirstMon: ; 3c92a (f:492a)
EnemySendOutFirstMon: ; 3c98f (f:498f)
xor a
ld hl,wEnemyStatsToDouble ; clear enemy statuses
ld [hli],a
@@ -1537,17 +1566,17 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
call SaveScreenTilesToBuffer1
jp SwitchPlayerMon
TrainerAboutToUseText: ; 3ca79 (f:4a79)
TrainerAboutToUseText: ; 3cade (f:4ade)
TX_FAR _TrainerAboutToUseText
db "@"
TrainerSentOutText: ; 3ca7e (f:4a7e)
TrainerSentOutText: ; 3cae3 (f:4ae3)
TX_FAR _TrainerSentOutText
db "@"
; tests if the player has any pokemon that are not fainted
; sets d = 0 if all fainted, d != 0 if some mons are still alive
AnyPartyAlive: ; 3ca83 (f:4a83)
AnyPartyAlive: ; 3cae8 (f:4ae8)
ld a, [wPartyCount]
ld e, a
xor a
@@ -1565,7 +1594,7 @@ AnyPartyAlive: ; 3ca83 (f:4a83)
; tests if player mon has fainted
; stores whether mon has fainted in Z flag
HasMonFainted: ; 3ca97 (f:4a97)
HasMonFainted: ; 3cafc (f:4afc)
ld a, [wWhichPokemon]
ld hl, wPartyMon1HP
ld bc, wPartyMon2 - wPartyMon1
@@ -2649,7 +2678,7 @@ MoveSelectionMenu: ; 3d219 (f:5219)
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .matchedkeyspicked
ld a, [W_FLAGS_D733]
ld a, [wFlags_D733]
bit BIT_TEST_BATTLE, a
ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
jr z, .matchedkeyspicked
@@ -2677,7 +2706,7 @@ SelectMenuItem: ; 3d2fe (f:52fe)
call PlaceString
jr .select
.battleselect
ld a, [W_FLAGS_D733]
ld a, [wFlags_D733]
bit BIT_TEST_BATTLE, a
jr nz, .select
call PrintMenuItem
@@ -6181,7 +6210,7 @@ GetCurrentMove: ; 3eabe (f:6abe)
jr .selected
.player
ld de, W_PLAYERMOVENUM
ld a, [W_FLAGS_D733]
ld a, [wFlags_D733]
bit BIT_TEST_BATTLE, a
ld a, [wTestBattlePlayerSelectedMove]
jr nz, .selected
@@ -7061,11 +7090,11 @@ PoisonEffect: ; 3f24f (f:724f)
ld b, ANIM_C7
ld hl, wPlayerBattleStatus3
ld a, [de]
ld de, W_PLAYERTOXICCOUNTER
ld de, wPlayerToxicCounter
jr nz, .ok
ld b, ANIM_A9
ld hl, wEnemyBattleStatus3
ld de, W_ENEMYTOXICCOUNTER
ld de, wEnemyToxicCounter
.ok
cp TOXIC
jr nz, .normalPoison ; done if move is not Toxic

File diff suppressed because it is too large Load Diff

View File

@@ -365,7 +365,7 @@ LearnMoveFromLevelUp: ; 3b00c (e:700c)
ld a, b
and a
jr z, .done
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .done
ld a, [wMoveNum]
cp THUNDERBOLT

View File

@@ -156,7 +156,7 @@ HoFDisplayAndRecordMonInfo: ; 7030e (1c:430e)
call HoFDisplayMonInfo
ld a, [wHoFPartyMonIndex]
ld [wWhichPokemon], a
callab IsThisPartymonOurPikachu ; 3f:4e18
callab IsThisPartymonStarterPikachu_Party ; 3f:4e18
jr nc, .asm_70336
ld e, $22
callab PlayPikachuSoundClip

View File

@@ -673,7 +673,7 @@ ItemUseEvoStone: ; d7d0 (3:57d0)
ld [wcf91],a
call Func_d85d
jr nc, .noEffect
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .notPlayerPikachu
ld e, $1b
callab PlayPikachuSoundClip
@@ -2373,7 +2373,7 @@ ItemUseTMHM: ; e374 (3:6374)
ld a,d
ld [wWhichPokemon],a
callabd_ModifyPikachuHappiness PIKAHAPPY_USEDTMHM
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc,.notTeachingThunderboltOrThunderToPikachu
ld a,[wcf91]
cp a,TM_24 ; are we teaching thunderbolt to the player pikachu?

View File

@@ -225,7 +225,7 @@ BillsPCDeposit: ; 2156d (8:556d)
ld hl, wPartyCount
call DisplayMonListMenu
jp c, BillsPCMenu
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .asm_215ad
call Func_154a
jr z, .asm_215ad
@@ -235,7 +235,7 @@ BillsPCDeposit: ; 2156d (8:556d)
.asm_215ad
call DisplayDepositWithdrawMenu
jp nc, BillsPCMenu
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .asm_215c9
ld e, $1b
callab PlayPikachuSoundClip
@@ -298,7 +298,7 @@ BillsPCWithdraw: ; 21613 (8:5613)
ld a, [wWhichPokemon]
ld hl, wBoxMonNicks
call GetPartyMonName
callab Func_fce0d
callab IsThisPartymonStarterPikachu_Box
jr nc, .asm_21660
ld e, $22
callab PlayPikachuSoundClip
@@ -329,7 +329,7 @@ BillsPCRelease: ; 21690 (8:5690)
ld hl, wNumInBox
call DisplayMonListMenu
jp c, BillsPCMenu
callab Func_fce0d
callab IsThisPartymonStarterPikachu_Box
jr c, .asm_216cb
ld hl, OnceReleasedText
call PrintText

View File

@@ -51,7 +51,7 @@ RedrawPartyMenu_: ; 11886 (4:5886)
call PlaceString ; print the pokemon's name
ld a,[hPartyMonIndex]
ld [wWhichPokemon],a
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .regularMon
call Func_154a
jr z, .regularMon

View File

@@ -175,11 +175,11 @@ StatusScreen: ; 114cc (4:54cc)
jr z, .playRegularCry
cp BOX_DATA
jr z, .checkBoxData
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .playRegularCry
jr .playPikachuSoundClip
.checkBoxData
callab Func_fce0d
callab IsThisPartymonStarterPikachu_Box
jr nc, .playRegularCry
.playPikachuSoundClip
ld e, 16

View File

@@ -79,7 +79,7 @@ PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
ld a, $3
ld [wNPCMovementScriptFunctionNum], a
.done
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
set 1, [hl]
ld a, $fc
ld [wJoyIgnore], a

View File

@@ -5,7 +5,7 @@ EnterMapAnim: ; 70567 (1c:4567)
call Delay3
push hl
call GBFadeInFromWhite
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
bit 7, [hl] ; used fly out of battle?
res 7, [hl]
jr nz, .flyAnimation

View File

@@ -25,7 +25,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
and a
jp nz, .declinedHealing ; if the player chose No
call SetLastBlackoutMap
callab IsPikachuInOurParty
callab IsStarterPikachuInOurParty
jr nc, .notHealingPlayerPikachu
call Func_154a
jr nz, .notHealingPlayerPikachu
@@ -41,7 +41,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
call Func_154a
jr nz, .playerPikachuNotOnScreen
call Func_152d
callab IsPikachuInOurParty
callab IsStarterPikachuInOurParty
call c, Func_6eaa
.playerPikachuNotOnScreen
lb bc, 1, 8
@@ -60,7 +60,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
call PlaySound
call Func_154a
jr nz, .doNotReturnPikachu
callab IsPikachuInOurParty
callab IsStarterPikachuInOurParty
call c, Func_6eaa
ld a, $5
ld [wd431], a
@@ -70,7 +70,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
call Func_6ebb
ld hl, PokemonFightingFitText
call PrintText
callab IsPikachuInOurParty
callab IsStarterPikachuInOurParty
jr nc, .notInParty
lb bc, 15, 0
call Func_6ebb

View File

@@ -475,7 +475,7 @@ HandlePartyMenuInput:: ; 1226 (0:1226)
jr nz,.asm_1258
ld a,[wCurrentMenuItem]
ld [wWhichPokemon],a
callab IsThisPartymonOurPikachu ; 3f:4e18
callab IsThisPartymonStarterPikachu_Party ; 3f:4e18
jr nc,.asm_1258
call Func_154a
jr nz,.asm_128f
@@ -2476,7 +2476,7 @@ ExecuteCurMapScriptInTable:: ; 30fc (0:30fc)
pop hl
pop af
push hl
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
bit 4, [hl]
res 4, [hl]
jr z, .useProvidedIndex ; test if map script index was overridden manually
@@ -2574,7 +2574,7 @@ TalkToTrainer:: ; 3168 (0:3168)
call ReadTrainerHeaderInfo ; read end battle text
pop de
call SaveEndBattleTextPointers
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
set 4, [hl] ; activate map script index override (index is set below)
ld hl, wFlags_0xcd60
bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player)
@@ -2596,7 +2596,7 @@ CheckFightingMapTrainers:: ; 31b5 (0:31b5)
ld [wTrainerHeaderFlagBit], a
ret
.trainerEngaging
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
set 3, [hl]
ld [wEmotionBubbleSpriteIndex], a
xor a ; EXCLAMATION_BUBBLE
@@ -2958,7 +2958,7 @@ IsItemInBag:: ; 3422 (0:3422)
IsSurfingPikachuInParty:: ; 342a (0:342a)
; set bit 6 of wd472 if true
; also calls Func_3467, which is a bankswitch to IsPikachuInOurParty
; also calls Func_3467, which is a bankswitch to IsStarterPikachuInOurParty
ld a,[wd472]
and $3f
ld [wd472],a
@@ -3001,7 +3001,7 @@ IsSurfingPikachuInParty:: ; 342a (0:342a)
Func_3467:: ; 3467 (0:3467)
push hl
push bc
callab IsPikachuInOurParty
callab IsStarterPikachuInOurParty
pop bc
pop hl
ret nc

View File

@@ -267,7 +267,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245)
.battleOccurred
ld hl,wd72d
res 6,[hl]
ld hl,W_FLAGS_D733
ld hl,wFlags_D733
res 3,[hl]
ld hl,wd126
set 5,[hl]
@@ -390,7 +390,7 @@ CheckWarpsNoCollisionLoop:: ; 04d5 (0:04d5)
pop hl
jr nc,CheckWarpsNoCollisionRetry2
; if the extra check passed
ld a,[W_FLAGS_D733]
ld a,[wFlags_D733]
bit 2,a
jr nz,WarpFound1
push de
@@ -1603,7 +1603,7 @@ JoypadOverworld:: ; 0c51 (0:0c51)
ret
ForceBikeDown:: ; 0c65 (0:0c65)
ld a,[W_FLAGS_D733]
ld a,[wFlags_D733]
bit 3,a ; check if a trainer wants a challenge
ret nz
ld a,[wCurMap]
@@ -1989,7 +1989,7 @@ LoadMapData:: ; 1241 (0:1241)
ld a,[wd732]
and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp
jr nz,.restoreRomBank
ld a,[W_FLAGS_D733]
ld a,[wFlags_D733]
bit 1,a
jr nz,.restoreRomBank
call Func_21e3 ; music related

View File

@@ -17,6 +17,22 @@ lb: MACRO ; r, hi, lo
ld \1, (\2) << 8 + ((\3) & $ff)
ENDM
SHADE_BLACK EQU %11
SHADE_DARK EQU %10
SHADE_LIGHT EQU %01
SHADE_WHITE EQU %00
setpal: MACRO
ld a, \1 << 6 | \2 << 4 | \3 << 2 | \4
ENDM
setpalBGP: MACRO
setpal SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE
ENDM
setpalOBP: MACRO
setpal SHADE_BLACK, SHADE_DARK, SHADE_WHITE, SHADE_WHITE
ENDM
; Constant enumeration is useful for monsters, items, moves, etc.
const_def: MACRO

View File

@@ -499,7 +499,7 @@ TestBattle:
ld a, %10000000 ; EARTHBADGE
ld [wObtainedBadges], a
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
set 0, [hl]
; Reset the party.
@@ -2534,7 +2534,7 @@ ApplyOutOfBattlePoisonDamage: ; c3de (3:43de)
ld a, $d0
ld [hSpriteIndexOrTextID], a
call DisplayTextID
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .curMonNotPlayerPikachu
ld e, $3
callab PlayPikachuSoundClip

View File

@@ -28,7 +28,7 @@ HallofFameRoomScript2: ; 5a4bb (16:64bb)
predef HallOfFamePC
pop af
ld [wLetterPrintingDelayFlags], a
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
res 1, [hl]
inc hl
set 0, [hl]

View File

@@ -116,7 +116,7 @@ OaksLabScript4: ; 1cbd2 (7:4bd2)
ld [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
res 1, [hl]
call PlayDefaultMusic

View File

@@ -70,7 +70,7 @@ SeafoamIslands4Script0: ; 46603 (11:6603)
dec a
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
set 2, [hl]
ld a, $1
ld [wSeafoamIslands4CurScript], a
@@ -112,7 +112,7 @@ SeafoamIslands4Script2: ; 46644 (11:6644)
ld [wSpriteStateData2 + $06], a
ld hl, wd730
set 7, [hl]
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
set 2, [hl]
ld a, $3
.asm_4667b

View File

@@ -46,7 +46,7 @@ SeafoamIslands5Script0: ; 467c7 (11:67c7)
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
call StartSimulatingJoypadStates
ld hl, W_FLAGS_D733
ld hl, wFlags_D733
res 2, [hl]
ld a, $1
ld [wSeafoamIslands5CurScript], a

View File

@@ -1698,7 +1698,7 @@ wPlayerNumAttacksLeft::
W_PLAYERCONFUSEDCOUNTER:: ; d06b
ds 1
W_PLAYERTOXICCOUNTER:: ; d06c
wPlayerToxicCounter:: ; d06c
ds 1
W_PLAYERDISABLEDMOVE:: ; d06d
; high nibble: which move is disabled (1-4)
@@ -1714,7 +1714,7 @@ wEnemyNumAttacksLeft:: ; d06f
W_ENEMYCONFUSEDCOUNTER:: ; d070
ds 1
W_ENEMYTOXICCOUNTER:: ; d071
wEnemyToxicCounter:: ; d071
ds 1
wEnemyDisabledMove:: ; d072
; high nibble: which move is disabled (1-4)
@@ -3017,7 +3017,7 @@ wd732:: ; d732
; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house)
ds 1
W_FLAGS_D733:: ; d733
wFlags_D733:: ; d733
; bit 0: running a test battle
; bit 4: use variable [W_CURMAPSCRIPT] instead of the provided index for next frame's map script (used to start battle when talking to trainers)
; bit 7: used fly out of battle

View File

@@ -1755,7 +1755,7 @@ ApplyOutOfBattlePoisonDamage: ; c3de (3:43de)
ld a, $d0
ld [hSpriteIndexOrTextID], a
call DisplayTextID
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
jr nc, .curMonNotPlayerPikachu
ld e, $3
callab PlayPikachuSoundClip
@@ -3870,7 +3870,7 @@ INCLUDE "engine/battle/display_effectiveness.asm"
INCLUDE "engine/items/tmhm.asm"
Func_2fd6a: ; 2fd6a (b:7d6a)
callab IsThisPartymonOurPikachu
callab IsThisPartymonStarterPikachu_Party
ret nc
ld a, $3
ld [wd431], a
@@ -4113,7 +4113,9 @@ CeladonPrizeMenu: ; 5267d (14:667d)
SECTION "bank15",ROMX,BANK[$15]
dr $54000,$56745
dr $54000,$5525f
GainExperience: ; 5525f (15:525f)
dr $5525f,$56745
_GetSpritePosition1: ; 56745 (15:6745)
dr $56745,$56765
_GetSpritePosition2: ; 56765 (15:6765)