This commit is contained in:
dannye 2024-09-25 00:45:00 -05:00
commit a02a98ee7a
287 changed files with 2580 additions and 2463 deletions

View File

@ -15,9 +15,9 @@ Audio1_UpdateMusic::
ld a, [wMuteAudioAndPauseMusic]
and a
jr z, .applyAffects
bit 7, a
bit BIT_MUTE_AUDIO, a
jr nz, .nextChannel
set 7, a
set BIT_MUTE_AUDIO, a
ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output
ldh [rNR51], a
@ -161,7 +161,7 @@ Audio1_PlayNextNote:
cp $4
jr nz, .asm_918c
ld a, [wLowHealthAlarm]
bit 7, a
bit BIT_LOW_HEALTH_ALARM, a
jr z, .asm_918c
call Audio1_EnableChannelOutput
ret
@ -206,7 +206,7 @@ Audio1_sound_ret:
.dontDisable
jr .afterDisable
.returnFromCall
res 1, [hl]
res BIT_SOUND_CALL, [hl]
ld d, $0
ld a, c
add a
@ -386,8 +386,8 @@ Audio1_toggle_perfect_pitch:
ld hl, wChannelFlags1
add hl, bc
ld a, [hl]
xor $1
ld [hl], a ; flip bit 0 of wChannelFlags1
xor 1 << BIT_PERFECT_PITCH
ld [hl], a
jp Audio1_sound_ret
Audio1_vibrato:
@ -841,7 +841,8 @@ Audio1_note_pitch:
bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used?
jr z, .skipFrequencyInc
inc e ; if yes, increment the frequency by 1
jr nc, .skipFrequencyInc
jr nc, .skipFrequencyInc ; Likely a mistake, because `inc` does not set flag C.
; Fortunately this does not seem to affect any notes that actually occur.
inc d
.skipFrequencyInc
ld hl, wChannelFrequencyLowBytes
@ -971,7 +972,7 @@ Audio1_ApplyWavePatternAndFrequency:
cp $4
ret nz
ld a, [wLowHealthAlarm]
bit 7, a
bit BIT_LOW_HEALTH_ALARM, a
ret z
xor a
ld [wFrequencyModifier], a

View File

@ -198,7 +198,7 @@ INCLUDE "audio/sfx/pokeflute_ch5_ch6.asm"
Audio2_InitMusicVariables::
xor a
ld [wUnusedC000], a
ld [wUnusedMusicByte], a
ld [wDisableChannelOutputWhenSfxEnds], a
ld [wMusicTempo + 1], a
ld [wMusicWaveInstrument], a
@ -376,7 +376,7 @@ Audio2_StopAllAudio::
ld a, $77
ldh [rNR50], a ; full volume
xor a
ld [wUnusedC000], a
ld [wUnusedMusicByte], a
ld [wDisableChannelOutputWhenSfxEnds], a
ld [wMuteAudioAndPauseMusic], a
ld [wMusicTempo + 1], a

View File

@ -1,12 +1,12 @@
Music_DoLowHealthAlarm::
ld a, [wLowHealthAlarm]
cp $ff
cp DISABLE_LOW_HEALTH_ALARM
jr z, .disableAlarm
bit 7, a ;alarm enabled?
ret z ;nope
bit BIT_LOW_HEALTH_ALARM, a
ret z
and $7f ;low 7 bits are the timer.
and LOW_HEALTH_TIMER_MASK
jr nz, .notToneHi ;if timer > 0, play low tone.
call .playToneHi
@ -19,15 +19,15 @@ Music_DoLowHealthAlarm::
call .playToneLo ;actually set the sound registers.
.noTone
ld a, $86
ld a, CRY_SFX_END
ld [wChannelSoundIDs + CHAN5], a ;disable sound channel?
ld a, [wLowHealthAlarm]
and $7f ;decrement alarm timer.
and LOW_HEALTH_TIMER_MASK
dec a
.resetTimer
; reset the timer and enable flag.
set 7, a
set BIT_LOW_HEALTH_ALARM, a
ld [wLowHealthAlarm], a
ret

View File

@ -76,3 +76,11 @@ DEF HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff)
; wChannelFlags2 constant (only has one flag)
DEF BIT_EXECUTE_MUSIC EQU 0 ; if in execute music
; wMuteAudioAndPauseMusic
DEF BIT_MUTE_AUDIO EQU 7
; wLowHealthAlarm
DEF BIT_LOW_HEALTH_ALARM EQU 7
DEF LOW_HEALTH_TIMER_MASK EQU %01111111
DEF DISABLE_LOW_HEALTH_ALARM EQU $ff

View File

@ -37,9 +37,6 @@ DEF MOVE_ACC rb
DEF MOVE_PP rb
DEF MOVE_LENGTH EQU _RS
; D733 flags
DEF BIT_TEST_BATTLE EQU 0
; battle type constants (wBattleType values)
const_def
const BATTLE_TYPE_NORMAL ; 0
@ -77,10 +74,14 @@ DEF MAX_STAT_VALUE EQU 999
DEF ATKDEFDV_TRAINER EQU $98
DEF SPDSPCDV_TRAINER EQU $88
; wDamageMultipliers
DEF BIT_STAB_DAMAGE EQU 7
DEF EFFECTIVENESS_MASK EQU %01111111
; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags
const_def
const STORING_ENERGY ; 0 ; Bide
const THRASHING_ABOUT ; 1 ; e.g. Thrash
const THRASHING_ABOUT ; 1 ; Thrash, Petal Dance
const ATTACKING_MULTIPLE_TIMES ; 2 ; e.g. Double Kick, Fury Attack
const FLINCHED ; 3
const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly
@ -97,11 +98,11 @@ DEF SPDSPCDV_TRAINER EQU $88
const HAS_SUBSTITUTE_UP ; 4
const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam
const USING_RAGE ; 6
const SEEDED ; 7
const SEEDED ; 7 ; Leech Seed
; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags
const_def
const BADLY_POISONED ; 0
const BADLY_POISONED ; 0 ; Toxic
const HAS_LIGHT_SCREEN_UP ; 1
const HAS_REFLECT_UP ; 2
const TRANSFORMED ; 3

View File

@ -34,6 +34,12 @@ DEF TRANSFERBOTTOM EQU 2
DEF REDRAW_COL EQU 1
DEF REDRAW_ROW EQU 2
; hUILayoutFlags
const_def
const BIT_PARTY_MENU_HP_BAR ; 0
const BIT_DOUBLE_SPACED_MENU ; 1
const BIT_SINGLE_SPACED_LINES ; 2
; tile list ids
; TileIDListPointerTable indexes (see data/tilemaps.asm)
const_def

View File

@ -82,8 +82,14 @@ DEF rWave_d EQU $ff3d
DEF rWave_e EQU $ff3e
DEF rWave_f EQU $ff3f
DEF rLCDC EQU $ff40 ; LCD Control (R/W)
DEF rLCDC_ENABLE EQU 7
DEF rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE
DEF rLCDC_BG_PRIORITY EQU 0
DEF rLCDC_SPRITES_ENABLE EQU 1
DEF rLCDC_SPRITE_SIZE EQU 2
DEF rLCDC_BG_TILEMAP EQU 3
DEF rLCDC_TILE_DATA EQU 4
DEF rLCDC_WINDOW_ENABLE EQU 5
DEF rLCDC_WINDOW_TILEMAP EQU 6
DEF rLCDC_ENABLE EQU 7
DEF rSTAT EQU $ff41 ; LCDC Status (R/W)
DEF rSCY EQU $ff42 ; Scroll Y (R/W)
DEF rSCX EQU $ff43 ; Scroll X (R/W)
@ -112,3 +118,8 @@ DEF rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank
DEF rPCM12 EQU $ff76 ; Channels 1 & 2 Amplitude (R)
DEF rPCM34 EQU $ff77 ; Channels 3 & 4 Amplitude (R)
DEF rIE EQU $ffff ; Interrupt Enable (R/W)
DEF rIE_VBLANK EQU 0
DEF rIE_LCD EQU 1
DEF rIE_TIMER EQU 2
DEF rIE_SERIAL EQU 3
DEF rIE_JOYPAD EQU 4

View File

@ -1,18 +1,18 @@
; party menu icons
; used in MonPartySpritePointers (see data/icon_pointers.asm)
const_def
const ICON_MON ; $0
const ICON_BALL ; $1
const ICON_HELIX ; $2
const ICON_FAIRY ; $3
const ICON_BIRD ; $4
const ICON_WATER ; $5
const ICON_BUG ; $6
const ICON_GRASS ; $7
const ICON_SNAKE ; $8
const ICON_QUADRUPED ; $9
const ICON_PIKACHU ; $A
DEF ICON_TRADEBUBBLE EQU $e
const ICON_MON ; $0
const ICON_BALL ; $1
const ICON_HELIX ; $2
const ICON_FAIRY ; $3
const ICON_BIRD ; $4
const ICON_WATER ; $5
const ICON_BUG ; $6
const ICON_GRASS ; $7
const ICON_SNAKE ; $8
const ICON_QUADRUPED ; $9
const ICON_PIKACHU ; $a
const_skip 3
const ICON_TRADEBUBBLE ; $e
DEF ICONOFFSET EQU $40 ; difference between alternating icon frames' tile IDs

View File

@ -1,13 +1,13 @@
; joypad buttons
const_def
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
const BIT_A_BUTTON ; 0
const BIT_B_BUTTON ; 1
const BIT_SELECT ; 2
const BIT_START ; 3
const BIT_D_RIGHT ; 4
const BIT_D_LEFT ; 5
const BIT_D_UP ; 6
const BIT_D_DOWN ; 7
DEF NO_INPUT EQU 0
DEF A_BUTTON EQU 1 << BIT_A_BUTTON

View File

@ -40,9 +40,16 @@ DEF SPRITESTATEDATA2_LENGTH EQU const_value
DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16
const_def 6
const BIT_TRAINER ; 6
const BIT_ITEM ; 7
; different kinds of people events
DEF ITEM EQU $80
DEF TRAINER EQU $40
DEF TRAINER EQU 1 << BIT_TRAINER
DEF ITEM EQU 1 << BIT_ITEM
; movement status
DEF BIT_FACE_PLAYER EQU 7
DEF WALK EQU $FE
DEF STAY EQU $FF

View File

@ -44,6 +44,9 @@ DEF PC_ITEM_CAPACITY EQU 50
const NO_YES_MENU ; 7
DEF NUM_TWO_OPTION_MENUS EQU const_value
; wTwoOptionMenuID
DEF BIT_SECOND_MENU_OPTION_DEFAULT EQU 7
; menu exit method constants for list menus and the buy/sell/quit menu
DEF CHOSE_MENU_ITEM EQU 1 ; pressed A
DEF CANCELLED_MENU EQU 2 ; pressed B

View File

@ -7,15 +7,3 @@ DEF TRUE EQU 1
const FLAG_RESET ; 0
const FLAG_SET ; 1
const FLAG_TEST ; 2
; wOptions
DEF TEXT_DELAY_FAST EQU %001 ; 1
DEF TEXT_DELAY_MEDIUM EQU %011 ; 3
DEF TEXT_DELAY_SLOW EQU %101 ; 5
const_def 6
const BIT_BATTLE_SHIFT ; 6
const BIT_BATTLE_ANIMATION ; 7
; wd732 flags
DEF BIT_DEBUG_MODE EQU 1

View File

@ -1,14 +1,20 @@
; OAM flags used by this game
DEF OAMFLAG_ENDOFDATA EQU %00000001 ; pseudo OAM flag, only used by game logic
DEF OAMFLAG_CANBEMASKED EQU %00000010 ; pseudo OAM flag, only used by game logic
; Pseudo-OAM flags used by game logic
const_def
const BIT_END_OF_OAM_DATA ; 0
const BIT_SPRITE_UNDER_GRASS ; 1
; Used in SpriteFacingAndAnimationTable (see data/sprites/facings.asm)
DEF FACING_END EQU 1 << BIT_END_OF_OAM_DATA
DEF UNDER_GRASS EQU 1 << BIT_SPRITE_UNDER_GRASS
; OAM attribute flags
DEF OAM_PALETTE EQU %111
DEF OAM_TILE_BANK EQU 3
DEF OAM_OBP_NUM EQU 4 ; Non CGB Mode Only
DEF OAM_X_FLIP EQU 5
DEF OAM_Y_FLIP EQU 6
DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
DEF OAM_PALETTE EQU %111
const_def 3
const OAM_TILE_BANK ; 3
const OAM_OBP_NUM ; 4 ; Non CGB Mode Only
const OAM_X_FLIP ; 5
const OAM_Y_FLIP ; 6
const OAM_PRIORITY ; 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
; OAM attribute masks
DEF OAM_HIGH_PALS EQU 1 << 2 ; palettes %100-%111 are OBP1

156
constants/ram_constants.asm Normal file
View File

@ -0,0 +1,156 @@
; wSlotMachineFlags
const_def 6
const BIT_SLOTS_CAN_WIN ; 6
const BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR ; 7
; wMiscFlags
const_def
const BIT_SEEN_BY_TRAINER ; 0
const BIT_BOULDER_DUST ; 1
const BIT_TURNING ; 2
const BIT_USING_GENERIC_PC ; 3
const BIT_NO_SPRITE_UPDATES ; 4
const BIT_NO_MENU_BUTTON_SOUND ; 5
const BIT_TRIED_PUSH_BOULDER ; 6
const BIT_PUSHED_BOULDER ; 7
; wAutoTextBoxDrawingControl
DEF BIT_NO_AUTO_TEXT_BOX EQU 0
; wTextPredefFlag
DEF BIT_TEXT_PREDEF EQU 0
; wFontLoaded
DEF BIT_FONT_LOADED EQU 0
; wCurrentMapScriptFlags
const_def 5
const BIT_CUR_MAP_LOADED_1 ; 5
const BIT_CUR_MAP_LOADED_2 ; 6
const BIT_CUR_MAP_USED_ELEVATOR ; 7
; wOptions
DEF TEXT_DELAY_MASK EQU %000111
DEF SOUND_MASK EQU %110000
const_def 6
const BIT_BATTLE_SHIFT ; 6
const BIT_BATTLE_ANIMATION ; 7
DEF TEXT_DELAY_FAST EQU %001 ; 1
DEF TEXT_DELAY_MEDIUM EQU %011 ; 3
DEF TEXT_DELAY_SLOW EQU %101 ; 5
; wLetterPrintingDelayFlags
const_def
const BIT_FAST_TEXT_DELAY ; 0
const BIT_TEXT_DELAY ; 1
; wCurMapTileset
DEF BIT_NO_PREVIOUS_MAP EQU 7
; wCurrentBoxNum
DEF BIT_HAS_CHANGED_BOXES EQU 7
; wObtainedBadges, wBeatGymFlags
const_def
const BIT_BOULDERBADGE ; 0
const BIT_CASCADEBADGE ; 1
const BIT_THUNDERBADGE ; 2
const BIT_RAINBOWBADGE ; 3
const BIT_SOULBADGE ; 4
const BIT_MARSHBADGE ; 5
const BIT_VOLCANOBADGE ; 6
const BIT_EARTHBADGE ; 7
DEF NUM_BADGES EQU const_value
; wStatusFlags1
const_def
const BIT_STRENGTH_ACTIVE ; 0
const BIT_SURF_ALLOWED ; 1
const_skip ; 2 ; unused
const BIT_GOT_OLD_ROD ; 3
const BIT_GOT_GOOD_ROD ; 4
const BIT_GOT_SUPER_ROD ; 5
const BIT_GAVE_SAFFRON_GUARDS_DRINK ; 6
const BIT_UNUSED_CARD_KEY ; 7
; wStatusFlags2
const_def
const BIT_WILD_ENCOUNTER_COOLDOWN ; 0
const BIT_NO_AUDIO_FADE_OUT ; 1
; wStatusFlags3
const_def
const BIT_INIT_TRADE_CENTER_FACING ; 0
const_skip 2 ; 1-2 ; unused
const BIT_WARP_FROM_CUR_SCRIPT ; 3
const BIT_ON_DUNGEON_WARP ; 4
const BIT_NO_NPC_FACE_PLAYER ; 5
const BIT_TALKED_TO_TRAINER ; 6
const BIT_PRINT_END_BATTLE_TEXT ; 7
; wStatusFlags4
const_def
const BIT_GOT_LAPRAS ; 0
const BIT_UNKNOWN_4_1 ; 1
const BIT_USED_POKECENTER ; 2
const BIT_GOT_STARTER ; 3
const BIT_NO_BATTLES ; 4
const BIT_BATTLE_OVER_OR_BLACKOUT ; 5
const BIT_LINK_CONNECTED ; 6
const BIT_INIT_SCRIPTED_MOVEMENT ; 7
; wStatusFlags5
const_def
const BIT_SCRIPTED_NPC_MOVEMENT ; 0
const BIT_UNKNOWN_5_1 ; 1
const BIT_UNKNOWN_5_2 ; 2
const_skip ; 3 ; unused
const BIT_UNKNOWN_5_4 ; 4
const BIT_DISABLE_JOYPAD ; 5
const BIT_NO_TEXT_DELAY ; 6
const BIT_SCRIPTED_MOVEMENT_STATE ; 7
; wStatusFlags6
const_def
const BIT_GAME_TIMER_COUNTING ; 0
const BIT_DEBUG_MODE ; 1
const BIT_FLY_OR_DUNGEON_WARP ; 2
const BIT_FLY_WARP ; 3
const BIT_DUNGEON_WARP ; 4
const BIT_ALWAYS_ON_BIKE ; 5
const BIT_ESCAPE_WARP ; 6
; wStatusFlags7
const_def
const BIT_TEST_BATTLE ; 0
const BIT_NO_MAP_MUSIC ; 1
const BIT_FORCED_WARP ; 2
const BIT_TRAINER_BATTLE ; 3
const BIT_USE_CUR_MAP_SCRIPT ; 4
const_skip 2 ; 5-6 ; unused
const BIT_USED_FLY ; 7
; wElite4Flags
const_def
const BIT_UNUSED_BEAT_ELITE_4 ; 0
const BIT_STARTED_ELITE_4 ; 1
; wMovementFlags
const_def
const BIT_STANDING_ON_DOOR ; 0
const BIT_EXITING_DOOR ; 1
const BIT_STANDING_ON_WARP ; 2
const_skip 3 ; 3-5 ; unused
const BIT_LEDGE_OR_FISHING ; 6
const BIT_SPINNING ; 7
; hFindPathFlags
const_def
const BIT_PATH_FOUND_Y ; 0
const BIT_PATH_FOUND_X ; 1
; hNPCPlayerRelativePosFlags
const_def
const BIT_PLAYER_LOWER_Y ; 0
const BIT_PLAYER_LOWER_X ; 1

View File

@ -44,19 +44,6 @@ DEF NUM_NPC_TRADES EQU const_value
const TRADE_DIALOGSET_EVOLUTION
const TRADE_DIALOGSET_HAPPY
; badges
; wObtainedBadges and wBeatGymFlags bits
const_def
const BIT_BOULDERBADGE ; 0
const BIT_CASCADEBADGE ; 1
const BIT_THUNDERBADGE ; 2
const BIT_RAINBOWBADGE ; 3
const BIT_SOULBADGE ; 4
const BIT_MARSHBADGE ; 5
const BIT_VOLCANOBADGE ; 6
const BIT_EARTHBADGE ; 7
DEF NUM_BADGES EQU const_value
; OaksAideScript results
DEF OAKS_AIDE_BAG_FULL EQU $00
DEF OAKS_AIDE_GOT_ITEM EQU $01

View File

@ -101,7 +101,7 @@ PredefPointers::
add_predef EnterMapAnim, $1E ; wrong bank
add_predef GetTileTwoStepsInFrontOfPlayer
add_predef CheckForCollisionWhenPushingBoulder
add_predef PrintStrengthTxt
add_predef PrintStrengthText
add_predef PickUpItem
add_predef PrintMoveType
add_predef LoadMovePPs

View File

