Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constants/audio_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ DEF HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff)
const REG_FREQUENCY_LO ; 3

; wChannelFlags1 constants
const_def
bit_const_def
const BIT_PERFECT_PITCH ; 0 ; controlled by toggle_perfect_pitch command
const BIT_SOUND_CALL ; 1 ; if in sound call
const BIT_NOISE_OR_SFX ; 2 ; if channel is the music noise channel or an SFX channel
Expand Down
2 changes: 1 addition & 1 deletion constants/event_constants.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; wEventFlags bit flags

; Pallet Town events
const_def
word_const_def
const EVENT_FOLLOWED_OAK_INTO_LAB
const_skip 2
const EVENT_HALL_OF_FAME_DEX_RATING
Expand Down
2 changes: 1 addition & 1 deletion constants/item_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; - TechnicalMachinePrices (see data/items/tm_prices.asm)
; - KeyItemFlags (see data/items/key_items.asm)
; - ItemUsePtrTable (see engine/items/item_effects.asm)
const_def
listable_const_def
const NO_ITEM ; $00
const MASTER_BALL ; $01
const ULTRA_BALL ; $02
Expand Down
4 changes: 1 addition & 3 deletions constants/map_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ENDM
; - WildDataPointers (see data/wild/grass_water.asm)
; Each map also has associated data in maps.asm.
; Order: towns/cities, then routes, then indoor/dungeon maps
const_def
listable_const_def
map_const PALLET_TOWN, 10, 9 ; $00
map_const VIRIDIAN_CITY, 20, 18 ; $01
map_const PEWTER_CITY, 20, 18 ; $02
Expand Down Expand Up @@ -401,5 +401,3 @@ DEF NUM_MAPS EQU const_value
; Indoor maps, such as houses, use this as the Map ID in their exit warps
; This map ID takes the player back to the last outdoor map they were on, stored in wLastMap
DEF LAST_MAP EQU $ff

ASSERT NUM_MAPS <= LAST_MAP, "map IDs overlap LAST_MAP"
19 changes: 7 additions & 12 deletions constants/map_data_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
; height of north/south connections
DEF MAP_BORDER EQU 3

; connection directions
const_def
const EAST_F
const WEST_F
const SOUTH_F
const NORTH_F
; wCurMapConnections : \1
; connection directions : BIT_\1
bit_const_def
shift_const EAST ; $01 (BIT_EAST ; 0)
shift_const WEST ; $02 (BIT_WEST ; 1)
shift_const SOUTH ; $04 (BIT_SOUTH ; 2)
shift_const NORTH ; $08 (BIT_NORTH ; 4)

; wCurMapConnections
const_def
shift_const EAST ; 1
shift_const WEST ; 2
shift_const SOUTH ; 4
shift_const NORTH ; 8

; wWarpEntries
DEF MAX_WARP_EVENTS EQU 32
Expand Down
2 changes: 1 addition & 1 deletion constants/menu_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ DEF BAG_ITEM_CAPACITY EQU 20
DEF PC_ITEM_CAPACITY EQU 50

; text box IDs
const_def 1
listable_const_def 1
const MESSAGE_BOX ; $01
const_skip ; $02
const MENU_TEMPLATE_03 ; $03 unused
Expand Down
5 changes: 3 additions & 2 deletions constants/move_animation_constants.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
; special effects that are part of move animations
; SpecialEffectPointers associates them with effect routines (see data/battle_anims/special_effect_pointers.asm)
const_def $C0
listable_const_def $C0
DEF SUBANIM_CONST_LIMIT EQU const_value - 1
DEF FIRST_SE_ID EQU const_value
const_skip $18
const SE_WAVY_SCREEN ; $D8 used in Psywave/Night Shade/Psychic etc.
Expand Down Expand Up @@ -48,7 +49,7 @@ DEF FIRST_SE_ID EQU const_value

; The 0 or 1 in the name of a subanim indicates whether to use tileset 0 or 1 data/moves/animations.asm.
; "Both" indicates either can be used for different images using the same animation.
const_def
max_const_def SUBANIM_CONST_LIMIT
const SUBANIM_0_STAR
const SUBANIM_0_STAR_TWICE
const SUBANIM_0_STAR_THRICE
Expand Down
2 changes: 1 addition & 1 deletion constants/move_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
; - MoveNames (see data/moves/names.asm)
; - AttackAnimationPointers (see data/moves/animations.asm)
; - MoveSoundTable (see data/moves/sfx.asm)
const_def
listable_const_def
const NO_MOVE ; 00
const POUND ; 01
const KARATE_CHOP ; 02
Expand Down
2 changes: 1 addition & 1 deletion constants/move_effect_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; {status condition}_EFFECT means that the move causes the status condition every time it hits the target

