mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Remove all code from main.asm (some labeled INCBINs, like out-of-context graphics, are still present)
engine/routines/ stores isolated out-of-context routines as individual files. It might be preferable later to append them to their related engine/ files in unique little SECTIONs, relying on the linkerscript to place them appropriately; or some other organization method. In the meantime, they're now easily findable apart from main.asm's other content.
This commit is contained in:
parent
15f1fc7c6c
commit
7d4486e6a3
@ -2573,11 +2573,11 @@ WinTrainerBattle: ; 3cfa4
|
|||||||
.CheckMaxedOutMomMoney: ; 3d0b1
|
.CheckMaxedOutMomMoney: ; 3d0b1
|
||||||
ld hl, wMomsMoney + 2
|
ld hl, wMomsMoney + 2
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
cp 999999 % $100
|
cp MAX_MONEY % $100
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
sbc 999999 / $100 % $100
|
sbc MAX_MONEY / $100 % $100
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
sbc 999999 / $10000 % $100
|
sbc MAX_MONEY / $10000 % $100
|
||||||
ret
|
ret
|
||||||
; 3d0be
|
; 3d0be
|
||||||
|
|
||||||
@ -2602,17 +2602,17 @@ AddBattleMoneyToAccount: ; 3d0be
|
|||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
pop hl
|
pop hl
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
cp 999999 % $100
|
cp MAX_MONEY % $100
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
sbc 999999 / $100 % $100
|
sbc MAX_MONEY / $100 % $100
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
sbc 999999 / $10000 % $100
|
sbc MAX_MONEY / $10000 % $100
|
||||||
ret c
|
ret c
|
||||||
ld [hl], 999999 / $10000 % $100
|
ld [hl], MAX_MONEY / $10000 % $100
|
||||||
inc hl
|
inc hl
|
||||||
ld [hl], 999999 / $100 % $100
|
ld [hl], MAX_MONEY / $100 % $100
|
||||||
inc hl
|
inc hl
|
||||||
ld [hl], 999999 % $100
|
ld [hl], MAX_MONEY % $100
|
||||||
ret
|
ret
|
||||||
; 3d0ea
|
; 3d0ea
|
||||||
|
|
||||||
|
@ -93,6 +93,8 @@ NUM_HOF_TEAMS = 30
|
|||||||
; significant money values
|
; significant money values
|
||||||
START_MONEY EQU 3000
|
START_MONEY EQU 3000
|
||||||
MOM_MONEY EQU 2300
|
MOM_MONEY EQU 2300
|
||||||
|
MAX_MONEY EQU 999999
|
||||||
|
MAX_COINS EQU 9999
|
||||||
|
|
||||||
|
|
||||||
; ChangeHappiness arguments (see data/happiness_changes.asm)
|
; ChangeHappiness arguments (see data/happiness_changes.asm)
|
||||||
|
@ -1185,14 +1185,14 @@ CardFlip_CheckWinCondition: ; e0637
|
|||||||
|
|
||||||
.IsCoinCaseFull: ; e0833
|
.IsCoinCaseFull: ; e0833
|
||||||
ld a, [Coins]
|
ld a, [Coins]
|
||||||
cp 9999 / $100
|
cp MAX_COINS / $100
|
||||||
jr c, .less
|
jr c, .less
|
||||||
jr z, .check_low
|
jr z, .check_low
|
||||||
jr .more
|
jr .more
|
||||||
|
|
||||||
.check_low
|
.check_low
|
||||||
ld a, [Coins + 1]
|
ld a, [Coins + 1]
|
||||||
cp 9999 % $100
|
cp MAX_COINS % $100
|
||||||
jr c, .less
|
jr c, .less
|
||||||
|
|
||||||
.more
|
.more
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
_Diploma: ; 1dd702
|
_Diploma: ; 1dd702
|
||||||
call PlaceDiplomaOnScreen
|
call PlaceDiplomaOnScreen
|
||||||
call WaitPressAorB_BlinkCursor
|
call WaitPressAorB_BlinkCursor
|
||||||
|
@ -3314,5 +3314,3 @@ GetMthMoveOfCurrentMon: ; f969
|
|||||||
add hl, bc
|
add hl, bc
|
||||||
ret
|
ret
|
||||||
; f971
|
; f971
|
||||||
|
|
||||||
INCLUDE "engine/pokeball_wobble.asm"
|
|
||||||
|
91
engine/link_2.asm
Normal file
91
engine/link_2.asm
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
LinkMonStatsScreen: ; 4d319
|
||||||
|
ld a, [wMenuCursorY]
|
||||||
|
dec a
|
||||||
|
ld [CurPartyMon], a
|
||||||
|
call LowVolume
|
||||||
|
predef StatsScreenInit
|
||||||
|
ld a, [CurPartyMon]
|
||||||
|
inc a
|
||||||
|
ld [wMenuCursorY], a
|
||||||
|
call ClearScreen
|
||||||
|
call ClearBGPalettes
|
||||||
|
call MaxVolume
|
||||||
|
farcall LoadTradeScreenBorder
|
||||||
|
farcall Link_WaitBGMap
|
||||||
|
farcall InitTradeSpeciesList
|
||||||
|
farcall SetTradeRoomBGPals
|
||||||
|
call WaitBGMap2
|
||||||
|
ret
|
||||||
|
|
||||||
|
Link_WaitBGMap: ; 4d354
|
||||||
|
call WaitBGMap
|
||||||
|
call WaitBGMap2
|
||||||
|
ret
|
||||||
|
|
||||||
|
LinkTextbox2: ; 4d35b
|
||||||
|
ld h, d
|
||||||
|
ld l, e
|
||||||
|
push bc
|
||||||
|
push hl
|
||||||
|
call .PlaceBorder
|
||||||
|
pop hl
|
||||||
|
pop bc
|
||||||
|
ld de, AttrMap - TileMap
|
||||||
|
add hl, de
|
||||||
|
inc b
|
||||||
|
inc b
|
||||||
|
inc c
|
||||||
|
inc c
|
||||||
|
ld a, $7
|
||||||
|
.row
|
||||||
|
push bc
|
||||||
|
push hl
|
||||||
|
.col
|
||||||
|
ld [hli], a
|
||||||
|
dec c
|
||||||
|
jr nz, .col
|
||||||
|
pop hl
|
||||||
|
ld de, SCREEN_WIDTH
|
||||||
|
add hl, de
|
||||||
|
pop bc
|
||||||
|
dec b
|
||||||
|
jr nz, .row
|
||||||
|
ret
|
||||||
|
|
||||||
|
.PlaceBorder: ; 4d37e
|
||||||
|
push hl
|
||||||
|
ld a, $76
|
||||||
|
ld [hli], a
|
||||||
|
inc a
|
||||||
|
call .PlaceRow
|
||||||
|
inc a
|
||||||
|
ld [hl], a
|
||||||
|
pop hl
|
||||||
|
ld de, SCREEN_WIDTH
|
||||||
|
add hl, de
|
||||||
|
.loop
|
||||||
|
push hl
|
||||||
|
ld a, "┌"
|
||||||
|
ld [hli], a
|
||||||
|
ld a, " "
|
||||||
|
call .PlaceRow
|
||||||
|
ld [hl], "─"
|
||||||
|
pop hl
|
||||||
|
ld de, SCREEN_WIDTH
|
||||||
|
add hl, de
|
||||||
|
dec b
|
||||||
|
jr nz, .loop
|
||||||
|
ld a, "┐"
|
||||||
|
ld [hli], a
|
||||||
|
ld a, "│"
|
||||||
|
call .PlaceRow
|
||||||
|
ld [hl], "└"
|
||||||
|
ret
|
||||||
|
|
||||||
|
.PlaceRow: ; 4d3ab
|
||||||
|
ld d, c
|
||||||
|
.row_loop
|
||||||
|
ld [hli], a
|
||||||
|
dec d
|
||||||
|
jr nz, .row_loop
|
||||||
|
ret
|
@ -24,7 +24,7 @@ GiveMoney:: ; 15fd7
|
|||||||
; 15ff7
|
; 15ff7
|
||||||
|
|
||||||
MaxMoney: ; 15ff7
|
MaxMoney: ; 15ff7
|
||||||
dt 999999
|
dt MAX_MONEY
|
||||||
; 15ffa
|
; 15ffa
|
||||||
|
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ GiveCoins:: ; 1606f
|
|||||||
; 1608d
|
; 1608d
|
||||||
|
|
||||||
.maxcoins ; 1608d
|
.maxcoins ; 1608d
|
||||||
bigdw 9999
|
bigdw MAX_COINS
|
||||||
; 1608f
|
; 1608f
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
ChrisBackpic: ; 2ba1a
|
|
||||||
INCBIN "gfx/player/chris_back.2bpp.lz"
|
|
||||||
|
|
||||||
DudeBackpic: ; 2bbaa
|
|
||||||
INCBIN "gfx/battle/dude.2bpp.lz"
|
|
3
engine/routines/battlestart_copytilemapatonce.asm
Normal file
3
engine/routines/battlestart_copytilemapatonce.asm
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
BattleStart_CopyTilemapAtOnce: ; 8cf4f
|
||||||
|
call CGBOnly_CopyTilemapAtOnce
|
||||||
|
ret
|
25
engine/routines/checkpokerus.asm
Normal file
25
engine/routines/checkpokerus.asm
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
CheckPokerus: ; 4d860
|
||||||
|
; Return carry if a monster in your party has Pokerus
|
||||||
|
|
||||||
|
; Get number of monsters to iterate over
|
||||||
|
ld a, [PartyCount]
|
||||||
|
and a
|
||||||
|
jr z, .NoPokerus
|
||||||
|
ld b, a
|
||||||
|
; Check each monster in the party for Pokerus
|
||||||
|
ld hl, PartyMon1PokerusStatus
|
||||||
|
ld de, PARTYMON_STRUCT_LENGTH
|
||||||
|
.Check:
|
||||||
|
ld a, [hl]
|
||||||
|
and $0f ; only the bottom nybble is used
|
||||||
|
jr nz, .HasPokerus
|
||||||
|
; Next PartyMon
|
||||||
|
add hl, de
|
||||||
|
dec b
|
||||||
|
jr nz, .Check
|
||||||
|
.NoPokerus:
|
||||||
|
and a
|
||||||
|
ret
|
||||||
|
.HasPokerus:
|
||||||
|
scf
|
||||||
|
ret
|
20
engine/routines/checksave.asm
Normal file
20
engine/routines/checksave.asm
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
CheckSave:: ; 4cffe
|
||||||
|
ld a, BANK(sCheckValue1) ; BANK(sCheckValue2)
|
||||||
|
call GetSRAMBank
|
||||||
|
ld a, [sCheckValue1]
|
||||||
|
ld b, a
|
||||||
|
ld a, [sCheckValue2]
|
||||||
|
ld c, a
|
||||||
|
call CloseSRAM
|
||||||
|
ld a, b
|
||||||
|
cp SAVE_CHECK_VALUE_1
|
||||||
|
jr nz, .ok
|
||||||
|
ld a, c
|
||||||
|
cp SAVE_CHECK_VALUE_2
|
||||||
|
jr nz, .ok
|
||||||
|
ld c, $1
|
||||||
|
ret
|
||||||
|
|
||||||
|
.ok
|
||||||
|
ld c, $0
|
||||||
|
ret
|
@ -1,6 +1,6 @@
|
|||||||
CheckTime:: ; c000
|
CheckTime:: ; c000
|
||||||
ld a, [TimeOfDay]
|
ld a, [TimeOfDay]
|
||||||
ld hl, TimeOfDayTable
|
ld hl, .TimeOfDayTable
|
||||||
ld de, 2
|
ld de, 2
|
||||||
call IsInArray
|
call IsInArray
|
||||||
inc hl
|
inc hl
|
||||||
@ -11,7 +11,7 @@ CheckTime:: ; c000
|
|||||||
ld c, a
|
ld c, a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
TimeOfDayTable: ; c012
|
.TimeOfDayTable: ; c012
|
||||||
db MORN_F, MORN
|
db MORN_F, MORN
|
||||||
db DAY_F, DAY
|
db DAY_F, DAY
|
||||||
db NITE_F, NITE
|
db NITE_F, NITE
|
@ -4,7 +4,7 @@ GetSquareRoot: ; 13b87
|
|||||||
; Rather than calculating the result, we take the index of the
|
; Rather than calculating the result, we take the index of the
|
||||||
; first value in a table of squares that isn't lower than de.
|
; first value in a table of squares that isn't lower than de.
|
||||||
|
|
||||||
ld hl, Squares
|
ld hl, .Squares
|
||||||
ld b, 0
|
ld b, 0
|
||||||
.loop
|
.loop
|
||||||
; Make sure we don't go past the end of the table.
|
; Make sure we don't go past the end of the table.
|
||||||
@ -22,7 +22,7 @@ GetSquareRoot: ; 13b87
|
|||||||
jr c, .loop
|
jr c, .loop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Squares: ; 13b98
|
.Squares: ; 13b98
|
||||||
root set 1
|
root set 1
|
||||||
rept $ff
|
rept $ff
|
||||||
dw root*root
|
dw root*root
|
4
engine/routines/kurt_selectquantity_interpretjoypad.asm
Normal file
4
engine/routines/kurt_selectquantity_interpretjoypad.asm
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Kurt_SelectQuantity_InterpretJoypad: ; 27a28
|
||||||
|
call BuySellToss_InterpretJoypad
|
||||||
|
ld b, a
|
||||||
|
ret
|
20
engine/routines/leveluphappinessmod.asm
Normal file
20
engine/routines/leveluphappinessmod.asm
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
LevelUpHappinessMod: ; 2709e
|
||||||
|
ld a, [CurPartyMon]
|
||||||
|
ld hl, PartyMon1CaughtLocation
|
||||||
|
call GetPartyLocation
|
||||||
|
ld a, [hl]
|
||||||
|
and $7f
|
||||||
|
ld d, a
|
||||||
|
ld a, [MapGroup]
|
||||||
|
ld b, a
|
||||||
|
ld a, [MapNumber]
|
||||||
|
ld c, a
|
||||||
|
call GetWorldMapLocation
|
||||||
|
cp d
|
||||||
|
ld c, HAPPINESS_GAINLEVEL
|
||||||
|
jr nz, .ok
|
||||||
|
ld c, HAPPINESS_GAINLEVELATHOME
|
||||||
|
|
||||||
|
.ok
|
||||||
|
callfar ChangeHappiness
|
||||||
|
ret
|
36
engine/routines/loadmappart.asm
Normal file
36
engine/routines/loadmappart.asm
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
_LoadMapPart:: ; 4d15b
|
||||||
|
ld hl, wMisc
|
||||||
|
ld a, [wMetatileStandingY]
|
||||||
|
and a
|
||||||
|
jr z, .top_row
|
||||||
|
ld bc, WMISC_WIDTH * 2
|
||||||
|
add hl, bc
|
||||||
|
|
||||||
|
.top_row
|
||||||
|
ld a, [wMetatileStandingX]
|
||||||
|
and a
|
||||||
|
jr z, .left_column
|
||||||
|
inc hl
|
||||||
|
inc hl
|
||||||
|
|
||||||
|
.left_column
|
||||||
|
decoord 0, 0
|
||||||
|
ld b, SCREEN_HEIGHT
|
||||||
|
.loop
|
||||||
|
ld c, SCREEN_WIDTH
|
||||||
|
.loop2
|
||||||
|
ld a, [hli]
|
||||||
|
ld [de], a
|
||||||
|
inc de
|
||||||
|
dec c
|
||||||
|
jr nz, .loop2
|
||||||
|
ld a, l
|
||||||
|
add 4
|
||||||
|
ld l, a
|
||||||
|
jr nc, .carry
|
||||||
|
inc h
|
||||||
|
|
||||||
|
.carry
|
||||||
|
dec b
|
||||||
|
jr nz, .loop
|
||||||
|
ret
|
21
engine/routines/loadpushoam.asm
Normal file
21
engine/routines/loadpushoam.asm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
LoadPushOAM:: ; 4031
|
||||||
|
ld c, hPushOAM - $ff00
|
||||||
|
ld b, .PushOAMEnd - .PushOAM
|
||||||
|
ld hl, .PushOAM
|
||||||
|
.loop
|
||||||
|
ld a, [hli]
|
||||||
|
ld [$ff00+c], a
|
||||||
|
inc c
|
||||||
|
dec b
|
||||||
|
jr nz, .loop
|
||||||
|
ret
|
||||||
|
|
||||||
|
.PushOAM: ; 403f
|
||||||
|
ld a, Sprites / $100
|
||||||
|
ld [rDMA], a
|
||||||
|
ld a, (SpritesEnd - Sprites) / 4 ; 40
|
||||||
|
.pushoam_loop
|
||||||
|
dec a
|
||||||
|
jr nz, .pushoam_loop
|
||||||
|
ret
|
||||||
|
.PushOAMEnd
|
80
engine/routines/phonering_copytilemapatonce.asm
Normal file
80
engine/routines/phonering_copytilemapatonce.asm
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
PhoneRing_CopyTilemapAtOnce: ; 4d188
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jp z, WaitBGMap
|
||||||
|
ld a, [wSpriteUpdatesEnabled]
|
||||||
|
cp $0
|
||||||
|
jp z, WaitBGMap
|
||||||
|
|
||||||
|
; What follows is a modified version of CopyTilemapAtOnce.
|
||||||
|
ld a, [hBGMapMode]
|
||||||
|
push af
|
||||||
|
xor a
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ld a, [hMapAnims]
|
||||||
|
push af
|
||||||
|
xor a
|
||||||
|
ld [hMapAnims], a
|
||||||
|
.wait
|
||||||
|
ld a, [rLY]
|
||||||
|
cp $8f
|
||||||
|
jr c, .wait
|
||||||
|
|
||||||
|
di
|
||||||
|
ld a, BANK(VBGMap2)
|
||||||
|
ld [rVBK], a
|
||||||
|
hlcoord 0, 0, AttrMap
|
||||||
|
call .CopyTilemapAtOnce
|
||||||
|
ld a, BANK(VBGMap0)
|
||||||
|
ld [rVBK], a
|
||||||
|
hlcoord 0, 0
|
||||||
|
call .CopyTilemapAtOnce
|
||||||
|
.wait2
|
||||||
|
ld a, [rLY]
|
||||||
|
cp $8f
|
||||||
|
jr c, .wait2
|
||||||
|
ei
|
||||||
|
|
||||||
|
pop af
|
||||||
|
ld [hMapAnims], a
|
||||||
|
pop af
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.CopyTilemapAtOnce: ; 4d1cb
|
||||||
|
ld [hSPBuffer], sp
|
||||||
|
ld sp, hl
|
||||||
|
ld a, [hBGMapAddress + 1]
|
||||||
|
ld h, a
|
||||||
|
ld l, 0
|
||||||
|
ld a, SCREEN_HEIGHT
|
||||||
|
ld [hTilesPerCycle], a
|
||||||
|
ld b, 1 << 1 ; not in v/hblank
|
||||||
|
ld c, rSTAT % $100
|
||||||
|
|
||||||
|
.loop
|
||||||
|
rept SCREEN_WIDTH / 2
|
||||||
|
pop de
|
||||||
|
.loop\@
|
||||||
|
ld a, [$ff00+c]
|
||||||
|
and b
|
||||||
|
jr nz, .loop\@
|
||||||
|
ld [hl], e
|
||||||
|
inc l
|
||||||
|
ld [hl], d
|
||||||
|
inc l
|
||||||
|
endr
|
||||||
|
|
||||||
|
ld de, BG_MAP_WIDTH - SCREEN_WIDTH
|
||||||
|
add hl, de
|
||||||
|
ld a, [hTilesPerCycle]
|
||||||
|
dec a
|
||||||
|
ld [hTilesPerCycle], a
|
||||||
|
jr nz, .loop
|
||||||
|
|
||||||
|
ld a, [hSPBuffer]
|
||||||
|
ld l, a
|
||||||
|
ld a, [hSPBuffer + 1]
|
||||||
|
ld h, a
|
||||||
|
ld sp, hl
|
||||||
|
ret
|
24
engine/routines/placewaitingtext.asm
Normal file
24
engine/routines/placewaitingtext.asm
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
PlaceWaitingText:: ; 4000
|
||||||
|
hlcoord 3, 10
|
||||||
|
ld b, 1
|
||||||
|
ld c, 11
|
||||||
|
|
||||||
|
ld a, [wBattleMode]
|
||||||
|
and a
|
||||||
|
jr z, .notinbattle
|
||||||
|
|
||||||
|
call TextBox
|
||||||
|
jr .proceed
|
||||||
|
|
||||||
|
.notinbattle
|
||||||
|
predef Predef_LinkTextbox
|
||||||
|
|
||||||
|
.proceed
|
||||||
|
hlcoord 4, 11
|
||||||
|
ld de, .Waiting
|
||||||
|
call PlaceString
|
||||||
|
ld c, 50
|
||||||
|
jp DelayFrames
|
||||||
|
|
||||||
|
.Waiting: ; 4025
|
||||||
|
db "Waiting...!@"
|
@ -14,7 +14,7 @@ Function1dd6a9: ; 1dd6a9
|
|||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
PrintHoursMins ; 1dd6bb (77:56bb)
|
PrintHoursMins: ; 1dd6bb (77:56bb)
|
||||||
; Hours in b, minutes in c
|
; Hours in b, minutes in c
|
||||||
ld a, b
|
ld a, b
|
||||||
cp 12
|
cp 12
|
19
engine/routines/returntobattle_useball.asm
Normal file
19
engine/routines/returntobattle_useball.asm
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
_ReturnToBattle_UseBall: ; 2715c
|
||||||
|
call ClearBGPalettes
|
||||||
|
call ClearTileMap
|
||||||
|
ld a, [BattleType]
|
||||||
|
cp BATTLETYPE_TUTORIAL
|
||||||
|
jr z, .gettutorialbackpic
|
||||||
|
farcall GetBattleMonBackpic
|
||||||
|
jr .continue
|
||||||
|
|
||||||
|
.gettutorialbackpic
|
||||||
|
farcall GetTrainerBackpic
|
||||||
|
.continue
|
||||||
|
farcall GetEnemyMonFrontpic
|
||||||
|
farcall _LoadBattleFontsHPBar
|
||||||
|
call GetMemSGBLayout
|
||||||
|
call CloseWindow
|
||||||
|
call LoadStandardMenuDataHeader
|
||||||
|
call WaitBGMap
|
||||||
|
jp SetPalettes
|
77
engine/routines/savemenu_copytilemapatonce.asm
Normal file
77
engine/routines/savemenu_copytilemapatonce.asm
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45)
|
||||||
|
ld a, [hCGB]
|
||||||
|
and a
|
||||||
|
jp z, WaitBGMap
|
||||||
|
|
||||||
|
; The following is a modified version of CopyTilemapAtOnce.
|
||||||
|
ld a, [hBGMapMode]
|
||||||
|
push af
|
||||||
|
xor a
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ld a, [hMapAnims]
|
||||||
|
push af
|
||||||
|
xor a
|
||||||
|
ld [hMapAnims], a
|
||||||
|
.WaitLY:
|
||||||
|
ld a, [rLY]
|
||||||
|
cp $60
|
||||||
|
jr c, .WaitLY
|
||||||
|
|
||||||
|
di
|
||||||
|
ld a, BANK(VBGMap2)
|
||||||
|
ld [rVBK], a
|
||||||
|
hlcoord 0, 0, AttrMap
|
||||||
|
call .CopyTilemapAtOnce
|
||||||
|
ld a, BANK(VBGMap0)
|
||||||
|
ld [rVBK], a
|
||||||
|
hlcoord 0, 0
|
||||||
|
call .CopyTilemapAtOnce
|
||||||
|
.WaitLY2:
|
||||||
|
ld a, [rLY]
|
||||||
|
cp $60
|
||||||
|
jr c, .WaitLY2
|
||||||
|
ei
|
||||||
|
|
||||||
|
pop af
|
||||||
|
ld [hMapAnims], a
|
||||||
|
pop af
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
.CopyTilemapAtOnce: ; 4cf80 (13:4f80)
|
||||||
|
ld [hSPBuffer], sp ; $ffd9
|
||||||
|
ld sp, hl
|
||||||
|
ld a, [hBGMapAddress + 1]
|
||||||
|
ld h, a
|
||||||
|
ld l, 0
|
||||||
|
ld a, SCREEN_HEIGHT
|
||||||
|
ld [hTilesPerCycle], a
|
||||||
|
ld b, 1 << 1
|
||||||
|
ld c, rSTAT % $100
|
||||||
|
|
||||||
|
.loop
|
||||||
|
rept SCREEN_WIDTH / 2
|
||||||
|
pop de
|
||||||
|
.loop\@
|
||||||
|
ld a, [$ff00+c]
|
||||||
|
and b
|
||||||
|
jr nz, .loop\@
|
||||||
|
ld [hl], e
|
||||||
|
inc l
|
||||||
|
ld [hl], d
|
||||||
|
inc l
|
||||||
|
endr
|
||||||
|
|
||||||
|
ld de, BG_MAP_WIDTH - SCREEN_WIDTH
|
||||||
|
add hl, de
|
||||||
|
ld a, [hTilesPerCycle]
|
||||||
|
dec a
|
||||||
|
ld [hTilesPerCycle], a
|
||||||
|
jr nz, .loop
|
||||||
|
|
||||||
|
ld a, [hSPBuffer]
|
||||||
|
ld l, a
|
||||||
|
ld a, [hSPBuffer + 1]
|
||||||
|
ld h, a
|
||||||
|
ld sp, hl
|
||||||
|
ret
|
@ -19,7 +19,3 @@ TownMap_ConvertLineBreakCharacters: ; 1de2c5
|
|||||||
hlcoord 9, 0
|
hlcoord 9, 0
|
||||||
call PlaceString
|
call PlaceString
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
PokegearGFX: ; 1de2e4
|
|
||||||
INCBIN "gfx/pokegear/pokegear.2bpp.lz"
|
|
9
engine/routines/updatebattlehuds.asm
Normal file
9
engine/routines/updatebattlehuds.asm
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
_UpdateBattleHUDs:
|
||||||
|
farcall DrawPlayerHUD
|
||||||
|
ld hl, PlayerHPPal
|
||||||
|
call SetHPPal
|
||||||
|
farcall DrawEnemyHUD
|
||||||
|
ld hl, EnemyHPPal
|
||||||
|
call SetHPPal
|
||||||
|
farcall FinishBattleAnim
|
||||||
|
ret
|
13
engine/routines/updateitemdescription.asm
Normal file
13
engine/routines/updateitemdescription.asm
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
UpdateItemDescription: ; 0x244c3
|
||||||
|
ld a, [MenuSelection]
|
||||||
|
ld [CurSpecies], a
|
||||||
|
hlcoord 0, 12
|
||||||
|
ld b, 4
|
||||||
|
ld c, SCREEN_WIDTH - 2
|
||||||
|
call TextBox
|
||||||
|
ld a, [MenuSelection]
|
||||||
|
cp -1
|
||||||
|
ret z
|
||||||
|
decoord 1, 14
|
||||||
|
farcall PrintItemDescription
|
||||||
|
ret
|
@ -471,10 +471,10 @@ Slots_LoadReelState: ; 929f6 (24:69f6)
|
|||||||
|
|
||||||
Slot_CheckCoinCaseFull: ; 92a04 (24:6a04)
|
Slot_CheckCoinCaseFull: ; 92a04 (24:6a04)
|
||||||
ld a, d
|
ld a, d
|
||||||
cp 9999 / $100
|
cp MAX_COINS / $100
|
||||||
jr c, .not_full
|
jr c, .not_full
|
||||||
ld a, e
|
ld a, e
|
||||||
cp 9999 % $100
|
cp MAX_COINS % $100
|
||||||
jr c, .not_full
|
jr c, .not_full
|
||||||
scf
|
scf
|
||||||
ret
|
ret
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
INCLUDE "data/maps/spawn_points.asm"
|
INCLUDE "data/maps/spawn_points.asm"
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,4 +48,5 @@ PrintUnownWord: ; fba2e (3e:7a2e)
|
|||||||
jr .loop
|
jr .loop
|
||||||
; fba5a (3e:7a5a)
|
; fba5a (3e:7a5a)
|
||||||
|
|
||||||
|
|
||||||
INCLUDE "data/unown_words.asm"
|
INCLUDE "data/unown_words.asm"
|
||||||
|
532
main.asm
532
main.asm
@ -3,58 +3,13 @@ INCLUDE "includes.asm"
|
|||||||
|
|
||||||
SECTION "bank1", ROMX
|
SECTION "bank1", ROMX
|
||||||
|
|
||||||
PlaceWaitingText:: ; 4000
|
INCLUDE "engine/routines/placewaitingtext.asm"
|
||||||
hlcoord 3, 10
|
INCLUDE "engine/routines/loadpushoam.asm"
|
||||||
ld b, 1
|
|
||||||
ld c, 11
|
|
||||||
|
|
||||||
ld a, [wBattleMode]
|
|
||||||
and a
|
|
||||||
jr z, .notinbattle
|
|
||||||
|
|
||||||
call TextBox
|
|
||||||
jr .proceed
|
|
||||||
|
|
||||||
.notinbattle
|
|
||||||
predef Predef_LinkTextbox
|
|
||||||
|
|
||||||
.proceed
|
|
||||||
hlcoord 4, 11
|
|
||||||
ld de, .Waiting
|
|
||||||
call PlaceString
|
|
||||||
ld c, 50
|
|
||||||
jp DelayFrames
|
|
||||||
|
|
||||||
.Waiting: ; 4025
|
|
||||||
db "Waiting...!@"
|
|
||||||
|
|
||||||
LoadPushOAM:: ; 4031
|
|
||||||
ld c, hPushOAM - $ff00
|
|
||||||
ld b, PushOAMEnd - PushOAM
|
|
||||||
ld hl, PushOAM
|
|
||||||
.loop
|
|
||||||
ld a, [hli]
|
|
||||||
ld [$ff00+c], a
|
|
||||||
inc c
|
|
||||||
dec b
|
|
||||||
jr nz, .loop
|
|
||||||
ret
|
|
||||||
|
|
||||||
PushOAM: ; 403f
|
|
||||||
ld a, Sprites / $100
|
|
||||||
ld [rDMA], a
|
|
||||||
ld a, (SpritesEnd - Sprites) / 4 ; 40
|
|
||||||
.loop
|
|
||||||
dec a
|
|
||||||
jr nz, .loop
|
|
||||||
ret
|
|
||||||
PushOAMEnd
|
|
||||||
|
|
||||||
INCLUDE "engine/map_objects.asm"
|
INCLUDE "engine/map_objects.asm"
|
||||||
INCLUDE "engine/intro_menu.asm"
|
INCLUDE "engine/intro_menu.asm"
|
||||||
INCLUDE "engine/init_map.asm"
|
INCLUDE "engine/init_map.asm"
|
||||||
INCLUDE "engine/learn.asm"
|
INCLUDE "engine/learn.asm"
|
||||||
INCLUDE "engine/check_nick_errors.asm"
|
INCLUDE "engine/routines/checknickerrors.asm"
|
||||||
INCLUDE "engine/math.asm"
|
INCLUDE "engine/math.asm"
|
||||||
INCLUDE "data/items/item_attributes.asm"
|
INCLUDE "data/items/item_attributes.asm"
|
||||||
INCLUDE "engine/npc_movement.asm"
|
INCLUDE "engine/npc_movement.asm"
|
||||||
@ -65,14 +20,14 @@ INCLUDE "event/special.asm"
|
|||||||
SECTION "bank2", ROMX
|
SECTION "bank2", ROMX
|
||||||
|
|
||||||
INCLUDE "engine/player_object.asm"
|
INCLUDE "engine/player_object.asm"
|
||||||
INCLUDE "engine/sine.asm"
|
INCLUDE "engine/routines/sine.asm"
|
||||||
INCLUDE "engine/predef.asm"
|
INCLUDE "engine/predef.asm"
|
||||||
INCLUDE "engine/color.asm"
|
INCLUDE "engine/color.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "bank3", ROMX
|
SECTION "bank3", ROMX
|
||||||
|
|
||||||
INCLUDE "engine/check_time.asm"
|
INCLUDE "engine/routines/checktime.asm"
|
||||||
INCLUDE "engine/specials.asm"
|
INCLUDE "engine/specials.asm"
|
||||||
INCLUDE "engine/printnum.asm"
|
INCLUDE "engine/printnum.asm"
|
||||||
INCLUDE "engine/health.asm"
|
INCLUDE "engine/health.asm"
|
||||||
@ -82,10 +37,11 @@ INCLUDE "engine/player_step.asm"
|
|||||||
INCLUDE "engine/anim_hp_bar.asm"
|
INCLUDE "engine/anim_hp_bar.asm"
|
||||||
INCLUDE "engine/move_mon.asm"
|
INCLUDE "engine/move_mon.asm"
|
||||||
INCLUDE "engine/billspctop.asm"
|
INCLUDE "engine/billspctop.asm"
|
||||||
INCLUDE "engine/get_breedmon_growth.asm"
|
INCLUDE "engine/routines/getbreedmonlevelgrowth.asm"
|
||||||
INCLUDE "event/bug_contest/caught_mon.asm"
|
INCLUDE "event/bug_contest/caught_mon.asm"
|
||||||
INCLUDE "engine/item_effects.asm"
|
INCLUDE "engine/item_effects.asm"
|
||||||
INCLUDE "engine/knows_move.asm"
|
INCLUDE "engine/routines/getpokeballwobble.asm"
|
||||||
|
INCLUDE "engine/routines/knowsmove.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "bank4", ROMX
|
SECTION "bank4", ROMX
|
||||||
@ -106,10 +62,10 @@ INCLUDE "event/bug_contest/contest.asm"
|
|||||||
INCLUDE "event/misc_scripts_2.asm"
|
INCLUDE "event/misc_scripts_2.asm"
|
||||||
INCLUDE "event/std_collision.asm"
|
INCLUDE "event/std_collision.asm"
|
||||||
INCLUDE "event/bug_contest/judging.asm"
|
INCLUDE "event/bug_contest/judging.asm"
|
||||||
INCLUDE "engine/pokerus_tick.asm"
|
INCLUDE "engine/routines/applypokerustick.asm"
|
||||||
INCLUDE "event/bug_contest/contest_2.asm"
|
INCLUDE "event/bug_contest/contest_2.asm"
|
||||||
INCLUDE "engine/unused_correct_party.asm"
|
INCLUDE "engine/routines/correcterrorsinplayerparty.asm"
|
||||||
INCLUDE "engine/square_root.asm"
|
INCLUDE "engine/routines/getsquareroot.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "bank5", ROMX
|
SECTION "bank5", ROMX
|
||||||
@ -141,21 +97,7 @@ SECTION "bank9", ROMX
|
|||||||
|
|
||||||
INCLUDE "data/text_buffers.asm"
|
INCLUDE "data/text_buffers.asm"
|
||||||
INCLUDE "engine/menu.asm"
|
INCLUDE "engine/menu.asm"
|
||||||
|
INCLUDE "engine/routines/updateitemdescription.asm"
|
||||||
UpdateItemDescription: ; 0x244c3
|
|
||||||
ld a, [MenuSelection]
|
|
||||||
ld [CurSpecies], a
|
|
||||||
hlcoord 0, 12
|
|
||||||
ld b, 4
|
|
||||||
ld c, SCREEN_WIDTH - 2
|
|
||||||
call TextBox
|
|
||||||
ld a, [MenuSelection]
|
|
||||||
cp -1
|
|
||||||
ret z
|
|
||||||
decoord 1, 14
|
|
||||||
farcall PrintItemDescription
|
|
||||||
ret
|
|
||||||
|
|
||||||
INCLUDE "engine/pokepic.asm"
|
INCLUDE "engine/pokepic.asm"
|
||||||
INCLUDE "engine/map_objects_2.asm"
|
INCLUDE "engine/map_objects_2.asm"
|
||||||
INCLUDE "engine/scrolling_menu.asm"
|
INCLUDE "engine/scrolling_menu.asm"
|
||||||
@ -167,58 +109,13 @@ INCLUDE "engine/buy_sell_toss.asm"
|
|||||||
INCLUDE "engine/trainer_card.asm"
|
INCLUDE "engine/trainer_card.asm"
|
||||||
INCLUDE "engine/prof_oaks_pc.asm"
|
INCLUDE "engine/prof_oaks_pc.asm"
|
||||||
INCLUDE "engine/decorations.asm"
|
INCLUDE "engine/decorations.asm"
|
||||||
|
INCLUDE "engine/routines/leveluphappinessmod.asm"
|
||||||
LevelUpHappinessMod: ; 2709e
|
|
||||||
ld a, [CurPartyMon]
|
|
||||||
ld hl, PartyMon1CaughtLocation
|
|
||||||
call GetPartyLocation
|
|
||||||
ld a, [hl]
|
|
||||||
and $7f
|
|
||||||
ld d, a
|
|
||||||
ld a, [MapGroup]
|
|
||||||
ld b, a
|
|
||||||
ld a, [MapNumber]
|
|
||||||
ld c, a
|
|
||||||
call GetWorldMapLocation
|
|
||||||
cp d
|
|
||||||
ld c, HAPPINESS_GAINLEVEL
|
|
||||||
jr nz, .ok
|
|
||||||
ld c, HAPPINESS_GAINLEVELATHOME
|
|
||||||
|
|
||||||
.ok
|
|
||||||
callfar ChangeHappiness
|
|
||||||
ret
|
|
||||||
|
|
||||||
INCLUDE "data/trainers/trainer_dvs.asm"
|
INCLUDE "data/trainers/trainer_dvs.asm"
|
||||||
|
INCLUDE "engine/routines/returntobattle_useball.asm"
|
||||||
_ReturnToBattle_UseBall: ; 2715c
|
INCLUDE "engine/routines/consumehelditem.asm"
|
||||||
call ClearBGPalettes
|
|
||||||
call ClearTileMap
|
|
||||||
ld a, [BattleType]
|
|
||||||
cp BATTLETYPE_TUTORIAL
|
|
||||||
jr z, .gettutorialbackpic
|
|
||||||
farcall GetBattleMonBackpic
|
|
||||||
jr .continue
|
|
||||||
|
|
||||||
.gettutorialbackpic
|
|
||||||
farcall GetTrainerBackpic
|
|
||||||
.continue
|
|
||||||
farcall GetEnemyMonFrontpic
|
|
||||||
farcall _LoadBattleFontsHPBar
|
|
||||||
call GetMemSGBLayout
|
|
||||||
call CloseWindow
|
|
||||||
call LoadStandardMenuDataHeader
|
|
||||||
call WaitBGMap
|
|
||||||
jp SetPalettes
|
|
||||||
|
|
||||||
INCLUDE "engine/consume_held_item.asm"
|
|
||||||
INCLUDE "battle/moves/move_effects_pointers.asm"
|
INCLUDE "battle/moves/move_effects_pointers.asm"
|
||||||
INCLUDE "battle/moves/move_effects.asm"
|
INCLUDE "battle/moves/move_effects.asm"
|
||||||
|
INCLUDE "engine/routines/kurt_selectquantity_interpretjoypad.asm"
|
||||||
Kurt_SelectQuantity_InterpretJoypad: ; 27a28
|
|
||||||
call BuySellToss_InterpretJoypad
|
|
||||||
ld b, a
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
SECTION "bankA", ROMX
|
SECTION "bankA", ROMX
|
||||||
@ -226,7 +123,12 @@ SECTION "bankA", ROMX
|
|||||||
INCLUDE "engine/link.asm"
|
INCLUDE "engine/link.asm"
|
||||||
INCLUDE "engine/wildmons.asm"
|
INCLUDE "engine/wildmons.asm"
|
||||||
INCLUDE "battle/link_result.asm"
|
INCLUDE "battle/link_result.asm"
|
||||||
INCLUDE "engine/player_gfx_2.asm"
|
|
||||||
|
ChrisBackpic: ; 2ba1a
|
||||||
|
INCBIN "gfx/player/chris_back.2bpp.lz"
|
||||||
|
|
||||||
|
DudeBackpic: ; 2bbaa
|
||||||
|
INCBIN "gfx/battle/dude.2bpp.lz"
|
||||||
|
|
||||||
|
|
||||||
SECTION "bankB", ROMX
|
SECTION "bankB", ROMX
|
||||||
@ -240,7 +142,7 @@ INCLUDE "engine/tmhm2.asm"
|
|||||||
INCLUDE "battle/moves/move_descriptions.asm"
|
INCLUDE "battle/moves/move_descriptions.asm"
|
||||||
INCLUDE "engine/pokerus.asm"
|
INCLUDE "engine/pokerus.asm"
|
||||||
INCLUDE "engine/start_battle.asm"
|
INCLUDE "engine/start_battle.asm"
|
||||||
INCLUDE "engine/place_graphics.asm"
|
INCLUDE "engine/routines/placegraphic.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "Effect Commands", ROMX
|
SECTION "Effect Commands", ROMX
|
||||||
@ -284,7 +186,7 @@ INCLUDE "engine/mail.asm"
|
|||||||
SECTION "Crystal Unique", ROMX
|
SECTION "Crystal Unique", ROMX
|
||||||
|
|
||||||
INCLUDE "engine/init_gender.asm"
|
INCLUDE "engine/init_gender.asm"
|
||||||
INCLUDE "engine/pack_f.asm"
|
INCLUDE "engine/routines/drawkrispackgfx.asm"
|
||||||
INCLUDE "event/move_tutor.asm"
|
INCLUDE "event/move_tutor.asm"
|
||||||
INCLUDE "engine/crystal_colors.asm"
|
INCLUDE "engine/crystal_colors.asm"
|
||||||
INCLUDE "event/celebi.asm"
|
INCLUDE "event/celebi.asm"
|
||||||
@ -300,233 +202,20 @@ SECTION "bank13", ROMX
|
|||||||
INCLUDE "engine/map_palettes.asm"
|
INCLUDE "engine/map_palettes.asm"
|
||||||
INCLUDE "tilesets/palette_maps.asm"
|
INCLUDE "tilesets/palette_maps.asm"
|
||||||
|
|
||||||
Unknown_4ce05: ; unreferenced
|
; unreferenced
|
||||||
|
; 0x4ce05
|
||||||
rept 26
|
rept 26
|
||||||
db $06
|
db $06
|
||||||
endr
|
endr
|
||||||
; 0x4ce1f
|
; 0x4ce1f
|
||||||
|
|
||||||
INCLUDE "data/collision_permissions.asm"
|
INCLUDE "data/collision_permissions.asm"
|
||||||
INCLUDE "engine/empty_sram.asm"
|
INCLUDE "engine/routines/emptyallsrambanks.asm"
|
||||||
|
INCLUDE "engine/routines/savemenu_copytilemapatonce.asm"
|
||||||
SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45)
|
INCLUDE "engine/routines/checksave.asm"
|
||||||
ld a, [hCGB]
|
|
||||||
and a
|
|
||||||
jp z, WaitBGMap
|
|
||||||
|
|
||||||
; The following is a modified version of CopyTilemapAtOnce.
|
|
||||||
ld a, [hBGMapMode]
|
|
||||||
push af
|
|
||||||
xor a
|
|
||||||
ld [hBGMapMode], a
|
|
||||||
ld a, [hMapAnims]
|
|
||||||
push af
|
|
||||||
xor a
|
|
||||||
ld [hMapAnims], a
|
|
||||||
.WaitLY:
|
|
||||||
ld a, [rLY]
|
|
||||||
cp $60
|
|
||||||
jr c, .WaitLY
|
|
||||||
|
|
||||||
di
|
|
||||||
ld a, BANK(VBGMap2)
|
|
||||||
ld [rVBK], a
|
|
||||||
hlcoord 0, 0, AttrMap
|
|
||||||
call .CopyTilemapAtOnce
|
|
||||||
ld a, BANK(VBGMap0)
|
|
||||||
ld [rVBK], a
|
|
||||||
hlcoord 0, 0
|
|
||||||
call .CopyTilemapAtOnce
|
|
||||||
.WaitLY2:
|
|
||||||
ld a, [rLY]
|
|
||||||
cp $60
|
|
||||||
jr c, .WaitLY2
|
|
||||||
ei
|
|
||||||
|
|
||||||
pop af
|
|
||||||
ld [hMapAnims], a
|
|
||||||
pop af
|
|
||||||
ld [hBGMapMode], a
|
|
||||||
ret
|
|
||||||
|
|
||||||
.CopyTilemapAtOnce: ; 4cf80 (13:4f80)
|
|
||||||
ld [hSPBuffer], sp ; $ffd9
|
|
||||||
ld sp, hl
|
|
||||||
ld a, [hBGMapAddress + 1]
|
|
||||||
ld h, a
|
|
||||||
ld l, 0
|
|
||||||
ld a, SCREEN_HEIGHT
|
|
||||||
ld [hTilesPerCycle], a
|
|
||||||
ld b, 1 << 1
|
|
||||||
ld c, rSTAT % $100
|
|
||||||
|
|
||||||
.loop
|
|
||||||
rept SCREEN_WIDTH / 2
|
|
||||||
pop de
|
|
||||||
.loop\@
|
|
||||||
ld a, [$ff00+c]
|
|
||||||
and b
|
|
||||||
jr nz, .loop\@
|
|
||||||
ld [hl], e
|
|
||||||
inc l
|
|
||||||
ld [hl], d
|
|
||||||
inc l
|
|
||||||
endr
|
|
||||||
|
|
||||||
ld de, BG_MAP_WIDTH - SCREEN_WIDTH
|
|
||||||
add hl, de
|
|
||||||
ld a, [hTilesPerCycle]
|
|
||||||
dec a
|
|
||||||
ld [hTilesPerCycle], a
|
|
||||||
jr nz, .loop
|
|
||||||
|
|
||||||
ld a, [hSPBuffer]
|
|
||||||
ld l, a
|
|
||||||
ld a, [hSPBuffer + 1]
|
|
||||||
ld h, a
|
|
||||||
ld sp, hl
|
|
||||||
ret
|
|
||||||
|
|
||||||
CheckSave:: ; 4cffe
|
|
||||||
ld a, BANK(sCheckValue1) ; BANK(sCheckValue2)
|
|
||||||
call GetSRAMBank
|
|
||||||
ld a, [sCheckValue1]
|
|
||||||
ld b, a
|
|
||||||
ld a, [sCheckValue2]
|
|
||||||
ld c, a
|
|
||||||
call CloseSRAM
|
|
||||||
ld a, b
|
|
||||||
cp SAVE_CHECK_VALUE_1
|
|
||||||
jr nz, .ok
|
|
||||||
ld a, c
|
|
||||||
cp SAVE_CHECK_VALUE_2
|
|
||||||
jr nz, .ok
|
|
||||||
ld c, $1
|
|
||||||
ret
|
|
||||||
|
|
||||||
.ok
|
|
||||||
ld c, $0
|
|
||||||
ret
|
|
||||||
|
|
||||||
INCLUDE "data/maps/map_scenes.asm"
|
INCLUDE "data/maps/map_scenes.asm"
|
||||||
|
INCLUDE "engine/routines/loadmappart.asm"
|
||||||
_LoadMapPart:: ; 4d15b
|
INCLUDE "engine/routines/phonering_copytilemapatonce.asm"
|
||||||
ld hl, wMisc
|
|
||||||
ld a, [wMetatileStandingY]
|
|
||||||
and a
|
|
||||||
jr z, .top_row
|
|
||||||
ld bc, WMISC_WIDTH * 2
|
|
||||||
add hl, bc
|
|
||||||
|
|
||||||
.top_row
|
|
||||||
ld a, [wMetatileStandingX]
|
|
||||||
and a
|
|
||||||
jr z, .left_column
|
|
||||||
inc hl
|
|
||||||
inc hl
|
|
||||||
|
|
||||||
.left_column
|
|
||||||
decoord 0, 0
|
|
||||||
ld b, SCREEN_HEIGHT
|
|
||||||
.loop
|
|
||||||
ld c, SCREEN_WIDTH
|
|
||||||
.loop2
|
|
||||||
ld a, [hli]
|
|
||||||
ld [de], a
|
|
||||||
inc de
|
|
||||||
dec c
|
|
||||||
jr nz, .loop2
|
|
||||||
ld a, l
|
|
||||||
add 4
|
|
||||||
ld l, a
|
|
||||||
jr nc, .carry
|
|
||||||
inc h
|
|
||||||
|
|
||||||
.carry
|
|
||||||
dec b
|
|
||||||
jr nz, .loop
|
|
||||||
ret
|
|
||||||
|
|
||||||
PhoneRing_CopyTilemapAtOnce: ; 4d188
|
|
||||||
ld a, [hCGB]
|
|
||||||
and a
|
|
||||||
jp z, WaitBGMap
|
|
||||||
ld a, [wSpriteUpdatesEnabled]
|
|
||||||
cp $0
|
|
||||||
jp z, WaitBGMap
|
|
||||||
|
|
||||||
; What follows is a modified version of CopyTilemapAtOnce.
|
|
||||||
ld a, [hBGMapMode]
|
|
||||||
push af
|
|
||||||
xor a
|
|
||||||
ld [hBGMapMode], a
|
|
||||||
ld a, [hMapAnims]
|
|
||||||
push af
|
|
||||||
xor a
|
|
||||||
ld [hMapAnims], a
|
|
||||||
.wait
|
|
||||||
ld a, [rLY]
|
|
||||||
cp $8f
|
|
||||||
jr c, .wait
|
|
||||||
|
|
||||||
di
|
|
||||||
ld a, BANK(VBGMap2)
|
|
||||||
ld [rVBK], a
|
|
||||||
hlcoord 0, 0, AttrMap
|
|
||||||
call .CopyTilemapAtOnce
|
|
||||||
ld a, BANK(VBGMap0)
|
|
||||||
ld [rVBK], a
|
|
||||||
hlcoord 0, 0
|
|
||||||
call .CopyTilemapAtOnce
|
|
||||||
.wait2
|
|
||||||
ld a, [rLY]
|
|
||||||
cp $8f
|
|
||||||
jr c, .wait2
|
|
||||||
ei
|
|
||||||
|
|
||||||
pop af
|
|
||||||
ld [hMapAnims], a
|
|
||||||
pop af
|
|
||||||
ld [hBGMapMode], a
|
|
||||||
ret
|
|
||||||
|
|
||||||
.CopyTilemapAtOnce: ; 4d1cb
|
|
||||||
ld [hSPBuffer], sp
|
|
||||||
ld sp, hl
|
|
||||||
ld a, [hBGMapAddress + 1]
|
|
||||||
ld h, a
|
|
||||||
ld l, 0
|
|
||||||
ld a, SCREEN_HEIGHT
|
|
||||||
ld [hTilesPerCycle], a
|
|
||||||
ld b, 1 << 1 ; not in v/hblank
|
|
||||||
ld c, rSTAT % $100
|
|
||||||
|
|
||||||
.loop
|
|
||||||
rept SCREEN_WIDTH / 2
|
|
||||||
pop de
|
|
||||||
.loop\@
|
|
||||||
ld a, [$ff00+c]
|
|
||||||
and b
|
|
||||||
jr nz, .loop\@
|
|
||||||
ld [hl], e
|
|
||||||
inc l
|
|
||||||
ld [hl], d
|
|
||||||
inc l
|
|
||||||
endr
|
|
||||||
|
|
||||||
ld de, BG_MAP_WIDTH - SCREEN_WIDTH
|
|
||||||
add hl, de
|
|
||||||
ld a, [hTilesPerCycle]
|
|
||||||
dec a
|
|
||||||
ld [hTilesPerCycle], a
|
|
||||||
jr nz, .loop
|
|
||||||
|
|
||||||
ld a, [hSPBuffer]
|
|
||||||
ld l, a
|
|
||||||
ld a, [hSPBuffer + 1]
|
|
||||||
ld h, a
|
|
||||||
ld sp, hl
|
|
||||||
ret
|
|
||||||
|
|
||||||
Shrink1Pic: ; 4d249
|
Shrink1Pic: ; 4d249
|
||||||
INCBIN "gfx/shrink/shrink1.2bpp.lz"
|
INCBIN "gfx/shrink/shrink1.2bpp.lz"
|
||||||
@ -534,129 +223,12 @@ INCBIN "gfx/shrink/shrink1.2bpp.lz"
|
|||||||
Shrink2Pic: ; 4d2d9
|
Shrink2Pic: ; 4d2d9
|
||||||
INCBIN "gfx/shrink/shrink2.2bpp.lz"
|
INCBIN "gfx/shrink/shrink2.2bpp.lz"
|
||||||
|
|
||||||
LinkMonStatsScreen: ; 4d319
|
INCLUDE "engine/link_2.asm"
|
||||||
ld a, [wMenuCursorY]
|
|
||||||
dec a
|
|
||||||
ld [CurPartyMon], a
|
|
||||||
call LowVolume
|
|
||||||
predef StatsScreenInit
|
|
||||||
ld a, [CurPartyMon]
|
|
||||||
inc a
|
|
||||||
ld [wMenuCursorY], a
|
|
||||||
call ClearScreen
|
|
||||||
call ClearBGPalettes
|
|
||||||
call MaxVolume
|
|
||||||
farcall LoadTradeScreenBorder
|
|
||||||
farcall Link_WaitBGMap
|
|
||||||
farcall InitTradeSpeciesList
|
|
||||||
farcall SetTradeRoomBGPals
|
|
||||||
call WaitBGMap2
|
|
||||||
ret
|
|
||||||
|
|
||||||
Link_WaitBGMap: ; 4d354
|
|
||||||
call WaitBGMap
|
|
||||||
call WaitBGMap2
|
|
||||||
ret
|
|
||||||
|
|
||||||
LinkTextbox2: ; 4d35b
|
|
||||||
ld h, d
|
|
||||||
ld l, e
|
|
||||||
push bc
|
|
||||||
push hl
|
|
||||||
call .PlaceBorder
|
|
||||||
pop hl
|
|
||||||
pop bc
|
|
||||||
ld de, AttrMap - TileMap
|
|
||||||
add hl, de
|
|
||||||
inc b
|
|
||||||
inc b
|
|
||||||
inc c
|
|
||||||
inc c
|
|
||||||
ld a, $7
|
|
||||||
.row
|
|
||||||
push bc
|
|
||||||
push hl
|
|
||||||
.col
|
|
||||||
ld [hli], a
|
|
||||||
dec c
|
|
||||||
jr nz, .col
|
|
||||||
pop hl
|
|
||||||
ld de, SCREEN_WIDTH
|
|
||||||
add hl, de
|
|
||||||
pop bc
|
|
||||||
dec b
|
|
||||||
jr nz, .row
|
|
||||||
ret
|
|
||||||
|
|
||||||
.PlaceBorder: ; 4d37e
|
|
||||||
push hl
|
|
||||||
ld a, $76
|
|
||||||
ld [hli], a
|
|
||||||
inc a
|
|
||||||
call .PlaceRow
|
|
||||||
inc a
|
|
||||||
ld [hl], a
|
|
||||||
pop hl
|
|
||||||
ld de, SCREEN_WIDTH
|
|
||||||
add hl, de
|
|
||||||
.loop
|
|
||||||
push hl
|
|
||||||
ld a, "┌"
|
|
||||||
ld [hli], a
|
|
||||||
ld a, " "
|
|
||||||
call .PlaceRow
|
|
||||||
ld [hl], "─"
|
|
||||||
pop hl
|
|
||||||
ld de, SCREEN_WIDTH
|
|
||||||
add hl, de
|
|
||||||
dec b
|
|
||||||
jr nz, .loop
|
|
||||||
ld a, "┐"
|
|
||||||
ld [hli], a
|
|
||||||
ld a, "│"
|
|
||||||
call .PlaceRow
|
|
||||||
ld [hl], "└"
|
|
||||||
ret
|
|
||||||
|
|
||||||
.PlaceRow: ; 4d3ab
|
|
||||||
ld d, c
|
|
||||||
.row_loop
|
|
||||||
ld [hli], a
|
|
||||||
dec d
|
|
||||||
jr nz, .row_loop
|
|
||||||
ret
|
|
||||||
|
|
||||||
INCLUDE "engine/delete_save_change_clock.asm"
|
INCLUDE "engine/delete_save_change_clock.asm"
|
||||||
INCLUDE "tilesets/tileset_headers.asm"
|
INCLUDE "tilesets/tileset_headers.asm"
|
||||||
INCLUDE "engine/flag_predef.asm"
|
INCLUDE "engine/routines/flagpredef.asm"
|
||||||
INCLUDE "engine/trademon_frontpic.asm"
|
INCLUDE "engine/routines/trademonfrontpic.asm"
|
||||||
|
INCLUDE "engine/routines/checkpokerus.asm"
|
||||||
CheckPokerus: ; 4d860
|
|
||||||
; Return carry if a monster in your party has Pokerus
|
|
||||||
|
|
||||||
; Get number of monsters to iterate over
|
|
||||||
ld a, [PartyCount]
|
|
||||||
and a
|
|
||||||
jr z, .NoPokerus
|
|
||||||
ld b, a
|
|
||||||
; Check each monster in the party for Pokerus
|
|
||||||
ld hl, PartyMon1PokerusStatus
|
|
||||||
ld de, PARTYMON_STRUCT_LENGTH
|
|
||||||
.Check:
|
|
||||||
ld a, [hl]
|
|
||||||
and $0f ; only the bottom nybble is used
|
|
||||||
jr nz, .HasPokerus
|
|
||||||
; Next PartyMon
|
|
||||||
add hl, de
|
|
||||||
dec b
|
|
||||||
jr nz, .Check
|
|
||||||
.NoPokerus:
|
|
||||||
and a
|
|
||||||
ret
|
|
||||||
.HasPokerus:
|
|
||||||
scf
|
|
||||||
ret
|
|
||||||
|
|
||||||
INCLUDE "event/lucky_number.asm"
|
INCLUDE "event/lucky_number.asm"
|
||||||
INCLUDE "engine/caught_data.asm"
|
INCLUDE "engine/caught_data.asm"
|
||||||
INCLUDE "engine/search2.asm"
|
INCLUDE "engine/search2.asm"
|
||||||
@ -667,7 +239,7 @@ INCLUDE "engine/init_hof_credits.asm"
|
|||||||
INCLUDE "mobile/get_trainer_class.asm"
|
INCLUDE "mobile/get_trainer_class.asm"
|
||||||
INCLUDE "battle/sliding_intro.asm"
|
INCLUDE "battle/sliding_intro.asm"
|
||||||
INCLUDE "mobile/print_opp_message.asm"
|
INCLUDE "mobile/print_opp_message.asm"
|
||||||
INCLUDE "engine/check_battle_scene.asm"
|
INCLUDE "engine/routines/checkbattlescene.asm"
|
||||||
INCLUDE "engine/gbc_only.asm"
|
INCLUDE "engine/gbc_only.asm"
|
||||||
INCLUDE "event/poke_seer.asm"
|
INCLUDE "event/poke_seer.asm"
|
||||||
|
|
||||||
@ -685,9 +257,9 @@ INCLUDE "engine/tempmon.asm"
|
|||||||
INCLUDE "text/types.asm"
|
INCLUDE "text/types.asm"
|
||||||
INCLUDE "text/unused_gen_1_trainers.asm"
|
INCLUDE "text/unused_gen_1_trainers.asm"
|
||||||
INCLUDE "engine/mon_stats.asm"
|
INCLUDE "engine/mon_stats.asm"
|
||||||
INCLUDE "engine/init_list.asm"
|
INCLUDE "engine/routines/initlist.asm"
|
||||||
INCLUDE "engine/experience.asm"
|
INCLUDE "engine/experience.asm"
|
||||||
INCLUDE "engine/switch_party_mons.asm"
|
INCLUDE "engine/routines/switchpartymons.asm"
|
||||||
INCLUDE "gfx/load_pics.asm"
|
INCLUDE "gfx/load_pics.asm"
|
||||||
INCLUDE "engine/move_mon_wo_mail.asm"
|
INCLUDE "engine/move_mon_wo_mail.asm"
|
||||||
INCLUDE "data/pokemon/base_stats.asm"
|
INCLUDE "data/pokemon/base_stats.asm"
|
||||||
@ -751,11 +323,7 @@ INCLUDE "engine/timeofdaypals.asm"
|
|||||||
INCLUDE "engine/battle_transition.asm"
|
INCLUDE "engine/battle_transition.asm"
|
||||||
INCLUDE "event/field_moves.asm"
|
INCLUDE "event/field_moves.asm"
|
||||||
INCLUDE "event/magnet_train.asm"
|
INCLUDE "event/magnet_train.asm"
|
||||||
|
INCLUDE "engine/routines/battlestart_copytilemapatonce.asm"
|
||||||
BattleStart_CopyTilemapAtOnce: ; 8cf4f
|
|
||||||
call CGBOnly_CopyTilemapAtOnce
|
|
||||||
ret
|
|
||||||
|
|
||||||
INCLUDE "engine/sprites.asm"
|
INCLUDE "engine/sprites.asm"
|
||||||
INCLUDE "engine/mon_icons.asm"
|
INCLUDE "engine/mon_icons.asm"
|
||||||
|
|
||||||
@ -897,8 +465,8 @@ SECTION "bank3E", ROMX
|
|||||||
INCLUDE "gfx/font.asm"
|
INCLUDE "gfx/font.asm"
|
||||||
INCLUDE "engine/time_capsule.asm"
|
INCLUDE "engine/time_capsule.asm"
|
||||||
INCLUDE "event/name_rater.asm"
|
INCLUDE "event/name_rater.asm"
|
||||||
INCLUDE "engine/play_slow_cry.asm"
|
INCLUDE "engine/routines/playslowcry.asm"
|
||||||
INCLUDE "engine/new_pokedex_entry.asm"
|
INCLUDE "engine/routines/newpokedexentry.asm"
|
||||||
INCLUDE "engine/time_capsule_2.asm"
|
INCLUDE "engine/time_capsule_2.asm"
|
||||||
INCLUDE "engine/unown_dex.asm"
|
INCLUDE "engine/unown_dex.asm"
|
||||||
INCLUDE "event/magikarp.asm"
|
INCLUDE "event/magikarp.asm"
|
||||||
@ -973,15 +541,7 @@ INCLUDE "text/phone/extra2.asm"
|
|||||||
|
|
||||||
SECTION "bank5E", ROMX
|
SECTION "bank5E", ROMX
|
||||||
|
|
||||||
_UpdateBattleHUDs:
|
INCLUDE "engine/routines/updatebattlehuds.asm"
|
||||||
farcall DrawPlayerHUD
|
|
||||||
ld hl, PlayerHPPal
|
|
||||||
call SetHPPal
|
|
||||||
farcall DrawEnemyHUD
|
|
||||||
ld hl, EnemyHPPal
|
|
||||||
call SetHPPal
|
|
||||||
farcall FinishBattleAnim
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
SECTION "mobile_5e", ROMX
|
SECTION "mobile_5e", ROMX
|
||||||
@ -1036,11 +596,15 @@ INCLUDE "engine/print_party.asm"
|
|||||||
|
|
||||||
SECTION "bank77_2", ROMX
|
SECTION "bank77_2", ROMX
|
||||||
|
|
||||||
INCLUDE "engine/printhoursmins.asm"
|
INCLUDE "engine/routines/printhoursmins.asm"
|
||||||
INCLUDE "engine/diploma.asm"
|
INCLUDE "engine/diploma.asm"
|
||||||
INCLUDE "engine/pokedex_3.asm"
|
INCLUDE "engine/pokedex_3.asm"
|
||||||
INCLUDE "event/catch_tutorial_input.asm"
|
INCLUDE "event/catch_tutorial_input.asm"
|
||||||
INCLUDE "engine/pokegear_2.asm"
|
INCLUDE "engine/routines/townmap_convertlinebreakcharacters.asm"
|
||||||
|
|
||||||
|
PokegearGFX: ; 1de2e4
|
||||||
|
INCBIN "gfx/pokegear/pokegear.2bpp.lz"
|
||||||
|
|
||||||
INCLUDE "engine/european_mail.asm"
|
INCLUDE "engine/european_mail.asm"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user