Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep color specific code for upgrade to rgbds v0.7.0 #27

Merged
merged 5 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions color/data/map_palette_constants.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const_value = 0
const_def
const INTRO_GRAY ; 00: used only when booting up the game
const OUTDOOR_GRAY ; 01
const OUTDOOR_RED ; 02
Expand Down Expand Up @@ -67,7 +67,7 @@ const_value = 0
const MAP_PALETTE_3F ; 3F

; Named to make tileset palette assignments consistent with Pokecrystal
const_value = 0
const_def
const PAL_BG_GRAY ; 00
const PAL_BG_RED ; 01
const PAL_BG_GREEN ; 02
Expand All @@ -78,7 +78,7 @@ const_value = 0
const PAL_BG_TEXT ; 07

; Used when you want a tile to display above the Player and NPCs
const_value = $80
const_def $80
const PAL_BG_PRIORITY_GRAY ; 80
const PAL_BG_PRIORITY_RED ; 81
const PAL_BG_PRIORITY_GREEN ; 82
Expand Down
34 changes: 17 additions & 17 deletions color/sprites.asm
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
; Handles sprite attributes

ATK_PAL_GREY EQU 0
ATK_PAL_BLUE EQU 1
ATK_PAL_RED EQU 2
ATK_PAL_BROWN EQU 3
ATK_PAL_YELLOW EQU 4
ATK_PAL_GREEN EQU 5
ATK_PAL_ICE EQU 6
ATK_PAL_PURPLE EQU 7
DEF ATK_PAL_GREY EQU 0
DEF ATK_PAL_BLUE EQU 1
DEF ATK_PAL_RED EQU 2
DEF ATK_PAL_BROWN EQU 3
DEF ATK_PAL_YELLOW EQU 4
DEF ATK_PAL_GREEN EQU 5
DEF ATK_PAL_ICE EQU 6
DEF ATK_PAL_PURPLE EQU 7
; 8: color based on attack type
; 9: don't change color palette (assume it's already set properly from elsewhere)


SPR_PAL_ORANGE EQU 0
SPR_PAL_BLUE EQU 1
SPR_PAL_GREEN EQU 2
SPR_PAL_BROWN EQU 3
SPR_PAL_PURPLE EQU 4
SPR_PAL_EMOJI EQU 5
SPR_PAL_TREE EQU 6
SPR_PAL_ROCK EQU 7
SPR_PAL_RANDOM EQU 8
DEF SPR_PAL_ORANGE EQU 0
DEF SPR_PAL_BLUE EQU 1
DEF SPR_PAL_GREEN EQU 2
DEF SPR_PAL_BROWN EQU 3
DEF SPR_PAL_PURPLE EQU 4
DEF SPR_PAL_EMOJI EQU 5
DEF SPR_PAL_TREE EQU 6
DEF SPR_PAL_ROCK EQU 7
DEF SPR_PAL_RANDOM EQU 8

LoadOverworldSpritePalettes:
ldh a, [rSVBK]
Expand Down
48 changes: 24 additions & 24 deletions color/wram.asm
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
W2_BgPaletteData EQU $d000
W2_SprPaletteData EQU $d040
DEF W2_BgPaletteData EQU $d000
DEF W2_SprPaletteData EQU $d040

W2_LastBGP EQU $d080
W2_LastOBP0 EQU $d081
W2_LastOBP1 EQU $d082
DEF W2_LastBGP EQU $d080
DEF W2_LastOBP0 EQU $d081
DEF W2_LastOBP1 EQU $d082

; If W2_TileBasedPalettes is set, each number corresponds to a tile. (takes $180 bytes)
; Otherwise this is a 20x18 map of palettes. (takes $168 bytes)
W2_TilesetPaletteMap EQU $d200
DEF W2_TilesetPaletteMap EQU $d200

; Each number here corresponds to a tile, but this isn't used for
; overworld sprites. I've got a better system for that.
W2_SpritePaletteMap EQU $d400
DEF W2_SpritePaletteMap EQU $d400

; Palette calculations for wTileMap are stored here before vblank.
W2_ScreenPalettesBuffer EQU $d500 ; 32x6 bytes (DMA-able), $d500-$d5c0
DEF W2_ScreenPalettesBuffer EQU $d500 ; 32x6 bytes (DMA-able), $d500-$d5c0

