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]
cp $ff
jr nz, .is_pokemon
ld hl, .PokedexQuestionMarkPalette
ld hl, PokedexQuestionMarkPalette
call LoadHLPaletteIntoDE ; green question mark palette
jr .got_palette
@ -275,7 +275,7 @@ _CGB_Pokedex:
ld a, $1 ; green question mark palette
call FillBoxCGB
call InitPartyMenuOBPals
ld hl, .PokedexCursorPalette
ld hl, PokedexCursorPalette
ld de, wOBPals1 palette 7 ; green cursor palette
ld bc, 1 palettes
ld a, BANK(wOBPals1)
@ -286,10 +286,10 @@ _CGB_Pokedex:
ldh [hCGBPalUpdate], a
ret
.PokedexQuestionMarkPalette:
PokedexQuestionMarkPalette:
INCLUDE "gfx/pokedex/question_mark.pal"
.PokedexCursorPalette:
PokedexCursorPalette:
INCLUDE "gfx/pokedex/cursor.pal"
_CGB_BillsPC:
@ -300,15 +300,15 @@ _CGB_BillsPC:
ld a, [wCurPartySpecies]
cp $ff
jr nz, .GetMonPalette
ld hl, .BillsPCOrangePalette
ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE
jr .Resume
jr .GotPalette
.GetMonPalette:
ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
.Resume:
.GotPalette:
call WipeAttrmap
hlcoord 1, 4, wAttrmap
lb bc, 7, 7
@ -321,16 +321,16 @@ _CGB_BillsPC:
ldh [hCGBPalUpdate], a
ret
.Function9009:
ld hl, .BillsPCOrangePalette
Function9009:
ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE
jr .asm_901a
jr .GotPalette
.unused
.GetMonPalette:
ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
.asm_901a
.GotPalette:
call WipeAttrmap
hlcoord 1, 1, wAttrmap
lb bc, 7, 7
@ -343,7 +343,7 @@ _CGB_BillsPC:
ldh [hCGBPalUpdate], a
ret
.BillsPCOrangePalette:
BillsPCOrangePalette:
INCLUDE "gfx/pc/orange.pal"
_CGB_PokedexUnownMode:
@ -886,10 +886,10 @@ _CGB_GamefreakLogo:
ld a, PREDEFPAL_GAMEFREAK_LOGO_BG
call GetPredefPal
call LoadHLPaletteIntoDE
ld hl, .Palette
ld hl, .GamefreakLogoOBPalette
ld de, wOBPals1
call LoadHLPaletteIntoDE
ld hl, .Palette
ld hl, .GamefreakLogoOBPalette
ld de, wOBPals1 palette 1
call LoadHLPaletteIntoDE
call WipeAttrmap
@ -897,7 +897,7 @@ _CGB_GamefreakLogo:
call ApplyPals
ret
.Palette:
.GamefreakLogoOBPalette:
INCLUDE "gfx/splash/logo.pal"
_CGB_PlayerOrMonFrontpicPals:
@ -947,7 +947,7 @@ _CGB_TrainerOrMonFrontpicPals:
ret
_CGB_MysteryGift:
ld hl, .Palettes
ld hl, .MysteryGiftPalettes
ld de, wBGPals1
ld bc, 2 palettes
ld a, BANK(wBGPals1)
@ -977,5 +977,22 @@ _CGB_MysteryGift:
call ApplyAttrmap
ret
.Palettes:
.MysteryGiftPalettes:
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"
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:
ld de, wBGPals1
ld c, 4
@ -992,7 +975,7 @@ PushSGBBorder:
ret
.LoadSGBBorderPointers:
ld hl, SGBBorder
ld hl, SGBBorderGFX
ld de, SGBBorderMap
ret
@ -1198,7 +1181,7 @@ SGBBorderPalettes:
; assumed to come after SGBBorderMap
INCLUDE "gfx/sgb/sgb_border.pal"
SGBBorder:
SGBBorderGFX:
INCBIN "gfx/sgb/sgb_border.2bpp"
HPBarPals:
@ -1237,7 +1220,6 @@ LoadMapPals:
add hl, de
ld e, l
ld d, h
; Switch to palettes WRAM bank
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)

View File

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

View File

@ -344,12 +344,12 @@ GetTrainerPic:
pop af
ldh [rSVBK], a
call WaitBGMap
ld a, $1
ld a, 1
ldh [hBGMapMode], a
ret
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]
push af

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -125,7 +125,7 @@ DisplayDexEntry:
push hl
push de
; 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 e, l
hlcoord 12, 7
@ -151,7 +151,7 @@ DisplayDexEntry:
jr z, .skip_weight
push de
; 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 e, l
hlcoord 11, 9

View File

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