Harmonize engine/{gfx, items, link, math} with pokegold

This commit is contained in:
Rangi 2020-06-17 10:39:17 -04:00
parent f2550fc3c2
commit 8019db3ea9
13 changed files with 69 additions and 73 deletions

View File

@ -261,7 +261,7 @@ _CGB_Pokedex:
ld a, [wCurPartySpecies] ld a, [wCurPartySpecies]
cp $ff cp $ff
jr nz, .is_pokemon jr nz, .is_pokemon
ld hl, .PokedexQuestionMarkPalette ld hl, PokedexQuestionMarkPalette
call LoadHLPaletteIntoDE ; green question mark palette call LoadHLPaletteIntoDE ; green question mark palette
jr .got_palette jr .got_palette
@ -275,7 +275,7 @@ _CGB_Pokedex:
ld a, $1 ; green question mark palette ld a, $1 ; green question mark palette
call FillBoxCGB call FillBoxCGB
call InitPartyMenuOBPals call InitPartyMenuOBPals
ld hl, .PokedexCursorPalette ld hl, PokedexCursorPalette
ld de, wOBPals1 palette 7 ; green cursor palette ld de, wOBPals1 palette 7 ; green cursor palette
ld bc, 1 palettes ld bc, 1 palettes
ld a, BANK(wOBPals1) ld a, BANK(wOBPals1)
@ -286,10 +286,10 @@ _CGB_Pokedex:
ldh [hCGBPalUpdate], a ldh [hCGBPalUpdate], a
ret ret
.PokedexQuestionMarkPalette: PokedexQuestionMarkPalette:
INCLUDE "gfx/pokedex/question_mark.pal" INCLUDE "gfx/pokedex/question_mark.pal"
.PokedexCursorPalette: PokedexCursorPalette:
INCLUDE "gfx/pokedex/cursor.pal" INCLUDE "gfx/pokedex/cursor.pal"
_CGB_BillsPC: _CGB_BillsPC:
@ -300,15 +300,15 @@ _CGB_BillsPC:
ld a, [wCurPartySpecies] ld a, [wCurPartySpecies]
cp $ff cp $ff
jr nz, .GetMonPalette jr nz, .GetMonPalette
ld hl, .BillsPCOrangePalette ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE call LoadHLPaletteIntoDE
jr .Resume jr .GotPalette
.GetMonPalette: .GetMonPalette:
ld bc, wTempMonDVs ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black call LoadPalette_White_Col1_Col2_Black
.Resume: .GotPalette:
call WipeAttrmap call WipeAttrmap
hlcoord 1, 4, wAttrmap hlcoord 1, 4, wAttrmap
lb bc, 7, 7 lb bc, 7, 7
@ -321,16 +321,16 @@ _CGB_BillsPC:
ldh [hCGBPalUpdate], a ldh [hCGBPalUpdate], a
ret ret
.Function9009: Function9009:
ld hl, .BillsPCOrangePalette ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE call LoadHLPaletteIntoDE
jr .asm_901a jr .GotPalette
.unused .GetMonPalette:
ld bc, wTempMonDVs ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black call LoadPalette_White_Col1_Col2_Black
.asm_901a .GotPalette:
call WipeAttrmap call WipeAttrmap
hlcoord 1, 1, wAttrmap hlcoord 1, 1, wAttrmap
lb bc, 7, 7 lb bc, 7, 7
@ -343,7 +343,7 @@ _CGB_BillsPC:
ldh [hCGBPalUpdate], a ldh [hCGBPalUpdate], a
ret ret
.BillsPCOrangePalette: BillsPCOrangePalette:
INCLUDE "gfx/pc/orange.pal" INCLUDE "gfx/pc/orange.pal"
_CGB_PokedexUnownMode: _CGB_PokedexUnownMode:
@ -886,10 +886,10 @@ _CGB_GamefreakLogo:
ld a, PREDEFPAL_GAMEFREAK_LOGO_BG ld a, PREDEFPAL_GAMEFREAK_LOGO_BG
call GetPredefPal call GetPredefPal
call LoadHLPaletteIntoDE call LoadHLPaletteIntoDE
ld hl, .Palette ld hl, .GamefreakLogoOBPalette
ld de, wOBPals1 ld de, wOBPals1
call LoadHLPaletteIntoDE call LoadHLPaletteIntoDE
ld hl, .Palette ld hl, .GamefreakLogoOBPalette
ld de, wOBPals1 palette 1 ld de, wOBPals1 palette 1
call LoadHLPaletteIntoDE call LoadHLPaletteIntoDE
call WipeAttrmap call WipeAttrmap
@ -897,7 +897,7 @@ _CGB_GamefreakLogo:
call ApplyPals call ApplyPals
ret ret
.Palette: .GamefreakLogoOBPalette:
INCLUDE "gfx/splash/logo.pal" INCLUDE "gfx/splash/logo.pal"
_CGB_PlayerOrMonFrontpicPals: _CGB_PlayerOrMonFrontpicPals:
@ -947,7 +947,7 @@ _CGB_TrainerOrMonFrontpicPals:
ret ret
_CGB_MysteryGift: _CGB_MysteryGift:
ld hl, .Palettes ld hl, .MysteryGiftPalettes
ld de, wBGPals1 ld de, wBGPals1
ld bc, 2 palettes ld bc, 2 palettes
ld a, BANK(wBGPals1) ld a, BANK(wBGPals1)
@ -977,5 +977,22 @@ _CGB_MysteryGift:
call ApplyAttrmap call ApplyAttrmap
ret ret
.Palettes: .MysteryGiftPalettes:
INCLUDE "gfx/mystery_gift/mystery_gift.pal" INCLUDE "gfx/mystery_gift/mystery_gift.pal"
Unreferenced_GS_CGB_MysteryGift:
ld hl, .MysteryGiftPalette
ld de, wBGPals1
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrmap
call ApplyAttrmap
ret
.MysteryGiftPalette:
RGB 31, 31, 31
RGB 09, 31, 31
RGB 10, 12, 31
RGB 00, 03, 19