@ -47,71 +47,71 @@ SpriteFacingAndAnimationTable:
db 4 ; #
db 0, 0, $00, 0
db 0, 8, $01, 0
db 8, 0, $02, OAMFLAG_CANBEMASKED
db 8, 8, $03, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 0, $02, UNDER_GRASS
db 8, 8, $03, UNDER_GRASS | FACING_END
.WalkingDown:
db 4 ; #
db 0, 0, $80, 0
db 0, 8, $81, 0
db 8, 0, $82, OAMFLAG_CANBEMASKED
db 8, 8, $83, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 0, $82, UNDER_GRASS
db 8, 8, $83, UNDER_GRASS | FACING_END
.WalkingDown2:
db 4 ; #
db 0, 8, $80, OAM_HFLIP
db 0, 0, $81, OAM_HFLIP
db 8, 8, $82, OAM_HFLIP | OAMFLAG_CANBEMASKED
db 8, 0, $83, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 8, $82, OAM_HFLIP | UNDER_GRASS
db 8, 0, $83, OAM_HFLIP | UNDER_GRASS | FACING_END
.StandingUp:
db 4 ; #
db 0, 0, $04, 0
db 0, 8, $05, 0
db 8, 0, $06, OAMFLAG_CANBEMASKED
db 8, 8, $07, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 0, $06, UNDER_GRASS
db 8, 8, $07, UNDER_GRASS | FACING_END
.WalkingUp:
db 4 ; #
db 0, 0, $84, 0
db 0, 8, $85, 0
db 8, 0, $86, OAMFLAG_CANBEMASKED
db 8, 8, $87, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 0, $86, UNDER_GRASS
db 8, 8, $87, UNDER_GRASS | FACING_END
.WalkingUp2:
db 4 ; #
db 0, 8, $84, OAM_HFLIP
db 0, 0, $85, OAM_HFLIP
db 8, 8, $86, OAM_HFLIP | OAMFLAG_CANBEMASKED
db 8, 0, $87, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 8, $86, OAM_HFLIP | UNDER_GRASS
db 8, 0, $87, OAM_HFLIP | UNDER_GRASS | FACING_END
.StandingLeft:
db 4 ; #
db 0, 0, $08, 0
db 0, 8, $09, 0
db 8, 0, $0a, OAMFLAG_CANBEMASKED
db 8, 8, $0b, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 0, $0a, UNDER_GRASS
db 8, 8, $0b, UNDER_GRASS | FACING_END
.WalkingLeft:
db 4 ; #
db 0, 0, $88, 0
db 0, 8, $89, 0
db 8, 0, $8a, OAMFLAG_CANBEMASKED
db 8, 8, $8b, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 0, $8a, UNDER_GRASS
db 8, 8, $8b, UNDER_GRASS | FACING_END
.StandingRight:
db 4 ; #
db 0, 8, $08, OAM_HFLIP
db 0, 0, $09, OAM_HFLIP
db 8, 8, $0a, OAM_HFLIP | OAMFLAG_CANBEMASKED
db 8, 0, $0b, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 8, $0a, OAM_HFLIP | UNDER_GRASS
db 8, 0, $0b, OAM_HFLIP | UNDER_GRASS | FACING_END
.WalkingRight:
db 4 ; #
db 0, 8, $88, OAM_HFLIP
db 0, 0, $89, OAM_HFLIP
db 8, 8, $8a, OAM_HFLIP | OAMFLAG_CANBEMASKED
db 8, 0, $8b, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 8, 8, $8a, OAM_HFLIP | UNDER_GRASS
db 8, 0, $8b, OAM_HFLIP | UNDER_GRASS | FACING_END
.SpecialCase:
db 9 ; #
@ -121,6 +121,6 @@ SpriteFacingAndAnimationTable:
db 4, -4, $01, 0
db 4, 4, $02, 0
db 4, 12, $01, 0
db 12, -4, $00, OAM_VFLIP | OAMFLAG_CANBEMASKED
db 12, 4, $01, OAMFLAG_CANBEMASKED
db 12, 12, $00, OAM_VFLIP | OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA
db 12, -4, $00, OAM_VFLIP | UNDER_GRASS
db 12, 4, $01, UNDER_GRASS
db 12, 12, $00, OAM_VFLIP | OAM_HFLIP | UNDER_GRASS | FACING_END

View File

@ -14,7 +14,7 @@ _CardKeyFailText::
done
_TrainerNameText::
text_ram wcd6d
text_ram wNameBuffer
text ": @"
text_end

View File

@ -10,7 +10,7 @@ _AIBattleUseItemText::
text_ram wTrainerName
text_start
line "used @"
text_ram wcd6d
text_ram wNameBuffer
text_start
cont "on @"
text_ram wEnemyMonNick
@ -45,7 +45,7 @@ _TradeSendsText::
text_ram wLinkEnemyTrainerName
text " sends"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "."
done
@ -56,7 +56,7 @@ _TradeWavesFarewellText::
done
_TradeTransferredText::
text_ram wcd6d
text_ram wNameBuffer
text " is"
line "transferred."
done
@ -64,7 +64,7 @@ _TradeTransferredText::
_TradeTakeCareText::
text "Take good care of"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "."
done
@ -72,7 +72,7 @@ _TradeWillTradeText::
text_ram wLinkEnemyTrainerName
text " will"
line "trade @"
text_ram wcd6d
text_ram wNameBuffer
text_start
done
@ -796,7 +796,7 @@ _VermilionGymTrashFailText::
_FoundHiddenItemText::
text "<PLAYER> found"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "!@"
text_end
@ -1119,7 +1119,7 @@ _CantMoveText::
_MoveIsDisabledText::
text "<USER>'s"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text " is"
cont "disabled!"
prompt
@ -1254,7 +1254,7 @@ _HitXTimesText::
prompt
_GainedText::
text_ram wcd6d
text_ram wNameBuffer
text " gained"
line "@"
text_end
@ -1275,10 +1275,10 @@ _ExpPointsText::
prompt
_GrewLevelText::
text_ram wcd6d
text_ram wNameBuffer
text " grew"
line "to level @"
text_decimal wCurEnemyLVL, 1, 3
text_decimal wCurEnemyLevel, 1, 3
text "!@"
text_end

View File

@ -113,7 +113,7 @@ _PartyMenuSwapMonText::
done
_PotionText::
text_ram wcd6d
text_ram wNameBuffer
text_start
line "recovered by @"
text_decimal wHPBarHPDifference, 2, 3
@ -121,52 +121,52 @@ _PotionText::
done
_AntidoteText::
text_ram wcd6d
text_ram wNameBuffer
text " was"
line "cured of poison!"
done
_ParlyzHealText::
text_ram wcd6d
text_ram wNameBuffer
text "'s"
line "rid of paralysis!"
done
_BurnHealText::
text_ram wcd6d
text_ram wNameBuffer
text "'s"
line "burn was healed!"
done
_IceHealText::
text_ram wcd6d
text_ram wNameBuffer
text " was"
line "defrosted!"
done
_AwakeningText::
text_ram wcd6d
text_ram wNameBuffer
text_start
line "woke up!"
done
_FullHealText::
text_ram wcd6d
text_ram wNameBuffer
text "'s"
line "health returned!"
done
_ReviveText::
text_ram wcd6d
text_ram wNameBuffer
text_start
line "is revitalized!"
done
_RareCandyText::
text_ram wcd6d
text_ram wNameBuffer
text " grew"
line "to level @"
text_decimal wCurEnemyLVL, 1, 3
text_decimal wCurEnemyLevel, 1, 3
text "!@"
text_end
@ -218,7 +218,7 @@ _DepositHowManyText::
done
_ItemWasStoredText::
text_ram wcd6d
text_ram wNameBuffer
text " was"
line "stored via PC."
prompt
@ -245,7 +245,7 @@ _WithdrawHowManyText::
_WithdrewItemText::
text "Withdrew"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "."
prompt
@ -335,7 +335,7 @@ _CantTakeMonText::
prompt
_PikachuUnhappyText::
text_ram wcd6d
text_ram wNameBuffer
text " looks"
line "unhappy about it!"
prompt
@ -384,7 +384,7 @@ _HereYouGoText::
_SoYouWantPrizeText::
text "So, you want"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "?"
done
@ -493,7 +493,7 @@ _DoYouWantToNicknameText::
text "Do you want to"
line "give a nickname"
cont "to @"
text_ram wcd6d
text_ram wNameBuffer
text "?"
done
@ -512,7 +512,7 @@ _WillBeTradedText::
text_ram wNameOfPlayerMonToBeTraded
text " and"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text " will"
cont "be traded."
done
@ -578,19 +578,19 @@ _ColosseumTotalL50Text::
prompt
_ColosseumHeightText::
text_ram wcd6d
text_ram wNameBuffer
text " is over"
line "68” tall!"
prompt
_ColosseumWeightText::
text_ram wcd6d
text_ram wNameBuffer
text " weighs"
line "over 44 pounds!"
prompt
_ColosseumEvolvedText::
text_ram wcd6d
text_ram wNameBuffer
text " is an"
line "evolved #MON!"
prompt
@ -621,7 +621,7 @@ _ColosseumVersionText::
prompt
_TextIDErrorText::
text_decimal hSpriteIndexOrTextID, 1, 2
text_decimal hTextID, 1, 2
text " error."
done

View File

@ -44,7 +44,7 @@ _EvolvedText::
_IntoText::
text_start
line "into @"
text_ram wcd6d
text_ram wNameBuffer
text "!"
done

View File

@ -128,14 +128,14 @@ _MimicLearnedMoveText::
text "<USER>"
line "learned"
cont "@"
text_ram wcd6d
text_ram wNameBuffer
text "!"
prompt
_MoveWasDisabledText::
text "<TARGET>'s"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text " was"
cont "disabled!"
prompt
@ -233,7 +233,7 @@ _TransformedText::
text "<USER>"
line "transformed into"
cont "@"
text_ram wcd6d
text_ram wNameBuffer
text "!"
prompt

View File

@ -8,7 +8,7 @@ _PokemartGreetingText::
done
_PokemonFaintedText::
text_ram wcd6d
text_ram wNameBuffer
text_start
line "fainted!"
done
@ -149,7 +149,7 @@ _ForgotAndText::
text_ram wLearnMoveMonName
text " forgot"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "!"
para "And..."

View File

@ -43,13 +43,13 @@ _WarpToLastPokemonCenterText::
done
_CannotUseTeleportNowText::
text_ram wcd6d
text_ram wNameBuffer
text " can't"
line "use TELEPORT now."
prompt
_CannotFlyHereText::
text_ram wcd6d
text_ram wNameBuffer
text " can't"
line "FLY here."
prompt
@ -75,13 +75,13 @@ _CannotGetOffHereText::
prompt
_UsedStrengthText::
text_ram wcd6d
text_ram wNameBuffer
text " used"
line "STRENGTH.@"
text_end
_CanMoveBouldersText::
text_ram wcd6d
text_ram wNameBuffer
text " can"
line "move boulders."
prompt
@ -99,7 +99,7 @@ _CyclingIsFunText::
_GotMonText::
text "<PLAYER> got"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "!@"
text_end

View File

@ -59,7 +59,7 @@ _ItemUseBallText06::
_SurfingGotOnText::
text "<PLAYER> got on"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "!"
prompt
@ -69,13 +69,13 @@ _SurfingNoPlaceToGetOffText::
prompt
_RefusingText::
text_ram wcd6d
text_ram wNameBuffer
text_start
line "is refusing!"
prompt
_VitaminStatRoseText::
text_ram wcd6d
text_ram wNameBuffer
text "'s"
line "@"
text_ram wStringBuffer
@ -180,7 +180,7 @@ _TeachMachineMoveText::
done
_MonCannotLearnMachineMoveText::
text_ram wcd6d
text_ram wNameBuffer
text " is not"
line "compatible with"
cont "@"
@ -226,7 +226,7 @@ _NoCyclingAllowedHereText::
_NoSurfingHereText::
text "No SURFing on"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text " here!"
prompt
@ -272,7 +272,7 @@ _GotOffBicycleText2::
_ThrewAwayItemText::
text "Threw away"
line "@"
text_ram wcd6d
text_ram wNameBuffer
text "."
prompt
@ -289,7 +289,7 @@ _TooImportantToTossText::
prompt
_AlreadyKnowsText::
text_ram wcd6d
text_ram wNameBuffer
text " knows"
line "@"
text_ram wStringBuffer
@ -436,7 +436,7 @@ _NothingToCutText::
prompt
_UsedCutText::
text_ram wcd6d
text_ram wNameBuffer
text " hacked"
line "away with CUT!"
prompt

View File

@ -138,13 +138,13 @@ DrawFrameBlock:
ld [de], a ; store tile ID
inc de
ld a, [hli]
bit 5, a ; is horizontal flip enabled?
bit OAM_X_FLIP, a
jr nz, .disableHorizontalFlip
.enableHorizontalFlip
set 5, a
set OAM_X_FLIP, a
jr .storeFlags2
.disableHorizontalFlip
res 5, a
res OAM_X_FLIP, a
.storeFlags2
ld b, a
ld a, [wdef5]
@ -452,7 +452,7 @@ MoveAnimation:
xor a
vc_hook Stop_reducing_move_anim_flashing_Haze_Hyper_Beam
ld [wSubAnimSubEntryAddr], a
ld [wUnusedD09B], a
ld [wUnusedMoveAnimByte], a
ld [wSubAnimTransform], a
dec a ; NO_MOVE - 1
ld [wAnimSoundID], a
@ -722,7 +722,7 @@ DoSpecialEffectByAnimationId:
INCLUDE "data/battle_anims/special_effects.asm"
DoBallTossSpecialEffects:
ld a, [wcf91]
ld a, [wCurItem]
cp ULTRA_BALL + 1 ; is it a Master Ball or Ultra Ball?
jr nc, .skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
@ -741,7 +741,7 @@ DoBallTossSpecialEffects:
ld a, [wIsInBattle]
cp 2 ; is it a trainer battle?
jr z, .isTrainerBattle
ld a, [wd11e]
ld a, [wPokeBallAnimData]
cp $10 ; is the enemy pokemon the Ghost Marowak?
ret nz
; if the enemy pokemon is the Ghost Marowak, make it dodge during the last 3 frames
@ -1169,12 +1169,12 @@ AnimationWaterDropletsEverywhere:
ld a, 16
ld [wBaseCoordY], a
ld a, 0
ld [wUnusedD08A], a
ld [wUnusedWaterDropletsByte], a
call _AnimationWaterDroplets
ld a, 24
ld [wBaseCoordY], a
ld a, 32
ld [wUnusedD08A], a
ld [wUnusedWaterDropletsByte], a
call _AnimationWaterDroplets
dec d
jr nz, .loop
@ -2109,8 +2109,8 @@ HideSubstituteShowMonAnim:
and a
jr nz, .monIsMinimized
ld a, [wBattleMonSpecies]
ld [wcf91], a
ld [wd0b5], a
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call GetMonHeader
predef LoadMonBackPic
ret
@ -2119,8 +2119,8 @@ HideSubstituteShowMonAnim:
and a
jr nz, .monIsMinimized
ld a, [wEnemyMonSpecies]
ld [wcf91], a
ld [wd0b5], a
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call GetMonHeader
ld de, vFrontPic
jp LoadMonFrontSprite
@ -2174,8 +2174,8 @@ ChangeMonPic:
and a
jr z, .playerTurn
ld a, [wChangeMonPicEnemyTurnSpecies]
ld [wcf91], a
ld [wd0b5], a
ld [wCurPartySpecies], a
ld [wCurSpecies], a
xor a
ld [wSpriteFlipped], a
call GetMonHeader
@ -2187,7 +2187,7 @@ ChangeMonPic:
push af
ld a, [wChangeMonPicPlayerTurnSpecies]
ld [wBattleMonSpecies2], a
ld [wd0b5], a
ld [wCurSpecies], a
call GetMonHeader
predef LoadMonBackPic
xor a ; TILEMAP_MON_PIC
@ -2795,7 +2795,7 @@ TossBallAnimation:
ld hl, .PokeBallAnimations
; choose which toss animation to use
ld a, [wcf91]
ld a, [wCurItem]
cp POKE_BALL
ld b, TOSS_ANIM
jr z, .done

View File

@ -11,7 +11,7 @@ BattleTransition:
; Determine which OAM block is being used by the enemy trainer sprite (if there
; is one).
ld hl, wSpritePlayerStateData1ImageIndex
ldh a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
ldh a, [hSpriteIndex] ; enemy trainer sprite index (0 if wild battle)
ld c, a
ld b, 0
ld de, $10
@ -64,6 +64,12 @@ BattleTransition:
ld l, a
jp hl
const_def
const BIT_TRAINER_BATTLE_TRANSITION ; 0
const BIT_STRONGER_BATTLE_TRANSITION ; 1
const BIT_DUNGEON_BATTLE_TRANSITION ; 2
DEF NUM_BATTLE_TRANSITION_BITS EQU const_value
; the three GetBattleTransitionID functions set the first
; three bits of c, which determines what transition animation
; to play at the beginning of a battle
@ -71,6 +77,7 @@ BattleTransition:
; bit 1: set if enemy is at least 3 levels higher than player
; bit 2: set if dungeon map
BattleTransitions:
table_width 2, BattleTransitions
dw BattleTransition_DoubleCircle ; %000
dw BattleTransition_Spiral ; %001
dw BattleTransition_Circle ; %010
@ -79,15 +86,16 @@ BattleTransitions:
dw BattleTransition_Shrink ; %101
dw BattleTransition_VerticalStripes ; %110
dw BattleTransition_Split ; %111
assert_table_length 1 << NUM_BATTLE_TRANSITION_BITS
GetBattleTransitionID_WildOrTrainer:
ld a, [wCurOpponent]
cp OPP_ID_OFFSET
jr nc, .trainer
res 0, c
res BIT_TRAINER_BATTLE_TRANSITION, c
ret
.trainer
set 0, c
set BIT_TRAINER_BATTLE_TRANSITION, c
ret
GetBattleTransitionID_CompareLevels:
@ -105,15 +113,15 @@ GetBattleTransitionID_CompareLevels:
ld a, [hl]
add $3
ld e, a
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
sub e
jr nc, .highLevelEnemy
res 1, c
res BIT_STRONGER_BATTLE_TRANSITION, c
ld a, 1
ld [wBattleTransitionSpiralDirection], a
ret
.highLevelEnemy
set 1, c
set BIT_STRONGER_BATTLE_TRANSITION, c
xor a
ld [wBattleTransitionSpiralDirection], a
ret
@ -129,7 +137,7 @@ GetBattleTransitionID_IsDungeonMap:
cp e
jr nz, .loop1
.match
set 2, c
set BIT_DUNGEON_BATTLE_TRANSITION, c
ret
.noMatch1
ld hl, DungeonMaps2
@ -145,7 +153,7 @@ GetBattleTransitionID_IsDungeonMap:
cp d
jr nc, .match
.noMatch2
res 2, c
res BIT_DUNGEON_BATTLE_TRANSITION, c
ret
INCLUDE "data/maps/dungeon_maps.asm"

View File

@ -48,7 +48,7 @@ PrintBeginningBattleText:
ld b, SILPH_SCOPE
call IsItemInBag
ld a, [wEnemyMonSpecies2]
ld [wcf91], a
ld [wCurPartySpecies], a
cp RESTLESS_SOUL
jr z, .isMarowak
ld a, b

View File

