Skip to content

Commit 44f47b8

Browse files
Rangi42kqesar
authored andcommitted
Identify various flag labels and bit constants (pret#454)
(cherry picked from commit 8fafca7)
1 parent f5d7e4a commit 44f47b8

File tree

143 files changed

+1071
-1081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+1071
-1081
lines changed

audio/fade_audio.asm

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ FadeOutAudio::
22
ld a, [wAudioFadeOutControl]
33
and a ; currently fading out audio?
44
jr nz, .fadingOut
5-
ld a, [wd72c]
6-
bit 1, a
5+
ld a, [wStatusFlags2]
6+
bit BIT_NO_AUDIO_FADE_OUT, a
77
ret nz
88
ld a, $77
99
ldh [rNR50], a

constants/battle_constants.asm

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ DEF MOVE_ACC rb
3737
DEF MOVE_PP rb
3838
DEF MOVE_LENGTH EQU _RS
3939

40-
; D733 flags
41-
DEF BIT_TEST_BATTLE EQU 0
42-
4340
; battle type constants (wBattleType values)
4441
const_def
4542
const BATTLE_TYPE_NORMAL ; 0
@@ -78,7 +75,7 @@ DEF SPDSPCDV_TRAINER EQU $88
7875
; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags
7976
const_def
8077
const STORING_ENERGY ; 0 ; Bide
81-
const THRASHING_ABOUT ; 1 ; e.g. Thrash
78+
const THRASHING_ABOUT ; 1 ; Thrash, Petal Dance
8279
const ATTACKING_MULTIPLE_TIMES ; 2 ; e.g. Double Kick, Fury Attack
8380
const FLINCHED ; 3
8481
const CHARGING_UP ; 4 ; e.g. Solar Beam, Fly
@@ -95,11 +92,11 @@ DEF SPDSPCDV_TRAINER EQU $88
9592
const HAS_SUBSTITUTE_UP ; 4
9693
const NEEDS_TO_RECHARGE ; 5 ; Hyper Beam
9794
const USING_RAGE ; 6
98-
const SEEDED ; 7
95+
const SEEDED ; 7 ; Leech Seed
9996

10097
; wPlayerBattleStatus3 or wEnemyBattleStatus3 bit flags
10198
const_def
102-
const BADLY_POISONED ; 0
99+
const BADLY_POISONED ; 0 ; Toxic
103100
const HAS_LIGHT_SCREEN_UP ; 1
104101
const HAS_REFLECT_UP ; 2
105102
const TRANSFORMED ; 3

constants/input_constants.asm

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
; joypad buttons
22
const_def
3-
const BIT_A_BUTTON
4-
const BIT_B_BUTTON
5-
const BIT_SELECT
6-
const BIT_START
7-
const BIT_D_RIGHT
8-
const BIT_D_LEFT
9-
const BIT_D_UP
10-
const BIT_D_DOWN
3+
const BIT_A_BUTTON ; 0
4+
const BIT_B_BUTTON ; 1
5+
const BIT_SELECT ; 2
6+
const BIT_START ; 3
7+
const BIT_D_RIGHT ; 4
8+
const BIT_D_LEFT ; 5
9+
const BIT_D_UP ; 6
10+
const BIT_D_DOWN ; 7
1111

1212
DEF NO_INPUT EQU 0
1313
DEF A_BUTTON EQU 1 << BIT_A_BUTTON

constants/misc_constants.asm

-12
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,3 @@ DEF TRUE EQU 1
77
const FLAG_RESET ; 0
88
const FLAG_SET ; 1
99
const FLAG_TEST ; 2
10-
11-
; wOptions
12-
DEF TEXT_DELAY_FAST EQU %000 ; 0
13-
DEF TEXT_DELAY_MEDIUM EQU %001 ; 1
14-
DEF TEXT_DELAY_SLOW EQU %011 ; 3
15-
16-
const_def 6
17-
const BIT_BATTLE_SHIFT ; 6
18-
const BIT_BATTLE_ANIMATION ; 7
19-
20-
; wd732 flags
21-
DEF BIT_DEBUG_MODE EQU 1

constants/ram_constants.asm

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
; wMiscFlags
2+
const_def
3+
const BIT_SEEN_BY_TRAINER ; 0
4+
const BIT_BOULDER_DUST ; 1
5+
const BIT_TURNING ; 2
6+
const BIT_USING_GENERIC_PC ; 3
7+
const BIT_NO_SPRITE_UPDATES ; 4
8+
const BIT_NO_MENU_BUTTON_SOUND ; 5
9+
const BIT_TRIED_PUSH_BOULDER ; 6
10+
const BIT_PUSHED_BOULDER ; 7
11+
12+
; wOptions
13+
DEF TEXT_DELAY_MASK EQU %111
14+
const_def 6
15+
const BIT_BATTLE_SHIFT ; 6
16+
const BIT_BATTLE_ANIMATION ; 7
17+
18+
DEF TEXT_DELAY_FAST EQU %001 ; 1
19+
DEF TEXT_DELAY_MEDIUM EQU %011 ; 3
20+
DEF TEXT_DELAY_SLOW EQU %101 ; 5
21+
22+
; wLetterPrintingDelayFlags
23+
const_def
24+
const BIT_FAST_TEXT_DELAY ; 0
25+
const BIT_TEXT_DELAY ; 1
26+
27+
; wObtainedBadges, wBeatGymFlags
28+
const_def
29+
const BIT_BOULDERBADGE ; 0
30+
const BIT_CASCADEBADGE ; 1
31+
const BIT_THUNDERBADGE ; 2
32+
const BIT_RAINBOWBADGE ; 3
33+
const BIT_SOULBADGE ; 4
34+
const BIT_MARSHBADGE ; 5
35+
const BIT_VOLCANOBADGE ; 6
36+
const BIT_EARTHBADGE ; 7
37+
DEF NUM_BADGES EQU const_value
38+
39+
; wStatusFlags1
40+
const_def
41+
const BIT_STRENGTH_ACTIVE ; 0
42+
const BIT_SURF_ALLOWED ; 1
43+
const_skip ; 2 ; unused
44+
const BIT_GOT_OLD_ROD ; 3
45+
const BIT_GOT_GOOD_ROD ; 4
46+
const BIT_GOT_SUPER_ROD ; 5
47+
const BIT_GAVE_SAFFRON_GUARDS_DRINK ; 6
48+
const BIT_UNUSED_CARD_KEY ; 7
49+
50+
; wStatusFlags2
51+
const_def
52+
const BIT_WILD_ENCOUNTER_COOLDOWN ; 0
53+
const BIT_NO_AUDIO_FADE_OUT ; 1
54+
55+
; wStatusFlags3
56+
const_def
57+
const BIT_INIT_TRADE_CENTER_FACING ; 0
58+
const_skip 2 ; 1-2 ; unused
59+
const BIT_WARP_FROM_CUR_SCRIPT ; 3
60+
const BIT_ON_DUNGEON_WARP ; 4
61+
const BIT_NO_NPC_FACE_PLAYER ; 5
62+
const BIT_TALKED_TO_TRAINER ; 6
63+
const BIT_PRINT_END_BATTLE_TEXT ; 7
64+
65+
; wStatusFlags4
66+
const_def
67+
const BIT_GOT_LAPRAS ; 0
68+
const BIT_UNKNOWN_4_1 ; 1
69+
const BIT_USED_POKECENTER ; 2
70+
const BIT_GOT_STARTER ; 3
71+
const BIT_NO_BATTLES ; 4
72+
const BIT_BATTLE_OVER_OR_BLACKOUT ; 5
73+
const BIT_LINK_CONNECTED ; 6
74+
const BIT_INIT_SCRIPTED_MOVEMENT ; 7
75+
76+
; wStatusFlags5
77+
const_def
78+
const BIT_SCRIPTED_NPC_MOVEMENT ; 0
79+
const BIT_UNKNOWN_5_1 ; 1
80+
const BIT_UNKNOWN_5_2 ; 2
81+
const_skip ; 3 ; unused
82+
const BIT_UNKNOWN_5_4 ; 4
83+
const BIT_DISABLE_JOYPAD ; 5
84+
const BIT_NO_TEXT_DELAY ; 6
85+
const BIT_SCRIPTED_MOVEMENT_STATE ; 7
86+
87+
; wStatusFlags6
88+
const_def
89+
const BIT_GAME_TIMER_COUNTING ; 0
90+
const BIT_DEBUG_MODE ; 1
91+
const BIT_FLY_OR_DUNGEON_WARP ; 2
92+
const BIT_FLY_WARP ; 3
93+
const BIT_DUNGEON_WARP ; 4
94+
const BIT_ALWAYS_ON_BIKE ; 5
95+
const BIT_ESCAPE_WARP ; 6
96+
97+
; wStatusFlags7
98+
const_def
99+
const BIT_TEST_BATTLE ; 0
100+
const BIT_NO_MAP_MUSIC ; 1
101+
const BIT_FORCED_WARP ; 2
102+
const BIT_TRAINER_BATTLE ; 3
103+
const BIT_USE_CUR_MAP_SCRIPT ; 4
104+
const_skip 2 ; 5-6 ; unused
105+
const BIT_USED_FLY ; 7
106+
107+
; wElite4Flags
108+
const_def
109+
const BIT_UNUSED_BEAT_ELITE_4 ; 0
110+
const BIT_STARTED_ELITE_4 ; 1
111+
112+
; wMovementFlags
113+
const_def
114+
const BIT_STANDING_ON_DOOR ; 0
115+
const BIT_EXITING_DOOR ; 1
116+
const BIT_STANDING_ON_WARP ; 2
117+
const_skip 3 ; 3-5 ; unused
118+
const BIT_LEDGE_OR_FISHING ; 6
119+
const BIT_SPINNING ; 7

constants/script_constants.asm

-13
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,6 @@ DEF NUM_NPC_TRADES EQU const_value
3939
const TRADE_DIALOGSET_EVOLUTION
4040
const TRADE_DIALOGSET_HAPPY
4141

42-
; badges
43-
; wObtainedBadges and wBeatGymFlags bits
44-
const_def
45-
const BIT_BOULDERBADGE ; 0
46-
const BIT_CASCADEBADGE ; 1
47-
const BIT_THUNDERBADGE ; 2
48-
const BIT_RAINBOWBADGE ; 3
49-
const BIT_SOULBADGE ; 4
50-
const BIT_MARSHBADGE ; 5
51-
const BIT_VOLCANOBADGE ; 6
52-
const BIT_EARTHBADGE ; 7
53-
DEF NUM_BADGES EQU const_value
54-
5542
; OaksAideScript results
5643
DEF OAKS_AIDE_BAG_FULL EQU $00
5744
DEF OAKS_AIDE_GOT_ITEM EQU $01

data/predef_pointers.asm

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ PredefPointers::
101101
add_predef EnterMapAnim, $1E ; wrong bank
102102
add_predef GetTileTwoStepsInFrontOfPlayer
103103
add_predef CheckForCollisionWhenPushingBoulder
104-
add_predef PrintStrengthTxt
104+
add_predef PrintStrengthText
105105
add_predef PickUpItem
106106
add_predef PrintMoveType
107107
add_predef LoadMovePPs

data/text/text_2.asm

+2-2
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ _GrewLevelText::
12291229
text_ram wcd6d
12301230
text " grew"
12311231
line "to level @"
1232-
text_decimal wCurEnemyLVL, 1, 3
1232+
text_decimal wCurEnemyLevel, 1, 3
12331233
text "!@"
12341234
text_end
12351235

@@ -1435,7 +1435,7 @@ _RareCandyText::
14351435
text_ram wcd6d
14361436
text " grew"
14371437
line "to level @"
1438-
text_decimal wCurEnemyLVL, 1, 3
1438+
text_decimal wCurEnemyLevel, 1, 3
14391439
text "!@"
14401440
text_end
14411441

engine/battle/battle_transitions.asm

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ GetBattleTransitionID_CompareLevels:
105105
ld a, [hl]
106106
add $3
107107
ld e, a
108-
ld a, [wCurEnemyLVL]
108+
ld a, [wCurEnemyLevel]
109109
sub e
110110
jr nc, .highLevelEnemy
111111
res 1, c

engine/battle/core.asm

+18-18
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ FaintEnemyPokemon:
860860
; the player has exp all
861861
; now, set the gain exp flag for every party member
862862
; half of the total stat exp and normal exp will divided evenly amongst every party member
863-
ld a, $1
863+
ld a, TRUE
864864
ld [wBoostExpByExpAll], a
865865
ld a, [wPartyCount]
866866
ld b, 0
@@ -940,8 +940,8 @@ TrainerBattleVictory:
940940
cp RIVAL3 ; final battle against rival
941941
jr nz, .notrival
942942
ld b, MUSIC_DEFEATED_GYM_LEADER
943-
ld hl, wFlags_D733
944-
set 1, [hl]
943+
ld hl, wStatusFlags7
944+
set BIT_NO_MAP_MUSIC, [hl]
945945
.notrival
946946
ld a, [wLinkState]
947947
cp LINK_STATE_BATTLING
@@ -1173,9 +1173,9 @@ HandlePlayerBlackOut:
11731173
ld hl, LinkBattleLostText
11741174
.noLinkBattle
11751175
call PrintText
1176-
ld a, [wd732]
1177-
res 5, a
1178-
ld [wd732], a
1176+
ld a, [wStatusFlags6]
1177+
res BIT_ALWAYS_ON_BIKE, a
1178+
ld [wStatusFlags6], a
11791179
call ClearScreen
11801180
scf
11811181
ret
@@ -1195,10 +1195,10 @@ LinkBattleLostText:
11951195
; slides pic of fainted mon downwards until it disappears
11961196
; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing
11971197
SlideDownFaintedMonPic:
1198-
ld a, [wd730]
1198+
ld a, [wStatusFlags5]
11991199
push af
1200-
set 6, a
1201-
ld [wd730], a
1200+
set BIT_NO_TEXT_DELAY, a
1201+
ld [wStatusFlags5], a
12021202
ld b, 7 ; number of times to slide
12031203
.slideStepLoop ; each iteration, the mon is slid down one row
12041204
push bc
@@ -1237,7 +1237,7 @@ SlideDownFaintedMonPic:
12371237
dec b
12381238
jr nz, .slideStepLoop
12391239
pop af
1240-
ld [wd730], a
1240+
ld [wStatusFlags5], a
12411241
ret
12421242

12431243
SevenSpacesText:
@@ -1360,7 +1360,7 @@ EnemySendOutFirstMon:
13601360
ld bc, wEnemyMon2 - wEnemyMon1
13611361
call AddNTimes
13621362
ld a, [hl]
1363-
ld [wCurEnemyLVL], a
1363+
ld [wCurEnemyLevel], a
13641364
ld a, [wWhichPokemon]
13651365
inc a
13661366
ld hl, wEnemyPartyCount
@@ -2583,7 +2583,7 @@ MoveSelectionMenu:
25832583
cp LINK_STATE_BATTLING
25842584
jr z, .matchedkeyspicked
25852585
; Disable left, right, and START buttons in regular battles.
2586-
ld a, [wFlags_D733]
2586+
ld a, [wStatusFlags7]
25872587
bit BIT_TEST_BATTLE, a
25882588
ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
25892589
jr z, .matchedkeyspicked
@@ -2612,7 +2612,7 @@ SelectMenuItem:
26122612
jr .select
26132613
.battleselect
26142614
; Hide move swap cursor in TestBattle.
2615-
ld a, [wFlags_D733]
2615+
ld a, [wStatusFlags7]
26162616
bit BIT_TEST_BATTLE, a
26172617
; This causes PrintMenuItem to not run in TestBattle.
26182618
; MoveSelectionMenu still draws part of its window, an issue
@@ -4464,7 +4464,7 @@ GetEnemyMonStat:
44644464
ret
44654465
.notLinkBattle
44664466
ld a, [wEnemyMonLevel]
4467-
ld [wCurEnemyLVL], a
4467+
ld [wCurEnemyLevel], a
44684468
ld a, [wEnemyMonSpecies]
44694469
ld [wd0b5], a
44704470
call GetMonHeader
@@ -6152,7 +6152,7 @@ GetCurrentMove:
61526152
.player
61536153
ld de, wPlayerMoveNum
61546154
; Apply InitBattleVariables to TestBattle.
6155-
ld a, [wFlags_D733]
6155+
ld a, [wStatusFlags7]
61566156
bit BIT_TEST_BATTLE, a
61576157
ld a, [wTestBattlePlayerSelectedMove]
61586158
jr nz, .selected
@@ -6203,7 +6203,7 @@ LoadEnemyMonData:
62036203
ld [hli], a
62046204
ld [hl], b
62056205
ld de, wEnemyMonLevel
6206-
ld a, [wCurEnemyLVL]
6206+
ld a, [wCurEnemyLevel]
62076207
ld [de], a
62086208
inc de
62096209
ld b, $0
@@ -6843,7 +6843,7 @@ InitOpponent:
68436843
jr InitBattleCommon
68446844

68456845
DetermineWildOpponent:
6846-
ld a, [wd732]
6846+
ld a, [wStatusFlags6]
68476847
bit BIT_DEBUG_MODE, a
68486848
jr z, .notDebugMode
68496849
ldh a, [hJoyHeld]
@@ -6861,7 +6861,7 @@ InitBattleCommon:
68616861
ld hl, wLetterPrintingDelayFlags
68626862
ld a, [hl]
68636863
push af
6864-
res 1, [hl]
6864+
res BIT_TEXT_DELAY, [hl] ; no delay
68656865
callfar InitBattleVariables
68666866
ld a, [wEnemyMonSpecies2]
68676867
sub OPP_ID_OFFSET

0 commit comments

Comments
 (0)