summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/ai/scoring.asm6
-rw-r--r--engine/battle/effect_commands.asm4
-rw-r--r--engine/events/pokecenter_pc.asm102
-rw-r--r--engine/events/specials.asm6
-rw-r--r--engine/gfx/cgb_layouts.asm8
-rw-r--r--engine/gfx/color.asm25
-rw-r--r--engine/gfx/load_pics.asm50
-rw-r--r--engine/gfx/pic_animation.asm6
-rw-r--r--engine/gfx/sgb_layouts.asm12
-rw-r--r--engine/items/pack.asm6
-rw-r--r--engine/overworld/map_object_action.asm14
-rw-r--r--engine/overworld/map_objects.asm57
-rw-r--r--engine/overworld/movement.asm14
-rw-r--r--engine/overworld/npc_movement.asm49
-rw-r--r--engine/overworld/player_movement.asm4
-rw-r--r--engine/overworld/scripting.asm2
-rw-r--r--engine/pokemon/bills_pc_top.asm4
-rw-r--r--engine/pokemon/move_mon.asm10
18 files changed, 199 insertions, 180 deletions
diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm
index 7af2db8ad..567737c1f 100644
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -1055,7 +1055,7 @@ AI_Smart_TrapTarget: ; 38a71
jr nz, .asm_38a91
ld a, [wPlayerSubStatus1]
- and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE
+ and 1 << SUBSTATUS_IN_LOVE | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_IDENTIFIED | 1 << SUBSTATUS_NIGHTMARE
jr nz, .asm_38a91
; Else, 50% chance to greatly encourage this move if it's the player's Pokemon first turn.
@@ -1569,7 +1569,7 @@ AI_Smart_DefrostOpponent: ; 38ccb
; No move has EFFECT_DEFROST_OPPONENT, so this layer is unused.
ld a, [wEnemyMonStatus]
- and $20
+ and 1 << FRZ
ret z
dec [hl]
dec [hl]
@@ -1847,7 +1847,7 @@ AI_Smart_MeanLook: ; 38dfb
; 80% chance to greatly encourage this move if the player is either
; in love, identified, stuck in Rollout, or has a Nightmare.
ld a, [wPlayerSubStatus1]
- and 1<<SUBSTATUS_IN_LOVE | 1<<SUBSTATUS_ROLLOUT | 1<<SUBSTATUS_IDENTIFIED | 1<<SUBSTATUS_NIGHTMARE
+ and 1 << SUBSTATUS_IN_LOVE | 1 << SUBSTATUS_ROLLOUT | 1 << SUBSTATUS_IDENTIFIED | 1 << SUBSTATUS_NIGHTMARE
jr nz, .asm_38e26
; Otherwise, discourage this move unless the player only has not very effective moves against the enemy.
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index fad5b27a0..2723bba6b 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -64,7 +64,7 @@ DoMove: ; 3402c
inc hl
ld [de], a
inc de
- cp -1
+ cp endmove_command
jr nz, .GetMoveEffect
; Start at the first command.
@@ -364,7 +364,7 @@ CantMove: ; 341f0
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVarAddr
ld a, [hl]
- and $ff ^ (1<<SUBSTATUS_BIDE + 1<<SUBSTATUS_RAMPAGE + 1<<SUBSTATUS_CHARGED)
+ and $ff ^ (1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED)
ld [hl], a
call ResetFuryCutterCount
diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm
index 42284aeab..6e33d376c 100644
--- a/engine/events/pokecenter_pc.asm
+++ b/engine/events/pokecenter_pc.asm
@@ -39,12 +39,19 @@ PokemonCenterPC: ; 1559a
dw PlaceNthMenuStrings
dw .JumpTable
+PCPC_PLAYERS_PC EQU 0
+PCPC_BILLS_PC EQU 1
+PCPC_OAKS_PC EQU 2
+PCPC_HALL_OF_FAME EQU 3
+PCPC_TURN_OFF EQU 4
+
.JumpTable:
- dw PlayersPC, .String_PlayersPC
- dw BillsPC, .String_BillsPC
- dw OaksPC, .String_OaksPC
+; entries correspond to PCPC_* constants
+ dw PlayersPC, .String_PlayersPC
+ dw BillsPC, .String_BillsPC
+ dw OaksPC, .String_OaksPC
dw HallOfFamePC, .String_HallOfFame
- dw TurnOffPC, .String_TurnOff
+ dw TurnOffPC, .String_TurnOff
.String_PlayersPC: db "<PLAYER>'s PC@"
.String_BillsPC: db "BILL's PC@"
@@ -53,33 +60,42 @@ PokemonCenterPC: ; 1559a
.String_TurnOff: db "TURN OFF@"
.WhichPC:
- ; before pokedex
- db 3 ; items
- db 1, 0, 4 ; bill's, player's, turn off
- db -1
+ ; before Pokédex
+ db 3
+ db PCPC_BILLS_PC
+ db PCPC_PLAYERS_PC
+ db PCPC_TURN_OFF
+ db -1 ; end
; before Hall Of Fame
- db 4 ; items
- db 1, 0, 2, 4 ; bill's, player's, oak's, turn off
- db -1
+ db 4
+ db PCPC_BILLS_PC
+ db PCPC_PLAYERS_PC
+ db PCPC_OAKS_PC
+ db PCPC_TURN_OFF
+ db -1 ; end
; postgame
- db 5 ; items
- db 1, 0, 2, 3, 4 ; bill's, player's, oak's, hall of fame, turn off
- db -1
+ db 5
+ db PCPC_BILLS_PC
+ db PCPC_PLAYERS_PC
+ db PCPC_OAKS_PC
+ db PCPC_HALL_OF_FAME
+ db PCPC_TURN_OFF
+ db -1 ; end
.ChooseWhichPCListToUse:
call CheckReceivedDex
jr nz, .got_dex
- ld a, $0
+ ld a, 0 ; before Pokédex
ret
.got_dex
ld a, [wHallOfFameCount]
and a
- ld a, $1
+ ld a, 1 ; before Hall Of Fame
ret z
- ld a, $2
+ ld a, 2 ; postgame
ret
; 15650
@@ -244,7 +260,16 @@ PlayersPCMenuData: ; 0x15736
dw PlaceNthMenuStrings
dw .PlayersPCMenuPointers
+PLAYERSPC_WITHDRAW_ITEM EQU 0
+PLAYERSPC_DEPOSIT_ITEM EQU 1
+PLAYERSPC_TOSS_ITEM EQU 2
+PLAYERSPC_MAIL_BOX EQU 3
+PLAYERSPC_DECORATION EQU 4
+PLAYERSPC_TURN_OFF EQU 5
+PLAYERSPC_LOG_OFF EQU 6
+
.PlayersPCMenuPointers: ; 0x15746
+; entries correspond to PLAYERSPC_* constants
dw PlayerWithdrawItemMenu, .WithdrawItem
dw PlayerDepositItemMenu, .DepositItem
dw PlayerTossItemMenu, .TossItem
@@ -261,32 +286,24 @@ PlayersPCMenuData: ; 0x15736
.TurnOff: db "TURN OFF@"
.LogOff: db "LOG OFF@"
-WITHDRAW_ITEM EQU 0
-DEPOSIT_ITEM EQU 1
-TOSS_ITEM EQU 2
-MAIL_BOX EQU 3
-DECORATION EQU 4
-TURN_OFF EQU 5
-LOG_OFF EQU 6
-
.PlayersPCMenuList1:
db 5
- db WITHDRAW_ITEM
- db DEPOSIT_ITEM
- db TOSS_ITEM
- db MAIL_BOX
- db TURN_OFF
- db -1
+ db PLAYERSPC_WITHDRAW_ITEM
+ db PLAYERSPC_DEPOSIT_ITEM
+ db PLAYERSPC_TOSS_ITEM
+ db PLAYERSPC_MAIL_BOX
+ db PLAYERSPC_TURN_OFF
+ db -1 ; end
.PlayersPCMenuList2:
db 6
- db WITHDRAW_ITEM
- db DEPOSIT_ITEM
- db TOSS_ITEM
- db MAIL_BOX
- db DECORATION
- db LOG_OFF
- db -1
+ db PLAYERSPC_WITHDRAW_ITEM
+ db PLAYERSPC_DEPOSIT_ITEM
+ db PLAYERSPC_TOSS_ITEM
+ db PLAYERSPC_MAIL_BOX
+ db PLAYERSPC_DECORATION
+ db PLAYERSPC_LOG_OFF
+ db -1 ; end
PC_DisplayTextWaitMenu: ; 157bb
ld a, [wOptions]
@@ -461,13 +478,14 @@ PlayerDepositItemMenu: ; 0x1588b
ret
.dw
- dw .tossable
+; entries correspond to ITEMMENU_* constants
+ dw .tossable ; ITEMMENU_NOUSE
dw .no_toss
dw .no_toss
dw .no_toss
- dw .tossable
- dw .tossable
- dw .tossable
+ dw .tossable ; ITEMMENU_CURRENT
+ dw .tossable ; ITEMMENU_PARTY
+ dw .tossable ; ITEMMENU_CLOSE
.no_toss
ret
diff --git a/engine/events/specials.asm b/engine/events/specials.asm
index acfc3c450..533f59520 100644
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -95,13 +95,13 @@ NameRival: ; 0xc29d
farcall _NamingScreen
; default to "SILVER"
ld hl, wRivalName
- ld de, DefaultRivalName
+ ld de, .default
call InitName
ret
-; 0xc2b2
-DefaultRivalName: ; 0xc2b2
+.default
db "SILVER@"
+; 0xc2b9
NameRater: ; c2b9
farcall _NameRater
diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm
index b36dceeb6..6ab676cda 100644
--- a/engine/gfx/cgb_layouts.asm
+++ b/engine/gfx/cgb_layouts.asm
@@ -48,7 +48,7 @@ LoadSGBLayoutCGB: ; 8d59
dw _CGB_GSTitleScreen
dw _CGB0d
dw _CGB_MoveList
- dw _CGB0f
+ dw _CGB_BetaPikachuMinigame
dw _CGB_PokedexSearchOption
dw _CGB11
dw _CGB_Pokepic
@@ -532,7 +532,7 @@ _CGB_GSIntro: ; 9122
; 9195
_CGB11: ; 9195
- ld hl, Palettes_SCGB_11
+ ld hl, BetaPokerPals
ld de, wBGPals1
ld bc, 5 palettes
ld a, BANK(wBGPals1)
@@ -790,8 +790,8 @@ _CGB_MoveList: ; 9373
ret
; 93a6
-_CGB0f: ; 93a6
- ld hl, PalPacket_SCGB_0F + 1
+_CGB_BetaPikachuMinigame: ; 93a6
+ ld hl, PalPacket_BetaPikachuMinigame + 1
call CopyFourPalettes
call WipeAttrMap
call ApplyAttrMap
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index 6cf896ff4..d9b9b1dbc 100644
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -43,37 +43,36 @@ CheckShininess:
and a
ret
-Unused_CheckContestMon:
-; Check a mon's DVs at hl in the bug catching contest.
-; Return carry if its DVs are good enough to place in the contest.
+Unused_CheckShininess:
+; Return carry if the DVs at hl are all 10 or higher.
; Attack
ld a, [hl]
cp 10 << 4
- jr c, .Bad
+ jr c, .NotShiny
; Defense
ld a, [hli]
and $f
cp 10
- jr c, .Bad
+ jr c, .NotShiny
; Speed
ld a, [hl]
cp 10 << 4
- jr c, .Bad
+ jr c, .NotShiny
; Special
ld a, [hl]
and $f
cp 10
- jr c, .Bad
+ jr c, .NotShiny
-.Good:
+.Shiny:
scf
ret
-.Bad:
+.NotShiny:
and a
ret
@@ -182,12 +181,12 @@ Unreferenced_Function8b4d:
ld a, [hSGB]
and a
ret z
- ld hl, PalPacket_Function8b4d
+ ld hl, PalPacket_BetaIntroVenusaur
jp PushSGBPals_
.cgb
ld de, wOBPals1
- ld a, PREDEFPAL_3B
+ ld a, PREDEFPAL_BETA_INTRO_VENUSAUR
call GetPredefPal
jp LoadHLPaletteIntoDE
@@ -1349,8 +1348,8 @@ INCLUDE "gfx/pokegear/pokegear.pal"
FemalePokegearPals:
INCLUDE "gfx/pokegear/pokegear_f.pal"
-Palettes_SCGB_11:
-INCLUDE "gfx/unknown/b789.pal"
+BetaPokerPals:
+INCLUDE "gfx/beta_poker/beta_poker.pal"
SlotMachinePals:
INCLUDE "gfx/slots/slots.pal"
diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm
index b533ee56b..9c909a5cd 100644
--- a/engine/gfx/load_pics.asm
+++ b/engine/gfx/load_pics.asm
@@ -252,7 +252,7 @@ GLOBAL PICS_FIX
push hl
push bc
- sub BANK(Pics_1) - PICS_FIX
+ sub BANK("Pics 1") - PICS_FIX
ld c, a
ld b, 0
ld hl, .PicsBanks
@@ -263,30 +263,30 @@ GLOBAL PICS_FIX
ret
.PicsBanks: ; 511d4
- db BANK(Pics_1) + 0
- db BANK(Pics_1) + 1
- db BANK(Pics_1) + 2
- db BANK(Pics_1) + 3
- db BANK(Pics_1) + 4
- db BANK(Pics_1) + 5
- db BANK(Pics_1) + 6
- db BANK(Pics_1) + 7
- db BANK(Pics_1) + 8
- db BANK(Pics_1) + 9
- db BANK(Pics_1) + 10
- db BANK(Pics_1) + 11
- db BANK(Pics_1) + 12
- db BANK(Pics_1) + 13
- db BANK(Pics_1) + 14
- db BANK(Pics_1) + 15
- db BANK(Pics_1) + 16
- db BANK(Pics_1) + 17
- db BANK(Pics_1) + 18
- db BANK(Pics_1) + 19
- db BANK(Pics_1) + 20
- db BANK(Pics_1) + 21
- db BANK(Pics_1) + 22
- db BANK(Pics_1) + 23
+ db BANK("Pics 1") ; BANK("Pics 1") + 0
+ db BANK("Pics 2") ; BANK("Pics 1") + 1
+ db BANK("Pics 3") ; BANK("Pics 1") + 2
+ db BANK("Pics 4") ; BANK("Pics 1") + 3
+ db BANK("Pics 5") ; BANK("Pics 1") + 4
+ db BANK("Pics 6") ; BANK("Pics 1") + 5
+ db BANK("Pics 7") ; BANK("Pics 1") + 6
+ db BANK("Pics 8") ; BANK("Pics 1") + 7
+ db BANK("Pics 9") ; BANK("Pics 1") + 8
+ db BANK("Pics 10") ; BANK("Pics 1") + 9
+ db BANK("Pics 11") ; BANK("Pics 1") + 10
+ db BANK("Pics 12") ; BANK("Pics 1") + 11
+ db BANK("Pics 13") ; BANK("Pics 1") + 12
+ db BANK("Pics 14") ; BANK("Pics 1") + 13
+ db BANK("Pics 15") ; BANK("Pics 1") + 14
+ db BANK("Pics 16") ; BANK("Pics 1") + 15
+ db BANK("Pics 17") ; BANK("Pics 1") + 16
+ db BANK("Pics 18") ; BANK("Pics 1") + 17
+ db BANK("Pics 19") ; BANK("Pics 1") + 18
+ db BANK("Pics 20") ; BANK("Pics 1") + 19
+ db BANK("Pics 21") ; BANK("Pics 1") + 20
+ db BANK("Pics 22") ; BANK("Pics 1") + 21
+ db BANK("Pics 23") ; BANK("Pics 1") + 22
+ db BANK("Pics 24") ; BANK("Pics 1") + 23
Function511ec: ; 511ec
ld a, c
diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm
index 54999a6bb..925296388 100644
--- a/engine/gfx/pic_animation.asm
+++ b/engine/gfx/pic_animation.asm
@@ -399,11 +399,11 @@ PokeAnim_DoAnimScript: ; d0250
.RunAnim: ; d0261
call PokeAnim_GetPointer
ld a, [wPokeAnimCommand]
- cp -1
+ cp endanim_command
jr z, PokeAnim_End
- cp -2
+ cp setrepeat_command
jr z, .SetRepeat
- cp -3
+ cp dorepeat_command
jr z, .DoRepeat
call PokeAnim_GetFrame
ld a, [wPokeAnimParameter]
diff --git a/engine/gfx/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm
index 24bdc952e..d53be908f 100644
--- a/engine/gfx/sgb_layouts.asm
+++ b/engine/gfx/sgb_layouts.asm
@@ -38,9 +38,9 @@ LoadSGBLayout: ; 864c
dw .SGB_GSTitleScreen
dw .SGB0d
dw .SGB_MoveList
- dw .SGB0f
+ dw .SGB_BetaPikachuMinigame
dw .SGB_PokedexSearchOption
- dw .SGB11
+ dw .SGB_BetaPoker
dw .SGB12
dw .SGB13
dw .SGB_PackPals
@@ -346,18 +346,18 @@ endr
ret
; 8897
-.SGB0f: ; 8897
- ld hl, PalPacket_SCGB_0F
+.SGB_BetaPikachuMinigame: ; 8897
+ ld hl, PalPacket_BetaPikachuMinigame
ld de, BlkPacket_9a86
ret
; 889e
-.SGB11: ; 889e
+.SGB_BetaPoker: ; 889e
ld hl, BlkPacket_9a86
ld de, wPlayerLightScreenCount ; ???
ld bc, PALPACKET_LENGTH
call CopyBytes
- ld hl, PalPacket_SCGB_11
+ ld hl, PalPacket_BetaPoker
ld de, BlkPacket_9a86
ret
; 88b1
diff --git a/engine/items/pack.asm b/engine/items/pack.asm
index ea3a051ac..9f0e82f66 100644
--- a/engine/items/pack.asm
+++ b/engine/items/pack.asm
@@ -571,11 +571,11 @@ RegisterItem: ; 103c2
ld a, [wCurrPocket]
rrca
rrca
- and $c0
+ and REGISTERED_POCKET
ld b, a
ld a, [wCurItemQuantity]
inc a
- and $3f
+ and REGISTERED_NUMBER
or b
ld [wWhichRegisteredItem], a
ld a, [wCurItem]
@@ -1283,7 +1283,7 @@ DrawPackGFX: ; 1089d
ld a, [wCurrPocket]
maskbits NUM_POCKETS
ld e, a
- ld d, $0
+ ld d, 0
ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jr z, .male_dude
diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm
index c82cd80a2..8c897d25a 100644
--- a/engine/overworld/map_object_action.asm
+++ b/engine/overworld/map_object_action.asm
@@ -47,7 +47,7 @@ SetFacingStandAction: ; 44b5
SetFacingStepAction: ; 44c1
ld hl, OBJECT_FLAGS1
add hl, bc
- bit SLIDING, [hl]
+ bit SLIDING_F, [hl]
jp nz, SetFacingCurrent
ld hl, OBJECT_STEP_FRAME
@@ -59,7 +59,7 @@ SetFacingStepAction: ; 44c1
rrca
rrca
- and %00000011
+ maskbits NUM_DIRECTIONS
ld d, a
call GetSpriteDirection
@@ -74,7 +74,7 @@ SetFacingStepAction: ; 44c1
SetFacingSkyfall: ; 44e4
ld hl, OBJECT_FLAGS1
add hl, bc
- bit SLIDING, [hl]
+ bit SLIDING_F, [hl]
jp nz, SetFacingCurrent
ld hl, OBJECT_STEP_FRAME
@@ -86,7 +86,7 @@ SetFacingSkyfall: ; 44e4
rrca
rrca
- and %00000011
+ maskbits NUM_DIRECTIONS
ld d, a
call GetSpriteDirection
@@ -101,7 +101,7 @@ SetFacingSkyfall: ; 44e4
SetFacingBumpAction: ; 4508
ld hl, OBJECT_FLAGS1
add hl, bc
- bit SLIDING, [hl]
+ bit SLIDING_F, [hl]
jp nz, SetFacingCurrent
ld hl, OBJECT_STEP_FRAME
@@ -112,7 +112,7 @@ SetFacingBumpAction: ; 4508
rrca
rrca
rrca
- and %00000011
+ maskbits NUM_DIRECTIONS
ld d, a
call GetSpriteDirection
@@ -245,7 +245,7 @@ SetFacingWeirdTree: ; 45ab
ld a, [hl]
inc a
ld [hl], a
- and %00001100
+ maskbits NUM_DIRECTIONS, 2
rrca
rrca
add FACING_WEIRD_TREE_0
diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm
index 1573a27b5..7ed1d5f5f 100644
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -93,7 +93,7 @@ Function437b: ; 437b
.ok2
ld hl, OBJECT_FLAGS1
add hl, bc
- bit 1, [hl]
+ bit WONT_DELETE_F, [hl]
jr nz, .yes2
call DeleteMapObject
scf
@@ -146,7 +146,7 @@ Function437b: ; 437b
.HandleObjectAction:
ld hl, OBJECT_FLAGS1
add hl, bc
- bit INVISIBLE, [hl]
+ bit INVISIBLE_F, [hl]
jr nz, SetFacingStanding
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -161,7 +161,7 @@ Function437b: ; 437b
Function4440: ; 4440
ld hl, OBJECT_FLAGS1
add hl, bc
- bit INVISIBLE, [hl]
+ bit INVISIBLE_F, [hl]
jr nz, SetFacingStanding
asm_4448:
ld de, ObjectActionPairPointers + 2 ; use second column
@@ -233,7 +233,7 @@ Function462a: ; 462a
UpdateTallGrassFlags: ; 463f
ld hl, OBJECT_FLAGS2
add hl, bc
- bit OVERHEAD, [hl]
+ bit OVERHEAD_F, [hl]
jr z, .ok
ld hl, OBJECT_NEXT_TILE
add hl, bc
@@ -260,13 +260,13 @@ SetTallGrassFlags: ; 4661
.set
ld hl, OBJECT_FLAGS2
add hl, bc
- set OVERHEAD, [hl]
+ set OVERHEAD_F, [hl]
ret
.reset
ld hl, OBJECT_FLAGS2
add hl, bc
- res OVERHEAD, [hl]
+ res OVERHEAD_F, [hl]
ret
; 4679
@@ -298,7 +298,7 @@ InitStep: ; 4690
ld [hl], a
ld hl, OBJECT_FLAGS1
add hl, bc
- bit FIXED_FACING, [hl]
+ bit FIXED_FACING_F, [hl]
jr nz, GetNextTile
add a
add a
@@ -696,7 +696,7 @@ MapObjectMovementPattern: ; 47dd
and %00000011
or 0
call InitStep
- call Function6ec1
+ call CanObjectMoveInDirection
jr c, .ok2
ld de, SFX_STRENGTH
call PlaySFX
@@ -1049,7 +1049,7 @@ MapObjectMovementPattern: ; 47dd
.RandomWalkContinue:
call InitStep
- call Function6ec1 ; check whether the object can move in that direction
+ call CanObjectMoveInDirection ; check whether the object can move in that direction
jr c, .NewDuration
call UpdateTallGrassFlags
ld hl, OBJECT_ACTION
@@ -2116,13 +2116,13 @@ SpawnEmote: ; 5547
ShakeGrass: ; 5556
push bc
- ld de, .data_5562
+ ld de, .GrassObject
call CopyTempObjectData
call InitTempObject
pop bc
ret
-.data_5562
+.GrassObject
db $00, PAL_OW_TREE, SPRITEMOVEDATA_GRASS
; 5565
@@ -2140,6 +2140,7 @@ ShakeScreen: ; 5565
.ScreenShakeObject:
db $00, PAL_OW_SILVER, SPRITEMOVEDATA_SCREENSHAKE
; 5579
+
DespawnEmote: ; 5579
push bc
ld a, [hMapObjectIndexBuffer]
@@ -2155,7 +2156,7 @@ DespawnEmote: ; 5579
push af
ld hl, OBJECT_FLAGS1
add hl, de
- bit EMOTE_OBJECT, [hl]
+ bit EMOTE_OBJECT_F, [hl]
jr z, .next
ld hl, OBJECT_SPRITE
add hl, de
@@ -2444,7 +2445,7 @@ Function56cd: ; 56cd
ld [hUsedSpriteTile], a
ld hl, OBJECT_PALETTE
add hl, bc
- bit 7, [hl]
+ bit BIG_OBJECT_F, [hl]
jr z, .ok7
ld a, d
add 2
@@ -2574,7 +2575,7 @@ ContinueSpawnFacing: ; 57db
_SetPlayerPalette: ; 57e2
ld a, d
- and %10000000
+ and 1 << 7
ret z
ld bc, 0 ; debug?
ld hl, OBJECT_FACING
@@ -2584,13 +2585,13 @@ _SetPlayerPalette: ; 57e2
ld [hl], a
ld a, d
swap a
- and %00000111
+ and PALETTE_MASK
ld d, a
ld bc, wPlayerStruct
ld hl, OBJECT_PALETTE
add hl, bc
ld a, [hl]
- and %11111000
+ and $ff ^ PALETTE_MASK
or d
ld [hl], a
ret
@@ -2918,10 +2919,10 @@ InitSprites: ; 5991
ld e, PRIORITY_LOW
ld hl, OBJECT_FLAGS2
add hl, bc
- bit LOW_PRIORITY, [hl]
+ bit LOW_PRIORITY_F, [hl]
jr nz, .add
ld e, PRIORITY_NORM
- bit HIGH_PRIORITY, [hl]
+ bit HIGH_PRIORITY_F, [hl]
jr z, .add
ld e, PRIORITY_HIGH
jr .add
@@ -2973,35 +2974,35 @@ InitSprites: ; 5991
ld hl, OBJECT_SPRITE_TILE
add hl, bc
ld a, [hl]
- and %01111111
+ and $ff ^ (1 << 7)
ld [hFFC1], a
xor a
bit 7, [hl]
jr nz, .skip1
- or %00001000
+ or VRAM_BANK_1
.skip1
ld hl, OBJECT_FLAGS2
add hl, bc
ld e, [hl]
bit 7, e
jr z, .skip2
- or %10000000
+ or PRIORITY
.skip2
- bit 4, e
+ bit USE_OBP1_F, e
jr z, .skip3
- or %00010000
+ or OBP_NUM
.skip3
ld hl, OBJECT_PALETTE
add hl, bc
ld d, a
ld a, [hl]
- and %00000111
+ and PALETTE_MASK
or d
ld d, a
xor a
- bit 3, e
+ bit OVERHEAD_F, e
jr z, .skip4
- or %10000000
+ or PRIORITY
.skip4
ld [hFFC2], a
ld hl, OBJECT_SPRITE_X
@@ -3063,7 +3064,7 @@ InitSprites: ; 5991
ld e, [hl]
inc hl
ld a, [hFFC1]
- bit 2, e
+ bit ABSOLUTE_TILE_ID_F, e
jr z, .nope1
xor a
.nope1
@@ -3072,7 +3073,7 @@ InitSprites: ; 5991
ld [bc], a ; tile id
inc c
ld a, e
- bit 1, a
+ bit RELATIVE_ATTRIBUTES_F, a
jr z, .nope2
ld a, [hFFC2]
or e
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm
index 3dbb0b83a..fcb8d55fb 100644
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -377,42 +377,42 @@ Movement_tree_shake: ; 5279
Movement_remove_sliding: ; 5293
ld hl, OBJECT_FLAGS1
add hl, bc
- res SLIDING, [hl]
+ res SLIDING_F, [hl]
jp ContinueReadingMovement
; 529c
Movement_set_sliding: ; 529c
ld hl, OBJECT_FLAGS1
add hl, bc
- set SLIDING, [hl]
+ set SLIDING_F, [hl]
jp ContinueReadingMovement
; 52a5
Movement_remove_fixed_facing: ; 52a5
ld hl, OBJECT_FLAGS1
add hl, bc
- res FIXED_FACING, [hl]
+ res FIXED_FACING_F, [hl]
jp ContinueReadingMovement
; 52ae
Movement_fix_facing: ; 52ae
ld hl, OBJECT_FLAGS1
add hl, bc
- set FIXED_FACING, [hl]
+ set FIXED_FACING_F, [hl]
jp ContinueReadingMovement
; 52b7
Movement_show_object: ; 52b7
ld hl, OBJECT_FLAGS1
add hl, bc
- res INVISIBLE, [hl]
+ res INVISIBLE_F, [hl]
jp ContinueReadingMovement
; 52c0
Movement_hide_object: ; 52c0
ld hl, OBJECT_FLAGS1
add hl, bc
- set INVISIBLE, [hl]
+ set INVISIBLE_F, [hl]
jp ContinueReadingMovement
; 52c9
@@ -838,7 +838,7 @@ JumpStep: ; 548a
ld hl, OBJECT_FLAGS2
add hl, bc
- res OVERHEAD, [hl]
+ res OVERHEAD_F, [hl]
ld hl, OBJECT_ACTION
add hl, bc
diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm
index 5670935e8..40ced1a5f 100644
--- a/engine/overworld/npc_movement.asm
+++ b/engine/overworld/npc_movement.asm
@@ -1,37 +1,38 @@
-Function6ec1: ; 6ec1
+CanObjectMoveInDirection: ; 6ec1
ld hl, OBJECT_PALETTE
add hl, bc
- bit 5, [hl]
- jr z, .not_bit_5
+ bit SWIMMING_F, [hl]
+ jr z, .not_swimming
ld hl, OBJECT_FLAGS1
add hl, bc
- bit 4, [hl] ; lost, uncomment next line to fix
-; jr nz, .resume
+ bit NOCLIP_TILES_F, [hl] ; lost, uncomment next line to fix
+ ; jr nz, .noclip_tiles
push hl
push bc
- call Function6f2c
+ call WillObjectBumpIntoLand
pop bc
pop hl
ret c
- jr .resume
+ jr .continue
-.not_bit_5
+.not_swimming
ld hl, OBJECT_FLAGS1
add hl, bc
- bit 4, [hl]
- jr nz, .resume
+ bit NOCLIP_TILES_F, [hl]
+ jr nz, .noclip_tiles
push hl
push bc
- call Function6f07
+ call WillObjectBumpIntoWater
pop bc
pop hl
ret c
-.resume
- bit 6, [hl]
- jr nz, .bit_6
+.noclip_tiles
+.continue
+ bit NOCLIP_OBJS_F, [hl]
+ jr nz, .noclip_objs
push hl
push bc
@@ -40,9 +41,9 @@ Function6ec1: ; 6ec1
pop hl
ret c
-.bit_6
- bit 5, [hl]
- jr nz, .bit_5
+.noclip_objs
+ bit MOVE_ANYWHERE_F, [hl]
+ jr nz, .move_anywhere
push hl
call HasObjectReachedMovementLimit
pop hl
@@ -53,13 +54,13 @@ Function6ec1: ; 6ec1
pop hl
ret c
-.bit_5
+.move_anywhere
and a
ret
; 6f07
-Function6f07: ; 6f07
+WillObjectBumpIntoWater: ; 6f07
call Function6f5f
ret c
ld hl, OBJECT_NEXT_MAP_X
@@ -78,12 +79,12 @@ Function6f07: ; 6f07
ld d, a
call GetTileCollision
and a ; LANDTILE
- jr z, Function6f3e
+ jr z, WillObjectBumpIntoTile
scf
ret
; 6f2c
-Function6f2c: ; 6f2c
+WillObjectBumpIntoLand: ; 6f2c
call Function6f5f
ret c
ld hl, OBJECT_NEXT_TILE
@@ -91,12 +92,12 @@ Function6f2c: ; 6f2c
ld a, [hl]
call GetTileCollision
cp WATERTILE
- jr z, Function6f3e
+ jr z, WillObjectBumpIntoTile
scf
ret
; 6f3e
-Function6f3e: ; 6f3e
+WillObjectBumpIntoTile: ; 6f3e
ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
@@ -331,7 +332,7 @@ IsNPCAtCoord: ; 7041
ld hl, OBJECT_PALETTE
add hl, bc
- bit 7, [hl]
+ bit BIG_OBJECT_F, [hl]
jr z, .got
call Function7171
diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm
index ef9afc7ad..f8bbe4952 100644
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -684,7 +684,7 @@ DoPlayerMovement:: ; 80000
ld hl, OBJECT_PALETTE
add hl, bc
- bit 6, [hl]
+ bit STRENGTH_BOULDER_F, [hl]
jr z, .not_boulder
ld hl, OBJECT_FLAGS2
@@ -696,7 +696,7 @@ DoPlayerMovement:: ; 80000
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
- and $fc
+ and %11111100
or d
ld [hl], a
diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm
index a18be2e6c..a2315a541 100644
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -1071,7 +1071,7 @@ ApplyObjectFacing:
jr c, .not_visible ; STILL_SPRITE
ld hl, OBJECT_FLAGS1
add hl, bc
- bit FIXED_FACING, [hl]
+ bit FIXED_FACING_F, [hl]
jr nz, .not_visible
pop de
ld a, e
diff --git a/engine/pokemon/bills_pc_top.asm b/engine/pokemon/bills_pc_top.asm
index 1e808c02c..e25381e29 100644
--- a/engine/pokemon/bills_pc_top.asm
+++ b/engine/pokemon/bills_pc_top.asm
@@ -96,9 +96,9 @@ _BillsPC: ; e3fd
dw BillsPC_SeeYa
.items ; e4c4
- db 5
+ db 5 ; # items
db 0 ; WITHDRAW
- db 1; DEPOSIT
+ db 1 ; DEPOSIT
db 2 ; CHANGE BOX
db 3 ; MOVE PKMN
db 4 ; SEE YA!
diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm
index 630479797..2074e537f 100644
--- a/engine/pokemon/move_mon.asm
+++ b/engine/pokemon/move_mon.asm
@@ -1497,29 +1497,29 @@ CalcMonStatC: ; e17b
jr z, .Special
cp STAT_SDEF
jr z, .Special
-; DV_HP = (DV_ATK & 1) << 3 + (DV_DEF & 1) << 2 + (DV_SPD & 1) << 1 + (DV_SPC & 1)
+; DV_HP = (DV_ATK & 1) << 3 | (DV_DEF & 1) << 2 | (DV_SPD & 1) << 1 | (DV_SPC & 1)
push bc
ld a, [hl]
swap a
- and $1
+ and 1
add a
add a
add a
ld b, a
ld a, [hli]
- and $1
+ and 1
add a
add a
add b
ld b, a
ld a, [hl]
swap a
- and $1
+ and 1
add a
add b
ld b, a
ld a, [hl]
- and $1
+ and 1
add b
pop bc
jr .GotDV