@ -238,7 +238,7 @@ StartBattle:
ld b, 0
add hl, bc
ld a, [hl] ; species
ld [wcf91], a
ld [wCurPartySpecies], a
ld [wBattleMonSpecies2], a
call LoadScreenTilesFromBuffer1
hlcoord 1, 5
@ -426,7 +426,7 @@ MainInBattleLoop:
jr c, .AIActionUsedEnemyFirst
call ExecuteEnemyMove
ld a, [wEscapedFromBattle]
and a ; was Teleport, Road, or Whirlwind used to escape from battle?
and a ; was Teleport, Roar, or Whirlwind used to escape from battle?
ret nz ; if so, return
ld a, b
and a
@ -437,7 +437,7 @@ MainInBattleLoop:
call DrawHUDsAndHPBars
call ExecutePlayerMove
ld a, [wEscapedFromBattle]
and a ; was Teleport, Road, or Whirlwind used to escape from battle?
and a ; was Teleport, Roar, or Whirlwind used to escape from battle?
ret nz ; if so, return
ld a, b
and a
@ -450,7 +450,7 @@ MainInBattleLoop:
.playerMovesFirst
call ExecutePlayerMove
ld a, [wEscapedFromBattle]
and a ; was Teleport, Road, or Whirlwind used to escape from battle?
and a ; was Teleport, Roar, or Whirlwind used to escape from battle?
ret nz ; if so, return
ld a, b
and a
@ -464,7 +464,7 @@ MainInBattleLoop:
jr c, .AIActionUsedPlayerFirst
call ExecuteEnemyMove
ld a, [wEscapedFromBattle]
and a ; was Teleport, Road, or Whirlwind used to escape from battle?
and a ; was Teleport, Roar, or Whirlwind used to escape from battle?
ret nz ; if so, return
ld a, b
and a
@ -853,7 +853,7 @@ FaintEnemyPokemon:
; the player has exp all
; now, set the gain exp flag for every party member
; half of the total stat exp and normal exp will divided evenly amongst every party member
ld a, $1
ld a, TRUE
ld [wBoostExpByExpAll], a
ld a, [wPartyCount]
ld b, 0
@ -938,8 +938,8 @@ TrainerBattleVictory:
cp RIVAL3 ; final battle against rival
jr nz, .notrival
ld b, MUSIC_DEFEATED_GYM_LEADER
ld hl, wFlags_D733
set 1, [hl]
ld hl, wStatusFlags7
set BIT_NO_MAP_MUSIC, [hl]
.notrival
ld a, [wLinkState]
cp LINK_STATE_BATTLING
@ -1019,12 +1019,12 @@ RemoveFaintedPlayerMon:
ld b, FLAG_RESET
predef FlagActionPredef ; clear gain exp flag for fainted mon
ld hl, wEnemyBattleStatus1
res 2, [hl] ; reset "attacking multiple times" flag
res ATTACKING_MULTIPLE_TIMES, [hl]
ld a, [wLowHealthAlarm]
bit 7, a ; skip sound flag (red bar (?))
bit BIT_LOW_HEALTH_ALARM, a
jr z, .skipWaitForSound
ld a, $ff
ld [wLowHealthAlarm], a ;disable low health alarm
ld a, DISABLE_LOW_HEALTH_ALARM
ld [wLowHealthAlarm], a
call WaitForSoundToFinish
xor a
.skipWaitForSound
@ -1196,9 +1196,9 @@ HandlePlayerBlackOut:
ld hl, LinkBattleLostText
.noLinkBattle
call PrintText
ld a, [wd732]
res 5, a
ld [wd732], a
ld a, [wStatusFlags6]
res BIT_ALWAYS_ON_BIKE, a
ld [wStatusFlags6], a
call ClearScreen
scf
ret
@ -1218,10 +1218,10 @@ LinkBattleLostText:
; slides pic of fainted mon downwards until it disappears
; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing
SlideDownFaintedMonPic:
ld a, [wd730]
ld a, [wStatusFlags5]
push af
set 6, a
ld [wd730], a
set BIT_NO_TEXT_DELAY, a
ld [wStatusFlags5], a
ld b, 7 ; number of times to slide
.slideStepLoop ; each iteration, the mon is slid down one row
push bc
@ -1260,7 +1260,7 @@ SlideDownFaintedMonPic:
dec b
jr nz, .slideStepLoop
pop af
ld [wd730], a
ld [wStatusFlags5], a
ret
SevenSpacesText:
@ -1344,7 +1344,7 @@ EnemySendOutFirstMon:
dec a
ld [wAICount], a
ld hl, wPlayerBattleStatus1
res 5, [hl]
res USING_TRAPPING_MOVE, [hl]
hlcoord 18, 0
ld a, 8
call SlideTrainerPicOffScreen
@ -1383,7 +1383,7 @@ EnemySendOutFirstMon:
ld bc, wEnemyMon2 - wEnemyMon1
call AddNTimes
ld a, [hl]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld a, [wWhichPokemon]
inc a
ld hl, wEnemyPartyCount
@ -1392,7 +1392,7 @@ EnemySendOutFirstMon:
add hl, bc
ld a, [hl]
ld [wEnemyMonSpecies2], a
ld [wcf91], a
ld [wCurPartySpecies], a
call LoadEnemyMonData
ld hl, wEnemyMonHP
ld a, [hli]
@ -1459,8 +1459,8 @@ EnemySendOutFirstMon:
ld hl, TrainerSentOutText
call PrintText
ld a, [wEnemyMonSpecies2]
ld [wcf91], a
ld [wd0b5], a
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call GetMonHeader
ld de, vFrontPic
call LoadMonFrontSprite
@ -1683,7 +1683,7 @@ LoadBattleMonFromParty:
ld bc, wBattleMonPP - wBattleMonLevel
call CopyData
ld a, [wBattleMonSpecies2]
ld [wd0b5], a
ld [wCurSpecies], a
call GetMonHeader
ld hl, wPartyMonNicks
ld a, [wPlayerMonNumber]
@ -1727,7 +1727,7 @@ LoadEnemyMonFromParty:
ld bc, wEnemyMonPP - wEnemyMonLevel
call CopyData
ld a, [wEnemyMonSpecies]
ld [wd0b5], a
ld [wCurSpecies], a
call GetMonHeader
ld hl, wEnemyMonNicks
ld a, [wWhichPokemon]
@ -1817,7 +1817,7 @@ SendOutMon:
callfar PlayPikachuSoundClip
jr .done
.playRegularCry
ld a, [wcf91]
ld a, [wCurPartySpecies]
call PlayCry
.done
call PrintEmptyString
@ -1916,7 +1916,7 @@ DrawPlayerHUDAndHPBar:
call PrintLevel
.doNotPrintLevel
ld a, [wLoadedMonSpecies]
ld [wcf91], a
ld [wCurPartySpecies], a
hlcoord 10, 9
predef DrawHP
ld a, $1
@ -1935,15 +1935,15 @@ DrawPlayerHUDAndHPBar:
jr z, .setLowHealthAlarm
.fainted
ld hl, wLowHealthAlarm
bit 7, [hl] ;low health alarm enabled?
ld [hl], $0
bit BIT_LOW_HEALTH_ALARM, [hl]
ld [hl], 0
ret z
xor a
ld [wChannelSoundIDs + CHAN5], a
ret
.setLowHealthAlarm
ld hl, wLowHealthAlarm
set 7, [hl] ;enable low health alarm
set BIT_LOW_HEALTH_ALARM, [hl]
ret
DrawEnemyHUDAndHPBar:
@ -2208,7 +2208,7 @@ DisplayBattleMenu::
ld a, D_LEFT | A_BUTTON
ld [hli], a ; wMenuWatchedKeys
call HandleMenuInput
bit 5, a ; check if left was pressed
bit BIT_D_LEFT, a
jr nz, .leftColumn ; if left was pressed, jump
ld a, [wCurrentMenuItem]
add $2 ; if we're in the right column, the actual id is +2
@ -2249,7 +2249,7 @@ DisplayBattleMenu::
jp LoadScreenTilesFromBuffer1 ; restore saved screen and return
.throwSafariBallWasSelected
ld a, SAFARI_BALL
ld [wcf91], a
ld [wCurItem], a
jp UseBagItem
.handleUnusedBattle
ld a, [wCurrentMenuItem]
@ -2285,7 +2285,7 @@ DisplayBattleMenu::
; bait was selected
ld a, SAFARI_BAIT
ld [wcf91], a
ld [wCurItem], a
jr UseBagItem
BagWasSelected:
@ -2341,8 +2341,8 @@ DisplayBagMenu:
UseBagItem:
; either use an item from the bag or use a safari zone item
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurItem]
ld [wNamedObjectIndex], a
call GetItemName
call CopyToStringBuffer
xor a
@ -2410,7 +2410,7 @@ PartyMenuOrRockOrRun:
jr nz, .partyMenuWasSelected
; safari battle
ld a, SAFARI_ROCK
ld [wcf91], a
ld [wCurItem], a
jp UseBagItem
.partyMenuWasSelected
call LoadScreenTilesFromBuffer1
@ -2486,8 +2486,8 @@ PartyMenuOrRockOrRun:
jr nz, .doEnemyMonAnimation
; enemy mon is not minimised
ld a, [wEnemyMonSpecies]
ld [wcf91], a
ld [wd0b5], a
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call GetMonHeader
ld de, vFrontPic
call LoadMonFrontSprite
@ -2580,11 +2580,11 @@ MoveSelectionMenu:
.writemoves
ld de, wMovesString
ldh a, [hUILayoutFlags]
set 2, a
set BIT_SINGLE_SPACED_LINES, a
ldh [hUILayoutFlags], a
call PlaceString
ldh a, [hUILayoutFlags]
res 2, a
res BIT_SINGLE_SPACED_LINES, a
ldh [hUILayoutFlags], a
ret
@ -2660,7 +2660,7 @@ MoveSelectionMenu:
cp LINK_STATE_BATTLING
jr z, .matchedkeyspicked
; Disable left, right, and START buttons in regular battles.
ld a, [wFlags_D733]
ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a
ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
jr z, .matchedkeyspicked
@ -2689,7 +2689,7 @@ SelectMenuItem:
jr .select
.battleselect
; Hide move swap cursor in TestBattle.
ld a, [wFlags_D733]
ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a
; This causes PrintMenuItem to not run in TestBattle.
; MoveSelectionMenu still draws part of its window, an issue
@ -2706,10 +2706,10 @@ SelectMenuItem:
ld [hl], "▷"
.select
ld hl, hUILayoutFlags
set 1, [hl]
set BIT_DOUBLE_SPACED_MENU, [hl]
call HandleMenuInput
ld hl, hUILayoutFlags
res 1, [hl]
res BIT_DOUBLE_SPACED_MENU, [hl]
bit BIT_D_UP, a
jp nz, SelectMenuItem_CursorUp
bit BIT_D_DOWN, a
@ -2762,7 +2762,7 @@ ENDC
cp c
jr z, .disabled
ld a, [wPlayerBattleStatus3]
bit 3, a ; transformed
bit TRANSFORMED, a
jr nz, .transformedMoveSelected
.transformedMoveSelected ; pointless
; Allow moves copied by Transform to be used.
@ -2863,7 +2863,7 @@ Func_3d536:
ret z
cp STRUGGLE
ret nc
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMoveName
hlcoord 13, 17
jp PlaceString
@ -2920,7 +2920,7 @@ NoMovesLeftText:
SwapMovesInMenu:
IF DEF(_DEBUG)
ld a, [wFlags_D733]
ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a
jp nz, Func_3d4f5
ENDC
@ -3047,7 +3047,7 @@ PrintMenuItem:
add hl, bc
ld a, [hl]
and $3f
ld [wcd6d], a
ld [wBattleMenuCurrentPP], a
; print TYPE/<type> and <curPP>/<maxPP>
hlcoord 1, 9
ld de, TypeText
@ -3057,7 +3057,7 @@ PrintMenuItem:
hlcoord 5, 9
ld [hl], "/"
hlcoord 5, 11
ld de, wcd6d
ld de, wBattleMenuCurrentPP
lb bc, 1, 2
call PrintNumber
hlcoord 8, 11
@ -3733,7 +3733,7 @@ CheckPlayerStatusConditions:
bit USING_RAGE, a ; is mon using rage?
jp z, .checkPlayerStatusConditionsDone ; if we made it this far, mon can move normally this turn
ld a, RAGE
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMoveName
call CopyToStringBuffer
xor a
@ -3823,7 +3823,7 @@ PrintMoveIsDisabledText:
res CHARGING_UP, a ; end the pokemon's
ld [de], a
ld a, [hl]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMoveName
ld hl, MoveIsDisabledText
jp PrintText
@ -3897,13 +3897,13 @@ MonName1Text:
ld hl, wEnemyUsedMove
.playerTurn
ld [hl], a
ld [wd11e], a
ld [wMoveGrammar], a
call DetermineExclamationPointTextNum
ld a, [wMonIsDisobedient]
and a
ld hl, Used2Text
ret nz
ld a, [wd11e]
ld a, [wMoveGrammar]
cp 3
ld hl, Used2Text
ret c
@ -3940,7 +3940,7 @@ _PrintMoveName:
text_far _MoveNameText
text_asm
ld hl, ExclamationPointPointerTable
ld a, [wd11e] ; exclamation point num
ld a, [wMoveGrammar]
add a
push bc
ld b, $0
@ -3988,7 +3988,7 @@ ExclamationPoint5Text:
; but the functionality didn't get removed
DetermineExclamationPointTextNum:
push bc
ld a, [wd11e] ; move ID
ld a, [wMoveGrammar] ; move ID
ld c, a
ld b, $0
ld hl, ExclamationPointMoveSets
@ -4004,7 +4004,7 @@ DetermineExclamationPointTextNum:
jr .loop
.done
ld a, b
ld [wd11e], a ; exclamation point num
ld [wMoveGrammar], a
pop bc
ret
@ -4019,7 +4019,7 @@ PrintMoveFailureText:
.playersTurn
ld hl, DoesntAffectMonText
ld a, [wDamageMultipliers]
and $7f
and EFFECTIVENESS_MASK
jr z, .gotTextToPrint
ld hl, AttackMissedText
ld a, [wCriticalHitOrOHKO]
@ -4573,9 +4573,9 @@ GetEnemyMonStat:
ret
.notLinkBattle
ld a, [wEnemyMonLevel]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld a, [wEnemyMonSpecies]
ld [wd0b5], a
ld [wCurSpecies], a
call GetMonHeader
ld hl, wEnemyMonDVs
ld de, wLoadedMonSpeedExp
@ -4779,7 +4779,7 @@ CriticalHitTest:
jr nz, .handleEnemy
ld a, [wBattleMonSpecies]
.handleEnemy
ld [wd0b5], a
ld [wCurSpecies], a
call GetMonHeader
ld a, [wMonHBaseSpeed]
ld b, a
@ -5289,7 +5289,7 @@ MirrorMoveFailedText:
; function used to reload move data for moves like Mirror Move and Metronome
ReloadMoveData:
ld [wd11e], a
ld [wNamedObjectIndex], a
dec a
ld hl, Moves
ld bc, MOVE_LENGTH
@ -5417,7 +5417,7 @@ AdjustDamageForMoveType:
ld a, l
ld [wDamage + 1], a
ld hl, wDamageMultipliers
set 7, [hl]
set BIT_STAB_DAMAGE, [hl]
.skipSameTypeAttackBonus
ld a, [wMoveType]
ld b, a
@ -5440,7 +5440,7 @@ AdjustDamageForMoveType:
push bc
inc hl
ld a, [wDamageMultipliers]
and $80
and 1 << BIT_STAB_DAMAGE
ld b, a
ld a, [hl] ; a = damage multiplier
ldh [hMultiplier], a
@ -5805,13 +5805,13 @@ EnemyCanExecuteChargingMove:
res CHARGING_UP, [hl] ; no longer charging up for attack
res INVULNERABLE, [hl] ; no longer invulnerable to typical attacks
ld a, [wEnemyMoveNum]
ld [wd0b5], a
ld [wNameListIndex], a
ld a, BANK(MoveNames)
ld [wPredefBank], a
ld a, MOVE_NAME
ld [wNameListType], a
call GetName
ld de, wcd6d
ld de, wNameBuffer
call CopyToStringBuffer
EnemyCanExecuteMove:
xor a
@ -6247,7 +6247,7 @@ CheckEnemyStatusConditions:
bit USING_RAGE, a ; is mon using rage?
jp z, .checkEnemyStatusConditionsDone ; if we made it this far, mon can move normally this turn
ld a, RAGE
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMoveName
call CopyToStringBuffer
xor a
@ -6272,13 +6272,13 @@ GetCurrentMove:
.player
ld de, wPlayerMoveNum
; Apply InitBattleVariables to TestBattle.
ld a, [wFlags_D733]
ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a
ld a, [wTestBattlePlayerSelectedMove]
jr nz, .selected
ld a, [wPlayerSelectedMove]
.selected
ld [wd0b5], a
ld [wNameListIndex], a
dec a
ld hl, Moves
ld bc, MOVE_LENGTH
@ -6291,7 +6291,7 @@ GetCurrentMove:
ld a, MOVE_NAME
ld [wNameListType], a
call GetName
ld de, wcd6d
ld de, wNameBuffer
jp CopyToStringBuffer
LoadEnemyMonData:
@ -6300,7 +6300,7 @@ LoadEnemyMonData:
jp z, LoadEnemyMonFromParty
ld a, [wEnemyMonSpecies2]
ld [wEnemyMonSpecies], a
ld [wd0b5], a
ld [wCurSpecies], a
call GetMonHeader
ld a, [wEnemyBattleStatus3]
bit TRANSFORMED, a ; is enemy mon transformed?
@ -6323,7 +6323,7 @@ LoadEnemyMonData:
ld [hli], a
ld [hl], b
ld de, wEnemyMonLevel
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
ld [de], a
inc de
ld b, $0
@ -6425,16 +6425,16 @@ LoadEnemyMonData:
ld a, [hl] ; base exp
ld [de], a
ld a, [wEnemyMonSpecies2]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, wcd6d
ld hl, wNameBuffer
ld de, wEnemyMonNick
ld bc, NAME_LENGTH
call CopyData
ld a, [wEnemyMonSpecies2]
ld [wd11e], a
ld [wPokedexNum], a
predef IndexToPokedex
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld c, a
ld b, FLAG_SET

View File

@ -204,7 +204,7 @@ ExplodeEffect:
FreezeBurnParalyzeEffect:
xor a
ld [wAnimationType], a
call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag]
call CheckTargetSubstitute
ret nz ; return if they have a substitute, can't effect them
ldh a, [hWhoseTurn]
and a
@ -848,7 +848,7 @@ SwitchAndTeleportEffect:
ld a, [wIsInBattle]
dec a
jr nz, .notWildBattle1
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
ld b, a
ld a, [wBattleMonLevel]
cp b ; is the player's level greater than the enemy's level?
@ -892,7 +892,7 @@ SwitchAndTeleportEffect:
jr nz, .notWildBattle2
ld a, [wBattleMonLevel]
ld b, a
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
cp b
jr nc, .enemyMoveWasSuccessful
add b
@ -1318,7 +1318,7 @@ MimicEffect:
add hl, bc
ld a, d
ld [hl], a
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMoveName
call PlayCurrentMoveAnimation
ld hl, MimicLearnedMoveText
@ -1365,7 +1365,7 @@ DisableEffect:
pop hl
and a
jr z, .pickMoveToDisable ; loop until a non-00 move slot is found
ld [wd11e], a ; store move number
ld [wNamedObjectIndex], a ; store move number
push hl
ldh a, [hWhoseTurn]
and a
@ -1410,7 +1410,7 @@ DisableEffect:
jr nz, .printDisableText
inc hl ; wEnemyDisabledMoveNumber
.printDisableText
ld a, [wd11e] ; move number
ld a, [wNamedObjectIndex] ; move number
ld [hl], a
call GetMoveName
ld hl, MoveWasDisabledText

View File

@ -70,8 +70,8 @@ EndOfBattle:
ld [hli], a
dec b
jr nz, .loop
ld hl, wd72c
set 0, [hl]
ld hl, wStatusFlags2
set BIT_WILD_ENCOUNTER_COOLDOWN, [hl]
call WaitForSoundToFinish
call GBPalWhiteOut
ld a, $ff

View File

@ -113,8 +113,8 @@ GainExperience:
ld b, 0
ld hl, wPartySpecies
add hl, bc
ld a, [hl] ; species
ld [wd0b5], a
ld a, [hl]
ld [wCurSpecies], a
call GetMonHeader
ld d, MAX_LEVEL
callfar CalcExperience ; get max exp
@ -160,17 +160,17 @@ GainExperience:
ld a, [hl] ; current level
cp d
jp z, .nextMon ; if level didn't change, go to next mon
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
push af
push hl
ld a, d
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld [hl], a
ld bc, wPartyMon1Species - wPartyMon1Level
add hl, bc
ld a, [hl] ; species
ld [wd0b5], a
ld [wd11e], a
ld a, [hl]
ld [wCurSpecies], a
ld [wPokedexNum], a
call GetMonHeader
ld bc, (wPartyMon1MaxHP + 1) - wPartyMon1Species
add hl, bc
@ -224,7 +224,7 @@ GainExperience:
call CopyData
pop hl
ld a, [wPlayerBattleStatus3]
bit 3, a ; is the mon transformed?
bit TRANSFORMED, a
jr nz, .recalcStatChanges
; the mon is not transformed, so update the unmodified stats
ld de, wPlayerMonUnmodifiedLevel
@ -257,8 +257,8 @@ GainExperience:
call LoadScreenTilesFromBuffer1
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
ld a, [wd0b5]
ld [wd11e], a
ld a, [wCurSpecies]
ld [wPokedexNum], a
predef LearnMoveFromLevelUp
ld hl, wCanEvolveFlags
ld a, [wWhichPokemon]
@ -267,7 +267,7 @@ GainExperience:
predef FlagActionPredef
pop hl
pop af
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
.nextMon
ld a, [wPartyCount]
@ -312,7 +312,7 @@ DivideExpDataByNumMonsGainingExp:
jr nz, .countSetBitsLoop
cp $2
ret c ; return if only one mon is gaining exp
ld [wd11e], a ; store number of mons gaining exp
ld [wTempByteValue], a ; store number of mons gaining exp
ld hl, wEnemyMonBaseStats
ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
.divideLoop
@ -320,7 +320,7 @@ DivideExpDataByNumMonsGainingExp:
ldh [hDividend], a
ld a, [hl]
ldh [hDividend + 1], a
ld a, [wd11e]
ld a, [wTempByteValue]
ldh [hDivisor], a
ld b, $2
call Divide ; divide value by number of mons gaining exp

View File

@ -1,5 +1,5 @@
GetTrainerName_::
ld hl, wGrassRate
ld hl, wLinkEnemyTrainerName
ld a, [wLinkState]
and a
jr nz, .foundName
@ -11,14 +11,14 @@ GetTrainerName_::
jr z, .foundName
cp RIVAL3
jr z, .foundName
ld [wd0b5], a
ld [wNameListIndex], a
ld a, TRAINER_NAME
ld [wNameListType], a
ld a, BANK(TrainerNames)
ld [wPredefBank], a
call GetName
ld hl, wcd6d
ld hl, wNameBuffer
.foundName
ld de, wTrainerName
ld bc, $d
ld bc, ITEM_NAME_LENGTH
jp CopyData

View File

@ -5,12 +5,12 @@ InitBattle::
InitOpponent:
ld a, [wCurOpponent]
ld [wcf91], a
ld [wCurPartySpecies], a
ld [wEnemyMonSpecies2], a
jr InitBattleCommon
DetermineWildOpponent:
ld a, [wd732]
ld a, [wStatusFlags6]
bit BIT_DEBUG_MODE, a
jr z, .notDebugMode
ldh a, [hJoyHeld]
@ -28,7 +28,7 @@ InitBattleCommon:
ld hl, wLetterPrintingDelayFlags
ld a, [hl]
push af
res 1, [hl]
res BIT_TEXT_DELAY, [hl] ; no delay
call InitBattleVariables
ld a, [wEnemyMonSpecies2]
sub OPP_ID_OFFSET
@ -87,14 +87,14 @@ InitWildBattle:
ld a, "T"
ld [hli], a
ld [hl], "@"
ld a, [wcf91]
ld a, [wCurPartySpecies]
push af
ld a, MON_GHOST
ld [wcf91], a
ld [wCurPartySpecies], a
ld de, vFrontPic
call LoadMonFrontSprite ; load ghost sprite
pop af
ld [wcf91], a
ld [wCurPartySpecies], a
jr .spriteLoaded
.isNoGhost
ld de, vFrontPic
@ -171,7 +171,7 @@ LoadMonBackPic:
; Assumes the monster's attributes have
; been loaded with GetMonHeader.
ld a, [wBattleMonSpecies2]
ld [wcf91], a
ld [wCurPartySpecies], a
hlcoord 1, 5
lb bc, 7, 8
call ClearScreenArea

View File

@ -8,16 +8,16 @@ FormatMovesString:
and a ; end of move list?
jr z, .printDashLoop ; print dashes when no moves are left
push hl
ld [wd0b5], a
ld [wNameListIndex], a
ld a, BANK(MoveNames)
ld [wPredefBank], a
ld a, MOVE_NAME
ld [wNameListType], a
call GetName
ld hl, wcd6d
ld hl, wNameBuffer
.copyNameLoop
ld a, [hli]
cp $50
cp "@"
jr z, .doneCopyingName
ld [de], a
inc de
@ -26,7 +26,7 @@ FormatMovesString:
ld a, b
ld [wNumMovesMinusOne], a
inc b
ld a, $4e ; line break
ld a, "<NEXT>"
ld [de], a
inc de
pop hl
@ -42,7 +42,7 @@ FormatMovesString:
ld a, b
cp NUM_MOVES
jr z, .done
ld a, $4e ; line break
ld a, "<NEXT>"
ld [de], a
inc de
jr .printDashLoop
@ -92,9 +92,9 @@ InitList:
ld a, h
ld [wListPointer + 1], a
ld a, e
ld [wUnusedCF8D], a
ld [wUnusedNamePointer], a
ld a, d
ld [wUnusedCF8D + 1], a
ld [wUnusedNamePointer + 1], a
ld bc, ItemPrices
ld a, c
ld [wItemPrices], a