View File

@ -446,23 +446,6 @@ INCLUDE "gfx/mail/mail.pal"
INCLUDE "engine/gfx/cgb_layouts.asm" INCLUDE "engine/gfx/cgb_layouts.asm"
Unreferenced_Function95f0:
ld hl, .Palette
ld de, wBGPals1
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call ApplyPals
call WipeAttrmap
call ApplyAttrmap
ret
.Palette:
RGB 31, 31, 31
RGB 09, 31, 31
RGB 10, 12, 31
RGB 00, 03, 19
CopyFourPalettes: CopyFourPalettes:
ld de, wBGPals1 ld de, wBGPals1
ld c, 4 ld c, 4
@ -992,7 +975,7 @@ PushSGBBorder:
ret ret
.LoadSGBBorderPointers: .LoadSGBBorderPointers:
ld hl, SGBBorder ld hl, SGBBorderGFX
ld de, SGBBorderMap ld de, SGBBorderMap
ret ret
@ -1198,7 +1181,7 @@ SGBBorderPalettes:
; assumed to come after SGBBorderMap ; assumed to come after SGBBorderMap
INCLUDE "gfx/sgb/sgb_border.pal" INCLUDE "gfx/sgb/sgb_border.pal"
SGBBorder: SGBBorderGFX:
INCBIN "gfx/sgb/sgb_border.2bpp" INCBIN "gfx/sgb/sgb_border.2bpp"
HPBarPals: HPBarPals:
@ -1237,7 +1220,6 @@ LoadMapPals:
add hl, de add hl, de
ld e, l ld e, l
ld d, h ld d, h
; Switch to palettes WRAM bank
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals1) ld a, BANK(wBGPals1)

View File

