Merge pull request #636 from mid-kid/patch

Small cleanups
This commit is contained in:
Rangi 2019-05-25 13:54:29 -04:00 committed by GitHub
commit e8ddecd0eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 129 additions and 234 deletions

View File

@ -65,9 +65,9 @@ tools:
$(MAKE) -C tools/
$(crystal_obj): RGBASMFLAGS = -D _CRYSTAL
$(crystal11_obj): RGBASMFLAGS = -D _CRYSTAL -D _CRYSTAL11
$(crystal_au_obj): RGBASMFLAGS = -D _CRYSTAL -D _CRYSTAL11 -D _CRYSTAL_AU
$(crystal_obj): RGBASMFLAGS =
$(crystal11_obj): RGBASMFLAGS = -D _CRYSTAL11
$(crystal_au_obj): RGBASMFLAGS = -D _CRYSTAL11 -D _CRYSTAL_AU
# The dep rules have to be explicit or else missing files won't be reported.
# As a side effect, they're evaluated immediately instead of when the rule is invoked.

View File

@ -62,8 +62,8 @@ ENDM
; decorations:
; - DecorationAttributes (see data/decorations/attributes.asm)
; - DecorationIDs (see data/decorations/decorations.asm)
const_value = 1
__enum__ = 0
const_def 1
enum_start
; FindOwnedBeds.beds values (see engine/overworld/decorations.asm)
const BEDS
deco FEATHERY_BED
@ -121,7 +121,7 @@ __enum__ = 0
deco GEODUDE_DOLL
deco MACHOP_DOLL
deco TENTACOOL_DOLL
NUM_NON_TROPHY_DECOS = __enum__
NUM_NON_TROPHY_DECOS EQU __enum__
deco GOLD_TROPHY_DOLL
deco SILVER_TROPHY_DOLL
NUM_DECOS = __enum__
NUM_DECOS EQU __enum__

View File