View File

@ -1,6 +1,6 @@
PayDayEffect_:
xor a
ld hl, wcd6d
ld hl, wPayDayMoney
ld [hli], a
ldh a, [hWhoseTurn]
and a
@ -21,7 +21,7 @@ PayDayEffect_:
ld b, $4
call Divide
ldh a, [hQuotient + 3]
ld [hli], a
ld [hli], a ; wPayDayMoney + 1
ldh a, [hRemainder]
ldh [hDividend + 3], a
ld a, 10
@ -33,7 +33,7 @@ PayDayEffect_:
ld b, a
ldh a, [hRemainder]
add b
ld [hl], a
ld [hl], a ; wPayDayMoney + 2
ld de, wTotalPayDayMoney + 2
ld c, $3
predef AddBCDPredef

View File

@ -109,7 +109,7 @@ TransformEffect_:
; original (unmodified) stats and stat mods
pop hl
ld a, [hl]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, wEnemyMonUnmodifiedAttack
ld de, wPlayerMonUnmodifiedAttack

View File

@ -1,4 +1,4 @@
; [wd0b5] = pokemon ID
; [wCurSpecies] = pokemon ID
; hl = dest addr
PrintMonType:
call GetPredefRegisters

View File

@ -49,12 +49,12 @@ ReadTrainer:
ld a, [hli]
cp $FF ; is the trainer special?
jr z, .SpecialTrainer ; if so, check for special moves
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
.LoopTrainerData
ld a, [hli]
and a ; have we reached the end of the trainer data?
jp z, .AddAdditionalMoveData
ld [wcf91], a ; write species somewhere (XXX why?)
ld [wCurPartySpecies], a
ld a, ENEMY_PARTY_DATA
ld [wMonDataLocation], a
push hl
@ -69,9 +69,9 @@ ReadTrainer:
ld a, [hli]
and a ; have we reached the end of the trainer data?
jr z, .AddAdditionalMoveData
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld a, [hli]
ld [wcf91], a
ld [wCurPartySpecies], a
ld a, ENEMY_PARTY_DATA
ld [wMonDataLocation], a
push hl
@ -129,7 +129,7 @@ ReadTrainer:
ld [de], a
inc de
ld [de], a
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
ld b, a
.LastLoop
; update wAmountMoneyWon addresses (money to win) based on enemy's level
@ -141,5 +141,5 @@ ReadTrainer:
inc de
inc de
dec b
jr nz, .LastLoop ; repeat wCurEnemyLVL times
jr nz, .LastLoop ; repeat wCurEnemyLevel times
ret

View File

@ -16,7 +16,7 @@ PrintSafariZoneBattleText:
jr nz, .done
push hl
ld a, [wEnemyMonSpecies]
ld [wd0b5], a
ld [wCurSpecies], a
call GetMonHeader
ld a, [wMonHCatchRate]
ld [wEnemyMonActualCatchRate], a

View File

@ -9,7 +9,7 @@ SaveTrainerName::
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wcd6d
ld de, wNameBuffer
.CopyCharacter
ld a, [hli]
ld [de], a

View File

@ -641,27 +641,27 @@ AICureStatus:
ld [hl], a ; clear status in enemy team roster
ld [wEnemyMonStatus], a ; clear status of active enemy
ld hl, wEnemyBattleStatus3
res 0, [hl]
res BADLY_POISONED, [hl]
ret
AIUseXAccuracy: ; unused
call AIPlayRestoringSFX
ld hl, wEnemyBattleStatus2
set 0, [hl]
set USING_X_ACCURACY, [hl]
ld a, X_ACCURACY
jp AIPrintItemUse
AIUseGuardSpec:
call AIPlayRestoringSFX
ld hl, wEnemyBattleStatus2
set 1, [hl]
set PROTECTED_BY_MIST, [hl]
ld a, GUARD_SPEC
jp AIPrintItemUse
AIUseDireHit: ; unused
call AIPlayRestoringSFX
ld hl, wEnemyBattleStatus2
set 2, [hl]
set GETTING_PUMPED, [hl]
ld a, DIRE_HIT
jp AIPrintItemUse
@ -741,7 +741,7 @@ AIPrintItemUse:
AIPrintItemUse_:
; print "x used [wAIItem] on z!"
ld a, [wAIItem]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetItemName
ld hl, AIBattleUseItemText
jp PrintText

View File

@ -4,8 +4,8 @@ TryDoWildEncounter:
ld a, [wNPCMovementScriptPointerTableNum]
and a
ret nz
ld a, [wd736]
and a
ld a, [wMovementFlags]
and a ; is player exiting a door, jumping over a ledge, or fishing?
ret nz
callfar IsPlayerStandingOnDoorTileOrWarpTile
jr nc, .notStandingOnDoorOrWarpTile
@ -73,23 +73,23 @@ TryDoWildEncounter:
ld b, 0
add hl, bc
ld a, [hli]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld a, [hl]
ld [wcf91], a
ld [wCurPartySpecies], a
ld [wEnemyMonSpecies2], a
ld a, [wRepelRemainingSteps]
and a
jr z, .willEncounter
ld a, [wPartyMon1Level]
ld b, a
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
cp b
jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon
jr .willEncounter
.lastRepelStep
ld [wRepelRemainingSteps], a
ld a, TEXT_REPEL_WORE_OFF
ldh [hSpriteIndexOrTextID], a
ldh [hTextID], a
call EnableAutoTextBoxDrawing
call DisplayTextID
.CantEncounter2

View File

@ -55,7 +55,7 @@ IF DEF(_DEBUG)
jp z, TestBattle
; DEBUG
ld hl, wd732
ld hl, wStatusFlags6
set BIT_DEBUG_MODE, [hl]
ld hl, StartNewGameDebug
ret
@ -78,7 +78,7 @@ TestBattle: ; unreferenced except in _DEBUG
ld a, 1 << BIT_EARTHBADGE
ld [wObtainedBadges], a
ld hl, wFlags_D733
ld hl, wStatusFlags7
set BIT_TEST_BATTLE, [hl]
ld hl, wNumBagItems
@ -88,7 +88,7 @@ TestBattle: ; unreferenced except in _DEBUG
cp -1
jr z, .done
inc de
ld [wcf91], a
ld [wCurItem], a
ld a, [de]
inc de
ld [wItemQuantity], a
@ -186,7 +186,7 @@ Func_fe812:
; fallthrough
Func_fe81a:
ld [de], a
ld [wd11e], a
ld [wTempByteValue], a
push bc
push hl
push de
@ -201,7 +201,7 @@ Func_fe81a:
ld de, Text_fed9c
call PlaceString
pop hl
ld a, [wd11e]
ld a, [wNamedObjectIndex]
and a
jr nz, .asm_fe845
ld de, Text_feda2
@ -424,17 +424,17 @@ Func_fe97f:
ld [wIsInBattle], a
.asm_fe990
ld a, b
ld [wcf91], a
ld [wCurPartySpecies], a
ld a, [hl]
ld b, a
inc de
ld a, [de]
and a
jr z, .asm_fe9ab
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
xor a
ld [wMonDataLocation], a
ld a, [wcf91]
ld a, [wCurPartySpecies]
and a
jr z, .asm_fe9ab
call AddPartyMon
@ -487,9 +487,9 @@ Func_fe97f:
dec a
jr z, .asm_fea40
ld a, [wTrainerClass]
ld [wd11e], a
ld [wTempByteValue], a
ld b, a
ld de, wd11e
ld de, wTempByteValue
hlcoord 1, 8
push bc
lb bc, LEADING_ZEROES | 1, 3
@ -507,7 +507,7 @@ Func_fe97f:
ld a, b
and a
jr z, .asm_fea65
ld de, wd11e
ld de, wTempByteValue
ld [de], a
hlcoord 1, 8
push bc
@ -523,7 +523,7 @@ Func_fe97f:
.asm_fea65
ld a, [wEnemyMonLevel]
ld c, a
ld de, wd11e
ld de, wTempByteValue
ld [de], a
hlcoord 16, 8
push bc
@ -626,13 +626,13 @@ Func_feb13:
; fallthrough
Func_feb35:
ld a, b
ld [wd11e], a
ld de, wd11e
ld [wTempByteValue], a
ld de, wTempByteValue
hlcoord 1, 8
push bc
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
ld a, [wd11e]
ld a, [wTempByteValue]
ld [wTrainerClass], a
call GetTrainerName
hlcoord 5, 8
@ -649,8 +649,8 @@ Func_feb35:
; fallthrough
Func_feb64:
ld a, b
ld [wd11e], a
ld de, wd11e
ld [wTempByteValue], a
ld de, wTempByteValue
hlcoord 1, 8
push bc
lb bc, LEADING_ZEROES | 1, 3
@ -725,7 +725,7 @@ Func_febe6:
Func_febee:
hlcoord 16, 8
ld a, c
ld de, wCurEnemyLVL
ld de, wCurEnemyLevel
ld [de], a
push bc
lb bc, LEADING_ZEROES | 1, 3
@ -761,11 +761,11 @@ Func_fec10:
ld [wTrainerNo], a
.asm_fec28
ld a, c
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld a, b
ld [wCurOpponent], a
xor a
ld [wd72d], a
ld [wStatusFlags3], a
predef InitOpponent
xor a
ld [wNumRunAttempts], a
@ -817,7 +817,7 @@ Func_fec9b:
ld a, [de]
cp -1
jp z, Func_fed01
ld [wd11e], a
ld [wTempByteValue], a
push hl
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
@ -838,7 +838,7 @@ Func_fec9b:
ld d, h
ld e, l
ld a, [de]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
pop hl
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
@ -849,7 +849,7 @@ Func_fec9b:
jr nc, .asm_fecee
inc d
.asm_fecee
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
ld [de], a
pop hl
ld a, [wWhichPokemon]
@ -935,8 +935,8 @@ Func_fedfe:
ld [hl], a
inc a
ldh [hJoy7], a
ld [wcf91], a
ld [wCurEnemyLVL], a
ld [wCurPartySpecies], a
ld [wCurEnemyLevel], a
; fallthrough
Func_fee23:
hlcoord 0, 3
@ -957,7 +957,7 @@ Func_fee23:
jr .asm_fee30
Func_fee49:
ld hl, wcf91
ld hl, wCurPartySpecies
inc [hl]
ld a, [hl]
cp NUM_POKEMON + 1
@ -966,7 +966,7 @@ Func_fee49:
jr Func_fee23
Func_fee56:
ld hl, wcf91
ld hl, wCurPartySpecies
dec [hl]
jr nz, Func_fee23
ld [hl], DEX_MEW
@ -977,19 +977,19 @@ Func_fee60:
lb bc, 2, 9
call ClearScreenArea
hlcoord 1, 1
ld de, wcf91
ld de, wCurPartySpecies
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
inc hl
push hl
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurPartySpecies]
ld [wPokedexNum], a
callfar PokedexToIndex
call GetMonName
pop hl
call PlaceString
ld a, [wd11e]
ld [wd0b5], a
ld a, [wPokedexNum]
ld [wCurSpecies], a
call GetMonHeader
ret
@ -1005,7 +1005,7 @@ Func_fee96:
.asm_feeab
call DelayFrame
call JoypadLowSensitivity
ld hl, wCurEnemyLVL
ld hl, wCurEnemyLevel
ldh a, [hJoy5]
bit BIT_A_BUTTON, a
jp nz, Func_feed1
@ -1035,7 +1035,7 @@ Func_feedb:
Func_feee2:
hlcoord 1, 3
ld de, wCurEnemyLVL
ld de, wCurEnemyLevel
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
ret
@ -1044,9 +1044,9 @@ Func_feeef:
hlcoord 1, 4
lb bc, 8, 11
call ClearScreenArea
ld a, [wcf91]
ld a, [wCurPartySpecies]
push af
ld [wd11e], a
ld [wPokedexNum], a
ld hl, BaseStats + 15
dec a
ld bc, BASE_DATA_SIZE
@ -1056,8 +1056,8 @@ Func_feeef:
ld a, BANK(BaseStats)
call FarCopyData
callfar PokedexToIndex
ld a, [wd11e]
ld [wcf91], a
ld a, [wPokedexNum]
ld [wCurPartySpecies], a
xor a
ld [wChangeMonPicEnemyTurnSpecies], a
ld de, wMoves
@ -1073,8 +1073,8 @@ Func_feeef:
push de
push bc
push hl
ld [wd11e], a
ld de, wd11e
ld [wTempByteValue], a
ld de, wTempByteValue
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
inc hl
@ -1089,7 +1089,7 @@ Func_feeef:
jr nz, .asm_fef36
.asm_fef5b
pop af
ld [wcf91], a
ld [wCurPartySpecies], a
ret
Func_fef60:
@ -1183,11 +1183,11 @@ Func_fefc5:
pop hl
inc hl
ld a, [de]
ld de, wd11e
ld de, wTempByteValue
ld [de], a
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
ld a, [wd11e]
ld a, [wTempByteValue]
and a
jr z, .asm_ff002
call Func_ff006
@ -1201,19 +1201,19 @@ Func_fefc5:
ret
Func_ff006:
ld a, [wcf91]
ld a, [wCurPartySpecies]
push af
ld a, [wd11e]
ld a, [wPokedexNum]
push af
push hl
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurPartySpecies]
ld [wPokedexNum], a
callfar PokedexToIndex
ld a, [wd11e]
ld [wcf91], a
ld a, [wPokedexNum]
ld [wCurPartySpecies], a
pop hl
pop af
ld [wd11e], a
ld [wPokedexNum], a
push hl
callfar Func_3b079
pop hl
@ -1221,7 +1221,7 @@ Func_ff006:
ld [hl], "×"
.asm_ff036
pop af
ld [wcf91], a
ld [wCurPartySpecies], a
ret
Func_ff03b:
@ -1306,7 +1306,7 @@ Func_ff09e:
pop hl
inc hl
ld a, [de]
ld de, wd11e
ld de, wTempByteValue
ld [de], a
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
@ -1366,17 +1366,17 @@ Text_ff113:
next "とくしゅ@" ; special
Func_ff12c:
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
ld [wEnemyMonLevel], a
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurPartySpecies]
ld [wPokedexNum], a
callfar PokedexToIndex
ld a, [wd11e]
ld [wcf91], a
ld [wd0b5], a
ld a, [wPokedexNum]
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call GetMonHeader
ld hl, wEnemyMon
ld a, [wcf91]
ld a, [wCurPartySpecies]
ld [hli], a
ld a, [wLoadedMonStats]
ld [hli], a
@ -1436,7 +1436,7 @@ Func_ff1b9:
ld a, 1
ldh [hJoy7], a
ld a, 2
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld hl, Text_ff290
call PrintText
call YesNoChoice
@ -1463,7 +1463,7 @@ Func_ff1e7:
ld [hl], "ル"
inc hl
inc hl
ld de, wCurEnemyLVL
ld de, wCurEnemyLevel
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
call DelayFrame
@ -1478,20 +1478,20 @@ Func_ff1e7:
jr Func_ff1e7
Func_ff21b:
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
inc a
cp MAX_LEVEL + 1
jr c, Func_ff231
ld a, 2
jr Func_ff231
Func_ff227:
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
dec a
cp 2
jr nc, Func_ff231
ld a, MAX_LEVEL
Func_ff231:
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
jr Func_ff1e7
Func_ff236:
@ -1511,16 +1511,16 @@ Func_ff236:
push bc
push de
ld a, c
ld [wd11e], a
ld [wPokedexNum], a
callfar PokedexToIndex
ld a, [wd11e]
ld a, [wPokedexNum]
ld [wEnemyMonSpecies2], a
ld [wcf91], a
ld [wCurPartySpecies], a
xor a
ld [wEnemyBattleStatus3], a
callfar LoadEnemyMonData
ld a, [wEnemyMonSpecies2]
ld [wcf91], a
ld [wCurPartySpecies], a
callfar SendNewMonToBox
pop de
pop bc

View File

@ -4,10 +4,10 @@ SetDebugNewGameParty: ; unreferenced except in _DEBUG
ld a, [de]
cp -1
ret z
ld [wcf91], a
ld [wCurPartySpecies], a
inc de
ld a, [de]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
inc de
call AddPartyMon
jr .loop
@ -58,7 +58,7 @@ IF DEF(_DEBUG)
ld a, [de]
cp -1
jr z, .items_end
ld [wcf91], a
ld [wCurItem], a
inc de
ld a, [de]
inc de

View File

@ -10,7 +10,7 @@ ResetStatusAndHalveMoneyOnBlackout::
ld [wNPCMovementScriptFunctionNum], a
ldh [hJoyHeld], a
ld [wNPCMovementScriptPointerTableNum], a
ld [wFlags_0xcd60], a
ld [wMiscFlags], a
ldh [hMoney], a
ldh [hMoney + 1], a
@ -39,10 +39,10 @@ ResetStatusAndHalveMoneyOnBlackout::
ld [wPlayerMoney + 2], a
.lostmoney
ld hl, wd732
set 2, [hl]
res 3, [hl]
set 6, [hl]
ld a, %11111111
ld hl, wStatusFlags6
set BIT_FLY_OR_DUNGEON_WARP, [hl]
res BIT_FLY_WARP, [hl]
set BIT_ESCAPE_WARP, [hl]
ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN
ld [wJoyIgnore], a
predef_jump HealParty

View File

@ -28,7 +28,7 @@ PrintCardKeyText:
xor a
ld [wPlayerMovingDirection], a
tx_pre_id CardKeySuccessText
ldh [hSpriteIndexOrTextID], a
ldh [hTextID], a
call PrintPredefTextID
call GetCoordsInFrontOfPlayer
srl d
@ -50,12 +50,12 @@ PrintCardKeyText:
ld [wNewTileBlockID], a
predef ReplaceTileBlock
ld hl, wCurrentMapScriptFlags
set 5, [hl]
set BIT_CUR_MAP_LOADED_1, [hl]
ld a, SFX_GO_INSIDE
jp PlaySound
.noCardKey
tx_pre_id CardKeyFailText
ldh [hSpriteIndexOrTextID], a
ldh [hTextID], a
jp PrintPredefTextID
INCLUDE "data/events/card_key_maps.asm"

View File

@ -1,6 +1,6 @@
GiveFossilToCinnabarLab::
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
xor a
ld [wCurrentMenuItem], a
ld a, A_BUTTON | B_BUTTON
@ -24,8 +24,8 @@ GiveFossilToCinnabarLab::
call TextBoxBorder
call UpdateSprites
call PrintFossilsInBag
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call HandleMenuInput
bit BIT_B_BUTTON, a
jr nz, .cancelledGivingFossil
@ -98,13 +98,13 @@ PrintFossilsInBag:
cp $ff
ret z
push hl
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetItemName
hlcoord 2, 2
ldh a, [hItemCounter]
ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld de, wcd6d
ld de, wNameBuffer
call PlaceString
ld hl, hItemCounter
inc [hl]
@ -114,10 +114,10 @@ PrintFossilsInBag:
; loads the names of the fossil item and the resulting mon
LoadFossilItemAndMonName::
ld a, [wFossilMon]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
call CopyToStringBuffer
ld a, [wFossilItem]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetItemName
ret

View File

@ -4,12 +4,12 @@ DisplayDiploma::
call ClearScreen
xor a
ld [wUpdateSpritesEnabled], a
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
callfar _DisplayDiploma
call WaitForTextScrollButtonPress
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3
call ReloadTilesetTilePatterns
call RestoreScreenTilesAndReloadTilePatterns

View File

@ -1,14 +1,14 @@
_DisplayPokedex::
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
predef ShowPokedexData
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call ReloadMapData
ld c, 10
call DelayFrames
predef IndexToPokedex
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld c, a
ld b, FLAG_SET

View File

@ -1,12 +1,12 @@
DisplayElevatorFloorMenu:
ld hl, wd730
ld hl, wStatusFlags5
ld a, [hl]
push af
set 6, [hl]
set BIT_NO_TEXT_DELAY, [hl]
ld hl, WhichFloorText
call PrintText
pop af
ld [wd730], a
ld [wStatusFlags5], a
ld hl, wItemList
ld a, l
ld [wListPointer], a
@ -26,7 +26,7 @@ DisplayElevatorFloorMenu:
ld [wListScrollOffset], a
ret c
ld hl, wCurrentMapScriptFlags
set 7, [hl]
set BIT_CUR_MAP_USED_ELEVATOR, [hl]
ld hl, wElevatorWarpMaps
ld a, [wWhichPokemon]
add a

View File

@ -13,7 +13,7 @@ _GivePokemon::
; add to box
xor a
ld [wEnemyBattleStatus3], a
ld a, [wcf91]
ld a, [wCurPartySpecies]
ld [wEnemyMonSpecies2], a
callfar LoadEnemyMonData
call SetPokedexOwnedFlag
@ -54,18 +54,18 @@ _GivePokemon::
ret
SetPokedexOwnedFlag:
ld a, [wcf91]
ld a, [wCurPartySpecies]
push af
ld [wd11e], a
ld [wPokedexNum], a
predef IndexToPokedex
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld c, a
ld hl, wPokedexOwned
ld b, FLAG_SET
predef FlagActionPredef
pop af
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, GotMonText
jp PrintText

View File

@ -37,10 +37,10 @@ HealParty:
ld hl, Moves
ld bc, MOVE_LENGTH
call AddNTimes
ld de, wcd6d
ld de, wMoveData
ld a, BANK(Moves)
call FarCopyData
ld a, [wcd6d + 5] ; PP is byte 5 of move data
ld a, [wMoveData + MOVE_PP]
pop bc
pop de
@ -84,7 +84,7 @@ HealParty:
.done
xor a
ld [wWhichPokemon], a
ld [wd11e], a
ld [wUsingPPUp], a
ld a, [wPartyCount]
ld b, a

