You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
main.asm is now under 30k lines
This commit is contained in:
2531
engine/crystal_intro.asm
Executable file
2531
engine/crystal_intro.asm
Executable file
File diff suppressed because it is too large
Load Diff
1517
engine/debug.asm
Executable file
1517
engine/debug.asm
Executable file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,90 @@
|
||||
EngineFlagAction:: ; 80430
|
||||
; Do action b on engine flag de
|
||||
;
|
||||
; b = 0: reset flag
|
||||
; = 1: set flag
|
||||
; > 1: check flag, result in c
|
||||
;
|
||||
; Setting/resetting does not return a result.
|
||||
|
||||
|
||||
; 16-bit flag ids are considered invalid, but it's nice
|
||||
; to know that the infrastructure is there.
|
||||
|
||||
ld a, d
|
||||
cp 0
|
||||
jr z, .ceiling
|
||||
jr c, .read ; cp 0 can't set carry!
|
||||
jr .invalid
|
||||
|
||||
; There are only $a2 engine flags, so
|
||||
; anything beyond that is invalid too.
|
||||
|
||||
.ceiling
|
||||
ld a, e
|
||||
cp NUM_ENGINE_FLAGS
|
||||
jr c, .read
|
||||
|
||||
; Invalid flags are treated as flag 00.
|
||||
|
||||
.invalid
|
||||
xor a
|
||||
ld e, a
|
||||
ld d, a
|
||||
|
||||
; Get this flag's location.
|
||||
|
||||
.read
|
||||
ld hl, EngineFlags
|
||||
; location
|
||||
rept 2
|
||||
add hl, de
|
||||
endr
|
||||
; bit
|
||||
add hl, de
|
||||
|
||||
; location
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
; bit
|
||||
ld c, [hl]
|
||||
|
||||
; What are we doing with this flag?
|
||||
|
||||
ld a, b
|
||||
cp 1
|
||||
jr c, .reset ; b = 0
|
||||
jr z, .set ; b = 1
|
||||
|
||||
; Return the given flag in c.
|
||||
.check
|
||||
ld a, [de]
|
||||
and c
|
||||
ld c, a
|
||||
ret
|
||||
|
||||
; Set the given flag.
|
||||
.set
|
||||
ld a, [de]
|
||||
or c
|
||||
ld [de], a
|
||||
ret
|
||||
|
||||
; Reset the given flag.
|
||||
.reset
|
||||
ld a, c
|
||||
cpl ; AND all bits except the one in question
|
||||
ld c, a
|
||||
ld a, [de]
|
||||
and c
|
||||
ld [de], a
|
||||
ret
|
||||
; 80462
|
||||
|
||||
|
||||
EngineFlags: ; 80462
|
||||
; All locations are in WRAM bank 1.
|
||||
engine_flag: MACRO
|
||||
dwb \1, 1 << \2
|
||||
|
||||
620
engine/npctrade.asm
Executable file
620
engine/npctrade.asm
Executable file
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@ Function5003f: ; 5003f
|
||||
LoadPartyMenuGFX: ; 5004f
|
||||
call LoadFontsBattleExtra
|
||||
callab Function8ad1 ; engine/color.asm
|
||||
callab InefficientlyClear121BytesAtwc300
|
||||
callab ClearSpriteAnims
|
||||
ret
|
||||
; 5005f
|
||||
|
||||
|
||||
1493
engine/printer.asm
Executable file
1493
engine/printer.asm
Executable file
File diff suppressed because it is too large
Load Diff
@@ -2985,8 +2985,8 @@ Script_reloadmappart:: ; 97ae3
|
||||
xor a
|
||||
ld [hBGMapMode], a
|
||||
call OverworldTextModeSwitch
|
||||
call Function2914
|
||||
callba Function104061
|
||||
call GetMovementPermissions
|
||||
callba ReloadMapPart
|
||||
call UpdateSprites
|
||||
ret
|
||||
; 97af6
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1761,7 +1761,7 @@ SetUpMoveScreenBG: ; 13172
|
||||
xor a
|
||||
ld [hBGMapMode], a
|
||||
callba Functionfb571
|
||||
callba InefficientlyClear121BytesAtwc300
|
||||
callba ClearSpriteAnims
|
||||
ld a, [CurPartyMon]
|
||||
ld e, a
|
||||
ld d, $0
|
||||
|
||||
684
engine/time_capsule/conversion.asm
Executable file
684
engine/time_capsule/conversion.asm
Executable file
File diff suppressed because it is too large
Load Diff
150
engine/variables.asm
Executable file
150
engine/variables.asm
Executable file
@@ -0,0 +1,150 @@
|
||||
_GetVarAction:: ; 80648 (20:4648)
|
||||
ld a, c
|
||||
cp NUM_VARS
|
||||
jr c, .valid
|
||||
xor a
|
||||
.valid
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, .VarActionTable
|
||||
rept 3
|
||||
add hl, bc
|
||||
endr
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
ld b, [hl]
|
||||
ld a, b
|
||||
and RETVAR_EXECUTE
|
||||
jr nz, .call
|
||||
ld a, b
|
||||
and RETVAR_ADDR_DE
|
||||
ret nz
|
||||
ld a, [de]
|
||||
jr .loadstringbuffer2
|
||||
|
||||
.call
|
||||
call _de_
|
||||
ret
|
||||
|
||||
.loadstringbuffer2: ; 8066c (20:466c)
|
||||
ld de, StringBuffer2
|
||||
ld [de], a
|
||||
ret
|
||||
; 80671 (20:4671)
|
||||
|
||||
.VarActionTable: ; 80671
|
||||
; $00: copy [de] to StringBuffer2
|
||||
; $40: return address in de
|
||||
; $80: call function
|
||||
dwb StringBuffer2, RETVAR_STRBUF2
|
||||
dwb PartyCount, RETVAR_STRBUF2
|
||||
dwb .BattleResult, RETVAR_EXECUTE
|
||||
dwb BattleType, RETVAR_ADDR_DE
|
||||
dwb TimeOfDay, RETVAR_STRBUF2
|
||||
dwb .CountCaughtMons, RETVAR_EXECUTE
|
||||
dwb .CountSeenMons, RETVAR_EXECUTE
|
||||
dwb .CountBadges, RETVAR_EXECUTE
|
||||
dwb PlayerState, RETVAR_ADDR_DE
|
||||
dwb .PlayerFacing, RETVAR_EXECUTE
|
||||
dwb hHours, RETVAR_STRBUF2
|
||||
dwb .DayOfWeek, RETVAR_EXECUTE
|
||||
dwb MapGroup, RETVAR_STRBUF2
|
||||
dwb MapNumber, RETVAR_STRBUF2
|
||||
dwb .UnownCaught, RETVAR_EXECUTE
|
||||
dwb wPermission, RETVAR_STRBUF2
|
||||
dwb .BoxFreeSpace, RETVAR_EXECUTE
|
||||
dwb wBugContestMinsRemaining, RETVAR_STRBUF2
|
||||
dwb XCoord, RETVAR_STRBUF2
|
||||
dwb YCoord, RETVAR_STRBUF2
|
||||
dwb wSpecialPhoneCallID, RETVAR_STRBUF2
|
||||
dwb wcf64, RETVAR_STRBUF2
|
||||
dwb wKurtApricornQuantity, RETVAR_STRBUF2
|
||||
dwb wCurrentCaller, RETVAR_ADDR_DE
|
||||
dwb wBlueCardBalance, RETVAR_ADDR_DE
|
||||
dwb wBuenasPassword, RETVAR_ADDR_DE
|
||||
dwb wdc58, RETVAR_STRBUF2
|
||||
dwb NULL, RETVAR_STRBUF2
|
||||
; 806c5
|
||||
|
||||
.CountCaughtMons: ; 806c5
|
||||
; Caught mons.
|
||||
ld hl, PokedexCaught
|
||||
ld b, EndPokedexCaught - PokedexCaught
|
||||
call CountSetBits
|
||||
ld a, [wd265]
|
||||
jp .loadstringbuffer2
|
||||
; 806d3
|
||||
|
||||
.CountSeenMons: ; 806d3
|
||||
; Seen mons.
|
||||
ld hl, PokedexSeen
|
||||
ld b, EndPokedexSeen - PokedexSeen
|
||||
call CountSetBits
|
||||
ld a, [wd265]
|
||||
jp .loadstringbuffer2
|
||||
; 806e1
|
||||
|
||||
.CountBadges: ; 806e1
|
||||
; Number of owned badges.
|
||||
ld hl, Badges
|
||||
ld b, 2
|
||||
call CountSetBits
|
||||
ld a, [wd265]
|
||||
jp .loadstringbuffer2
|
||||
; 806ef
|
||||
|
||||
.PlayerFacing: ; 806ef
|
||||
; The direction the player is facing.
|
||||
ld a, [PlayerDirection]
|
||||
and $c
|
||||
rrca
|
||||
rrca
|
||||
jp .loadstringbuffer2
|
||||
; 806f9
|
||||
|
||||
.DayOfWeek: ; 806f9
|
||||
; The day of the week.
|
||||
call GetWeekday
|
||||
jp .loadstringbuffer2
|
||||
; 806ff
|
||||
|
||||
.UnownCaught: ; 806ff
|
||||
; Number of unique Unown caught.
|
||||
call .count
|
||||
ld a, b
|
||||
jp .loadstringbuffer2
|
||||
|
||||
.count
|
||||
ld hl, UnownDex
|
||||
ld b, 0
|
||||
.loop
|
||||
ld a, [hli]
|
||||
and a
|
||||
ret z
|
||||
inc b
|
||||
ld a, b
|
||||
cp 26
|
||||
jr c, .loop
|
||||
ret
|
||||
; 80715
|
||||
|
||||
.BoxFreeSpace: ; 80715
|
||||
; Remaining slots in the current box.
|
||||
ld a, BANK(sBoxCount)
|
||||
call GetSRAMBank
|
||||
ld hl, sBoxCount
|
||||
ld a, MONS_PER_BOX
|
||||
sub [hl]
|
||||
ld b, a
|
||||
call CloseSRAM
|
||||
ld a, b
|
||||
jp .loadstringbuffer2
|
||||
; 80728
|
||||
|
||||
.BattleResult: ; 80728
|
||||
ld a, [wBattleResult]
|
||||
and $3f
|
||||
jp .loadstringbuffer2
|
||||
; 80730
|
||||
Reference in New Issue
Block a user