From 6b5be9129cabe72b9f775b02db1bf7e7169153da Mon Sep 17 00:00:00 2001 From: vulcandth Date: Mon, 6 Jun 2022 16:25:31 -0500 Subject: RGBDS syntax updates (#358) New MACRO and DEF syntax --- constants/pokemon_data_constants.asm | 62 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'constants/pokemon_data_constants.asm') diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 6670f777..430abfe0 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -1,37 +1,37 @@ ; base data struct members (see data/pokemon/base_stats/*.asm) rsreset -BASE_DEX_NO rb -BASE_STATS rb NUM_STATS +DEF BASE_DEX_NO rb +DEF BASE_STATS rb NUM_STATS rsset BASE_STATS -BASE_HP rb -BASE_ATK rb -BASE_DEF rb -BASE_SPD rb -BASE_SPC rb -BASE_TYPES rw +DEF BASE_HP rb +DEF BASE_ATK rb +DEF BASE_DEF rb +DEF BASE_SPD rb +DEF BASE_SPC rb +DEF BASE_TYPES rw rsset BASE_TYPES -BASE_TYPE_1 rb -BASE_TYPE_2 rb -BASE_CATCH_RATE rb -BASE_EXP rb -BASE_PIC_SIZE rb -BASE_FRONTPIC rw -BASE_BACKPIC rw -BASE_MOVES rb NUM_MOVES -BASE_GROWTH_RATE rb -BASE_TMHM rb (NUM_TM_HM + 7) / 8 - rb_skip -BASE_DATA_SIZE EQU _RS +DEF BASE_TYPE_1 rb +DEF BASE_TYPE_2 rb +DEF BASE_CATCH_RATE rb +DEF BASE_EXP rb +DEF BASE_PIC_SIZE rb +DEF BASE_FRONTPIC rw +DEF BASE_BACKPIC rw +DEF BASE_MOVES rb NUM_MOVES +DEF BASE_GROWTH_RATE rb +DEF BASE_TMHM rb (NUM_TM_HM + 7) / 8 + rb_skip +DEF BASE_DATA_SIZE EQU _RS -PARTY_LENGTH EQU 6 +DEF PARTY_LENGTH EQU 6 -MONS_PER_BOX EQU 20 -NUM_BOXES EQU 12 +DEF MONS_PER_BOX EQU 20 +DEF NUM_BOXES EQU 12 -HOF_MON EQU $10 -HOF_TEAM EQU PARTY_LENGTH * HOF_MON -HOF_TEAM_CAPACITY EQU 50 +DEF HOF_MON EQU $10 +DEF HOF_TEAM EQU PARTY_LENGTH * HOF_MON +DEF HOF_TEAM_CAPACITY EQU 50 ; mon data locations @@ -52,8 +52,8 @@ HOF_TEAM_CAPACITY EQU 50 const EV_ITEM ; 2 const EV_TRADE ; 3 -MAX_EVOLUTIONS EQU 3 -EVOLUTION_SIZE EQU 4 +DEF MAX_EVOLUTIONS EQU 3 +DEF EVOLUTION_SIZE EQU 4 ; wMonHGrowthRate values @@ -65,8 +65,8 @@ EVOLUTION_SIZE EQU 4 const GROWTH_MEDIUM_SLOW const GROWTH_FAST const GROWTH_SLOW -NUM_GROWTH_RATES EQU const_value +DEF NUM_GROWTH_RATES EQU const_value ; wild data (see data/wild/maps/*.asm) -NUM_WILDMONS EQU 10 -WILDDATA_LENGTH EQU 1 + NUM_WILDMONS * 2 +DEF NUM_WILDMONS EQU 10 +DEF WILDDATA_LENGTH EQU 1 + NUM_WILDMONS * 2 -- cgit v1.3.1-sl0p From 70cbb483288cd048f85420a63caadc707e9b75bf Mon Sep 17 00:00:00 2001 From: vulcandth Date: Mon, 4 Jul 2022 00:08:17 -0500 Subject: party_struct constants and ExchangeBytes size (#364) Co-Authored-By: Rangi <35663410+Rangi42@users.noreply.github.com> --- constants/pokemon_data_constants.asm | 31 +++++++++++++++++++++++++++++++ constants/serial_constants.asm | 4 ++++ engine/link/cable_club.asm | 6 +++--- 3 files changed, 38 insertions(+), 3 deletions(-) (limited to 'constants/pokemon_data_constants.asm') diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 430abfe0..1fd7ce19 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -23,6 +23,37 @@ DEF BASE_TMHM rb (NUM_TM_HM + 7) / 8 rb_skip DEF BASE_DATA_SIZE EQU _RS +; party_struct members (see macros/wram.asm) +rsreset +DEF MON_SPECIES rb +DEF MON_HP rw +DEF MON_BOX_LEVEL rb +DEF MON_STATUS rb +DEF MON_TYPE rw +rsset MON_TYPE +DEF MON_TYPE1 rb +DEF MON_TYPE2 rb +DEF MON_CATCH_RATE rb +DEF MON_MOVES rb NUM_MOVES +DEF MON_OTID rw +DEF MON_EXP rb 3 +DEF MON_HP_EXP rw +DEF MON_ATK_EXP rw +DEF MON_DEF_EXP rw +DEF MON_SPD_EXP rw +DEF MON_SPC_EXP rw +DEF MON_DVS rw +DEF MON_PP rb NUM_MOVES +DEF BOXMON_STRUCT_LENGTH EQU _RS +DEF MON_LEVEL rb +DEF MON_STATS rw NUM_STATS +rsset MON_STATS +DEF MON_MAXHP rw +DEF MON_ATK rw +DEF MON_DEF rw +DEF MON_SPD rw +DEF MON_SPC rw +DEF PARTYMON_STRUCT_LENGTH EQU _RS DEF PARTY_LENGTH EQU 6 diff --git a/constants/serial_constants.asm b/constants/serial_constants.asm index 16603980..37747b76 100644 --- a/constants/serial_constants.asm +++ b/constants/serial_constants.asm @@ -14,6 +14,10 @@ DEF SERIAL_NO_DATA_BYTE EQU $FE ; signals the end of one part of a patch list (there are two parts) for player/enemy party data DEF SERIAL_PATCH_LIST_PART_TERMINATOR EQU $FF +DEF SERIAL_PREAMBLE_LENGTH EQU 6 +DEF SERIAL_RN_PREAMBLE_LENGTH EQU 7 +DEF SERIAL_RNS_LENGTH EQU 10 + DEF LINK_STATE_NONE EQU $00 ; not using link DEF LINK_STATE_IN_CABLE_CLUB EQU $01 ; in a cable club room (Colosseum or Trade Centre) DEF LINK_STATE_START_TRADE EQU $02 ; pre-trade selection screen initialisation diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 40e0dfe8..7e856093 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -123,21 +123,21 @@ CableClub_DoBattleOrTradeAgain: ldh [rIE], a ld hl, wSerialRandomNumberListBlock ld de, wSerialOtherGameboyRandomNumberListBlock - ld bc, $11 + ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH vc_hook Wireless_ExchangeBytes_RNG_state_unknown_Type5 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wSerialPlayerDataBlock ld de, wSerialEnemyDataBlock - ld bc, $1a8 + ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3 vc_hook Wireless_ExchangeBytes_party_structs call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wSerialPartyMonsPatchList ld de, wSerialEnemyMonsPatchList - ld bc, $c8 + ld bc, 200 vc_hook Wireless_ExchangeBytes_patch_lists call Serial_ExchangeBytes ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK) -- cgit v1.3.1-sl0p From 74cee737f6990fd770838eb8fe4d090028a76bd9 Mon Sep 17 00:00:00 2001 From: vulcandth Date: Sun, 11 Sep 2022 00:05:04 -0500 Subject: Rename `macros/wram.asm` to `macros/ram.asm` (#388) --- constants/map_object_constants.asm | 4 +- constants/pokemon_data_constants.asm | 2 +- macros/ram.asm | 115 +++++++++++++++++++++++++++++++++++ macros/wram.asm | 115 ----------------------------------- ram.asm | 2 +- 5 files changed, 119 insertions(+), 119 deletions(-) create mode 100644 macros/ram.asm delete mode 100644 macros/wram.asm (limited to 'constants/pokemon_data_constants.asm') diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 5c666d83..377edcea 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -1,4 +1,4 @@ -; spritestatedata1 struct members (see macros/wram.asm) +; spritestatedata1 struct members (see macros/ram.asm) const_def const SPRITESTATEDATA1_PICTUREID ; 0 const SPRITESTATEDATA1_MOVEMENTSTATUS ; 1 @@ -18,7 +18,7 @@ const SPRITESTATEDATA1_0F ; f DEF SPRITESTATEDATA1_LENGTH EQU const_value -; spritestatedata2 struct members (see macros/wram.asm) +; spritestatedata2 struct members (see macros/ram.asm) const_def const SPRITESTATEDATA2_WALKANIMATIONCOUNTER ; 0 const SPRITESTATEDATA2_01 ; 1 diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 1fd7ce19..028d6711 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -23,7 +23,7 @@ DEF BASE_TMHM rb (NUM_TM_HM + 7) / 8 rb_skip DEF BASE_DATA_SIZE EQU _RS -; party_struct members (see macros/wram.asm) +; party_struct members (see macros/ram.asm) rsreset DEF MON_SPECIES rb DEF MON_HP rw diff --git a/macros/ram.asm b/macros/ram.asm new file mode 100644 index 00000000..df5dcf90 --- /dev/null +++ b/macros/ram.asm @@ -0,0 +1,115 @@ +; Used in wram.asm + +MACRO flag_array + ds ((\1) + 7) / 8 +ENDM + +DEF BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2 + +MACRO box_struct +\1Species:: db +\1HP:: dw +\1BoxLevel:: db +\1Status:: db +\1Type:: +\1Type1:: db +\1Type2:: db +\1CatchRate:: db +\1Moves:: ds NUM_MOVES +\1OTID:: dw +\1Exp:: ds 3 +\1HPExp:: dw +\1AttackExp:: dw +\1DefenseExp:: dw +\1SpeedExp:: dw +\1SpecialExp:: dw +\1DVs:: ds 2 +\1PP:: ds NUM_MOVES +ENDM + +MACRO party_struct + box_struct \1 +\1Level:: db +\1Stats:: +\1MaxHP:: dw +\1Attack:: dw +\1Defense:: dw +\1Speed:: dw +\1Special:: dw +ENDM + +MACRO battle_struct +\1Species:: db +\1HP:: dw +\1PartyPos:: +\1BoxLevel:: db +\1Status:: db +\1Type:: +\1Type1:: db +\1Type2:: db +\1CatchRate:: db +\1Moves:: ds NUM_MOVES +\1DVs:: ds 2 +\1Level:: db +\1Stats:: +\1MaxHP:: dw +\1Attack:: dw +\1Defense:: dw +\1Speed:: dw +\1Special:: dw +\1PP:: ds NUM_MOVES +ENDM + +MACRO spritestatedata1 +\1PictureID:: db +\1MovementStatus:: db +\1ImageIndex:: db +\1YStepVector:: db +\1YPixels:: db +\1XStepVector:: db +\1XPixels:: db +\1IntraAnimFrameCounter:: db +\1AnimFrameCounter:: db +\1FacingDirection:: db +\1YAdjusted:: db +\1XAdjusted:: db +\1CollisionData:: db + ds 3 +\1End:: +ENDM + +MACRO spritestatedata2 +\1WalkAnimationCounter:: db + ds 1 +\1YDisplacement:: db +\1XDisplacement:: db +\1MapY:: db +\1MapX:: db +\1MovementByte1:: db +\1GrassPriority:: db +\1MovementDelay:: db +\1OrigFacingDirection:: db + ds 3 +\1PictureID:: db +\1ImageBaseOffset:: db + ds 1 +\1End:: +ENDM + +MACRO sprite_oam_struct +\1YCoord:: db +\1XCoord:: db +\1TileID:: db +\1Attributes:: db +ENDM + +MACRO map_connection_struct +\1ConnectedMap:: db +\1ConnectionStripSrc:: dw +\1ConnectionStripDest:: dw +\1ConnectionStripLength:: db +\1ConnectedMapWidth:: db +\1ConnectedMapYAlignment:: db +\1ConnectedMapXAlignment:: db +\1ConnectedMapViewPointer:: dw +ENDM diff --git a/macros/wram.asm b/macros/wram.asm deleted file mode 100644 index df5dcf90..00000000 --- a/macros/wram.asm +++ /dev/null @@ -1,115 +0,0 @@ -; Used in wram.asm - -MACRO flag_array - ds ((\1) + 7) / 8 -ENDM - -DEF BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2 - -MACRO box_struct -\1Species:: db -\1HP:: dw -\1BoxLevel:: db -\1Status:: db -\1Type:: -\1Type1:: db -\1Type2:: db -\1CatchRate:: db -\1Moves:: ds NUM_MOVES -\1OTID:: dw -\1Exp:: ds 3 -\1HPExp:: dw -\1AttackExp:: dw -\1DefenseExp:: dw -\1SpeedExp:: dw -\1SpecialExp:: dw -\1DVs:: ds 2 -\1PP:: ds NUM_MOVES -ENDM - -MACRO party_struct - box_struct \1 -\1Level:: db -\1Stats:: -\1MaxHP:: dw -\1Attack:: dw -\1Defense:: dw -\1Speed:: dw -\1Special:: dw -ENDM - -MACRO battle_struct -\1Species:: db -\1HP:: dw -\1PartyPos:: -\1BoxLevel:: db -\1Status:: db -\1Type:: -\1Type1:: db -\1Type2:: db -\1CatchRate:: db -\1Moves:: ds NUM_MOVES -\1DVs:: ds 2 -\1Level:: db -\1Stats:: -\1MaxHP:: dw -\1Attack:: dw -\1Defense:: dw -\1Speed:: dw -\1Special:: dw -\1PP:: ds NUM_MOVES -ENDM - -MACRO spritestatedata1 -\1PictureID:: db -\1MovementStatus:: db -\1ImageIndex:: db -\1YStepVector:: db -\1YPixels:: db -\1XStepVector:: db -\1XPixels:: db -\1IntraAnimFrameCounter:: db -\1AnimFrameCounter:: db -\1FacingDirection:: db -\1YAdjusted:: db -\1XAdjusted:: db -\1CollisionData:: db - ds 3 -\1End:: -ENDM - -MACRO spritestatedata2 -\1WalkAnimationCounter:: db - ds 1 -\1YDisplacement:: db -\1XDisplacement:: db -\1MapY:: db -\1MapX:: db -\1MovementByte1:: db -\1GrassPriority:: db -\1MovementDelay:: db -\1OrigFacingDirection:: db - ds 3 -\1PictureID:: db -\1ImageBaseOffset:: db - ds 1 -\1End:: -ENDM - -MACRO sprite_oam_struct -\1YCoord:: db -\1XCoord:: db -\1TileID:: db -\1Attributes:: db -ENDM - -MACRO map_connection_struct -\1ConnectedMap:: db -\1ConnectionStripSrc:: dw -\1ConnectionStripDest:: dw -\1ConnectionStripLength:: db -\1ConnectedMapWidth:: db -\1ConnectedMapYAlignment:: db -\1ConnectedMapXAlignment:: db -\1ConnectedMapViewPointer:: dw -ENDM diff --git a/ram.asm b/ram.asm index 24040b14..077ae799 100644 --- a/ram.asm +++ b/ram.asm @@ -1,6 +1,6 @@ INCLUDE "constants.asm" -INCLUDE "macros/wram.asm" +INCLUDE "macros/ram.asm" INCLUDE "ram/vram.asm" -- cgit v1.3.1-sl0p