Skip to content

Commit

Permalink
Addition of colored starter sprites and met data page in pokemon stat…
Browse files Browse the repository at this point in the history
…s menu
  • Loading branch information
coderthegreat2 committed May 23, 2024
1 parent 80cfd47 commit fa1323b
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 52 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
# Pokémon Crystal [![Build Status][ci-badge]][ci]

This is a disassembly of my Pokémon Crystal romhack based on the dissasembly by pret.

It adds new features such as:

- the physical/special split
- the fairy type
- a move relearner
- the removal of overworld poison damage
- colors for each type of pokeball
- much more

This romhack is a WIP and may contain bugs.
This is a disassembly of Pokémon Crystal.

It builds the following ROMs:

Expand All @@ -31,3 +20,14 @@ To set up the repository, see [INSTALL.md](INSTALL.md).
- [**Documentation**][docs]
- [**Wiki**][wiki] (includes [tutorials][tutorials])
- [**Symbols**][symbols]

You can find us on [Discord (pret, #pokecrystal)](https://discord.gg/d5dubZ3).

For other pret projects, see [pret.github.io](https://pret.github.io/).

[docs]: https://pret.github.io/pokecrystal/
[wiki]: https://github.com/pret/pokecrystal/wiki
[tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials
[symbols]: https://github.com/pret/pokecrystal/tree/symbols
[ci]: https://github.com/pret/pokecrystal/actions
[ci-badge]: https://github.com/pret/pokecrystal/actions/workflows/main.yml/badge.svg
1 change: 0 additions & 1 deletion engine/battle/effect_commands.asm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ DoMove:
; Get the user's move effect.
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
and TYPE_MASK
ld c, a
ld b, 0
ld hl, MoveEffectsPointers
Expand Down
9 changes: 5 additions & 4 deletions engine/events/pokepic.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Pokepic::
call MenuBox
call UpdateSprites
call ApplyTilemap
ld b, SCGB_POKEPIC
call GetSGBLayout
ld de, wBGPals1 palette PAL_BG_TEXT color 1
farcall LoadPokemonPalette
call UpdateTimePals
xor a
ldh [hBGMapMode], a
ld a, [wCurPartySpecies]
Expand Down Expand Up @@ -36,7 +37,7 @@ ClosePokepic::
xor a
ldh [hBGMapMode], a
call LoadOverworldTilemapAndAttrmapPals
call ApplyTilemap
call CopyTilemapAtOnce
call UpdateSprites
call LoadStandardFont
ret
Expand All @@ -45,4 +46,4 @@ PokepicMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 6, 4, 14, 13
dw NULL
db 1 ; default option
db 1 ; default option
13 changes: 9 additions & 4 deletions engine/gfx/cgb_layouts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ _CGB_StatsScreenHPPals:
call LoadPalette_White_Col1_Col2_Black ; exp palette
ld hl, StatsScreenPagePals
ld de, wBGPals1 palette 3
ld bc, 3 palettes ; pink, green, and blue page palettes
ld bc, 4 palettes ; pink, green, blue, and orange page palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
call WipeAttrmap
Expand All @@ -228,21 +228,26 @@ _CGB_StatsScreenHPPals:
ld a, $2 ; exp palette
call ByteFill

hlcoord 13, 5, wAttrmap
hlcoord 11, 5, wAttrmap
lb bc, 2, 2
ld a, $3 ; pink page palette
call FillBoxCGB

hlcoord 15, 5, wAttrmap
hlcoord 13, 5, wAttrmap
lb bc, 2, 2
ld a, $4 ; green page palette
call FillBoxCGB

hlcoord 17, 5, wAttrmap
hlcoord 15, 5, wAttrmap
lb bc, 2, 2
ld a, $5 ; blue page palette
call FillBoxCGB

hlcoord 17, 5, wAttrmap
lb bc, 2, 2
ld a, $6 ; orange page palette
call FillBoxCGB

call ApplyAttrmap
call ApplyPals
ld a, TRUE
Expand Down
10 changes: 9 additions & 1 deletion engine/gfx/color.asm
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ LoadStatsScreenPals:
ret z
ld hl, StatsScreenPals
ld b, 0
dec c
add hl, bc
add hl, bc
ldh a, [rSVBK]
Expand Down Expand Up @@ -1338,3 +1337,12 @@ INCLUDE "gfx/beta_poker/beta_poker.pal"

SlotMachinePals:
INCLUDE "gfx/slots/slots.pal"

LoadPokemonPalette:
ld a, [wCurPartySpecies]
; hl = palette
call GetMonPalettePointer
; load palette into de (set by caller)
ld bc, PAL_COLOR_SIZE * 2
ld a, BANK(wBGPals1)
jp FarCopyWRAM
150 changes: 120 additions & 30 deletions engine/pokemon/stats_screen.asm
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const_def 1
const PINK_PAGE ; 1
const GREEN_PAGE ; 2
const BLUE_PAGE ; 3
DEF NUM_STAT_PAGES EQU const_value - 1
const_def
const PINK_PAGE ; 0
const GREEN_PAGE ; 1
const BLUE_PAGE ; 2
const ORANGE_PAGE ; 3
NUM_STAT_PAGES EQU const_value

DEF STAT_PAGE_MASK EQU %00000011

Expand Down Expand Up @@ -62,12 +63,7 @@ StatsScreenInit_gotaddress:
StatsScreenMain:
xor a
ld [wJumptableIndex], a
; ???
ld [wStatsScreenFlags], a
ld a, [wStatsScreenFlags]
and ~STAT_PAGE_MASK
or PINK_PAGE ; first_page
ld [wStatsScreenFlags], a
ld [wStatsScreenFlags], a ; PINK_PAGE
.loop
ld a, [wJumptableIndex]
and ~(1 << 7)
Expand All @@ -82,12 +78,7 @@ StatsScreenMain:
StatsScreenMobile:
xor a
ld [wJumptableIndex], a
; ???
ld [wStatsScreenFlags], a
ld a, [wStatsScreenFlags]
and ~STAT_PAGE_MASK
or PINK_PAGE ; first_page
ld [wStatsScreenFlags], a
ld [wStatsScreenFlags], a ; PINK_PAGE
.loop
farcall Mobile_SetOverworldDelay
ld a, [wJumptableIndex]
Expand Down Expand Up @@ -373,21 +364,23 @@ StatsScreen_JoypadAction:

.a_button
ld a, c
cp BLUE_PAGE ; last page
cp ORANGE_PAGE ; last page
jr z, .b_button
.d_right
inc c
ld a, BLUE_PAGE ; last page
ld a, ORANGE_PAGE ; last page
cp c
jr nc, .set_page
ld c, PINK_PAGE ; first page
jr .set_page

.d_left
dec c
jr nz, .set_page
ld c, BLUE_PAGE ; last page
jr .set_page
ld a, c
dec c
and a ; cp PINK_PAGE ; first page
jr nz, .set_page
ld c, ORANGE_PAGE ; last page
jr .set_page

.done
ret
Expand Down Expand Up @@ -507,7 +500,7 @@ StatsScreen_PlaceHorizontalDivider:
ret

StatsScreen_PlacePageSwitchArrows:
hlcoord 12, 6
hlcoord 10, 6
ld [hl], "◀"
hlcoord 19, 6
ld [hl], "▶"
Expand Down Expand Up @@ -563,7 +556,6 @@ StatsScreen_LoadGFX:
.PageTilemap:
ld a, [wStatsScreenFlags]
maskbits NUM_STAT_PAGES
dec a
ld hl, .Jumptable
rst JumpTable
ret
Expand All @@ -574,6 +566,7 @@ StatsScreen_LoadGFX:
dw LoadPinkPage
dw LoadGreenPage
dw LoadBluePage
dw LoadOrangePage
assert_table_length NUM_STAT_PAGES

LoadPinkPage:
Expand Down Expand Up @@ -817,6 +810,94 @@ LoadBluePage:
dw sBoxMonOTs
dw wBufferMonOT

LoadOrangePage:
call .placeCaughtLocation
ld de, MetAtMapString
hlcoord 1, 9
call PlaceString
call .placeCaughtLevel
ret

.placeCaughtLocation
ld a, [wTempMonCaughtLocation]
and CAUGHT_LOCATION_MASK
jr z, .unknown_location
cp LANDMARK_EVENT
jr z, .unknown_location
cp LANDMARK_GIFT
jr z, .unknown_location
ld e, a
farcall GetLandmarkName
ld de, wStringBuffer1
hlcoord 2, 10
call PlaceString
ld a, [wTempMonCaughtTime]
and CAUGHT_TIME_MASK
ret z ; no time
rlca
rlca
dec a
ld hl, .times
call GetNthString
ld d, h
ld e, l
call CopyName1
ld de, wStringBuffer2
hlcoord 2, 11
call PlaceString
ret

.unknown_location:
ld de, MetUnknownMapString
hlcoord 2, 10
call PlaceString
ret

.times
db "MORN@"
db "DAY@"
db "NITE@"

.placeCaughtLevel
; caught level
; Limited to between 1 and 63 since it's a 6-bit quantity.
ld a, [wTempMonCaughtLevel]
and CAUGHT_LEVEL_MASK
jr z, .unknown_level
cp CAUGHT_EGG_LEVEL ; egg marker value
jr nz, .print
ld a, EGG_LEVEL ; egg hatch level

.print
ld [wTextDecimalByte], a
hlcoord 3, 13
ld de, wTextDecimalByte
lb bc, PRINTNUM_LEFTALIGN | 1, 3
call PrintNum
ld de, MetAtLevelString
hlcoord 1, 12
call PlaceString
hlcoord 2, 13
ld [hl], "<LV>"
ret

.unknown_level
ld de, MetUnknownLevelString
hlcoord 2, 12
call PlaceString
ret

MetAtMapString:
db "MET AT:@"

MetUnknownMapString:
db "UNKNOWN@"
MetAtLevelString:
db "MET LEVEL:@"
MetUnknownLevelString:
db "???@"

IDNoString:
db "<ID>№.@"

Expand Down Expand Up @@ -1106,6 +1187,9 @@ StatsScreen_AnimateEgg:
ret

StatsScreen_LoadPageIndicators:
hlcoord 11, 5
ld a, $36 ; " " " "
call .load_square
hlcoord 13, 5
ld a, $36 ; first of 4 small square tiles
call .load_square
Expand All @@ -1116,13 +1200,19 @@ StatsScreen_LoadPageIndicators:
ld a, $36 ; " " " "
call .load_square
ld a, c
cp PINK_PAGE
hlcoord 11, 5
jr z, .load_highlighted_square
cp GREEN_PAGE
hlcoord 13, 5
jr z, .load_highlighted_square
cp BLUE_PAGE
hlcoord 15, 5
jr z, .load_highlighted_square
; must be ORANGE_PAGE
hlcoord 17, 5
.load_highlighted_square
ld a, $3a ; first of 4 large square tiles
hlcoord 13, 5 ; PINK_PAGE (< GREEN_PAGE)
jr c, .load_square
hlcoord 15, 5 ; GREEN_PAGE (= GREEN_PAGE)
jr z, .load_square
hlcoord 17, 5 ; BLUE_PAGE (> GREEN_PAGE)
.load_square
push bc
ld [hli], a
Expand Down
5 changes: 5 additions & 0 deletions gfx/stats/pages.pal
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
RGB 17, 31, 31
RGB 17, 31, 31
RGB 00, 00, 00
; orange
RGB 31, 31, 31
RGB 30, 24, 16
RGB 30, 22, 12
RGB 00, 00, 00
2 changes: 2 additions & 0 deletions gfx/stats/stats.pal
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
RGB 21, 31, 14
; blue
RGB 17, 31, 31
; orange
RGB 30, 24, 16

0 comments on commit fa1323b

Please sign in to comment.