mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Merge pull request #503 from Rangi42/master
Factor wMisc into meaningful parts; move most code out of home.asm
This commit is contained in:
commit
40b537d45b
@ -1081,7 +1081,7 @@ HandleNoise: ; e858c
|
|||||||
ret z
|
ret z
|
||||||
; are we in a sfx channel?
|
; are we in a sfx channel?
|
||||||
ld a, [wCurChannel]
|
ld a, [wCurChannel]
|
||||||
bit 2, a ; sfx
|
bit NOISE_CHAN_F, a
|
||||||
jr nz, .next
|
jr nz, .next
|
||||||
; is ch8 on? (noise)
|
; is ch8 on? (noise)
|
||||||
ld hl, wChannel8Flags
|
ld hl, wChannel8Flags
|
||||||
@ -1330,7 +1330,7 @@ GetNoiseSample: ; e86c5
|
|||||||
call SetNoteDuration
|
call SetNoteDuration
|
||||||
; check current channel
|
; check current channel
|
||||||
ld a, [wCurChannel]
|
ld a, [wCurChannel]
|
||||||
bit 2, a ; are we in a sfx channel?
|
bit NOISE_CHAN_F, a
|
||||||
jr nz, .sfx
|
jr nz, .sfx
|
||||||
ld hl, wChannel8Flags
|
ld hl, wChannel8Flags
|
||||||
bit SOUND_CHANNEL_ON, [hl] ; is ch8 on? (noise)
|
bit SOUND_CHANNEL_ON, [hl] ; is ch8 on? (noise)
|
||||||
|
@ -31,6 +31,8 @@ NUM_NOISE_CHANS EQU const_value
|
|||||||
const CHAN8 ; 7
|
const CHAN8 ; 7
|
||||||
NUM_CHANNELS EQU const_value
|
NUM_CHANNELS EQU const_value
|
||||||
|
|
||||||
|
NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7
|
||||||
|
|
||||||
; Flags1
|
; Flags1
|
||||||
const_def
|
const_def
|
||||||
const SOUND_CHANNEL_ON ; 0
|
const SOUND_CHANNEL_ON ; 0
|
||||||
|
@ -157,7 +157,7 @@ SLP EQU %111 ; 0-7 turns
|
|||||||
const FRZ
|
const FRZ
|
||||||
const PAR
|
const PAR
|
||||||
|
|
||||||
ALL_STATUS EQU (1 << PSN) + (1 << BRN) + (1 << FRZ) + (1 << PAR) + SLP
|
ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
|
||||||
|
|
||||||
; wPlayerSubStatus1 or wEnemySubStatus1 bit flags
|
; wPlayerSubStatus1 or wEnemySubStatus1 bit flags
|
||||||
enum_start 7, -1
|
enum_start 7, -1
|
||||||
@ -248,3 +248,7 @@ SUBSTATUS_CURLED EQU 0
|
|||||||
const WIN
|
const WIN
|
||||||
const LOSE
|
const LOSE
|
||||||
const DRAW
|
const DRAW
|
||||||
|
|
||||||
|
BATTLERESULT_CAUGHT_CELEBI EQU 6
|
||||||
|
BATTLERESULT_BOX_FULL EQU 7
|
||||||
|
BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_CAUGHT_CELEBI) | (1 << BATTLERESULT_BOX_FULL)
|
||||||
|
@ -16,8 +16,12 @@ SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels
|
|||||||
|
|
||||||
BG_MAP_WIDTH EQU 32 ; tiles
|
BG_MAP_WIDTH EQU 32 ; tiles
|
||||||
BG_MAP_HEIGHT EQU 32 ; tiles
|
BG_MAP_HEIGHT EQU 32 ; tiles
|
||||||
WMISC_WIDTH EQU 6 * 4
|
|
||||||
WMISC_HEIGHT EQU 5 * 4
|
METATILE_WIDTH EQU 4 ; tiles
|
||||||
|
SCREEN_META_WIDTH EQU 6 ; metatiles
|
||||||
|
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
|
HP_BAR_LENGTH EQU 6 ; tiles
|
||||||
|
@ -15,11 +15,15 @@ ENDM
|
|||||||
|
|
||||||
; map group ids
|
; map group ids
|
||||||
; `newgroup` indexes are for:
|
; `newgroup` indexes are for:
|
||||||
; - MapGroupPointers (see data/maps/definitions.asm)
|
; - MapGroupPointers (see data/maps/maps.asm)
|
||||||
; - MapGroupRoofs (see data/maps/roofs.asm)
|
; - MapGroupRoofs (see data/maps/roofs.asm)
|
||||||
; - OutdoorSprites (see data/maps/outdoor_sprites.asm)
|
; - OutdoorSprites (see data/maps/outdoor_sprites.asm)
|
||||||
; - RoofPals (see gfx/tilesets/roofs.pal)
|
; - RoofPals (see gfx/tilesets/roofs.pal)
|
||||||
; `map_const` indexes are for the sub-tables of MapGroupPointers (see data/maps/definitions.asm)
|
; `map_const` indexes are for the sub-tables of MapGroupPointers (see data/maps/maps.asm)
|
||||||
|
; Each map also has associated data:
|
||||||
|
; - attributes (see data/maps/attributes.asm)
|
||||||
|
; - blocks (see data/maps/blocks.asm)
|
||||||
|
; - scripts and events (see data/maps/scripts.asm)
|
||||||
const_def
|
const_def
|
||||||
|
|
||||||
newgroup ; 1
|
newgroup ; 1
|
||||||
|
@ -2,20 +2,14 @@ unownwall: MACRO
|
|||||||
rept _NARG
|
rept _NARG
|
||||||
if \1 == "-"
|
if \1 == "-"
|
||||||
x = $64
|
x = $64
|
||||||
else
|
elif \1 >= "Y"
|
||||||
if \1 >= "Y"
|
|
||||||
x = 2 * (\1 - "Y") + $60
|
x = 2 * (\1 - "Y") + $60
|
||||||
else
|
elif \1 >= "Q"
|
||||||
if \1 >= "Q"
|
|
||||||
x = 2 * (\1 - "Q") + $40
|
x = 2 * (\1 - "Q") + $40
|
||||||
else
|
elif \1 >= "I"
|
||||||
if \1 >= "I"
|
|
||||||
x = 2 * (\1 - "I") + $20
|
x = 2 * (\1 - "I") + $20
|
||||||
else
|
else
|
||||||
x = 2 * (\1 - "A")
|
x = 2 * (\1 - "A")
|
||||||
endc
|
|
||||||
endc
|
|
||||||
endc
|
|
||||||
endc
|
endc
|
||||||
db x
|
db x
|
||||||
shift
|
shift
|
||||||
@ -25,16 +19,16 @@ ENDM
|
|||||||
|
|
||||||
UnownWalls: ; 8aebc
|
UnownWalls: ; 8aebc
|
||||||
; UNOWNWORDS_ESCAPE
|
; UNOWNWORDS_ESCAPE
|
||||||
; db $08, $44, $04, $00, $2e, $08, $ff
|
; db $08, $44, $04, $00, $2e, $08, -1
|
||||||
unownwall "E", "S", "C", "A", "P", "E"
|
unownwall "E", "S", "C", "A", "P", "E"
|
||||||
; UNOWNWORDS_LIGHT
|
; UNOWNWORDS_LIGHT
|
||||||
; db $26, $20, $0c, $0e, $46, $ff
|
; db $26, $20, $0c, $0e, $46, -1
|
||||||
unownwall "L", "I", "G", "H", "T"
|
unownwall "L", "I", "G", "H", "T"
|
||||||
; UNOWNWORDS_WATER
|
; UNOWNWORDS_WATER
|
||||||
; db $4c, $00, $46, $08, $42, $ff
|
; db $4c, $00, $46, $08, $42, -1
|
||||||
unownwall "W", "A", "T", "E", "R"
|
unownwall "W", "A", "T", "E", "R"
|
||||||
; UNOWNWORDS_HO_OH
|
; UNOWNWORDS_HO_OH
|
||||||
; db $0e, $2c, $64, $2c, $0e, $ff
|
; db $0e, $2c, $64, $2c, $0e, -1
|
||||||
unownwall "H", "O", "-", "O", "H"
|
unownwall "H", "O", "-", "O", "H"
|
||||||
; 8aed5
|
; 8aed5
|
||||||
|
|
||||||
|
@ -27,39 +27,39 @@ connection: MACRO
|
|||||||
if "\1" == "north"
|
if "\1" == "north"
|
||||||
map_id \3
|
map_id \3
|
||||||
dw \2_Blocks + \3_WIDTH * (\3_HEIGHT - 3) + \5
|
dw \2_Blocks + \3_WIDTH * (\3_HEIGHT - 3) + \5
|
||||||
dw wOverworldMap + \4 + 3
|
dw wOverworldMapBlocks + \4 + 3
|
||||||
db \6
|
db \6
|
||||||
db \3_WIDTH
|
db \3_WIDTH
|
||||||
db \3_HEIGHT * 2 - 1
|
db \3_HEIGHT * 2 - 1
|
||||||
db (\4 - \5) * -2
|
db (\4 - \5) * -2
|
||||||
dw wOverworldMap + \3_HEIGHT * (\3_WIDTH + 6) + 1
|
dw wOverworldMapBlocks + \3_HEIGHT * (\3_WIDTH + 6) + 1
|
||||||
elif "\1" == "south"
|
elif "\1" == "south"
|
||||||
map_id \3
|
map_id \3
|
||||||
dw \2_Blocks + \5
|
dw \2_Blocks + \5
|
||||||
dw wOverworldMap + (CURRENT_MAP_HEIGHT + 3) * (CURRENT_MAP_WIDTH + 6) + \4 + 3
|
dw wOverworldMapBlocks + (CURRENT_MAP_HEIGHT + 3) * (CURRENT_MAP_WIDTH + 6) + \4 + 3
|
||||||
db \6
|
db \6
|
||||||
db \3_WIDTH
|
db \3_WIDTH
|
||||||
db 0
|
db 0
|
||||||
db (\4 - \5) * -2
|
db (\4 - \5) * -2
|
||||||
dw wOverworldMap + \3_WIDTH + 7
|
dw wOverworldMapBlocks + \3_WIDTH + 7
|
||||||
elif "\1" == "west"
|
elif "\1" == "west"
|
||||||
map_id \3
|
map_id \3
|
||||||
dw \2_Blocks + (\3_WIDTH * \5) + \3_WIDTH - 3
|
dw \2_Blocks + (\3_WIDTH * \5) + \3_WIDTH - 3
|
||||||
dw wOverworldMap + (CURRENT_MAP_WIDTH + 6) * (\4 + 3)
|
dw wOverworldMapBlocks + (CURRENT_MAP_WIDTH + 6) * (\4 + 3)
|
||||||
db \6
|
db \6
|
||||||
db \3_WIDTH
|
db \3_WIDTH
|
||||||
db (\4 - \5) * -2
|
db (\4 - \5) * -2
|
||||||
db \3_WIDTH * 2 - 1
|
db \3_WIDTH * 2 - 1
|
||||||
dw wOverworldMap + \3_WIDTH * 2 + 6
|
dw wOverworldMapBlocks + \3_WIDTH * 2 + 6
|
||||||
elif "\1" == "east"
|
elif "\1" == "east"
|
||||||
map_id \3
|
map_id \3
|
||||||
dw \2_Blocks + (\3_WIDTH * \5)
|
dw \2_Blocks + (\3_WIDTH * \5)
|
||||||
dw wOverworldMap + (CURRENT_MAP_WIDTH + 6) * (\4 + 3 + 1) - 3
|
dw wOverworldMapBlocks + (CURRENT_MAP_WIDTH + 6) * (\4 + 3 + 1) - 3
|
||||||
db \6
|
db \6
|
||||||
db \3_WIDTH
|
db \3_WIDTH
|
||||||
db (\4 - \5) * -2
|
db (\4 - \5) * -2
|
||||||
db 0
|
db 0
|
||||||
dw wOverworldMap + \3_WIDTH + 7
|
dw wOverworldMapBlocks + \3_WIDTH + 7
|
||||||
endc
|
endc
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
@ -949,18 +949,18 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
|
|||||||
add 3
|
add 3
|
||||||
ld hl, wEnemyMonLevel
|
ld hl, wEnemyMonLevel
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nc, .okay
|
jr nc, .not_stronger
|
||||||
set 0, e
|
set TRANS_STRONGER_F, e
|
||||||
.okay
|
.not_stronger
|
||||||
ld a, [wEnvironment]
|
ld a, [wEnvironment]
|
||||||
cp CAVE
|
cp CAVE
|
||||||
jr z, .okay2
|
jr z, .cave
|
||||||
cp ENVIRONMENT_5
|
cp ENVIRONMENT_5
|
||||||
jr z, .okay2
|
jr z, .cave
|
||||||
cp DUNGEON
|
cp DUNGEON
|
||||||
jr z, .okay2
|
jr z, .cave
|
||||||
set 1, e
|
set TRANS_NO_CAVE_F, e
|
||||||
.okay2
|
.cave
|
||||||
ld hl, .StartingPoints
|
ld hl, .StartingPoints
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
@ -969,8 +969,11 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
|
|||||||
; 8c38f (23:438f)
|
; 8c38f (23:438f)
|
||||||
|
|
||||||
.StartingPoints: ; 8c38f
|
.StartingPoints: ; 8c38f
|
||||||
db 1, 9
|
; entries correspond to TRANS_* constants
|
||||||
db 16, 24
|
db BATTLETRANSITION_CAVE
|
||||||
|
db BATTLETRANSITION_CAVE_STRONGER
|
||||||
|
db BATTLETRANSITION_NO_CAVE
|
||||||
|
db BATTLETRANSITION_NO_CAVE_STRONGER
|
||||||
; 8c393
|
; 8c393
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
; BattleTransitionJumptable.Jumptable indexes
|
||||||
|
BATTLETRANSITION_CAVE EQU $01
|
||||||
|
BATTLETRANSITION_CAVE_STRONGER EQU $09
|
||||||
|
BATTLETRANSITION_NO_CAVE EQU $10
|
||||||
|
BATTLETRANSITION_NO_CAVE_STRONGER EQU $18
|
||||||
|
BATTLETRANSITION_FINISH EQU $20
|
||||||
|
BATTLETRANSITION_END EQU $80
|
||||||
|
|
||||||
DoBattleTransition: ; 8c20f
|
DoBattleTransition: ; 8c20f
|
||||||
call .InitGFX
|
call .InitGFX
|
||||||
ld a, [rBGP]
|
ld a, [rBGP]
|
||||||
@ -14,7 +22,7 @@ DoBattleTransition: ; 8c20f
|
|||||||
|
|
||||||
.loop
|
.loop
|
||||||
ld a, [wJumptableIndex]
|
ld a, [wJumptableIndex]
|
||||||
bit 7, a
|
bit 7, a ; BATTLETRANSITION_END?
|
||||||
jr nz, .done
|
jr nz, .done
|
||||||
call BattleTransitionJumptable
|
call BattleTransitionJumptable
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
@ -145,13 +153,13 @@ INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp"
|
|||||||
|
|
||||||
|
|
||||||
BattleTransitionJumptable: ; 8c314
|
BattleTransitionJumptable: ; 8c314
|
||||||
jumptable .dw, wJumptableIndex
|
jumptable .Jumptable, wJumptableIndex
|
||||||
; 8c323
|
; 8c323
|
||||||
|
|
||||||
.dw ; 8c323 (23:4323)
|
.Jumptable ; 8c323 (23:4323)
|
||||||
dw StartTrainerBattle_DetermineWhichAnimation ; 00
|
dw StartTrainerBattle_DetermineWhichAnimation ; 00
|
||||||
|
|
||||||
; Animation 1: cave
|
; BATTLETRANSITION_CAVE
|
||||||
dw StartTrainerBattle_LoadPokeBallGraphics ; 01
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 01
|
||||||
dw StartTrainerBattle_SetUpBGMap ; 02
|
dw StartTrainerBattle_SetUpBGMap ; 02
|
||||||
dw StartTrainerBattle_Flash ; 03
|
dw StartTrainerBattle_Flash ; 03
|
||||||
@ -161,7 +169,7 @@ BattleTransitionJumptable: ; 8c314
|
|||||||
dw StartTrainerBattle_SetUpForWavyOutro ; 07
|
dw StartTrainerBattle_SetUpForWavyOutro ; 07
|
||||||
dw StartTrainerBattle_SineWave ; 08
|
dw StartTrainerBattle_SineWave ; 08
|
||||||
|
|
||||||
; Animation 2: cave, stronger
|
; BATTLETRANSITION_CAVE_STRONGER
|
||||||
dw StartTrainerBattle_LoadPokeBallGraphics ; 09
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 09
|
||||||
dw StartTrainerBattle_SetUpBGMap ; 0a
|
dw StartTrainerBattle_SetUpBGMap ; 0a
|
||||||
dw StartTrainerBattle_Flash ; 0b
|
dw StartTrainerBattle_Flash ; 0b
|
||||||
@ -171,7 +179,7 @@ BattleTransitionJumptable: ; 8c314
|
|||||||
; There is no setup for this one
|
; There is no setup for this one
|
||||||
dw StartTrainerBattle_ZoomToBlack ; 0f
|
dw StartTrainerBattle_ZoomToBlack ; 0f
|
||||||
|
|
||||||
; Animation 3: no cave
|
; BATTLETRANSITION_NO_CAVE
|
||||||
dw StartTrainerBattle_LoadPokeBallGraphics ; 10
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 10
|
||||||
dw StartTrainerBattle_SetUpBGMap ; 11
|
dw StartTrainerBattle_SetUpBGMap ; 11
|
||||||
dw StartTrainerBattle_Flash ; 12
|
dw StartTrainerBattle_Flash ; 12
|
||||||
@ -181,7 +189,7 @@ BattleTransitionJumptable: ; 8c314
|
|||||||
dw StartTrainerBattle_SetUpForSpinOutro ; 16
|
dw StartTrainerBattle_SetUpForSpinOutro ; 16
|
||||||
dw StartTrainerBattle_SpinToBlack ; 17
|
dw StartTrainerBattle_SpinToBlack ; 17
|
||||||
|
|
||||||
; Animation 4: no cave, stronger
|
; BATTLETRANSITION_NO_CAVE_STRONGER
|
||||||
dw StartTrainerBattle_LoadPokeBallGraphics ; 18
|
dw StartTrainerBattle_LoadPokeBallGraphics ; 18
|
||||||
dw StartTrainerBattle_SetUpBGMap ; 19
|
dw StartTrainerBattle_SetUpBGMap ; 19
|
||||||
dw StartTrainerBattle_Flash ; 1a
|
dw StartTrainerBattle_Flash ; 1a
|
||||||
@ -191,9 +199,19 @@ BattleTransitionJumptable: ; 8c314
|
|||||||
dw StartTrainerBattle_SetUpForRandomScatterOutro ; 1e
|
dw StartTrainerBattle_SetUpForRandomScatterOutro ; 1e
|
||||||
dw StartTrainerBattle_SpeckleToBlack ; 1f
|
dw StartTrainerBattle_SpeckleToBlack ; 1f
|
||||||
|
|
||||||
; All animations jump to here.
|
; BATTLETRANSITION_FINISH
|
||||||
dw StartTrainerBattle_Finish ; 20
|
dw StartTrainerBattle_Finish ; 20
|
||||||
|
|
||||||
|
; transition animations
|
||||||
|
const_def
|
||||||
|
const TRANS_CAVE
|
||||||
|
const TRANS_CAVE_STRONGER
|
||||||
|
const TRANS_NO_CAVE
|
||||||
|
const TRANS_NO_CAVE_STRONGER
|
||||||
|
|
||||||
|
; transition animation bits
|
||||||
|
TRANS_STRONGER_F EQU 0 ; bit set in TRANS_CAVE_STRONGER and TRANS_NO_CAVE_STRONGER
|
||||||
|
TRANS_NO_CAVE_F EQU 1 ; bit set in TRANS_NO_CAVE and TRANS_NO_CAVE_STRONGER
|
||||||
|
|
||||||
StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
|
StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
|
||||||
; The screen flashes a different number of times depending on the level of
|
; The screen flashes a different number of times depending on the level of
|
||||||
@ -205,18 +223,18 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
|
|||||||
add 3
|
add 3
|
||||||
ld hl, wEnemyMonLevel
|
ld hl, wEnemyMonLevel
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nc, .okay
|
jr nc, .not_stronger
|
||||||
set 0, e
|
set TRANS_STRONGER_F, e
|
||||||
.okay
|
.not_stronger
|
||||||
ld a, [wEnvironment]
|
ld a, [wEnvironment]
|
||||||
cp CAVE
|
cp CAVE
|
||||||
jr z, .okay2
|
jr z, .cave
|
||||||
cp ENVIRONMENT_5
|
cp ENVIRONMENT_5
|
||||||
jr z, .okay2
|
jr z, .cave
|
||||||
cp DUNGEON
|
cp DUNGEON
|
||||||
jr z, .okay2
|
jr z, .cave
|
||||||
set 1, e
|
set TRANS_NO_CAVE_F, e
|
||||||
.okay2
|
.cave
|
||||||
ld hl, .StartingPoints
|
ld hl, .StartingPoints
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
@ -225,13 +243,16 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
|
|||||||
; 8c38f (23:438f)
|
; 8c38f (23:438f)
|
||||||
|
|
||||||
.StartingPoints: ; 8c38f
|
.StartingPoints: ; 8c38f
|
||||||
db 1, 9
|
; entries correspond to TRANS_* constants
|
||||||
db 16, 24
|
db BATTLETRANSITION_CAVE
|
||||||
|
db BATTLETRANSITION_CAVE_STRONGER
|
||||||
|
db BATTLETRANSITION_NO_CAVE
|
||||||
|
db BATTLETRANSITION_NO_CAVE_STRONGER
|
||||||
; 8c393
|
; 8c393
|
||||||
|
|
||||||
StartTrainerBattle_Finish: ; 8c393 (23:4393)
|
StartTrainerBattle_Finish: ; 8c393 (23:4393)
|
||||||
call ClearSprites
|
call ClearSprites
|
||||||
ld a, $80
|
ld a, BATTLETRANSITION_END
|
||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -322,7 +343,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.end
|
.end
|
||||||
ld a, $20
|
ld a, BATTLETRANSITION_FINISH
|
||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -394,7 +415,7 @@ endr
|
|||||||
call DelayFrame
|
call DelayFrame
|
||||||
xor a
|
xor a
|
||||||
ld [hBGMapMode], a
|
ld [hBGMapMode], a
|
||||||
ld a, $20
|
ld a, BATTLETRANSITION_FINISH
|
||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
ret
|
ret
|
||||||
; 8c490 (23:4490)
|
; 8c490 (23:4490)
|
||||||
@ -406,6 +427,10 @@ endr
|
|||||||
const LOWER_LEFT
|
const LOWER_LEFT
|
||||||
const LOWER_RIGHT
|
const LOWER_RIGHT
|
||||||
|
|
||||||
|
; quadrant bits
|
||||||
|
RIGHT_QUADRANT_F EQU 0 ; bit set in UPPER_RIGHT and LOWER_RIGHT
|
||||||
|
LOWER_QUADRANT_F EQU 1 ; bit set in LOWER_LEFT and LOWER_RIGHT
|
||||||
|
|
||||||
.spintable ; 8c490
|
.spintable ; 8c490
|
||||||
spintable_entry: MACRO
|
spintable_entry: MACRO
|
||||||
db \1
|
db \1
|
||||||
@ -451,7 +476,7 @@ ENDM
|
|||||||
.loop1
|
.loop1
|
||||||
ld [hl], $ff
|
ld [hl], $ff
|
||||||
ld a, [wcf65]
|
ld a, [wcf65]
|
||||||
bit 0, a
|
bit RIGHT_QUADRANT_F, a
|
||||||
jr z, .leftside
|
jr z, .leftside
|
||||||
inc hl
|
inc hl
|
||||||
jr .okay1
|
jr .okay1
|
||||||
@ -462,7 +487,7 @@ ENDM
|
|||||||
jr nz, .loop1
|
jr nz, .loop1
|
||||||
pop hl
|
pop hl
|
||||||
ld a, [wcf65]
|
ld a, [wcf65]
|
||||||
bit 1, a
|
bit LOWER_QUADRANT_F, a
|
||||||
ld bc, SCREEN_WIDTH
|
ld bc, SCREEN_WIDTH
|
||||||
jr z, .upper
|
jr z, .upper
|
||||||
ld bc, -SCREEN_WIDTH
|
ld bc, -SCREEN_WIDTH
|
||||||
@ -477,7 +502,7 @@ ENDM
|
|||||||
ld c, a
|
ld c, a
|
||||||
.loop2
|
.loop2
|
||||||
ld a, [wcf65]
|
ld a, [wcf65]
|
||||||
bit 0, a
|
bit RIGHT_QUADRANT_F, a
|
||||||
jr z, .leftside2
|
jr z, .leftside2
|
||||||
dec hl
|
dec hl
|
||||||
jr .okay2
|
jr .okay2
|
||||||
@ -530,7 +555,7 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f)
|
|||||||
call DelayFrame
|
call DelayFrame
|
||||||
xor a
|
xor a
|
||||||
ld [hBGMapMode], a
|
ld [hBGMapMode], a
|
||||||
ld a, $20
|
ld a, BATTLETRANSITION_FINISH
|
||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -778,7 +803,7 @@ StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768)
|
|||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
.done
|
.done
|
||||||
ld a, $20
|
ld a, BATTLETRANSITION_FINISH
|
||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
ret
|
ret
|
||||||
; 8c792 (23:4792)
|
; 8c792 (23:4792)
|
||||||
|
@ -119,8 +119,8 @@ DoBattle: ; 3c000
|
|||||||
WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
|
WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
|
||||||
call Call_LoadTempTileMapToTileMap
|
call Call_LoadTempTileMapToTileMap
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
add $2
|
add DRAW
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
ld a, [wLinkMode]
|
ld a, [wLinkMode]
|
||||||
and a
|
and a
|
||||||
@ -128,8 +128,8 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
|
|||||||
jr z, .print_text
|
jr z, .print_text
|
||||||
|
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a ; WIN
|
||||||
ld hl, BattleText_EnemyFled
|
ld hl, BattleText_EnemyFled
|
||||||
call CheckMobileBattleError
|
call CheckMobileBattleError
|
||||||
jr nc, .print_text
|
jr nc, .print_text
|
||||||
@ -575,8 +575,8 @@ CheckContestBattleOver: ; 3c3f5
|
|||||||
and a
|
and a
|
||||||
jr nz, .contest_not_over
|
jr nz, .contest_not_over
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
add $2
|
add DRAW
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
scf
|
scf
|
||||||
ret
|
ret
|
||||||
@ -2199,8 +2199,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
|
|||||||
call EmptyBattleTextBox
|
call EmptyBattleTextBox
|
||||||
call LoadTileMapToTempTileMap
|
call LoadTileMapToTempTileMap
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a ; WIN
|
||||||
call IsAnyMonHoldingExpShare
|
call IsAnyMonHoldingExpShare
|
||||||
jr z, .skip_exp
|
jr z, .skip_exp
|
||||||
ld hl, wEnemyMonBaseStats
|
ld hl, wEnemyMonBaseStats
|
||||||
@ -2745,8 +2745,8 @@ PlayerMonFaintHappinessMod: ; 3d1aa
|
|||||||
ld [wCurPartyMon], a
|
ld [wCurPartyMon], a
|
||||||
callfar ChangeHappiness
|
callfar ChangeHappiness
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and %11000000
|
and BATTLERESULT_BITMASK
|
||||||
add $1
|
add LOSE
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
ld a, [wWhichMonFaintedFirst]
|
ld a, [wWhichMonFaintedFirst]
|
||||||
and a
|
and a
|
||||||
@ -3050,8 +3050,8 @@ LostBattle: ; 3d38e
|
|||||||
jr nz, .not_tied
|
jr nz, .not_tied
|
||||||
ld hl, TiedAgainstText
|
ld hl, TiedAgainstText
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
add 2
|
add DRAW
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
jr .text
|
jr .text
|
||||||
|
|
||||||
@ -3928,11 +3928,11 @@ TryToRunAwayFromBattle: ; 3d8b3
|
|||||||
cp BATTLEACTION_FORFEIT
|
cp BATTLEACTION_FORFEIT
|
||||||
ld a, DRAW
|
ld a, DRAW
|
||||||
jr z, .fled
|
jr z, .fled
|
||||||
dec a
|
dec a ; LOSE
|
||||||
.fled
|
.fled
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
add b
|
add b
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
call StopDangerSound
|
call StopDangerSound
|
||||||
@ -5180,8 +5180,8 @@ BattleMenu_Pack: ; 3e1c7
|
|||||||
xor a
|
xor a
|
||||||
ld [wWildMon], a
|
ld [wWildMon], a
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a ; WIN
|
||||||
call ClearWindowData
|
call ClearWindowData
|
||||||
call SetPalettes
|
call SetPalettes
|
||||||
scf
|
scf
|
||||||
@ -8607,9 +8607,10 @@ DisplayLinkBattleResult: ; 3f77c
|
|||||||
.proceed
|
.proceed
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $f
|
and $f
|
||||||
cp $1
|
cp LOSE
|
||||||
jr c, .victory
|
jr c, .victory ; WIN
|
||||||
jr z, .loss
|
jr z, .loss ; LOSE
|
||||||
|
; DRAW
|
||||||
farcall StubbedTrainerRankings_ColosseumDraws
|
farcall StubbedTrainerRankings_ColosseumDraws
|
||||||
ld de, .Draw
|
ld de, .Draw
|
||||||
jr .store_result
|
jr .store_result
|
||||||
@ -8841,7 +8842,7 @@ BattleEnd_HandleRoamMons: ; 3f998
|
|||||||
jr nz, .not_roaming
|
jr nz, .not_roaming
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $f
|
and $f
|
||||||
jr z, .caught_or_defeated_roam_mon
|
jr z, .caught_or_defeated_roam_mon ; WIN
|
||||||
call GetRoamMonHP
|
call GetRoamMonHP
|
||||||
ld a, [wEnemyMonHP + 1]
|
ld a, [wEnemyMonHP + 1]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
@ -9001,11 +9002,12 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
|
|||||||
.StoreResult: ; 3faa0
|
.StoreResult: ; 3faa0
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $f
|
and $f
|
||||||
cp $1
|
cp LOSE
|
||||||
ld bc, sLinkBattleWins + 1 - sLinkBattleResults
|
ld bc, sLinkBattleWins + 1 - sLinkBattleResults
|
||||||
jr c, .okay
|
jr c, .okay ; WIN
|
||||||
ld bc, sLinkBattleLosses + 1 - sLinkBattleResults
|
ld bc, sLinkBattleLosses + 1 - sLinkBattleResults
|
||||||
jr z, .okay
|
jr z, .okay ; LOSE
|
||||||
|
; DRAW
|
||||||
ld bc, sLinkBattleDraws + 1 - sLinkBattleResults
|
ld bc, sLinkBattleDraws + 1 - sLinkBattleResults
|
||||||
.okay
|
.okay
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -5390,8 +5390,8 @@ INCLUDE "engine/battle/move_effects/teleport.asm"
|
|||||||
|
|
||||||
SetBattleDraw: ; 36804
|
SetBattleDraw: ; 36804
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
or $2
|
or DRAW
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -41,20 +41,20 @@ DetermineLinkBattleResult: ; 2b930
|
|||||||
.victory
|
.victory
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $f0
|
and $f0
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a ; WIN
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.defeat
|
.defeat
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $f0
|
and $f0
|
||||||
add $1
|
add LOSE
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.drawn
|
.drawn
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $f0
|
and $f0
|
||||||
add $2
|
add DRAW
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -123,16 +123,16 @@ DetermineLinkBattleResult: ; 2b930
|
|||||||
jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
|
jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
|
||||||
ld hl, wOTPartyMon1HP
|
ld hl, wOTPartyMon1HP
|
||||||
call .CheckFaintedOrFullHealth
|
call .CheckFaintedOrFullHealth
|
||||||
ld e, $1
|
ld e, $1 ; victory
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.finish
|
.finish
|
||||||
ld hl, wOTPartyMon1HP
|
ld hl, wOTPartyMon1HP
|
||||||
call .CheckFaintedOrFullHealth
|
call .CheckFaintedOrFullHealth
|
||||||
ld e, $0
|
ld e, $0 ; drawn
|
||||||
ret nz ; we both have pokemon that are neither fainted nor at full health
|
ret nz ; we both have pokemon that are neither fainted nor at full health
|
||||||
ld e, $2
|
ld e, $2 ; defeat
|
||||||
ld a, $1
|
ld a, $1 ; not drawn
|
||||||
and a
|
and a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ Function170114: ; 170114
|
|||||||
ld a, $5
|
ld a, $5
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, $a948
|
ld hl, $a948
|
||||||
ld de, wMisc
|
ld de, wc608
|
||||||
ld bc, $f6 ; 246
|
ld bc, $f6 ; 246
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
@ -90,11 +90,11 @@ Function170139: ; 170139
|
|||||||
ld b, $0
|
ld b, $0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
; Store that number in wMisc
|
; Store that number in wc608
|
||||||
ld a, h
|
ld a, h
|
||||||
ld [wMisc], a
|
ld [wc608], a
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [wMisc + 1], a
|
ld [wc608 + 1], a
|
||||||
ld hl, wBT_OTTempMon1DVs
|
ld hl, wBT_OTTempMon1DVs
|
||||||
ld a, [wPlayerID]
|
ld a, [wPlayerID]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
@ -161,7 +161,7 @@ Function170139: ; 170139
|
|||||||
ld hl, $a894
|
ld hl, $a894
|
||||||
ld bc, NAME_LENGTH_JAPANESE
|
ld bc, NAME_LENGTH_JAPANESE
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
ld hl, wMisc
|
ld hl, wc608
|
||||||
ld de, $a948
|
ld de, $a948
|
||||||
ld bc, $f6
|
ld bc, $f6
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
@ -254,7 +254,7 @@ RunBattleTowerTrainer: ; 17024d
|
|||||||
farcall HealParty
|
farcall HealParty
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
ld [wScriptVar], a
|
ld [wScriptVar], a
|
||||||
and a
|
and a ; WIN?
|
||||||
jr nz, .lost
|
jr nz, .lost
|
||||||
ld a, BANK(sNrOfBeatenBattleTowerTrainers)
|
ld a, BANK(sNrOfBeatenBattleTowerTrainers)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
@ -674,7 +674,7 @@ Function1704e1: ; 1704e1
|
|||||||
call CopyBytes
|
call CopyBytes
|
||||||
|
|
||||||
ld hl, $a8b2
|
ld hl, $a8b2
|
||||||
ld de, wMisc
|
ld de, wc608
|
||||||
ld bc, $0096
|
ld bc, $0096
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
|
|
||||||
@ -793,7 +793,7 @@ Function1704e1: ; 1704e1
|
|||||||
call .PlaceUpDownArrows
|
call .PlaceUpDownArrows
|
||||||
ld a, $50
|
ld a, $50
|
||||||
ld [wcd4e], a
|
ld [wcd4e], a
|
||||||
ld hl, wMisc
|
ld hl, wc608
|
||||||
ld a, [wNrOfBeatenBattleTowerTrainers]
|
ld a, [wNrOfBeatenBattleTowerTrainers]
|
||||||
ld c, a
|
ld c, a
|
||||||
xor a
|
xor a
|
||||||
@ -1441,7 +1441,7 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10
|
|||||||
ld a, $5
|
ld a, $5
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, $b023
|
ld hl, $b023
|
||||||
ld de, wMisc
|
ld de, wc608
|
||||||
ld bc, $0069
|
ld bc, $0069
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
ld a, [$a825]
|
ld a, [$a825]
|
||||||
@ -1460,14 +1460,14 @@ Function1709bb: ; 1709bb (5c:49bb) BattleTowerAction $10
|
|||||||
ld a, $0
|
ld a, $0
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, wRTC
|
ld hl, wRTC
|
||||||
ld de, wMisc
|
ld de, wc608
|
||||||
ld bc, $0004
|
ld bc, $0004
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
ld a, $5
|
ld a, $5
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, $b08c
|
ld hl, $b08c
|
||||||
ld de, wMisc
|
ld de, wc608
|
||||||
ld c, $4
|
ld c, $4
|
||||||
.compare_loop
|
.compare_loop
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
|
@ -7,7 +7,7 @@ DisplayCaughtContestMonStats: ; cc000
|
|||||||
ld hl, wOptions
|
ld hl, wOptions
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
set 4, [hl]
|
set NO_TEXT_SCROLL, [hl]
|
||||||
|
|
||||||
hlcoord 0, 0
|
hlcoord 0, 0
|
||||||
ld b, 4
|
ld b, 4
|
||||||
|
@ -325,15 +325,15 @@ CelebiEvent_SetBattleType: ; 49bf3
|
|||||||
|
|
||||||
CheckCaughtCelebi: ; 49bf9
|
CheckCaughtCelebi: ; 49bf9
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
bit 6, a
|
bit BATTLERESULT_CAUGHT_CELEBI, a
|
||||||
jr z, .false
|
jr z, .false
|
||||||
ld a, $1
|
ld a, TRUE
|
||||||
ld [wScriptVar], a
|
ld [wScriptVar], a
|
||||||
jr .done
|
jr .done
|
||||||
|
|
||||||
|
|
||||||
.false
|
.false
|
||||||
xor a
|
xor a ; FALSE
|
||||||
ld [wScriptVar], a
|
ld [wScriptVar], a
|
||||||
|
|
||||||
.done
|
.done
|
||||||
|
@ -143,12 +143,12 @@ AnimateHallOfFame: ; 864c3
|
|||||||
|
|
||||||
|
|
||||||
GetHallOfFameParty: ; 8653f
|
GetHallOfFameParty: ; 8653f
|
||||||
ld hl, wOverworldMap
|
ld hl, wHallOfFamePokemonList
|
||||||
ld bc, HOF_LENGTH
|
ld bc, wHallOfFamePokemonListEnd - wHallOfFamePokemonList + 1
|
||||||
xor a
|
xor a
|
||||||
call ByteFill
|
call ByteFill
|
||||||
ld a, [wHallOfFameCount]
|
ld a, [wHallOfFameCount]
|
||||||
ld de, wOverworldMap
|
ld de, wHallOfFamePokemonList
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
ld hl, wPartySpecies
|
ld hl, wPartySpecies
|
||||||
@ -216,7 +216,7 @@ GetHallOfFameParty: ; 8653f
|
|||||||
pop bc
|
pop bc
|
||||||
inc c
|
inc c
|
||||||
pop de
|
pop de
|
||||||
ld hl, HOF_MON_LENGTH
|
ld hl, wHallOfFamePokemonListMon1End - wHallOfFamePokemonListMon1
|
||||||
add hl, de
|
add hl, de
|
||||||
ld e, l
|
ld e, l
|
||||||
ld d, h
|
ld d, h
|
||||||
@ -224,7 +224,7 @@ GetHallOfFameParty: ; 8653f
|
|||||||
jr .next
|
jr .next
|
||||||
|
|
||||||
.done
|
.done
|
||||||
ld a, $ff
|
ld a, -1
|
||||||
ld [de], a
|
ld [de], a
|
||||||
ret
|
ret
|
||||||
; 865b5
|
; 865b5
|
||||||
@ -422,7 +422,7 @@ LoadHOFTeam: ; 8671c
|
|||||||
cp NUM_HOF_TEAMS
|
cp NUM_HOF_TEAMS
|
||||||
jr nc, .invalid
|
jr nc, .invalid
|
||||||
ld hl, sHallOfFame
|
ld hl, sHallOfFame
|
||||||
ld bc, HOF_LENGTH
|
ld bc, wHallOfFameTempEnd - wHallOfFameTemp + 1
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
ld a, BANK(sHallOfFame)
|
ld a, BANK(sHallOfFame)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
@ -430,7 +430,7 @@ LoadHOFTeam: ; 8671c
|
|||||||
and a
|
and a
|
||||||
jr z, .absent
|
jr z, .absent
|
||||||
ld de, wHallOfFameTemp
|
ld de, wHallOfFameTemp
|
||||||
ld bc, HOF_LENGTH
|
ld bc, wHallOfFameTempEnd - wHallOfFameTemp + 1
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
and a
|
and a
|
||||||
|
@ -179,7 +179,7 @@ CheckMapForSomethingToCut: ; c7ce
|
|||||||
farcall CheckCutCollision
|
farcall CheckCutCollision
|
||||||
pop de
|
pop de
|
||||||
jr nc, .fail
|
jr nc, .fail
|
||||||
; Get the location of the current block in wOverworldMap.
|
; Get the location of the current block in wOverworldMapBlocks.
|
||||||
call GetBlockLocation
|
call GetBlockLocation
|
||||||
ld c, [hl]
|
ld c, [hl]
|
||||||
; See if that block contains something that can be cut.
|
; See if that block contains something that can be cut.
|
||||||
@ -188,7 +188,7 @@ CheckMapForSomethingToCut: ; c7ce
|
|||||||
call CheckOverworldTileArrays
|
call CheckOverworldTileArrays
|
||||||
pop hl
|
pop hl
|
||||||
jr nc, .fail
|
jr nc, .fail
|
||||||
; Back up the wOverworldMap address to wBuffer3
|
; Back up the wOverworldMapBlocks address to wBuffer3
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [wBuffer3], a
|
ld [wBuffer3], a
|
||||||
ld a, h
|
ld a, h
|
||||||
|
@ -12,7 +12,7 @@ RotateUnownFrontpic: ; e0000
|
|||||||
ld de, wd002
|
ld de, wd002
|
||||||
call .Copy
|
call .Copy
|
||||||
call .Rotate
|
call .Rotate
|
||||||
ld hl, UnownPrinter_OverworldMapRectangle
|
ld hl, UnownPrinter_GBPrinterRectangle
|
||||||
pop bc
|
pop bc
|
||||||
add hl, bc
|
add hl, bc
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -30,7 +30,7 @@ RotateUnownFrontpic: ; e0000
|
|||||||
cp 7 * 7
|
cp 7 * 7
|
||||||
jr c, .loop
|
jr c, .loop
|
||||||
|
|
||||||
ld hl, wOverworldMap
|
ld hl, wGameboyPrinterRAM
|
||||||
ld de, sScratch
|
ld de, sScratch
|
||||||
ld bc, 7 * 7 tiles
|
ld bc, 7 * 7 tiles
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
@ -95,17 +95,17 @@ RotateUnownFrontpic: ; e0000
|
|||||||
jr nz, .loop_count
|
jr nz, .loop_count
|
||||||
ret
|
ret
|
||||||
|
|
||||||
overworldmaprect: MACRO
|
gbprinterrect: MACRO
|
||||||
y = 0
|
y = 0
|
||||||
rept \1
|
rept \1
|
||||||
x = \1 * (\2 + -1) + y
|
x = \1 * (\2 + -1) + y
|
||||||
rept \2
|
rept \2
|
||||||
dw wOverworldMap tile x
|
dw wGameboyPrinterRAM tile x
|
||||||
x = x + -\2
|
x = x + -\2
|
||||||
endr
|
endr
|
||||||
y = y + 1
|
y = y + 1
|
||||||
endr
|
endr
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
UnownPrinter_OverworldMapRectangle: ; e008b
|
UnownPrinter_GBPrinterRectangle: ; e008b
|
||||||
overworldmaprect 7, 7
|
gbprinterrect 7, 7
|
||||||
|
@ -12,7 +12,7 @@ ret_e00ed: ; e00ed (38:40ed)
|
|||||||
|
|
||||||
_CardFlip: ; e00ee (38:40ee)
|
_CardFlip: ; e00ee (38:40ee)
|
||||||
ld hl, wOptions
|
ld hl, wOptions
|
||||||
set 4, [hl]
|
set NO_TEXT_SCROLL, [hl]
|
||||||
call ClearBGPalettes
|
call ClearBGPalettes
|
||||||
call ClearTileMap
|
call ClearTileMap
|
||||||
call ClearSprites
|
call ClearSprites
|
||||||
|
@ -14,8 +14,8 @@ _UnownPuzzle: ; e1190
|
|||||||
xor a
|
xor a
|
||||||
ld [hBGMapMode], a
|
ld [hBGMapMode], a
|
||||||
call DisableLCD
|
call DisableLCD
|
||||||
ld hl, wMisc ; includes wPuzzlePieces
|
ld hl, wc608 ; includes wPuzzlePieces
|
||||||
ld bc, wMiscEnd - wMisc
|
ld bc, wc7e8 - wc608
|
||||||
xor a
|
xor a
|
||||||
call ByteFill
|
call ByteFill
|
||||||
ld hl, UnownPuzzleCursorGFX
|
ld hl, UnownPuzzleCursorGFX
|
||||||
|
@ -537,7 +537,7 @@ PokeBallEffect: ; e8a2
|
|||||||
cp BATTLETYPE_CELEBI
|
cp BATTLETYPE_CELEBI
|
||||||
jr nz, .not_celebi
|
jr nz, .not_celebi
|
||||||
ld hl, wBattleResult
|
ld hl, wBattleResult
|
||||||
set 6, [hl]
|
set BATTLERESULT_CAUGHT_CELEBI, [hl]
|
||||||
.not_celebi
|
.not_celebi
|
||||||
|
|
||||||
ld a, [wPartyCount]
|
ld a, [wPartyCount]
|
||||||
@ -615,7 +615,7 @@ PokeBallEffect: ; e8a2
|
|||||||
cp MONS_PER_BOX
|
cp MONS_PER_BOX
|
||||||
jr nz, .BoxNotFullYet
|
jr nz, .BoxNotFullYet
|
||||||
ld hl, wBattleResult
|
ld hl, wBattleResult
|
||||||
set 7, [hl]
|
set BATTLERESULT_BOX_FULL, [hl]
|
||||||
.BoxNotFullYet:
|
.BoxNotFullYet:
|
||||||
ld a, [wCurItem]
|
ld a, [wCurItem]
|
||||||
cp FRIEND_BALL
|
cp FRIEND_BALL
|
||||||
@ -2196,8 +2196,8 @@ PokeDollEffect: ; f48f
|
|||||||
inc a
|
inc a
|
||||||
ld [wForcedSwitch], a
|
ld [wForcedSwitch], a
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $c0
|
and BATTLERESULT_BITMASK
|
||||||
or $2
|
or DRAW
|
||||||
ld [wBattleResult], a
|
ld [wBattleResult], a
|
||||||
jp UseItemText
|
jp UseItemText
|
||||||
|
|
||||||
|
@ -84,9 +84,9 @@ Gen2ToGen1LinkComms: ; 2805d
|
|||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
ld a, SERIAL_NO_DATA_BYTE
|
ld a, SERIAL_NO_DATA_BYTE
|
||||||
ld [de], a
|
ld [de], a
|
||||||
ld hl, wMisc
|
ld hl, wLink_c608
|
||||||
ld de, wPlayerTrademonSpecies
|
ld de, wTrademons
|
||||||
ld bc, wPlayerTrademonSpecies - wMisc
|
ld bc, wTrademons - wLink_c608
|
||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
xor a
|
xor a
|
||||||
ld [rIF], a
|
ld [rIF], a
|
||||||
@ -229,9 +229,9 @@ Gen2ToGen2LinkComms: ; 28177
|
|||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
ld a, SERIAL_NO_DATA_BYTE
|
ld a, SERIAL_NO_DATA_BYTE
|
||||||
ld [de], a
|
ld [de], a
|
||||||
ld hl, wMisc
|
ld hl, wLink_c608
|
||||||
ld de, wPlayerTrademonSpecies
|
ld de, wTrademons
|
||||||
ld bc, $c8
|
ld bc, wTrademons - wLink_c608
|
||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
ld a, [wLinkMode]
|
ld a, [wLinkMode]
|
||||||
cp LINK_TRADECENTER
|
cp LINK_TRADECENTER
|
||||||
@ -581,7 +581,7 @@ FixDataForLinkTransfer: ; 28434
|
|||||||
ld [hli], a
|
ld [hli], a
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop2
|
jr nz, .loop2
|
||||||
ld hl, wMisc
|
ld hl, wLink_c608
|
||||||
ld a, SERIAL_PREAMBLE_BYTE
|
ld a, SERIAL_PREAMBLE_BYTE
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
|
@ -394,7 +394,7 @@ Function104b88: ; 104b88 (41:4b88)
|
|||||||
jp nz, Function104d32
|
jp nz, Function104d32
|
||||||
call Function104d38
|
call Function104d38
|
||||||
ret nz
|
ret nz
|
||||||
ld hl, wOverworldMap
|
ld hl, wLinkData
|
||||||
ld a, [wca02]
|
ld a, [wca02]
|
||||||
ld b, a
|
ld b, a
|
||||||
call Function104d4e
|
call Function104d4e
|
||||||
@ -551,7 +551,7 @@ Function104cd2: ; 104cd2 (41:4cd2)
|
|||||||
jp nz, Function104d32
|
jp nz, Function104d32
|
||||||
call Function104d38
|
call Function104d38
|
||||||
ret nz
|
ret nz
|
||||||
ld hl, wOverworldMap
|
ld hl, wLinkData
|
||||||
ld a, [wca02]
|
ld a, [wca02]
|
||||||
ld b, a
|
ld b, a
|
||||||
call Function104d4e
|
call Function104d4e
|
||||||
@ -1543,7 +1543,7 @@ Function105777: ; 105777 (41:5777)
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
Function10578c: ; 10578c (41:578c)
|
Function10578c: ; 10578c (41:578c)
|
||||||
ld de, wOverworldMap
|
ld de, wLinkData
|
||||||
ld a, BANK(sPlayerData)
|
ld a, BANK(sPlayerData)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, sPlayerData + wPlayerName - wPlayerData
|
ld hl, sPlayerData + wPlayerName - wPlayerData
|
||||||
|
@ -71,7 +71,7 @@ Function818f4: ; 818f4
|
|||||||
ld hl, PokemonPalettes
|
ld hl, PokemonPalettes
|
||||||
|
|
||||||
Function818fd: ; 818fd
|
Function818fd: ; 818fd
|
||||||
ld de, wOverworldMap
|
ld de, wOverworldMapBlocks
|
||||||
ld c, NUM_POKEMON + 1
|
ld c, NUM_POKEMON + 1
|
||||||
.asm_81902
|
.asm_81902
|
||||||
push bc
|
push bc
|
||||||
@ -87,7 +87,7 @@ Function818fd: ; 818fd
|
|||||||
|
|
||||||
Function81911: ; 81911
|
Function81911: ; 81911
|
||||||
ld hl, TrainerPalettes
|
ld hl, TrainerPalettes
|
||||||
ld de, wOverworldMap
|
ld de, wOverworldMapBlocks
|
||||||
ld c, NUM_TRAINER_CLASSES
|
ld c, NUM_TRAINER_CLASSES
|
||||||
.asm_81919
|
.asm_81919
|
||||||
push bc
|
push bc
|
||||||
@ -424,7 +424,7 @@ Function81bf4: ; 81bf4
|
|||||||
ld h, $0
|
ld h, $0
|
||||||
add hl, hl
|
add hl, hl
|
||||||
add hl, hl
|
add hl, hl
|
||||||
ld de, wOverworldMap
|
ld de, wOverworldMapBlocks
|
||||||
add hl, de
|
add hl, de
|
||||||
ld de, wc608
|
ld de, wc608
|
||||||
ld bc, 4
|
ld bc, 4
|
||||||
@ -876,7 +876,7 @@ Function81eca: ; 81eca
|
|||||||
ld h, $0
|
ld h, $0
|
||||||
add hl, hl
|
add hl, hl
|
||||||
add hl, hl
|
add hl, hl
|
||||||
ld de, wOverworldMap
|
ld de, wOverworldMapBlocks
|
||||||
add hl, de
|
add hl, de
|
||||||
ld e, l
|
ld e, l
|
||||||
ld d, h
|
ld d, h
|
||||||
|
@ -165,9 +165,9 @@ AddHallOfFameEntry: ; 14b5f
|
|||||||
ld a, c
|
ld a, c
|
||||||
or b
|
or b
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
ld hl, wOverworldMap
|
ld hl, wHallOfFamePokemonList
|
||||||
ld de, sHallOfFame
|
ld de, sHallOfFame
|
||||||
ld bc, HOF_LENGTH
|
ld bc, wHallOfFamePokemonListEnd - wHallOfFamePokemonList + 1
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
ret
|
ret
|
||||||
@ -943,8 +943,8 @@ endr
|
|||||||
; 150f9
|
; 150f9
|
||||||
|
|
||||||
SaveBoxAddress: ; 150f9
|
SaveBoxAddress: ; 150f9
|
||||||
; Save box via wMisc.
|
; Save box via wBoxPartialData.
|
||||||
; We do this in three steps because the size of wMisc is less than
|
; We do this in three steps because the size of wBoxPartialData is less than
|
||||||
; the size of sBox.
|
; the size of sBox.
|
||||||
push hl
|
push hl
|
||||||
; Load the first part of the active box.
|
; Load the first part of the active box.
|
||||||
@ -953,8 +953,8 @@ SaveBoxAddress: ; 150f9
|
|||||||
ld a, BANK(sBox)
|
ld a, BANK(sBox)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, sBox
|
ld hl, sBox
|
||||||
ld de, wMisc
|
ld de, wBoxPartialData
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
pop de
|
pop de
|
||||||
@ -963,23 +963,23 @@ SaveBoxAddress: ; 150f9
|
|||||||
push af
|
push af
|
||||||
push de
|
push de
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, wMisc
|
ld hl, wBoxPartialData
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
|
|
||||||
; Load the second part of the active box.
|
; Load the second part of the active box.
|
||||||
ld a, BANK(sBox)
|
ld a, BANK(sBox)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, sBox + (wMiscEnd - wMisc)
|
ld hl, sBox + (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
ld de, wMisc
|
ld de, wBoxPartialData
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
pop de
|
pop de
|
||||||
pop af
|
pop af
|
||||||
|
|
||||||
ld hl, (wMiscEnd - wMisc)
|
ld hl, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
add hl, de
|
add hl, de
|
||||||
ld e, l
|
ld e, l
|
||||||
ld d, h
|
ld d, h
|
||||||
@ -987,30 +987,30 @@ SaveBoxAddress: ; 150f9
|
|||||||
push af
|
push af
|
||||||
push de
|
push de
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, wMisc
|
ld hl, wBoxPartialData
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
|
|
||||||
; Load the third and final part of the active box.
|
; Load the third and final part of the active box.
|
||||||
ld a, BANK(sBox)
|
ld a, BANK(sBox)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, sBox + (wMiscEnd - wMisc) * 2
|
ld hl, sBox + (wBoxPartialDataEnd - wBoxPartialData) * 2
|
||||||
ld de, wMisc
|
ld de, wBoxPartialData
|
||||||
ld bc, sBoxEnd - (sBox + (wMiscEnd - wMisc) * 2) ; $8e
|
ld bc, sBoxEnd - (sBox + (wBoxPartialDataEnd - wBoxPartialData) * 2) ; $8e
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
pop de
|
pop de
|
||||||
pop af
|
pop af
|
||||||
|
|
||||||
ld hl, (wMiscEnd - wMisc)
|
ld hl, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
add hl, de
|
add hl, de
|
||||||
ld e, l
|
ld e, l
|
||||||
ld d, h
|
ld d, h
|
||||||
; Save it to the final part of the target box.
|
; Save it to the final part of the target box.
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, wMisc
|
ld hl, wBoxPartialData
|
||||||
ld bc, sBoxEnd - (sBox + (wMiscEnd - wMisc) * 2) ; $8e
|
ld bc, sBoxEnd - (sBox + (wBoxPartialDataEnd - wBoxPartialData) * 2) ; $8e
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
|
|
||||||
@ -1020,8 +1020,8 @@ SaveBoxAddress: ; 150f9
|
|||||||
|
|
||||||
|
|
||||||
LoadBoxAddress: ; 1517d (5:517d)
|
LoadBoxAddress: ; 1517d (5:517d)
|
||||||
; Load box via wMisc.
|
; Load box via wBoxPartialData.
|
||||||
; We do this in three steps because the size of wMisc is less than
|
; We do this in three steps because the size of wBoxPartialData is less than
|
||||||
; the size of sBox.
|
; the size of sBox.
|
||||||
push hl
|
push hl
|
||||||
ld l, e
|
ld l, e
|
||||||
@ -1030,52 +1030,52 @@ LoadBoxAddress: ; 1517d (5:517d)
|
|||||||
push af
|
push af
|
||||||
push hl
|
push hl
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld de, wMisc
|
ld de, wBoxPartialData
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
ld a, BANK(sBox)
|
ld a, BANK(sBox)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, wMisc
|
ld hl, wBoxPartialData
|
||||||
ld de, sBox
|
ld de, sBox
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
pop hl
|
pop hl
|
||||||
pop af
|
pop af
|
||||||
|
|
||||||
ld de, (wMiscEnd - wMisc)
|
ld de, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
add hl, de
|
add hl, de
|
||||||
; Load part 2
|
; Load part 2
|
||||||
push af
|
push af
|
||||||
push hl
|
push hl
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld de, wMisc
|
ld de, wBoxPartialData
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
ld a, BANK(sBox)
|
ld a, BANK(sBox)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, wMisc
|
ld hl, wBoxPartialData
|
||||||
ld de, sBox + (wMiscEnd - wMisc)
|
ld de, sBox + (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
ld bc, (wMiscEnd - wMisc)
|
ld bc, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
pop hl
|
pop hl
|
||||||
pop af
|
pop af
|
||||||
; Load part 3
|
; Load part 3
|
||||||
ld de, (wMiscEnd - wMisc)
|
ld de, (wBoxPartialDataEnd - wBoxPartialData)
|
||||||
add hl, de
|
add hl, de
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld de, wMisc
|
ld de, wBoxPartialData
|
||||||
ld bc, sBoxEnd - (sBox + (wMiscEnd - wMisc) * 2) ; $8e
|
ld bc, sBoxEnd - (sBox + (wBoxPartialDataEnd - wBoxPartialData) * 2) ; $8e
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
ld a, BANK(sBox)
|
ld a, BANK(sBox)
|
||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, wMisc
|
ld hl, wBoxPartialData
|
||||||
ld de, sBox + (wMiscEnd - wMisc) * 2
|
ld de, sBox + (wBoxPartialDataEnd - wBoxPartialData) * 2
|
||||||
ld bc, sBoxEnd - (sBox + (wMiscEnd - wMisc) * 2) ; $8e
|
ld bc, sBoxEnd - (sBox + (wBoxPartialDataEnd - wBoxPartialData) * 2) ; $8e
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ RunTradeAnimScript: ; 28fa1
|
|||||||
ld hl, wOptions
|
ld hl, wOptions
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
set 4, [hl]
|
set NO_TEXT_SCROLL, [hl]
|
||||||
call .TradeAnimLayout
|
call .TradeAnimLayout
|
||||||
ld a, [wcf66]
|
ld a, [wcf66]
|
||||||
and a
|
and a
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
_LoadMapPart:: ; 4d15b
|
_LoadMapPart:: ; 4d15b
|
||||||
ld hl, wMisc
|
ld hl, wSurroundingTiles
|
||||||
ld a, [wMetatileStandingY]
|
ld a, [wMetatileStandingY]
|
||||||
and a
|
and a
|
||||||
jr z, .top_row
|
jr z, .top_row
|
||||||
ld bc, WMISC_WIDTH * 2
|
ld bc, SURROUNDING_WIDTH * 2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
|
||||||
.top_row
|
.top_row
|
||||||
@ -25,7 +25,7 @@ _LoadMapPart:: ; 4d15b
|
|||||||
dec c
|
dec c
|
||||||
jr nz, .loop2
|
jr nz, .loop2
|
||||||
ld a, l
|
ld a, l
|
||||||
add 4
|
add METATILE_WIDTH
|
||||||
ld l, a
|
ld l, a
|
||||||
jr nc, .carry
|
jr nc, .carry
|
||||||
inc h
|
inc h
|
||||||
|
@ -1359,7 +1359,7 @@ Script_startbattle:
|
|||||||
call BufferScreen
|
call BufferScreen
|
||||||
predef StartBattle
|
predef StartBattle
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $3f
|
and $ff ^ BATTLERESULT_BITMASK
|
||||||
ld [wScriptVar], a
|
ld [wScriptVar], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1378,10 +1378,10 @@ Script_reloadmapafterbattle:
|
|||||||
|
|
||||||
ld hl, wBattleScriptFlags
|
ld hl, wBattleScriptFlags
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
ld [hl], $0
|
ld [hl], 0
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $3f
|
and $ff ^ BATTLERESULT_BITMASK
|
||||||
cp $1
|
cp LOSE
|
||||||
jr nz, .notblackedout
|
jr nz, .notblackedout
|
||||||
ld b, BANK(Script_BattleWhiteout)
|
ld b, BANK(Script_BattleWhiteout)
|
||||||
ld hl, Script_BattleWhiteout
|
ld hl, Script_BattleWhiteout
|
||||||
@ -1395,7 +1395,7 @@ Script_reloadmapafterbattle:
|
|||||||
|
|
||||||
.was_wild
|
.was_wild
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
bit 7, a
|
bit BATTLERESULT_BOX_FULL, a
|
||||||
jr z, .done
|
jr z, .done
|
||||||
ld b, BANK(Script_SpecialBillCall)
|
ld b, BANK(Script_SpecialBillCall)
|
||||||
ld de, Script_SpecialBillCall
|
ld de, Script_SpecialBillCall
|
||||||
|
@ -146,6 +146,6 @@ _GetVarAction:: ; 80648 (20:4648)
|
|||||||
|
|
||||||
.BattleResult: ; 80728
|
.BattleResult: ; 80728
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and $3f
|
and $ff ^ BATTLERESULT_BITMASK
|
||||||
jp .loadstringbuffer2
|
jp .loadstringbuffer2
|
||||||
; 80730
|
; 80730
|
||||||
|
@ -392,7 +392,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
|
|||||||
|
|
||||||
|
|
||||||
GetCoordOfUpperLeftCorner:: ; 10486d
|
GetCoordOfUpperLeftCorner:: ; 10486d
|
||||||
ld hl, wOverworldMap
|
ld hl, wOverworldMapBlocks
|
||||||
ld a, [wXCoord]
|
ld a, [wXCoord]
|
||||||
bit 0, a
|
bit 0, a
|
||||||
jr nz, .increment_then_halve1
|
jr nz, .increment_then_halve1
|
||||||
|
@ -2,7 +2,7 @@ _DepositPKMN: ; e2391 (38:6391)
|
|||||||
ld hl, wOptions
|
ld hl, wOptions
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
set 4, [hl]
|
set NO_TEXT_SCROLL, [hl]
|
||||||
ld a, [wVramState]
|
ld a, [wVramState]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
@ -264,7 +264,7 @@ _WithdrawPKMN: ; e2583 (38:6583)
|
|||||||
ld hl, wOptions
|
ld hl, wOptions
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
set 4, [hl]
|
set NO_TEXT_SCROLL, [hl]
|
||||||
ld a, [wVramState]
|
ld a, [wVramState]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
@ -507,7 +507,7 @@ _MovePKMNWithoutMail: ; e2759
|
|||||||
ld hl, wOptions
|
ld hl, wOptions
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
set 4, [hl]
|
set NO_TEXT_SCROLL, [hl]
|
||||||
ld a, [wVramState]
|
ld a, [wVramState]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CheckNickErrors:: ; 669f
|
CorrectNickErrors:: ; 669f
|
||||||
; error-check monster nick before use
|
; error-check monster nick before use
|
||||||
; must be a peace offering to gamesharkers
|
; must be a peace offering to gamesharkers
|
||||||
|
|
@ -778,7 +778,7 @@ PrintPartyMenuText: ; 5049a
|
|||||||
.gotstring ; 504be
|
.gotstring ; 504be
|
||||||
ld a, [wOptions]
|
ld a, [wOptions]
|
||||||
push af
|
push af
|
||||||
set 4, a ; disable text delay
|
set NO_TEXT_SCROLL, a
|
||||||
ld [wOptions], a
|
ld [wOptions], a
|
||||||
hlcoord 1, 16 ; Coord
|
hlcoord 1, 16 ; Coord
|
||||||
call PlaceString
|
call PlaceString
|
||||||
|
@ -772,7 +772,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
|
|||||||
ld hl, .OTNamePointers
|
ld hl, .OTNamePointers
|
||||||
call GetNicknamePointer
|
call GetNicknamePointer
|
||||||
call CopyNickname
|
call CopyNickname
|
||||||
farcall CheckNickErrors
|
farcall CorrectNickErrors
|
||||||
hlcoord 2, 13
|
hlcoord 2, 13
|
||||||
call PlaceString
|
call PlaceString
|
||||||
ld a, [wTempMonCaughtGender]
|
ld a, [wTempMonCaughtGender]
|
||||||
|
25
home/clear_sprites.asm
Normal file
25
home/clear_sprites.asm
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
ClearSprites:: ; 300b
|
||||||
|
; Erase OAM data
|
||||||
|
ld hl, wVirtualOAM
|
||||||
|
ld b, wVirtualOAMEnd - wVirtualOAM
|
||||||
|
xor a
|
||||||
|
.loop
|
||||||
|
ld [hli], a
|
||||||
|
dec b
|
||||||
|
jr nz, .loop
|
||||||
|
ret
|
||||||
|
; 3016
|
||||||
|
|
||||||
|
HideSprites:: ; 3016
|
||||||
|
; Set all OAM y-positions to 160 to hide them offscreen
|
||||||
|
ld hl, wVirtualOAMSprite00YCoord
|
||||||
|
ld de, SPRITEOAMSTRUCT_LENGTH
|
||||||
|
ld b, NUM_SPRITE_OAM_STRUCTS
|
||||||
|
ld a, SCREEN_WIDTH_PX
|
||||||
|
.loop
|
||||||
|
ld [hl], a ; y
|
||||||
|
add hl, de
|
||||||
|
dec b
|
||||||
|
jr nz, .loop
|
||||||
|
ret
|
||||||
|
; 3026
|
14
home/copy_name.asm
Normal file
14
home/copy_name.asm
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
CopyName1:: ; 30d6
|
||||||
|
; Copies the name from de to wStringBuffer2
|
||||||
|
ld hl, wStringBuffer2
|
||||||
|
|
||||||
|
CopyName2:: ; 30d9
|
||||||
|
; Copies the name from de to hl
|
||||||
|
.loop
|
||||||
|
ld a, [de]
|
||||||
|
inc de
|
||||||
|
ld [hli], a
|
||||||
|
cp "@"
|
||||||
|
jr nz, .loop
|
||||||
|
ret
|
||||||
|
; 30e1
|
38
home/copy_tilemap.asm
Normal file
38
home/copy_tilemap.asm
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
LoadTileMapToTempTileMap:: ; 309d
|
||||||
|
; Load wTileMap into wTempTileMap
|
||||||
|
ld a, [rSVBK]
|
||||||
|
push af
|
||||||
|
ld a, BANK(wTempTileMap)
|
||||||
|
ld [rSVBK], a
|
||||||
|
hlcoord 0, 0
|
||||||
|
decoord 0, 0, wTempTileMap
|
||||||
|
ld bc, wTileMapEnd - wTileMap
|
||||||
|
call CopyBytes
|
||||||
|
pop af
|
||||||
|
ld [rSVBK], a
|
||||||
|
ret
|
||||||
|
; 30b4
|
||||||
|
|
||||||
|
Call_LoadTempTileMapToTileMap:: ; 30b4
|
||||||
|
xor a
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
call LoadTempTileMapToTileMap
|
||||||
|
ld a, 1
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ret
|
||||||
|
; 30bf
|
||||||
|
|
||||||
|
LoadTempTileMapToTileMap:: ; 30bf
|
||||||
|
; Load wTempTileMap into wTileMap
|
||||||
|
ld a, [rSVBK]
|
||||||
|
push af
|
||||||
|
ld a, BANK(wTempTileMap)
|
||||||
|
ld [rSVBK], a
|
||||||
|
hlcoord 0, 0, wTempTileMap
|
||||||
|
decoord 0, 0
|
||||||
|
ld bc, wTileMapEnd - wTileMap
|
||||||
|
call CopyBytes
|
||||||
|
pop af
|
||||||
|
ld [rSVBK], a
|
||||||
|
ret
|
||||||
|
; 30d6
|
58
home/map.asm
58
home/map.asm
@ -109,7 +109,7 @@ LoadMapPart:: ; 217a
|
|||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
|
|
||||||
call LoadMetatiles
|
call LoadMetatiles
|
||||||
ld a, $60
|
ld a, "■"
|
||||||
hlcoord 0, 0
|
hlcoord 0, 0
|
||||||
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
||||||
call ByteFill
|
call ByteFill
|
||||||
@ -129,13 +129,13 @@ LoadMetatiles:: ; 2198
|
|||||||
ld e, a
|
ld e, a
|
||||||
ld a, [wOverworldMapAnchor + 1]
|
ld a, [wOverworldMapAnchor + 1]
|
||||||
ld d, a
|
ld d, a
|
||||||
ld hl, wMisc
|
ld hl, wSurroundingTiles
|
||||||
ld b, WMISC_HEIGHT / 4 ; 5
|
ld b, SURROUNDING_HEIGHT / METATILE_WIDTH ; 5
|
||||||
|
|
||||||
.row
|
.row
|
||||||
push de
|
push de
|
||||||
push hl
|
push hl
|
||||||
ld c, WMISC_WIDTH / 4 ; 6
|
ld c, SURROUNDING_WIDTH / METATILE_WIDTH ; 6
|
||||||
|
|
||||||
.col
|
.col
|
||||||
push de
|
push de
|
||||||
@ -148,7 +148,7 @@ LoadMetatiles:: ; 2198
|
|||||||
ld a, [wMapBorderBlock]
|
ld a, [wMapBorderBlock]
|
||||||
|
|
||||||
.ok
|
.ok
|
||||||
; Load the current wMisc address into de.
|
; Load the current wSurroundingTiles address into de.
|
||||||
ld e, l
|
ld e, l
|
||||||
ld d, h
|
ld d, h
|
||||||
; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles).
|
; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles).
|
||||||
@ -169,27 +169,27 @@ LoadMetatiles:: ; 2198
|
|||||||
ld h, a
|
ld h, a
|
||||||
|
|
||||||
; copy the 4x4 metatile
|
; copy the 4x4 metatile
|
||||||
rept 3
|
rept METATILE_WIDTH + -1
|
||||||
rept 4
|
rept METATILE_WIDTH
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
endr
|
endr
|
||||||
ld a, e
|
ld a, e
|
||||||
add WMISC_WIDTH - 4
|
add SURROUNDING_WIDTH - METATILE_WIDTH
|
||||||
ld e, a
|
ld e, a
|
||||||
jr nc, .next\@
|
jr nc, .next\@
|
||||||
inc d
|
inc d
|
||||||
.next\@
|
.next\@
|
||||||
endr
|
endr
|
||||||
rept 4
|
rept METATILE_WIDTH
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
endr
|
endr
|
||||||
; Next metatile
|
; Next metatile
|
||||||
pop hl
|
pop hl
|
||||||
ld de, 4
|
ld de, METATILE_WIDTH
|
||||||
add hl, de
|
add hl, de
|
||||||
pop de
|
pop de
|
||||||
inc de
|
inc de
|
||||||
@ -197,7 +197,7 @@ endr
|
|||||||
jp nz, .col
|
jp nz, .col
|
||||||
; Next metarow
|
; Next metarow
|
||||||
pop hl
|
pop hl
|
||||||
ld de, WMISC_WIDTH * 4
|
ld de, SURROUNDING_WIDTH * METATILE_WIDTH
|
||||||
add hl, de
|
add hl, de
|
||||||
pop de
|
pop de
|
||||||
ld a, [wMapWidth]
|
ld a, [wMapWidth]
|
||||||
@ -260,10 +260,10 @@ GetDestinationWarpNumber:: ; 2252
|
|||||||
|
|
||||||
.GetDestinationWarpNumber: ; 2266
|
.GetDestinationWarpNumber: ; 2266
|
||||||
ld a, [wPlayerStandingMapY]
|
ld a, [wPlayerStandingMapY]
|
||||||
sub $4
|
sub 4
|
||||||
ld e, a
|
ld e, a
|
||||||
ld a, [wPlayerStandingMapX]
|
ld a, [wPlayerStandingMapX]
|
||||||
sub $4
|
sub 4
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, [wCurrMapWarpCount]
|
ld a, [wCurrMapWarpCount]
|
||||||
and a
|
and a
|
||||||
@ -732,8 +732,8 @@ RestoreFacingAfterWarp:: ; 248a
|
|||||||
; 24cd
|
; 24cd
|
||||||
|
|
||||||
LoadBlockData:: ; 24cd
|
LoadBlockData:: ; 24cd
|
||||||
ld hl, wOverworldMap
|
ld hl, wOverworldMapBlocks
|
||||||
ld bc, wOverworldMapEnd - wOverworldMap
|
ld bc, wOverworldMapBlocksEnd - wOverworldMapBlocks
|
||||||
ld a, 0
|
ld a, 0
|
||||||
call ByteFill
|
call ByteFill
|
||||||
call ChangeMap
|
call ChangeMap
|
||||||
@ -747,7 +747,7 @@ ChangeMap:: ; 24e4
|
|||||||
ld a, [hROMBank]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
|
|
||||||
ld hl, wOverworldMap
|
ld hl, wOverworldMapBlocks
|
||||||
ld a, [wMapWidth]
|
ld a, [wMapWidth]
|
||||||
ld [hConnectedMapWidth], a
|
ld [hConnectedMapWidth], a
|
||||||
add $6
|
add $6
|
||||||
@ -1454,8 +1454,8 @@ BufferScreen:: ; 2879
|
|||||||
ld h, [hl]
|
ld h, [hl]
|
||||||
ld l, a
|
ld l, a
|
||||||
ld de, wScreenSave
|
ld de, wScreenSave
|
||||||
ld c, $5
|
ld c, SCREEN_META_HEIGHT
|
||||||
ld b, $6
|
ld b, SCREEN_META_WIDTH
|
||||||
.row
|
.row
|
||||||
push bc
|
push bc
|
||||||
push hl
|
push hl
|
||||||
@ -1467,9 +1467,9 @@ BufferScreen:: ; 2879
|
|||||||
jr nz, .col
|
jr nz, .col
|
||||||
pop hl
|
pop hl
|
||||||
ld a, [wMapWidth]
|
ld a, [wMapWidth]
|
||||||
add $6
|
add 6
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, $0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop bc
|
pop bc
|
||||||
dec c
|
dec c
|
||||||
@ -1498,18 +1498,18 @@ SaveScreen:: ; 289d
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.up
|
.up
|
||||||
ld de, wScreenSave + 6
|
ld de, wScreenSave + SCREEN_META_WIDTH
|
||||||
ld a, [hMapObjectIndexBuffer]
|
ld a, [hMapObjectIndexBuffer]
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, $0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
jr .vertical
|
jr .vertical
|
||||||
|
|
||||||
.down
|
.down
|
||||||
ld de, wScreenSave
|
ld de, wScreenSave
|
||||||
.vertical
|
.vertical
|
||||||
ld b, 6
|
ld b, SCREEN_META_WIDTH
|
||||||
ld c, 4
|
ld c, SCREEN_META_HEIGHT - 1
|
||||||
jr SaveScreen_LoadNeighbor
|
jr SaveScreen_LoadNeighbor
|
||||||
|
|
||||||
.left
|
.left
|
||||||
@ -1520,8 +1520,8 @@ SaveScreen:: ; 289d
|
|||||||
.right
|
.right
|
||||||
ld de, wScreenSave
|
ld de, wScreenSave
|
||||||
.horizontal
|
.horizontal
|
||||||
ld b, 5
|
ld b, SCREEN_META_WIDTH - 1
|
||||||
ld c, 5
|
ld c, SCREEN_META_HEIGHT
|
||||||
jr SaveScreen_LoadNeighbor
|
jr SaveScreen_LoadNeighbor
|
||||||
|
|
||||||
LoadNeighboringBlockData:: ; 28e3
|
LoadNeighboringBlockData:: ; 28e3
|
||||||
@ -1533,8 +1533,8 @@ LoadNeighboringBlockData:: ; 28e3
|
|||||||
add 6
|
add 6
|
||||||
ld [hConnectionStripLength], a
|
ld [hConnectionStripLength], a
|
||||||
ld de, wScreenSave
|
ld de, wScreenSave
|
||||||
ld b, 6
|
ld b, SCREEN_META_WIDTH
|
||||||
ld c, 5
|
ld c, SCREEN_META_HEIGHT
|
||||||
|
|
||||||
SaveScreen_LoadNeighbor:: ; 28f7
|
SaveScreen_LoadNeighbor:: ; 28f7
|
||||||
.row
|
.row
|
||||||
@ -1816,7 +1816,7 @@ GetBlockLocation:: ; 2a66
|
|||||||
add 6
|
add 6
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wOverworldMap + 1
|
ld hl, wOverworldMapBlocks + 1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, e
|
ld a, e
|
||||||
srl a
|
srl a
|
||||||
|
257
home/menu_window.asm
Normal file
257
home/menu_window.asm
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
PushWindow:: ; 1c00
|
||||||
|
callfar _PushWindow
|
||||||
|
ret
|
||||||
|
; 1c07
|
||||||
|
|
||||||
|
ExitMenu:: ; 0x1c07
|
||||||
|
push af
|
||||||
|
callfar _ExitMenu
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
|
InitVerticalMenuCursor:: ; 0x1c10
|
||||||
|
callfar _InitVerticalMenuCursor
|
||||||
|
ret
|
||||||
|
|
||||||
|
CloseWindow:: ; 0x1c17
|
||||||
|
push af
|
||||||
|
call ExitMenu
|
||||||
|
call ApplyTilemap
|
||||||
|
call UpdateSprites
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
|
RestoreTileBackup:: ; 0x1c23
|
||||||
|
call MenuBoxCoord2Tile
|
||||||
|
call .copy
|
||||||
|
call MenuBoxCoord2Attr
|
||||||
|
call .copy
|
||||||
|
ret
|
||||||
|
; 0x1c30
|
||||||
|
|
||||||
|
.copy ; 0x1c30
|
||||||
|
call GetMenuBoxDims
|
||||||
|
inc b
|
||||||
|
inc c
|
||||||
|
|
||||||
|
.row
|
||||||
|
push bc
|
||||||
|
push hl
|
||||||
|
|
||||||
|
.col
|
||||||
|
ld a, [de]
|
||||||
|
ld [hli], a
|
||||||
|
dec de
|
||||||
|
dec c
|
||||||
|
jr nz, .col ; 0x1c3b $fa
|
||||||
|
|
||||||
|
pop hl
|
||||||
|
ld bc, SCREEN_WIDTH
|
||||||
|
add hl, bc
|
||||||
|
pop bc
|
||||||
|
dec b
|
||||||
|
jr nz, .row ; 0x1c44 $ef
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
PopWindow:: ; 0x1c47
|
||||||
|
ld b, $10
|
||||||
|
ld de, wMenuFlags
|
||||||
|
.loop
|
||||||
|
ld a, [hld]
|
||||||
|
ld [de], a
|
||||||
|
inc de
|
||||||
|
dec b
|
||||||
|
jr nz, .loop ; 0x1c50 $fa
|
||||||
|
ret
|
||||||
|
|
||||||
|
GetMenuBoxDims:: ; 0x1c53
|
||||||
|
ld a, [wMenuBorderTopCoord] ; top
|
||||||
|
ld b, a
|
||||||
|
ld a, [wMenuBorderBottomCoord] ; bottom
|
||||||
|
sub b
|
||||||
|
ld b, a
|
||||||
|
ld a, [wMenuBorderLeftCoord] ; left
|
||||||
|
ld c, a
|
||||||
|
ld a, [wMenuBorderRightCoord] ; right
|
||||||
|
sub c
|
||||||
|
ld c, a
|
||||||
|
ret
|
||||||
|
; 0x1c66
|
||||||
|
|
||||||
|
CopyMenuData:: ; 1c66
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
push bc
|
||||||
|
push af
|
||||||
|
ld hl, wMenuDataPointer
|
||||||
|
ld a, [hli]
|
||||||
|
ld h, [hl]
|
||||||
|
ld l, a
|
||||||
|
ld de, wMenuDataFlags
|
||||||
|
ld bc, wMenuDataEnd - wMenuDataFlags
|
||||||
|
call CopyBytes
|
||||||
|
pop af
|
||||||
|
pop bc
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 1c7e
|
||||||
|
|
||||||
|
GetWindowStackTop:: ; 1c7e
|
||||||
|
ld hl, wWindowStackPointer
|
||||||
|
ld a, [hli]
|
||||||
|
ld h, [hl]
|
||||||
|
ld l, a
|
||||||
|
inc hl
|
||||||
|
ld a, [hli]
|
||||||
|
ld h, [hl]
|
||||||
|
ld l, a
|
||||||
|
ret
|
||||||
|
; 1c89
|
||||||
|
|
||||||
|
PlaceVerticalMenuItems:: ; 1c89
|
||||||
|
call CopyMenuData
|
||||||
|
ld hl, wMenuDataPointer
|
||||||
|
ld e, [hl]
|
||||||
|
inc hl
|
||||||
|
ld d, [hl]
|
||||||
|
call GetMenuTextStartCoord
|
||||||
|
call Coord2Tile ; hl now contains the tilemap address where we will start printing text.
|
||||||
|
inc de
|
||||||
|
ld a, [de] ; Number of items
|
||||||
|
inc de
|
||||||
|
ld b, a
|
||||||
|
.loop
|
||||||
|
push bc
|
||||||
|
call PlaceString
|
||||||
|
inc de
|
||||||
|
ld bc, 2 * SCREEN_WIDTH
|
||||||
|
add hl, bc
|
||||||
|
pop bc
|
||||||
|
dec b
|
||||||
|
jr nz, .loop
|
||||||
|
|
||||||
|
ld a, [wMenuDataFlags]
|
||||||
|
bit 4, a
|
||||||
|
ret z
|
||||||
|
|
||||||
|
call MenuBoxCoord2Tile
|
||||||
|
ld a, [de]
|
||||||
|
ld c, a
|
||||||
|
inc de
|
||||||
|
ld b, $0
|
||||||
|
add hl, bc
|
||||||
|
jp PlaceString
|
||||||
|
; 1cbb
|
||||||
|
|
||||||
|
MenuBox:: ; 1cbb
|
||||||
|
call MenuBoxCoord2Tile
|
||||||
|
call GetMenuBoxDims
|
||||||
|
dec b
|
||||||
|
dec c
|
||||||
|
jp TextBox
|
||||||
|
; 1cc6
|
||||||
|
|
||||||
|
GetMenuTextStartCoord:: ; 1cc6
|
||||||
|
ld a, [wMenuBorderTopCoord]
|
||||||
|
ld b, a
|
||||||
|
inc b
|
||||||
|
ld a, [wMenuBorderLeftCoord]
|
||||||
|
ld c, a
|
||||||
|
inc c
|
||||||
|
; bit 6: if not set, leave extra room on top
|
||||||
|
ld a, [wMenuDataFlags]
|
||||||
|
bit 6, a
|
||||||
|
jr nz, .bit_6_set
|
||||||
|
inc b
|
||||||
|
|
||||||
|
.bit_6_set
|
||||||
|
; bit 7: if set, leave extra room on the left
|
||||||
|
ld a, [wMenuDataFlags]
|
||||||
|
bit 7, a
|
||||||
|
jr z, .bit_7_clear
|
||||||
|
inc c
|
||||||
|
|
||||||
|
.bit_7_clear
|
||||||
|
ret
|
||||||
|
; 1ce1
|
||||||
|
|
||||||
|
ClearMenuBoxInterior:: ; 1ce1
|
||||||
|
call MenuBoxCoord2Tile
|
||||||
|
ld bc, SCREEN_WIDTH + 1
|
||||||
|
add hl, bc
|
||||||
|
call GetMenuBoxDims
|
||||||
|
dec b
|
||||||
|
dec c
|
||||||
|
call ClearBox
|
||||||
|
ret
|
||||||
|
; 1cf1
|
||||||
|
|
||||||
|
ClearWholeMenuBox:: ; 1cf1
|
||||||
|
call MenuBoxCoord2Tile
|
||||||
|
call GetMenuBoxDims
|
||||||
|
inc c
|
||||||
|
inc b
|
||||||
|
call ClearBox
|
||||||
|
ret
|
||||||
|
; 1cfd
|
||||||
|
|
||||||
|
|
||||||
|
MenuBoxCoord2Tile:: ; 1cfd
|
||||||
|
ld a, [wMenuBorderLeftCoord]
|
||||||
|
ld c, a
|
||||||
|
ld a, [wMenuBorderTopCoord]
|
||||||
|
ld b, a
|
||||||
|
; 1d05
|
||||||
|
|
||||||
|
|
||||||
|
Coord2Tile:: ; 1d05
|
||||||
|
; Return the address of wTileMap(c, b) in hl.
|
||||||
|
xor a
|
||||||
|
ld h, a
|
||||||
|
ld l, b
|
||||||
|
ld a, c
|
||||||
|
ld b, h
|
||||||
|
ld c, l
|
||||||
|
add hl, hl
|
||||||
|
add hl, hl
|
||||||
|
add hl, bc
|
||||||
|
add hl, hl
|
||||||
|
add hl, hl
|
||||||
|
ld c, a
|
||||||
|
xor a
|
||||||
|
ld b, a
|
||||||
|
add hl, bc
|
||||||
|
bccoord 0, 0
|
||||||
|
add hl, bc
|
||||||
|
ret
|
||||||
|
; 1d19
|
||||||
|
|
||||||
|
MenuBoxCoord2Attr:: ; 1d19
|
||||||
|
ld a, [wMenuBorderLeftCoord]
|
||||||
|
ld c, a
|
||||||
|
ld a, [wMenuBorderTopCoord]
|
||||||
|
ld b, a
|
||||||
|
|
||||||
|
Coord2Attr:: ; 1d21
|
||||||
|
; Return the address of wAttrMap(c, b) in hl.
|
||||||
|
xor a
|
||||||
|
ld h, a
|
||||||
|
ld l, b
|
||||||
|
ld a, c
|
||||||
|
ld b, h
|
||||||
|
ld c, l
|
||||||
|
add hl, hl
|
||||||
|
add hl, hl
|
||||||
|
add hl, bc
|
||||||
|
add hl, hl
|
||||||
|
add hl, hl
|
||||||
|
ld c, a
|
||||||
|
xor a
|
||||||
|
ld b, a
|
||||||
|
add hl, bc
|
||||||
|
bccoord 0, 0, wAttrMap
|
||||||
|
add hl, bc
|
||||||
|
ret
|
||||||
|
; 1d35
|
90
home/mon_data.asm
Normal file
90
home/mon_data.asm
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
Unreferenced_GetNthMove:: ; 384d
|
||||||
|
ld hl, wListMoves_MoveIndicesBuffer
|
||||||
|
ld c, a
|
||||||
|
ld b, 0
|
||||||
|
add hl, bc
|
||||||
|
ld a, [hl]
|
||||||
|
ret
|
||||||
|
; 3856
|
||||||
|
|
||||||
|
GetBaseData:: ; 3856
|
||||||
|
push bc
|
||||||
|
push de
|
||||||
|
push hl
|
||||||
|
ld a, [hROMBank]
|
||||||
|
push af
|
||||||
|
ld a, BANK(BaseData)
|
||||||
|
rst Bankswitch
|
||||||
|
|
||||||
|
; Egg doesn't have BaseData
|
||||||
|
ld a, [wCurSpecies]
|
||||||
|
cp EGG
|
||||||
|
jr z, .egg
|
||||||
|
|
||||||
|
; Get BaseData
|
||||||
|
dec a
|
||||||
|
ld bc, BASE_DATA_SIZE
|
||||||
|
ld hl, BaseData
|
||||||
|
call AddNTimes
|
||||||
|
ld de, wCurBaseData
|
||||||
|
ld bc, BASE_DATA_SIZE
|
||||||
|
call CopyBytes
|
||||||
|
jr .end
|
||||||
|
|
||||||
|
.egg
|
||||||
|
; ????
|
||||||
|
ld de, UnknownEggPic
|
||||||
|
|
||||||
|
; Sprite dimensions
|
||||||
|
ld b, $55 ; 5x5
|
||||||
|
ld hl, wBasePicSize
|
||||||
|
ld [hl], b
|
||||||
|
|
||||||
|
; ????
|
||||||
|
ld hl, wBasePadding
|
||||||
|
ld [hl], e
|
||||||
|
inc hl
|
||||||
|
ld [hl], d
|
||||||
|
inc hl
|
||||||
|
ld [hl], e
|
||||||
|
inc hl
|
||||||
|
ld [hl], d
|
||||||
|
jr .end
|
||||||
|
|
||||||
|
.end
|
||||||
|
; Replace Pokedex # with species
|
||||||
|
ld a, [wCurSpecies]
|
||||||
|
ld [wBaseDexNo], a
|
||||||
|
|
||||||
|
pop af
|
||||||
|
rst Bankswitch
|
||||||
|
pop hl
|
||||||
|
pop de
|
||||||
|
pop bc
|
||||||
|
ret
|
||||||
|
; 389c
|
||||||
|
|
||||||
|
GetCurNick:: ; 389c
|
||||||
|
ld a, [wCurPartyMon]
|
||||||
|
ld hl, wPartyMonNicknames
|
||||||
|
|
||||||
|
GetNick:: ; 38a2
|
||||||
|
; Get nickname a from list hl.
|
||||||
|
|
||||||
|
push hl
|
||||||
|
push bc
|
||||||
|
|
||||||
|
call SkipNames
|
||||||
|
ld de, wStringBuffer1
|
||||||
|
|
||||||
|
push de
|
||||||
|
ld bc, MON_NAME_LENGTH
|
||||||
|
call CopyBytes
|
||||||
|
pop de
|
||||||
|
|
||||||
|
callfar CorrectNickErrors
|
||||||
|
|
||||||
|
pop bc
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 38bb
|
37
home/mon_data_2.asm
Normal file
37
home/mon_data_2.asm
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
GetPartyParamLocation:: ; 3917
|
||||||
|
; Get the location of parameter a from wCurPartyMon in hl
|
||||||
|
push bc
|
||||||
|
ld hl, wPartyMons
|
||||||
|
ld c, a
|
||||||
|
ld b, 0
|
||||||
|
add hl, bc
|
||||||
|
ld a, [wCurPartyMon]
|
||||||
|
call GetPartyLocation
|
||||||
|
pop bc
|
||||||
|
ret
|
||||||
|
; 3927
|
||||||
|
|
||||||
|
GetPartyLocation:: ; 3927
|
||||||
|
; Add the length of a PartyMon struct to hl a times.
|
||||||
|
ld bc, PARTYMON_STRUCT_LENGTH
|
||||||
|
jp AddNTimes
|
||||||
|
; 392d
|
||||||
|
|
||||||
|
Unreferenced_GetDexNumber:: ; 392d
|
||||||
|
; Probably used in gen 1 to convert index number to dex number
|
||||||
|
; Not required in gen 2 because index number == dex number
|
||||||
|
push hl
|
||||||
|
ld a, b
|
||||||
|
dec a
|
||||||
|
ld b, 0
|
||||||
|
add hl, bc
|
||||||
|
ld hl, BaseData + BASE_DEX_NO
|
||||||
|
ld bc, BASE_DATA_SIZE
|
||||||
|
call AddNTimes
|
||||||
|
ld a, BANK(BaseData)
|
||||||
|
call GetFarHalfword
|
||||||
|
ld b, l
|
||||||
|
ld c, h
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 3945
|
107
home/mon_stats.asm
Normal file
107
home/mon_stats.asm
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
IsAPokemon:: ; 3741
|
||||||
|
; Return carry if species a is not a Pokemon.
|
||||||
|
and a
|
||||||
|
jr z, .NotAPokemon
|
||||||
|
cp EGG
|
||||||
|
jr z, .Pokemon
|
||||||
|
cp NUM_POKEMON + 1
|
||||||
|
jr c, .Pokemon
|
||||||
|
|
||||||
|
.NotAPokemon:
|
||||||
|
scf
|
||||||
|
ret
|
||||||
|
|
||||||
|
.Pokemon:
|
||||||
|
and a
|
||||||
|
ret
|
||||||
|
; 3750
|
||||||
|
|
||||||
|
DrawBattleHPBar:: ; 3750
|
||||||
|
; Draw an HP bar d tiles long at hl
|
||||||
|
; Fill it up to e pixels
|
||||||
|
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
push bc
|
||||||
|
|
||||||
|
; Place 'HP:'
|
||||||
|
ld a, $60
|
||||||
|
ld [hli], a
|
||||||
|
ld a, $61
|
||||||
|
ld [hli], a
|
||||||
|
|
||||||
|
; Draw a template
|
||||||
|
push hl
|
||||||
|
ld a, $62 ; empty bar
|
||||||
|
.template
|
||||||
|
ld [hli], a
|
||||||
|
dec d
|
||||||
|
jr nz, .template
|
||||||
|
ld a, $6b ; bar end
|
||||||
|
add b
|
||||||
|
ld [hl], a
|
||||||
|
pop hl
|
||||||
|
|
||||||
|
; Safety check # pixels
|
||||||
|
ld a, e
|
||||||
|
and a
|
||||||
|
jr nz, .fill
|
||||||
|
ld a, c
|
||||||
|
and a
|
||||||
|
jr z, .done
|
||||||
|
ld e, 1
|
||||||
|
|
||||||
|
.fill
|
||||||
|
; Keep drawing tiles until pixel length is reached
|
||||||
|
ld a, e
|
||||||
|
sub TILE_WIDTH
|
||||||
|
jr c, .lastbar
|
||||||
|
|
||||||
|
ld e, a
|
||||||
|
ld a, $6a ; full bar
|
||||||
|
ld [hli], a
|
||||||
|
ld a, e
|
||||||
|
and a
|
||||||
|
jr z, .done
|
||||||
|
jr .fill
|
||||||
|
|
||||||
|
.lastbar
|
||||||
|
ld a, $62 ; empty bar
|
||||||
|
add e ; + e
|
||||||
|
ld [hl], a
|
||||||
|
|
||||||
|
.done
|
||||||
|
pop bc
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 3786
|
||||||
|
|
||||||
|
PrepMonFrontpic:: ; 3786
|
||||||
|
ld a, $1
|
||||||
|
ld [wBoxAlignment], a
|
||||||
|
|
||||||
|
_PrepMonFrontpic:: ; 378b
|
||||||
|
ld a, [wCurPartySpecies]
|
||||||
|
call IsAPokemon
|
||||||
|
jr c, .not_pokemon
|
||||||
|
|
||||||
|
push hl
|
||||||
|
ld de, vTiles2
|
||||||
|
predef GetMonFrontpic
|
||||||
|
pop hl
|
||||||
|
xor a
|
||||||
|
ld [hGraphicStartTile], a
|
||||||
|
lb bc, 7, 7
|
||||||
|
predef PlaceGraphic
|
||||||
|
xor a
|
||||||
|
ld [wBoxAlignment], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.not_pokemon
|
||||||
|
xor a
|
||||||
|
ld [wBoxAlignment], a
|
||||||
|
inc a
|
||||||
|
ld [wCurPartySpecies], a
|
||||||
|
ret
|
||||||
|
; 37b6
|
81
home/print_bcd.asm
Normal file
81
home/print_bcd.asm
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
PrintBCDNumber:: ; 38bb
|
||||||
|
; function to print a BCD (Binary-coded decimal) number
|
||||||
|
; de = address of BCD number
|
||||||
|
; hl = destination address
|
||||||
|
; c = flags and length
|
||||||
|
; bit 7: if set, do not print leading zeroes
|
||||||
|
; if unset, print leading zeroes
|
||||||
|
; bit 6: if set, left-align the string (do not pad empty digits with spaces)
|
||||||
|
; if unset, right-align the string
|
||||||
|
; bit 5: if set, print currency symbol at the beginning of the string
|
||||||
|
; if unset, do not print the currency symbol
|
||||||
|
; bits 0-4: length of BCD number in bytes
|
||||||
|
; Note that bits 5 and 7 are modified during execution. The above reflects
|
||||||
|
; their meaning at the beginning of the functions's execution.
|
||||||
|
ld b, c ; save flags in b
|
||||||
|
res 7, c
|
||||||
|
res 6, c
|
||||||
|
res 5, c ; c now holds the length
|
||||||
|
bit 5, b
|
||||||
|
jr z, .loop
|
||||||
|
bit 7, b
|
||||||
|
jr nz, .loop ; skip currency symbol
|
||||||
|
ld [hl], "¥"
|
||||||
|
inc hl
|
||||||
|
.loop
|
||||||
|
ld a, [de]
|
||||||
|
swap a
|
||||||
|
call PrintBCDDigit ; print upper digit
|
||||||
|
ld a, [de]
|
||||||
|
call PrintBCDDigit ; print lower digit
|
||||||
|
inc de
|
||||||
|
dec c
|
||||||
|
jr nz, .loop
|
||||||
|
bit 7, b ; were any non-zero digits printed?
|
||||||
|
jr z, .done ; if so, we are done
|
||||||
|
.numberEqualsZero ; if every digit of the BCD number is zero
|
||||||
|
bit 6, b ; left or right alignment?
|
||||||
|
jr nz, .skipRightAlignmentAdjustment
|
||||||
|
dec hl ; if the string is right-aligned, it needs to be moved back one space
|
||||||
|
.skipRightAlignmentAdjustment
|
||||||
|
bit 5, b
|
||||||
|
jr z, .skipCurrencySymbol
|
||||||
|
ld [hl], "¥" ; currency symbol
|
||||||
|
inc hl
|
||||||
|
.skipCurrencySymbol
|
||||||
|
ld [hl], "0"
|
||||||
|
call PrintLetterDelay
|
||||||
|
inc hl
|
||||||
|
.done
|
||||||
|
ret
|
||||||
|
; 0x38f2
|
||||||
|
|
||||||
|
PrintBCDDigit:: ; 38f2
|
||||||
|
and %00001111
|
||||||
|
and a
|
||||||
|
jr z, .zeroDigit
|
||||||
|
.nonzeroDigit
|
||||||
|
bit 7, b ; have any non-space characters been printed?
|
||||||
|
jr z, .outputDigit
|
||||||
|
; if bit 7 is set, then no numbers have been printed yet
|
||||||
|
bit 5, b ; print the currency symbol?
|
||||||
|
jr z, .skipCurrencySymbol
|
||||||
|
ld [hl], "¥"
|
||||||
|
inc hl
|
||||||
|
res 5, b
|
||||||
|
.skipCurrencySymbol
|
||||||
|
res 7, b ; unset 7 to indicate that a nonzero digit has been reached
|
||||||
|
.outputDigit
|
||||||
|
add "0"
|
||||||
|
ld [hli], a
|
||||||
|
jp PrintLetterDelay
|
||||||
|
|
||||||
|
.zeroDigit
|
||||||
|
bit 7, b ; either printing leading zeroes or already reached a nonzero digit?
|
||||||
|
jr z, .outputDigit ; if so, print a zero digit
|
||||||
|
bit 6, b ; left or right alignment?
|
||||||
|
ret nz
|
||||||
|
ld a, " "
|
||||||
|
ld [hli], a ; if right-aligned, "print" a space by advancing the pointer
|
||||||
|
ret
|
||||||
|
; 0x3917
|
31
home/print_level.asm
Normal file
31
home/print_level.asm
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
PrintLevel:: ; 382d
|
||||||
|
; Print wTempMonLevel at hl
|
||||||
|
|
||||||
|
ld a, [wTempMonLevel]
|
||||||
|
ld [hl], "<LV>"
|
||||||
|
inc hl
|
||||||
|
|
||||||
|
; How many digits?
|
||||||
|
ld c, 2
|
||||||
|
cp 100 ; This is distinct from MAX_LEVEL.
|
||||||
|
jr c, Print8BitNumRightAlign
|
||||||
|
|
||||||
|
; 3-digit numbers overwrite the :L.
|
||||||
|
dec hl
|
||||||
|
inc c
|
||||||
|
jr Print8BitNumRightAlign
|
||||||
|
; 383d
|
||||||
|
|
||||||
|
PrintLevel_Force3Digits:: ; 383d
|
||||||
|
; Print :L and all 3 digits
|
||||||
|
ld [hl], "<LV>"
|
||||||
|
inc hl
|
||||||
|
ld c, 3
|
||||||
|
; 3842
|
||||||
|
|
||||||
|
Print8BitNumRightAlign:: ; 3842
|
||||||
|
ld [wd265], a
|
||||||
|
ld de, wd265
|
||||||
|
ld b, PRINTNUM_RIGHTALIGN | 1
|
||||||
|
jp PrintNum
|
||||||
|
; 384d
|
125
home/print_text.asm
Normal file
125
home/print_text.asm
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
PrintLetterDelay:: ; 313d
|
||||||
|
; Wait before printing the next letter.
|
||||||
|
|
||||||
|
; The text speed setting in wOptions is actually a frame count:
|
||||||
|
; fast: 1 frame
|
||||||
|
; mid: 3 frames
|
||||||
|
; slow: 5 frames
|
||||||
|
|
||||||
|
; wTextBoxFlags[!0] and A or B override text speed with a one-frame delay.
|
||||||
|
; wOptions[4] and wTextBoxFlags[!1] disable the delay.
|
||||||
|
|
||||||
|
ld a, [wOptions]
|
||||||
|
bit NO_TEXT_SCROLL, a
|
||||||
|
ret nz
|
||||||
|
|
||||||
|
; non-scrolling text?
|
||||||
|
ld a, [wTextBoxFlags]
|
||||||
|
bit NO_TEXT_DELAY_F, a
|
||||||
|
ret z
|
||||||
|
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
push bc
|
||||||
|
|
||||||
|
ld hl, hOAMUpdate
|
||||||
|
ld a, [hl]
|
||||||
|
push af
|
||||||
|
|
||||||
|
; orginally turned oam update off...
|
||||||
|
; ld a, 1
|
||||||
|
ld [hl], a
|
||||||
|
|
||||||
|
; force fast scroll?
|
||||||
|
ld a, [wTextBoxFlags]
|
||||||
|
bit FAST_TEXT_DELAY_F, a
|
||||||
|
jr z, .fast
|
||||||
|
|
||||||
|
; text speed
|
||||||
|
ld a, [wOptions]
|
||||||
|
and %111
|
||||||
|
jr .updatedelay
|
||||||
|
|
||||||
|
.fast
|
||||||
|
ld a, TEXT_DELAY_FAST
|
||||||
|
|
||||||
|
.updatedelay
|
||||||
|
ld [wTextDelayFrames], a
|
||||||
|
|
||||||
|
.checkjoypad
|
||||||
|
call GetJoypad
|
||||||
|
|
||||||
|
; input override
|
||||||
|
ld a, [wDisableTextAcceleration]
|
||||||
|
and a
|
||||||
|
jr nz, .wait
|
||||||
|
|
||||||
|
; Wait one frame if holding A or B.
|
||||||
|
ld a, [hJoyDown]
|
||||||
|
bit A_BUTTON_F, a
|
||||||
|
jr z, .checkb
|
||||||
|
jr .delay
|
||||||
|
.checkb
|
||||||
|
bit B_BUTTON_F, a
|
||||||
|
jr z, .wait
|
||||||
|
|
||||||
|
.delay
|
||||||
|
call DelayFrame
|
||||||
|
jr .end
|
||||||
|
|
||||||
|
.wait
|
||||||
|
ld a, [wTextDelayFrames]
|
||||||
|
and a
|
||||||
|
jr nz, .checkjoypad
|
||||||
|
|
||||||
|
.end
|
||||||
|
pop af
|
||||||
|
ld [hOAMUpdate], a
|
||||||
|
pop bc
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
ret
|
||||||
|
; 318c
|
||||||
|
|
||||||
|
CopyDataUntil:: ; 318c
|
||||||
|
; Copy [hl .. bc) to de.
|
||||||
|
|
||||||
|
; In other words, the source data is
|
||||||
|
; from hl up to but not including bc,
|
||||||
|
; and the destination is de.
|
||||||
|
|
||||||
|
ld a, [hli]
|
||||||
|
ld [de], a
|
||||||
|
inc de
|
||||||
|
ld a, h
|
||||||
|
cp b
|
||||||
|
jr nz, CopyDataUntil
|
||||||
|
ld a, l
|
||||||
|
cp c
|
||||||
|
jr nz, CopyDataUntil
|
||||||
|
ret
|
||||||
|
; 0x3198
|
||||||
|
|
||||||
|
PrintNum:: ; 3198
|
||||||
|
homecall _PrintNum
|
||||||
|
ret
|
||||||
|
; 31a4
|
||||||
|
|
||||||
|
MobilePrintNum:: ; 31a4
|
||||||
|
homecall _MobilePrintNum
|
||||||
|
ret
|
||||||
|
; 31b0
|
||||||
|
|
||||||
|
FarPrintText:: ; 31b0
|
||||||
|
ld [hBuffer], a
|
||||||
|
ld a, [hROMBank]
|
||||||
|
push af
|
||||||
|
ld a, [hBuffer]
|
||||||
|
rst Bankswitch
|
||||||
|
|
||||||
|
call PrintText
|
||||||
|
|
||||||
|
pop af
|
||||||
|
rst Bankswitch
|
||||||
|
ret
|
||||||
|
; 31be
|
33
home/region.asm
Normal file
33
home/region.asm
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
IsInJohto:: ; 2f17
|
||||||
|
; Return 0 if the player is in Johto, and 1 in Kanto.
|
||||||
|
|
||||||
|
ld a, [wMapGroup]
|
||||||
|
ld b, a
|
||||||
|
ld a, [wMapNumber]
|
||||||
|
ld c, a
|
||||||
|
call GetWorldMapLocation
|
||||||
|
|
||||||
|
cp FAST_SHIP
|
||||||
|
jr z, .Johto
|
||||||
|
|
||||||
|
cp SPECIAL_MAP
|
||||||
|
jr nz, .CheckRegion
|
||||||
|
|
||||||
|
ld a, [wBackupMapGroup]
|
||||||
|
ld b, a
|
||||||
|
ld a, [wBackupMapNumber]
|
||||||
|
ld c, a
|
||||||
|
call GetWorldMapLocation
|
||||||
|
|
||||||
|
.CheckRegion:
|
||||||
|
cp KANTO_LANDMARK
|
||||||
|
jr nc, .Kanto
|
||||||
|
|
||||||
|
.Johto:
|
||||||
|
xor a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.Kanto:
|
||||||
|
ld a, 1
|
||||||
|
ret
|
||||||
|
; 2f3e
|
65
home/scrolling_menu.asm
Normal file
65
home/scrolling_menu.asm
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
ScrollingMenu:: ; 350c
|
||||||
|
call CopyMenuData
|
||||||
|
ld a, [hROMBank]
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, BANK(_ScrollingMenu)
|
||||||
|
rst Bankswitch
|
||||||
|
|
||||||
|
call _InitScrollingMenu
|
||||||
|
call .UpdatePalettes
|
||||||
|
call _ScrollingMenu
|
||||||
|
|
||||||
|
pop af
|
||||||
|
rst Bankswitch
|
||||||
|
|
||||||
|
ld a, [wMenuJoypad]
|
||||||
|
ret
|
||||||
|
; 3524
|
||||||
|
|
||||||
|
.UpdatePalettes: ; 3524
|
||||||
|
ld hl, wVramState
|
||||||
|
bit 0, [hl]
|
||||||
|
jp nz, UpdateTimePals
|
||||||
|
jp SetPalettes
|
||||||
|
; 352f
|
||||||
|
|
||||||
|
InitScrollingMenu:: ; 352f
|
||||||
|
ld a, [wMenuBorderTopCoord]
|
||||||
|
dec a
|
||||||
|
ld b, a
|
||||||
|
ld a, [wMenuBorderBottomCoord]
|
||||||
|
sub b
|
||||||
|
ld d, a
|
||||||
|
ld a, [wMenuBorderLeftCoord]
|
||||||
|
dec a
|
||||||
|
ld c, a
|
||||||
|
ld a, [wMenuBorderRightCoord]
|
||||||
|
sub c
|
||||||
|
ld e, a
|
||||||
|
push de
|
||||||
|
call Coord2Tile
|
||||||
|
pop bc
|
||||||
|
jp TextBox
|
||||||
|
; 354b
|
||||||
|
|
||||||
|
JoyTextDelay_ForcehJoyDown:: ; 354b joypad
|
||||||
|
call DelayFrame
|
||||||
|
|
||||||
|
ld a, [hInMenu]
|
||||||
|
push af
|
||||||
|
ld a, $1
|
||||||
|
ld [hInMenu], a
|
||||||
|
call JoyTextDelay
|
||||||
|
pop af
|
||||||
|
ld [hInMenu], a
|
||||||
|
|
||||||
|
ld a, [hJoyLast]
|
||||||
|
and D_RIGHT + D_LEFT + D_UP + D_DOWN
|
||||||
|
ld c, a
|
||||||
|
ld a, [hJoyPressed]
|
||||||
|
and A_BUTTON + B_BUTTON + SELECT + START
|
||||||
|
or c
|
||||||
|
ld c, a
|
||||||
|
ret
|
||||||
|
; 3567
|
53
home/sprite_anims.asm
Normal file
53
home/sprite_anims.asm
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
PushLYOverrides:: ; 3b0c
|
||||||
|
ld a, [hLCDCPointer]
|
||||||
|
and a
|
||||||
|
ret z
|
||||||
|
|
||||||
|
ld a, LOW(wLYOverridesBackup)
|
||||||
|
ld [wRequested2bppSource], a
|
||||||
|
ld a, HIGH(wLYOverridesBackup)
|
||||||
|
ld [wRequested2bppSource + 1], a
|
||||||
|
|
||||||
|
ld a, LOW(wLYOverrides)
|
||||||
|
ld [wRequested2bppDest], a
|
||||||
|
ld a, HIGH(wLYOverrides)
|
||||||
|
ld [wRequested2bppDest + 1], a
|
||||||
|
|
||||||
|
ld a, (wLYOverridesEnd - wLYOverrides) / 16
|
||||||
|
ld [wRequested2bpp], a
|
||||||
|
ret
|
||||||
|
; 3b2a
|
||||||
|
|
||||||
|
_InitSpriteAnimStruct:: ; 3b2a
|
||||||
|
ld [wSpriteAnimIDBuffer], a
|
||||||
|
ld a, [hROMBank]
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, BANK(InitSpriteAnimStruct)
|
||||||
|
rst Bankswitch
|
||||||
|
ld a, [wSpriteAnimIDBuffer]
|
||||||
|
|
||||||
|
call InitSpriteAnimStruct
|
||||||
|
|
||||||
|
pop af
|
||||||
|
rst Bankswitch
|
||||||
|
|
||||||
|
ret
|
||||||
|
; 3b3c
|
||||||
|
|
||||||
|
ReinitSpriteAnimFrame:: ; 3b3c
|
||||||
|
ld [wSpriteAnimIDBuffer], a
|
||||||
|
ld a, [hROMBank]
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, BANK(_ReinitSpriteAnimFrame)
|
||||||
|
rst Bankswitch
|
||||||
|
ld a, [wSpriteAnimIDBuffer]
|
||||||
|
|
||||||
|
call _ReinitSpriteAnimFrame
|
||||||
|
|
||||||
|
pop af
|
||||||
|
rst Bankswitch
|
||||||
|
|
||||||
|
ret
|
||||||
|
; 3b4e
|
21
home/sprite_updates.asm
Normal file
21
home/sprite_updates.asm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
DisableSpriteUpdates:: ; 0x2ed3
|
||||||
|
xor a
|
||||||
|
ld [hMapAnims], a
|
||||||
|
ld a, [wVramState]
|
||||||
|
res 0, a
|
||||||
|
ld [wVramState], a
|
||||||
|
ld a, $0
|
||||||
|
ld [wSpriteUpdatesEnabled], a
|
||||||
|
ret
|
||||||
|
; 0x2ee4
|
||||||
|
|
||||||
|
EnableSpriteUpdates:: ; 2ee4
|
||||||
|
ld a, $1
|
||||||
|
ld [wSpriteUpdatesEnabled], a
|
||||||
|
ld a, [wVramState]
|
||||||
|
set 0, a
|
||||||
|
ld [wVramState], a
|
||||||
|
ld a, $1
|
||||||
|
ld [hMapAnims], a
|
||||||
|
ret
|
||||||
|
; 2ef6
|
143
home/stone_queue.asm
Normal file
143
home/stone_queue.asm
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
HandleStoneQueue:: ; 3567
|
||||||
|
ld a, [hROMBank]
|
||||||
|
push af
|
||||||
|
|
||||||
|
call SwitchToMapScriptsBank
|
||||||
|
call .WarpAction
|
||||||
|
|
||||||
|
pop bc
|
||||||
|
ld a, b
|
||||||
|
rst Bankswitch
|
||||||
|
ret
|
||||||
|
; 3574
|
||||||
|
|
||||||
|
.WarpAction: ; 3574
|
||||||
|
ld hl, OBJECT_MAP_OBJECT_INDEX
|
||||||
|
add hl, de
|
||||||
|
ld a, [hl]
|
||||||
|
cp $ff
|
||||||
|
jr z, .nope
|
||||||
|
|
||||||
|
ld l, a
|
||||||
|
push hl
|
||||||
|
call .IsObjectOnWarp
|
||||||
|
pop hl
|
||||||
|
jr nc, .nope
|
||||||
|
ld d, a
|
||||||
|
ld e, l
|
||||||
|
call .IsObjectInStoneTable
|
||||||
|
jr nc, .nope
|
||||||
|
call CallMapScript
|
||||||
|
farcall EnableScriptMode
|
||||||
|
scf
|
||||||
|
ret
|
||||||
|
|
||||||
|
.nope
|
||||||
|
and a
|
||||||
|
ret
|
||||||
|
; 3599
|
||||||
|
|
||||||
|
.IsObjectOnWarp: ; 3599
|
||||||
|
push de
|
||||||
|
|
||||||
|
ld hl, OBJECT_NEXT_MAP_X
|
||||||
|
add hl, de
|
||||||
|
ld a, [hl]
|
||||||
|
ld hl, OBJECT_NEXT_MAP_Y
|
||||||
|
add hl, de
|
||||||
|
ld e, [hl]
|
||||||
|
|
||||||
|
sub 4
|
||||||
|
ld d, a
|
||||||
|
ld a, e
|
||||||
|
sub 4
|
||||||
|
ld e, a
|
||||||
|
call .check_on_warp
|
||||||
|
|
||||||
|
pop de
|
||||||
|
ret
|
||||||
|
; 35b0
|
||||||
|
|
||||||
|
.check_on_warp ; 35b0
|
||||||
|
ld hl, wCurrMapWarpsPointer
|
||||||
|
ld a, [hli]
|
||||||
|
ld h, [hl]
|
||||||
|
ld l, a
|
||||||
|
ld a, [wCurrMapWarpCount]
|
||||||
|
and a
|
||||||
|
jr z, .nope2
|
||||||
|
|
||||||
|
.loop
|
||||||
|
push af
|
||||||
|
ld a, [hl]
|
||||||
|
cp e
|
||||||
|
jr nz, .not_on_warp
|
||||||
|
inc hl
|
||||||
|
ld a, [hld]
|
||||||
|
cp d
|
||||||
|
jr nz, .not_on_warp
|
||||||
|
jr .found_warp
|
||||||
|
|
||||||
|
.not_on_warp
|
||||||
|
ld a, 5
|
||||||
|
add l
|
||||||
|
ld l, a
|
||||||
|
jr nc, .no_carry
|
||||||
|
inc h
|
||||||
|
.no_carry
|
||||||
|
|
||||||
|
pop af
|
||||||
|
dec a
|
||||||
|
jr nz, .loop
|
||||||
|
|
||||||
|
.nope2
|
||||||
|
and a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.found_warp
|
||||||
|
pop af
|
||||||
|
ld d, a
|
||||||
|
ld a, [wCurrMapWarpCount]
|
||||||
|
sub d
|
||||||
|
inc a
|
||||||
|
scf
|
||||||
|
ret
|
||||||
|
; 35de
|
||||||
|
|
||||||
|
.IsObjectInStoneTable: ; 35de
|
||||||
|
inc e
|
||||||
|
ld hl, CMDQUEUE_ADDR
|
||||||
|
add hl, bc
|
||||||
|
ld a, [hli]
|
||||||
|
ld h, [hl]
|
||||||
|
ld l, a
|
||||||
|
.loop2
|
||||||
|
ld a, [hli]
|
||||||
|
cp $ff
|
||||||
|
jr z, .nope3
|
||||||
|
cp d
|
||||||
|
jr nz, .next_inc3
|
||||||
|
ld a, [hli]
|
||||||
|
cp e
|
||||||
|
jr nz, .next_inc2
|
||||||
|
ld a, [hli]
|
||||||
|
ld h, [hl]
|
||||||
|
ld l, a
|
||||||
|
jr .yes
|
||||||
|
|
||||||
|
.next_inc3
|
||||||
|
inc hl
|
||||||
|
|
||||||
|
.next_inc2
|
||||||
|
inc hl
|
||||||
|
inc hl
|
||||||
|
jr .loop2
|
||||||
|
|
||||||
|
.nope3
|
||||||
|
and a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.yes
|
||||||
|
scf
|
||||||
|
ret
|
||||||
|
; 3600
|
454
home/tilemap.asm
454
home/tilemap.asm
@ -1,257 +1,229 @@
|
|||||||
PushWindow:: ; 1c00
|
ClearBGPalettes:: ; 31f3
|
||||||
callfar _PushWindow
|
call ClearPalettes
|
||||||
|
WaitBGMap:: ; 31f6
|
||||||
|
; Tell VBlank to update BG Map
|
||||||
|
ld a, 1 ; BG Map 0 tiles
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
; Wait for it to do its magic
|
||||||
|
ld c, 4
|
||||||
|
call DelayFrames
|
||||||
ret
|
ret
|
||||||
; 1c07
|
; 3200
|
||||||
|
|
||||||
ExitMenu:: ; 0x1c07
|
WaitBGMap2:: ; 0x3200
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jr z, .bg0
|
||||||
|
|
||||||
|
ld a, 2
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ld c, 4
|
||||||
|
call DelayFrames
|
||||||
|
|
||||||
|
.bg0
|
||||||
|
ld a, 1
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ld c, 4
|
||||||
|
call DelayFrames
|
||||||
|
ret
|
||||||
|
; 0x3218
|
||||||
|
|
||||||
|
IsCGB:: ; 3218
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
ret
|
||||||
|
; 321c
|
||||||
|
|
||||||
|
ApplyTilemap:: ; 321c
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jr z, .dmg
|
||||||
|
|
||||||
|
ld a, [wSpriteUpdatesEnabled]
|
||||||
|
cp 0
|
||||||
|
jr z, .dmg
|
||||||
|
|
||||||
|
ld a, 1
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
jr CopyTilemapAtOnce
|
||||||
|
|
||||||
|
.dmg
|
||||||
|
; WaitBGMap
|
||||||
|
ld a, 1
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ld c, 4
|
||||||
|
call DelayFrames
|
||||||
|
ret
|
||||||
|
; 3238
|
||||||
|
|
||||||
|
CGBOnly_CopyTilemapAtOnce:: ; 3238
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jr z, WaitBGMap
|
||||||
|
|
||||||
|
CopyTilemapAtOnce:: ; 323d
|
||||||
|
jr .CopyTilemapAtOnce
|
||||||
|
; 323f
|
||||||
|
|
||||||
|
; unused
|
||||||
|
farcall HDMATransferAttrMapAndTileMapToWRAMBank3
|
||||||
|
ret
|
||||||
|
; 3246
|
||||||
|
|
||||||
|
.CopyTilemapAtOnce: ; 3246
|
||||||
|
ld a, [hBGMapMode]
|
||||||
push af
|
push af
|
||||||
callfar _ExitMenu
|
xor a
|
||||||
pop af
|
ld [hBGMapMode], a
|
||||||
ret
|
|
||||||
|
|
||||||
InitVerticalMenuCursor:: ; 0x1c10
|
ld a, [hMapAnims]
|
||||||
callfar _InitVerticalMenuCursor
|
|
||||||
ret
|
|
||||||
|
|
||||||
CloseWindow:: ; 0x1c17
|
|
||||||
push af
|
push af
|
||||||
call ExitMenu
|
xor a
|
||||||
call ApplyTilemap
|
ld [hMapAnims], a
|
||||||
call UpdateSprites
|
|
||||||
|
.wait
|
||||||
|
ld a, [rLY]
|
||||||
|
cp $7f
|
||||||
|
jr c, .wait
|
||||||
|
|
||||||
|
di
|
||||||
|
ld a, BANK(vTiles3)
|
||||||
|
ld [rVBK], a
|
||||||
|
hlcoord 0, 0, wAttrMap
|
||||||
|
call .StackPointerMagic
|
||||||
|
ld a, BANK(vTiles0)
|
||||||
|
ld [rVBK], a
|
||||||
|
hlcoord 0, 0
|
||||||
|
call .StackPointerMagic
|
||||||
|
|
||||||
|
.wait2
|
||||||
|
ld a, [rLY]
|
||||||
|
cp $7f
|
||||||
|
jr c, .wait2
|
||||||
|
ei
|
||||||
|
|
||||||
pop af
|
pop af
|
||||||
|
ld [hMapAnims], a
|
||||||
|
pop af
|
||||||
|
ld [hBGMapMode], a
|
||||||
ret
|
ret
|
||||||
|
; 327b
|
||||||
|
|
||||||
RestoreTileBackup:: ; 0x1c23
|
.StackPointerMagic: ; 327b
|
||||||
call MenuBoxCoord2Tile
|
; Copy all tiles to vBGMap
|
||||||
call .copy
|
ld [hSPBuffer], sp
|
||||||
call MenuBoxCoord2Attr
|
ld sp, hl
|
||||||
call .copy
|
ld a, [hBGMapAddress + 1]
|
||||||
ret
|
ld h, a
|
||||||
; 0x1c30
|
ld l, 0
|
||||||
|
ld a, SCREEN_HEIGHT
|
||||||
|
ld [hTilesPerCycle], a
|
||||||
|
ld b, 1 << 1 ; not in v/hblank
|
||||||
|
ld c, LOW(rSTAT)
|
||||||
|
|
||||||
.copy ; 0x1c30
|
|
||||||
call GetMenuBoxDims
|
|
||||||
inc b
|
|
||||||
inc c
|
|
||||||
|
|
||||||
.row
|
|
||||||
push bc
|
|
||||||
push hl
|
|
||||||
|
|
||||||
.col
|
|
||||||
ld a, [de]
|
|
||||||
ld [hli], a
|
|
||||||
dec de
|
|
||||||
dec c
|
|
||||||
jr nz, .col ; 0x1c3b $fa
|
|
||||||
|
|
||||||
pop hl
|
|
||||||
ld bc, SCREEN_WIDTH
|
|
||||||
add hl, bc
|
|
||||||
pop bc
|
|
||||||
dec b
|
|
||||||
jr nz, .row ; 0x1c44 $ef
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
PopWindow:: ; 0x1c47
|
|
||||||
ld b, $10
|
|
||||||
ld de, wMenuFlags
|
|
||||||
.loop
|
.loop
|
||||||
ld a, [hld]
|
rept SCREEN_WIDTH / 2
|
||||||
ld [de], a
|
|
||||||
inc de
|
|
||||||
dec b
|
|
||||||
jr nz, .loop ; 0x1c50 $fa
|
|
||||||
ret
|
|
||||||
|
|
||||||
GetMenuBoxDims:: ; 0x1c53
|
|
||||||
ld a, [wMenuBorderTopCoord] ; top
|
|
||||||
ld b, a
|
|
||||||
ld a, [wMenuBorderBottomCoord] ; bottom
|
|
||||||
sub b
|
|
||||||
ld b, a
|
|
||||||
ld a, [wMenuBorderLeftCoord] ; left
|
|
||||||
ld c, a
|
|
||||||
ld a, [wMenuBorderRightCoord] ; right
|
|
||||||
sub c
|
|
||||||
ld c, a
|
|
||||||
ret
|
|
||||||
; 0x1c66
|
|
||||||
|
|
||||||
CopyMenuData:: ; 1c66
|
|
||||||
push hl
|
|
||||||
push de
|
|
||||||
push bc
|
|
||||||
push af
|
|
||||||
ld hl, wMenuDataPointer
|
|
||||||
ld a, [hli]
|
|
||||||
ld h, [hl]
|
|
||||||
ld l, a
|
|
||||||
ld de, wMenuDataFlags
|
|
||||||
ld bc, wMenuDataEnd - wMenuDataFlags
|
|
||||||
call CopyBytes
|
|
||||||
pop af
|
|
||||||
pop bc
|
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
; if in v/hblank, wait until not in v/hblank
|
||||||
ret
|
.loop\@
|
||||||
; 1c7e
|
ld a, [$ff00+c]
|
||||||
|
and b
|
||||||
|
jr nz, .loop\@
|
||||||
|
; load BGMap0
|
||||||
|
ld [hl], e
|
||||||
|
inc l
|
||||||
|
ld [hl], d
|
||||||
|
inc l
|
||||||
|
endr
|
||||||
|
|
||||||
GetWindowStackTop:: ; 1c7e
|
ld de, BG_MAP_WIDTH - SCREEN_WIDTH
|
||||||
ld hl, wWindowStackPointer
|
add hl, de
|
||||||
ld a, [hli]
|
ld a, [hTilesPerCycle]
|
||||||
ld h, [hl]
|
dec a
|
||||||
ld l, a
|
ld [hTilesPerCycle], a
|
||||||
inc hl
|
|
||||||
ld a, [hli]
|
|
||||||
ld h, [hl]
|
|
||||||
ld l, a
|
|
||||||
ret
|
|
||||||
; 1c89
|
|
||||||
|
|
||||||
PlaceVerticalMenuItems:: ; 1c89
|
|
||||||
call CopyMenuData
|
|
||||||
ld hl, wMenuDataPointer
|
|
||||||
ld e, [hl]
|
|
||||||
inc hl
|
|
||||||
ld d, [hl]
|
|
||||||
call GetMenuTextStartCoord
|
|
||||||
call Coord2Tile ; hl now contains the tilemap address where we will start printing text.
|
|
||||||
inc de
|
|
||||||
ld a, [de] ; Number of items
|
|
||||||
inc de
|
|
||||||
ld b, a
|
|
||||||
.loop
|
|
||||||
push bc
|
|
||||||
call PlaceString
|
|
||||||
inc de
|
|
||||||
ld bc, 2 * SCREEN_WIDTH
|
|
||||||
add hl, bc
|
|
||||||
pop bc
|
|
||||||
dec b
|
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
|
|
||||||
ld a, [wMenuDataFlags]
|
ld a, [hSPBuffer]
|
||||||
bit 4, a
|
ld l, a
|
||||||
|
ld a, [hSPBuffer + 1]
|
||||||
|
ld h, a
|
||||||
|
ld sp, hl
|
||||||
|
ret
|
||||||
|
; 32f9
|
||||||
|
|
||||||
|
SetPalettes:: ; 32f9
|
||||||
|
; Inits the Palettes
|
||||||
|
; depending on the system the monochromes palettes or color palettes
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jr nz, .SetPalettesForGameBoyColor
|
||||||
|
ld a, %11100100
|
||||||
|
ld [rBGP], a
|
||||||
|
ld a, %11010000
|
||||||
|
ld [rOBP0], a
|
||||||
|
ld [rOBP1], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.SetPalettesForGameBoyColor:
|
||||||
|
push de
|
||||||
|
ld a, %11100100
|
||||||
|
call DmgToCgbBGPals
|
||||||
|
lb de, %11100100, %11100100
|
||||||
|
call DmgToCgbObjPals
|
||||||
|
pop de
|
||||||
|
ret
|
||||||
|
; 3317
|
||||||
|
|
||||||
|
ClearPalettes:: ; 3317
|
||||||
|
; Make all palettes white
|
||||||
|
|
||||||
|
; CGB: make all the palette colors white
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jr nz, .cgb
|
||||||
|
|
||||||
|
; DMG: just change palettes to 0 (white)
|
||||||
|
xor a
|
||||||
|
ld [rBGP], a
|
||||||
|
ld [rOBP0], a
|
||||||
|
ld [rOBP1], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.cgb
|
||||||
|
ld a, [rSVBK]
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, BANK(wBGPals2)
|
||||||
|
ld [rSVBK], a
|
||||||
|
|
||||||
|
; Fill wBGPals2 and wOBPals2 with $ffff (white)
|
||||||
|
ld hl, wBGPals2
|
||||||
|
ld bc, 16 palettes
|
||||||
|
ld a, $ff
|
||||||
|
call ByteFill
|
||||||
|
|
||||||
|
pop af
|
||||||
|
ld [rSVBK], a
|
||||||
|
|
||||||
|
; Request palette update
|
||||||
|
ld a, 1
|
||||||
|
ld [hCGBPalUpdate], a
|
||||||
|
ret
|
||||||
|
; 333e
|
||||||
|
|
||||||
|
GetMemSGBLayout:: ; 333e
|
||||||
|
ld b, SCGB_RAM
|
||||||
|
GetSGBLayout:: ; 3340
|
||||||
|
; load sgb packets unless dmg
|
||||||
|
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jr nz, .sgb
|
||||||
|
|
||||||
|
ld a, [hSGB]
|
||||||
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
call MenuBoxCoord2Tile
|
.sgb
|
||||||
ld a, [de]
|
predef_jump LoadSGBLayout
|
||||||
ld c, a
|
; 334e
|
||||||
inc de
|
|
||||||
ld b, $0
|
|
||||||
add hl, bc
|
|
||||||
jp PlaceString
|
|
||||||
; 1cbb
|
|
||||||
|
|
||||||
MenuBox:: ; 1cbb
|
|
||||||
call MenuBoxCoord2Tile
|
|
||||||
call GetMenuBoxDims
|
|
||||||
dec b
|
|
||||||
dec c
|
|
||||||
jp TextBox
|
|
||||||
; 1cc6
|
|
||||||
|
|
||||||
GetMenuTextStartCoord:: ; 1cc6
|
|
||||||
ld a, [wMenuBorderTopCoord]
|
|
||||||
ld b, a
|
|
||||||
inc b
|
|
||||||
ld a, [wMenuBorderLeftCoord]
|
|
||||||
ld c, a
|
|
||||||
inc c
|
|
||||||
; bit 6: if not set, leave extra room on top
|
|
||||||
ld a, [wMenuDataFlags]
|
|
||||||
bit 6, a
|
|
||||||
jr nz, .bit_6_set
|
|
||||||
inc b
|
|
||||||
|
|
||||||
.bit_6_set
|
|
||||||
; bit 7: if set, leave extra room on the left
|
|
||||||
ld a, [wMenuDataFlags]
|
|
||||||
bit 7, a
|
|
||||||
jr z, .bit_7_clear
|
|
||||||
inc c
|
|
||||||
|
|
||||||
.bit_7_clear
|
|
||||||
ret
|
|
||||||
; 1ce1
|
|
||||||
|
|
||||||
ClearMenuBoxInterior:: ; 1ce1
|
|
||||||
call MenuBoxCoord2Tile
|
|
||||||
ld bc, SCREEN_WIDTH + 1
|
|
||||||
add hl, bc
|
|
||||||
call GetMenuBoxDims
|
|
||||||
dec b
|
|
||||||
dec c
|
|
||||||
call ClearBox
|
|
||||||
ret
|
|
||||||
; 1cf1
|
|
||||||
|
|
||||||
ClearWholeMenuBox:: ; 1cf1
|
|
||||||
call MenuBoxCoord2Tile
|
|
||||||
call GetMenuBoxDims
|
|
||||||
inc c
|
|
||||||
inc b
|
|
||||||
call ClearBox
|
|
||||||
ret
|
|
||||||
; 1cfd
|
|
||||||
|
|
||||||
|
|
||||||
MenuBoxCoord2Tile:: ; 1cfd
|
|
||||||
ld a, [wMenuBorderLeftCoord]
|
|
||||||
ld c, a
|
|
||||||
ld a, [wMenuBorderTopCoord]
|
|
||||||
ld b, a
|
|
||||||
; 1d05
|
|
||||||
|
|
||||||
|
|
||||||
Coord2Tile:: ; 1d05
|
|
||||||
; Return the address of wTileMap(c, b) in hl.
|
|
||||||
xor a
|
|
||||||
ld h, a
|
|
||||||
ld l, b
|
|
||||||
ld a, c
|
|
||||||
ld b, h
|
|
||||||
ld c, l
|
|
||||||
add hl, hl
|
|
||||||
add hl, hl
|
|
||||||
add hl, bc
|
|
||||||
add hl, hl
|
|
||||||
add hl, hl
|
|
||||||
ld c, a
|
|
||||||
xor a
|
|
||||||
ld b, a
|
|
||||||
add hl, bc
|
|
||||||
bccoord 0, 0
|
|
||||||
add hl, bc
|
|
||||||
ret
|
|
||||||
; 1d19
|
|
||||||
|
|
||||||
MenuBoxCoord2Attr:: ; 1d19
|
|
||||||
ld a, [wMenuBorderLeftCoord]
|
|
||||||
ld c, a
|
|
||||||
ld a, [wMenuBorderTopCoord]
|
|
||||||
ld b, a
|
|
||||||
|
|
||||||
Coord2Attr:: ; 1d21
|
|
||||||
; Return the address of wAttrMap(c, b) in hl.
|
|
||||||
xor a
|
|
||||||
ld h, a
|
|
||||||
ld l, b
|
|
||||||
ld a, c
|
|
||||||
ld b, h
|
|
||||||
ld c, l
|
|
||||||
add hl, hl
|
|
||||||
add hl, hl
|
|
||||||
add hl, bc
|
|
||||||
add hl, hl
|
|
||||||
add hl, hl
|
|
||||||
ld c, a
|
|
||||||
xor a
|
|
||||||
ld b, a
|
|
||||||
add hl, bc
|
|
||||||
bccoord 0, 0, wAttrMap
|
|
||||||
add hl, bc
|
|
||||||
ret
|
|
||||||
; 1d35
|
|
||||||
|
@ -247,7 +247,7 @@ PrintWinLossText:: ; 3718
|
|||||||
.canlose
|
.canlose
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
ld hl, wWinTextPointer
|
ld hl, wWinTextPointer
|
||||||
and $f
|
and $f ; WIN?
|
||||||
jr z, .ok
|
jr z, .ok
|
||||||
ld hl, wLossTextPointer
|
ld hl, wLossTextPointer
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
RefreshScreen:: ; 2dba
|
RefreshScreen:: ; 2dba
|
||||||
|
|
||||||
call ClearWindowData
|
call ClearWindowData
|
||||||
ld a, [hROMBank]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
|
@ -233,7 +233,7 @@ hall_of_fame: MACRO
|
|||||||
\1Mon4:: hof_mon \1Mon4
|
\1Mon4:: hof_mon \1Mon4
|
||||||
\1Mon5:: hof_mon \1Mon5
|
\1Mon5:: hof_mon \1Mon5
|
||||||
\1Mon6:: hof_mon \1Mon6
|
\1Mon6:: hof_mon \1Mon6
|
||||||
\1End:: ds 1
|
\1End:: db
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
link_battle_record: MACRO
|
link_battle_record: MACRO
|
||||||
|
2
main.asm
2
main.asm
@ -9,7 +9,7 @@ INCLUDE "engine/overworld/map_objects.asm"
|
|||||||
INCLUDE "engine/menus/intro_menu.asm"
|
INCLUDE "engine/menus/intro_menu.asm"
|
||||||
INCLUDE "engine/overworld/init_map.asm"
|
INCLUDE "engine/overworld/init_map.asm"
|
||||||
INCLUDE "engine/pokemon/learn.asm"
|
INCLUDE "engine/pokemon/learn.asm"
|
||||||
INCLUDE "engine/pokemon/check_nick_errors.asm"
|
INCLUDE "engine/pokemon/correct_nick_errors.asm"
|
||||||
INCLUDE "engine/math/math.asm"
|
INCLUDE "engine/math/math.asm"
|
||||||
INCLUDE "data/items/attributes.asm"
|
INCLUDE "data/items/attributes.asm"
|
||||||
INCLUDE "engine/overworld/npc_movement.asm"
|
INCLUDE "engine/overworld/npc_movement.asm"
|
||||||
|
@ -75,8 +75,8 @@ SetRAMStateForMobile: ; 100063
|
|||||||
|
|
||||||
EnableMobile: ; 100082
|
EnableMobile: ; 100082
|
||||||
xor a
|
xor a
|
||||||
ld hl, wOverworldMap
|
ld hl, wOverworldMapBlocks
|
||||||
ld bc, wOverworldMapEnd - wOverworldMap
|
ld bc, wOverworldMapBlocksEnd - wOverworldMapBlocks
|
||||||
call ByteFill
|
call ByteFill
|
||||||
|
|
||||||
di
|
di
|
||||||
|
@ -106,7 +106,7 @@ Function170c06: ; 170c06
|
|||||||
call GetSRAMBank
|
call GetSRAMBank
|
||||||
ld hl, $a894
|
ld hl, $a894
|
||||||
ld a, [wBattleResult]
|
ld a, [wBattleResult]
|
||||||
and a
|
and a ; WIN?
|
||||||
jr nz, .asm_170c15
|
jr nz, .asm_170c15
|
||||||
inc [hl]
|
inc [hl]
|
||||||
|
|
||||||
|
40
wram.asm
40
wram.asm
@ -361,9 +361,13 @@ UNION ; c608
|
|||||||
wc608:: ds 480
|
wc608:: ds 480
|
||||||
|
|
||||||
NEXTU ; c608
|
NEXTU ; c608
|
||||||
; miscellaneous
|
; surrounding tiles
|
||||||
wMisc:: ds WMISC_WIDTH * WMISC_HEIGHT
|
wSurroundingTiles:: ds SURROUNDING_WIDTH * SURROUNDING_HEIGHT
|
||||||
wMiscEnd::
|
|
||||||
|
NEXTU ; c608
|
||||||
|
; box save buffer
|
||||||
|
wBoxPartialData:: ds 480
|
||||||
|
wBoxPartialDataEnd::
|
||||||
|
|
||||||
NEXTU ; c608
|
NEXTU ; c608
|
||||||
; odd egg
|
; odd egg
|
||||||
@ -389,7 +393,7 @@ wInitMinuteBuffer:: db ; c626
|
|||||||
|
|
||||||
NEXTU ; c608
|
NEXTU ; c608
|
||||||
; link engine data
|
; link engine data
|
||||||
ds 10
|
wLink_c608:: ds 10
|
||||||
wc612:: ds 10
|
wc612:: ds 10
|
||||||
|
|
||||||
NEXTU ; c608
|
NEXTU ; c608
|
||||||
@ -884,8 +888,9 @@ wc7e8_End::
|
|||||||
SECTION "Overworld Map", WRAM0
|
SECTION "Overworld Map", WRAM0
|
||||||
|
|
||||||
UNION ; c800
|
UNION ; c800
|
||||||
wOverworldMap:: ds 1300 ; c800
|
; overworld map blocks
|
||||||
wOverworldMapEnd::
|
wOverworldMapBlocks:: ds 1300 ; c800
|
||||||
|
wOverworldMapBlocksEnd::
|
||||||
|
|
||||||
NEXTU ; c800
|
NEXTU ; c800
|
||||||
; GB Printer screen RAM
|
; GB Printer screen RAM
|
||||||
@ -928,10 +933,14 @@ wGameboyPrinterRAMEnd::
|
|||||||
|
|
||||||
NEXTU ; c800
|
NEXTU ; c800
|
||||||
; bill's pc data
|
; bill's pc data
|
||||||
wBillsPCPokemonList:: ; c800
|
wBillsPCPokemonList::
|
||||||
; Pokemon, box number, list index
|
; (species, box number, list index) x30
|
||||||
ds 3 * 30
|
ds 3 * 30
|
||||||
|
|
||||||
|
NEXTU ; c800
|
||||||
|
; Hall of Fame data
|
||||||
|
wHallOfFamePokemonList:: hall_of_fame wHallOfFamePokemonList
|
||||||
|
|
||||||
NEXTU ; c800
|
NEXTU ; c800
|
||||||
; raw link data
|
; raw link data
|
||||||
wLinkData:: ds $514
|
wLinkData:: ds $514
|
||||||
@ -1495,8 +1504,11 @@ wGameTimerPause:: ; cfbc
|
|||||||
|
|
||||||
ds 1
|
ds 1
|
||||||
|
|
||||||
wcfbe:: ; SGB flags?
|
wcfbe:: ; cfbe
|
||||||
; bit 7
|
; bits 4, 6, or 7 can be used to disable joypad input
|
||||||
|
; bit 4
|
||||||
|
; bit 6: mon fainted?
|
||||||
|
; bit 7: SGB flag?
|
||||||
db
|
db
|
||||||
|
|
||||||
ds 1
|
ds 1
|
||||||
@ -1884,7 +1896,11 @@ wVramState:: ; d0ed
|
|||||||
; flickers when climbing waterfall
|
; flickers when climbing waterfall
|
||||||
db
|
db
|
||||||
|
|
||||||
wBattleResult:: db ; d0ee
|
wBattleResult:: ; d0ee
|
||||||
|
; WIN, LOSE, or DRAW
|
||||||
|
; bit 6: caught celebi
|
||||||
|
; bit 7: box full
|
||||||
|
db
|
||||||
wUsingItemWithSelect:: db ; d0ef
|
wUsingItemWithSelect:: db ; d0ef
|
||||||
|
|
||||||
UNION ; d0f0
|
UNION ; d0f0
|
||||||
@ -2760,7 +2776,7 @@ wMapGroup:: db ; dcb5 ; map group of current map
|
|||||||
wMapNumber:: db ; dcb6 ; map number of current map
|
wMapNumber:: db ; dcb6 ; map number of current map
|
||||||
wYCoord:: db ; dcb7 ; current y coordinate relative to top-left corner of current map
|
wYCoord:: db ; dcb7 ; current y coordinate relative to top-left corner of current map
|
||||||
wXCoord:: db ; dcb8 ; current x coordinate relative to top-left corner of current map
|
wXCoord:: db ; dcb8 ; current x coordinate relative to top-left corner of current map
|
||||||
wScreenSave:: ds 6 * 5
|
wScreenSave:: ds SCREEN_META_WIDTH * SCREEN_META_HEIGHT
|
||||||
|
|
||||||
wCurrMapDataEnd::
|
wCurrMapDataEnd::
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user