2012-05-24 02:05:19 +00:00
|
|
|
_CRYSTAL EQU 1
|
|
|
|
|
2013-07-04 07:55:04 +00:00
|
|
|
if _CRYSTAL
|
|
|
|
VERSION EQU 0
|
|
|
|
else
|
|
|
|
VERSION EQU 1
|
|
|
|
endc
|
|
|
|
|
2013-06-18 01:16:16 +00:00
|
|
|
INCLUDE "constants/pokemon_constants.asm"
|
|
|
|
INCLUDE "constants/move_constants.asm"
|
|
|
|
INCLUDE "constants/battle_constants.asm"
|
|
|
|
INCLUDE "constants/map_constants.asm"
|
|
|
|
INCLUDE "constants/item_constants.asm"
|
|
|
|
INCLUDE "constants/trainer_constants.asm"
|
|
|
|
INCLUDE "constants/script_constants.asm"
|
2013-08-24 01:19:58 +00:00
|
|
|
INCLUDE "constants/event_flags.asm"
|
2013-08-27 18:12:05 +00:00
|
|
|
INCLUDE "constants/engine_flags.asm"
|
2013-06-18 01:16:16 +00:00
|
|
|
INCLUDE "constants/music_constants.asm"
|
2013-06-11 01:56:34 +00:00
|
|
|
|
|
|
|
|
2013-07-04 19:42:01 +00:00
|
|
|
; macros require rst vectors to be defined
|
2013-01-25 08:42:39 +00:00
|
|
|
FarCall EQU $08
|
|
|
|
Bankswitch EQU $10
|
2013-07-04 19:42:01 +00:00
|
|
|
JumpTable EQU $28
|
2013-01-25 08:42:39 +00:00
|
|
|
|
2013-06-11 01:56:34 +00:00
|
|
|
|
2012-09-22 23:27:57 +00:00
|
|
|
dwb: MACRO
|
|
|
|
dw \1
|
|
|
|
db \2
|
|
|
|
ENDM
|
|
|
|
|
2013-01-14 16:02:11 +00:00
|
|
|
dbw: MACRO
|
|
|
|
db \1
|
|
|
|
dw \2
|
|
|
|
ENDM
|
|
|
|
|
2012-10-09 18:54:39 +00:00
|
|
|
dn: MACRO
|
|
|
|
db \1 << 4 + \2
|
|
|
|
ENDM
|
|
|
|
|
2013-08-17 02:35:31 +00:00
|
|
|
dt: MACRO ; three-byte (big-endian)
|
|
|
|
db (\1 >> 16) & $ff
|
|
|
|
db (\1 >> 8) & $ff
|
|
|
|
db \1 & $ff
|
|
|
|
ENDM
|
|
|
|
|
2013-06-11 01:56:34 +00:00
|
|
|
bigdw: MACRO ; big-endian word
|
2012-11-03 04:45:14 +00:00
|
|
|
dw ((\1)/$100) + (((\1)&$ff)*$100)
|
|
|
|
ENDM
|
|
|
|
|
2013-06-11 01:56:34 +00:00
|
|
|
callab: MACRO ; address, bank
|
2012-09-26 19:43:48 +00:00
|
|
|
ld hl, \1
|
|
|
|
ld a, BANK(\1)
|
2013-01-25 08:42:39 +00:00
|
|
|
rst FarCall
|
2012-09-26 19:43:48 +00:00
|
|
|
ENDM
|
|
|
|
|
2013-06-11 01:56:34 +00:00
|
|
|
callba: MACRO ; bank, address
|
2012-09-26 19:43:48 +00:00
|
|
|
ld a, BANK(\1)
|
|
|
|
ld hl, \1
|
2013-01-25 08:42:39 +00:00
|
|
|
rst FarCall
|
2012-09-26 19:43:48 +00:00
|
|
|
ENDM
|
|
|
|
|
2013-01-11 01:31:06 +00:00
|
|
|
TX_RAM: MACRO
|
|
|
|
db 1
|
|
|
|
dw \1
|
2012-09-26 19:43:48 +00:00
|
|
|
ENDM
|
|
|
|
|
2012-07-15 02:16:04 +00:00
|
|
|
TX_FAR: MACRO
|
|
|
|
db $16
|
|
|
|
dw \1
|
|
|
|
db BANK(\1)
|
|
|
|
ENDM
|
|
|
|
|
2013-01-13 05:38:48 +00:00
|
|
|
RGB: MACRO
|
|
|
|
dw ((\3 << 10) | (\2 << 5) | (\1))
|
|
|
|
ENDM
|
|
|
|
|
2012-11-30 11:03:04 +00:00
|
|
|
note: MACRO
|
|
|
|
db \1
|
|
|
|
ENDM
|
|
|
|
|
2013-01-16 11:38:13 +00:00
|
|
|
; It's better to use *coord than FuncCoord.
|
|
|
|
FuncCoord: MACRO
|
|
|
|
Coord = $c4a0 + 20 * \2 + \1
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
bccoord: MACRO
|
2013-02-16 03:01:48 +00:00
|
|
|
FuncCoord \1, \2
|
|
|
|
ld bc, Coord
|
2013-01-16 11:38:13 +00:00
|
|
|
ENDM
|
|
|
|
|
|
|
|
decoord: MACRO
|
2013-02-16 03:01:48 +00:00
|
|
|
FuncCoord \1, \2
|
|
|
|
ld de, Coord
|
2013-01-16 11:38:13 +00:00
|
|
|
ENDM
|
|
|
|
|
|
|
|
hlcoord: MACRO
|
2013-02-16 03:01:48 +00:00
|
|
|
FuncCoord \1, \2
|
|
|
|
ld hl, Coord
|
2013-01-16 11:38:13 +00:00
|
|
|
ENDM
|
2012-11-30 11:03:04 +00:00
|
|
|
|
2013-02-16 03:01:48 +00:00
|
|
|
|
|
|
|
; pic animations
|
|
|
|
frame: MACRO
|
|
|
|
db \1
|
|
|
|
db \2
|
|
|
|
ENDM
|
|
|
|
setrepeat: MACRO
|
|
|
|
db $fe
|
|
|
|
db \1
|
|
|
|
ENDM
|
|
|
|
dorepeat: MACRO
|
|
|
|
db $fd
|
|
|
|
db \1
|
|
|
|
ENDM
|
|
|
|
endanim: MACRO
|
|
|
|
db $ff
|
|
|
|
ENDM
|
|
|
|
|
|
|
|
|
2013-02-05 02:10:34 +00:00
|
|
|
NONE EQU 0
|
|
|
|
|
2012-03-21 01:00:56 +00:00
|
|
|
|
2013-06-11 01:56:34 +00:00
|
|
|
; types
|
2012-03-21 04:03:03 +00:00
|
|
|
NORMAL EQU $00
|
|
|
|
FIGHTING EQU $01
|
|
|
|
FLYING EQU $02
|
|
|
|
POISON EQU $03
|
|
|
|
GROUND EQU $04
|
|
|
|
ROCK EQU $05
|
|
|
|
BUG EQU $07
|
|
|
|
GHOST EQU $08
|
|
|
|
STEEL EQU $09
|
2012-03-21 04:19:48 +00:00
|
|
|
CURSE_T EQU $13
|
2012-03-21 04:03:03 +00:00
|
|
|
FIRE EQU $14
|
|
|
|
WATER EQU $15
|
|
|
|
GRASS EQU $16
|
|
|
|
ELECTRIC EQU $17
|
|
|
|
PSYCHIC EQU $18
|
|
|
|
ICE EQU $19
|
|
|
|
DRAGON EQU $1A
|
|
|
|
DARK EQU $1B
|
2012-03-26 06:47:58 +00:00
|
|
|
|
2012-12-31 05:35:19 +00:00
|
|
|
; egg group constants
|
|
|
|
MONSTER EQU $01
|
|
|
|
AMPHIBIAN EQU $02
|
|
|
|
INSECT EQU $03
|
|
|
|
AVIAN EQU $04
|
|
|
|
FIELD EQU $05
|
|
|
|
FAIRY EQU $06
|
|
|
|
PLANT EQU $07
|
|
|
|
HUMANSHAPE EQU $08
|
|
|
|
INVERTEBRATE EQU $09
|
|
|
|
INANIMATE EQU $0A
|
|
|
|
AMORPHOUS EQU $0B
|
|
|
|
FISH EQU $0C
|
|
|
|
LADIES_MAN EQU $0D
|
|
|
|
REPTILE EQU $0E
|
|
|
|
NO_EGGS EQU $0F
|
|
|
|
|
2013-02-03 10:38:09 +00:00
|
|
|
; menu sprites
|
|
|
|
ICON_POLIWAG EQU $01
|
|
|
|
ICON_JIGGLYPUFF EQU $02
|
|
|
|
ICON_DIGLETT EQU $03
|
|
|
|
ICON_PIKACHU EQU $04
|
|
|
|
ICON_STARYU EQU $05
|
|
|
|
ICON_FISH EQU $06
|
|
|
|
ICON_BIRD EQU $07
|
|
|
|
ICON_MONSTER EQU $08
|
|
|
|
ICON_CLEFAIRY EQU $09
|
|
|
|
ICON_ODDISH EQU $0a
|
|
|
|
ICON_BUG EQU $0b
|
|
|
|
ICON_GHOST EQU $0c
|
|
|
|
ICON_LAPRAS EQU $0d
|
|
|
|
ICON_HUMANSHAPE EQU $0e
|
|
|
|
ICON_FOX EQU $0f
|
|
|
|
ICON_EQUINE EQU $10
|
|
|
|
ICON_SHELL EQU $11
|
|
|
|
ICON_BLOB EQU $12
|
|
|
|
ICON_SERPENT EQU $13
|
|
|
|
ICON_VOLTORB EQU $14
|
|
|
|
ICON_SQUIRTLE EQU $15
|
|
|
|
ICON_BULBASAUR EQU $16
|
|
|
|
ICON_CHARMANDER EQU $17
|
|
|
|
ICON_CATERPILLAR EQU $18
|
|
|
|
ICON_UNOWN EQU $19
|
|
|
|
ICON_GEODUDE EQU $1a
|
|
|
|
ICON_FIGHTER EQU $1b
|
|
|
|
ICON_EGG EQU $1c
|
|
|
|
ICON_JELLYFISH EQU $1d
|
|
|
|
ICON_MOTH EQU $1e
|
|
|
|
ICON_BAT EQU $1f
|
|
|
|
ICON_SNORLAX EQU $20
|
|
|
|
ICON_HO_OH EQU $21
|
|
|
|
ICON_LUGIA EQU $22
|
|
|
|
ICON_GYARADOS EQU $23
|
|
|
|
ICON_SLOWPOKE EQU $24
|
|
|
|
ICON_SUDOWOODO EQU $25
|
|
|
|
ICON_BIGMON EQU $26
|
|
|
|
|
2013-04-29 17:45:41 +00:00
|
|
|
|
2012-05-24 02:05:19 +00:00
|
|
|
; evolution types
|
|
|
|
EVOLVE_LEVEL EQU 1
|
|
|
|
EVOLVE_ITEM EQU 2
|
|
|
|
EVOLVE_TRADE EQU 3
|
|
|
|
EVOLVE_HAPPINESS EQU 4
|
|
|
|
EVOLVE_STAT EQU 5
|
|
|
|
|
2013-04-29 19:42:31 +00:00
|
|
|
BASE_HAPPINESS EQU 70
|
2012-05-24 02:05:19 +00:00
|
|
|
; happiness evolution triggers
|
2013-04-12 21:21:31 +00:00
|
|
|
HAPPINESS_TO_EVOLVE EQU 220
|
2012-05-24 02:05:19 +00:00
|
|
|
TR_ANYTIME EQU 1
|
|
|
|
TR_MORNDAY EQU 2
|
|
|
|
TR_NITE EQU 3
|
|
|
|
|
|
|
|
; stat evolution triggers
|
|
|
|
ATK_GT_DEF EQU 1
|
|
|
|
ATK_LT_DEF EQU 2
|
|
|
|
ATK_EQ_DEF EQU 3
|
2012-05-25 05:16:16 +00:00
|
|
|
|
|
|
|
|
2012-09-23 16:50:44 +00:00
|
|
|
; name length
|
|
|
|
PLAYER_NAME_LENGTH EQU 8
|
2012-10-09 06:32:05 +00:00
|
|
|
PKMN_NAME_LENGTH EQU 11
|
|
|
|
|
2012-11-24 03:11:55 +00:00
|
|
|
|
2013-01-11 07:18:34 +00:00
|
|
|
; predefs
|
2013-04-29 20:32:05 +00:00
|
|
|
PREDEF_FLAG EQU $03
|
2013-01-11 07:18:34 +00:00
|
|
|
PREDEF_FILLPP EQU $05
|
2013-04-08 06:15:08 +00:00
|
|
|
PREDEF_ADDPARTYMON EQU $06
|
2013-01-11 07:18:34 +00:00
|
|
|
PREDEF_FILLSTATS EQU $0C
|
2013-08-02 18:21:16 +00:00
|
|
|
PREDEF_PRINT_MOVE_DESCRIPTION EQU $11
|
|
|
|
PREDEF_UPDATE_PLAYER_HUD EQU $12
|
|
|
|
PREDEF_FILL_BOX EQU $13
|
|
|
|
PREDEF_UPDATE_ENEMY_HUD EQU $15
|
2013-08-24 08:09:32 +00:00
|
|
|
PREDEF_START_BATTLE EQU $16
|
2013-08-02 18:21:16 +00:00
|
|
|
PREDEF_FILL_IN_EXP_BAR EQU $17
|
2013-01-11 07:18:34 +00:00
|
|
|
PREDEF_FILLMOVES EQU $1B
|
2013-08-02 18:21:16 +00:00
|
|
|
PREDEF_GET_GENDER EQU $24
|
|
|
|
PREDEF_STATS_SCREEN EQU $25
|
2013-08-01 22:30:30 +00:00
|
|
|
PREDEF_DRAW_PLAYER_HP EQU $26
|
|
|
|
PREDEF_DRAW_ENEMY_HP EQU $27
|
2013-08-02 18:21:16 +00:00
|
|
|
PREDEF_GET_TYPE_NAME EQU $29
|
|
|
|
PREDEF_PRINT_MOVE_TYPE EQU $2A
|
|
|
|
PREDEF_PRINT_TYPE EQU $2B
|
|
|
|
PREDEF_GET_UNOWN_LETTER EQU $2D
|
|
|
|
PREDEF_LOAD_SGB_LAYOUT EQU $31
|
2013-08-15 10:06:50 +00:00
|
|
|
PREDEF_CHECK_CONTEST_MON EQU $33
|
2013-08-24 08:09:32 +00:00
|
|
|
PREDEF_BATTLE_TRANSITION EQU $34
|
2013-08-02 18:21:16 +00:00
|
|
|
PREDEF_PARTYMON_ITEM_NAME EQU $3B
|
2013-06-11 01:56:34 +00:00
|
|
|
PREDEF_DECOMPRESS EQU $40
|
2012-11-24 03:11:55 +00:00
|
|
|
|
|
|
|
|
2013-05-04 06:13:44 +00:00
|
|
|
; flag manipulation
|
|
|
|
RESET_FLAG EQU 0
|
|
|
|
SET_FLAG EQU 1
|
|
|
|
CHECK_FLAG EQU 2
|
|
|
|
|
|
|
|
|
2012-12-23 08:21:19 +00:00
|
|
|
; joypad
|
2013-02-20 04:57:07 +00:00
|
|
|
BUTTONS EQU %00010000
|
|
|
|
D_PAD EQU %00100000
|
|
|
|
|
|
|
|
NO_INPUT EQU %00000000
|
|
|
|
BUTTON_A EQU %00000001
|
|
|
|
BUTTON_B EQU %00000010
|
|
|
|
SELECT EQU %00000100
|
|
|
|
START EQU %00001000
|
|
|
|
D_RIGHT EQU %00010000
|
|
|
|
D_LEFT EQU %00100000
|
|
|
|
D_UP EQU %01000000
|
|
|
|
D_DOWN EQU %10000000
|
2012-12-23 08:21:19 +00:00
|
|
|
|
|
|
|
|
2013-08-01 22:30:30 +00:00
|
|
|
; screen
|
|
|
|
HP_BAR_LENGTH EQU 6
|
|
|
|
HP_BAR_LENGTH_PX EQU 48
|
|
|
|
EXP_BAR_LENGTH EQU 8
|
|
|
|
EXP_BAR_LENGTH_PX EQU 64
|
|
|
|
|
|
|
|
SCREEN_WIDTH EQU 20
|
|
|
|
SCREEN_HEIGHT EQU 18
|
|
|
|
SCREEN_WIDTH_PX EQU 160
|
|
|
|
SCREEN_HEIGHT_PX EQU 144
|
|
|
|
|
2013-09-01 01:12:23 +00:00
|
|
|
BG_MAP_WIDTH EQU 32
|
|
|
|
BG_MAP_HEIGHT EQU 32
|
|
|
|
|
2013-08-01 22:30:30 +00:00
|
|
|
TILE_WIDTH EQU 8
|
|
|
|
|
|
|
|
|
2013-06-27 04:34:49 +00:00
|
|
|
; movement
|
|
|
|
STEP_SLOW EQU 0
|
|
|
|
STEP_WALK EQU 1
|
|
|
|
STEP_BIKE EQU 2
|
|
|
|
STEP_LEDGE EQU 3
|
|
|
|
STEP_ICE EQU 4
|
|
|
|
STEP_TURN EQU 5
|
|
|
|
STEP_BACK_LEDGE EQU 6
|
|
|
|
STEP_WALK_IN_PLACE EQU 7
|
|
|
|
|
2013-01-23 20:27:48 +00:00
|
|
|
|