; MoveEffectPointerTable indexes (see data/moves/effects_pointers.asm)
const_def
listable_const_def
const NO_ADDITIONAL_EFFECT ; $00
const EFFECT_01 ; $01 unused
const POISON_SIDE_EFFECT1 ; $02
Expand Down
4 changes: 3 additions & 1 deletion constants/pokemon_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
; - CryData (see data/pokemon/cries.asm)
; - PokedexOrder (see data/pokemon/dex_order.asm)
; - PokedexEntryPointers (see data/pokemon/dex_entries.asm)
const_def
max_const_def OPP_ID_OFFSET - 1
; Pokemons and trainers share ID values.
; Note : even without this limitation, they would be limited to $FD.
const NO_MON ; $00
const RHYDON ; $01
const KANGASKHAN ; $02
Expand Down
36 changes: 15 additions & 21 deletions constants/sprite_data_constants.asm
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
; sprite facing directions
const_def 0, $04
const SPRITE_FACING_DOWN ; $00
const SPRITE_FACING_UP ; $04
const SPRITE_FACING_LEFT ; $08
const SPRITE_FACING_RIGHT ; $0C
MACRO sprite_facing_const
const \1
DEF \2 EQU \1 << 4
ENDM

const_def 0, $40
const NPC_MOVEMENT_DOWN ; $00
const NPC_MOVEMENT_UP ; $40
const NPC_MOVEMENT_LEFT ; $80
const NPC_MOVEMENT_RIGHT ; $C0
; sprite facing directions
nybble_const_def 0, $4
sprite_facing_const SPRITE_FACING_DOWN, NPC_MOVEMENT_DOWN ; $00, $00
sprite_facing_const SPRITE_FACING_UP, NPC_MOVEMENT_UP ; $04, $40
sprite_facing_const SPRITE_FACING_LEFT, NPC_MOVEMENT_LEFT ; $08, $80
sprite_facing_const SPRITE_FACING_RIGHT, NPC_MOVEMENT_RIGHT ; $0C, $C0

DEF NPC_CHANGE_FACING EQU $E0

; player direction constants
const_def
const PLAYER_DIR_BIT_RIGHT ; 0
const PLAYER_DIR_BIT_LEFT ; 1
const PLAYER_DIR_BIT_DOWN ; 2
const PLAYER_DIR_BIT_UP ; 3

DEF PLAYER_DIR_RIGHT EQU 1 << PLAYER_DIR_BIT_RIGHT
DEF PLAYER_DIR_LEFT EQU 1 << PLAYER_DIR_BIT_LEFT
DEF PLAYER_DIR_DOWN EQU 1 << PLAYER_DIR_BIT_DOWN
DEF PLAYER_DIR_UP EQU 1 << PLAYER_DIR_BIT_UP
bit_const_def
shift_const PLAYER_DIR_RIGHT ; $01 (BIT_PLAYER_DIR_RIGHT ; 0)
shift_const PLAYER_DIR_LEFT ; $02 (BIT_PLAYER_DIR_LEFT ; 1)
shift_const PLAYER_DIR_DOWN ; $04 (BIT_PLAYER_DIR_DOWN ; 2)
shift_const PLAYER_DIR_UP ; $08 (BIT_PLAYER_DIR_UP ; 3)
8 changes: 7 additions & 1 deletion constants/tileset_constants.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
; Tileset IDs values are limited by the fact that the function LoadTilesetHeader (engine/overworld/tilesets.asm)
; multiply the ID by 8 before taking carry into account.
; Hence any value bigger than 31 would overflow.
; Note : even without this limitation, would be listable_const_def
DEF TILESET_CONST_LIMIT EQU $FF / 8

; tileset ids
; Tilesets indexes (see data/tilesets/tileset_headers.asm)
const_def
max_const_def TILESET_CONST_LIMIT
const OVERWORLD ; 0
const REDS_HOUSE_1 ; 1
const MART ; 2
Expand Down
8 changes: 4 additions & 4 deletions constants/trainer_constants.asm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
DEF OPP_ID_OFFSET EQU 200

MACRO trainer_const
const \1
DEF OPP_\1 EQU OPP_ID_OFFSET + \1
const OPP_\1
DEF \1 EQU OPP_\1 - OPP_ID_OFFSET
ENDM

; trainer class ids
Expand All @@ -13,7 +13,7 @@ ENDM
; - TrainerPicAndMoneyPointers (see data/trainers/pic_pointers_money.asm)
; - TrainerAIPointers (see data/trainers/ai_pointers.asm)
; - TrainerClassMoveChoiceModifications (see data/trainers/move_choices.asm)
const_def
listable_const_def OPP_ID_OFFSET
trainer_const NOBODY ; $00
trainer_const YOUNGSTER ; $01
trainer_const BUG_CATCHER ; $02
Expand Down Expand Up @@ -62,4 +62,4 @@ ENDM
trainer_const CHANNELER ; $2D
trainer_const AGATHA ; $2E
trainer_const LANCE ; $2F
DEF NUM_TRAINERS EQU const_value - 1
DEF NUM_TRAINERS EQU const_value - OPP_ID_OFFSET - 1
2 changes: 1 addition & 1 deletion constants/type_constants.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; TypeNames indexes (see data/types/names.asm)
const_def
listable_const_def

