Skip to content

Commit

Permalink
Merge remote-tracking branch 'pret/master' into core
Browse files Browse the repository at this point in the history
  • Loading branch information
vulcandth committed Dec 27, 2024
2 parents 9fe12bf + 0124a1e commit b566720
Show file tree
Hide file tree
Showing 256 changed files with 1,760 additions and 13,083 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ jobs:
uses: actions/checkout@v2
with:
path: rgbds
ref: v0.8.0
ref: v0.9.0
repository: gbdev/rgbds

- name: Install rgbds
working-directory: rgbds
run: |
sudo apt-get install -yq libpng-dev
sudo make install
- name: Remove rgbds
run: |
Expand Down
22 changes: 11 additions & 11 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ Run setup and leave the default settings. At the "**Select Packages**" step, cho

Double click on the text that says "**Skip**" next to each package to select the most recent version to install.

Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.7.0**.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.9.0**.

**Note:** If you already have an installed rgbds older than 0.7.0, you will need to update to 0.7.0. Ignore this if you have never installed rgbds before. If a version newer than 0.7.0 does not work, try downloading 0.7.0.
**Note:** If you already have an installed rgbds older than 0.9.0, you will need to update to 0.9.0. Ignore this if you have never installed rgbds before. If a version newer than 0.9.0 does not work, try downloading 0.9.0.

Now open the **Cygwin terminal** and enter the following commands.