@ -42,6 +42,7 @@ LCD_STAT EQU 1
TIMER EQU 2
SERIAL EQU 3
JOYPAD EQU 4
IE_DEFAULT EQU (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
; OAM attribute flags
OAM_TILE_BANK EQU 3

View File

@ -199,7 +199,7 @@
add_tm: MACRO
if !DEF(TM01)
TM01 = const_value
TM01 EQU const_value
enum_start 1
endc
define _\@_1, "TM_\1"
@ -260,11 +260,11 @@ ENDM
add_tm FIRE_PUNCH ; f0
add_tm FURY_CUTTER ; f1
add_tm NIGHTMARE ; f2
NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
NUM_TMS EQU const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
add_hm: MACRO
if !DEF(HM01)
HM01 = const_value
HM01 EQU const_value
endc
define _\@_1, "HM_\1"
const _\@_1
@ -278,7 +278,7 @@ ENDM
add_hm FLASH ; f7
add_hm WHIRLPOOL ; f8
add_hm WATERFALL ; f9
NUM_HMS = const_value - HM01
NUM_HMS EQU const_value - HM01
add_mt: MACRO
enum \1_TMNUM
@ -287,7 +287,7 @@ ENDM
add_mt FLAMETHROWER
add_mt THUNDERBOLT
add_mt ICE_BEAM
NUM_TM_HM_TUTOR = __enum__ + -1
NUM_TM_HM_TUTOR EQU __enum__ + -1
const ITEM_FA ; fa

View File

@ -118,11 +118,7 @@ EggMovePointers::
dw NoEggMoves
dw GoldeenEggMoves
dw NoEggMoves
if _CRYSTAL
dw NoEggMoves
else
dw StaryuEggMoves
endc
dw NoEggMoves
dw MrMimeEggMoves
dw ScytherEggMoves

View File

@ -17,9 +17,6 @@ BulbasaurEggMoves:
db LIGHT_SCREEN
db SKULL_BASH
db SAFEGUARD
if !_CRYSTAL
db CHARM
endc
db RAZOR_WIND
db PETAL_DANCE
db -1 ; end
@ -46,9 +43,6 @@ PidgeyEggMoves:
db PURSUIT
db FAINT_ATTACK
db FORESIGHT
if !_CRYSTAL
db STEEL_WING
endc
db -1 ; end
RattataEggMoves:
@ -73,9 +67,7 @@ EkansEggMoves:
db SLAM
db SPITE
db BEAT_UP
if _CRYSTAL
db CRUNCH
endc
db -1 ; end
SandshrewEggMoves:
@ -83,9 +75,7 @@ SandshrewEggMoves:
db SAFEGUARD
db COUNTER
db RAPID_SPIN
if _CRYSTAL
db METAL_CLAW
endc
db -1 ; end
NidoranFEggMoves:
@ -129,9 +119,6 @@ OddishEggMoves:
db RAZOR_LEAF
db FLAIL
db SYNTHESIS
if !_CRYSTAL
db CHARM
endc
db -1 ; end
ParasEggMoves:
@ -140,9 +127,6 @@ ParasEggMoves:
db COUNTER
db PSYBEAM
db FLAIL
if !_CRYSTAL
db SWEET_SCENT
endc
db LIGHT_SCREEN
db PURSUIT
db -1 ; end
@ -176,9 +160,7 @@ PsyduckEggMoves:
db LIGHT_SCREEN
db FUTURE_SIGHT
db PSYCHIC_M
if _CRYSTAL
db CROSS_CHOP
endc
db -1 ; end
MankeyEggMoves:
@ -257,9 +239,6 @@ SlowpokeEggMoves:
db -1 ; end
FarfetchDEggMoves:
if !_CRYSTAL
db STEEL_WING
endc
db FORESIGHT
db MIRROR_MOVE
db GUST
@ -337,9 +316,7 @@ CuboneEggMoves:
db SCREECH
db SKULL_BASH
db PERISH_SONG
if _CRYSTAL
db SWORDS_DANCE
endc
db -1 ; end
LickitungEggMoves:
@ -403,14 +380,6 @@ GoldeenEggMoves:
db HYDRO_PUMP
db -1 ; end
if !_CRYSTAL
StaryuEggMoves:
db AURORA_BEAM
db BARRIER
db SUPERSONIC
db -1 ; end
endc
MrMimeEggMoves:
db FUTURE_SIGHT
db HYPNOSIS
@ -461,16 +430,10 @@ AerodactylEggMoves:
db WHIRLWIND
db PURSUIT
db FORESIGHT
if !_CRYSTAL
db STEEL_WING
endc
db -1 ; end
SnorlaxEggMoves:
db LICK
if !_CRYSTAL
db CHARM
endc
db -1 ; end
DratiniEggMoves:
@ -495,9 +458,7 @@ CyndaquilEggMoves:
db REVERSAL
db THRASH
db FORESIGHT
if _CRYSTAL
db SUBMISSION
endc
db -1 ; end
TotodileEggMoves:
@ -523,9 +484,7 @@ HoothootEggMoves:
db FAINT_ATTACK
db WING_ATTACK
db WHIRLWIND
if _CRYSTAL
db SKY_ATTACK
endc
db -1 ; end
LedybaEggMoves:
@ -650,9 +609,7 @@ MurkrowEggMoves:
db QUICK_ATTACK
db MIRROR_MOVE
db WING_ATTACK
if _CRYSTAL
db SKY_ATTACK
endc
db -1 ; end
MisdreavusEggMoves:
@ -732,9 +689,7 @@ TeddiursaEggMoves:
db SEISMIC_TOSS
db FOCUS_ENERGY
db COUNTER
if _CRYSTAL
db METAL_CLAW
endc
db -1 ; end
SlugmaEggMoves:
@ -784,9 +739,7 @@ SkarmoryEggMoves:
db DRILL_PECK
db PURSUIT
db WHIRLWIND
if _CRYSTAL
db SKY_ATTACK
endc
db -1 ; end
HoundourEggMoves:
@ -803,9 +756,7 @@ PhanpyEggMoves:
db FOCUS_ENERGY
db BODY_SLAM
db ANCIENTPOWER
if _CRYSTAL
db WATER_GUN
endc
db -1 ; end
StantlerEggMoves:
@ -824,9 +775,6 @@ TyrogueEggMoves:
db -1 ; end
SmoochumEggMoves:
if !_CRYSTAL
db LOVELY_KISS
endc
db MEDITATE
db -1 ; end
@ -835,9 +783,7 @@ ElekidEggMoves:
db BARRIER
db ROLLING_KICK
db MEDITATE
if _CRYSTAL
db CROSS_CHOP
endc
db -1 ; end
MagbyEggMoves:
@ -845,9 +791,7 @@ MagbyEggMoves:
db MEGA_PUNCH
db BARRIER
db SCREECH
if _CRYSTAL
db CROSS_CHOP
endc
db -1 ; end
MiltankEggMoves:

View File

@ -670,9 +670,7 @@ DiglettEvosAttacks:
DugtrioEvosAttacks:
db 0 ; no more evolutions
if _CRYSTAL
db 1, TRI_ATTACK
endc
db 1, SCRATCH
db 1, GROWL
db 1, MAGNITUDE
@ -1115,11 +1113,7 @@ MagnetonEvosAttacks:
db 16, SONICBOOM
db 21, THUNDER_WAVE
db 27, LOCK_ON
if _CRYSTAL
db 35, TRI_ATTACK
else
db 35, SWIFT
endc
db 43, SCREECH
db 53, ZAP_CANNON
db 0 ; no more level-up moves
@ -1235,9 +1229,7 @@ CloysterEvosAttacks:
db 1, SUPERSONIC
db 1, AURORA_BEAM
db 1, PROTECT
if _CRYSTAL
db 33, SPIKES
endc
db 41, SPIKE_CANNON
db 0 ; no more level-up moves
@ -1814,11 +1806,7 @@ EeveeEvosAttacks:
db 16, GROWL
db 23, QUICK_ATTACK
db 30, BITE
if _CRYSTAL
db 36, BATON_PASS
else
db 36, FOCUS_ENERGY
endc
db 42, TAKE_DOWN
db 0 ; no more level-up moves
@ -2297,11 +2285,7 @@ SpinarakEvosAttacks:
db 23, LEECH_LIFE
db 30, FURY_SWIPES
db 37, SPIDER_WEB
if _CRYSTAL
db 45, AGILITY
else
db 45, SCREECH
endc
db 53, PSYCHIC_M
db 0 ; no more level-up moves
@ -2317,11 +2301,7 @@ AriadosEvosAttacks:
db 25, LEECH_LIFE
db 34, FURY_SWIPES
db 43, SPIDER_WEB
if _CRYSTAL
db 53, AGILITY
else
db 53, SCREECH
endc
db 63, PSYCHIC_M
db 0 ; no more level-up moves
@ -2544,11 +2524,7 @@ HoppipEvosAttacks:
db EVOLVE_LEVEL, 18, SKIPLOOM
db 0 ; no more evolutions
db 1, SPLASH
if _CRYSTAL
db 5, SYNTHESIS
else
db 1, SYNTHESIS
endc
db 5, TAIL_WHIP
db 10, TACKLE
db 13, POISONPOWDER
@ -2566,9 +2542,7 @@ SkiploomEvosAttacks:
db 1, SYNTHESIS
db 1, TAIL_WHIP
db 1, TACKLE
if _CRYSTAL
db 5, SYNTHESIS
endc
db 5, TAIL_WHIP
db 10, TACKLE
db 13, POISONPOWDER
@ -2585,9 +2559,7 @@ JumpluffEvosAttacks:
db 1, SYNTHESIS
db 1, TAIL_WHIP
db 1, TACKLE
if _CRYSTAL
db 5, SYNTHESIS
endc
db 5, TAIL_WHIP
db 10, TACKLE
db 13, POISONPOWDER
@ -2641,11 +2613,7 @@ YanmaEvosAttacks:
db 19, SONICBOOM
db 25, DETECT
db 31, SUPERSONIC
if _CRYSTAL
db 37, WING_ATTACK
else
db 37, SWIFT
endc
db 43, SCREECH
db 0 ; no more level-up moves
@ -2857,9 +2825,7 @@ GranbullEvosAttacks:
QwilfishEvosAttacks:
db 0 ; no more evolutions
if _CRYSTAL
db 1, SPIKES
endc
db 1, TACKLE
db 1, POISON_STING
db 10, HARDEN
@ -2919,9 +2885,7 @@ SneaselEvosAttacks:
db 41, AGILITY
db 49, SLASH
db 57, BEAT_UP
if _CRYSTAL
db 65, METAL_CLAW
endc
db 0 ; no more level-up moves
TeddiursaEvosAttacks:
@ -2989,9 +2953,7 @@ SwinubEvosAttacks:
db 28, TAKE_DOWN
db 37, MIST
db 46, BLIZZARD
if _CRYSTAL
db 55, AMNESIA
endc
db 0 ; no more level-up moves
PiloswineEvosAttacks:
@ -3005,9 +2967,7 @@ PiloswineEvosAttacks:
db 33, FURY_ATTACK
db 42, MIST
db 56, BLIZZARD
if _CRYSTAL
db 70, AMNESIA
endc
db 0 ; no more level-up moves
CorsolaEvosAttacks:
@ -3300,17 +3260,10 @@ SuicuneEvosAttacks:
db 0 ; no more evolutions
db 1, BITE
db 1, LEER
if _CRYSTAL
db 11, BUBBLEBEAM
db 21, RAIN_DANCE
db 31, GUST
db 41, AURORA_BEAM
else
db 11, WATER_GUN
db 21, ROAR
db 31, GUST
db 41, BUBBLEBEAM
endc
db 51, MIST
db 61, MIRROR_COAT
db 71, HYDRO_PUMP

View File

@ -332,7 +332,7 @@ Edit `GetMapMusic`:
add_tm PSYCHIC_M ; dd
...
add_tm NIGHTMARE ; f2
NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
NUM_TMS EQU const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
```
`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/items.asm) have to compensate for this.

