You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07: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:
@@ -2573,11 +2573,11 @@ WinTrainerBattle: ; 3cfa4
|
||||
.CheckMaxedOutMomMoney: ; 3d0b1
|
||||
ld hl, wMomsMoney + 2
|
||||
ld a, [hld]
|
||||
cp 999999 % $100
|
||||
cp MAX_MONEY % $100
|
||||
ld a, [hld]
|
||||
sbc 999999 / $100 % $100
|
||||
sbc MAX_MONEY / $100 % $100
|
||||
ld a, [hl]
|
||||
sbc 999999 / $10000 % $100
|
||||
sbc MAX_MONEY / $10000 % $100
|
||||
ret
|
||||
; 3d0be
|
||||
|
||||
@@ -2602,17 +2602,17 @@ AddBattleMoneyToAccount: ; 3d0be
|
||||
jr nz, .loop
|
||||
pop hl
|
||||
ld a, [hld]
|
||||
cp 999999 % $100
|
||||
cp MAX_MONEY % $100
|
||||
ld a, [hld]
|
||||
sbc 999999 / $100 % $100
|
||||
sbc MAX_MONEY / $100 % $100
|
||||
ld a, [hl]
|
||||
sbc 999999 / $10000 % $100
|
||||
sbc MAX_MONEY / $10000 % $100
|
||||
ret c
|
||||
ld [hl], 999999 / $10000 % $100
|
||||
ld [hl], MAX_MONEY / $10000 % $100
|
||||
inc hl
|
||||
ld [hl], 999999 / $100 % $100
|
||||
ld [hl], MAX_MONEY / $100 % $100
|
||||
inc hl
|
||||
ld [hl], 999999 % $100
|
||||
ld [hl], MAX_MONEY % $100
|
||||
ret
|
||||
; 3d0ea
|
||||
|
||||
|
@@ -93,6 +93,8 @@ NUM_HOF_TEAMS = 30
|
||||
; significant money values
|
||||
START_MONEY EQU 3000
|
||||
MOM_MONEY EQU 2300
|
||||
MAX_MONEY EQU 999999
|
||||
MAX_COINS EQU 9999
|
||||
|
||||
|
||||
; ChangeHappiness arguments (see data/happiness_changes.asm)
|
||||
|
@@ -1185,14 +1185,14 @@ CardFlip_CheckWinCondition: ; e0637
|
||||
|
||||
.IsCoinCaseFull: ; e0833
|
||||
ld a, [Coins]
|
||||
cp 9999 / $100
|
||||
cp MAX_COINS / $100
|
||||
jr c, .less
|
||||
jr z, .check_low
|
||||
jr .more
|
||||
|
||||
.check_low
|
||||
ld a, [Coins + 1]
|
||||
cp 9999 % $100
|
||||
cp MAX_COINS % $100
|
||||
jr c, .less
|
||||
|
||||
.more
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
_Diploma: ; 1dd702
|
||||
call PlaceDiplomaOnScreen
|
||||
call WaitPressAorB_BlinkCursor
|
||||
|
@@ -3314,5 +3314,3 @@ GetMthMoveOfCurrentMon: ; f969
|
||||
add hl, bc
|
||||
ret
|
||||
; 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
|
||||
|
||||
MaxMoney: ; 15ff7
|
||||
dt 999999
|
||||
dt MAX_MONEY
|
||||
; 15ffa
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ GiveCoins:: ; 1606f
|
||||
; 1608d
|
||||
|
||||
.maxcoins ; 1608d
|
||||
bigdw 9999
|
||||
bigdw MAX_COINS
|
||||
; 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
|
||||
ld a, [TimeOfDay]
|
||||
ld hl, TimeOfDayTable
|
||||
ld hl, .TimeOfDayTable
|
||||
ld de, 2
|
||||
call IsInArray
|
||||
inc hl
|
||||
@@ -11,7 +11,7 @@ CheckTime:: ; c000
|
||||
ld c, a
|
||||
ret
|
||||
|
||||
TimeOfDayTable: ; c012
|
||||
.TimeOfDayTable: ; c012
|
||||
db MORN_F, MORN
|
||||
db DAY_F, DAY
|
||||
db NITE_F, NITE
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user