Expand All @@ -67,7 +67,7 @@ Install [**Homebrew**](https://brew.sh/). Follow the official instructions.

Open **Terminal** and prepare to enter commands.

Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.7.0**.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.9.0**.

Now you're ready to [build **pokecrystal**](#build-pokecrystal).

Expand All @@ -84,7 +84,7 @@ To install the software required for **pokecrystal**:
sudo apt-get install make gcc git
```

Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source.

### OpenSUSE

Expand All @@ -94,7 +94,7 @@ To install the software required for **pokecrystal**:
sudo zypper install make gcc git
```

Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source.
Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source.

### Arch Linux

Expand All @@ -104,7 +104,7 @@ To install the software required for **pokecrystal**:
sudo pacman -S make gcc git rgbds
```

If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source.
If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source.

### Termux

Expand All @@ -120,7 +120,7 @@ To install **rgbds**:
pkg install rgbds
```

If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source.
If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source.

### Other distros

Expand All @@ -131,7 +131,7 @@ If your distro is not listed here, try to find the required software in its repo
- `git`
- `rgbds`

If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.7.0** from source.
If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source.

Now you're ready to [build **pokecrystal**](#build-pokecrystal).

Expand Down Expand Up @@ -159,12 +159,12 @@ make crystal11

### Build with a local rgbds version

If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.7.0 globally. Instead, you can put its files in a directory within pokecrystal, such as `pokecrystal/rgbds-0.7.0/`. Then specify it when you run `make`:
If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.9.0 globally. Instead, you can put its files in a directory within pokecrystal, such as `pokecrystal/rgbds-0.9.0/`. Then specify it when you run `make`:

```bash
make RGBDS=rgbds-0.7.0/
make RGBDS=rgbds-0.9.0/
```

```bash
make RGBDS=rgbds-0.7.0/ crystal11
make RGBDS=rgbds-0.9.0/ crystal11
```
86 changes: 56 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ tools:
$(MAKE) -C tools/


RGBASMFLAGS = -E -Q8 -P includes.asm -Weverything -Wnumeric-string=2 -Wtruncation=1
RGBASMFLAGS = -Q8 -P includes.asm -Weverything -Wtruncation=1

$(pokecrystal_obj): RGBASMFLAGS +=
$(pokecrystal_debug_obj): RGBASMFLAGS += -D _DEBUG
$(pokecrystal_vc_obj): RGBASMFLAGS += -D _CRYSTAL_VC

%.patch: vc/%.constants.sym %_vc.gbc %.gbc vc/%.patch.template
%.patch: %_vc.gbc %.gbc vc/%.patch.template
tools/make_patch $*_vc.sym $^ $@

rgbdscheck.o: rgbdscheck.asm
Expand All @@ -122,16 +122,12 @@ $(foreach obj, $(pokecrystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))
$(foreach obj, $(pokecrystal_debug_obj), $(eval $(call DEP,$(obj),$(obj:_debug.o=.asm))))
$(foreach obj, $(pokecrystal_vc_obj), $(eval $(call DEP,$(obj),$(obj:_vc.o=.asm))))

# Dependencies for VC files that need to run scan_includes
%.constants.sym: %.constants.asm $(shell tools/scan_includes %.constants.asm) $(preinclude_deps) | rgbdscheck.o
$(RGBASM) $(RGBASMFLAGS) $< > $@

endif


pokecrystal_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal_vc_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m MBC3+TIMER+RAM+BATTERY -r 3 -p 0
pokecrystal_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m MBC3+TIMER+RAM+BATTERY -r 3 -p 0
pokecrystal_vc_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m MBC3+TIMER+RAM+BATTERY -r 3 -p 0

.gbc: tools/bankends
%.gbc: $$(%_obj) layout.link
Expand Down Expand Up @@ -159,17 +155,46 @@ gfx/pokemon/%/frames.asm: gfx/pokemon/%/front.animated.tilemap gfx/pokemon/%/fro
tools/pokemon_animation -f $^ > $@


### Misc file-specific graphics rules
### Pokemon and trainer sprite rules

gfx/pokemon/%/back.2bpp: rgbgfx += --columns
gfx/pokemon/%/back.2bpp: gfx/pokemon/%/back.png gfx/pokemon/%/normal.gbcpal
$(RGBGFX) $(rgbgfx) --colors gbc:$(word 2,$^) -o $@ $<
gfx/pokemon/%/front.2bpp: gfx/pokemon/%/front.png gfx/pokemon/%/normal.gbcpal
$(RGBGFX) $(rgbgfx) --colors gbc:$(word 2,$^) -o $@ $<
gfx/pokemon/%/normal.gbcpal: gfx/pokemon/%/front.gbcpal gfx/pokemon/%/back.gbcpal
tools/gbcpal $(tools/gbcpal) $@ $^

gfx/trainers/%.2bpp: rgbgfx += --columns
gfx/trainers/%.2bpp: gfx/trainers/%.png gfx/trainers/%.gbcpal
$(RGBGFX) $(rgbgfx) --colors gbc:$(word 2,$^) -o $@ $<

gfx/pokemon/%/back.2bpp: rgbgfx += -Z -c embedded
gfx/pokemon/%/front.2bpp: rgbgfx += -c embedded
# Unown letters share one normal.gbcpal
unown_pngs := $(wildcard gfx/pokemon/unown_*/front.png) $(wildcard gfx/pokemon/unown_*/back.png)
$(foreach png, $(unown_pngs),\
$(eval $(png:.png=.2bpp): $(png) gfx/pokemon/unown/normal.gbcpal))
gfx/pokemon/unown_%/back.2bpp: rgbgfx += --colors gbc:$(word 2,$^)
gfx/pokemon/unown_%/front.2bpp: rgbgfx += --colors gbc:$(word 2,$^)
gfx/pokemon/unown/normal.gbcpal: $(subst .png,.gbcpal,$(unown_pngs))
tools/gbcpal $(tools/gbcpal) $@ $^


### Misc file-specific graphics rules
gfx/pokemon/egg/unused_front.2bpp: rgbgfx += --columns

gfx/trainers/%.2bpp: rgbgfx += -Z -c embedded
gfx/pokemon/spearow/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/fearow/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/farfetch_d/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/hitmonlee/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/scyther/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/jynx/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/porygon/normal.gbcpal: tools/gbcpal += --reverse
gfx/pokemon/porygon2/normal.gbcpal: tools/gbcpal += --reverse

gfx/pokemon/egg/unused_front.2bpp: rgbgfx += -Z
gfx/trainers/swimmer_m.gbcpal: tools/gbcpal += --reverse

gfx/new_game/shrink1.2bpp: rgbgfx += -Z
gfx/new_game/shrink2.2bpp: rgbgfx += -Z
gfx/new_game/shrink1.2bpp: rgbgfx += --columns
gfx/new_game/shrink2.2bpp: rgbgfx += --columns

gfx/mail/dragonite.1bpp: tools/gfx += --remove-whitespace
gfx/mail/large_note.1bpp: tools/gfx += --remove-whitespace
Expand All @@ -179,17 +204,17 @@ gfx/mail/litebluemail_border.1bpp: tools/gfx += --remove-whitespace

gfx/pokedex/pokedex.2bpp: tools/gfx += --trim-whitespace
gfx/pokedex/pokedex_sgb.2bpp: tools/gfx += --trim-whitespace
gfx/pokedex/question_mark.2bpp: rgbgfx += -Z
gfx/pokedex/question_mark.2bpp: rgbgfx += --columns
gfx/pokedex/slowpoke.2bpp: tools/gfx += --trim-whitespace

gfx/pokegear/pokegear.2bpp: rgbgfx += -x2
gfx/pokegear/pokegear.2bpp: rgbgfx += --trim-end 2
gfx/pokegear/pokegear_sprites.2bpp: tools/gfx += --trim-whitespace

gfx/mystery_gift/mystery_gift.2bpp: tools/gfx += --trim-whitespace

gfx/title/crystal.2bpp: tools/gfx += --interleave --png=$<
gfx/title/old_fg.2bpp: tools/gfx += --interleave --png=$<
gfx/title/logo.2bpp: rgbgfx += -x 4
gfx/title/logo.2bpp: rgbgfx += --trim-end 4

gfx/trade/ball.2bpp: tools/gfx += --remove-whitespace
gfx/trade/game_boy.2bpp: tools/gfx += --remove-duplicates --preserve=0x23,0x27
Expand Down Expand Up @@ -222,21 +247,21 @@ gfx/battle_anims/rocks.2bpp: tools/gfx += --remove-whitespace
gfx/battle_anims/skyattack.2bpp: tools/gfx += --remove-whitespace
gfx/battle_anims/status.2bpp: tools/gfx += --remove-whitespace

gfx/player/chris.2bpp: rgbgfx += -Z
gfx/player/chris_back.2bpp: rgbgfx += -Z
gfx/player/kris.2bpp: rgbgfx += -Z
gfx/player/kris_back.2bpp: rgbgfx += -Z
gfx/player/chris.2bpp: rgbgfx += --columns
gfx/player/chris_back.2bpp: rgbgfx += --columns
gfx/player/kris.2bpp: rgbgfx += --columns
gfx/player/kris_back.2bpp: rgbgfx += --columns

gfx/trainer_card/chris_card.2bpp: rgbgfx += -Z
gfx/trainer_card/kris_card.2bpp: rgbgfx += -Z
gfx/trainer_card/chris_card.2bpp: rgbgfx += --columns
gfx/trainer_card/kris_card.2bpp: rgbgfx += --columns
gfx/trainer_card/leaders.2bpp: tools/gfx += --trim-whitespace

gfx/overworld/chris_fish.2bpp: tools/gfx += --trim-whitespace
gfx/overworld/kris_fish.2bpp: tools/gfx += --trim-whitespace

gfx/sprites/big_onix.2bpp: tools/gfx += --remove-whitespace --remove-xflip

gfx/battle/dude.2bpp: rgbgfx += -Z
gfx/battle/dude.2bpp: rgbgfx += --columns

gfx/font/unused_bold_font.1bpp: tools/gfx += --trim-whitespace

Expand All @@ -261,12 +286,12 @@ gfx/mobile/stadium2_n64.2bpp: tools/gfx += --trim-whitespace
%.2bpp: %.png
$(RGBGFX) $(rgbgfx) -o $@ $<
$(if $(tools/gfx),\
tools/gfx $(tools/gfx) -o $@ $@)
tools/gfx $(tools/gfx) -o $@ $@ || $$($(RM) $@ && false))