@ -1,22 +1,19 @@
INCLUDE "gfx/font.asm" INCLUDE "gfx/font.asm"
; This and the following two functions are unreferenced. Unused_EnableHDMA:
; Debug, perhaps? db FALSE
Unreferenced_fb434:
db 0
Unreferenced_Functionfb435: Unreferenced_Get1bppOptionalHDMA:
ld a, [Unreferenced_fb434] ld a, [Unused_EnableHDMA]
and a and a
jp nz, Get1bppViaHDMA jp nz, Get1bppViaHDMA
jp Get1bpp jp Get1bpp
Unreferenced_Functionfb43f: Unreferenced_Get2bppOptionalHDMA:
ld a, [Unreferenced_fb434] ld a, [Unused_EnableHDMA]
and a and a
jp nz, Get2bppViaHDMA jp nz, Get2bppViaHDMA
jp Get2bpp jp Get2bpp
; End unreferenced block
_LoadStandardFont:: _LoadStandardFont::
ld de, Font ld de, Font

View File

@ -344,12 +344,12 @@ GetTrainerPic:
pop af pop af
ldh [rSVBK], a ldh [rSVBK], a
call WaitBGMap call WaitBGMap
ld a, $1 ld a, 1
ldh [hBGMapMode], a ldh [hBGMapMode], a
ret ret
DecompressGet2bpp: DecompressGet2bpp:
; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de. ; Decompress lz data from b:hl to wDecompressScratch, then copy it to address de.
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af

View File

@ -41,9 +41,9 @@ LoadMenuMonIcon:
dw Trade_LoadMonIconGFX ; MONICON_TRADE dw Trade_LoadMonIconGFX ; MONICON_TRADE
dw Mobile_InitAnimatedMonIcon ; MONICON_MOBILE1 dw Mobile_InitAnimatedMonIcon ; MONICON_MOBILE1
dw Mobile_InitPartyMenuBGPal71 ; MONICON_MOBILE2 dw Mobile_InitPartyMenuBGPal71 ; MONICON_MOBILE2
dw .GetPartyMenuMonIcon ; MONICON_UNUSED dw Unused_GetPartyMenuMonIcon ; MONICON_UNUSED
.GetPartyMenuMonIcon: Unused_GetPartyMenuMonIcon:
call InitPartyMenuIcon call InitPartyMenuIcon
call .GetPartyMonItemGFX call .GetPartyMonItemGFX
call SetPartyMonIconAnimSpeed call SetPartyMonIconAnimSpeed

View File

@ -66,7 +66,7 @@ DoAnimFrame:
ld hl, SPRITEANIMSTRUCT_YOFFSET ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc add hl, bc
ld [hl], $0 ld [hl], 0
ret ret
.PartyMonSwitch .PartyMonSwitch
@ -269,8 +269,8 @@ DoAnimFrame:
ret ret
.asm_8d3ba .asm_8d3ba
ld a, $1 ld a, 1
ld [wcf64], a ld [wIntroSceneFrameCounter], a
call DeinitializeSprite call DeinitializeSprite
ret ret
@ -844,7 +844,7 @@ DoAnimFrame:
ret ret
.AnonymousJumptable: .AnonymousJumptable:
ld hl, sp+$0 ld hl, sp+0
ld e, [hl] ld e, [hl]
inc hl inc hl
ld d, [hl] ld d, [hl]
@ -853,7 +853,7 @@ DoAnimFrame:
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc add hl, bc
ld l, [hl] ld l, [hl]
ld h, $0 ld h, 0
add hl, hl add hl, hl
add hl, de add hl, de
ld a, [hli] ld a, [hli]

View File

@ -2,7 +2,7 @@ ClearSpriteAnims:
ld hl, wSpriteAnimDict ld hl, wSpriteAnimDict
ld bc, wSpriteAnimsEnd - wSpriteAnimDict ld bc, wSpriteAnimsEnd - wSpriteAnimDict
.loop .loop
ld [hl], $0 ld [hl], 0
inc hl inc hl
dec bc dec bc
ld a, c ld a, c
@ -209,7 +209,7 @@ DeinitializeSprite:
; Clear the index field of the struct in bc. ; Clear the index field of the struct in bc.
ld hl, SPRITEANIMSTRUCT_INDEX ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc add hl, bc
ld [hl], $0 ld [hl], 0
ret ret
DeinitializeAllSprites: DeinitializeAllSprites:
@ -319,7 +319,7 @@ AddOrSubtractY:
bit OAM_Y_FLIP, [hl] bit OAM_Y_FLIP, [hl]
jr z, .ok jr z, .ok
; -8 - a ; -8 - a
add $8 add 8
xor $ff xor $ff
inc a inc a
@ -334,7 +334,7 @@ AddOrSubtractX:
bit OAM_X_FLIP, [hl] bit OAM_X_FLIP, [hl]
jr z, .ok jr z, .ok
; -8 - a ; -8 - a
add $8 add 8
xor $ff xor $ff
inc a inc a

