Disassemble load_pics.asm and move_mon_wo_mail.asm in bank $14.

This commit is contained in:
entrpntr
2020-03-25 14:11:25 -04:00
parent 14fb37e810
commit ca12e16b29
158 changed files with 621 additions and 59 deletions

2
.gitignore vendored
View File

@@ -41,6 +41,6 @@ pokesilver.txt
.DS_STORE
# compiled graphics
*.png
*.2bpp
*.lz
*.1bpp

View File

@@ -45,7 +45,7 @@ silver: pokesilver.gbc
clean:
rm -f $(roms) $(gold_obj) $(silver_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym)
find gfx/pics gfx/trainers -name "*.png" -delete
find gfx/pics gfx/trainers \( -name "*.png" -o -name "*.2bpp" \) -delete
$(MAKE) clean -C tools/
compare: $(roms)

View File

@@ -2350,7 +2350,7 @@ BattleAnim_Transform:
anim_call BattleAnim_TargetObj_2Row
anim_sound 0, 0, SFX_PSYBEAM
anim_bgeffect ANIM_BG_WAVE_DEFORM_USER, $0, $1, $0
anim_wait 48
anim_wait 48
anim_transform
anim_incbgeffect ANIM_BG_WAVE_DEFORM_USER
anim_wait 48
@@ -2592,7 +2592,7 @@ BattleAnim_Minimize:
anim_1gfx ANIM_GFX_HIT
anim_call BattleAnim_TargetObj_2Row
anim_bgeffect ANIM_BG_WAVE_DEFORM_USER, $0, $1, $0
anim_wait 48
anim_wait 48
anim_minimizeopp
anim_incbgeffect ANIM_BG_WAVE_DEFORM_USER
anim_wait 48

View File

@@ -74,6 +74,6 @@ PredefPointers::
add_predef CheckTypeMatchup ; $40
add_predef ConvertMon_1to2
add_predef NewPokedexEntry
add_predef FrontpicPredef
add_predef UnusedFrontpicPredef
add_predef UpdateTimePredef
dbw -1, InexplicablyEmptyFunction ; ???

View File

@@ -19,9 +19,9 @@ add_special: MACRO
; Some ROM0 specials have a nonzero bank.
\1Special::
IF _NARG == 1
dba \1
dba \1
ELSE
dbw \2, \1
dbw \2, \1
ENDC
ENDM

432
engine/gfx/load_pics.asm Normal file
View File

