mirror of
https://github.com/pret/pokered.git
synced 2024-11-26 23:50:41 +00:00
Identify more flag bits (#464)
This commit is contained in:
parent
21cfdbd458
commit
8f1dcf07e5
@ -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
|
||||
@ -197,7 +197,7 @@ Audio1_sound_ret:
|
||||
.dontDisable
|
||||
jr .afterDisable
|
||||
.returnFromCall
|
||||
res 1, [hl]
|
||||
res BIT_SOUND_CALL, [hl]
|
||||
ld d, $0
|
||||
ld a, c
|
||||
add a
|
||||
@ -377,8 +377,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:
|
||||
|
@ -17,9 +17,9 @@ Audio2_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
|
||||
@ -163,8 +163,8 @@ Audio2_PlayNextNote:
|
||||
ld a, c
|
||||
cp CHAN5
|
||||
jr nz, .beginChecks
|
||||
ld a, [wLowHealthAlarm] ; low health alarm enabled?
|
||||
bit 7, a
|
||||
ld a, [wLowHealthAlarm]
|
||||
bit BIT_LOW_HEALTH_ALARM, a
|
||||
ret nz
|
||||
.beginChecks
|
||||
; ---
|
||||
@ -208,7 +208,7 @@ Audio2_sound_ret:
|
||||
.dontDisable
|
||||
jr .afterDisable
|
||||
.returnFromCall
|
||||
res 1, [hl]
|
||||
res BIT_SOUND_CALL, [hl]
|
||||
ld d, $0
|
||||
ld a, c
|
||||
add a
|
||||
@ -388,8 +388,8 @@ Audio2_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 Audio2_sound_ret
|
||||
|
||||
Audio2_vibrato:
|
||||
@ -978,7 +978,7 @@ Audio2_ResetCryModifiers:
|
||||
cp CHAN5
|
||||
jr nz, .skip
|
||||
ld a, [wLowHealthAlarm]
|
||||
bit 7, a
|
||||
bit BIT_LOW_HEALTH_ALARM, a
|
||||
jr z, .skip
|
||||
xor a
|
||||
ld [wFrequencyModifier], a
|
||||
|
@ -15,9 +15,9 @@ Audio3_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
|
||||
@ -197,7 +197,7 @@ Audio3_sound_ret:
|
||||
.dontDisable
|
||||
jr .afterDisable
|
||||
.returnFromCall
|
||||
res 1, [hl]
|
||||
res BIT_SOUND_CALL, [hl]
|
||||
ld d, $0
|
||||
ld a, c
|
||||
add a
|
||||
@ -377,8 +377,8 @@ Audio3_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 Audio3_sound_ret
|
||||
|
||||
Audio3_vibrato:
|
||||
|
@ -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
|
||||
|
||||
|
@ -66,3 +66,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
|
||||
|
@ -72,6 +72,10 @@ 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
|
||||
|
@ -29,6 +29,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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1
|
||||
|
@ -1,3 +1,8 @@
|
||||
; 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
|
||||
@ -9,6 +14,15 @@
|
||||
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
|
||||
|
||||
; wOptions
|
||||
DEF TEXT_DELAY_MASK EQU %111
|
||||
const_def 6
|
||||
@ -24,6 +38,12 @@ DEF TEXT_DELAY_SLOW EQU %101 ; 5
|
||||
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
|
||||
@ -117,3 +137,13 @@ DEF NUM_BADGES EQU const_value
|
||||
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
|
||||
|
@ -48,12 +48,12 @@ SpriteFacingAndAnimationTable:
|
||||
; y, x, attributes
|
||||
db 0, 0, $00 ; top left
|
||||
db 0, 8, $00 ; top right
|
||||
db 8, 0, OAMFLAG_CANBEMASKED ; bottom left
|
||||
db 8, 8, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right
|
||||
db 8, 0, UNDER_GRASS ; bottom left
|
||||
db 8, 8, UNDER_GRASS | FACING_END ; bottom right
|
||||
|
||||
.FlippedOAM:
|
||||
; y, x, attributes
|
||||
db 0, 8, OAM_HFLIP ; top left
|
||||
db 0, 0, OAM_HFLIP ; top right
|
||||
db 8, 8, OAM_HFLIP | OAMFLAG_CANBEMASKED ; bottom left
|
||||
db 8, 0, OAM_HFLIP | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA ; bottom right
|
||||
db 8, 8, OAM_HFLIP | UNDER_GRASS ; bottom left
|
||||
db 8, 0, OAM_HFLIP | UNDER_GRASS | FACING_END ; bottom right
|
||||
|
@ -114,13 +114,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 [de], a
|
||||
inc de
|
||||
|
@ -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:
|
||||
@ -108,12 +116,12 @@ GetBattleTransitionID_CompareLevels:
|
||||
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"
|
||||
|
@ -1007,12 +1007,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
|
||||
.skipWaitForSound
|
||||
; a is 0, so this zeroes the enemy's accumulated damage.
|
||||
@ -1305,7 +1305,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
|
||||
@ -1860,15 +1860,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:
|
||||
@ -2121,7 +2121,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
|
||||
@ -2473,11 +2473,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
|
||||
|
||||
@ -2604,10 +2604,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
|
||||
@ -2652,7 +2652,7 @@ SelectMenuItem:
|
||||
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.
|
||||
@ -3850,7 +3850,7 @@ PrintMoveFailureText:
|
||||
.playersTurn
|
||||
ld hl, DoesntAffectMonText
|
||||
ld a, [wDamageMultipliers]
|
||||
and $7f
|
||||
and EFFECTIVENESS_MASK
|
||||
jr z, .gotTextToPrint
|
||||
ld hl, AttackMissedText
|
||||
ld a, [wCriticalHitOrOHKO]
|
||||
@ -5248,7 +5248,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
|
||||
@ -5271,7 +5271,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
|
||||
|
@ -194,7 +194,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
|
||||
|
@ -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
|
||||
|
@ -632,27 +632,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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
ApplyOutOfBattlePoisonDamage:
|
||||
ld a, [wStatusFlags5]
|
||||
assert BIT_SCRIPTED_MOVEMENT_STATE == 7
|
||||
add a ; overflows bit 7 into carry flag
|
||||
add a ; overflows scripted movement state bit into carry flag
|
||||
jp c, .noBlackOut ; no black out if joypad states are being simulated
|
||||
ld a, [wPartyCount]
|
||||
and a
|
||||
|
@ -214,7 +214,7 @@ UpdateHPBar_PrintHPNumber:
|
||||
ld [wHPBarTempHP], a
|
||||
push hl
|
||||
ldh a, [hUILayoutFlags]
|
||||
bit 0, a
|
||||
bit BIT_PARTY_MENU_HP_BAR, a
|
||||
jr z, .hpBelowBar
|
||||
ld de, $9
|
||||
jr .next
|
||||
|
@ -124,7 +124,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]
|
||||
@ -132,7 +132,7 @@ PrepareOAMData::
|
||||
inc hl
|
||||
ld [de], a
|
||||
inc e
|
||||
bit 0, a ; OAMFLAG_ENDOFDATA
|
||||
bit BIT_END_OF_OAM_DATA, a
|
||||
jr z, .tileLoop
|
||||
|
||||
ld a, e
|
||||
|
@ -691,7 +691,7 @@ ItemUseSurfboard:
|
||||
ldh [hSpriteIndex], a
|
||||
ld d, 16 ; talking range in pixels (normal range)
|
||||
call IsSpriteInFrontOfPlayer2
|
||||
res 7, [hl]
|
||||
res BIT_FACE_PLAYER, [hl]
|
||||
ldh a, [hSpriteIndex]
|
||||
and a ; is there a sprite in the way?
|
||||
jr nz, .cannotStopSurfing
|
||||
@ -1052,13 +1052,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)
|
||||
@ -1202,13 +1202,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 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
|
||||
|
@ -75,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
|
||||
@ -196,13 +196,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
|
||||
|
@ -282,7 +282,7 @@ CableClub_DoBattleOrTradeAgain:
|
||||
call ClearScreen
|
||||
call Delay3
|
||||
ld hl, wOptions
|
||||
res 7, [hl]
|
||||
res BIT_BATTLE_ANIMATION, [hl]
|
||||
predef InitOpponent
|
||||
predef HealParty
|
||||
jp ReturnToCableClubRoom
|
||||
@ -342,10 +342,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
|
||||
@ -407,10 +407,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
|
||||
@ -489,7 +489,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
|
||||
@ -585,7 +585,7 @@ ReturnToCableClubRoom:
|
||||
ld a, [hl]
|
||||
push af
|
||||
push hl
|
||||
res 0, [hl]
|
||||
res BIT_FONT_LOADED, [hl]
|
||||
xor a
|
||||
ld [wStatusFlags3], a ; clears BIT_INIT_TRADE_CENTER_FACING
|
||||
dec a
|
||||
|
@ -3,7 +3,7 @@ DisplayTextIDInit::
|
||||
xor a
|
||||
ld [wListMenuID], a
|
||||
ld a, [wAutoTextBoxDrawingControl]
|
||||
bit 0, a
|
||||
bit BIT_NO_AUTO_TEXT_BOX, a
|
||||
jr nz, .skipDrawingTextBoxBorder
|
||||
ldh a, [hTextID]
|
||||
and a
|
||||
@ -31,7 +31,7 @@ DisplayTextIDInit::
|
||||
call TextBoxBorder
|
||||
.skipDrawingTextBoxBorder
|
||||
ld hl, wFontLoaded
|
||||
set 0, [hl]
|
||||
set BIT_FONT_LOADED, [hl]
|
||||
ld hl, wMiscFlags
|
||||
bit BIT_NO_SPRITE_UPDATES, [hl]
|
||||
res BIT_NO_SPRITE_UPDATES, [hl]
|
||||
|
@ -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
|
||||
|
@ -70,12 +70,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
|
||||
|
@ -50,7 +50,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]
|
||||
|
@ -66,7 +66,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
|
||||
@ -349,15 +349,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
|
||||
call GetBoxSRAMLocation
|
||||
@ -366,7 +366,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
|
||||
@ -448,12 +448,12 @@ DisplayChangeBoxMenu:
|
||||
ld c, 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
|
||||
|
@ -227,8 +227,8 @@ DisplayTwoOptionMenu:
|
||||
ld [wMenuWatchMovingOutOfBounds], a
|
||||
push hl
|
||||
ld hl, wTwoOptionMenuID
|
||||
bit 7, [hl] ; select second menu item by default?
|
||||
res 7, [hl]
|
||||
bit BIT_SECOND_MENU_OPTION_DEFAULT, [hl]
|
||||
res BIT_SECOND_MENU_OPTION_DEFAULT, [hl]
|
||||
jr z, .storeCurrentMenuItem
|
||||
inc a
|
||||
.storeCurrentMenuItem
|
||||
|
@ -162,7 +162,7 @@ LoadMapSpriteTilePatterns:
|
||||
pop de
|
||||
ld b, a
|
||||
ld a, [wFontLoaded]
|
||||
bit 0, a ; reloading upper half of tile patterns after displaying text?
|
||||
bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text?
|
||||
jr nz, .skipFirstLoad ; if so, skip loading data into the lower half
|
||||
ld a, b
|
||||
ld b, 0
|
||||
@ -183,7 +183,7 @@ LoadMapSpriteTilePatterns:
|
||||
inc d
|
||||
.noCarry3
|
||||
ld a, [wFontLoaded]
|
||||
bit 0, a ; reloading upper half of tile patterns after displaying text?
|
||||
bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text?
|
||||
jr nz, .loadWhileLCDOn
|
||||
pop af
|
||||
pop hl
|
||||
@ -268,7 +268,7 @@ InitOutsideMapSprites:
|
||||
call nc, GetSplitMapSpriteSetID ; if so, choose the appropriate one
|
||||
ld b, a ; b = spriteSetID
|
||||
ld a, [wFontLoaded]
|
||||
bit 0, a ; reloading upper half of tile patterns after displaying text?
|
||||
bit BIT_FONT_LOADED, a ; reloading upper half of tile patterns after displaying text?
|
||||
jr nz, .loadSpriteSet ; if so, forcibly reload the sprite set
|
||||
ld a, [wSpriteSetID]
|
||||
cp b ; has the sprite set ID changed?
|
||||
|
@ -57,7 +57,7 @@ UpdatePlayerSprite:
|
||||
.next
|
||||
ld [wSpritePlayerStateData1FacingDirection], a
|
||||
ld a, [wFontLoaded]
|
||||
bit 0, a
|
||||
bit BIT_FONT_LOADED, a
|
||||
jr nz, .notMoving
|
||||
.moving
|
||||
ld a, [wMovementFlags]
|
||||
@ -135,11 +135,11 @@ UpdateNPCSprite:
|
||||
ld l, a
|
||||
inc l
|
||||
ld a, [hl] ; x#SPRITESTATEDATA1_MOVEMENTSTATUS
|
||||
bit 7, a ; is the face player flag set?
|
||||
bit BIT_FACE_PLAYER, a
|
||||
jp nz, MakeNPCFacePlayer
|
||||
ld b, a
|
||||
ld a, [wFontLoaded]
|
||||
bit 0, a
|
||||
bit BIT_FONT_LOADED, a
|
||||
jp nz, notYetMoving
|
||||
ld a, b
|
||||
cp $2
|
||||
@ -412,7 +412,7 @@ MakeNPCFacePlayer:
|
||||
ld a, [wStatusFlags3]
|
||||
bit BIT_NO_NPC_FACE_PLAYER, a
|
||||
jr nz, notYetMoving
|
||||
res 7, [hl]
|
||||
res BIT_FACE_PLAYER, [hl]
|
||||
ld a, [wPlayerDirection]
|
||||
bit PLAYER_DIR_BIT_UP, a
|
||||
jr z, .notFacingDown
|
||||
|
@ -16,7 +16,7 @@ FindPathToPlayer:
|
||||
and a
|
||||
jr nz, .stillHasYProgress
|
||||
ldh a, [hFindPathFlags]
|
||||
set 0, a ; current end of path matches the player's Y coordinate
|
||||
set BIT_PATH_FOUND_Y, a
|
||||
ldh [hFindPathFlags], a
|
||||
.stillHasYProgress
|
||||
ldh a, [hFindPathXProgress]
|
||||
@ -27,11 +27,11 @@ FindPathToPlayer:
|
||||
and a
|
||||
jr nz, .stillHasXProgress
|
||||
ldh a, [hFindPathFlags]
|
||||
set 1, a ; current end of path matches the player's X coordinate
|
||||
set BIT_PATH_FOUND_X, a
|
||||
ldh [hFindPathFlags], a
|
||||
.stillHasXProgress
|
||||
ldh a, [hFindPathFlags]
|
||||
cp $3 ; has the end of the path reached the player's position?
|
||||
cp (1 << BIT_PATH_FOUND_X) | (1 << BIT_PATH_FOUND_Y)
|
||||
jr z, .done
|
||||
; Compare whether the X distance between the player and the current of the path
|
||||
; is greater or if the Y distance is. Then, try to reduce whichever is greater.
|
||||
@ -40,7 +40,7 @@ FindPathToPlayer:
|
||||
jr c, .yDistanceGreater
|
||||
; x distance is greater
|
||||
ldh a, [hNPCPlayerRelativePosFlags]
|
||||
bit 1, a
|
||||
bit BIT_PLAYER_LOWER_X, a
|
||||
jr nz, .playerIsLeftOfNPC
|
||||
ld d, NPC_MOVEMENT_RIGHT
|
||||
jr .next1
|
||||
@ -53,7 +53,7 @@ FindPathToPlayer:
|
||||
jr .storeDirection
|
||||
.yDistanceGreater
|
||||
ldh a, [hNPCPlayerRelativePosFlags]
|
||||
bit 0, a
|
||||
bit BIT_PLAYER_LOWER_Y, a
|
||||
jr nz, .playerIsAboveNPC
|
||||
ld d, NPC_MOVEMENT_DOWN
|
||||
jr .next2
|
||||
@ -97,15 +97,15 @@ CalcPositionOfPlayerRelativeToNPC:
|
||||
.NPCNorthOfPlayer
|
||||
push hl
|
||||
ld hl, hNPCPlayerRelativePosFlags
|
||||
bit 0, [hl]
|
||||
set 0, [hl]
|
||||
bit BIT_PLAYER_LOWER_Y, [hl]
|
||||
set BIT_PLAYER_LOWER_Y, [hl]
|
||||
pop hl
|
||||
jr .divideYDistance
|
||||
.NPCSouthOfOrAlignedWithPlayer
|
||||
push hl
|
||||
ld hl, hNPCPlayerRelativePosFlags
|
||||
bit 0, [hl]
|
||||
res 0, [hl]
|
||||
bit BIT_PLAYER_LOWER_Y, [hl]
|
||||
res BIT_PLAYER_LOWER_Y, [hl]
|
||||
pop hl
|
||||
.divideYDistance
|
||||
push hl
|
||||
@ -125,15 +125,15 @@ CalcPositionOfPlayerRelativeToNPC:
|
||||
.NPCWestOfPlayer
|
||||
push hl
|
||||
ld hl, hNPCPlayerRelativePosFlags
|
||||
bit 1, [hl]
|
||||
set 1, [hl]
|
||||
bit BIT_PLAYER_LOWER_X, [hl]
|
||||
set BIT_PLAYER_LOWER_X, [hl]
|
||||
pop hl
|
||||
jr .divideXDistance
|
||||
.NPCEastOfOrAlignedWithPlayer
|
||||
push hl
|
||||
ld hl, hNPCPlayerRelativePosFlags
|
||||
bit 1, [hl]
|
||||
res 1, [hl]
|
||||
bit BIT_PLAYER_LOWER_X, [hl]
|
||||
res BIT_PLAYER_LOWER_X, [hl]
|
||||
pop hl
|
||||
.divideXDistance
|
||||
ldh [hDividend2], a
|
||||
|
@ -18,7 +18,7 @@ TryPushingBoulder::
|
||||
swap a
|
||||
ld e, a
|
||||
add hl, de
|
||||
res 7, [hl]
|
||||
res BIT_FACE_PLAYER, [hl]
|
||||
call GetSpriteMovementByte2Pointer
|
||||
ld a, [hl]
|
||||
cp BOULDER_MOVEMENT_BYTE_2
|
||||
|
@ -52,7 +52,7 @@ LoadSpecialWarpData:
|
||||
bit BIT_DEBUG_MODE, a
|
||||
; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug
|
||||
jr nz, .notNewGameWarp
|
||||
bit 2, a
|
||||
bit BIT_FLY_OR_DUNGEON_WARP, a
|
||||
jr nz, .notNewGameWarp
|
||||
ld hl, NewGameWarp
|
||||
.copyWarpData
|
||||
|
@ -127,11 +127,11 @@ TryingToLearn:
|
||||
hlcoord 6, 8
|
||||
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
|
||||
ld hl, wTopMenuItemY
|
||||
ld a, 8
|
||||
@ -147,10 +147,10 @@ TryingToLearn:
|
||||
ld [hli], a ; wMenuWatchedKeys
|
||||
ld [hl], 0 ; wLastMenuItem
|
||||
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]
|
||||
push af
|
||||
call LoadScreenTilesFromBuffer1
|
||||
pop af
|
||||
|
@ -41,7 +41,7 @@ DrawHP_:
|
||||
call DrawHPBar
|
||||
pop hl
|
||||
ldh a, [hUILayoutFlags]
|
||||
bit 0, a
|
||||
bit BIT_PARTY_MENU_HP_BAR, a
|
||||
jr z, .printFractionBelowBar
|
||||
ld bc, $9 ; right of bar
|
||||
jr .printFraction
|
||||
|
@ -1,8 +1,9 @@
|
||||
PromptUserToPlaySlots:
|
||||
call SaveScreenTilesToBuffer2
|
||||
ld a, BANK(DisplayTextIDInit) ; TRUE
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
ld b, a
|
||||
ld a, BANK(DisplayTextIDInit)
|
||||
assert BANK(DisplayTextIDInit) == 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
ld [wAutoTextBoxDrawingControl], a ; 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
ld b, a ; BANK(DisplayTextIDInit)
|
||||
ld hl, DisplayTextIDInit
|
||||
call Bankswitch
|
||||
ld hl, PlaySlotMachineText
|
||||
@ -173,7 +174,7 @@ OneMoreGoSlotMachineText:
|
||||
|
||||
SlotMachine_SetFlags:
|
||||
ld hl, wSlotMachineFlags
|
||||
bit 7, [hl]
|
||||
bit BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl]
|
||||
ret nz
|
||||
ld a, [wSlotMachineAllowMatchesCounter]
|
||||
and a
|
||||
@ -191,14 +192,14 @@ SlotMachine_SetFlags:
|
||||
ld [hl], 0
|
||||
ret
|
||||
.allowMatches
|
||||
set 6, [hl]
|
||||
set BIT_SLOTS_CAN_WIN, [hl]
|
||||
ret
|
||||
.setAllowMatchesCounter
|
||||
ld a, 60
|
||||
ld [wSlotMachineAllowMatchesCounter], a
|
||||
ret
|
||||
.allowSevenAndBarMatches
|
||||
set 7, [hl]
|
||||
set BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR, [hl]
|
||||
ret
|
||||
|
||||
SlotMachine_SpinWheels:
|
||||
@ -289,7 +290,7 @@ SlotMachine_StopWheel1Early:
|
||||
call SlotMachine_GetWheel1Tiles
|
||||
ld hl, wSlotMachineWheel1BottomTile
|
||||
ld a, [wSlotMachineFlags]
|
||||
and $80
|
||||
and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR
|
||||
jr nz, .sevenAndBarMode
|
||||
; Stop early if the middle symbol is not a cherry.
|
||||
inc hl
|
||||
@ -317,7 +318,7 @@ SlotMachine_StopWheel1Early:
|
||||
SlotMachine_StopWheel2Early:
|
||||
call SlotMachine_GetWheel2Tiles
|
||||
ld a, [wSlotMachineFlags]
|
||||
and $80
|
||||
and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR
|
||||
jr nz, .sevenAndBarMode
|
||||
; Stop early if any symbols are lined up in the first two wheels.
|
||||
call SlotMachine_FindWheel1Wheel2Matches
|
||||
@ -401,7 +402,7 @@ SlotMachine_CheckForMatches:
|
||||
call SlotMachine_CheckForMatch
|
||||
jr z, .foundMatch
|
||||
ld a, [wSlotMachineFlags]
|
||||
and $c0
|
||||
and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR)
|
||||
jr z, .noMatch
|
||||
ld hl, wSlotMachineRerollCounter
|
||||
dec [hl]
|
||||
@ -421,9 +422,9 @@ SlotMachine_CheckForMatches:
|
||||
jp SlotMachine_CheckForMatches
|
||||
.foundMatch
|
||||
ld a, [wSlotMachineFlags]
|
||||
and $c0
|
||||
and (1 << BIT_SLOTS_CAN_WIN) | (1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR)
|
||||
jr z, .rollWheel3DownByOneSymbol ; roll wheel if player isn't allowed to win
|
||||
and $80
|
||||
and 1 << BIT_SLOTS_CAN_WIN_WITH_7_OR_BAR
|
||||
jr nz, .acceptMatch
|
||||
; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel
|
||||
ld a, [hl]
|
||||
@ -599,7 +600,7 @@ SlotReward300Func:
|
||||
call PlaySound
|
||||
call Random
|
||||
cp $80
|
||||
ld a, $0
|
||||
ld a, 0
|
||||
jr c, .skip
|
||||
ld [wSlotMachineFlags], a
|
||||
.skip
|
||||
@ -654,7 +655,7 @@ SlotMachine_PrintPayoutCoins:
|
||||
jp PrintNumber
|
||||
|
||||
SlotMachine_PayCoinsToPlayer:
|
||||
ld a, $1
|
||||
ld a, TRUE
|
||||
ld [wMuteAudioAndPauseMusic], a
|
||||
call WaitForSoundToFinish
|
||||
|
||||
|
@ -227,7 +227,7 @@ SetSpriteMovementBytesToFF::
|
||||
|
||||
; returns the sprite movement byte 1 pointer for sprite [hSpriteIndex] in hl
|
||||
GetSpriteMovementByte1Pointer::
|
||||
ld h, $C2
|
||||
ld h, HIGH(wSpriteStateData2)
|
||||
ldh a, [hSpriteIndex]
|
||||
swap a
|
||||
add 6
|
||||
|
@ -121,7 +121,7 @@ OverworldLoopLessDelay::
|
||||
ld a, [wCurMap]
|
||||
call SwitchToMapRomBank ; switch to the ROM bank of the current map
|
||||
ld hl, wCurMapTileset
|
||||
set 7, [hl]
|
||||
set BIT_NO_PREVIOUS_MAP, [hl]
|
||||
.changeMap
|
||||
jp EnterMap
|
||||
.checkForOpponent
|
||||
@ -879,10 +879,10 @@ LoadTilesetTilePatternData::
|
||||
ld a, [wTilesetBank]
|
||||
jp FarCopyData2
|
||||
|
||||
; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8
|
||||
; this loads the current map's complete tile map (which references blocks, not individual tiles) to wOverworldMap
|
||||
; it can also load partial tile maps of connected maps into a border of length 3 around the current map
|
||||
LoadTileBlockMap::
|
||||
; fill C6E8-CBFB with the background tile
|
||||
; fill wOverworldMap-wOverworldMapEnd with the background tile
|
||||
ld hl, wOverworldMap
|
||||
ld a, [wMapBackgroundTile]
|
||||
ld d, a
|
||||
@ -1210,7 +1210,7 @@ IsSpriteInFrontOfPlayer2::
|
||||
and $f0
|
||||
inc a
|
||||
ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS
|
||||
set 7, [hl] ; set flag to make the sprite face the player
|
||||
set BIT_FACE_PLAYER, [hl]
|
||||
ld a, e
|
||||
ldh [hTextID], a
|
||||
ret
|
||||
@ -1303,7 +1303,7 @@ CheckForTilePairCollisions::
|
||||
ld a, [wTileInFrontOfPlayer]
|
||||
ld c, a
|
||||
.tilePairCollisionLoop
|
||||
ld a, [wCurMapTileset] ; tileset number
|
||||
ld a, [wCurMapTileset]
|
||||
ld b, a
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
@ -1943,7 +1943,7 @@ CollisionCheckOnWater::
|
||||
call PlayDefaultMusic
|
||||
jr .noCollision
|
||||
.checkIfVermilionDockTileset
|
||||
ld a, [wCurMapTileset] ; tileset
|
||||
ld a, [wCurMapTileset]
|
||||
cp SHIP_PORT ; Vermilion Dock tileset
|
||||
jr nz, .noCollision ; keep surfing if it's not the boarding platform tile
|
||||
jr .stopSurfing ; if it is the boarding platform tile, stop surfing
|
||||
@ -2015,10 +2015,10 @@ LoadMapHeader::
|
||||
call SwitchToMapRomBank
|
||||
ld a, [wCurMapTileset]
|
||||
ld b, a
|
||||
res 7, a
|
||||
res BIT_NO_PREVIOUS_MAP, a
|
||||
ld [wCurMapTileset], a
|
||||
ldh [hPreviousTileset], a
|
||||
bit 7, b
|
||||
bit BIT_NO_PREVIOUS_MAP, b
|
||||
ret nz
|
||||
ld hl, MapHeaderPointers
|
||||
ld a, [wCurMap]
|
||||
@ -2203,9 +2203,9 @@ LoadMapHeader::
|
||||
ld [hl], a ; store text ID in byte 1 of sprite entry
|
||||
pop hl
|
||||
ldh a, [hLoadSpriteTemp1]
|
||||
bit 6, a
|
||||
bit BIT_TRAINER, a
|
||||
jr nz, .trainerSprite
|
||||
bit 7, a
|
||||
bit BIT_ITEM, a
|
||||
jr nz, .itemBallSprite
|
||||
jr .regularSprite
|
||||
.trainerSprite
|
||||
|
@ -3,7 +3,7 @@ PrintPredefTextID::
|
||||
ld hl, TextPredefs
|
||||
call SetMapTextPointer
|
||||
ld hl, wTextPredefFlag
|
||||
set 0, [hl]
|
||||
set BIT_TEXT_PREDEF, [hl]
|
||||
call DisplayTextID
|
||||
|
||||
RestoreMapTextPointer::
|
||||
|
@ -13,12 +13,12 @@
|
||||
; their meaning at the beginning of the functions's execution.
|
||||
PrintBCDNumber::
|
||||
ld b, c ; save flags in b
|
||||
res 7, c
|
||||
res 6, c
|
||||
res 5, c ; c now holds the length
|
||||
bit 5, b
|
||||
res BIT_LEADING_ZEROES, c
|
||||
res BIT_LEFT_ALIGN, c
|
||||
res BIT_MONEY_SIGN, c ; c now holds the length
|
||||
bit BIT_MONEY_SIGN, b
|
||||
jr z, .loop
|
||||
bit 7, b
|
||||
bit BIT_LEADING_ZEROES, b
|
||||
jr nz, .loop
|
||||
ld [hl], "¥"
|
||||
inc hl
|
||||
@ -31,14 +31,14 @@ PrintBCDNumber::
|
||||
inc de
|
||||
dec c
|
||||
jr nz, .loop
|
||||
bit 7, b ; were any non-zero digits printed?
|
||||
bit BIT_LEADING_ZEROES, b
|
||||
jr z, .done ; if so, we are done
|
||||
.numberEqualsZero ; if every digit of the BCD number is zero
|
||||
bit 6, b ; left or right alignment?
|
||||
bit BIT_LEFT_ALIGN, b
|
||||
jr nz, .skipRightAlignmentAdjustment
|
||||
dec hl ; if the string is right-aligned, it needs to be moved back one space
|
||||
.skipRightAlignmentAdjustment
|
||||
bit 5, b
|
||||
bit BIT_MONEY_SIGN, b
|
||||
jr z, .skipCurrencySymbol
|
||||
ld [hl], "¥"
|
||||
inc hl
|
||||
@ -54,24 +54,24 @@ PrintBCDDigit::
|
||||
and a
|
||||
jr z, .zeroDigit
|
||||
.nonzeroDigit
|
||||
bit 7, b ; have any non-space characters been printed?
|
||||
bit BIT_LEADING_ZEROES, b
|
||||
jr z, .outputDigit
|
||||
; if bit 7 is set, then no numbers have been printed yet
|
||||
bit 5, b ; print the currency symbol?
|
||||
bit BIT_MONEY_SIGN, b
|
||||
jr z, .skipCurrencySymbol
|
||||
ld [hl], "¥"
|
||||
inc hl
|
||||
res 5, b
|
||||
res BIT_MONEY_SIGN, b
|
||||
.skipCurrencySymbol
|
||||
res 7, b ; unset 7 to indicate that a nonzero digit has been reached
|
||||
res BIT_LEADING_ZEROES, b
|
||||
.outputDigit
|
||||
add "0"
|
||||
ld [hli], a
|
||||
jp PrintLetterDelay
|
||||
.zeroDigit
|
||||
bit 7, b ; either printing leading zeroes or already reached a nonzero digit?
|
||||
bit BIT_LEADING_ZEROES, b
|
||||
jr z, .outputDigit ; if so, print a zero digit
|
||||
bit 6, b ; left or right alignment?
|
||||
bit BIT_LEFT_ALIGN, b
|
||||
ret nz
|
||||
inc hl ; if right-aligned, "print" a space by advancing the pointer
|
||||
ret
|
||||
|
@ -4,7 +4,7 @@ ReloadMapSpriteTilePatterns::
|
||||
ld hl, wFontLoaded
|
||||
ld a, [hl]
|
||||
push af
|
||||
res 0, [hl]
|
||||
res BIT_FONT_LOADED, [hl]
|
||||
push hl
|
||||
xor a
|
||||
ld [wSpriteSetID], a
|
||||
|
@ -63,7 +63,7 @@ PlaceNextChar::
|
||||
jr nz, .NotNext
|
||||
ld bc, 2 * SCREEN_WIDTH
|
||||
ldh a, [hUILayoutFlags]
|
||||
bit 2, a
|
||||
bit BIT_SINGLE_SPACED_LINES, a
|
||||
jr z, .ok
|
||||
ld bc, SCREEN_WIDTH
|
||||
.ok
|
||||
|
@ -6,8 +6,8 @@ DisplayTextID::
|
||||
push af
|
||||
farcall DisplayTextIDInit ; initialization
|
||||
ld hl, wTextPredefFlag
|
||||
bit 0, [hl]
|
||||
res 0, [hl]
|
||||
bit BIT_TEXT_PREDEF, [hl]
|
||||
res BIT_TEXT_PREDEF, [hl]
|
||||
jr nz, .skipSwitchToMapBank
|
||||
ld a, [wCurMap]
|
||||
call SwitchToMapRomBank
|
||||
@ -128,7 +128,7 @@ CloseTextDisplay::
|
||||
ld [MBC1RomBank], a
|
||||
call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns)
|
||||
ld hl, wFontLoaded
|
||||
res 0, [hl]
|
||||
res BIT_FONT_LOADED, [hl]
|
||||
ld a, [wStatusFlags6]
|
||||
bit BIT_FLY_WARP, a
|
||||
call z, LoadPlayerSpriteGraphics
|
||||
|
@ -137,12 +137,12 @@ PlaceMenuCursor::
|
||||
jr z, .checkForArrow1
|
||||
push af
|
||||
ldh a, [hUILayoutFlags]
|
||||
bit 1, a ; is the menu double spaced?
|
||||
bit BIT_DOUBLE_SPACED_MENU, a
|
||||
jr z, .doubleSpaced1
|
||||
ld bc, 20
|
||||
ld bc, SCREEN_WIDTH
|
||||
jr .getOldMenuItemScreenPosition
|
||||
.doubleSpaced1
|
||||
ld bc, 40
|
||||
ld bc, SCREEN_WIDTH * 2
|
||||
.getOldMenuItemScreenPosition
|
||||
pop af
|
||||
.oldMenuItemLoop
|
||||
@ -163,12 +163,12 @@ PlaceMenuCursor::
|
||||
jr z, .checkForArrow2
|
||||
push af
|
||||
ldh a, [hUILayoutFlags]
|
||||
bit 1, a ; is the menu double spaced?
|
||||
bit BIT_DOUBLE_SPACED_MENU, a
|
||||
jr z, .doubleSpaced2
|
||||
ld bc, 20
|
||||
ld bc, SCREEN_WIDTH
|
||||
jr .getCurrentMenuItemScreenPosition
|
||||
.doubleSpaced2
|
||||
ld bc, 40
|
||||
ld bc, SCREEN_WIDTH * 2
|
||||
.getCurrentMenuItemScreenPosition
|
||||
pop af
|
||||
.currentMenuItemLoop
|
||||
@ -272,7 +272,7 @@ EnableAutoTextBoxDrawing::
|
||||
jr AutoTextBoxDrawingCommon
|
||||
|
||||
DisableAutoTextBoxDrawing::
|
||||
ld a, TRUE
|
||||
ld a, 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
|
||||
AutoTextBoxDrawingCommon::
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
|
@ -388,6 +388,7 @@ hClearLetterPrintingDelayFlags:: db
|
||||
|
||||
; bit 0: draw HP fraction to the right of bar instead of below (for party menu)
|
||||
; bit 1: menu is double spaced
|
||||
; bit 2: text is single spaced
|
||||
hUILayoutFlags:: db
|
||||
|
||||
hFieldMoveMonMenuTopMenuItemX:: db
|
||||
|
@ -1,5 +1,5 @@
|
||||
CeruleanBadgeHouse_Script:
|
||||
ld a, TRUE
|
||||
ld a, 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
dec a
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
|
@ -1,5 +1,5 @@
|
||||
Museum1F_Script:
|
||||
ld a, TRUE
|
||||
ld a, 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
xor a
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
|
@ -1,7 +1,7 @@
|
||||
OaksLab_Script:
|
||||
CheckEvent EVENT_PALLET_AFTER_GETTING_POKEBALLS_2
|
||||
call nz, OaksLabLoadTextPointers2Script
|
||||
ld a, TRUE
|
||||
ld a, 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
xor a
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
|
@ -1,6 +1,6 @@
|
||||
PewterMart_Script:
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, TRUE
|
||||
ld a, 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
ret
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
SSAnne2FRooms_Script:
|
||||
ld a, TRUE
|
||||
ld a, 1 << BIT_NO_AUTO_TEXT_BOX
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
xor a
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
|
Loading…
Reference in New Issue
Block a user