DEF PHYSICAL EQU const_value
const NORMAL ; $00
Expand Down
6 changes: 3 additions & 3 deletions engine/items/item_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -726,13 +726,13 @@ ItemUseSurfboard:
; uses a simulated button press to make the player move forward
.makePlayerMoveForward
ld a, [wPlayerDirection] ; direction the player is going
bit PLAYER_DIR_BIT_UP, a
bit BIT_PLAYER_DIR_UP, a
ld b, PAD_UP
jr nz, .storeSimulatedButtonPress
bit PLAYER_DIR_BIT_DOWN, a
bit BIT_PLAYER_DIR_DOWN, a
ld b, PAD_DOWN
jr nz, .storeSimulatedButtonPress
bit PLAYER_DIR_BIT_LEFT, a
bit BIT_PLAYER_DIR_LEFT, a
ld b, PAD_LEFT
jr nz, .storeSimulatedButtonPress
ld b, PAD_RIGHT
Expand Down
14 changes: 7 additions & 7 deletions engine/overworld/movement.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ UpdatePlayerSprite:
jr nz, .moving
ld a, [wPlayerMovingDirection]
; check if down
bit PLAYER_DIR_BIT_DOWN, a
bit BIT_PLAYER_DIR_DOWN, a
jr z, .checkIfUp
xor a ; ld a, SPRITE_FACING_DOWN
jr .next
.checkIfUp
bit PLAYER_DIR_BIT_UP, a
bit BIT_PLAYER_DIR_UP, a
jr z, .checkIfLeft
ld a, SPRITE_FACING_UP
jr .next
.checkIfLeft
bit PLAYER_DIR_BIT_LEFT, a
bit BIT_PLAYER_DIR_LEFT, a
jr z, .checkIfRight
ld a, SPRITE_FACING_LEFT
jr .next
.checkIfRight
bit PLAYER_DIR_BIT_RIGHT, a
bit BIT_PLAYER_DIR_RIGHT, a
jr z, .notMoving
ld a, SPRITE_FACING_RIGHT
jr .next
Expand Down Expand Up @@ -415,17 +415,17 @@ MakeNPCFacePlayer:
jr nz, NotYetMoving
res BIT_FACE_PLAYER, [hl]
ld a, [wPlayerDirection]
bit PLAYER_DIR_BIT_UP, a
bit BIT_PLAYER_DIR_UP, a
jr z, .notFacingDown
ld c, SPRITE_FACING_DOWN
jr .facingDirectionDetermined
.notFacingDown
bit PLAYER_DIR_BIT_DOWN, a
bit BIT_PLAYER_DIR_DOWN, a
jr z, .notFacingUp
ld c, SPRITE_FACING_UP
jr .facingDirectionDetermined
.notFacingUp
bit PLAYER_DIR_BIT_LEFT, a
bit BIT_PLAYER_DIR_LEFT, a
jr z, .notFacingRight
ld c, SPRITE_FACING_RIGHT
jr .facingDirectionDetermined
Expand Down
8 changes: 4 additions & 4 deletions home/overworld.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2047,22 +2047,22 @@ LoadMapHeader::
ld a, [wCurMapConnections]
ld b, a
; check north
bit NORTH_F, b
bit BIT_NORTH, b
jr z, .checkSouth
ld de, wNorthConnectionHeader
call CopyMapConnectionHeader
.checkSouth
bit SOUTH_F, b
bit BIT_SOUTH, b
jr z, .checkWest
ld de, wSouthConnectionHeader
call CopyMapConnectionHeader
.checkWest
bit WEST_F, b
bit BIT_WEST, b
jr z, .checkEast
ld de, wWestConnectionHeader
call CopyMapConnectionHeader
.checkEast
bit EAST_F, b
bit BIT_EAST, b
jr z, .getObjectDataPointer
ld de, wEastConnectionHeader
call CopyMapConnectionHeader
Expand Down
2 changes: 1 addition & 1 deletion includes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ INCLUDE "constants/move_constants.asm"
INCLUDE "constants/move_animation_constants.asm"
INCLUDE "constants/move_effect_constants.asm"
INCLUDE "constants/item_constants.asm"
INCLUDE "constants/trainer_constants.asm"
INCLUDE "constants/pokemon_constants.asm"
INCLUDE "constants/pokedex_constants.asm"
INCLUDE "constants/pokemon_data_constants.asm"
INCLUDE "constants/player_constants.asm"
INCLUDE "constants/trainer_constants.asm"
INCLUDE "constants/icon_constants.asm"
INCLUDE "constants/sprite_constants.asm"
INCLUDE "constants/sprite_data_constants.asm"
Expand Down
Loading
Loading