View File

@ -14,7 +14,7 @@ HiddenItems:
ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld a, [wHiddenObjectFunctionArgument] ; item ID
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetItemName
tx_pre_jump FoundHiddenItemText

View File

@ -80,8 +80,8 @@ BillsHousePokemonList::
ld a, 1
ld [wTopMenuItemX], a
.billsPokemonLoop
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 0
lb bc, 10, 9
call TextBoxBorder
@ -110,8 +110,8 @@ BillsHousePokemonList::
call LoadScreenTilesFromBuffer2
jr .billsPokemonLoop
.cancel
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call LoadScreenTilesFromBuffer2
jp TextScriptEnd

View File

@ -94,7 +94,7 @@ CinnabarGymQuiz_AskQuestion:
cp c
jr nz, .wrongAnswer
ld hl, wCurrentMapScriptFlags
set 5, [hl]
set BIT_CUR_MAP_LOADED_1, [hl]
ldh a, [hGymGateIndex]
ldh [hBackupGymGateIndex], a
ld hl, CinnabarGymQuizCorrectText

View File

@ -1,6 +1,6 @@
FanClubPicture1:
ld a, RAPIDASH
ld [wcf91], a
ld [wCurPartySpecies], a
call DisplayMonFrontSpriteInBox
call EnableAutoTextBoxDrawing
tx_pre FanClubPicture1Text
@ -12,7 +12,7 @@ FanClubPicture1Text::
FanClubPicture2:
ld a, FEAROW
ld [wcf91], a
ld [wCurPartySpecies], a
call DisplayMonFrontSpriteInBox
call EnableAutoTextBoxDrawing
tx_pre FanClubPicture2Text

View File

@ -3,7 +3,7 @@ IndigoPlateauStatues::
ld hl, IndigoPlateauStatuesText1
call PrintText
ld a, [wXCoord]
bit 0, a
bit 0, a ; even or odd?
ld hl, IndigoPlateauStatuesText2
jr nz, .ok
ld hl, IndigoPlateauStatuesText3

View File

@ -1,6 +1,6 @@
AerodactylFossil:
ld a, FOSSIL_AERODACTYL
ld [wcf91], a
ld [wCurPartySpecies], a
call DisplayMonFrontSpriteInBox
call EnableAutoTextBoxDrawing
tx_pre AerodactylFossilText
@ -12,7 +12,7 @@ AerodactylFossilText::
KabutopsFossil:
ld a, FOSSIL_KABUTOPS
ld [wcf91], a
ld [wCurPartySpecies], a
call DisplayMonFrontSpriteInBox
call EnableAutoTextBoxDrawing
tx_pre KabutopsFossilText

View File

@ -1,6 +1,5 @@
DisplayMonFrontSpriteInBox:
; Displays a pokemon's front sprite in a pop-up window.
; [wcf91] = pokemon internal id number
ld a, 1
ldh [hAutoBGTransferEnabled], a
call Delay3
@ -11,8 +10,8 @@ DisplayMonFrontSpriteInBox:
ld [wTextBoxID], a
call DisplayTextBoxID
call UpdateSprites
ld a, [wcf91]
ld [wd0b5], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetMonHeader
ld de, vChars1 tile $31
call LoadMonFrontSprite

View File

@ -3,7 +3,7 @@ OpenPokemonCenterPC:
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
ld a, TRUE
ld a, 1 << BIT_NO_AUTO_TEXT_BOX
ld [wAutoTextBoxDrawingControl], a
tx_pre_jump PokemonCenterPCText

View File

@ -5,7 +5,7 @@ Route15GateLeftBinoculars:
call EnableAutoTextBoxDrawing
tx_pre Route15UpstairsBinocularsText
ld a, ARTICUNO
ld [wcf91], a
ld [wCurPartySpecies], a
call PlayCry
call DisplayMonFrontSpriteInBox
xor a

View File

@ -40,7 +40,7 @@ SafariZoneGameOver:
cp SFX_SAFARI_ZONE_PA
jr nz, .waitForMusicToPlay
ld a, TEXT_SAFARI_GAME_OVER
ldh [hSpriteIndexOrTextID], a
ldh [hTextID], a
call DisplayTextID
xor a
ld [wPlayerMovingDirection], a

View File

@ -24,8 +24,8 @@ LinkCableHelp::
ld a, 1
ld [wTopMenuItemX], a
.linkHelpLoop
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 0
lb bc, 8, 13
call TextBoxBorder
@ -40,8 +40,8 @@ LinkCableHelp::
ld a, [wCurrentMenuItem]
cp 3 ; pressed a on "STOP READING"
jr z, .exit
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
ld hl, LinkCableInfoTexts
add a
ld d, 0
@ -53,8 +53,8 @@ LinkCableHelp::
call PrintText
jp .linkHelpLoop
.exit
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call LoadScreenTilesFromBuffer1
jp TextScriptEnd
@ -107,8 +107,8 @@ ViridianSchoolBlackboard::
ld a, 1
ld [wTopMenuItemX], a
.blackboardLoop
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 0
lb bc, 6, 10
call TextBoxBorder
@ -157,8 +157,8 @@ ViridianSchoolBlackboard::
jr z, .exitBlackboard
; we must have pressed a on a status condition
; so print the text
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
ld hl, ViridianBlackboardStatusPointers
add a
ld d, 0
@ -170,8 +170,8 @@ ViridianSchoolBlackboard::
call PrintText
jp .blackboardLoop
.exitBlackboard
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call LoadScreenTilesFromBuffer1
jp TextScriptEnd

View File

@ -4,8 +4,8 @@ TownMapText::
text_asm
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3
xor a
ldh [hWY], a
@ -13,8 +13,8 @@ TownMapText::
ldh [hAutoBGTransferEnabled], a
call LoadFontTilePatterns
farcall DisplayTownMap
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
ld de, TextScriptEnd
push de
ldh a, [hLoadedROMBank]

View File

@ -61,7 +61,7 @@ GymTrashScript:
; Completed the trash can puzzle.
SetEvent EVENT_2ND_LOCK_OPENED
ld hl, wCurrentMapScriptFlags
set 6, [hl]
set BIT_CUR_MAP_LOADED_2, [hl]
tx_pre_id VermilionGymTrashSuccessText3

View File

@ -69,9 +69,9 @@ DoInGameTradeDialogue:
; copies name of species a to hl
InGameTrade_GetMonName:
push de
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, wcd6d
ld hl, wNameBuffer
pop de
ld bc, NAME_LENGTH
jp CopyData
@ -91,7 +91,7 @@ InGameTrade_DoTrade:
jp c, .tradeFailed ; jump if the player didn't select a pokemon
ld a, [wInGameTradeGiveMonSpecies]
ld b, a
ld a, [wcf91]
ld a, [wCurPartySpecies]
cp b
ld a, $2
jr nz, .tradeFailed ; jump if the selected mon's species is not the required one
@ -100,24 +100,24 @@ InGameTrade_DoTrade:
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld a, [hl]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld b, FLAG_SET
call InGameTrade_FlagActionPredef
ld hl, ConnectCableText
call PrintText
ld a, [wWhichPokemon]
push af
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
push af
call LoadHpBarAndStatusTilePatterns
call InGameTrade_PrepareTradeData
predef InternalClockTradeAnim
pop af
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
pop af
ld [wWhichPokemon], a
ld a, [wInGameTradeReceiveMonSpecies]
ld [wcf91], a
ld [wCurPartySpecies], a
xor a
ld [wMonDataLocation], a ; not used
ld [wRemoveMonFromBox], a

View File

@ -1,7 +1,7 @@
PickUpItem:
call EnableAutoTextBoxDrawing
ldh a, [hSpriteIndexOrTextID]
ldh a, [hSpriteIndex]
ld b, a
ld hl, wMissableObjectList
.missableObjectsListLoop
@ -18,7 +18,7 @@ PickUpItem:
ldh [hMissableObjectIndex], a
ld hl, wMapSpriteExtraData
ldh a, [hSpriteIndexOrTextID]
ldh a, [hSpriteIndex]
dec a
add a
ld d, 0

View File

@ -1,12 +1,13 @@
ApplyOutOfBattlePoisonDamage:
ld a, [wd730]
add a
ld a, [wStatusFlags5]
assert BIT_SCRIPTED_MOVEMENT_STATE == 7
add a ; overflows scripted movement state bit into carry flag
jp c, .noBlackOut ; no black out if joypad states are being simulated
ld a, [wd492]
bit 7, a
jp nz, .noBlackOut
ld a, [wd72e]
bit 6, a
ld a, [wStatusFlags4]
bit BIT_LINK_CONNECTED, a
jp nz, .noBlackOut
ld a, [wPartyCount]
and a
@ -50,7 +51,7 @@ ApplyOutOfBattlePoisonDamage:
inc hl
ld [hl], a
ld a, [de]
ld [wd11e], a
ld [wPokedexNum], a
push de
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
@ -59,7 +60,7 @@ ApplyOutOfBattlePoisonDamage:
ld [wJoyIgnore], a
call EnableAutoTextBoxDrawing
ld a, TEXT_MON_FAINTED
ldh [hSpriteIndexOrTextID], a
ldh [hTextID], a
call DisplayTextID
callfar IsThisPartymonStarterPikachu_Party
jr nc, .curMonNotPlayerPikachu
@ -112,10 +113,10 @@ ApplyOutOfBattlePoisonDamage:
jr nz, .noBlackOut
call EnableAutoTextBoxDrawing
ld a, TEXT_BLACKED_OUT
ldh [hSpriteIndexOrTextID], a
ldh [hTextID], a
call DisplayTextID
ld hl, wd72e
set 5, [hl]
ld hl, wStatusFlags4
set BIT_BATTLE_OVER_OR_BLACKOUT, [hl]
ld a, $ff
jr .done
.noBlackOut

View File

@ -11,10 +11,10 @@ DisplayPokemonCenterDialogue_::
call SaveScreenTilesToBuffer1 ; save screen
ld hl, PokemonCenterWelcomeText
call PrintText
ld hl, wd72e
bit 2, [hl]
set 1, [hl]
set 2, [hl]
ld hl, wStatusFlags4
bit BIT_USED_POKECENTER, [hl]
set BIT_UNKNOWN_4_1, [hl]
set BIT_USED_POKECENTER, [hl]
jr nz, .skipShallWeHealYourPokemon
ld hl, ShallWeHealYourPokemonText
call PrintText

View File

@ -72,7 +72,7 @@ DisplayPokemartDialogue_::
ld a, [wIsKeyItem]
and a
jr nz, .unsellableItem
ld a, [wcf91]
ld a, [wCurItem]
call IsItemHM
jr c, .unsellableItem
ld a, PRICEDITEMLISTMENU
@ -156,8 +156,8 @@ DisplayPokemartDialogue_::
call DisplayChooseQuantityMenu
inc a
jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button
ld a, [wcf91] ; item ID
ld [wd11e], a ; store item ID for GetItemName
ld a, [wCurItem]
ld [wNamedObjectIndex], a
call GetItemName
call CopyToStringBuffer
ld hl, PokemartTellBuyPriceText

View File

@ -5,8 +5,8 @@ CeladonPrizeMenu::
ld hl, RequireCoinCaseTextPtr
jp PrintText
.havingCoinCase
ld hl, wd730
set 6, [hl] ; disable letter-printing delay
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
ld hl, ExchangeCoinsForPrizesTextPtr
call PrintText
; the following are the menu settings
@ -37,8 +37,8 @@ CeladonPrizeMenu::
jr z, .noChoice
call HandlePrizeChoice
.noChoice
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
ret
RequireCoinCaseTextPtr:
@ -55,17 +55,14 @@ WhichPrizeTextPtr:
text_end
GetPrizeMenuId:
; determine which one among the three
; prize-texts has been selected
; using the text ID (stored in [hSpriteIndexOrTextID])
; load the three prizes at wd13d-wd13f
; load the three prices at wd141-wd146
; display the three prizes' names
; (distinguishing between Pokemon names
; and Items (specifically TMs) names)
ldh a, [hSpriteIndexOrTextID]
sub 3 ; prize-texts' id are 3, 4 and 5
ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2)
; determine which one among the three prize texts has been selected using the text ID (stored in [hTextID])
; prize texts' IDs are TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1-TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_3
; load the three prizes at wPrize1-wPrice3
; load the three prices at wPrize1Price-wPrize3Price
; display the three prizes' names, distinguishing between Pokemon names and item names (specifically TMs)
ldh a, [hTextID]
sub TEXT_GAMECORNERPRIZEROOM_PRIZE_VENDOR_1
ld [wWhichPrizeWindow], a ; prize texts' relative ID (i.e. 0-2)
add a
add a
ld d, 0
@ -87,37 +84,37 @@ GetPrizeMenuId:
ld bc, 6
call CopyData
ld a, [wWhichPrizeWindow]
cp 2 ;is TM_menu?
cp 2 ; is TM_menu?
jr nz, .putMonName
ld a, [wPrize1]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetItemName
hlcoord 2, 4
call PlaceString
ld a, [wPrize2]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetItemName
hlcoord 2, 6
call PlaceString
ld a, [wPrize3]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetItemName
hlcoord 2, 8
call PlaceString
jr .putNoThanksText
.putMonName
ld a, [wPrize1]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
hlcoord 2, 4
call PlaceString
ld a, [wPrize2]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
hlcoord 2, 6
call PlaceString
ld a, [wPrize3]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
hlcoord 2, 8
call PlaceString
@ -193,7 +190,7 @@ HandlePrizeChoice:
ld hl, wPrize1
add hl, de
ld a, [hl]
ld [wd11e], a
ld [wNamedObjectIndex], a
ld a, [wWhichPrizeWindow]
cp 2 ; is prize a TM?
jr nz, .getMonName
@ -212,9 +209,9 @@ HandlePrizeChoice:
call HasEnoughCoins
jr c, .notEnoughCoins
ld a, [wWhichPrizeWindow]
cp $02
cp 2 ; is prize a TM?
jr nz, .giveMon
ld a, [wd11e]
ld a, [wNamedObjectIndex]
ld b, a
ld a, 1
ld c, a
@ -222,8 +219,8 @@ HandlePrizeChoice:
jr nc, .bagFull
jr .subtractCoins
.giveMon
ld a, [wd11e]
ld [wcf91], a
ld a, [wNamedObjectIndex]
ld [wCurPartySpecies], a
push af
call GetPrizeMonLevel
ld c, a
@ -288,7 +285,7 @@ OhFineThenTextPtr:
text_end
GetPrizeMonLevel:
ld a, [wcf91]
ld a, [wCurPartySpecies]
ld b, a
ld hl, PrizeMonLevelDictionary
.loop
@ -299,7 +296,7 @@ GetPrizeMonLevel:
jr .loop
.matchFound
ld a, [hl]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ret
INCLUDE "data/events/prize_mon_levels.asm"

View File

@ -15,8 +15,8 @@ VendingMachineMenu::
ld [wTopMenuItemY], a
ld a, 1
ld [wTopMenuItemX], a
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
hlcoord 0, 3
lb bc, 8, 12
call TextBoxBorder
@ -27,8 +27,8 @@ VendingMachineMenu::
hlcoord 9, 6
ld de, DrinkPriceText
call PlaceString
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call HandleMenuInput
bit BIT_B_BUTTON, a
jr nz, .notThirsty

View File

@ -34,7 +34,7 @@ LoadBGMapAttributes::
ldh [rHDMA4], a
ldh a, [rLCDC]
and rLCDC_ENABLE_MASK ; is LCD off?
and 1 << rLCDC_ENABLE ; is LCD off?
jr z, .lcdOff ; if off, transfer immediately
; wait for VBlank if LCD is on
.waitForVBlankLoop1
@ -68,7 +68,7 @@ LoadBGMapAttributes::
ldh [rHDMA4], a
; LCD check again
ldh a, [rLCDC]
and rLCDC_ENABLE_MASK ; is LCD off?
and 1 << rLCDC_ENABLE ; is LCD off?
jr z, .lcdOff2 ; if off, transfer immediately
; wait for VBlank if LCD is on
.waitForVBlankLoop2

View File

@ -215,7 +215,7 @@ UpdateHPBar_PrintHPNumber:
push hl
ld de, $15
ldh a, [hUILayoutFlags]
bit 0, a
bit BIT_PARTY_MENU_HP_BAR, a
jr z, .hpBelowBar
ld de, $9
.hpBelowBar

View File

@ -208,9 +208,9 @@ WriteMonPartySpriteOAMBySpecies:
UnusedPartyMonSpriteFunction:
; This function is unused and doesn't appear to do anything useful. It looks
; like it may have been intended to load the tile patterns and OAM data for
; the mon party sprite associated with the species in [wcf91].
; the mon party sprite associated with the species in [wCurPartySpecies].
; However, its calculations are off and it loads garbage data.
ld a, [wcf91]
ld a, [wCurPartySpecies]
call GetPartyMonSpriteID
push af
ld hl, vSprites tile $00
@ -270,9 +270,9 @@ WriteMonPartySpriteOAM:
jp CopyData
GetPartyMonSpriteID:
ld [wd11e], a
ld [wPokedexNum], a
predef IndexToPokedex
ld a, [wd11e]
ld a, [wPokedexNum]
ld c, a
dec a
srl a
@ -281,7 +281,7 @@ GetPartyMonSpriteID:
ld d, 0
add hl, de
ld a, [hl]
bit 0, c
bit 0, c ; even or odd?
jr nz, .skipSwap
swap a ; use lower nybble if pokedex num is even
.skipSwap

View File

@ -75,7 +75,7 @@ SetPal_StatusScreen:
ld de, wPalPacket
ld bc, $10
call CopyData
ld a, [wcf91]
ld a, [wCurPartySpecies]
cp NUM_POKEMON_INDEXES + 1
jr c, .pokemon
ld a, $1 ; not pokemon
@ -103,7 +103,7 @@ SetPal_Pokedex:
ld de, wPalPacket
ld bc, $10
call CopyData
ld a, [wcf91]
ld a, [wCurPartySpecies]
call DeterminePaletteIDOutOfBattle
ld hl, wPalPacket + 3
ld [hl], a
@ -297,13 +297,13 @@ BadgeBlkDataLengths:
DeterminePaletteID:
ld a, [hl]
DeterminePaletteIDOutOfBattle:
ld [wd11e], a
ld [wPokedexNum], a
and a ; is the mon index 0?
jr z, .skipDexNumConversion
push bc
predef IndexToPokedex
pop bc
ld a, [wd11e]
ld a, [wPokedexNum]
.skipDexNumConversion
ld e, a
ld d, 0
@ -723,7 +723,7 @@ SendSGBPackets:
pop hl
call InitGBCPalettes
ldh a, [rLCDC]
and rLCDC_ENABLE_MASK
and 1 << rLCDC_ENABLE
ret z
call Delay3
ret
@ -853,7 +853,7 @@ TransferCurBGPData::
ld hl, wGBCPal
ld b, %10 ; mask for non-V-blank/non-H-blank STAT mode
ldh a, [rLCDC]
and rLCDC_ENABLE_MASK
and 1 << rLCDC_ENABLE
jr nz, .lcdEnabled
REPT NUM_PAL_COLORS
call TransferPalColorLCDDisabled
@ -892,7 +892,7 @@ BufferBGPPal::
TransferBGPPals::
; Transfer the buffered BG palettes.
ldh a, [rLCDC]
and rLCDC_ENABLE_MASK
and 1 << rLCDC_ENABLE
jr z, .lcdDisabled
di
.waitLoop
@ -929,7 +929,7 @@ TransferCurOBPData:
ld hl, wGBCPal
ld b, %10 ; mask for non-V-blank/non-H-blank STAT mode
ldh a, [rLCDC]
and rLCDC_ENABLE_MASK
and 1 << rLCDC_ENABLE
jr nz, .lcdEnabled
REPT NUM_PAL_COLORS
call TransferPalColorLCDDisabled

View File

@ -63,7 +63,7 @@ PredefShakeScreenHorizontally:
ldh a, [hMutateWX]
xor b
ldh [hMutateWX], a
bit 7, a
bit 7, a ; negative?
jr z, .skipZeroing
xor a ; zero a if it's negative
.skipZeroing

View File

@ -113,7 +113,7 @@ PrepareOAMData::
inc hl
inc e
ld a, [hl]
bit 1, a ; is the tile allowed to set the sprite priority bit?
bit BIT_SPRITE_UNDER_GRASS, a
jr z, .skipPriority
ldh a, [hSpritePriority]
or [hl]
@ -139,8 +139,8 @@ PrepareOAMData::
; Clear unused OAM.
.asm_4a41
ld a, [wd736]
bit 6, a ; jumping down ledge or fishing animation?
ld a, [wMovementFlags]
bit BIT_LEDGE_OR_FISHING, a
ld c, $a0
jr z, .clear

View File

@ -1,7 +1,7 @@
; function to add an item (in varying quantities) to the player's bag or PC box
; INPUT:
; hl = address of inventory (either wNumBagItems or wNumBoxItems)
; [wcf91] = item ID
; [wCurItem] = item ID
; [wItemQuantity] = item quantity
; sets carry flag if successful, unsets carry flag if unsuccessful
AddItemToInventory_::
@ -30,7 +30,7 @@ AddItemToInventory_::
.notAtEndOfInventory
ld a, [hli]
ld b, a ; b = ID of current item in table
ld a, [wcf91] ; a = ID of item being added
ld a, [wCurItem] ; a = ID of item being added
cp b ; does the current item in the table match the item being added?
jp z, .increaseItemQuantity ; if so, increase the item's quantity
inc hl
@ -51,7 +51,7 @@ AddItemToInventory_::
ld c, a
ld b, 0
add hl, bc ; hl = address to store the item
ld a, [wcf91]
ld a, [wCurItem]
ld [hli], a ; store item ID
ld a, [wItemQuantity]
ld [hli], a ; store item quantity

