mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
parent
d3b397fd37
commit
5005ca7bd0
@ -29,7 +29,7 @@
|
||||
const CGB_PLAYER_OR_MON_FRONTPIC_PALS
|
||||
const CGB_TRADE_TUBE
|
||||
const CGB_TRAINER_OR_MON_FRONTPIC_PALS
|
||||
const CGB_1D
|
||||
const CGB_LEVEL_SELECTION_MENU_TOD_CHANGE
|
||||
DEF NUM_CGB_LAYOUTS EQU const_value
|
||||
|
||||
DEF CGB_PARTY_MENU_HP_BARS EQU $fc
|
||||
|
@ -55,7 +55,7 @@ CGBLayoutJumptable:
|
||||
dw _CGB_PlayerOrMonFrontpicPals
|
||||
dw _CGB_TradeTube
|
||||
dw _CGB_TrainerOrMonFrontpicPals
|
||||
dw _CGB_Unused1D
|
||||
dw _CGB_LevelSelectionMenuToDChange
|
||||
assert_table_length NUM_CGB_LAYOUTS
|
||||
|
||||
_CGB_BattleGrayscale:
|
||||
@ -585,7 +585,7 @@ _CGB_LevelSelectionMenu:
|
||||
ld bc, 1 palettes
|
||||
ld a, BANK(wOBPals1)
|
||||
call FarCopyWRAM
|
||||
; load daytime-based ToD symbol pals (pal1)
|
||||
; load daytime-based ToD symbol pals (pal1)
|
||||
ld a, [wTimeOfDay]
|
||||
maskbits NUM_DAYTIMES
|
||||
ld bc, 1 palettes
|
||||
@ -624,6 +624,86 @@ _CGB_LevelSelectionMenu:
|
||||
ldh [hCGBPalUpdate], a
|
||||
ret
|
||||
|
||||
_CGB_LevelSelectionMenuToDChange:
|
||||
; load daytime-based ToD symbol pals (pal1)
|
||||
ld a, [wTimeOfDay]
|
||||
maskbits NUM_DAYTIMES
|
||||
ld bc, 1 palettes
|
||||
ld hl, LevelSelectionMenuTimeOfDaySymbolsPals
|
||||
call AddNTimes
|
||||
ld de, wOBPals1 + 1 palettes
|
||||
ld bc, 1 palettes
|
||||
ld a, BANK(wOBPals1)
|
||||
call FarCopyWRAM
|
||||
|
||||
; load fading background pals
|
||||
ld hl, .PalsOffsets
|
||||
ld a, [wLevelSelectionMenuStartingToD]
|
||||
maskbits NUM_DAYTIMES
|
||||
ld d, a
|
||||
ld a, [wLevelSelectionMenuToDFadeStep]
|
||||
ld e, a
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp d
|
||||
jr nz, .next1
|
||||
inc a ; cp $ff
|
||||
jr z, .done
|
||||
ld a, [hli]
|
||||
cp e
|
||||
jr z, .match
|
||||
jr .next2
|
||||
.next1
|
||||
inc hl
|
||||
.next2
|
||||
inc hl
|
||||
jr .loop
|
||||
|
||||
.match
|
||||
ld e, [hl]
|
||||
ld a, [wPlayerGender]
|
||||
bit PLAYERGENDER_FEMALE_F, a
|
||||
jr z, .male
|
||||
ld hl, LevelSelectionMenuFemalePals
|
||||
jr .got_pals
|
||||
.male
|
||||
ld hl, LevelSelectionMenuMalePals
|
||||
.got_pals
|
||||
ld a, e
|
||||
ld bc, 6 palettes
|
||||
call AddNTimes
|
||||
ld de, wBGPals1
|
||||
ld bc, 6 palettes
|
||||
ld a, BANK(wBGPals1)
|
||||
call FarCopyWRAM
|
||||
|
||||
.done
|
||||
; apply and commit pals
|
||||
call ApplyPals
|
||||
ld a, TRUE
|
||||
ldh [hCGBPalUpdate], a
|
||||
ret
|
||||
|
||||
.PalsOffsets:
|
||||
; wLevelSelectionMenuStartingToD, wLevelSelectionMenuToDFadeStep, offset from LevelSelectionMenu*Pals
|
||||
db MORN_F, 0, 0
|
||||
db DAY_F, 0, 1
|
||||
db NITE_F, 0, 2
|
||||
db EVE_F, 0, 3
|
||||
db MORN_F, 1, 4
|
||||
db MORN_F, 2, 5
|
||||
db MORN_F, 3, 1
|
||||
db DAY_F, 1, 6
|
||||
db DAY_F, 2, 7
|
||||
db DAY_F, 3, 3
|
||||
db EVE_F, 1, 8
|
||||
db EVE_F, 2, 9
|
||||
db EVE_F, 3, 2
|
||||
db NITE_F, 1, 10
|
||||
db NITE_F, 2, 11
|
||||
db NITE_F, 3, 0
|
||||
db $ff
|
||||
|
||||
_CGB_UnownPuzzle:
|
||||
ld hl, FourPals_UnownPuzzle
|
||||
call CopyFourPalettes
|
||||
|
@ -155,9 +155,8 @@ GameMenu_WorldMap:
|
||||
cp CLEARED_LEVEL
|
||||
jr nz, .save_and_return
|
||||
; if CLEARED_LEVEL:
|
||||
; show post-level screen, clear level, unlock levels, advance ToD, request appropriate LSM events
|
||||
; show post-level screen, clear level, unlock levels, request appropriate LSM events
|
||||
farcall ClearedLevelScreen
|
||||
call AdvanceTimeOfDay
|
||||
ld hl, wLevelSelectionMenuEntryEventQueue
|
||||
set LSMEVENT_ANIMATE_TIME_OF_DAY, [hl]
|
||||
ld a, [wLastUnlockedLevelsCount]
|
||||
|
@ -118,6 +118,89 @@ LevelSelectionMenu::
|
||||
call LevelSelectionMenu_DrawStageTrophies
|
||||
call LevelSelectionMenu_RefreshTextboxAttrs
|
||||
|
||||
ld a, [wLevelSelectionMenuEntryEventQueue]
|
||||
bit LSMEVENT_ANIMATE_TIME_OF_DAY, a
|
||||
jp z, .main_loop
|
||||
|
||||
call LevelSelectionMenu_Delay10Frames
|
||||
|
||||
ld bc, SPRITEOAMSTRUCT_LENGTH
|
||||
ld e, 3 * TILE_WIDTH
|
||||
.tod_symbol_upwards_loop
|
||||
farcall PlaySpriteAnimationsAndDelayFrame
|
||||
ld hl, wShadowOAM + $4 * SPRITEOAMSTRUCT_LENGTH + SPRITEOAMSTRUCT_YCOORD
|
||||
dec [hl]
|
||||
add hl, bc
|
||||
dec [hl]
|
||||
add hl, bc
|
||||
dec [hl]
|
||||
add hl, bc
|
||||
dec [hl]
|
||||
dec e
|
||||
jr nz, .tod_symbol_upwards_loop
|
||||
|
||||
ld a, [wTimeOfDay]
|
||||
ld [wLevelSelectionMenuStartingToD], a
|
||||
|
||||
cp NITE_F
|
||||
ld e, -4
|
||||
jr z, .change_tod_symbol
|
||||
cp EVE_F
|
||||
ld e, -2
|
||||
jr z, .change_tod_symbol
|
||||
cp DAY_F
|
||||
ld e, 4
|
||||
jr z, .change_tod_symbol
|
||||
ld e, 2
|
||||
.change_tod_symbol
|
||||
ld hl, wShadowOAM + $4 * SPRITEOAMSTRUCT_LENGTH + SPRITEOAMSTRUCT_TILE_ID
|
||||
ld bc, SPRITEOAMSTRUCT_LENGTH
|
||||
ld d, 2 * 2
|
||||
.change_tod_symbol_loop
|
||||
ld a, [hl]
|
||||
add e
|
||||
ld [hl], a
|
||||
add hl, bc
|
||||
dec d
|
||||
jr nz, .change_tod_symbol_loop
|
||||
|
||||
call AdvanceTimeOfDay
|
||||
|
||||
xor a
|
||||
ld [wLevelSelectionMenuToDFadeStep], a
|
||||
ld b, CGB_LEVEL_SELECTION_MENU_TOD_CHANGE
|
||||
call GetCGBLayout
|
||||
call LevelSelectionMenu_Delay4Frames
|
||||
ld a, 1
|
||||
ld [wLevelSelectionMenuToDFadeStep], a
|
||||
ld b, CGB_LEVEL_SELECTION_MENU_TOD_CHANGE
|
||||
call GetCGBLayout
|
||||
call LevelSelectionMenu_Delay4Frames
|
||||
ld a, 2
|
||||
ld [wLevelSelectionMenuToDFadeStep], a
|
||||
ld b, CGB_LEVEL_SELECTION_MENU_TOD_CHANGE
|
||||
call GetCGBLayout
|
||||
call LevelSelectionMenu_Delay4Frames
|
||||
ld a, 3
|
||||
ld [wLevelSelectionMenuToDFadeStep], a
|
||||
ld b, CGB_LEVEL_SELECTION_MENU_TOD_CHANGE
|
||||
call GetCGBLayout
|
||||
|
||||
ld bc, SPRITEOAMSTRUCT_LENGTH
|
||||
ld e, 3 * TILE_WIDTH
|
||||
.tod_symbol_downwards_loop
|
||||
farcall PlaySpriteAnimationsAndDelayFrame
|
||||
ld hl, wShadowOAM + $4 * SPRITEOAMSTRUCT_LENGTH + SPRITEOAMSTRUCT_YCOORD
|
||||
inc [hl]
|
||||
add hl, bc
|
||||
inc [hl]
|
||||
add hl, bc
|
||||
inc [hl]
|
||||
add hl, bc
|
||||
inc [hl]
|
||||
dec e
|
||||
jr nz, .tod_symbol_downwards_loop
|
||||
|
||||
.main_loop
|
||||
farcall PlaySpriteAnimations
|
||||
call DelayFrame
|
||||
@ -1030,13 +1113,16 @@ LevelSelectionMenu_GetNewPage:
|
||||
ld a, 1
|
||||
ret
|
||||
|
||||
LevelSelectionMenu_Delay4Frames:
|
||||
ld a, 4
|
||||
jr LevelSelectionMenu_Delay10Frames.loop
|
||||
|
||||
LevelSelectionMenu_Delay10Frames:
|
||||
; Delay 10 frames while playing sprite anims
|
||||
ld a, 10
|
||||
.loop
|
||||
push af
|
||||
farcall PlaySpriteAnimations
|
||||
call DelayFrame
|
||||
farcall PlaySpriteAnimationsAndDelayFrame
|
||||
pop af
|
||||
dec a
|
||||
jr nz, .loop
|
||||
|
@ -35,7 +35,7 @@ AdvanceTimeOfDay::
|
||||
.set_days
|
||||
ld [wCurDay], a
|
||||
|
||||
call ClearDailyTimers
|
||||
farcall ClearDailyTimers
|
||||
|
||||
ret
|
||||
|
||||
|
@ -41,14 +41,14 @@ MACRO rgbpals_fade_apply
|
||||
DEF fade_from EQUS \1
|
||||
DEF fade_to EQUS \2
|
||||
assert {fade_from}_len == {fade_to}_len, "fade_from pals and fade_to pals must be same length"
|
||||
for i, \3
|
||||
for i, 0, \3
|
||||
for j, 0, {fade_from}_len, 3
|
||||
DEF rgbch_red = {j} + 0
|
||||
DEF rgbch_green = {j} + 1
|
||||
DEF rgbch_blue = {j} + 2
|
||||
DEF palred_value = {fade_from}_{d:rgbch_red} + ({fade_to}_{d:rgbch_red} - {fade_from}_{d:rgbch_red}) * i / \3
|
||||
DEF palgreen_value = {fade_from}_{d:rgbch_green} + ({fade_to}_{d:rgbch_green} - {fade_from}_{d:rgbch_green}) * i / \3
|
||||
DEF palblue_value = {fade_from}_{d:rgbch_blue} + ({fade_to}_{d:rgbch_blue} - {fade_from}_{d:rgbch_blue}) * i / \3
|
||||
DEF palred_value = {fade_from}_{d:rgbch_red} + ({fade_to}_{d:rgbch_red} - {fade_from}_{d:rgbch_red}) * (i + 1) / (\3 + 1)
|
||||
DEF palgreen_value = {fade_from}_{d:rgbch_green} + ({fade_to}_{d:rgbch_green} - {fade_from}_{d:rgbch_green}) * (i + 1) / (\3 + 1)
|
||||
DEF palblue_value = {fade_from}_{d:rgbch_blue} + ({fade_to}_{d:rgbch_blue} - {fade_from}_{d:rgbch_blue}) * (i + 1) / (\3 + 1)
|
||||
dw palred (palred_value) + palgreen (palgreen_value) + palblue (palblue_value)
|
||||
endr
|
||||
endr
|
||||
|
@ -947,6 +947,8 @@ ENDU
|
||||
|
||||
wDefaultCGBLayout:: db
|
||||
|
||||
UNION
|
||||
|
||||
wPlayerHPPal:: db
|
||||
wEnemyHPPal:: db
|
||||
|
||||
@ -955,6 +957,12 @@ wCurHPPal:: db
|
||||
|
||||
wWhichPartyMonHPPal:: db
|
||||
|
||||
NEXTU
|
||||
wLevelSelectionMenuStartingToD:: db
|
||||
wLevelSelectionMenuToDFadeStep:: db
|
||||
|
||||
ENDU
|
||||
|
||||
wAttrmap::
|
||||
; 20x18 grid of bg tile attributes for 8x8 tiles
|
||||
; read horizontally from the top row
|
||||
|
Loading…
Reference in New Issue
Block a user