%.1bpp: %.png
$(RGBGFX) $(rgbgfx) -d1 -o $@ $<
$(RGBGFX) $(rgbgfx) --depth 1 -o $@ $<
$(if $(tools/gfx),\
tools/gfx $(tools/gfx) -d1 -o $@ $@)
tools/gfx $(tools/gfx) --depth 1 -o $@ $@ || $$($(RM) $@ && false))

%.2bpp.vtiles2: %.2bpp
$Qtools/sub_2bpp.sh $< 128 > $@
Expand All @@ -278,7 +303,8 @@ gfx/mobile/stadium2_n64.2bpp: tools/gfx += --trim-whitespace
$Qtools/sub_2bpp.sh $< 128 128 > $@

%.gbcpal: %.png
$(RGBGFX) -c embedded -p $@ $<
$(RGBGFX) -p $@ $<
tools/gbcpal $(tools/gbcpal) $@ $@ || $$($(RM) $@ && false)

%.dimensions: %.png
tools/png_dimensions $< $@
2 changes: 1 addition & 1 deletion audio/cry_pointers.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Cries:
; entries correspond to CRY_* constants (see constants/cry_constants.asm)
table_width 3, Cries
table_width 3
dba Cry_Nidoran_M
dba Cry_Nidoran_F
dba Cry_Slowpoke
Expand Down
19 changes: 9 additions & 10 deletions audio/engine.asm
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ UpdateChannels:
jp hl