View File

@ -1,7 +1,7 @@
UseItem_::
ld a, 1
ld [wActionResultOrTookBattleTurn], a ; initialise to success value
ld a, [wcf91] ;contains item_ID
ld a, [wCurItem]
cp HM01
jp nc, ItemUseTMHM
ld hl, ItemUsePtrTable
@ -199,7 +199,7 @@ ItemUseBall:
ld b, a
; Get the item ID.
ld hl, wcf91
ld hl, wCurItem
ld a, [hl]
; The Master Ball always succeeds.
@ -263,7 +263,7 @@ ItemUseBall:
call Multiply
; Determine BallFactor. It's 8 for Great Balls and 12 for the others.
ld a, [wcf91]
ld a, [wCurItem]
cp GREAT_BALL
ld a, 12
jr nz, .skip1
@ -349,7 +349,7 @@ ItemUseBall:
; Poké Ball: BallFactor2 = 255
; Great Ball: BallFactor2 = 200
; Ultra/Safari Ball: BallFactor2 = 150
ld a, [wcf91]
ld a, [wCurItem]
ld b, 255
cp POKE_BALL
jr z, .skip4
@ -442,11 +442,11 @@ ItemUseBall:
ld [wDamageMultipliers], a
ld a, [wWhichPokemon]
push af
ld a, [wcf91]
ld a, [wCurItem]
push af
predef MoveAnimation
pop af
ld [wcf91], a
ld [wCurItem], a
pop af
ld [wWhichPokemon], a
@ -504,15 +504,15 @@ ItemUseBall:
ld [hl], a
.skip6
ld a, [wcf91]
ld a, [wCurPartySpecies]
push af
ld a, [wEnemyMonSpecies2]
ld [wcf91], a
ld [wCurPartySpecies], a
ld a, [wEnemyMonLevel]
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
callfar LoadEnemyMonData
pop af
ld [wcf91], a
ld [wCurPartySpecies], a
pop hl
pop af
ld [hld], a
@ -523,8 +523,8 @@ ItemUseBall:
ld [hl], a
ld a, [wEnemyMonSpecies]
ld [wCapturedMonSpecies], a
ld [wcf91], a
ld [wd11e], a
ld [wCurPartySpecies], a
ld [wPokedexNum], a
ld a, [wBattleType]
cp BATTLE_TYPE_OLD_MAN ; is this the old man battle?
jp z, .oldManCaughtMon ; if so, don't give the player the caught Pokémon
@ -535,7 +535,7 @@ ItemUseBall:
; Add the caught Pokémon to the Pokédex.
predef IndexToPokedex
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld c, a
ld b, FLAG_TEST
@ -543,7 +543,7 @@ ItemUseBall:
predef FlagActionPredef
ld a, c
push af
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld c, a
ld b, FLAG_SET
@ -557,7 +557,7 @@ ItemUseBall:
call PrintText
call ClearSprites
ld a, [wEnemyMonSpecies]
ld [wd11e], a
ld [wPokedexNum], a
predef ShowPokedexData
.skipShowingPokedexData
@ -710,8 +710,8 @@ ItemUseSurfboard:
jp c, SurfingAttemptFailed
.surf
call .makePlayerMoveForward
ld hl, wd730
set 7, [hl]
ld hl, wStatusFlags5
set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld a, 2
ld [wWalkBikeSurfState], a ; change player state to surfing
call PlayDefaultMusic ; play surfing music
@ -720,11 +720,11 @@ ItemUseSurfboard:
.tryToStopSurfing
xor a
ldh [hSpriteIndexOrTextID], a
ldh [hSpriteIndex], a
ld d, 16 ; talking range in pixels (normal range)
call IsSpriteInFrontOfPlayer2
res 7, [hl]
ldh a, [hSpriteIndexOrTextID]
res BIT_FACE_PLAYER, [hl]
ldh a, [hSpriteIndex]
and a ; is there a sprite in the way?
jr nz, .cannotStopSurfing
ld hl, TilePairCollisionsWater
@ -744,8 +744,8 @@ ItemUseSurfboard:
ld [wPikachuSpawnState], a
ld hl, wPikachuOverworldStateFlags
set 5, [hl]
ld hl, wd730
set 7, [hl]
ld hl, wStatusFlags5
set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
xor a
ld [wWalkBikeSurfState], a ; change player state to walking
dec a
@ -771,7 +771,7 @@ ItemUseSurfboard:
ld a, b
ld [wSimulatedJoypadStatesEnd], a
xor a
ld [wUnusedCD39], a
ld [wUnusedSimulatedJoypadStatesMask], a
inc a
ld [wSimulatedJoypadStatesIndex], a
ret
@ -793,7 +793,7 @@ ItemUseEvoStone:
jp nz, ItemUseNotTime
ld a, [wWhichPokemon]
push af
ld a, [wcf91]
ld a, [wCurItem]
ld [wEvoStoneItemID], a
push af
ld a, EVO_STONE_PARTY_MENU
@ -801,12 +801,12 @@ ItemUseEvoStone:
ld a, $ff
ld [wUpdateSpritesEnabled], a
call DisplayPartyMenu
ld a, [wcf91]
ld a, [wCurPartySpecies]
ld [wLoadedMon], a
pop bc
jr c, .canceledItemUse
ld a, b
ld [wcf91], a
ld [wCurPartySpecies], a
call Func_d85d
jr nc, .noEffect
callfar IsThisPartymonStarterPikachu_Party
@ -854,19 +854,19 @@ Func_d85d:
ld b, $0
add hl, bc
add hl, bc
ld de, wcd6d
ld de, wEvoDataBuffer
ld a, BANK(TryEvolvingMon)
ld bc, $2
call FarCopyData
ld hl, wcd6d
ld hl, wEvoDataBuffer
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wcd6d
ld de, wEvoDataBuffer
ld a, BANK(TryEvolvingMon)
ld bc, 13
call FarCopyData
ld hl, wcd6d
ld hl, wEvoDataBuffer
.loop
ld a, [hli]
and a
@ -878,7 +878,7 @@ Func_d85d:
dec hl
dec hl
ld b, [hl]
ld a, [wcf91]
ld a, [wCurItem]
inc hl
inc hl
inc hl
@ -906,7 +906,7 @@ ItemUseMedicine:
jp z, Func_e4bf
ld a, [wWhichPokemon]
push af
ld a, [wcf91]
ld a, [wCurItem]
push af
ld a, USE_ITEM_PARTY_MENU
ld [wPartyMenuTypeOrMessageID], a
@ -929,9 +929,9 @@ ItemUseMedicine:
ld a, [wWhichPokemon]
ld [wUsedItemOnWhichPokemon], a
ld d, a
ld a, [wcf91]
ld a, [wCurPartySpecies]
ld e, a
ld [wd0b5], a
ld [wCurSpecies], a
pop af
push af
cp CALCIUM + 1
@ -943,7 +943,7 @@ ItemUseMedicine:
pop hl
.noHappinessBoost
pop af
ld [wcf91], a
ld [wCurItem], a
pop af
ld [wWhichPokemon], a
ld a, [wPseudoItemID]
@ -954,7 +954,7 @@ ItemUseMedicine:
cp d ; is the pokemon trying to use softboiled on itself?
jr z, ItemUseMedicine ; if so, force another choice
.checkItemType
ld a, [wcf91]
ld a, [wCurItem]
cp REVIVE
jr nc, .healHP ; if it's a Revive or Max Revive
cp FULL_HEAL
@ -967,7 +967,7 @@ ItemUseMedicine:
.cureStatusAilment
ld bc, wPartyMon1Status - wPartyMon1
add hl, bc ; hl now points to status
ld a, [wcf91]
ld a, [wCurItem]
lb bc, ANTIDOTE_MSG, 1 << PSN
cp ANTIDOTE
jr z, .checkMonStatus
@ -1022,7 +1022,7 @@ ItemUseMedicine:
or b
jr nz, .notFainted
.fainted
ld a, [wcf91]
ld a, [wCurItem]
cp REVIVE
jr z, .updateInBattleFaintedData
cp MAX_REVIVE
@ -1070,7 +1070,7 @@ ItemUseMedicine:
jr .compareCurrentHPToMaxHP
.notFainted
ld a, [wcf91]
ld a, [wCurItem]
cp REVIVE
jp z, .healingItemNoEffect
cp MAX_REVIVE
@ -1090,7 +1090,7 @@ ItemUseMedicine:
pop hl
jr nz, .notFullHP
.fullHP ; if the pokemon's current HP equals its max HP
ld a, [wcf91]
ld a, [wCurItem]
cp FULL_RESTORE
jp nz, .healingItemNoEffect
inc hl
@ -1099,7 +1099,7 @@ ItemUseMedicine:
and a ; does the pokemon have a status ailment?
jp z, .healingItemNoEffect
ld a, FULL_HEAL
ld [wcf91], a
ld [wCurItem], a
dec hl
dec hl
dec hl
@ -1169,13 +1169,13 @@ ItemUseMedicine:
ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent
ldh a, [hUILayoutFlags]
set 0, a
set BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
ld a, $02
ld [wHPBarType], a
predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled
ldh a, [hUILayoutFlags]
res 0, a
res BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
pop af
ld b, a ; store heal amount (1/5 of max HP)
@ -1191,7 +1191,7 @@ ItemUseMedicine:
jr .addHealAmount
.notUsingSoftboiled2
ld a, [wcf91]
ld a, [wCurItem]
cp SODA_POP
ld b, 60 ; Soda Pop heal amount
jr z, .addHealAmount
@ -1226,7 +1226,7 @@ ItemUseMedicine:
ld e, l ; de now points to current HP
ld hl, (wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1)
add hl, de ; hl now points to max HP
ld a, [wcf91]
ld a, [wCurItem]
cp REVIVE
jr z, .setCurrentHPToHalfMaxHP
ld a, [hld]
@ -1238,7 +1238,7 @@ ItemUseMedicine:
ld a, [de]
sbc b
jr nc, .setCurrentHPToMaxHp ; if current HP exceeds max HP after healing
ld a, [wcf91]
ld a, [wCurItem]
cp HYPER_POTION
jr c, .setCurrentHPToMaxHp ; if using a Full Restore or Max Potion
cp MAX_REVIVE
@ -1270,7 +1270,7 @@ ItemUseMedicine:
ld [wHPBarNewHP], a
dec de
.doneHealingPartyHP ; done updating the pokemon's current HP in the party data structure
ld a, [wcf91]
ld a, [wCurItem]
cp FULL_RESTORE
jr nz, .updateInBattleData
ld bc, wPartyMon1Status - (wPartyMon1MaxHP + 1)
@ -1289,7 +1289,7 @@ ItemUseMedicine:
ld [wBattleMonHP], a
ld a, [hld]
ld [wBattleMonHP + 1], a
ld a, [wcf91]
ld a, [wCurItem]
cp FULL_RESTORE
jr nz, .calculateHPBarCoords
xor a
@ -1316,7 +1316,7 @@ ItemUseMedicine:
call RemoveUsedItem
pop hl
.skipRemovingItem
ld a, [wcf91]
ld a, [wCurItem]
cp FULL_RESTORE
jr c, .playStatusAilmentCuringSound
cp FULL_HEAL
@ -1324,17 +1324,17 @@ ItemUseMedicine:
ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent
ldh a, [hUILayoutFlags]
set 0, a
set BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
ld a, $02
ld [wHPBarType], a
predef UpdateHPBar2 ; animate the HP bar lengthening
ldh a, [hUILayoutFlags]
res 0, a
res BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
ld a, REVIVE_MSG
ld [wPartyMenuTypeOrMessageID], a
ld a, [wcf91]
ld a, [wCurItem]
cp REVIVE
jr z, .showHealingItemMessage
cp MAX_REVIVE
@ -1379,12 +1379,12 @@ ItemUseMedicine:
.useVitamin
push hl
ld a, [hl]
ld [wd0b5], a
ld [wd11e], a
ld [wCurSpecies], a
ld [wPokedexNum], a
ld bc, wPartyMon1Level - wPartyMon1
add hl, bc ; hl now points to level
ld a, [hl] ; a = level
ld [wCurEnemyLVL], a ; store level
ld [wCurEnemyLevel], a ; store level
call GetMonHeader
push de
ld a, d
@ -1392,7 +1392,7 @@ ItemUseMedicine:
call GetPartyMonName
pop de
pop hl
ld a, [wcf91]
ld a, [wCurItem]
cp RARE_CANDY
jp z, .useRareCandy
push hl
@ -1418,7 +1418,7 @@ ItemUseMedicine:
pop hl
call .recalculateStats
ld hl, VitaminStats
ld a, [wcf91]
ld a, [wCurItem]
sub HP_UP - 1
ld c, a
.statNameLoop ; loop to get the address of the name of the stat the vitamin increases
@ -1466,7 +1466,7 @@ ItemUseMedicine:
jr z, .vitaminNoEffect ; can't raise level above 100
inc a
ld [hl], a ; store incremented level
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
push hl
push de
ld d, a
@ -1485,7 +1485,7 @@ ItemUseMedicine:
pop hl
ld a, [wWhichPokemon]
push af
ld a, [wcf91]
ld a, [wCurItem]
push af
push de
push hl
@ -1524,7 +1524,7 @@ ItemUseMedicine:
ld a, d
ld [wWhichPokemon], a
ld a, e
ld [wd11e], a
ld [wPokedexNum], a
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
call LoadMonData
@ -1550,7 +1550,7 @@ ItemUseMedicine:
ld a, $01
ld [wUpdateSpritesEnabled], a
pop af
ld [wcf91], a
ld [wCurItem], a
pop af
ld [wWhichPokemon], a
jp RemoveUsedItem
@ -1647,12 +1647,12 @@ ItemUseEscapeRope:
jr z, .notUsable
cp b
jr nz, .loop
ld hl, wd732
set 3, [hl]
set 6, [hl]
ld hl, wStatusFlags6
set BIT_FLY_WARP, [hl]
set BIT_ESCAPE_WARP, [hl]
call Func_1510
ld hl, wd72e
res 4, [hl]
ld hl, wStatusFlags4
res BIT_NO_BATTLES, [hl]
ResetEvent EVENT_IN_SAFARI_ZONE
xor a
ld [wNumSafariBalls], a
@ -1698,7 +1698,7 @@ ItemUseXAccuracy:
; The Card Key is handled in a different way.
ItemUseCardKey:
xor a
ld [wUnusedD71F], a
ld [wUnusedCardKeyGateID], a
call GetTileAndCoordsInFrontOfPlayer
ld a, [GetTileAndCoordsInFrontOfPlayer]
cp $18
@ -1732,7 +1732,7 @@ ItemUseCardKey:
cp e
jr nz, .nextEntry3
ld a, [hl]
ld [wUnusedD71F], a
ld [wUnusedCardKeyGateID], a
jr .done
.nextEntry1
@ -1746,8 +1746,8 @@ ItemUseCardKey:
.done
ld hl, ItemUseText00
call PrintText
ld hl, wd728
set 7, [hl]
ld hl, wStatusFlags1
set BIT_UNUSED_CARD_KEY, [hl] ; never checked
ret
INCLUDE "data/events/card_key_coords.asm"
@ -1818,7 +1818,7 @@ ItemUseXStat:
ld a, [hl]
push af ; save [wPlayerMoveEffect]
push hl
ld a, [wcf91]
ld a, [wCurItem]
sub X_ATTACK - ATTACK_UP1_EFFECT
ld [hl], a ; store player move effect
call PrintItemUseTextAndRemoveItem
@ -2087,7 +2087,7 @@ RodResponse:
ld a, 1
ld [wMoveMissed], a
ld a, b ; level
ld [wCurEnemyLVL], a
ld [wCurEnemyLevel], a
ld a, c ; species
ld [wCurOpponent], a
@ -2175,7 +2175,7 @@ ItemUsePPUp:
ItemUsePPRestore:
ld a, [wWhichPokemon]
push af
ld a, [wcf91]
ld a, [wCurItem]
ld [wPPRestoreItem], a
.chooseMon
xor a
@ -2225,7 +2225,7 @@ ItemUsePPRestore:
call GetSelectedMoveOffset
push hl
ld a, [hl]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMoveName
call CopyToStringBuffer
pop hl
@ -2247,7 +2247,7 @@ ItemUsePPRestore:
add 1 << 6 ; increase PP Up count by 1
ld [hl], a
ld a, 1 ; 1 PP Up used
ld [wd11e], a
ld [wUsingPPUp], a
call RestoreBonusPP ; add the bonus PP to current PP
ld a, SFX_HEAL_AILMENT
call PlaySound
@ -2400,16 +2400,16 @@ ItemUseTMHM:
ld a, [wIsInBattle]
and a
jp nz, ItemUseNotTime
ld a, [wcf91]
ld a, [wCurItem]
sub TM01 ; underflows below 0 for HM items (before TM items)
push af
jr nc, .skipAdding
add NUM_TMS + NUM_HMS ; adjust HM IDs to come after TM IDs
.skipAdding
inc a
ld [wd11e], a
ld [wTempTMHM], a
predef TMToMove ; get move ID from TM/HM ID
ld a, [wd11e]
ld a, [wTempTMHM]
ld [wMoveNum], a
call GetMoveName
call CopyToStringBuffer
@ -2436,7 +2436,7 @@ ItemUseTMHM:
.useMachine
ld a, [wWhichPokemon]
push af
ld a, [wcf91]
ld a, [wCurItem]
push af
.chooseMon
ld hl, wStringBuffer
@ -2486,7 +2486,7 @@ ItemUseTMHM:
ld a, [wWhichPokemon]
ld d, a
pop af
ld [wcf91], a
ld [wCurItem], a
pop af
ld [wWhichPokemon], a
ld a, b
@ -2500,7 +2500,7 @@ ItemUseTMHM:
callabd_ModifyPikachuHappiness PIKAHAPPY_USEDTMHM
callfar IsThisPartymonStarterPikachu_Party
jr nc, .notTeachingThunderboltOrThunderToPikachu
ld a, [wcf91]
ld a, [wCurItem]
cp TM_THUNDERBOLT ; are we teaching thunderbolt to the player pikachu?
jr z, .teachingThunderboltOrThunderToPlayerPikachu
cp TM_THUNDER ; are we teaching thunder then?
@ -2514,7 +2514,7 @@ ItemUseTMHM:
pop af
ld [wWhichPokemon], a
ld a, [wcf91]
ld a, [wCurItem]
call IsItemHM
ret c
jp RemoveUsedItem
@ -2775,10 +2775,10 @@ GetMaxPP:
ld hl, Moves
ld bc, MOVE_LENGTH
call AddNTimes
ld de, wcd6d
ld de, wMoveData
ld a, BANK(Moves)
call FarCopyData
ld de, wcd6d + 5 ; PP is byte 5 of move data
ld de, wMoveData + MOVE_PP
ld a, [de]
ld b, a ; b = normal max PP
pop hl
@ -2794,9 +2794,10 @@ GetMaxPP:
and %11000000 ; get PP Up count
pop bc
or b ; place normal max PP in 6 lower bits of a
assert wMoveData + MOVE_PP + 1 == wPPUpCountAndMaxPP
ld h, d
ld l, e
inc hl ; hl = wcd73
inc hl ; hl = wPPUpCountAndMaxPP
ld [hl], a
xor a ; add the bonus for the existing PP Up count
ld [wUsingPPUp], a
@ -2820,14 +2821,14 @@ GetSelectedMoveOffset2:
; confirms the item toss and then tosses the item
; INPUT:
; hl = address of inventory (either wNumBagItems or wNumBoxItems)
; [wcf91] = item ID
; [wCurItem] = item ID
; [wWhichPokemon] = index of item within inventory
; [wItemQuantity] = quantity to toss
; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not
TossItem_::
push hl
ld a, [wcf91]
ld a, [wCurItem]
call IsItemHM
pop hl
jr c, .tooImportantToToss
@ -2838,8 +2839,8 @@ TossItem_::
and a
jr nz, .tooImportantToToss
push hl
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurItem]
ld [wNamedObjectIndex], a
call GetItemName
call CopyToStringBuffer
ld hl, IsItOKToTossItemText
@ -2858,8 +2859,8 @@ TossItem_::
push hl
ld a, [wWhichPokemon]
call RemoveItemFromInventory
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurItem]
ld [wNamedObjectIndex], a
call GetItemName
call CopyToStringBuffer
ld hl, ThrewAwayItemText
@ -2890,7 +2891,7 @@ TooImportantToTossText:
; checks if an item is a key item
; INPUT:
; [wcf91] = item ID
; [wCurItem] = item ID
; OUTPUT:
; [wIsKeyItem] = result
; 00: item is not key item
@ -2898,7 +2899,7 @@ TooImportantToTossText:
IsKeyItem_::
ld a, $01
ld [wIsKeyItem], a
ld a, [wcf91]
ld a, [wCurItem]
cp HM01 ; is the item an HM or TM?
jr nc, .checkIfItemIsHM
; if the item is not an HM or TM
@ -2918,7 +2919,7 @@ IsKeyItem_::
and a
ret nz
.checkIfItemIsHM
ld a, [wcf91]
ld a, [wCurItem]
call IsItemHM
ret c
xor a
@ -2932,8 +2933,8 @@ SendNewMonToBox:
ld a, [de]
inc a
ld [de], a
ld a, [wcf91]
ld [wd0b5], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
ld c, a
.loop
inc de
@ -3057,7 +3058,7 @@ SendNewMonToBox:
ld [de], a
inc de
push de
ld a, [wCurEnemyLVL]
ld a, [wCurEnemyLevel]
ld d, a
callfar CalcExperience
pop de
@ -3091,7 +3092,7 @@ SendNewMonToBox:
ld [de], a
dec b
jr nz, .loop6
ld a, [wcf91]
ld a, [wCurPartySpecies]
cp KADABRA
jr nz, .notKadabra
ld a, TWISTEDSPOON_GSC
@ -3131,7 +3132,7 @@ ItemUseReloadOverworldData:
call LoadCurrentMapView
jp UpdateSprites
; creates a list at wBuffer of maps where the mon in [wd11e] can be found.
; creates a list at wBuffer of maps where the mon in [wPokedexNum] can be found.
; this is used by the pokedex to display locations the mon can be found on the map.
FindWildLocationsOfMon:
ld hl, WildDataPointers
@ -3166,7 +3167,7 @@ CheckMapForMon:
inc hl
ld b, NUM_WILDMONS
.loop
ld a, [wd11e]
ld a, [wPokedexNum]
cp [hl]
jr nz, .nextEntry
ld a, c