W2_TownMapLoaded EQU $d700
W2_TileBasedPalettes EQU $d701
W2_StaticPaletteMapChanged EQU $d702 ; Set to a number >=3 if palette map is modified, since the window is drawn in thirds. Only for when TileBasedPalettes == 0.
W2_UseOBP1 EQU $d703 ; If set, sprite palettes 4-7 use OBP1 instead of OBP0
DEF W2_TownMapLoaded EQU $d700
DEF W2_TileBasedPalettes EQU $d701
DEF W2_StaticPaletteMapChanged EQU $d702 ; Set to a number >=3 if palette map is modified, since the window is drawn in thirds. Only for when TileBasedPalettes == 0.
DEF W2_UseOBP1 EQU $d703 ; If set, sprite palettes 4-7 use OBP1 instead of OBP0

; These are like W2_BgPaletteData/SprPaletteData, but they account for BGP/OBP0/OBP1.
W2_BgPaletteDataBuffer EQU $d704
W2_SprPaletteDataBuffer EQU $d744
DEF W2_BgPaletteDataBuffer EQU $d704
DEF W2_SprPaletteDataBuffer EQU $d744

W2_BgPaletteDataModified EQU $d784
W2_SprPaletteDataModified EQU $d785
DEF W2_BgPaletteDataModified EQU $d784
DEF W2_SprPaletteDataModified EQU $d785

; Analagous to StaticPaletteMapChanged, but only used between Pre-vblank and
; actual-vblank routines.
W2_StaticPaletteMapChanged_vbl EQU $d786
DEF W2_StaticPaletteMapChanged_vbl EQU $d786

; Former value of [hAutoBGTransferDest + 1]. Should be $98 or $9c.
W2_LastAutoCopyDest EQU $d787
DEF W2_LastAutoCopyDest EQU $d787

W2_ForceBGPUpdate EQU $d788
W2_ForceOBPUpdate EQU $d789
DEF W2_ForceBGPUpdate EQU $d788
DEF W2_ForceOBPUpdate EQU $d789

; Set to 0 when vblank has updated W2_PreVBlankWindowPortion. Used to make sure that the
; pre-vblank routines are in sync with the vblank routines.
W2_UpdatedWindowPortion EQU $d78a
DEF W2_UpdatedWindowPortion EQU $d78a

; Set if a row or column on the map was drawn during the current vblank.
W2_DrewRowOrColumn EQU $d78b
DEF W2_DrewRowOrColumn EQU $d78b

; Palette of the current pokemon (remembered here so pokemon have correct palette when
; transformed)
W2_BattleMonPalette EQU $d78c
DEF W2_BattleMonPalette EQU $d78c

; Used by "WindowTransferBgRowsAndColors" function. Analagous to H_VBCOPYBGNUMROWS.
W2_VBCOPYBGNUMROWS EQU $d78d
DEF W2_VBCOPYBGNUMROWS EQU $d78d

; In bank 1, the stack starts at $dfff. So, that's also the stack here when bank 2 is
; loaded. Don't use anything too close to there.
2 changes: 1 addition & 1 deletion includes.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GEN_2_GRAPHICS EQU 1
DEF GEN_2_GRAPHICS EQU 1

INCLUDE "macros/asserts.asm"
INCLUDE "macros/const.asm"
Expand Down
2 changes: 1 addition & 1 deletion macros/color.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENDM
MACRO tilepal
; vram bank, pals
; without some code rewrites, only vram0 is usable for now
x = \1 << 3
DEF x = \1 << 3
REPT _NARG +- 1
db (x | PAL_BG_\2)
SHIFT
Expand Down
8 changes: 4 additions & 4 deletions rgbdscheck.asm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
MAJOR EQU 0
MINOR EQU 6
PATCH EQU 0
DEF MAJOR EQU 0
DEF MINOR EQU 6
DEF PATCH EQU 0

WRONG_RGBDS EQUS "fail \"pokered requires rgbds v0.6.0 or newer.\""
DEF WRONG_RGBDS EQUS "fail \"pokered requires rgbds v0.6.0 or newer.\""

IF !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__)
WRONG_RGBDS
Expand Down