.ChannelFunctions:
table_width 2, UpdateChannels.ChannelFunctions
table_width 2
; music channels
dw .Channel1
dw .Channel2
Expand Down Expand Up @@ -1320,7 +1320,7 @@ ParseMusicCommand:

MusicCommands:
; entries correspond to audio constants (see macros/scripts/audio.asm)
table_width 2, MusicCommands
table_width 2
dw Music_Octave8
dw Music_Octave7
dw Music_Octave6
Expand Down Expand Up @@ -2135,20 +2135,19 @@ SetNoteDuration:
ld e, [hl] ; no-optimize b|c|d|e = *hl++|*hl--
inc hl
ld d, [hl]
; add ??? to the next result
ld hl, CHANNEL_FIELD16
; add duration modifier to the next result
ld hl, CHANNEL_NOTE_DURATION_MODIFIER
add hl, bc
ld l, [hl]
; multiply Tempo by last result (NoteLength * LOW(delay))
call .Multiply
; copy result to de
ld e, l
ld d, h
; store result in ???
ld hl, CHANNEL_FIELD16
; store result in NoteDuration and NoteDurationModifier
ld hl, CHANNEL_NOTE_DURATION_MODIFIER
add hl, bc
ld [hl], e
; store result in NoteDuration
ld hl, CHANNEL_NOTE_DURATION
add hl, bc
ld [hl], d
Expand Down Expand Up @@ -2213,9 +2212,9 @@ Tempo:
ld a, e
ld [hli], a
ld [hl], d
; clear ???
; clear duration modifier
xor a
ld hl, CHANNEL_FIELD16
ld hl, CHANNEL_NOTE_DURATION_MODIFIER
add hl, bc
ld [hl], a
ret
Expand Down Expand Up @@ -2710,7 +2709,7 @@ StereoTracks:
db $11, $22, $44, $88

ChannelPointers:
table_width 2, ChannelPointers
table_width 2
; music channels
dw wChannel1
dw wChannel2
Expand Down
2 changes: 1 addition & 1 deletion audio/music_pointers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Music:
; entries correspond to MUSIC_* constants
table_width 3, Music
table_width 3
dba Music_Nothing
dba Music_TitleScreen
dba Music_Route1
Expand Down
2 changes: 1 addition & 1 deletion audio/notes.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FrequencyTable:
table_width 2, FrequencyTable
table_width 2
dw 0 ; __
dw $f82c ; C_
dw $f89d ; C#
Expand Down
2 changes: 1 addition & 1 deletion audio/sfx_pointers.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SFX:
; entries correspond to SFX_* constants
table_width 3, SFX
table_width 3
dba Sfx_DexFanfare5079
dba Sfx_Item
dba Sfx_CaughtMon
Expand Down
2 changes: 1 addition & 1 deletion constants/audio_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ DEF CHANNEL_PITCH rb
DEF CHANNEL_OCTAVE rb
DEF CHANNEL_TRANSPOSITION rb
DEF CHANNEL_NOTE_DURATION rb
DEF CHANNEL_FIELD16 rb
DEF CHANNEL_NOTE_DURATION_MODIFIER rb
rb_skip
DEF CHANNEL_LOOP_COUNT rb
DEF CHANNEL_TEMPO rw
Expand Down
2 changes: 2 additions & 0 deletions constants/battle_anim_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ DEF BATTLEANIMSTRUCT_VAR2 rb ; 10
DEF BATTLEANIMSTRUCT_LENGTH EQU _RS
DEF NUM_BATTLE_ANIM_STRUCTS EQU 10 ; see wActiveAnimObjects

DEF BATTLEANIMSTRUCT_OAMFLAGS_FIX_COORDS_F EQU 0

; wBattleAnimTileDict size (see wram.asm)
DEF NUM_BATTLEANIMTILEDICT_ENTRIES EQU 5

Expand Down
6 changes: 6 additions & 0 deletions constants/battle_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ DEF EFFECTIVE EQU 10
DEF NOT_VERY_EFFECTIVE EQU 05
DEF NO_EFFECT EQU 00

; wTypeModifier
DEF EFFECTIVENESS_MASK EQU %01111111
const_def 7
shift_const STAB_DAMAGE

; enemy AI behavior
DEF BASE_AI_SWITCH_SCORE EQU 10

Expand Down Expand Up @@ -218,6 +223,7 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP_MASK
const SCREENS_SAFEGUARD
const SCREENS_LIGHT_SCREEN
const SCREENS_REFLECT
const SCREENS_UNUSED

; values in wBattleWeather
const_def
Expand Down
Loading

0 comments on commit b566720

Please sign in to comment.