View File

@ -1,7 +1,7 @@
GetMachinePrice::
; Input: [wcf91] = Item Id of a TM
; Input: [wCurItem] = Item ID of a TM
; Output: Stores the TM price at hItemPrice
ld a, [wcf91] ; a contains TM item id
ld a, [wCurItem]
sub TM01 ; underflows below 0 for HM items (before TM items)
ret c ; HMs are priceless
ld d, a

View File

@ -1,7 +1,7 @@
; tests if mon [wcf91] can learn move [wMoveNum]
; tests if mon [wCurPartySpecies] can learn move [wMoveNum]
CanLearnTM:
ld a, [wcf91]
ld [wd0b5], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetMonHeader
ld hl, wMonHLearnset
push hl
@ -26,17 +26,17 @@ CanLearnTM:
ld c, 0
ret
; converts TM/HM number in wd11e into move number
; converts TM/HM number in [wTempTMHM] into move number
; HMs start at 51
TMToMove:
ld a, [wd11e]
ld a, [wTempTMHM]
dec a
ld hl, TechnicalMachines
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
ld [wd11e], a
ld [wTempTMHM], a
ret
INCLUDE "data/moves/tmhm_moves.asm"

View File

@ -1,5 +1,7 @@
DEF NOT_VISITED EQU $fe
DEF BIRD_BASE_TILE EQU $04
DisplayTownMap:
call LoadTownMap
ld hl, wUpdateSpritesEnabled
@ -12,15 +14,15 @@ DisplayTownMap:
ld a, [wCurMap]
push af
ld b, $0
call DrawPlayerOrBirdSprite ; player sprite
call DrawPlayerOrBirdSprite
hlcoord 1, 0
ld de, wcd6d
ld de, wNameBuffer
call PlaceString
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $10
call CopyData
ld hl, vSprites tile $04
ld hl, vSprites tile BIRD_BASE_TILE
ld de, TownMapCursor
lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8
call CopyVideoDataDouble
@ -50,15 +52,15 @@ DisplayTownMap:
ld hl, wShadowOAMSprite04
call WriteTownMapSpriteOAM ; town map cursor sprite
pop hl
ld de, wcd6d
ld de, wNameBuffer
.copyMapName
ld a, [hli]
ld [de], a
inc de
cp $50
cp "@"
jr nz, .copyMapName
hlcoord 1, 0
ld de, wcd6d
ld de, wNameBuffer
call PlaceString
ld hl, wShadowOAMSprite04
ld de, wTileMapBackup + 16
@ -73,9 +75,9 @@ DisplayTownMap:
jr z, .inputLoop
ld a, SFX_TINK
call PlaySound
bit 6, b
bit BIT_D_UP, b
jr nz, .pressedUp
bit 7, b
bit BIT_D_DOWN, b
jr nz, .pressedDown
xor a
ld [wTownMapSpriteBlinkingEnabled], a
@ -153,7 +155,7 @@ LoadTownMap_Fly::
ld de, BirdSprite
ld b, BANK(BirdSprite)
ld c, 12
ld hl, vSprites tile $04
ld hl, vSprites tile BIRD_BASE_TILE
call CopyVideoData
ld de, TownMapUpArrow
ld hl, vChars1 tile $6d
@ -183,10 +185,10 @@ LoadTownMap_Fly::
call ClearScreenArea
pop hl
ld a, [hl]
ld b, $4
call DrawPlayerOrBirdSprite ; draw bird sprite
ld b, BIRD_BASE_TILE
call DrawPlayerOrBirdSprite
hlcoord 3, 0
ld de, wcd6d
ld de, wNameBuffer
call PlaceString
ld c, 15
call DelayFrames
@ -204,13 +206,13 @@ LoadTownMap_Fly::
pop hl
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
jr z, .inputLoop
bit 0, b
bit BIT_A_BUTTON, b
jr nz, .pressedA
ld a, SFX_TINK
call PlaySound
bit 6, b
bit BIT_D_UP, b
jr nz, .pressedUp
bit 7, b
bit BIT_D_DOWN, b
jr nz, .pressedDown
jr .pressedB
.pressedA
@ -218,10 +220,11 @@ LoadTownMap_Fly::
call PlaySound
ld a, [hl]
ld [wDestinationMap], a
ld hl, wd732
set 3, [hl]
ld hl, wStatusFlags6
set BIT_FLY_WARP, [hl]
assert wStatusFlags6 + 1 == wStatusFlags7
inc hl
set 7, [hl]
set BIT_USED_FLY, [hl]
.pressedB
xor a
ld [wTownMapSpriteBlinkingEnabled], a
@ -365,7 +368,7 @@ DrawPlayerOrBirdSprite:
call TownMapCoordsToOAMCoords
call WritePlayerOrBirdSpriteOAM
pop hl
ld de, wcd6d
ld de, wNameBuffer
.loop
ld a, [hli]
ld [de], a

View File

@ -53,8 +53,8 @@ _Joypad::
ld a, b
ldh [hJoyLast], a
ld a, [wd730]
bit 5, a
ld a, [wStatusFlags5]
bit BIT_DISABLE_JOYPAD, a
jr nz, DiscardButtonPresses
ldh a, [hJoyLast]

View File

@ -256,9 +256,9 @@ CableClub_DoBattleOrTradeAgain:
dec c
jr nz, .unpatchEnemyMonsLoop
ld a, LOW(wEnemyMonOT)
ld [wUnusedCF8D], a
ld [wUnusedNamePointer], a
ld a, HIGH(wEnemyMonOT)
ld [wUnusedCF8D + 1], a
ld [wUnusedNamePointer + 1], a
xor a
ld [wTradeCenterPointerTableIndex], a
call StopAllMusic
@ -280,7 +280,7 @@ CableClub_DoBattleOrTradeAgain:
ld b, SET_PAL_OVERWORLD
call RunPaletteCommand
ld hl, wOptions
res 7, [hl]
res BIT_BATTLE_ANIMATION, [hl]
ld a, [wLetterPrintingDelayFlags]
push af
xor a
@ -349,10 +349,10 @@ TradeCenter_SelectMon:
ld [wTopMenuItemX], a
.enemyMonMenu_HandleInput
ld hl, hUILayoutFlags
set 1, [hl]
set BIT_DOUBLE_SPACED_MENU, [hl]
call HandleMenuInput
ld hl, hUILayoutFlags
res 1, [hl]
res BIT_DOUBLE_SPACED_MENU, [hl]
and a
jp z, .getNewInput
bit BIT_A_BUTTON, a
@ -414,10 +414,10 @@ TradeCenter_SelectMon:
call ClearScreenArea
.playerMonMenu_HandleInput
ld hl, hUILayoutFlags
set 1, [hl]
set BIT_DOUBLE_SPACED_MENU, [hl]
call HandleMenuInput
ld hl, hUILayoutFlags
res 1, [hl]
res BIT_DOUBLE_SPACED_MENU, [hl]
and a ; was anything pressed?
jr nz, .playerMonMenu_SomethingPressed
jp .getNewInput
@ -495,7 +495,7 @@ TradeCenter_SelectMon:
ld a, 1
ld [wTopMenuItemX], a
call HandleMenuInput
bit 4, a ; Right pressed?
bit BIT_D_RIGHT, a
jr nz, .selectTradeMenuItem
bit BIT_B_BUTTON, a
jr z, .displayPlayerMonStats
@ -591,9 +591,9 @@ ReturnToCableClubRoom:
ld a, [hl]
push af
push hl
res 0, [hl]
res BIT_FONT_LOADED, [hl]
xor a
ld [wd72d], a
ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING
dec a
ld [wDestinationWarpID], a
call LoadMapData
@ -666,7 +666,7 @@ TradeCenter_PrintPartyListNames:
ld a, [de]
cp $ff
ret z
ld [wd11e], a
ld [wNamedObjectIndex], a
push bc
push hl
push de
@ -702,9 +702,9 @@ TradeCenter_Trade:
ld b, 0
add hl, bc
ld a, [hl]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, wcd6d
ld hl, wNameBuffer
ld de, wNameOfPlayerMonToBeTraded
ld bc, NAME_LENGTH
call CopyData
@ -714,7 +714,7 @@ TradeCenter_Trade:
ld b, 0
add hl, bc
ld a, [hl]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, WillBeTradedText
bccoord 1, 14
@ -810,7 +810,7 @@ TradeCenter_Trade:
ld e, a
add hl, de
ld a, [hl]
ld [wcf91], a
ld [wCurPartySpecies], a
ld hl, wEnemyMons
ld a, c
ld bc, wEnemyMon2 - wEnemyMon1
@ -843,7 +843,7 @@ TradeCenter_Trade:
call ClearScreen
call LoadHpBarAndStatusTilePatterns
xor a
ld [wUnusedCC5B], a
ld [wUnusedFlag], a
ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .usingExternalClock

View File

@ -113,8 +113,8 @@ CableClubNPC::
ld hl, wUnknownSerialCounter
ld [hli], a
ld [hl], a
ld hl, wd72e
res 6, [hl]
ld hl, wStatusFlags4
res BIT_LINK_CONNECTED, [hl]
xor a
ld [wMenuJoypadPollCount], a
ret

View File

@ -3,9 +3,9 @@ DisplayTextIDInit::
xor a
ld [wListMenuID], a
ld a, [wAutoTextBoxDrawingControl]
bit 0, a
bit BIT_NO_AUTO_TEXT_BOX, a
jr nz, .skipDrawingTextBoxBorder
ldh a, [hSpriteIndexOrTextID] ; text ID (or sprite ID)
ldh a, [hTextID]
and a
jr nz, .notStartMenu
; if text ID is 0 (i.e. the start menu)
@ -28,10 +28,10 @@ DisplayTextIDInit::
call TextBoxBorder
.skipDrawingTextBoxBorder
ld hl, wFontLoaded
set 0, [hl]
ld hl, wFlags_0xcd60
bit 4, [hl]
res 4, [hl]
set BIT_FONT_LOADED, [hl]
ld hl, wMiscFlags
bit BIT_NO_SPRITE_UPDATES, [hl]
res BIT_NO_SPRITE_UPDATES, [hl]
jr nz, .skipMovingSprites
call UpdateSprites
.skipMovingSprites

View File

@ -21,8 +21,8 @@ DrawStartMenu::
ld [wLastMenuItem], a
xor a
ld [wMenuWatchMovingOutOfBounds], a
ld hl, wd730
set 6, [hl] ; no pauses between printing each letter
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
hlcoord 12, 2
CheckEvent EVENT_GOT_POKEDEX
; case for not having pokedex
@ -40,8 +40,8 @@ DrawStartMenu::
call PrintStartMenuItem
ld de, wPlayerName ; player's name
call PrintStartMenuItem
ld a, [wd72e]
bit 6, a ; is the player using the link feature?
ld a, [wStatusFlags4]
bit BIT_LINK_CONNECTED, a
; case for not using link feature
ld de, StartMenuSaveText
jr z, .printSaveOrResetText
@ -53,8 +53,8 @@ DrawStartMenu::
call PrintStartMenuItem
ld de, StartMenuExitText
call PlaceString
ld hl, wd730
res 6, [hl] ; turn pauses between printing letters back on
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
ret
StartMenuPokedexText:

View File

@ -1,8 +1,8 @@
PKMNLeaguePC:
ld hl, AccessedHoFPCText
call PrintText
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
push hl
ld a, [wUpdateSpritesEnabled]
push af
@ -44,7 +44,7 @@ PKMNLeaguePC:
pop af
ld [wUpdateSpritesEnabled], a
pop hl
res 6, [hl]
res BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3
call ClearScreen
call RunDefaultPaletteCommand
@ -57,7 +57,7 @@ LeaguePCShowTeam:
call LeaguePCShowMon
call WaitForTextScrollButtonPress
ldh a, [hJoyHeld]
bit 1, a
bit BIT_B_BUTTON, a
jr nz, .exit
ld hl, wHallOfFame + HOF_MON
ld de, wHallOfFame
@ -83,13 +83,13 @@ LeaguePCShowMon:
ld hl, wHallOfFame
ld a, [hli]
ld [wHoFMonSpecies], a
ld [wcf91], a
ld [wd0b5], a
ld [wCurPartySpecies], a
ld [wCurSpecies], a
ld [wBattleMonSpecies2], a
ld [wWholeScreenPaletteMonSpecies], a
ld a, [hli]
ld [wHoFMonLevel], a
ld de, wcd6d
ld de, wNameBuffer
ld bc, NAME_LENGTH
call CopyData
ld b, SET_PAL_POKEMON_WHOLE_SCREEN

View File

@ -22,9 +22,9 @@ Func_f531b::
call TextBoxBorder
call UpdateSprites
xor a
ld [wUnusedCD37], a
ld [wd72d], a
ld [wd11e], a
ld [wUnusedLinkMenuByte], a
ld [wCableClubDestinationMap], a
ld [wNamedObjectIndex], a
ld hl, wTopMenuItemY
ld a, $2
ld [hli], a
@ -90,7 +90,7 @@ Func_f531b::
jr z, .asm_f53df
.asm_f53d1
ld a, $1
ld [wd11e], a
ld [wNamedObjectIndex], a
ld a, b
ld [wLinkMenuSelectionSendBuffer], a
and $3
@ -310,21 +310,21 @@ PetitCup::
jp z, DuplicateSpecies
dec hl
ld a, [hl]
ld [wcf91], a
ld [wCurPartySpecies], a
push hl
callfar Func_3b10f
pop hl
jp c, asm_f56ad
inc hl
ld a, [hl]
ld [wcf91], a
ld [wCurPartySpecies], a
push hl
callfar Func_3b10f
pop hl
jp c, asm_f56ad
inc hl
ld a, [hl]
ld [wcf91], a
ld [wCurPartySpecies], a
push hl
callfar Func_3b10f
pop hl
@ -343,19 +343,19 @@ PetitCup::
ld hl, PokedexEntryPointers
add hl, bc
add hl, bc
ld de, wcd6d
ld de, wNameBuffer
ld bc, $2
ld a, BANK(PokedexEntryPointers)
call FarCopyData
ld hl, wcd6d
ld hl, wNameBuffer
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wcd6d
ld de, wNameBuffer
ld bc, $14
ld a, BANK(PokedexEntryPointers)
call FarCopyData
ld hl, wcd6d
ld hl, wNameBuffer
.loop2
ld a, [hli]
cp "@"
@ -483,7 +483,7 @@ asm_f5689::
pop af
pop bc
pop hl
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, ColosseumHeightText
call PrintText
@ -494,7 +494,7 @@ asm_f569b::
pop af
pop bc
pop hl
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, ColosseumWeightText
call PrintText
@ -503,7 +503,7 @@ asm_f569b::
asm_f56ad::
ld a, [hl]
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
ld hl, ColosseumEvolvedText
call PrintText
@ -635,8 +635,8 @@ ColosseumIneligibleText::
LinkMenu:
xor a
ld [wLetterPrintingDelayFlags], a
ld hl, wd72e
set 6, [hl]
ld hl, wStatusFlags4
set BIT_LINK_CONNECTED, [hl]
ld hl, TextTerminator_f5a16
call PrintText
call SaveScreenTilesToBuffer1
@ -650,20 +650,26 @@ LinkMenu:
ld de, TradeCenterText
call PlaceString
xor a
ld [wUnusedCD37], a
ld [wd72d], a
ld [wd11e], a
ld [wUnusedLinkMenuByte], a
ld [wCableClubDestinationMap], a
ld [wNamedObjectIndex], a
ld hl, wTopMenuItemY
ld a, $5
ld a, 5
ld [hli], a
ld a, $6
assert wTopMenuItemY + 1 == wTopMenuItemX
ld a, 6
ld [hli], a
assert wTopMenuItemX + 1 == wCurrentMenuItem
xor a
ld [hli], a
inc hl
ld a, $3
assert wCurrentMenuItem + 2 == wMaxMenuItem
ld a, 3
ld [hli], a
assert wMaxMenuItem + 1 == wMenuWatchedKeys
assert 2 == B_BUTTON
ld [hli], a
assert wMenuWatchedKeys + 1 == wLastMenuItem
xor a
ld [hl], a
.waitForInputLoop
@ -716,7 +722,7 @@ LinkMenu:
jr z, .doneChoosingMenuSelection
.useEnemyMenuSelection
ld a, $1
ld [wd11e], a
ld [wNamedObjectIndex], a
ld a, b
ld [wLinkMenuSelectionSendBuffer], a
and $3
@ -769,12 +775,12 @@ LinkMenu:
jr nz, .next
ld a, TRADE_CENTER
.next
ld [wd72d], a
ld [wCableClubDestinationMap], a
ld hl, ColosseumPleaseWaitText
call PrintText
ld c, 50
call DelayFrames
ld hl, wd732
ld hl, wStatusFlags6
res BIT_DEBUG_MODE, [hl]
ld a, [wDefaultMap]
ld [wDestinationMap], a
@ -796,13 +802,13 @@ LinkMenu:
ld hl, ColosseumCanceledText
vc_hook Wireless_net_stop
call PrintText
ld hl, wd72e
res 6, [hl]
ld hl, wStatusFlags4
res BIT_LINK_CONNECTED, [hl]
vc_hook Wireless_net_end
ret
.asm_f5963
ld a, [wd11e]
ld a, [wNamedObjectIndex]
and a
jr nz, .asm_f5974
ld b, " "
@ -847,7 +853,7 @@ LinkMenu:
xor a
ld [wUnknownSerialCounter], a
ld [wUnknownSerialCounter+1], a
ld a, [wd11e]
ld a, [wNamedObjectIndex]
and a
jr z, .asm_f59cd
ld b, " "

View File

@ -21,14 +21,14 @@ MainMenu:
ld [hli], a
ld [hl], a
ld [wDefaultMap], a
ld hl, wd72e
res 6, [hl]
ld hl, wStatusFlags4
res BIT_LINK_CONNECTED, [hl]
call ClearScreen
call RunDefaultPaletteCommand
call LoadTextBoxTilePatterns
call LoadFontTilePatterns
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
ld a, [wSaveFileStatus]
cp 1
jr z, .noSaveFile
@ -48,8 +48,8 @@ MainMenu:
ld de, NewGameText
call PlaceString
.next2
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
call UpdateSprites
xor a
ld [wCurrentMenuItem], a
@ -83,13 +83,13 @@ MainMenu:
cp 1
jp z, StartNewGame
call DisplayOptionMenu
ld a, 1
ld a, TRUE
ld [wOptionsInitialized], a
jp .mainMenuLoop
.choseContinue
call DisplayContinueGameInfo
ld hl, wCurrentMapScriptFlags
set 5, [hl]
set BIT_CUR_MAP_LOADED_1, [hl]
.inputLoop
xor a
ldh [hJoyPressed], a
@ -100,7 +100,7 @@ MainMenu:
bit BIT_A_BUTTON, a
jr nz, .pressedA
bit BIT_B_BUTTON, a
jp nz, .mainMenuLoop ; pressed B
jp nz, .mainMenuLoop
jr .inputLoop
.pressedA
call GBPalWhiteOutWithDelay3
@ -112,18 +112,18 @@ MainMenu:
ld a, [wNumHoFTeams]
and a
jp z, SpecialEnterMap
ld a, [wCurMap] ; map ID
ld a, [wCurMap]
cp HALL_OF_FAME
jp nz, SpecialEnterMap
xor a
ld [wDestinationMap], a
ld hl, wd732
set 2, [hl] ; fly warp or dungeon warp
ld hl, wStatusFlags6
set BIT_FLY_OR_DUNGEON_WARP, [hl]
call PrepareForSpecialWarp
jp SpecialEnterMap
InitOptions:
ld a, TEXT_DELAY_FAST
ld a, 1 << BIT_FAST_TEXT_DELAY
ld [wLetterPrintingDelayFlags], a
ld a, TEXT_DELAY_MEDIUM
ld [wOptions], a
@ -145,11 +145,9 @@ NotEnoughMemoryText:
text_end
StartNewGame:
ld hl, wd732
; Ensure debug mode is not used when
; starting a regular new game.
; Debug mode persists in saved games for
; both debug and non-debug builds, and is
ld hl, wStatusFlags6
; Ensure debug mode is not used when starting a regular new game.
; Debug mode persists in saved games for both debug and non-debug builds, and is
; only reset here by the main menu.
res BIT_DEBUG_MODE, [hl]
; fallthrough
@ -166,9 +164,9 @@ SpecialEnterMap::
ldh [hJoyPressed], a
ldh [hJoyHeld], a
ldh [hJoy5], a
ld [wd72d], a
ld hl, wd732
set 0, [hl] ; count play time
ld [wCableClubDestinationMap], a
ld hl, wStatusFlags6
set BIT_GAME_TIMER_COUNTING, [hl]
call ResetPlayerSpriteData
ld c, 20
call DelayFrames

View File

