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

View File

@ -62,8 +62,8 @@ ENDM
; decorations: ; decorations:
; - DecorationAttributes (see data/decorations/attributes.asm) ; - DecorationAttributes (see data/decorations/attributes.asm)
; - DecorationIDs (see data/decorations/decorations.asm) ; - DecorationIDs (see data/decorations/decorations.asm)
const_value = 1 const_def 1
__enum__ = 0 enum_start
; FindOwnedBeds.beds values (see engine/overworld/decorations.asm) ; FindOwnedBeds.beds values (see engine/overworld/decorations.asm)
const BEDS const BEDS
deco FEATHERY_BED deco FEATHERY_BED
@ -121,7 +121,7 @@ __enum__ = 0
deco GEODUDE_DOLL deco GEODUDE_DOLL
deco MACHOP_DOLL deco MACHOP_DOLL
deco TENTACOOL_DOLL deco TENTACOOL_DOLL
NUM_NON_TROPHY_DECOS = __enum__ NUM_NON_TROPHY_DECOS EQU __enum__
deco GOLD_TROPHY_DOLL deco GOLD_TROPHY_DOLL
deco SILVER_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 TIMER EQU 2
SERIAL EQU 3 SERIAL EQU 3
JOYPAD EQU 4 JOYPAD EQU 4
IE_DEFAULT EQU (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
; OAM attribute flags ; OAM attribute flags
OAM_TILE_BANK EQU 3 OAM_TILE_BANK EQU 3

View File

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

View File

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

View File

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

View File

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

View File

@ -332,7 +332,7 @@ Edit `GetMapMusic`:
add_tm PSYCHIC_M ; dd add_tm PSYCHIC_M ; dd
... ...
add_tm NIGHTMARE ; f2 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. `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 and a
jr nz, .ToGoldenrod jr nz, .ToGoldenrod
ld a, 1 ; forwards ld a, 1 ; forwards
lb bc, $40, $60 lb bc, 8 * TILE_WIDTH, 12 * TILE_WIDTH
lb de, (11 * 8) - (11 * 8 + 4), -$60 lb de, (11 * TILE_WIDTH) - (11 * TILE_WIDTH + 4), -12 * TILE_WIDTH
jr .continue jr .continue
.ToGoldenrod: .ToGoldenrod:
ld a, -1 ; backwards ld a, -1 ; backwards
lb bc, -$40, -$60 lb bc, -8 * TILE_WIDTH, -12 * TILE_WIDTH
lb de, (11 * 8) + (11 * 8 + 4), $60 lb de, (11 * TILE_WIDTH) + (11 * TILE_WIDTH + 4), 12 * TILE_WIDTH
.continue .continue
ld h, a ld h, a
@ -34,11 +34,11 @@ MagnetTrain:
push af push af
ldh a, [hSCY] ldh a, [hSCY]
push af push af
call MagntTrain_LoadGFX_PlayMusic call MagnetTrain_LoadGFX_PlayMusic
ld hl, hVBlank ld hl, hVBlank
ld a, [hl] ld a, [hl]
push af push af
ld [hl], $1 ld [hl], 1
.loop .loop
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
and a and a
@ -84,18 +84,19 @@ MagnetTrain:
MagnetTrain_UpdateLYOverrides: MagnetTrain_UpdateLYOverrides:
ld hl, wLYOverridesBackup ld hl, wLYOverridesBackup
ld c, $2f ld c, 6 * TILE_WIDTH - 1
ld a, [wMagnetTrainOffset] ld a, [wMagnetTrainOffset]
add a add a
ldh [hSCX], a ldh [hSCX], a
call .loadloop call .loadloop
ld c, $30 ld c, 6 * TILE_WIDTH
ld a, [wMagnetTrainPosition] ld a, [wMagnetTrainPosition]
call .loadloop call .loadloop
ld c, $31 ld c, 6 * TILE_WIDTH + 1
ld a, [wMagnetTrainOffset] ld a, [wMagnetTrainOffset]
add a add a
call .loadloop call .loadloop
ld a, [wMagnetTrainDirection] ld a, [wMagnetTrainDirection]
ld d, a ld d, a
ld hl, wMagnetTrainOffset ld hl, wMagnetTrainOffset
@ -111,20 +112,22 @@ MagnetTrain_UpdateLYOverrides:
jr nz, .loadloop jr nz, .loadloop
ret ret
MagntTrain_LoadGFX_PlayMusic: MagnetTrain_LoadGFX_PlayMusic:
call ClearBGPalettes call ClearBGPalettes
call ClearSprites call ClearSprites
call DisableLCD call DisableLCD
callfar ClearSpriteAnims callfar ClearSpriteAnims
call SetMagnetTrainPals call SetMagnetTrainPals
call DrawMagnetTrain call DrawMagnetTrain
ld a, $90 ld a, SCREEN_HEIGHT_PX
ldh [hWY], a ldh [hWY], a
call EnableLCD call EnableLCD
xor a xor a
ldh [hBGMapMode], a ldh [hBGMapMode], a
ldh [hSCX], a ldh [hSCX], a
ldh [hSCY], a ldh [hSCY], a
; Load the player sprite
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wPlayerGender) ld a, BANK(wPlayerGender)
@ -135,6 +138,8 @@ MagntTrain_LoadGFX_PlayMusic:
ld hl, vTiles0 ld hl, vTiles0
ld c, 4 ld c, 4
call Request2bpp call Request2bpp
; Load the trainer walking frame
ld hl, 12 tiles ld hl, 12 tiles
add hl, de add hl, de
ld d, h ld d, h
@ -142,7 +147,9 @@ MagntTrain_LoadGFX_PlayMusic:
ld hl, vTiles0 tile $04 ld hl, vTiles0 tile $04
ld c, 4 ld c, 4
call Request2bpp call Request2bpp
call MagnetTrain_InitLYOverrides call MagnetTrain_InitLYOverrides
ld hl, wJumptableIndex ld hl, wJumptableIndex
xor a xor a
ld [hli], a ; wJumptableIndex ld [hli], a ; wJumptableIndex
@ -150,6 +157,7 @@ MagntTrain_LoadGFX_PlayMusic:
ld [hli], a ; wMagnetTrainOffset ld [hli], a ; wMagnetTrainOffset
ld [hli], a ; wMagnetTrainPosition ld [hli], a ; wMagnetTrainPosition
ld [hli], a ; wMagnetTrainWaitCounter ld [hli], a ; wMagnetTrainWaitCounter
ld de, MUSIC_MAGNET_TRAIN ld de, MUSIC_MAGNET_TRAIN
call PlayMusic2 call PlayMusic2
ret ret
@ -159,25 +167,26 @@ DrawMagnetTrain:
xor a xor a
.loop .loop
call GetMagnetTrainBGTiles call GetMagnetTrainBGTiles
ld b, 32 / 2 ld b, BG_MAP_WIDTH / 2
call .FillAlt call .FillAlt
inc a inc a
cp $12 cp SCREEN_HEIGHT
jr c, .loop jr c, .loop
hlbgcoord 0, 6 hlbgcoord 0, 6
ld de, MagnetTrainTilemap1 ld de, MagnetTrainTilemap
ld c, 20 ld c, 20
call .FillLine call .FillLine
hlbgcoord 0, 7 hlbgcoord 0, 7
ld de, MagnetTrainTilemap2 ld de, MagnetTrainTilemap + 20
ld c, 20 ld c, 20
call .FillLine call .FillLine
hlbgcoord 0, 8 hlbgcoord 0, 8
ld de, MagnetTrainTilemap3 ld de, MagnetTrainTilemap + (20 * 2)
ld c, 20 ld c, 20
call .FillLine call .FillLine
hlbgcoord 0, 9 hlbgcoord 0, 9
ld de, MagnetTrainTilemap4 ld de, MagnetTrainTilemap + (20 * 3)
ld c, 20 ld c, 20
call .FillLine call .FillLine
ret ret
@ -247,7 +256,7 @@ MagnetTrain_InitLYOverrides:
ret ret
SetMagnetTrainPals: SetMagnetTrainPals:
ld a, $1 ld a, 1
ldh [rVBK], a ldh [rVBK], a
; bushes ; bushes
@ -274,7 +283,7 @@ SetMagnetTrainPals:
ld a, PAL_BG_YELLOW ld a, PAL_BG_YELLOW
call ByteFill call ByteFill
ld a, $0 ld a, 0
ldh [rVBK], a ldh [rVBK], a
ret ret
@ -305,7 +314,7 @@ MagnetTrain_Jumptable:
ret ret
.InitPlayerSpriteAnim: .InitPlayerSpriteAnim:
ld d, 10 * 8 + 5 ld d, (8 + 2) * TILE_WIDTH + 5
ld a, [wMagnetTrainPlayerSpriteInitX] ld a, [wMagnetTrainPlayerSpriteInitX]
ld e, a ld e, a
ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED
@ -317,7 +326,6 @@ MagnetTrain_Jumptable:
bit PLAYERGENDER_FEMALE_F, a bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender jr z, .got_gender
ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE
.got_gender .got_gender
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
@ -325,9 +333,9 @@ MagnetTrain_Jumptable:
call _InitSpriteAnimStruct call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld [hl], $0 ld [hl], 0
call .Next call .Next
ld a, $80 ld a, 128
ld [wMagnetTrainWaitCounter], a ld [wMagnetTrainWaitCounter], a
ret ret
@ -350,7 +358,7 @@ MagnetTrain_Jumptable:
.PrepareToHoldTrain: .PrepareToHoldTrain:
call .Next call .Next
ld a, $80 ld a, 128
ld [wMagnetTrainWaitCounter], a ld [wMagnetTrainWaitCounter], a
ret ret
@ -408,6 +416,7 @@ MagnetTrain_Jumptable_FirstRunThrough:
call MagnetTrain_UpdateLYOverrides call MagnetTrain_UpdateLYOverrides
call PushLYOverrides call PushLYOverrides
call DelayFrame call DelayFrame
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wEnvironment) ld a, BANK(wEnvironment)
@ -416,20 +425,23 @@ MagnetTrain_Jumptable_FirstRunThrough:
push af push af
ld a, [wEnvironment] ld a, [wEnvironment]
push af push af
ld a, [wTimeOfDay] ld a, [wTimeOfDay]
maskbits NUM_DAYTIMES maskbits NUM_DAYTIMES
ld [wTimeOfDayPal], a ld [wTimeOfDayPal], a
ld a, $1 ld a, TOWN
ld [wEnvironment], a ld [wEnvironment], a
ld b, SCGB_MAPPALS ld b, SCGB_MAPPALS
call GetSGBLayout call GetSGBLayout
call UpdateTimePals call UpdateTimePals
ldh a, [rBGP] ldh a, [rBGP]
ld [wBGP], a ld [wBGP], a
ldh a, [rOBP0] ldh a, [rOBP0]
ld [wOBP0], a ld [wOBP0], a
ldh a, [rOBP1] ldh a, [rOBP1]
ld [wOBP1], a ld [wOBP1], a
pop af pop af
ld [wEnvironment], a ld [wEnvironment], a
pop af pop af
@ -438,11 +450,8 @@ MagnetTrain_Jumptable_FirstRunThrough:
ldh [rSVBK], a ldh [rSVBK], a
ret ret
MagnetTrainTilemap1: MagnetTrainTilemap:
db $1f, $05, $06, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0b, $0c, $1f 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 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 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 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 call DelayFrames
xor a xor a
ldh [hSerialSend], a ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1 ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 1 ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
call DelayFrame call DelayFrame
xor a xor a
ldh [hSerialSend], a ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1 ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 1 ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
.player_1 .player_1
@ -70,7 +70,7 @@ Gen2ToGen1LinkComms:
call DelayFrames call DelayFrames
xor a xor a
ldh [rIF], a ldh [rIF], a
ld a, $8 ld a, 1 << SERIAL
ldh [rIE], a ldh [rIE], a
ld hl, wd1f3 ld hl, wd1f3
ld de, wEnemyMonSpecies ld de, wEnemyMonSpecies
@ -90,7 +90,7 @@ Gen2ToGen1LinkComms:
call Serial_ExchangeBytes call Serial_ExchangeBytes
xor a xor a
ldh [rIF], a ldh [rIF], a
ld a, $1d ld a, (1 << JOYPAD) | (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ldh [rIE], a ldh [rIE], a
call Link_CopyRandomNumbers call Link_CopyRandomNumbers
ld hl, wOTPlayerName ld hl, wOTPlayerName
@ -194,17 +194,17 @@ Gen2ToGen2LinkComms:
call DelayFrames call DelayFrames
xor a xor a
ldh [hSerialSend], a ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1 ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 1 ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
call DelayFrame call DelayFrame
xor a xor a
ldh [hSerialSend], a ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1 ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 1 ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
.Player1: .Player1:
@ -214,7 +214,7 @@ Gen2ToGen2LinkComms:
call DelayFrames call DelayFrames
xor a xor a
ldh [rIF], a ldh [rIF], a
ld a, $8 ld a, 1 << SERIAL
ldh [rIE], a ldh [rIE], a
ld hl, wd1f3 ld hl, wd1f3
ld de, wEnemyMonSpecies ld de, wEnemyMonSpecies
@ -243,7 +243,7 @@ Gen2ToGen2LinkComms:
.not_trading .not_trading
xor a xor a
ldh [rIF], a ldh [rIF], a
ld a, $1d ld a, (1 << JOYPAD) | (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ldh [rIE], a ldh [rIE], a
ld de, MUSIC_NONE ld de, MUSIC_NONE
call PlayMusic call PlayMusic
@ -447,7 +447,7 @@ Gen2ToGen2LinkComms:
xor a xor a
ldh [rIF], a ldh [rIF], a
ldh a, [rIE] ldh a, [rIE]
set 1, a set LCD_STAT, a
ldh [rIE], a ldh [rIE], a
pop af pop af
ldh [rIF], a ldh [rIF], a
@ -1558,9 +1558,9 @@ Function28b22:
xor a xor a
ldh [rSB], a ldh [rSB], a
ldh [hSerialSend], a ldh [hSerialSend], a
ld a, (0 << rSC_ON) | 1 ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 1 ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ret ret
@ -2104,18 +2104,18 @@ WaitForOtherPlayerToExit:
xor a xor a
ldh [rSB], a ldh [rSB], a
ldh [hSerialReceive], a ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 1 ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 1 ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld c, 3 ld c, 3
call DelayFrames call DelayFrames
xor a xor a
ldh [rSB], a ldh [rSB], a
ldh [hSerialReceive], a ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0 ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 0 ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld c, 3 ld c, 3
call DelayFrames call DelayFrames
@ -2131,7 +2131,7 @@ WaitForOtherPlayerToExit:
push af push af
xor a xor a
ldh [rIF], a ldh [rIF], a
ld a, $f ld a, IE_DEFAULT
ldh [rIE], a ldh [rIE], a
pop af pop af
ldh [rIF], a ldh [rIF], a
@ -2160,9 +2160,9 @@ SetBitsForTimeCapsuleRequest:
ldh [rSB], a ldh [rSB], a
xor a xor a
ldh [hSerialReceive], a ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0 ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 0 ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
xor a ; LINK_TIMECAPSULE - 1 xor a ; LINK_TIMECAPSULE - 1
ld [wPlayerLinkAction], a ld [wPlayerLinkAction], a
@ -2177,9 +2177,9 @@ WaitForLinkedFriend:
ldh [rSB], a ldh [rSB], a
xor a xor a
ldh [hSerialReceive], a ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0 ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 0 ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
call DelayFrame call DelayFrame
call DelayFrame call DelayFrame
@ -2202,9 +2202,9 @@ WaitForLinkedFriend:
ldh [rSB], a ldh [rSB], a
xor a xor a
ldh [hSerialReceive], a ldh [hSerialReceive], a
ld a, (0 << rSC_ON) | 0 ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 0 ld a, (1 << rSC_ON) | (0 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, [wLinkTimeoutFrames] ld a, [wLinkTimeoutFrames]
dec a dec a
@ -2218,9 +2218,9 @@ WaitForLinkedFriend:
.not_done .not_done
ld a, $1 ld a, $1
ldh [rSB], a ldh [rSB], a
ld a, (0 << rSC_ON) | 1 ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
ld a, (1 << rSC_ON) | 1 ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a ldh [rSC], a
call DelayFrame call DelayFrame
jr .loop jr .loop

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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