@@ -0,0 +1,432 @@
GetUnownLetter:
; Return Unown letter in wUnownLetter based on DVs at hl
; Take the middle 2 bits of each DV and place them in order:
; atk def spd spc
; .ww..xx. .yy..zz.
; atk
ld a, [hl]
and %01100000
sla a
ld b, a
; def
ld a, [hli]
and %00000110
swap a
srl a
or b
ld b, a
; spd
ld a, [hl]
and %01100000
swap a
sla a
or b
ld b, a
; spc
ld a, [hl]
and %00000110
srl a
or b
; Divide by 10 to get 0-25
ldh [hDividend + 3], a
xor a
ldh [hDividend], a
ldh [hDividend + 1], a
ldh [hDividend + 2], a
ld a, $ff / NUM_UNOWN + 1
ldh [hDivisor], a
ld b, 4
call Divide
; Increment to get 1-26
ldh a, [hQuotient + 2]
inc a
ld [wUnownLetter], a
ret
GetMonFrontpic:
call _GetFrontpic
jp Load2bppToSRAM
UnusedFrontpicPredef:
call _GetFrontpic
push hl
farcall StubbedGetFrontpic
pop hl
jp Load2bppToSRAM
_GetFrontpic:
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
and a
ret z
cp NUM_POKEMON + 1
ret z
cp EGG + 1
ret nc
.is_a_pokemon:
push de
call GetBaseData
ld a, [wBasePicSize]
and $f
ld b, a
push bc
ld a, BANK(sDecompressBuffer)
call OpenSRAM
ld hl, PokemonPicPointers
ld a, [wCurPartySpecies]
ld d, BANK(PokemonPicPointers)
cp UNOWN
jr z, .unown
cp EGG
jr nz, .not_egg
ld hl, EggPic
ld a, BANK(EggPic)
jr .ok
.unown:
ld a, [wUnownLetter]
ld d, BANK(UnownPicPointers)
.not_egg:
dec a
ld bc, 6
call AddNTimes
ld a, d
call GetFarByte
call FixPicBank
push af
inc hl
ld a, d
call GetFarHalfword
pop af
.ok:
ld de, sDecompressBuffer
call FarDecompress
pop bc
ld hl, sDecompressScratch
ld de, sDecompressBuffer
call PadFrontpic
pop hl
ret
Load2bppToSRAM:
ld de, sDecompressScratch
ld c, 7 * 7
ldh a, [hROMBank]
ld b, a
call Get2bpp
jp CloseSRAM
GetMonBackpic:
ld a, [wCurPartySpecies]
and a
ret z
cp NUM_POKEMON + 1
ret z
cp EGG + 1
ret nc
.is_a_pokemon:
push de
ld a, BANK(sDecompressBuffer)
call OpenSRAM
ld hl, PokemonPicPointers
ld a, [wCurPartySpecies]
ld d, BANK(PokemonPicPointers)
cp UNOWN
jr nz, .ok
ld a, [wUnownLetter]
ld d, BANK(UnownPicPointers)
.ok:
dec a
ld bc, 6
call AddNTimes
ld bc, 3
add hl, bc
ld a, d
call GetFarByte
call FixPicBank
push af
inc hl
ld a, d
call GetFarByte
push af
inc hl
ld a, d
call GetFarByte
ld h, a
pop af
ld l, a
ld de, sDecompressBuffer
pop af
call FarDecompress
ld hl, sDecompressBuffer
ld c, 6 * 6
call FixBackpicAlignment
pop hl
ld de, sDecompressBuffer
ldh a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM
ret
FixPicBank:
; Precondition: a = defined bank for pic
; Postcondition: a = repaired bank for pic
;
; Pic bank values that will get repaired (and what they'll be repaired to):
; $13 -> $1f
; $14 -> $20
; $1f -> $2e
;
; Otherwise, the repaired bank will match the defined bank.
push hl
push bc
ld b, a
ld hl, .FixPicBankTable
.loop:
ld a, [hli]
cp -1
jr z, .done
inc hl
cp b
jr nz, .loop
dec hl
ld b, [hl]
.done:
ld a, b
pop bc
pop hl
ret
.FixPicBankTable:
db $13, $1f
db $14, $20
db $1f, $2e
db -1
Function150ff:
ld a, c
push de
ld hl, PokemonPicPointers ; UnownPicPointers
dec a
ld bc, 6
call AddNTimes
ld a, BANK(PokemonPicPointers)
call GetFarByte
call FixPicBank
push af
inc hl
ld a, BANK(PokemonPicPointers)
call GetFarHalfword
pop af
pop de
call FarDecompress
ret
GetTrainerPic:
ld a, [wTrainerClass]
and a
ret z
cp NUM_TRAINER_CLASSES
ret nc
ld a, 0
call WaitBGMap
xor a
ldh [hBGMapMode], a
ld a, BANK(sDecompressBuffer)
call OpenSRAM
push de
ld hl, TrainerPicPointers
ld a, [wTrainerClass]
dec a
ld bc, 3
call AddNTimes
ld a, BANK(TrainerPicPointers)
call GetFarByte
call FixPicBank
push af
inc hl
ld a, BANK(TrainerPicPointers)
call GetFarByte
push af
inc hl
ld a, BANK(TrainerPicPointers)
call GetFarByte
ld h, a
pop af
ld l, a
ld de, sDecompressBuffer
pop af
call FarDecompress
pop hl
ld de, sDecompressBuffer
ld c, 7 * 7
ldh a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM
call WaitBGMap
ld a, 1
ldh [hBGMapMode], a
ret
DecompressGet2bpp:
push de
push bc
ld a, BANK(sDecompressBuffer)
call OpenSRAM
ld a, b
ld de, sDecompressBuffer
call FarDecompress
pop bc
ld de, sDecompressBuffer
pop hl
ldh a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM
ret
FixBackpicAlignment:
push de
push bc
ld a, [wBoxAlignment]
and a
jr z, .keep_dims
ld a, c
cp 7 * 7
ld de, 7 * 7 tiles
jr z, .got_dims
cp 6 * 6
ld de, 6 * 6 tiles
jr z, .got_dims
ld de, 5 * 5 tiles
.got_dims
ld a, [hl]
ld b, 0
ld c, 8
.loop
rra
rl b
dec c
jr nz, .loop
ld a, b
ld [hli], a
dec de
ld a, e
or d
jr nz, .got_dims
.keep_dims
pop bc
pop de
ret
PadFrontpic:
; pads frontpic to fill 7x7 box
ld a, b
cp 6
jr z, .six
cp 5
jr z, .five
.seven_loop
ld c, 7 << 4
call LoadOrientedFrontpic
dec b
jr nz, .seven_loop
ret
.six
ld c, 7 << 4
xor a
call .Fill
.six_loop
ld c, (7 - 6) << 4
xor a
call .Fill
ld c, 6 << 4
call LoadOrientedFrontpic
dec b
jr nz, .six_loop
ret
.five
ld c, 7 << 4
xor a
call .Fill
.five_loop
ld c, (7 - 5) << 4
xor a
call .Fill
ld c, 5 << 4
call LoadOrientedFrontpic
dec b
jr nz, .five_loop
ld c, 7 << 4
xor a
call .Fill
ret
.Fill:
rept 4
srl c
endr
.loop:
rept 16
ld [hli], a
endr
dec c
jr nz, .loop
ret
LoadOrientedFrontpic:
ld a, [wBoxAlignment]
and a
jr nz, .x_flip
rept 4
srl c
endr
.left_loop:
rept 16
ld a, [de]
inc de
ld [hli], a
endr
dec c
jr nz, .left_loop
ret
.x_flip:
push bc
.right_loop:
ld a, [de]
inc de
ld b, a
xor a
rept 8
rr b
rla
endr
ld [hli], a
dec c
jr nz, .right_loop
pop bc
ret

View File

@@ -55,7 +55,7 @@ GetVarAction_::
dwb wXCoord, RETVAR_STRBUF2
dwb wYCoord, RETVAR_STRBUF2
dwb wSpecialPhoneCallID, RETVAR_STRBUF2
dwb 0, 0
dwb NULL, RETVAR_STRBUF2
.CountCaughtMons: ; 41cf
; Caught mons.

View File

@@ -406,7 +406,7 @@ AddTempmonToParty: ; da9c (3:5a9c)
ld a, [wFirstUnownSeen]
and a
jr nz, .asm_db43
ld a, [wd11e]
ld a, [wUnownLetter]
ld [wFirstUnownSeen], a
.asm_db43
and a
@@ -604,7 +604,7 @@ SendGetMonIntoFromBox: ; db45 (3:5b45)
ld a, [sBoxCount]
dec a
ld b, a
call Functiondcbc
call RestorePPOfDepositedPokemon
Functiondcb2: ; dcb2 (3:5cb2)
call CloseSRAM
and a
@@ -615,7 +615,7 @@ Functiondcb7: ; dcb7 (3:5cb7)
scf
ret
Functiondcbc: ; dcbc (3:5cbc)
RestorePPOfDepositedPokemon:
ld a, b
ld hl, sBoxMon1Species
ld bc, BOXMON_STRUCT_LENGTH
@@ -947,7 +947,7 @@ SendMonIntoBox: ; de74 (3:5e74)
ld bc, $4
call CopyBytes
ld b, $0
call Functiondcbc
call RestorePPOfDepositedPokemon
call CloseSRAM
scf
ret

View File

@@ -0,0 +1,133 @@
InsertPokemonIntoBox:
ld a, BANK(sBoxCount)
call OpenSRAM
ld hl, sBoxCount
call InsertSpeciesIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wNextBoxOrPartyIndex], a
ld hl, sBoxMonNicknames
ld bc, MON_NAME_LENGTH
ld de, wBufferMonNick
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wNextBoxOrPartyIndex], a
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
ld [wNextBoxOrPartyIndex], a
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
ld de, wBufferMon
call InsertDataIntoBoxOrParty
ld hl, wBufferMonMoves
ld de, wTempMonMoves
ld bc, NUM_MOVES
call CopyBytes
ld hl, wBufferMonPP
ld de, wTempMonPP
ld bc, NUM_MOVES
call CopyBytes
ld a, [wCurPartyMon]
ld b, a
farcall RestorePPOfDepositedPokemon
jp CloseSRAM
InsertPokemonIntoParty:
ld hl, wPartyCount
call InsertSpeciesIntoBoxOrParty
ld a, [wPartyCount]
dec a
ld [wNextBoxOrPartyIndex], a
ld hl, wPartyMonNicknames
ld bc, MON_NAME_LENGTH
ld de, wBufferMonNick
call InsertDataIntoBoxOrParty
ld a, [wPartyCount]
dec a
ld [wNextBoxOrPartyIndex], a
ld hl, wPartyMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
call InsertDataIntoBoxOrParty
ld a, [wPartyCount]
dec a
ld [wNextBoxOrPartyIndex], a
ld hl, wPartyMons
ld bc, PARTYMON_STRUCT_LENGTH
ld de, wBufferMon
call InsertDataIntoBoxOrParty
ret
InsertSpeciesIntoBoxOrParty:
inc [hl]
inc hl
ld a, [wCurPartyMon]
ld c, a
ld b, 0
add hl, bc
ld a, [wCurPartySpecies]
ld c, a
.loop
ld a, [hl]
ld [hl], c
inc hl
inc c
ld c, a
jr nz, .loop
ret
InsertDataIntoBoxOrParty:
push de
push hl
push bc
ld a, [wNextBoxOrPartyIndex]
dec a
call AddNTimes
push hl
add hl, bc
ld d, h
ld e, l
pop hl
.loop
push bc
ld a, [wNextBoxOrPartyIndex]
ld b, a
ld a, [wCurPartyMon]
cp b
pop bc
jr z, .insert
push hl
push de
push bc
call CopyBytes
pop bc
pop de
pop hl
push hl
ld a, l
sub c
ld l, a
ld a, h
sbc b
ld h, a
pop de
ld a, [wNextBoxOrPartyIndex]
dec a
ld [wNextBoxOrPartyIndex], a
jr .loop
.insert
pop bc
pop hl
ld a, [wCurPartyMon]
call AddNTimes
ld d, h
ld e, l
pop hl
call CopyBytes
ret

View File

@@ -17,7 +17,7 @@ _SwapTextboxPalettes::
ld h, a
ld a, [hl]
and $f
bit 3, a
bit 3, a
jr z, .next
jr .asm_8038
@@ -31,8 +31,8 @@ _SwapTextboxPalettes::
ld a, [hl]
swap a
and $f
bit 3, a
jr z, .next
bit 3, a
jr z, .next
.asm_8038
ld a, [wMapGroup]
@@ -73,7 +73,7 @@ _ScrollBGMapPalettes::
ld h, a
ld a, [hl]
and $f
bit 3, a
bit 3, a
jr z, .next
jr .asm_8083

BIN
gfx/intro/copyright.2bpp Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

BIN
gfx/intro/logo_sparkle.2bpp Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

BIN
gfx/intro/logo_star.2bpp Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

BIN
gfx/misc/pack.2bpp Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

BIN
gfx/misc/pack_menu.2bpp Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

1
gfx/namingscreen/ed.1bpp Normal file
View File

@@ -0,0 +1 @@
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More