View File

@ -2097,9 +2097,9 @@ XAccuracyEffect:
PokeDollEffect: PokeDollEffect:
ld a, [wBattleMode] ld a, [wBattleMode]
dec a dec a ; WILD_BATTLE?
jr nz, .asm_f4a6 jr nz, .not_wild
inc a inc a ; TRUE
ld [wForcedSwitch], a ld [wForcedSwitch], a
ld a, [wBattleResult] ld a, [wBattleResult]
and BATTLERESULT_BITMASK and BATTLERESULT_BITMASK
@ -2107,7 +2107,7 @@ PokeDollEffect:
ld [wBattleResult], a ld [wBattleResult], a
jp UseItemText jp UseItemText
.asm_f4a6 .not_wild
xor a xor a
ld [wItemEffectSucceeded], a ld [wItemEffectSucceeded], a
ret ret

View File

@ -14,11 +14,11 @@ CanLearnTMHMMove:
and a and a
jr z, .end jr z, .end
cp b cp b
jr z, .asm_11659 jr z, .found
inc c inc c
jr .loop jr .loop
.asm_11659 .found
pop hl pop hl
ld b, CHECK_FLAG ld b, CHECK_FLAG
push de push de

View File

@ -80,7 +80,7 @@ PrepMysteryGiftDataToSend:
.tenpercent .tenpercent
call Random call Random
cp 20 percent - 1 ; 50 cp 20 percent - 1
jr c, .twopercent jr c, .twopercent
call Random call Random
and %011 and %011

View File

@ -117,7 +117,7 @@ PlaceTradePartnerNamesAndParty:
hlcoord 7, 9 hlcoord 7, 9
ld de, wOTPartySpecies ld de, wOTPartySpecies
.PlaceSpeciesNames: .PlaceSpeciesNames:
ld c, $0 ld c, 0
.loop .loop
ld a, [de] ld a, [de]
cp -1 cp -1

View File

@ -125,7 +125,7 @@ DisplayDexEntry:
push hl push hl
push de push de
; Print the height, with two of the four digits in front of the decimal point ; Print the height, with two of the four digits in front of the decimal point
ld hl, sp+$0 ld hl, sp+0
ld d, h ld d, h
ld e, l ld e, l
hlcoord 12, 7 hlcoord 12, 7
@ -151,7 +151,7 @@ DisplayDexEntry:
jr z, .skip_weight jr z, .skip_weight
push de push de
; Print the weight, with four of the five digits in front of the decimal point ; Print the weight, with four of the five digits in front of the decimal point
ld hl, sp+$0 ld hl, sp+0
ld d, h ld d, h
ld e, l ld e, l
hlcoord 11, 9 hlcoord 11, 9

View File

@ -4,7 +4,7 @@ Unreferenced_Function1dd6a9:
ld c, a ld c, a
push bc push bc
push de push de
ld hl, sp+$2 ld hl, sp+2
ld d, h ld d, h
ld e, l ld e, l
pop hl pop hl
@ -30,7 +30,7 @@ PrintHoursMins:
ld b, a ld b, a
; Crazy stuff happening with the stack ; Crazy stuff happening with the stack
push bc push bc
ld hl, sp+$1 ld hl, sp+1
push de push de
push hl push hl
pop de pop de
@ -42,7 +42,7 @@ PrintHoursMins:
inc hl inc hl
ld d, h ld d, h
ld e, l ld e, l
ld hl, sp+$0 ld hl, sp+0
push de push de
push hl push hl
pop de pop de