Merge pull request #712 from Rangi42/master

Miscellaneous fixes
This commit is contained in:
mid-kid 2020-04-17 18:25:59 +00:00 committed by GitHub
commit 19aee926af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 85 additions and 59 deletions

2
FAQ.md
View File

@ -58,7 +58,7 @@ If you are using 64-bit Windows, download [**64-bit Cygwin**][cygwin] and [**64-
If you have not changed any of the asm, make sure you have the latest version of pokecrystal and the correct version of rgbds (see [INSTALL.md](INSTALL.md)). If you have not changed any of the asm, make sure you have the latest version of pokecrystal and the correct version of rgbds (see [INSTALL.md](INSTALL.md)).
If you added or changed any code, it has to fit in the **memory banks**. The 2MB ROM is divided into 128 banks of 4KB ($4000 bytes) each, numbered $00 to $7F. The linkerscript [pokecrystal.link](pokecrystal.link) lists which `SECTION`s go in which banks. Try moving some code into a new section. If you added or changed any code, it has to fit in the **memory banks**. The 2MB ROM is divided into 128 banks of 4KB ($4000 bytes) each, numbered $00 to $7F. The linkerscript [layout.link](layout.link) lists which `SECTION`s go in which banks. Try moving some code into a new section.
### "Invalid file or object file version" ### "Invalid file or object file version"

View File

@ -50,7 +50,7 @@ crystal11: pokecrystal11.gbc
crystal-au: pokecrystal-au.gbc crystal-au: pokecrystal-au.gbc
clean: clean:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(crystal_au_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o
find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.sgb.tilemap" \) -delete find gfx \( -name "*.[12]bpp" -o -name "*.lz" -o -name "*.gbcpal" -o -name "*.sgb.tilemap" \) -delete
find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete find gfx/pokemon -mindepth 1 ! -path "gfx/pokemon/unown/*" \( -name "bitmask.asm" -o -name "frames.asm" -o -name "front.animated.tilemap" -o -name "front.dimensions" \) -delete
$(MAKE) clean -C tools/ $(MAKE) clean -C tools/
@ -71,11 +71,14 @@ $(crystal_obj): RGBASMFLAGS +=
$(crystal11_obj): RGBASMFLAGS += -D _CRYSTAL11 $(crystal11_obj): RGBASMFLAGS += -D _CRYSTAL11
$(crystal_au_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU $(crystal_au_obj): RGBASMFLAGS += -D _CRYSTAL11 -D _CRYSTAL_AU
rgbdscheck.o: rgbdscheck.asm
$(RGMASM) -o $@ $<
# The dep rules have to be explicit or else missing files won't be reported. # The dep rules have to be explicit or else missing files won't be reported.
# As a side effect, they're evaluated immediately instead of when the rule is invoked. # As a side effect, they're evaluated immediately instead of when the rule is invoked.
# It doesn't look like $(shell) can be deferred so there might not be a better way. # It doesn't look like $(shell) can be deferred so there might not be a better way.
define DEP define DEP
$1: $2 $$(shell tools/scan_includes $2) $1: $2 $$(shell tools/scan_includes $2) | rgbdscheck.o
$$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$< $$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$<
endef endef
@ -92,17 +95,17 @@ $(foreach obj, $(crystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))
endif endif
pokecrystal.gbc: $(crystal_obj) pokecrystal.link pokecrystal.gbc: $(crystal_obj) layout.link
$(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l pokecrystal.link -o $@ $(crystal_obj) $(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l layout.link -p 0 -o $@ $(crystal_obj)
$(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ $(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
pokecrystal11.gbc: $(crystal11_obj) pokecrystal.link pokecrystal11.gbc: $(crystal11_obj) layout.link
$(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l pokecrystal.link -o $@ $(crystal11_obj) $(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l layout.link -p 0 -o $@ $(crystal11_obj)
$(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@ $(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
pokecrystal-au.gbc: $(crystal_au_obj) pokecrystal.link pokecrystal-au.gbc: $(crystal_au_obj) layout.link
$(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l pokecrystal.link -o $@ $(crystal_au_obj) $(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l layout.link -p 0 -o $@ $(crystal_au_obj)
$(RGBFIX) -Cjv -i BYTU -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ $(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTU -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
# For files that the compressor can't match, there will be a .lz file suffixed with the md5 hash of the correct uncompressed file. # For files that the compressor can't match, there will be a .lz file suffixed with the md5 hash of the correct uncompressed file.

View File

@ -1,7 +1,3 @@
if __RGBDS_MAJOR__ <= 0 && __RGBDS_MINOR__ < 4
fail "pokecrystal requires rgbds 0.4.0 or newer."
endc
INCLUDE "charmap.asm" INCLUDE "charmap.asm"
INCLUDE "macros.asm" INCLUDE "macros.asm"

View File

@ -85,7 +85,7 @@ In [gfx/pics.asm](https://github.com/pret/pokecrystal/blob/master/gfx/pics.asm):
```asm ```asm
; PokemonPicPointers and UnownPicPointers are assumed to start at the same ; PokemonPicPointers and UnownPicPointers are assumed to start at the same
; address, but in different banks. This is enforced in pokecrystal.link. ; address, but in different banks. This is enforced in layout.link.
SECTION "Pic Pointers", ROMX SECTION "Pic Pointers", ROMX
@ -98,7 +98,7 @@ SECTION "Unown Pic Pointers", ROMX
INCLUDE "data/pokemon/unown_pic_pointers.asm" INCLUDE "data/pokemon/unown_pic_pointers.asm"
``` ```
In [pokecrystal.link](https://github.com/pret/pokecrystal/blob/master/pokecrystal.link): In [layout.link](https://github.com/pret/pokecrystal/blob/master/layout.link):
``` ```
ROMX $48 ROMX $48
@ -113,7 +113,7 @@ ROMX $49
**Fix:** **Fix:**
Don't enforce `org $4000` in [pokecrystal.link](https://github.com/pret/pokecrystal/blob/master/pokecrystal.link). Don't enforce `org $4000` in [layout.link](https://github.com/pret/pokecrystal/blob/master/layout.link).
Edit `GetFrontpicPointer`: Edit `GetFrontpicPointer`:

View File

@ -52,7 +52,7 @@ PlaceDiplomaOnScreen:
PrintDiplomaPage2: PrintDiplomaPage2:
hlcoord 0, 0 hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f ld a, " "
call ByteFill call ByteFill
ld hl, DiplomaPage2Tilemap ld hl, DiplomaPage2Tilemap
decoord 0, 0 decoord 0, 0

View File

@ -112,7 +112,7 @@ _UnownPrinter:
ld a, [hl] ld a, [hl]
and a and a
jr nz, .wrap_around_left jr nz, .wrap_around_left
ld [hl], 26 + 1 ld [hl], NUM_UNOWN + 1
.wrap_around_left .wrap_around_left
dec [hl] dec [hl]
jr .return jr .return
@ -120,7 +120,7 @@ _UnownPrinter:
.press_right .press_right
ld hl, wJumptableIndex ld hl, wJumptableIndex
ld a, [hl] ld a, [hl]
cp 26 cp NUM_UNOWN
jr c, .wrap_around_right jr c, .wrap_around_right
ld [hl], -1 ld [hl], -1
.wrap_around_right .wrap_around_right
@ -132,7 +132,7 @@ _UnownPrinter:
.UpdateUnownFrontpic: .UpdateUnownFrontpic:
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
cp 26 cp NUM_UNOWN
jr z, .vacant jr z, .vacant
inc a inc a
ld [wUnownLetter], a ld [wUnownLetter], a

View File

@ -1,7 +1,7 @@
RotateUnownFrontpic: RotateUnownFrontpic:
; something to do with Unown printer ; something to do with Unown printer
push de push de
xor a ; sScratch xor a ; BANK(sScratch)
call GetSRAMBank call GetSRAMBank
ld hl, sScratch ld hl, sScratch
ld bc, 0 ld bc, 0

View File

@ -59,9 +59,9 @@ AreYouABoyOrAreYouAGirlText:
InitGenderScreen: InitGenderScreen:
ld a, $10 ld a, $10
ld [wMusicFade], a ld [wMusicFade], a
ld a, MUSIC_NONE ld a, LOW(MUSIC_NONE)
ld [wMusicFadeID], a ld [wMusicFadeID], a
ld a, $0 ld a, HIGH(MUSIC_NONE)
ld [wMusicFadeID + 1], a ld [wMusicFadeID + 1], a
ld c, 8 ld c, 8
call DelayFrames call DelayFrames

View File

@ -1206,7 +1206,7 @@ TitleScreenMain:
inc [hl] inc [hl]
; Fade out the title screen music ; Fade out the title screen music
xor a xor a ; MUSIC_NONE
ld [wMusicFadeID], a ld [wMusicFadeID], a
ld [wMusicFadeID + 1], a ld [wMusicFadeID + 1], a
ld hl, wMusicFade ld hl, wMusicFade

View File

@ -1,21 +1,34 @@
; GetOptionPointer.Pointers indexes
const_def
const OPT_TEXT_SPEED ; 0
const OPT_BATTLE_SCENE ; 1
const OPT_BATTLE_STYLE ; 2
const OPT_SOUND ; 3
const OPT_PRINT ; 4
const OPT_MENU_ACCOUNT ; 5
const OPT_FRAME ; 6
const OPT_CANCEL ; 7
NUM_OPTIONS EQU const_value ; 8
_OptionsMenu: _OptionsMenu:
ld hl, hInMenu ld hl, hInMenu
ld a, [hl] ld a, [hl]
push af push af
ld [hl], $1 ld [hl], TRUE
call ClearBGPalettes call ClearBGPalettes
hlcoord 0, 0 hlcoord 0, 0
ld b, 16 ld b, SCREEN_HEIGHT - 2
ld c, 18 ld c, SCREEN_WIDTH - 2
call Textbox call Textbox
hlcoord 2, 2 hlcoord 2, 2
ld de, StringOptions ld de, StringOptions
call PlaceString call PlaceString
xor a xor a
ld [wJumptableIndex], a ld [wJumptableIndex], a
ld c, $6 ; number of items on the menu minus 1 (for cancel)
.print_text_loop ; this next will display the settings of each option when the menu is opened ; display the settings of each option when the menu is opened
ld c, NUM_OPTIONS - 2 ; omit frame type, the last option
.print_text_loop
push bc push bc
xor a xor a
ldh [hJoyLast], a ldh [hJoyLast], a
@ -25,8 +38,8 @@ _OptionsMenu:
inc [hl] inc [hl]
dec c dec c
jr nz, .print_text_loop jr nz, .print_text_loop
call UpdateFrame ; display the frame type
call UpdateFrame
xor a xor a
ld [wJumptableIndex], a ld [wJumptableIndex], a
inc a inc a
@ -78,8 +91,8 @@ StringOptions:
db "CANCEL@" db "CANCEL@"
GetOptionPointer: GetOptionPointer:
ld a, [wJumptableIndex] ; load the cursor position to a ld a, [wJumptableIndex]
ld e, a ; copy it to de ld e, a
ld d, 0 ld d, 0
ld hl, .Pointers ld hl, .Pointers
add hl, de add hl, de
@ -87,9 +100,10 @@ GetOptionPointer:
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
jp hl ; jump to the code of the current highlighted item jp hl
.Pointers: .Pointers:
; entries correspond to OPT_* constants
dw Options_TextSpeed dw Options_TextSpeed
dw Options_BattleScene dw Options_BattleScene
dw Options_BattleStyle dw Options_BattleStyle
@ -346,7 +360,7 @@ Options_Print:
ld [wGBPrinterBrightness], a ld [wGBPrinterBrightness], a
.NonePressed: .NonePressed:
ld b, $0 ld b, 0
ld hl, .Strings ld hl, .Strings
add hl, bc add hl, bc
add hl, bc add hl, bc
@ -500,17 +514,17 @@ OptionsControl:
ret ret
.DownPressed: .DownPressed:
ld a, [hl] ; load the cursor position to a ld a, [hl]
cp $7 ; maximum number of items in option menu cp OPT_CANCEL ; maximum option index
jr nz, .CheckFive jr nz, .CheckMenuAccount
ld [hl], $0 ld [hl], OPT_TEXT_SPEED ; first option
scf scf
ret ret
.CheckFive: ; I have no idea why this exists... .CheckMenuAccount: ; I have no idea why this exists...
cp $5 cp OPT_MENU_ACCOUNT
jr nz, .Increase jr nz, .Increase
ld [hl], $5 ld [hl], OPT_MENU_ACCOUNT
.Increase: .Increase:
inc [hl] inc [hl]
@ -519,16 +533,18 @@ OptionsControl:
.UpPressed: .UpPressed:
ld a, [hl] ld a, [hl]
cp $6
jr nz, .NotSix ; Another thing where I'm not sure why it exists
ld [hl], $5 ; Another thing where I'm not sure why it exists cp OPT_FRAME
jr nz, .NotFrame
ld [hl], OPT_MENU_ACCOUNT
scf scf
ret ret
.NotSix: .NotFrame:
and a and a ; OPT_TEXT_SPEED, minimum option index
jr nz, .Decrease jr nz, .Decrease
ld [hl], $8 ; number of option items +1 ld [hl], NUM_OPTIONS ; decrements to OPT_CANCEL, maximum option index
.Decrease: .Decrease:
dec [hl] dec [hl]
@ -538,7 +554,7 @@ OptionsControl:
Options_UpdateCursorPosition: Options_UpdateCursorPosition:
hlcoord 1, 1 hlcoord 1, 1
ld de, SCREEN_WIDTH ld de, SCREEN_WIDTH
ld c, $10 ld c, SCREEN_HEIGHT - 2
.loop .loop
ld [hl], " " ld [hl], " "
add hl, de add hl, de

View File

@ -85,7 +85,7 @@ Credits::
xor a xor a
ldh [hBGMapMode], a ldh [hBGMapMode], a
ld [wCreditsPos], a ld [wCreditsPos], a
ld [wCreditsUnusedCD21], a ld [wCreditsPos + 1], a
ld [wCreditsTimer], a ld [wCreditsTimer], a
.execution_loop .execution_loop

View File

@ -226,9 +226,9 @@ ApplyMapPalettes:
ret ret
FadeMapMusicAndPalettes: FadeMapMusicAndPalettes:
ld e, 0 ld e, LOW(MUSIC_NONE)
ld a, [wMusicFadeID] ld a, [wMusicFadeID]
ld d, 0 ld d, HIGH(MUSIC_NONE)
ld a, [wMusicFadeID + 1] ld a, [wMusicFadeID + 1]
ld a, $4 ld a, $4
ld [wMusicFade], a ld [wMusicFade], a

View File

@ -2,7 +2,7 @@ INCLUDE "constants.asm"
; PokemonPicPointers and UnownPicPointers are assumed to start at the same ; PokemonPicPointers and UnownPicPointers are assumed to start at the same
; address, but in different banks. This is enforced in pokecrystal.link. ; address, but in different banks. This is enforced in layout.link.
SECTION "Pic Pointers", ROMX SECTION "Pic Pointers", ROMX

View File

@ -704,9 +704,9 @@ Function1163c0:
.asm_11642a .asm_11642a
ld a, $8 ld a, $8
ld [wMusicFade], a ld [wMusicFade], a
ld a, $0 ld a, LOW(MUSIC_NONE)
ld [wMusicFadeID], a ld [wMusicFadeID], a
ld a, $0 ld a, HIGH(MUSIC_NONE)
ld [wMusicFadeID + 1], a ld [wMusicFadeID + 1], a
.asm_116439 .asm_116439

12
rgbdscheck.asm Normal file
View File

@ -0,0 +1,12 @@
; pokecrystal requires rgbds 0.4.0 or newer.
MAJOR EQU 0
MINOR EQU 4
PATCH EQU 0
if !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__)
fail "pokecrystal requires rgbds {MAJOR}.{MINOR}.{PATCH} or newer."
elif (__RGBDS_MAJOR__ < MAJOR) || \
(__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ < MINOR) || \
(__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ == MINOR && __RGBDS_PATCH__ < PATCH)
fail "pokecrystal requires rgbds {MAJOR}.{MINOR}.{PATCH} or newer."
endc

View File

@ -1176,8 +1176,7 @@ wBGMapBufferEnd::
NEXTU ; cd20 NEXTU ; cd20
; credits ; credits
wCreditsPos:: db wCreditsPos:: dw
wCreditsUnusedCD21:: db
wCreditsTimer:: db wCreditsTimer:: db
NEXTU ; cd20 NEXTU ; cd20