diff options
26 files changed, 493 insertions, 461 deletions
diff --git a/constants.asm b/constants.asm index d3e99ef..feadf95 100644 --- a/constants.asm +++ b/constants.asm @@ -1,6 +1,6 @@ INCLUDE "constants/charmap.asm" -INCLUDE "macros/enum.asm" +INCLUDE "macros/const.asm" INCLUDE "macros/predef.asm" INCLUDE "macros/data.asm" INCLUDE "macros/code.asm" @@ -43,6 +43,7 @@ INCLUDE "constants/map_data_constants.asm" INCLUDE "constants/script_constants.asm" INCLUDE "constants/serial_constants.asm" +INCLUDE "constants/input_constants.asm" INCLUDE "constants/misc_constants.asm" @@ -51,6 +52,5 @@ INCLUDE "constants/menu_constants.asm" INCLUDE "constants/wram_constants.asm" INCLUDE "constants/sgb_constants.asm" INCLUDE "constants/map_object_constants.asm" -INCLUDE "constants/main_menu_constants.asm" INCLUDE "constants/start_menu_constants.asm" INCLUDE "constants/movement_constants.asm" diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index f960501..9c11e36 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -5,11 +5,11 @@ const CHAN3 const CHAN4 NUM_MUSIC_CHANS EQU const_value -NUM_NOISE_CHANS EQU const_value const CHAN5 const CHAN6 const CHAN7 const CHAN8 +NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS NUM_CHANNELS EQU const_value ; channel_struct members (see macros/wram.asm) @@ -52,6 +52,8 @@ CHANNEL_FIELD2F EQUS "(wChannel1Field2f - wChannel1)" CHANNEL_FIELD30 EQUS "(wChannel1Field30 - wChannel1)" CHANNEL_STRUCT_LENGTH EQUS "(wChannel2 - wChannel1)" +NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7 + ; Flags1 const_def const SOUND_CHANNEL_ON ; 0 diff --git a/constants/battle_anim_constants.asm b/constants/battle_anim_constants.asm index 0fbd83a..57d0a70 100644 --- a/constants/battle_anim_constants.asm +++ b/constants/battle_anim_constants.asm @@ -1,7 +1,7 @@ ; battle_anim_struct members (see macros/wram.asm) const_def const BATTLEANIMSTRUCT_INDEX - const BATTLEANIMSTRUCT_01 + const BATTLEANIMSTRUCT_OAMFLAGS const BATTLEANIMSTRUCT_02 const BATTLEANIMSTRUCT_FRAMESET_ID const BATTLEANIMSTRUCT_FUNCTION @@ -11,19 +11,13 @@ const BATTLEANIMSTRUCT_YCOORD const BATTLEANIMSTRUCT_XOFFSET const BATTLEANIMSTRUCT_YOFFSET - const BATTLEANIMSTRUCT_0B + const BATTLEANIMSTRUCT_PARAM const BATTLEANIMSTRUCT_DURATION const BATTLEANIMSTRUCT_FRAME - const BATTLEANIMSTRUCT_ANON_JT_INDEX - const BATTLEANIMSTRUCT_0F - const BATTLEANIMSTRUCT_10 - const BATTLEANIMSTRUCT_11 - const BATTLEANIMSTRUCT_12 - const BATTLEANIMSTRUCT_13 - const BATTLEANIMSTRUCT_14 - const BATTLEANIMSTRUCT_15 - const BATTLEANIMSTRUCT_16 - const BATTLEANIMSTRUCT_17 + const BATTLEANIMSTRUCT_JUMPTABLE_INDEX + const BATTLEANIMSTRUCT_VAR1 + const BATTLEANIMSTRUCT_VAR2 + const_skip 7 BATTLEANIMSTRUCT_LENGTH EQU const_value ; BattleAnimObjects indexes (see data/battle_anims/objects.asm) @@ -813,6 +807,7 @@ const_value SET $b1 const BG_EFFECT_STRUCT_JT_INDEX const BG_EFFECT_STRUCT_BATTLE_TURN const BG_EFFECT_STRUCT_03 +BG_EFFECT_STRUCT_LENGTH EQU const_value ; battle palettes const_def diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index ad64c58..2e63990 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -1,6 +1,7 @@ ; significant level values MAX_LEVEL EQU 100 MIN_LEVEL EQU 2 +EGG_LEVEL EQU 5 ; maximum moves known per mon NUM_MOVES EQU 4 @@ -9,8 +10,9 @@ NUM_MOVES EQU 4 BASE_STAT_LEVEL EQU 7 MAX_STAT_LEVEL EQU 13 -; minimum damage before type effectiveness +; damage limits before type effectiveness MIN_NEUTRAL_DAMAGE EQU 2 +MAX_NEUTRAL_DAMAGE EQU 999 ; turns that sleep lasts REST_SLEEP_TURNS EQU 2 @@ -59,8 +61,10 @@ MOVE_LENGTH EQU const_value const STAT_DEF const STAT_SPD const STAT_SATK +NUM_EXP_STATS EQU const_value - 1 const STAT_SDEF NUM_STATS EQU const_value +NUM_BATTLE_STATS EQU NUM_STATS - 1 ; don't count HP STAT_SPC EQU STAT_SATK ; stat formula constants @@ -91,8 +95,6 @@ SPDSPCDV_SHINY EQU $AA const BATTLETYPE_TREE const BATTLETYPE_TRAP const BATTLETYPE_FORCEITEM - const BATTLETYPE_CELEBI - const BATTLETYPE_SUICUNE ; BattleVarPairs indexes (see home/battle.asm) const_def @@ -158,59 +160,60 @@ SLP EQU %111 ; 0-7 turns ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP ; wPlayerSubStatus1 or wEnemySubStatus1 bit flags - enum_start 7, -1 - enum SUBSTATUS_IN_LOVE - enum SUBSTATUS_ROLLOUT - enum SUBSTATUS_ENDURE - enum SUBSTATUS_PERISH - enum SUBSTATUS_IDENTIFIED - enum SUBSTATUS_PROTECT - enum SUBSTATUS_CURSE - enum SUBSTATUS_NIGHTMARE + const_def + const SUBSTATUS_NIGHTMARE + const SUBSTATUS_CURSE + const SUBSTATUS_PROTECT + const SUBSTATUS_IDENTIFIED + const SUBSTATUS_PERISH + const SUBSTATUS_ENDURE + const SUBSTATUS_ROLLOUT + const SUBSTATUS_IN_LOVE ; wPlayerSubStatus2 or wEnemySubStatus2 bit flags -SUBSTATUS_CURLED EQU 0 + const_def + const SUBSTATUS_CURLED ; wPlayerSubStatus3 or wEnemySubStatus3 bit flags - enum_start 7, -1 - enum SUBSTATUS_CONFUSED - enum SUBSTATUS_FLYING - enum SUBSTATUS_UNDERGROUND - enum SUBSTATUS_CHARGED - enum SUBSTATUS_FLINCHED - enum SUBSTATUS_IN_LOOP - enum SUBSTATUS_RAMPAGE - enum SUBSTATUS_BIDE + const_def + const SUBSTATUS_BIDE + const SUBSTATUS_RAMPAGE + const SUBSTATUS_IN_LOOP + const SUBSTATUS_FLINCHED + const SUBSTATUS_CHARGED + const SUBSTATUS_UNDERGROUND + const SUBSTATUS_FLYING + const SUBSTATUS_CONFUSED ; wPlayerSubStatus4 or wEnemySubStatus4 bit flags - enum_start 7, -1 - enum SUBSTATUS_LEECH_SEED - enum SUBSTATUS_RAGE - enum SUBSTATUS_RECHARGE - enum SUBSTATUS_SUBSTITUTE - enum SUBSTATUS_UNKNOWN_1 - enum SUBSTATUS_FOCUS_ENERGY - enum SUBSTATUS_MIST - enum SUBSTATUS_X_ACCURACY + const_def + const SUBSTATUS_X_ACCURACY + const SUBSTATUS_MIST + const SUBSTATUS_FOCUS_ENERGY + const_skip + const SUBSTATUS_SUBSTITUTE + const SUBSTATUS_RECHARGE + const SUBSTATUS_RAGE + const SUBSTATUS_LEECH_SEED ; wPlayerSubStatus5 or wEnemySubStatus5 bit flags - enum_start 7, -1 - enum SUBSTATUS_CANT_RUN - enum SUBSTATUS_DESTINY_BOND - enum SUBSTATUS_LOCK_ON - enum SUBSTATUS_ENCORED - enum SUBSTATUS_TRANSFORMED - enum SUBSTATUS_UNKNOWN_2 - enum SUBSTATUS_UNKNOWN_3 - enum SUBSTATUS_TOXIC + const_def + const SUBSTATUS_TOXIC + const_skip + const_skip + const SUBSTATUS_TRANSFORMED + const SUBSTATUS_ENCORED + const SUBSTATUS_LOCK_ON + const SUBSTATUS_DESTINY_BOND + const SUBSTATUS_CANT_RUN ; wPlayerScreens or wEnemyScreens bit flags - enum_start 4, -1 - enum SCREENS_REFLECT - enum SCREENS_LIGHT_SCREEN - enum SCREENS_SAFEGUARD - enum SCREENS_UNUSED - enum SCREENS_SPIKES + const_def + const SCREENS_SPIKES + const_skip + const SCREENS_SAFEGUARD + const SCREENS_LIGHT_SCREEN + const SCREENS_REFLECT ; values in wBattleWeather const_def @@ -246,3 +249,6 @@ SUBSTATUS_CURLED EQU 0 const WIN const LOSE const DRAW + +BATTLERESULT_BOX_FULL EQU 7 +BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_BOX_FULL) diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 52f74e5..772d2e6 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -8,7 +8,6 @@ PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE PALRGB_WHITE EQUS "palred 31 + palgreen 31 + palblue 31" ; $7fff - SCREEN_WIDTH EQU 20 ; tiles SCREEN_HEIGHT EQU 18 ; tiles SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels @@ -23,7 +22,6 @@ SCREEN_META_HEIGHT EQU 5 ; metatiles SURROUNDING_WIDTH EQU SCREEN_META_WIDTH * METATILE_WIDTH ; tiles SURROUNDING_HEIGHT EQU SCREEN_META_HEIGHT * METATILE_WIDTH ; tiles - HP_BAR_LENGTH EQU 6 ; tiles EXP_BAR_LENGTH EQU 8 ; tiles HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * TILE_WIDTH ; pixels @@ -34,8 +32,8 @@ HP_GREEN EQU 0 HP_YELLOW EQU 1 HP_RED EQU 2 -SPRITEBUFFERSIZE EQU 7*7 * 8 ; 7 * 7 (tiles) * 8 (bytes per tile) -DOUBLESPRITEBUFFERSIZE EQU 2*SPRITEBUFFERSIZE +SPRITEBUFFERSIZE EQU 7 * 7 * 8 ; 7 * 7 (tiles) * 8 (bytes per tile) +DOUBLESPRITEBUFFERSIZE EQU 2 * SPRITEBUFFERSIZE ; sprite_oam_struct members (see macros/wram.asm) const_def @@ -45,16 +43,3 @@ DOUBLESPRITEBUFFERSIZE EQU 2*SPRITEBUFFERSIZE const SPRITEOAMSTRUCT_ATTRIBUTES ; 3 SPRITEOAMSTRUCT_LENGTH EQU const_value NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wVirtualOAM - - -; PokeAnims indexes (see engine/gfx/pic_animation.asm) - const_def - const ANIM_MON_SLOW - const ANIM_MON_NORMAL - const ANIM_MON_MENU - const ANIM_MON_TRADE - const ANIM_MON_EVOLVE - const ANIM_MON_HATCH - const ANIM_MON_UNUSED - const ANIM_MON_EGG1 - const ANIM_MON_EGG2 diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index b22019d..a86e008 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -42,6 +42,7 @@ LCD_STAT EQU 1 TIMER EQU 2 SERIAL EQU 3 JOYPAD EQU 4 +IE_DEFAULT EQU (1 << JOYPAD) | (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) ; OAM attribute flags OAM_TILE_BANK EQU 3 @@ -58,10 +59,6 @@ X_FLIP EQU 1 << OAM_X_FLIP ; $20 Y_FLIP EQU 1 << OAM_Y_FLIP ; $40 PRIORITY EQU 1 << OAM_PRIORITY ; $80 -; Other useful constants -LCDC_DEFAULT EQU %11100011 -LY_VBLANK EQU 144 - ; Hardware registers rJOYP EQU $ff00 ; Joypad (R/W) rSB EQU $ff01 ; Serial transfer data (R/W) @@ -119,18 +116,24 @@ rWave_d EQU $ff3d rWave_e EQU $ff3e rWave_f EQU $ff3f rLCDC EQU $ff40 ; LCD Control (R/W) +rLCDC_BG_PRIORITY EQU 0 ; 0=Off, 1=On rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16 +rLCDC_BG_TILEMAP EQU 3 ; 0=9800-9BFF, 1=9C00-9FFF +rLCDC_TILE_DATA EQU 4 ; 0=8800-97FF, 1=8000-8FFF +rLCDC_WINDOW_ENABLE EQU 5 ; 0=Off, 1=On rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF rLCDC_ENABLE EQU 7 ; 0=Off, 1=On +LCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY) rSTAT EQU $ff41 ; LCDC Status (R/W) -rSTAT_HBLANK EQU 3 ; 0=Off, 1=On -rSTAT_VBLANK EQU 4 ; 0=Off, 1=On -rSTAT_MODE2 EQU 5 ; 0=Off, 1=On -rSTAT_LYC EQU 6 ; 0=Off, 1=On +rSTAT_HBLANK EQU 3 ; 0=Off, 1=On +rSTAT_VBLANK EQU 4 ; 0=Off, 1=On +rSTAT_MODE2 EQU 5 ; 0=Off, 1=On +rSTAT_LYC EQU 6 ; 0=Off, 1=On rSCY EQU $ff42 ; Scroll Y (R/W) rSCX EQU $ff43 ; Scroll X (R/W) rLY EQU $ff44 ; LCDC Y-Coordinate (R) +LY_VBLANK EQU 144 rLYC EQU $ff45 ; LY Compare (R/W) rDMA EQU $ff46 ; DMA Transfer and Start Address (W) rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only diff --git a/constants/icon_constants.asm b/constants/icon_constants.asm index 6490b51..ca999c9 100644 --- a/constants/icon_constants.asm +++ b/constants/icon_constants.asm @@ -1,4 +1,4 @@ -; Icon IDs +; icon ids const_def const ICON_NONE ; 00 const ICON_NYOROMO ; 01 diff --git a/constants/input_constants.asm b/constants/input_constants.asm new file mode 100644 index 0000000..3042c3f --- /dev/null +++ b/constants/input_constants.asm @@ -0,0 +1,26 @@ +; joypad buttons + const_def + const A_BUTTON_F ; 0 + const B_BUTTON_F ; 1 + const SELECT_F ; 2 + const START_F ; 3 + const D_RIGHT_F ; 4 + const D_LEFT_F ; 5 + const D_UP_F ; 6 + const D_DOWN_F ; 7 + +NO_INPUT EQU %00000000 +A_BUTTON EQU 1 << A_BUTTON_F +B_BUTTON EQU 1 << B_BUTTON_F +SELECT EQU 1 << SELECT_F +START EQU 1 << START_F +D_RIGHT EQU 1 << D_RIGHT_F +D_LEFT EQU 1 << D_LEFT_F +D_UP EQU 1 << D_UP_F +D_DOWN EQU 1 << D_DOWN_F + +BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START +D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN + +R_DPAD EQU %00100000 +R_BUTTONS EQU %00010000 diff --git a/constants/item_constants.asm b/constants/item_constants.asm index ebc3aee..a8c504b 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -1,4 +1,4 @@ -; Item IDs +; item ids const_def const ITEM_NONE ; 00 const ITEM_MASTER_BALL ; 01 @@ -66,6 +66,7 @@ const ITEM_ETHER ; 3f const ITEM_MAX_ETHER ; 40 const ITEM_ELIXER ; 41 + const ITEM_MYSTIC_PETAL ; 42 *RED_SCALE const ITEM_WHITE_FEATHER ; 43 *SECRETPOTION const ITEM_CONFUSE_CLAW ; 44 *S_S_TICKET @@ -263,7 +264,7 @@ NUM_HMS = const_value - ITEM_HM01 const ITEM_FF -NUM_TMS_HMS = NUM_TMS + NUM_HMS +NUM_TM_HM = NUM_TMS + NUM_HMS ; leftovers from pokered ITEM_HM01_RED EQU $c4 diff --git a/constants/item_data_constants.asm b/constants/item_data_constants.asm index 80dfd14..a0543de 100755 --- a/constants/item_data_constants.asm +++ b/constants/item_data_constants.asm @@ -1,6 +1,6 @@ ; item_attributes struct members (see data/items/attributes.asm) const_def - const ITEMATTR_PRICE + const ITEMATTR_PRICE_LO const ITEMATTR_PRICE_HI const ITEMATTR_EFFECT const ITEMATTR_PARAM @@ -19,10 +19,12 @@ ITEMATTR_STRUCT_LENGTH EQU const_value ; item menu types ; UseItem.dw indexes (see engine/items/pack.asm) ; UseRegisteredItem.SwitchTo indexes (see engine/overworld/select_menu.asm) -ITEMMENU_NOUSE EQU 0 -ITEMMENU_CURRENT EQU 4 -ITEMMENU_PARTY EQU 5 -ITEMMENU_CLOSE EQU 6 + const_def + const ITEMMENU_NOUSE ; 0 + const_skip 3 + const ITEMMENU_CURRENT ; 4 + const ITEMMENU_PARTY ; 5 + const ITEMMENU_CLOSE ; 6 ; item actions CANT_SELECT_F EQU 6 @@ -56,7 +58,7 @@ MAX_PC_ITEMS EQU 50 const HELD_RESTORE_ALL_PP const HELD_CLEANSE_TAG - const_def 10 + const_next 10 const HELD_HEAL_POISON const HELD_HEAL_FREEZE const HELD_HEAL_BURN @@ -65,7 +67,7 @@ MAX_PC_ITEMS EQU 50 const HELD_HEAL_STATUS const HELD_HEAL_CONFUSION - const_def 20 + const_next 20 const HELD_PREVENT_POISON const HELD_PREVENT_BURN const HELD_PREVENT_FREEZE @@ -73,7 +75,7 @@ MAX_PC_ITEMS EQU 50 const HELD_PREVENT_PARALYZE const HELD_PREVENT_CONFUSE - const_def 30 + const_next 30 const HELD_30 const HELD_ATTACK_UP const HELD_DEFENSE_UP @@ -84,7 +86,7 @@ MAX_PC_ITEMS EQU 50 const HELD_EVASION_UP const HELD_38 - const_def 40 + const_next 40 const HELD_40 const HELD_41 const HELD_METAL_POWDER @@ -95,7 +97,7 @@ MAX_PC_ITEMS EQU 50 const HELD_47 const HELD_48 - const_def 50 + const_next 50 const HELD_NORMAL_BOOST const HELD_FIGHTING_BOOST const HELD_FLYING_BOOST @@ -114,7 +116,7 @@ MAX_PC_ITEMS EQU 50 const HELD_DARK_BOOST const HELD_STEEL_BOOST - const_def 70 + const_next 70 const HELD_CATCH_CHANCE const HELD_71 const HELD_ESCAPE diff --git a/constants/main_menu_constants.asm b/constants/main_menu_constants.asm deleted file mode 100644 index 0a3519e..0000000 --- a/constants/main_menu_constants.asm +++ /dev/null @@ -1,12 +0,0 @@ - const_def - const M_NEW_GAME - const M_CONTINUE - const M_PLAY_GAME - const M_SET_TIME - - const_def - const CONTINUE - const NEW_GAME - const OPTION - const PLAY_POKEMON - const SET_TIME diff --git a/constants/map_constants.asm b/constants/map_constants.asm index ba2563c..da632fb 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -1,6 +1,6 @@ newgroup: MACRO const_value = const_value + 1 - enum_start 1 +__map_value__ = 1 ENDM map_const: MACRO @@ -8,12 +8,13 @@ map_const: MACRO ;\2: width: in blocks ;\3: height: in blocks GROUP_\1 EQU const_value - enum MAP_\1 +MAP_\1 EQU __map_value__ +__map_value__ = __map_value__ + 1 \1_WIDTH EQU \2 \1_HEIGHT EQU \3 ENDM -; Map IDs +; map ids const_def newgroup ; 1 @@ -98,196 +99,198 @@ ENDM map_const HAITEKU_AQUARIUM_1F, 8, 4 ; 13 map_const HAITEKU_AQUARIUM_2F, 8, 4 ; 14 - newgroup - - map_const FONTO_ROUTE_1, 35, 9 - map_const FONTO_ROUTE_2, 10, 18 - map_const FONTO_ROUTE_3, 25, 9 - map_const FONTO_ROUTE_4, 10, 18 - map_const FONTO_ROUTE_5, 10, 18 - map_const FONTO_ROUTE_6, 35, 9 - map_const FONTO, 10, 9 - map_const FONTO_ROUTE_GATE_1, 5, 4 - map_const FONTO_ROUTE_GATE_2, 5, 4 - map_const FONTO_ROUTE_GATE_3, 5, 4 - map_const FONTO_ROCKET_HOUSE, 8, 4 - map_const FONTO_MART, 8, 4 - map_const FONTO_HOUSE, 5, 4 - map_const FONTO_POKECENTER_1F, 8, 4 - map_const FONTO_POKECENTER_2F, 8, 4 - map_const FONTO_LAB, 5, 4 - - newgroup - - map_const BAADON_ROUTE_1, 10, 27 - map_const BAADON_ROUTE_2, 50, 9 - map_const BAADON_ROUTE_3, 10, 18 - map_const BAADON, 10, 9 - map_const BAADON_ROUTE_GATE_WEST, 5, 4 - map_const BAADON_ROUTE_GATE_NEWTYPE, 5, 4 - map_const BAADON_MART, 8, 4 - map_const BAADON_POKECENTER_1F, 8, 4 - map_const BAADON_POKECENTER_2F, 8, 4 - map_const BAADON_HOUSE_1, 4, 4 - map_const BAADON_WALLPAPER_HOUSE, 4, 4 - map_const BAADON_HOUSE_2, 5, 4 - map_const BAADON_LEAGUE_1F, 4, 8 - map_const BAADON_LEAGUE_2F, 5, 9 - - newgroup - - map_const ROUTE_15, 15, 9 - map_const NEWTYPE_ROUTE, 15, 9 - map_const ROUTE_18, 10, 45 - map_const NEWTYPE, 20, 18 - map_const ROUTE_15_POKECENTER_1F, 8, 4 - map_const ROUTE_15_POKECENTER_2F, 8, 4 - map_const NEWTYPE_ROUTE_GATE, 5, 4 - map_const ROUTE_18_POKECENTER_1F, 8, 4 - map_const ROUTE_18_POKECENTER_2F, 8, 4 - map_const NEWTYPE_POKECENTER_1F, 8, 4 - map_const NEWTYPE_POKECENTER_2F, 8, 4 - map_const NEWTYPE_LEAGUE_1F, 4, 8 - map_const NEWTYPE_LEAGUE_2F, 5, 9 - map_const NEWTYPE_SAILOR_HOUSE, 5, 4 - map_const NEWTYPE_MART, 8, 4 - map_const NEWTYPE_DOJO, 4, 8 - map_const NEWTYPE_HOUSE_1, 5, 4 - map_const NEWTYPE_DINER, 4, 4 - map_const NEWTYPE_HOUSE_2, 5, 4 - map_const NEWTYPE_HOUSE_3, 5, 4 - - newgroup - - map_const SUGAR_ROUTE, 10, 27 - map_const SUGAR, 10, 9 - map_const SUGAR_ROUTE_GATE, 5, 4 - map_const SUGAR_HOUSE, 4, 8 - map_const SUGAR_HOUSE_2, 4, 4 - map_const SUGAR_MART, 8, 4 - map_const SUGAR_POKECENTER_1F, 8, 4 - map_const SUGAR_POKECENTER_2F, 8, 4 - - newgroup - - map_const BULL_FOREST_ROUTE_1, 25, 9 - map_const BULL_FOREST_ROUTE_2, 10, 27 - map_const BULL_FOREST_ROUTE_3, 10, 27 - map_const BULL_FOREST, 20, 18 - map_const BULL_FOREST_ROUTE_1_HOUSE, 5, 4 - map_const BULL_FOREST_ROUTE_GATE_STAND, 5, 4 - map_const BULL_MART, 8, 4 - map_const BULL_HOUSE_1, 4, 4 - map_const BULL_HOUSE_2, 5, 4 - map_const BULL_HOUSE_3, 5, 4 - map_const BULL_POKECENTER_1F, 8, 4 - map_const BULL_POKECENTER_2F, 8, 4 - map_const BULL_LEAGUE_1F, 4, 8 - map_const BULL_LEAGUE_2F, 5, 9 - map_const BULL_HOUSE_4, 5, 4 - - newgroup - - map_const STAND_ROUTE, 10, 27 - map_const STAND, 20, 18 - map_const STAND_ROUTE_GATE_KANTO, 5, 4 - map_const STAND_LAB, 4, 4 - map_const STAND_POKECENTER_1F, 8, 4 - map_const STAND_POKECENTER_2F, 8, 4 - map_const STAND_OFFICE, 8, 4 - map_const STAND_MART, 8, 4 - map_const STAND_HOUSE, 5, 4 - map_const STAND_ROCKET_HOUSE_1F, 8, 4 - map_const STAND_ROCKET_HOUSE_2F, 8, 4 - map_const STAND_LEAGUE_1F, 4, 8 - map_const STAND_LEAGUE_2F, 5, 9 - - newgroup - - map_const KANTO_EAST_ROUTE, 20, 9 - map_const KANTO, 30, 27 - map_const KANTO_CERULEAN_HOUSE, 5, 4 - map_const KANTO_POKECENTER_1F, 8, 4 - map_const KANTO_POKECENTER_2F, 8, 4 - map_const KANTO_LEAGUE_1F, 4, 8 - map_const KANTO_LEAGUE_2F, 5, 9 - map_const KANTO_LAVENDER_HOUSE, 5, 4 - map_const KANTO_CELADON_MART_1F, 8, 4 - map_const KANTO_CELADON_MART_2F, 8, 4 - map_const KANTO_CELADON_MART_3F, 8, 4 - map_const KANTO_CELADON_MART_4F, 8, 4 - map_const KANTO_CELADON_MART_5F, 8, 4 - map_const KANTO_CELADON_ELEVATOR, 2, 2 - map_const KANTO_MART, 8, 4 - map_const KANTO_GAMEFREAK_HQ_1, 4, 6 - map_const KANTO_GAMEFREAK_HQ_2, 4, 6 - map_const KANTO_GAMEFREAK_HQ_3, 4, 6 - map_const KANTO_GAMEFREAK_HQ_4, 4, 6 - map_const KANTO_GAMEFREAK_HQ_5, 4, 4 - map_const KANTO_SILPH_CO, 12, 8 - map_const KANTO_VIRIDIAN_HOUSE, 5, 4 - map_const KANTO_GAME_CORNER, 10, 7 - map_const KANTO_UNUSED_AREA, 4, 4 - map_const KANTO_GAME_CORNER_PRIZES, 5, 4 - map_const KANTO_DINER, 5, 4 - map_const KANTO_SCHOOL, 4, 8 - map_const KANTO_HOSPITAL, 8, 4 - map_const KANTO_POKECENTER_2_1F, 8, 4 - map_const KANTO_POKECENTER_2_2F, 8, 4 - map_const KANTO_REDS_HOUSE, 5, 4 - map_const KANTO_GREENS_HOUSE_1F, 4, 4 - map_const KANTO_GREENS_HOUSE_2F, 4, 4 - map_const KANTO_ELDERS_HOUSE, 5, 4 - map_const KANTO_OAKS_LAB, 4, 4 - map_const KANTO_LEAGUE_2_1F, 4, 8 - map_const KANTO_LEAGUE_2_2F, 5, 9 - map_const KANTO_FISHING_GURU, 5, 4 - - newgroup - - map_const PRINCE_ROUTE, 10, 5 - map_const PRINCE, 10, 9 - - newgroup - - map_const MT_FUJI_ROUTE, 10, 5 - map_const MT_FUJI, 10, 9 - - newgroup - - map_const SOUTH, 20, 18 - map_const SOUTH_HOUSE_1, 5, 4 - map_const SOUTH_POKECENTER_1F, 8, 4 - map_const SOUTH_POKECENTER_2F, 8, 4 - map_const SOUTH_MART, 8, 4 - map_const SOUTH_HOUSE_2, 5, 4 - - newgroup - - map_const NORTH, 10, 9 - map_const NORTH_HOUSE_1, 5, 4 - map_const NORTH_MART, 6, 4 - map_const NORTH_HOUSE_2, 5, 4 - map_const NORTH_POKECENTER_1F, 8, 4 - map_const NORTH_POKECENTER_2F, 8, 4 - - newgroup - - map_const POWER_PLANT_1, 10, 9 - map_const POWER_PLANT_2, 10, 9 - map_const POWER_PLANT_3, 15, 18 - map_const POWER_PLANT_4, 15, 18 - map_const RUINS_OF_ALPH_ENTRANCE, 10, 9 - map_const RUINS_OF_ALPH_MAIN, 25, 27 - map_const CAVE_MINECARTS_1, 20, 18 - map_const CAVE_MINECARTS_2, 20, 18 - map_const CAVE_MINECARTS_3, 20, 18 - map_const CAVE_MINECARTS_4, 20, 18 - map_const CAVE_MINECARTS_5, 20, 18 - map_const CAVE_MINECARTS_6, 10, 18 - map_const CAVE_MINECARTS_7, 10, 18 - map_const OFFICE_1, 10, 9 - map_const OFFICE_2, 15, 18 - map_const OFFICE_3, 10, 18 - map_const SLOWPOKE_WELL_ENTRANCE, 10, 9 - map_const SLOWPOKE_WELL_MAIN, 10, 18 + newgroup ; 5 + + map_const FONTO_ROUTE_1, 35, 9 ; 1 + map_const FONTO_ROUTE_2, 10, 18 ; 2 + map_const FONTO_ROUTE_3, 25, 9 ; 3 + map_const FONTO_ROUTE_4, 10, 18 ; 4 + map_const FONTO_ROUTE_5, 10, 18 ; 5 + map_const FONTO_ROUTE_6, 35, 9 ; 6 + map_const FONTO, 10, 9 ; 7 + map_const FONTO_ROUTE_GATE_1, 5, 4 ; 8 + map_const FONTO_ROUTE_GATE_2, 5, 4 ; 9 + map_const FONTO_ROUTE_GATE_3, 5, 4 ; 10 + map_const FONTO_ROCKET_HOUSE, 8, 4 ; 11 + map_const FONTO_MART, 8, 4 ; 12 + map_const FONTO_HOUSE, 5, 4 ; 13 + map_const FONTO_POKECENTER_1F, 8, 4 ; 14 + map_const FONTO_POKECENTER_2F, 8, 4 ; 15 + map_const FONTO_LAB, 5, 4 ; 16 + + newgroup ; 6 + + map_const BAADON_ROUTE_1, 10, 27 ; 1 + map_const BAADON_ROUTE_2, 50, 9 ; 2 + map_const BAADON_ROUTE_3, 10, 18 ; 3 + map_const BAADON, 10, 9 ; 4 + map_const BAADON_ROUTE_GATE_WEST, 5, 4 ; 5 + map_const BAADON_ROUTE_GATE_NEWTYPE, 5, 4 ; 6 + map_const BAADON_MART, 8, 4 ; 7 + map_const BAADON_POKECENTER_1F, 8, 4 ; 8 + map_const BAADON_POKECENTER_2F, 8, 4 ; 9 + map_const BAADON_HOUSE_1, 4, 4 ; 10 + map_const BAADON_WALLPAPER_HOUSE, 4, 4 ; 11 + map_const BAADON_HOUSE_2, 5, 4 ; 12 + map_const BAADON_LEAGUE_1F, 4, 8 ; 13 + map_const BAADON_LEAGUE_2F, 5, 9 ; 14 + + newgroup ; 7 + + map_const ROUTE_15, 15, 9 ; 1 + map_const NEWTYPE_ROUTE, 15, 9 ; 2 + map_const ROUTE_18, 10, 45 ; 3 + map_const NEWTYPE, 20, 18 ; 4 + map_const ROUTE_15_POKECENTER_1F, 8, 4 ; 5 + map_const ROUTE_15_POKECENTER_2F, 8, 4 ; 6 + map_const NEWTYPE_ROUTE_GATE, 5, 4 ; 7 + map_const ROUTE_18_POKECENTER_1F, 8, 4 ; 8 + map_const ROUTE_18_POKECENTER_2F, 8, 4 ; 9 + map_const NEWTYPE_POKECENTER_1F, 8, 4 ; 10 + map_const NEWTYPE_POKECENTER_2F, 8, 4 ; 11 + map_const NEWTYPE_LEAGUE_1F, 4, 8 ; 12 + map_const NEWTYPE_LEAGUE_2F, 5, 9 ; 13 + map_const NEWTYPE_SAILOR_HOUSE, 5, 4 ; 14 + map_const NEWTYPE_MART, 8, 4 ; 15 + map_const NEWTYPE_DOJO, 4, 8 ; 16 + map_const NEWTYPE_HOUSE_1, 5, 4 ; 17 + map_const NEWTYPE_DINER, 4, 4 ; 18 + map_const NEWTYPE_HOUSE_2, 5, 4 ; 19 + map_const NEWTYPE_HOUSE_3, 5, 4 ; 20 + + newgroup ; 8 + + map_const SUGAR_ROUTE, 10, 27 ; 1 + map_const SUGAR, 10, 9 ; 2 + map_const SUGAR_ROUTE_GATE, 5, 4 ; 3 + map_const SUGAR_HOUSE, 4, 8 ; 4 + map_const SUGAR_HOUSE_2, 4, 4 ; 5 + map_const SUGAR_MART, 8, 4 ; 6 + map_const SUGAR_POKECENTER_1F, 8, 4 ; 7 + map_const SUGAR_POKECENTER_2F, 8, 4 ; 8 + + newgroup ; 9 + + map_const BULL_FOREST_ROUTE_1, 25, 9 ; 1 + map_const BULL_FOREST_ROUTE_2, 10, 27 ; 2 + map_const BULL_FOREST_ROUTE_3, 10, 27 ; 3 + map_const BULL_FOREST, 20, 18 ; 4 + map_const BULL_FOREST_ROUTE_1_HOUSE, 5, 4 ; 5 + map_const BULL_FOREST_ROUTE_GATE_STAND, 5, 4 ; 6 + map_const BULL_MART, 8, 4 ; 7 + map_const BULL_HOUSE_1, 4, 4 ; 8 + map_const BULL_HOUSE_2, 5, 4 ; 9 + map_const BULL_HOUSE_3, 5, 4 ; 10 + map_const BULL_POKECENTER_1F, 8, 4 ; 11 + map_const BULL_POKECENTER_2F, 8, 4 ; 12 + map_const BULL_LEAGUE_1F, 4, 8 ; 13 + map_const BULL_LEAGUE_2F, 5, 9 ; 14 + map_const BULL_HOUSE_4, 5, 4 ; 15 + + newgroup ; 10 + + map_const STAND_ROUTE, 10, 27 ; 1 + map_const STAND, 20, 18 ; 2 + map_const STAND_ROUTE_GATE_KANTO, 5, 4 ; 3 + map_const STAND_LAB, 4, 4 ; 4 + map_const STAND_POKECENTER_1F, 8, 4 ; 5 + map_const STAND_POKECENTER_2F, 8, 4 ; 6 + map_const STAND_OFFICE, 8, 4 ; 7 + map_const STAND_MART, 8, 4 ; 8 + map_const STAND_HOUSE, 5, 4 ; 9 + map_const STAND_ROCKET_HOUSE_1F, 8, 4 ; 10 + map_const STAND_ROCKET_HOUSE_2F, 8, 4 ; 11 + map_const STAND_LEAGUE_1F, 4, 8 ; 12 + map_const STAND_LEAGUE_2F, 5, 9 ; 13 + + newgroup ; 11 + + map_const KANTO_EAST_ROUTE, 20, 9 ; 1 + map_const KANTO, 30, 27 ; 2 + map_const KANTO_CERULEAN_HOUSE, 5, 4 ; 3 + map_const KANTO_POKECENTER_1F, 8, 4 ; 4 + map_const KANTO_POKECENTER_2F, 8, 4 ; 5 + map_const KANTO_LEAGUE_1F, 4, 8 ; 6 + map_const KANTO_LEAGUE_2F, 5, 9 ; 7 + map_const KANTO_LAVENDER_HOUSE, 5, 4 ; 8 + map_const KANTO_CELADON_MART_1F, 8, 4 ; 9 + map_const KANTO_CELADON_MART_2F, 8, 4 ; 10 + map_const KANTO_CELADON_MART_3F, 8, 4 ; 11 + map_const KANTO_CELADON_MART_4F, 8, 4 ; 12 + map_const KANTO_CELADON_MART_5F, 8, 4 ; 13 + map_const KANTO_CELADON_ELEVATOR, 2, 2 ; 14 + map_const KANTO_MART, 8, 4 ; 15 + map_const KANTO_GAMEFREAK_HQ_1, 4, 6 ; 16 + map_const KANTO_GAMEFREAK_HQ_2, 4, 6 ; 17 + map_const KANTO_GAMEFREAK_HQ_3, 4, 6 ; 18 + map_const KANTO_GAMEFREAK_HQ_4, 4, 6 ; 19 + map_const KANTO_GAMEFREAK_HQ_5, 4, 4 ; 20 + map_const KANTO_SILPH_CO, 12, 8 ; 21 + map_const KANTO_VIRIDIAN_HOUSE, 5, 4 ; 22 + map_const KANTO_GAME_CORNER, 10, 7 ; 23 + map_const KANTO_UNUSED_AREA, 4, 4 ; 24 + map_const KANTO_GAME_CORNER_PRIZES, 5, 4 ; 25 + map_const KANTO_DINER, 5, 4 ; 26 + map_const KANTO_SCHOOL, 4, 8 ; 27 + map_const KANTO_HOSPITAL, 8, 4 ; 28 + map_const KANTO_POKECENTER_2_1F, 8, 4 ; 29 + map_const KANTO_POKECENTER_2_2F, 8, 4 ; 30 + map_const KANTO_REDS_HOUSE, 5, 4 ; 31 + map_const KANTO_GREENS_HOUSE_1F, 4, 4 ; 32 + map_const KANTO_GREENS_HOUSE_2F, 4, 4 ; 33 + map_const KANTO_ELDERS_HOUSE, 5, 4 ; 34 + map_const KANTO_OAKS_LAB, 4, 4 ; 35 + map_const KANTO_LEAGUE_2_1F, 4, 8 ; 36 + map_const KANTO_LEAGUE_2_2F, 5, 9 ; 37 + map_const KANTO_FISHING_GURU, 5, 4 ; 38 + + newgroup ; 12 + + map_const PRINCE_ROUTE, 10, 5 ; 1 + map_const PRINCE, 10, 9 ; 2 + + newgroup ; 13 + + map_const MT_FUJI_ROUTE, 10, 5 ; 1 + map_const MT_FUJI, 10, 9 ; 2 + + newgroup ; 14 + + map_const SOUTH, 20, 18 ; 1 + map_const SOUTH_HOUSE_1, 5, 4 ; 2 + map_const SOUTH_POKECENTER_1F, 8, 4 ; 3 + map_const SOUTH_POKECENTER_2F, 8, 4 ; 4 + map_const SOUTH_MART, 8, 4 ; 5 + map_const SOUTH_HOUSE_2, 5, 4 ; 6 + + newgroup ; 15 + + map_const NORTH, 10, 9 ; 1 + map_const NORTH_HOUSE_1, 5, 4 ; 2 + map_const NORTH_MART, 6, 4 ; 3 + map_const NORTH_HOUSE_2, 5, 4 ; 4 + map_const NORTH_POKECENTER_1F, 8, 4 ; 5 + map_const NORTH_POKECENTER_2F, 8, 4 ; 6 + + newgroup ; 16 + + map_const POWER_PLANT_1, 10, 9 ; 1 + map_const POWER_PLANT_2, 10, 9 ; 2 + map_const POWER_PLANT_3, 15, 18 ; 3 + map_const POWER_PLANT_4, 15, 18 ; 4 + map_const RUINS_OF_ALPH_ENTRANCE, 10, 9 ; 5 + map_const RUINS_OF_ALPH_MAIN, 25, 27 ; 6 + map_const CAVE_MINECARTS_1, 20, 18 ; 7 + map_const CAVE_MINECARTS_2, 20, 18 ; 8 + map_const CAVE_MINECARTS_3, 20, 18 ; 9 + map_const CAVE_MINECARTS_4, 20, 18 ; 10 + map_const CAVE_MINECARTS_5, 20, 18 ; 11 + map_const CAVE_MINECARTS_6, 10, 18 ; 12 + map_const CAVE_MINECARTS_7, 10, 18 ; 13 + map_const OFFICE_1, 10, 9 ; 14 + map_const OFFICE_2, 15, 18 ; 15 + map_const OFFICE_3, 10, 18 ; 16 + map_const SLOWPOKE_WELL_ENTRANCE, 10, 9 ; 17 + map_const SLOWPOKE_WELL_MAIN, 10, 18 ; 18 + +NUM_MAP_GROUPS EQU const_value ; 16 diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 8a60442..cc29753 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -1,3 +1,20 @@ +GROUP_N_A EQU -1 +MAP_N_A EQU -1 +GROUP_NONE EQU 0 +MAP_NONE EQU 0 + +; map struct members (see data/maps/maps.asm) + const_def + const MAP_MAPATTRIBUTES_BANK ; 0 + const MAP_TILESET ; 1 + const MAP_ENVIRONMENT ; 2 + const MAP_MAPATTRIBUTES ; 3 + const MAP_MAPATTRIBUTES_HI ; 4 + const MAP_LOCATION ; 5 + const MAP_MUSIC ; 6 + const MAP_PALETTE ; 7 + const MAP_FISHGROUP ; 8 + ; map environments (wEnvironment) const_def 1 const TOWN @@ -8,6 +25,32 @@ const GATE const DUNGEON +; map palettes (wEnvironment) + const_def + const PALETTE_AUTO + const PALETTE_DAY + const PALETTE_NITE + const PALETTE_MORN + const PALETTE_DARK +NUM_MAP_PALETTES EQU const_value + +; FishGroups indexes (see data/wild/fish.asm) + const_def + const FISHGROUP_NONE + const FISHGROUP_SHORE + const FISHGROUP_OCEAN + const FISHGROUP_LAKE + const FISHGROUP_POND + const FISHGROUP_DRATINI + const FISHGROUP_QWILFISH_SWARM + const FISHGROUP_REMORAID_SWARM + const FISHGROUP_GYARADOS + const FISHGROUP_DRATINI_2 + const FISHGROUP_WHIRL_ISLANDS + const FISHGROUP_QWILFISH + const FISHGROUP_REMORAID + const FISHGROUP_QWILFISH_NO_SWARM + ; connection directions (see data/maps/data.asm) const_def const EAST_F @@ -25,7 +68,6 @@ ; SpawnPoints indexes (see data/maps/spawn_points.asm) const_value = -1 const SPAWN_N_A - NUM_SPAWNS EQU 18 ; size of each spawn point data diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 81c52a3..e6f7b02 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -32,11 +32,12 @@ OBJECT_1E rb 1 ; 1e OBJECT_1F rb 1 ; 1f OBJECT_RANGE rb 1 ; 20 OBJECT_DATA rb 7 ; 21 -OBJECT_LENGTH SET _RS +OBJECT_LENGTH EQU _RS +NUM_OBJECT_STRUCTS EQU 10 rsreset CMDQUEUE_UNK0 rb 16 -CMDQUEUE_ENTRY_SIZE SET _RS +CMDQUEUE_ENTRY_SIZE EQU _RS rsreset MAPOBJECT_OBJECT_STRUCT_ID rb 1 ; 0 @@ -54,7 +55,7 @@ MAPOBJECT_POINTER_HI rb 1 ; b MAPOBJECT_EVENT_FLAG rw 1 MAPOBJECT_E rb 1 ; unused MAPOBJECT_F rb 1 ; unused -MAP_OBJECT_LENGTH SET _RS +MAP_OBJECT_LENGTH EQU _RS rsreset MAPOBJECTTEMPLATE_SPRITE rb 1 ; 0 @@ -69,8 +70,7 @@ MAPOBJECTTEMPLATE_RANGE rb 1 ; 8 MAPOBJECTTEMPLATE_SCRIPT_POINTER rb 1 ; 9 MAPOBJECTTEMPLATE_POINTER_HI rb 1 ; a MAPOBJECTTEMPLATE_EVENT_FLAG rw 1 ; b -MAP_OBJECT_TEMPLATE_LENGTH SET _RS +MAP_OBJECT_TEMPLATE_LENGTH EQU _RS PLAYER_OBJECT_INDEX EQU 1 COMPANION_OBJECT_INDEX EQU 2 -NUM_OBJECT_STRUCTS EQU 10 diff --git a/constants/map_setup_constants.asm b/constants/map_setup_constants.asm index 7357058..6b65638 100644 --- a/constants/map_setup_constants.asm +++ b/constants/map_setup_constants.asm @@ -1,10 +1,9 @@ - const_def $f1 - const MAPSETUP_CONTINUE ; $f1 - const MAPSETUP_F2 - const MAPSETUP_RELOADMAP ; $f3 - const MAPSETUP_TELEPORT ; $f4 - const MAPSETUP_F5 ; Note: entry is duplicate of $F4 - const MAPSETUP_WARP ; $f6 - const MAPSETUP_CONNECTION ; $f7 - const MAPSETUP_F8 + const MAPSETUP_CONTINUE ; f1 + const_skip + const MAPSETUP_RELOADMAP ; f3 + const MAPSETUP_TELEPORT ; f4 + const_skip + const MAPSETUP_WARP ; f6 + const MAPSETUP_CONNECTION ; f7 + const_skip diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index b536ecf..0cc7ce3 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -1,28 +1,3 @@ -; joypad - - const_def - const A_BUTTON_F - const B_BUTTON_F - const SELECT_F - const START_F - const D_RIGHT_F - const D_LEFT_F - const D_UP_F - const D_DOWN_F - -NO_INPUT EQU %00000000 -A_BUTTON EQU 1 << A_BUTTON_F -B_BUTTON EQU 1 << B_BUTTON_F -SELECT EQU 1 << SELECT_F -START EQU 1 << START_F -D_RIGHT EQU 1 << D_RIGHT_F -D_LEFT EQU 1 << D_LEFT_F -D_UP EQU 1 << D_UP_F -D_DOWN EQU 1 << D_DOWN_F - -BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START -D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN - ; Boolean values FALSE EQU 0 TRUE EQU 1 diff --git a/constants/move_constants.asm b/constants/move_constants.asm index c21936f..f7693ae 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -1,4 +1,4 @@ -; Move IDs +; move ids const_def const MOVE_NONE ; 00 const MOVE_POUND ; 01 @@ -252,7 +252,7 @@ const MOVE_BRIGHT_MOSS ; f9 *ROCK_SMASH const MOVE_WHIRLPOOL ; fa const MOVE_BOUNCE ; fb *BEAT_UP -NUM_ATTACKS EQU const_value + -1 +NUM_ATTACKS EQU const_value - 1 const MOVE_OR_ANIM_FC ; fc const MOVE_OR_ANIM_FD ; fd diff --git a/constants/music_constants.asm b/constants/music_constants.asm index acb47eb..e926a78 100755 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -1,5 +1,5 @@ +; song ids const_def - const MUSIC_NONE ; 00 const MUSIC_TITLE ; 01 const MUSIC_ROUTE_1 ; 02 diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index d95e499..944800c 100644 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -1,9 +1,12 @@ +__trainer_class__ = 0 + trainerclass: MACRO - enum \1 +\1 EQU __trainer_class__ +__trainer_class__ = __trainer_class__ + 1 const_value = 1 ENDM - enum_start +; trainer class ids trainerclass TRAINER_NONE ; 00 trainerclass TRAINER_HAYATO ; 01 @@ -142,4 +145,4 @@ ENDM trainerclass TRAINER_ELITE_FOUR_F ; 40 -NUM_TRAINER_CLASSES EQU __enum__ +NUM_TRAINER_CLASSES EQU __trainer_class__ diff --git a/data/pokemon/base_stats.asm b/data/pokemon/base_stats.asm index 2042c7b..c28f1c7 100644 --- a/data/pokemon/base_stats.asm +++ b/data/pokemon/base_stats.asm @@ -8,7 +8,7 @@ tms1 = 0 ; TM01-TM24 (24) tms2 = 0 ; TM25-TM48 (24) tms3 = 0 ; TM49-TM50 + HM01-HM07 (9) rept _NARG - if 0 < \1 && \1 <= (NUM_TMS_HMS + 7) / 8 * 8 + if 0 < \1 && \1 <= (NUM_TM_HM + 7) / 8 * 8 if \1 < 24 + 1 tms1 = tms1 | (1 << ((\1) - 1)) elif \1 < 48 + 1 diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index 78417e2..3ecf4e2 100755 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -712,7 +712,7 @@ ItemAttr_ReturnCarry: GetItemPrice: push hl push bc - ld a, ITEMATTR_PRICE + ld a, ITEMATTR_PRICE_LO call GetItemAttr ld e, a ld a, ITEMATTR_PRICE_HI diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 356a237..7034904 100644 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -1,5 +1,18 @@ INCLUDE "constants.asm" + const_def + const M_NEW_GAME + const M_CONTINUE + const M_PLAY_GAME + const M_SET_TIME + + const_def + const CONTINUE + const NEW_GAME + const OPTION + const PLAY_POKEMON + const SET_TIME + SECTION "engine/menu/main_menu.asm@Initialize new game WRAM", ROMX ; TODO: Move this to another file when surrounding ; functions have been disassembled. diff --git a/macros/const.asm b/macros/const.asm new file mode 100644 index 0000000..5dfc3bc --- /dev/null +++ b/macros/const.asm @@ -0,0 +1,40 @@ +; Enumerate constants + +const_def: MACRO +if _NARG >= 1 +const_value = \1 +else +const_value = 0 +endc +if _NARG >= 2 +const_inc = \2 +else +const_inc = 1 +endc +ENDM + +const: MACRO +\1 EQU const_value +const_value = const_value + const_inc +ENDM + +shift_const: MACRO +\1 EQU (1 << const_value) +const_value = const_value + const_inc +ENDM + +const_skip: MACRO +if _NARG >= 1 +const_value = const_value + const_inc * (\1) +else +const_value = const_value + const_inc +endc +ENDM + +const_next: MACRO +if (const_value > 0 && \1 < const_value) || (const_value < 0 && \1 > const_value) +fail "const_next cannot go backwards from {const_value} to \1" +else +const_value = \1 +endc +ENDM diff --git a/macros/data.asm b/macros/data.asm index 241e52a..0c3723a 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -52,7 +52,7 @@ dx: MACRO x = 8 * ((\1) - 1) rept \1 db LOW((\2) >> x) -x = x + -8 +x = x - 8 endr ENDM diff --git a/macros/enum.asm b/macros/enum.asm deleted file mode 100644 index 385aee6..0000000 --- a/macros/enum.asm +++ /dev/null @@ -1,53 +0,0 @@ -; Enumerate variables - -enum_start: MACRO -if _NARG >= 1 -__enum__ = \1 -else -__enum__ = 0 -endc -if _NARG >= 2 -__enumdir__ = \2 -else -__enumdir__ = +1 -endc -ENDM - -enum: MACRO -\1 = __enum__ -__enum__ = __enum__ + __enumdir__ -ENDM - -enum_set: MACRO -__enum__ = \1 -ENDM - - -; Enumerate constants - -const_def: MACRO -if _NARG >= 1 -const_value = \1 -else -const_value = 0 -endc -ENDM - -const: MACRO -\1 EQU const_value -const_value = const_value + 1 -ENDM - -shift_const: MACRO -\1 EQU (1 << const_value) -const_value = const_value + 1 -ENDM - - -; Enumerate strings - -define: MACRO -if !DEF(\1) -\1 EQUS \2 -endc -ENDM diff --git a/macros/text.asm b/macros/text.asm index 4ce8d43..a734df7 100644 --- a/macros/text.asm +++ b/macros/text.asm @@ -5,130 +5,132 @@ para EQUS "db \"<PARA>\"," ; Start a new paragraph. cont EQUS "db \"<CONT>\"," ; Scroll to the next line. done EQUS "db \"<DONE>\"" ; End a text box. prompt EQUS "db \"<PROMPT>\"" ; Prompt the player to end a text box (initiating some other event). -text_end EQUS "db $50" ; End control code for text processor (different from "@") -; TODO: determine if these are in -; Pokedex text commands are only used with pokered. -; They are included for compatibility. -page EQUS "db $50," ; Start a new Pokedex page. -dex EQUS "db $e8, $50" ; End a Pokedex entry. +; TextCommands indexes (see home/text.asm) + const_def 1 - enum_start 1 - enum TX_RAM ; $01 + const TX_RAM ; $01 text_from_ram: MACRO db TX_RAM dw \1 ; address - ENDM +endm - enum TX_BCD ; $02 + const TX_BCD ; $02 text_bcd: macro db TX_BCD dw \1 ; address db \2 ; flags + digits, see PrintBCDNumber - ENDM +endm - enum TX_MOVE ; $03 + const TX_MOVE ; $03 text_move: macro db TX_MOVE dw \1 ; address - ENDM +endm - enum TX_BOX ; $04 + const TX_BOX ; $04 text_box: macro db TX_BOX dw \1 ; address db \2, \3 ; width, height - ENDM +endm - enum TX_LOW ; $05 + const TX_LOW ; $05 text_low: macro db TX_LOW - endm +endm - enum WAIT_BUTTON ; $06 + const WAIT_BUTTON ; $06 text_waitbutton: macro db WAIT_BUTTON - endm +endm - enum TX_SCROLL ; $07 + const TX_SCROLL ; $07 text_scroll: macro db TX_SCROLL - endm +endm - enum START_ASM ; $08 + const START_ASM ; $08 start_asm: macro db START_ASM - endm +endm - enum TX_NUM ; $09 + const TX_NUM ; $09 deciram: macro db TX_NUM dw \1 ; address dn \2, \3 ; bytes, flags + digits - endm +endm - enum TX_EXIT ; $0a + const TX_EXIT ; $0a text_exit: macro db TX_EXIT - endm +endm - enum TX_SOUND_0B ; $0b + const TX_SOUND_0B ; $0b sound_dex_fanfare_50_79: macro db TX_SOUND_0B - endm +endm - enum TX_DOTS ; $0c + const TX_DOTS ; $0c text_dots: macro db TX_DOTS db \1 - endm +endm - enum TX_LINK_WAIT_BUTTON ; $0d + const TX_LINK_WAIT_BUTTON ; $0d link_wait_button: macro db TX_LINK_WAIT_BUTTON - endm +endm - enum TX_SOUND_0E ; $0e + const TX_SOUND_0E ; $0e sound_dex_fanfare_20_49: macro db TX_SOUND_0E - endm +endm - enum TX_SOUND_0F ; $0f + const TX_SOUND_0F ; $0f sound_item: macro db TX_SOUND_0F - endm +endm - enum TX_SOUND_10 ; $10 + const TX_SOUND_10 ; $10 sound_caught_mon: macro db TX_SOUND_10 - endm +endm - enum TX_SOUND_11 ; $11 + const TX_SOUND_11 ; $11 sound_dex_fanfare_80_109: macro db TX_SOUND_11 - endm +endm - enum TX_SOUND_12 ; $12 + const TX_SOUND_12 ; $12 sound_fanfare: macro db TX_SOUND_12 - endm +endm - enum TX_SOUND_13 ; $13 + const TX_SOUND_13 ; $13 sound_slot_machine_start: macro db TX_SOUND_13 - endm +endm - enum TX_CRY_14 ; $14 + const TX_CRY_14 ; $14 cry_nidorina: macro db TX_CRY_14 - endm +endm - enum TX_CRY_15 ; $15 + const TX_CRY_15 ; $15 cry_pigeot: macro db TX_CRY_15 - endm +endm - enum TX_CRY_16 ; $16 + const TX_CRY_16 ; $16 cry_jugon: macro db TX_CRY_16 - endm +endm + + const_next $50 + + const TX_END ; $50 +text_end: macro + db TX_END +endm |