@ -7,8 +7,8 @@ AskName:
hlcoord 0, 0
lb bc, 4, 11
call z, ClearScreenArea ; only if in wild battle
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurPartySpecies]
ld [wNamedObjectIndex], a
call GetMonName
ld hl, DoYouWantToNicknameText
call PrintText
@ -44,7 +44,7 @@ AskName:
.declinedNickname
ld d, h
ld e, l
ld hl, wcd6d
ld hl, wNameBuffer
ld bc, NAME_LENGTH
jp CopyData
@ -82,8 +82,8 @@ DisplayNameRaterScreen::
DisplayNamingScreen:
push hl
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
@ -165,8 +165,8 @@ DisplayNamingScreen:
call GBPalNormal
xor a
ld [wAnimCounter], a
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
ld a, [wIsInBattle]
and a
jp z, LoadTextBoxTilePatterns
@ -472,12 +472,12 @@ PrintNamingText:
ld de, RivalsTextString
dec a
jr z, .notNickname
ld a, [wcf91]
ld a, [wCurPartySpecies]
ld [wMonPartySpriteSpecies], a
push af
farcall WriteMonPartySpriteOAMBySpecies
pop af
ld [wd11e], a
ld [wNamedObjectIndex], a
call GetMonName
hlcoord 4, 1
call PlaceString

View File

@ -43,9 +43,9 @@ OptionMenuJumpTable:
OptionsMenu_TextSpeed:
call GetTextSpeed
ldh a, [hJoy5]
bit 4, a ; right
bit BIT_D_RIGHT, a
jr nz, .pressedRight
bit 5, a
bit BIT_D_LEFT, a
jr nz, .pressedLeft
jr .nonePressed
.pressedRight
@ -193,9 +193,9 @@ OptionsMenu_SpeakerSettings:
swap a
ld c, a
ldh a, [hJoy5]
bit 4, a
bit BIT_D_RIGHT, a
jr nz, .pressedRight
bit 5, a
bit BIT_D_LEFT, a
jr nz, .pressedLeft
jr .asm_41dca
.pressedRight
@ -248,9 +248,9 @@ Earphone3SoundText:
OptionsMenu_GBPrinterBrightness:
call Func_41e7b
ldh a, [hJoy5]
bit 4, a
bit BIT_D_RIGHT, a
jr nz, .pressedRight
bit 5, a
bit BIT_D_LEFT, a
jr nz, .pressedLeft
jr .asm_41e32
.pressedRight

View File

@ -78,12 +78,12 @@ RedrawPartyMenu_::
push hl
ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column
ldh a, [hUILayoutFlags]
set 0, a
set BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
add hl, bc
predef DrawHP2 ; draw HP bar and prints current / max HP
ldh a, [hUILayoutFlags]
res 0, a
res BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
call SetPartyMenuHPBarColor ; color the HP bar (on SGB)
pop hl
@ -129,19 +129,19 @@ RedrawPartyMenu_::
rl b
ld c, a
add hl, bc
ld de, wcd6d
ld de, wEvoDataBuffer
ld a, BANK(EvosMovesPointerTable)
ld bc, 2
call FarCopyData
ld hl, wcd6d
ld hl, wEvoDataBuffer
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wcd6d
ld de, wEvoDataBuffer
ld a, BANK(EvosMovesPointerTable)
ld bc, 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator
call FarCopyData
ld hl, wcd6d
ld hl, wEvoDataBuffer
ld de, .notAbleToEvolveText
; loop through the pokemon's evolution entries
.checkEvolutionsLoop
@ -180,11 +180,11 @@ RedrawPartyMenu_::
ld b, SET_PAL_PARTY_MENU
call RunPaletteCommand
.printMessage
ld hl, wd730
ld hl, wStatusFlags5
ld a, [hl]
push af
push hl
set 6, [hl] ; turn off letter printing delay
set BIT_NO_TEXT_DELAY, [hl]
ld a, [wPartyMenuTypeOrMessageID] ; message ID
cp FIRST_PARTY_MENU_TEXT_ID
jr nc, .printItemUseMessage

View File

@ -5,14 +5,14 @@ ActivatePC::
ld hl, TurnedOnPC1Text
call PrintText
call WaitForSoundToFinish
ld hl, wFlags_0xcd60
set 3, [hl]
ld hl, wMiscFlags
set BIT_USING_GENERIC_PC, [hl]
call LoadScreenTilesFromBuffer2
call Delay3
PCMainMenu:
farcall DisplayPCMainMenu
ld hl, wFlags_0xcd60
set 5, [hl]
ld hl, wMiscFlags
set BIT_NO_MENU_BUTTON_SOUND, [hl]
call HandleMenuInput
bit BIT_B_BUTTON, a
jp nz, LogOff
@ -48,9 +48,9 @@ PCMainMenu:
jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague
jp LogOff ;otherwise, it's 4, and you're logging off
.playersPC
ld hl, wFlags_0xcd60
res 5, [hl]
set 3, [hl]
ld hl, wMiscFlags
res BIT_NO_MENU_BUTTON_SOUND, [hl]
set BIT_USING_GENERIC_PC, [hl]
ld a, SFX_ENTER_PC
call PlaySound
call WaitForSoundToFinish
@ -93,9 +93,9 @@ LogOff:
ld a, SFX_TURN_OFF_PC
call PlaySound
call WaitForSoundToFinish
ld hl, wFlags_0xcd60
res 3, [hl]
res 5, [hl]
ld hl, wMiscFlags
res BIT_USING_GENERIC_PC, [hl]
res BIT_NO_MENU_BUTTON_SOUND, [hl]
ret
TurnedOnPC1Text:

View File

@ -5,8 +5,8 @@ PlayerPC::
xor a
ld [wBagSavedMenuItem], a
ld [wParentMenuItem], a
ld a, [wFlags_0xcd60]
bit 3, a ; accessing player's PC through another PC?
ld a, [wMiscFlags]
bit BIT_USING_GENERIC_PC, a
jr nz, PlayerPCMenu
; accessing it directly
ld a, SFX_TURN_ON_PC
@ -15,12 +15,12 @@ PlayerPC::
call PrintText
PlayerPCMenu:
ld hl, wd730
set 6, [hl]
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
ld a, [wParentMenuItem]
ld [wCurrentMenuItem], a
ld hl, wFlags_0xcd60
set 5, [hl]
ld hl, wMiscFlags
set BIT_NO_MENU_BUTTON_SOUND, [hl]
call LoadScreenTilesFromBuffer2
hlcoord 0, 0
lb bc, 8, 14
@ -49,7 +49,7 @@ PlayerPCMenu:
ld hl, WhatDoYouWantText
call PrintText
call HandleMenuInput
bit 1, a
bit BIT_B_BUTTON, a
jp nz, ExitPlayerPC
call PlaceUnfilledArrowMenuCursor
ld a, [wCurrentMenuItem]
@ -62,22 +62,22 @@ PlayerPCMenu:
jp z, PlayerPCToss
ExitPlayerPC:
ld a, [wFlags_0xcd60]
bit 3, a ; accessing player's PC through another PC?
ld a, [wMiscFlags]
bit BIT_USING_GENERIC_PC, a
jr nz, .next
; accessing it directly
ld a, SFX_TURN_OFF_PC
call PlaySound
call WaitForSoundToFinish
.next
ld hl, wFlags_0xcd60
res 5, [hl]
ld hl, wMiscFlags
res BIT_NO_MENU_BUTTON_SOUND, [hl]
call LoadScreenTilesFromBuffer2
xor a
ld [wListScrollOffset], a
ld [wBagSavedMenuItem], a
ld hl, wd730
res 6, [hl]
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ret
@ -224,7 +224,7 @@ PlayerPCToss:
ld a, [wIsKeyItem]
and a
jr nz, .next
ld a, [wcf91]
ld a, [wCurItem]
call IsItemHM
jr c, .next
; if it's not a key item, there can be more than one of the item

View File

@ -9,7 +9,7 @@ ShowPokedexMenu:
ld [wListScrollOffset], a
ld [wLastMenuItem], a
inc a
ld [wd11e], a
ld [wPokedexNum], a
ldh [hJoy7], a
.setUpGraphics
callfar LoadPokedexTilePatterns
@ -37,7 +37,7 @@ ShowPokedexMenu:
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ldh [hJoy7], a
ld [wUnusedCD3A], a
ld [wUnusedOverrideSimulatedJoypadStatesIndex], a
ld [wOverrideSimulatedJoypadStatesMask], a
pop af
ld [wListScrollOffset], a
@ -72,8 +72,8 @@ HandlePokedexSideMenu:
push af
add b
inc a
ld [wd11e], a
ld a, [wd11e]
ld [wPokedexNum], a
ld a, [wPokedexNum]
push af
ld a, [wDexMaxSeenMon]
push af ; this doesn't need to be preserved
@ -124,7 +124,7 @@ ENDC
pop af
ld [wDexMaxSeenMon], a
pop af
ld [wd11e], a
ld [wPokedexNum], a
pop af
ld [wListScrollOffset], a
pop af
@ -157,7 +157,7 @@ ENDC
; play pokemon cry
.choseCry
ld a, [wd11e]
ld a, [wPokedexNum]
call GetCryData
call PlaySound
jr .handleMenuInput
@ -172,8 +172,8 @@ ENDC
push af
xor a
ldh [hTileAnimations], a
ld a, [wd11e]
ld [wcf91], a
ld a, [wPokedexNum]
ld [wCurPartySpecies], a
callfar PrintPokedexEntry
xor a
ldh [hAutoBGTransferEnabled], a
@ -359,7 +359,7 @@ Pokedex_PlacePokemonList:
call ClearScreenArea
hlcoord 1, 3
ld a, [wListScrollOffset]
ld [wd11e], a
ld [wPokedexNum], a
ld d, 7
ld a, [wDexMaxSeenMon]
cp 7
@ -370,17 +370,17 @@ Pokedex_PlacePokemonList:
; loop to print pokemon pokedex numbers and names
; if the player has owned the pokemon, it puts a pokeball beside the name
.printPokemonLoop
ld a, [wd11e]
ld a, [wPokedexNum]
inc a
ld [wd11e], a
ld [wPokedexNum], a
push af
push de
push hl
ld de, -SCREEN_WIDTH
add hl, de
ld de, wd11e
ld de, wPokedexNum
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber ; print the pokedex number
call PrintNumber
ld de, SCREEN_WIDTH
add hl, de
dec hl
@ -413,7 +413,7 @@ Pokedex_PlacePokemonList:
add hl, bc
pop de
pop af
ld [wd11e], a
ld [wPokedexNum], a
dec d
jr nz, .printPokemonLoop
ld a, 01
@ -423,10 +423,10 @@ Pokedex_PlacePokemonList:
; tests if a pokemon's bit is set in the seen or owned pokemon bit fields
; INPUT:
; [wd11e] = pokedex number
; [wPokedexNum] = pokedex number
; hl = address of bit field
IsPokemonBitSet:
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld c, a
ld b, FLAG_TEST
@ -444,8 +444,8 @@ ShowPokedexData:
; function to display pokedex data from inside the pokedex
ShowPokedexDataInternal:
ld hl, wd72c
set 1, [hl]
ld hl, wStatusFlags2
set BIT_NO_AUDIO_FADE_OUT, [hl]
ld a, $33 ; 3/7 volume
ldh [rNR50], a
ldh a, [hTileAnimations]
@ -453,13 +453,13 @@ ShowPokedexDataInternal:
xor a
ldh [hTileAnimations], a
call GBPalWhiteOut ; zero all palettes
ld a, [wd11e] ; pokemon ID
ld [wcf91], a
ld a, [wPokedexNum]
ld [wCurPartySpecies], a
push af
ld b, SET_PAL_POKEDEX
call RunPaletteCommand
pop af
ld [wd11e], a
ld [wPokedexNum], a
call DrawDexEntryOnScreen
call c, Pokedex_PrintFlavorTextAtRow11
.waitForButtonPress
@ -474,8 +474,8 @@ ShowPokedexDataInternal:
call RunDefaultPaletteCommand
call LoadTextBoxTilePatterns
call GBPalNormal
ld hl, wd72c
res 1, [hl]
ld hl, wStatusFlags2
res BIT_NO_AUDIO_FADE_OUT, [hl]
ld a, $77 ; max volume
ldh [rNR50], a
ret
@ -537,7 +537,7 @@ DrawDexEntryOnScreen:
call PlaceString
ld hl, PokedexEntryPointers
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld e, a
ld d, 0
@ -553,7 +553,7 @@ DrawDexEntryOnScreen:
ld h, b
ld l, c
push de
ld a, [wd11e]
ld a, [wPokedexNum]
push af
call IndexToPokedex
@ -562,16 +562,16 @@ DrawDexEntryOnScreen:
ld [hli], a
ld a, "<DOT>"
ld [hli], a
ld de, wd11e
ld de, wPokedexNum
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber ; print pokedex number
ld hl, wPokedexOwned
call IsPokemonBitSet
pop af
ld [wd11e], a
ld a, [wcf91]
ld [wd0b5], a
ld [wPokedexNum], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
pop de
push af
@ -584,8 +584,8 @@ DrawDexEntryOnScreen:
call GetMonHeader ; load pokemon picture location
hlcoord 1, 1
call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture
ld a, [wcf91]
call PlayCry ; play pokemon cry
ld a, [wCurPartySpecies]
call PlayCry
pop hl
pop de
@ -712,10 +712,10 @@ DrawTileLine:
INCLUDE "data/pokemon/dex_entries.asm"
PokedexToIndex:
; converts the Pokédex number at wd11e to an index
; converts the Pokédex number at [wPokedexNum] to an index
push bc
push hl
ld a, [wd11e]
ld a, [wPokedexNum]
ld b, a
ld c, 0
ld hl, PokedexOrder
@ -727,23 +727,23 @@ PokedexToIndex:
jr nz, .loop
ld a, c
ld [wd11e], a
ld [wPokedexNum], a
pop hl
pop bc
ret
IndexToPokedex:
; converts the index number at wd11e to a Pokédex number
; converts the index number at [wPokedexNum] to a Pokédex number
push bc
push hl
ld a, [wd11e]
ld a, [wPokedexNum]
dec a
ld hl, PokedexOrder
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wd11e], a
ld [wPokedexNum], a
pop hl
pop bc
ret

View File

@ -1,6 +1,5 @@
LoadSAV:
;(if carry -> write
;"the file data is destroyed")
; if carry, write "the file data is destroyed"
call ClearScreen
call LoadFontTilePatterns
call LoadTextBoxTilePatterns
@ -13,15 +12,15 @@ LoadSAV:
ld a, $2 ; good checksum
jr .goodsum
.badsum
ld hl, wd730
ld hl, wStatusFlags5
push hl
set 6, [hl]
set BIT_NO_TEXT_DELAY, [hl]
ld hl, FileDataDestroyedText
call PrintText
ld c, 100
call DelayFrames
pop hl
res 6, [hl]
res BIT_NO_TEXT_DELAY, [hl]
ld a, $1 ; bad checksum
.goodsum
ld [wSaveFileStatus], a
@ -65,7 +64,7 @@ LoadSAV0:
ld bc, wMainDataEnd - wMainDataStart
call CopyData
ld hl, wCurMapTileset
set 7, [hl]
set BIT_NO_PREVIOUS_MAP, [hl]
ld hl, sSpriteData
ld de, wSpriteDataStart
ld bc, wSpriteDataEnd - wSpriteDataStart
@ -341,15 +340,15 @@ ChangeBox::
and a
ret nz ; return if No was chosen
ld hl, wCurrentBoxNum
bit 7, [hl] ; is it the first time player is changing the box?
bit BIT_HAS_CHANGED_BOXES, [hl] ; is it the first time player is changing the box?
call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM
call DisplayChangeBoxMenu
call UpdateSprites
ld hl, hUILayoutFlags
set 1, [hl]
set BIT_DOUBLE_SPACED_MENU, [hl]
call HandleMenuInput
ld hl, hUILayoutFlags
res 1, [hl]
res BIT_DOUBLE_SPACED_MENU, [hl]
bit BIT_B_BUTTON, a
ret nz
ld a, $b6
@ -361,7 +360,7 @@ ChangeBox::
ld hl, wBoxDataStart
call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM
ld a, [wCurrentMenuItem]
set 7, a
set BIT_HAS_CHANGED_BOXES, a
ld [wCurrentBoxNum], a
call GetBoxSRAMLocation
ld de, wBoxDataStart
@ -433,12 +432,12 @@ DisplayChangeBoxMenu:
lb bc, 12, 7
call TextBoxBorder
ld hl, hUILayoutFlags
set 2, [hl]
set BIT_SINGLE_SPACED_LINES, [hl]
ld de, BoxNames
hlcoord 13, 1
call PlaceString
ld hl, hUILayoutFlags
res 2, [hl]
res BIT_SINGLE_SPACED_LINES, [hl]
ld a, [wCurrentBoxNum]
and $7f
cp 9

View File

@ -142,12 +142,12 @@ StartMenu_Pokemon::
jp .loop
.canFly
call ChooseFlyDestination
ld a, [wd732]
bit 3, a ; did the player decide to fly?
ld a, [wStatusFlags6]
bit BIT_FLY_WARP, a
jr nz, .asm_5d4c
call LoadFontTilePatterns
ld hl, wd72e
set 1, [hl]
ld hl, wStatusFlags4
set BIT_UNKNOWN_4_1, [hl]
jp StartMenu_Pokemon
.asm_5d4c
call Func_1510
@ -164,11 +164,11 @@ StartMenu_Pokemon::
bit BIT_SOULBADGE, a
jp z, .newBadgeRequired
farcall IsSurfingAllowed
ld hl, wd728
bit 1, [hl]
res 1, [hl]
ld hl, wStatusFlags1
bit BIT_SURF_ALLOWED, [hl]
res BIT_SURF_ALLOWED, [hl]
jp z, .loop
ld a, [wcf91]
ld a, [wCurPartySpecies]
cp STARTER_PIKACHU
jr z, .surfingPikachu
ld a, $1
@ -178,7 +178,7 @@ StartMenu_Pokemon::
.continue
ld [wd473], a
ld a, SURFBOARD
ld [wcf91], a
ld [wCurItem], a
ld [wPseudoItemID], a
call UseItem
ld a, [wActionResultOrTookBattleTurn]
@ -193,7 +193,7 @@ StartMenu_Pokemon::
.strength
bit BIT_RAINBOWBADGE, a
jp z, .newBadgeRequired
predef PrintStrengthTxt
predef PrintStrengthText
call GBPalWhiteOutWithDelay3
jp .goBackToMap
.flash
@ -210,7 +210,7 @@ StartMenu_Pokemon::
text_end
.dig
ld a, ESCAPE_ROPE
ld [wcf91], a
ld [wCurItem], a
ld [wPseudoItemID], a
call UseItem
ld a, [wActionResultOrTookBattleTurn]
@ -230,13 +230,13 @@ StartMenu_Pokemon::
.canTeleport
ld hl, .warpToLastPokemonCenterText
call PrintText
ld hl, wd732
set 3, [hl]
set 6, [hl]
ld hl, wStatusFlags6
set BIT_FLY_WARP, [hl]
set BIT_ESCAPE_WARP, [hl]
call Func_1510
ld hl, wd72e
set 1, [hl]
res 4, [hl]
ld hl, wStatusFlags4
set BIT_UNKNOWN_4_1, [hl]
res BIT_NO_BATTLES, [hl]
ld c, 60
call DelayFrames
call GBPalWhiteOutWithDelay3
@ -276,7 +276,7 @@ StartMenu_Pokemon::
ld a, [wPartyAndBillsPCSavedMenuItem]
push af
ld a, POTION
ld [wcf91], a
ld [wCurItem], a
ld [wPseudoItemID], a
call UseItem
pop af
@ -354,7 +354,7 @@ StartMenu_Item::
call PlaceUnfilledArrowMenuCursor
xor a
ld [wMenuItemToSwap], a
ld a, [wcf91]
ld a, [wCurItem]
cp BICYCLE
jp z, .useOrTossItem
.notBicycle1
@ -381,15 +381,15 @@ StartMenu_Item::
jr z, .useOrTossItem
jp ItemMenuLoop
.useOrTossItem ; if the player made the choice to use or toss the item
ld a, [wcf91]
ld [wd11e], a
ld a, [wCurItem]
ld [wNamedObjectIndex], a
call GetItemName
call CopyToStringBuffer
ld a, [wcf91]
ld a, [wCurItem]
cp BICYCLE
jr nz, .notBicycle2
ld a, [wd732]
bit 5, a
ld a, [wStatusFlags6]
bit BIT_ALWAYS_ON_BIKE, a
jr z, .useItem_closeMenu
ld hl, CannotGetOffHereText
call PrintText
@ -400,14 +400,14 @@ StartMenu_Item::
jr nz, .tossItem
; use item
ld [wPseudoItemID], a ; a must be 0 due to above conditional jump
ld a, [wcf91]
ld a, [wCurItem]
cp HM01
jr nc, .useItem_partyMenu
ld hl, UsableItems_CloseMenu
ld de, 1
call IsInArray
jr c, .useItem_closeMenu
ld a, [wcf91]
ld a, [wCurItem]
ld hl, UsableItems_PartyMenu
ld de, 1
call IsInArray
@ -443,7 +443,7 @@ StartMenu_Item::
ld a, [wIsKeyItem]
and a
jr nz, .skipAskingQuantity
ld a, [wcf91]
ld a, [wCurItem]
call IsItemHM
jr c, .skipAskingQuantity
call DisplayChooseQuantityMenu
@ -657,8 +657,8 @@ TrainerInfo_DrawVerticalLine:
ret
StartMenu_SaveReset::
ld a, [wd72e]
bit 6, a ; is the player using the link feature?
ld a, [wStatusFlags4]
bit BIT_LINK_CONNECTED, a
jp nz, Init
predef SaveSAV ; save the game
call LoadScreenTilesFromBuffer2 ; restore saved screen

Some files were not shown because too many files have changed in this diff Show More