View File

@ -3,14 +3,14 @@ MagnetTrain:
and a
jr nz, .ToGoldenrod
ld a, 1 ; forwards
lb bc, $40, $60
lb de, (11 * 8) - (11 * 8 + 4), -$60
lb bc, 8 * TILE_WIDTH, 12 * TILE_WIDTH
lb de, (11 * TILE_WIDTH) - (11 * TILE_WIDTH + 4), -12 * TILE_WIDTH
jr .continue
.ToGoldenrod:
ld a, -1 ; backwards
lb bc, -$40, -$60
lb de, (11 * 8) + (11 * 8 + 4), $60
lb bc, -8 * TILE_WIDTH, -12 * TILE_WIDTH
lb de, (11 * TILE_WIDTH) + (11 * TILE_WIDTH + 4), 12 * TILE_WIDTH
.continue
ld h, a
@ -34,11 +34,11 @@ MagnetTrain:
push af
ldh a, [hSCY]
push af
call MagntTrain_LoadGFX_PlayMusic
call MagnetTrain_LoadGFX_PlayMusic
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $1
ld [hl], 1
.loop
ld a, [wJumptableIndex]
and a
@ -84,18 +84,19 @@ MagnetTrain:
MagnetTrain_UpdateLYOverrides:
ld hl, wLYOverridesBackup
ld c, $2f
ld c, 6 * TILE_WIDTH - 1
ld a, [wMagnetTrainOffset]
add a
ldh [hSCX], a
call .loadloop
ld c, $30
ld c, 6 * TILE_WIDTH
ld a, [wMagnetTrainPosition]
call .loadloop
ld c, $31
ld c, 6 * TILE_WIDTH + 1
ld a, [wMagnetTrainOffset]
add a
call .loadloop
ld a, [wMagnetTrainDirection]
ld d, a
ld hl, wMagnetTrainOffset
@ -111,20 +112,22 @@ MagnetTrain_UpdateLYOverrides:
jr nz, .loadloop
ret
MagntTrain_LoadGFX_PlayMusic:
MagnetTrain_LoadGFX_PlayMusic:
call ClearBGPalettes
call ClearSprites
call DisableLCD
callfar ClearSpriteAnims
call SetMagnetTrainPals
call DrawMagnetTrain
ld a, $90
ld a, SCREEN_HEIGHT_PX
ldh [hWY], a
call EnableLCD
xor a
ldh [hBGMapMode], a
ldh [hSCX], a
ldh [hSCY], a
; Load the player sprite
ldh a, [rSVBK]
push af
ld a, BANK(wPlayerGender)
@ -135,6 +138,8 @@ MagntTrain_LoadGFX_PlayMusic:
ld hl, vTiles0
ld c, 4
call Request2bpp
; Load the trainer walking frame
ld hl, 12 tiles
add hl, de
ld d, h
@ -142,7 +147,9 @@ MagntTrain_LoadGFX_PlayMusic:
ld hl, vTiles0 tile $04
ld c, 4
call Request2bpp
call MagnetTrain_InitLYOverrides
ld hl, wJumptableIndex
xor a
ld [hli], a ; wJumptableIndex
@ -150,6 +157,7 @@ MagntTrain_LoadGFX_PlayMusic:
ld [hli], a ; wMagnetTrainOffset
ld [hli], a ; wMagnetTrainPosition
ld [hli], a ; wMagnetTrainWaitCounter
ld de, MUSIC_MAGNET_TRAIN
call PlayMusic2
ret
@ -159,25 +167,26 @@ DrawMagnetTrain:
xor a
.loop
call GetMagnetTrainBGTiles
ld b, 32 / 2
ld b, BG_MAP_WIDTH / 2
call .FillAlt
inc a
cp $12
cp SCREEN_HEIGHT
jr c, .loop
hlbgcoord 0, 6
ld de, MagnetTrainTilemap1
ld de, MagnetTrainTilemap
ld c, 20
call .FillLine
hlbgcoord 0, 7
ld de, MagnetTrainTilemap2
ld de, MagnetTrainTilemap + 20
ld c, 20
call .FillLine
hlbgcoord 0, 8
ld de, MagnetTrainTilemap3
ld de, MagnetTrainTilemap + (20 * 2)
ld c, 20
call .FillLine
hlbgcoord 0, 9
ld de, MagnetTrainTilemap4
ld de, MagnetTrainTilemap + (20 * 3)
ld c, 20
call .FillLine
ret
@ -247,7 +256,7 @@ MagnetTrain_InitLYOverrides:
ret
SetMagnetTrainPals:
ld a, $1
ld a, 1
ldh [rVBK], a
; bushes
@ -274,7 +283,7 @@ SetMagnetTrainPals:
ld a, PAL_BG_YELLOW
call ByteFill
ld a, $0
ld a, 0
ldh [rVBK], a
ret
@ -305,7 +314,7 @@ MagnetTrain_Jumptable:
ret
.InitPlayerSpriteAnim:
ld d, 10 * 8 + 5
ld d, (8 + 2) * TILE_WIDTH + 5
ld a, [wMagnetTrainPlayerSpriteInitX]
ld e, a
ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED
@ -317,7 +326,6 @@ MagnetTrain_Jumptable:
bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender
ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE
.got_gender
pop af
ldh [rSVBK], a
@ -325,9 +333,9 @@ MagnetTrain_Jumptable:
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $0
ld [hl], 0
call .Next
ld a, $80
ld a, 128
ld [wMagnetTrainWaitCounter], a
ret
@ -350,7 +358,7 @@ MagnetTrain_Jumptable:
.PrepareToHoldTrain:
call .Next
ld a, $80
ld a, 128
ld [wMagnetTrainWaitCounter], a
ret
@ -408,6 +416,7 @@ MagnetTrain_Jumptable_FirstRunThrough:
call MagnetTrain_UpdateLYOverrides
call PushLYOverrides
call DelayFrame
ldh a, [rSVBK]
push af
ld a, BANK(wEnvironment)
@ -416,20 +425,23 @@ MagnetTrain_Jumptable_FirstRunThrough:
push af
ld a, [wEnvironment]
push af
ld a, [wTimeOfDay]
maskbits NUM_DAYTIMES
ld [wTimeOfDayPal], a
ld a, $1
ld a, TOWN
ld [wEnvironment], a
ld b, SCGB_MAPPALS
call GetSGBLayout
call UpdateTimePals
ldh a, [rBGP]
ld [wBGP], a
ldh a, [rOBP0]
ld [wOBP0], a
ldh a, [rOBP1]
ld [wOBP1], a
pop af
ld [wEnvironment], a
pop af
@ -438,11 +450,8 @@ MagnetTrain_Jumptable_FirstRunThrough:
ldh [rSVBK], a
ret
MagnetTrainTilemap1:
MagnetTrainTilemap:
db $1f, $05, $06, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0b, $0c, $1f
MagnetTrainTilemap2:
db $14, $15, $16, $1a, $1a, $1a, $19, $1a, $1a, $1a, $1a, $1a, $1a, $19, $1a, $1a, $1a, $1b, $1c, $1d
MagnetTrainTilemap3:
db $24, $25, $26, $27, $07, $2f, $29, $28, $28, $28, $28, $28, $28, $29, $07, $2f, $2a, $2b, $2c, $2d
MagnetTrainTilemap4:
db $20, $1f, $2e, $1f, $17, $00, $2e, $1f, $1f, $1f, $1f, $1f, $1f, $2e, $17, $00, $1f, $2e, $1f, $0f

View File

@ -50,17 +50,17 @@ Gen2ToGen1LinkComms:
call DelayFrames
xor a
ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
call DelayFrame
xor a
ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
.player_1
@ -70,7 +70,7 @@ Gen2ToGen1LinkComms:
call DelayFrames
xor a
ldh [rIF], a
ld a, $8
ld a, 1 << SERIAL
ldh [rIE], a
ld hl, wd1f3
ld de, wEnemyMonSpecies
@ -90,7 +90,7 @@ Gen2ToGen1LinkComms:
call Serial_ExchangeBytes
xor a
ldh [rIF], a
ld a, $1d
ld a, (1 << JOYPAD) | (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ldh [rIE], a
call Link_CopyRandomNumbers
ld hl, wOTPlayerName
@ -194,17 +194,17 @@ Gen2ToGen2LinkComms:
call DelayFrames
xor a
ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
call DelayFrame
xor a
ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
.Player1:
@ -214,7 +214,7 @@ Gen2ToGen2LinkComms:
call DelayFrames
xor a
ldh [rIF], a
ld a, $8
ld a, 1 << SERIAL
ldh [rIE], a
ld hl, wd1f3
ld de, wEnemyMonSpecies
@ -243,7 +243,7 @@ Gen2ToGen2LinkComms:
.not_trading
xor a
ldh [rIF], a
ld a, $1d
ld a, (1 << JOYPAD) | (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ldh [rIE], a
ld de, MUSIC_NONE
call PlayMusic
@ -447,7 +447,7 @@ Gen2ToGen2LinkComms:
xor a
ldh [rIF], a
ldh a, [rIE]
set 1, a
set LCD_STAT, a
ldh [rIE], a
pop af
ldh [rIF], a
@ -1558,9 +1558,9 @@ Function28b22:
xor a
ldh [rSB], a
ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ret
@ -2104,18 +2104,18 @@ WaitForOtherPlayerToExit:
xor a
ldh [rSB], a
ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld c, 3
call DelayFrames
xor a
ldh [rSB], a
ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 0
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld c, 3
call DelayFrames
@ -2131,7 +2131,7 @@ WaitForOtherPlayerToExit:
push af
xor a
ldh [rIF], a
ld a, $f
ld a, IE_DEFAULT
ldh [rIE], a
pop af
ldh [rIF], a
@ -2160,9 +2160,9 @@ SetBitsForTimeCapsuleRequest:
ldh [rSB], a
xor a
ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 0
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
xor a ; LINK_TIMECAPSULE - 1
ld [wPlayerLinkAction], a
@ -2177,9 +2177,9 @@ WaitForLinkedFriend:
ldh [rSB], a
xor a
ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 0
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
call DelayFrame
call DelayFrame
@ -2202,9 +2202,9 @@ WaitForLinkedFriend:
ldh [rSB], a
xor a
ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 0
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, [wLinkTimeoutFrames]
dec a
@ -2218,9 +2218,9 @@ WaitForLinkedFriend:
.not_done
ld a, $1
ldh [rSB], a
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
call DelayFrame
jr .loop

View File

@ -434,7 +434,7 @@ Function104bd0:
xor a
ldh [rIF], a
ldh a, [rIE]
or $1
or 1 << VBLANK
ldh [rIE], a
ei
call DelayFrame
@ -559,7 +559,7 @@ Function104d1c:
xor a
ldh [rIF], a
ldh a, [rIE]
or $1
or 1 << VBLANK
ldh [rIE], a
ei
call DelayFrame
@ -600,7 +600,7 @@ Function104d56:
Function104d5e:
call Function104d74
ld a, $4
ld a, 1 << TIMER
ldh [rIE], a
xor a
ldh [rIF], a

View File

@ -145,9 +145,7 @@ ScriptCommandTable:
dw Script_loadmenu ; 4f
dw Script_closewindow ; 50
dw Script_jumptextfaceplayer ; 51
if _CRYSTAL
dw Script_farjumptext ; 52
endc
dw Script_jumptext ; 53
dw Script_waitbutton ; 54
dw Script_buttonsound ; 55
@ -330,8 +328,6 @@ JumpTextScript:
closetext
end
if _CRYSTAL
Script_farjumptext:
; script command 0x52
; parameters: text_pointer
@ -346,8 +342,6 @@ Script_farjumptext:
ld hl, JumpTextScript
jp ScriptJump
endc
Script_writetext:
; script command 0x4c
; parameters: text_pointer

View File

@ -56,7 +56,7 @@ PrintDexEntry:
push af
xor a
ldh [rIF], a
ld a, $9
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
call Printer_StartTransmission
@ -140,13 +140,13 @@ PrintPCBox:
push af
xor a
ldh [rIF], a
ld a, %1001
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], %0100
ld [hl], 4
xor a
ldh [hBGMapMode], a
@ -219,7 +219,7 @@ PrintUnownStamp:
push af
xor a
ldh [rIF], a
ld a, $9
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
@ -284,7 +284,7 @@ PrintMail:
push af
xor a
ldh [rIF], a
ld a, %1001
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
xor a
@ -326,7 +326,7 @@ PrintPartymon:
push af
xor a
ldh [rIF], a
ld a, %1001
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
xor a
@ -390,7 +390,7 @@ _PrintDiploma:
push af
xor a
ldh [rIF], a
ld a, %1001
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
@ -458,9 +458,9 @@ CheckCancelPrint:
ld [wPrinterOpcode], a
ld a, $88
ldh [rSB], a
ld a, $1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, $81
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
.loop2
ld a, [wPrinterOpcode]

View File

@ -279,9 +279,9 @@ Printer_WaitHandshake:
ld [wPrinterOpcode], a
ld a, $88
ldh [rSB], a
ld a, $1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, $81
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ret
@ -622,9 +622,9 @@ Printer_Send0x08:
Printer_SerialSend:
ldh [rSB], a
ld a, $1 ; switch to internal clock
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, $81 ; start transfer
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ret

View File

@ -32,11 +32,11 @@ AskSerial::
ldh [rSB], a
; switch to internal clock
ld a, %00000001
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
; start transfer
ld a, %10000001
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ret

View File

@ -6,7 +6,7 @@ Reset::
call ClearPalettes
xor a
ldh [rIF], a
ld a, 1 ; VBlank int
ld a, 1 << VBLANK
ldh [rIE], a
ei
@ -154,7 +154,7 @@ Init::
xor a
ldh [rIF], a
ld a, %1111 ; VBlank, LCDStat, Timer, Serial interrupts
ld a, IE_DEFAULT
ldh [rIE], a
ei

View File

@ -46,7 +46,7 @@ DisableLCD::
ld b, a
; Disable VBlank
res 0, a ; vblank
res VBLANK, a
ldh [rIE], a
.wait

View File

@ -28,9 +28,9 @@ Serial::
cp USING_INTERNAL_CLOCK
jr z, .player2
ld a, 0 << rSC_ON
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, 1 << rSC_ON
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
jr .player2
@ -65,9 +65,9 @@ Serial::
bit 7, a
jr nz, .wait_bit_7
ld a, 0 << rSC_ON
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, 1 << rSC_ON
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
jr .player2
@ -130,9 +130,9 @@ Serial_ExchangeByte::
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .not_player_2
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
.not_player_2
.loop2
@ -352,9 +352,9 @@ LinkTransfer::
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .player_1
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
.player_1
@ -382,9 +382,9 @@ LinkDataReceived::
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret nz
ld a, (0 << rSC_ON) | 1
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | 1
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ret
@ -396,8 +396,8 @@ Unreferenced_Function919::
ldh [rSB], a
xor a
ldh [hSerialReceive], a
ld a, 0 << rSC_ON
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ld a, 1 << rSC_ON
ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a
ret

View File

@ -196,13 +196,13 @@ VBlank1::
xor a
ldh [rIF], a
; enable lcd stat
ld a, %10 ; lcd stat
ld a, 1 << LCD_STAT
ldh [rIE], a
; rerequest serial int if applicable (still disabled)
; request lcd stat
ld a, b
and %1000 ; serial
or %10 ; lcd stat
and 1 << SERIAL
or 1 << LCD_STAT
ldh [rIF], a
ei
@ -220,7 +220,7 @@ VBlank1::
xor a
ldh [rIF], a
; enable ints besides joypad
ld a, %1111 ; serial timer lcdstat vblank
ld a, IE_DEFAULT
ldh [rIE], a
; rerequest ints
ld a, b
@ -279,7 +279,7 @@ VBlank3::
push af
xor a
ldh [rIF], a
ld a, %10 ; lcd stat
ld a, 1 << LCD_STAT
ldh [rIE], a
ldh [rIF], a
@ -302,7 +302,7 @@ VBlank3::
xor a
ldh [rIF], a
; enable ints besides joypad
ld a, %1111 ; serial timer lcdstat vblank
ld a, IE_DEFAULT
ldh [rIE], a
; request ints
ld a, b
@ -368,7 +368,7 @@ VBlank5::
xor a
ldh [rIF], a
ld a, %10 ; lcd stat
ld a, 1 << LCD_STAT
ldh [rIE], a
; request lcd stat
ldh [rIF], a
@ -384,7 +384,7 @@ VBlank5::
xor a
ldh [rIF], a
; enable ints besides joypad
ld a, %1111 ; serial timer lcdstat vblank
ld a, IE_DEFAULT
ldh [rIE], a
ret

View File

@ -605,7 +605,7 @@ Function11032c:
Function110393:
ld c, LOW(rIE)
ldh a, [c]
or $c
or (1 << SERIAL) | (1 << TIMER)
ldh [c], a
ret
@ -4101,9 +4101,9 @@ Function111b21:
Function111b2e:
ld hl, $c822
set 1, [hl]
ld a, $3
ld a, (0 << rSC_ON) | (1 << rSC_CGB) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, $83
ld a, (1 << rSC_ON) | (1 << rSC_CGB) | (1 << rSC_CLOCK)
ldh [rSC], a
Function111b3b:
@ -4684,7 +4684,7 @@ Function111f07:
ret
.asm_111f17
ldh a, [rSC]
and $80
and 1 << rSC_ON
jr nz, .asm_111f17
di
ld a, [$c81e]

View File

@ -14,7 +14,7 @@ endc
ENDM
enum: MACRO
\1 = __enum__
\1 EQU __enum__
__enum__ = __enum__ + __enumdir__
ENDM

View File

@ -536,13 +536,11 @@ jumptextfaceplayer: MACRO
dw \1 ; text_pointer
ENDM
; if _CRYSTAL
enum farjumptext_command ; $52
farjumptext: MACRO
db farjumptext_command
dba \1
ENDM
; endc
enum jumptext_command ; $53
jumptext: MACRO

View File

@ -79,7 +79,7 @@ EnableMobile:
call DoubleSpeed
xor a
ldh [rIF], a
ld a, 1 << VBLANK | 1 << LCD_STAT | 1 << TIMER | 1 << SERIAL
ld a, IE_DEFAULT
ldh [rIE], a
xor a
ldh [hMapAnims], a
@ -162,7 +162,7 @@ Function1000fa:
xor a
ldh [rIF], a
ldh a, [rIE]
and $13
and $1f ^ (1 << SERIAL | 1 << TIMER)
ldh [rIE], a
xor a
ldh [hMobileReceive], a

View File

@ -469,7 +469,7 @@ BattleTowerRoomMenu_InitRAM:
ld a, [hl]
ld [wcd7f], a
set 1, [hl]
ld a, $f
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
ldh [rIE], a
ld a, $1
ldh [hMobileReceive], a