Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
yenatch 2017-12-23 17:14:09 -05:00
commit c51968f0de
1066 changed files with 16040 additions and 15625 deletions

16
FAQ.md
View File

@ -1,27 +1,43 @@
# FAQ
## Questions
- [What is pokecrystal11.gbc?](#what-is-pokecrystal11gbc)
- [Can't build ROM; "ERROR: `UNION` already defined"](#cant-build-rom-error-union-already-defined)
- [Can't build ROM; "Segmentation fault" from `rgbgfx`](#cant-build-rom-segmentation-fault-from-rgbgfx)
- [Can't build ROM; "Section is too big" or "Unable to place section in bank"](#cant-build-rom-section-is-too-big-or-unable-to-place-section-in-bank)
- [How do I edit maps?](#how-do-i-edit-maps)
- [I need more help!](#i-need-more-help)
## What is pokecrystal11.gbc?
Version 1.1 of Pokémon Crystal, which fixed some issues with the initial international release. `make crystal11` defines `CRYSTAL11` so the assembly builds the changed version.
## Can't build ROM; "ERROR: `UNION` already defined"
Download [**rgbds 0.3.3**](rgbds). Earlier versions will not work.
## Can't build ROM; "Segmentation fault" from `rgbgfx`
If you are using 64-bit Windows, download [**64-bit Cygwin**](cygwin) and [**64-bit rgbds**](rgbds).
## Can't build ROM; "Section is too big" or "Unable to place section in bank"
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 each, numbered $00 to $7F. The linkerscript **pokecrystal.link** lists which **`SECTION`**s go in which banks. Try moving some code into a new section.
## How do I edit maps?
For `asm` scripts, read [docs/map_scripts.md](docs/map_scripts.md). For `blk` layouts, try [crowdmap](crowdmap) or [Polished Map](polished-map).
## I need more help!
Try asking on IRC or Discord (see [README.md](README.md)).

View File

@ -17,20 +17,20 @@ RGBLINK := rgblink
crystal_obj := \
wram.o \
main.o \
lib/mobile/main.o \
home.o \
audio.o \
home.o \
main.o \
maps.o \
engine/events.o \
wram.o \
data/pokemon/dex_entries.o \
data/pokemon/egg_moves.o \
data/pokemon/evos_attacks.o \
engine/credits.o \
data/egg_moves.o \
data/evos_attacks.o \
data/pokedex/entries.o \
misc/crystal_misc.o \
text/common_text.o \
gfx/pics.o
engine/events.o \
gfx/pics.o \
gfx/sprites.o \
lib/mobile/main.o \
text/common_text.o
crystal11_obj := $(crystal_obj:.o=11.o)
@ -197,15 +197,17 @@ gfx/trainer_card/kris_card.2bpp: rgbgfx += -h
gfx/battle/dude.2bpp: rgbgfx += -h
gfx/font/unused_bold_font.1bpp: tools/gfx += --trim-whitespace
gfx/pokegear/pokegear.2bpp: rgbgfx += -x2
gfx/pokegear/pokegear_sprites.2bpp: tools/gfx += --trim-whitespace
gfx/unknown/ascii_font.2bpp: tools/gfx += --trim-whitespace
gfx/unknown/bold_font.1bpp: tools/gfx += --trim-whitespace
gfx/unknown/egg_animated.2bpp: tools/gfx += --trim-whitespace
gfx/unknown/egg_animated_nonmatching.2bpp: tools/gfx += --remove-duplicates --remove-xflip
gfx/unknown/mobile_splash.2bpp: tools/gfx += --remove-duplicates --remove-xflip
gfx/unknown/pichu_animated.2bpp: tools/gfx += --trim-whitespace
gfx/mobile/ascii_font.2bpp: tools/gfx += --trim-whitespace
gfx/mobile/electro_ball.2bpp: tools/gfx += --trim-whitespace
gfx/mobile/electro_ball_nonmatching.2bpp: tools/gfx += --remove-duplicates --remove-xflip
gfx/mobile/mobile_splash.2bpp: tools/gfx += --remove-duplicates --remove-xflip
gfx/mobile/pichu_animated.2bpp: tools/gfx += --trim-whitespace
gfx/unknown/unknown_egg.2bpp: rgbgfx += -h

View File

@ -4,7 +4,7 @@ INCLUDE "includes.asm"
SECTION "Audio", ROMX
INCLUDE "audio/engine.asm"
INCLUDE "trainers/encounter_music.asm"
INCLUDE "data/trainers/encounter_music.asm"
INCLUDE "audio/music_pointers.asm"
INCLUDE "audio/music/nothing.asm"
INCLUDE "audio/cry_pointers.asm"
@ -157,6 +157,6 @@ INCLUDE "audio/sfx_crystal.asm"
SECTION "Cries", ROMX
CryHeaders:: INCLUDE "audio/cry_headers.asm"
INCLUDE "data/pokemon/cry_headers.asm"
INCLUDE "audio/cries.asm"

View File

@ -245,7 +245,7 @@ UpdateChannels: ; e8125
.Channel1:
ld a, [Danger]
bit 7, a
bit DANGER_ON_F, a
ret nz
.Channel5:
ld hl, Channel1NoteFlags - Channel1
@ -537,9 +537,9 @@ _CheckSFX: ; e82e7
PlayDanger: ; e8307
ld a, [Danger]
bit 7, a
bit DANGER_ON_F, a
ret z
and $7f
and $ff - (1 << DANGER_ON_F)
ld d, a
call _CheckSFX
jr c, .asm_e8335
@ -573,7 +573,7 @@ PlayDanger: ; e8307
jr c, .asm_e833c
xor a
.asm_e833c
or $80
or 1 << DANGER_ON_F
ld [Danger], a
; is hw ch1 on?
ld a, [SoundOutput]
@ -632,9 +632,9 @@ FadeMusic: ; e8358
ld [MusicFadeCount], a
; get SO1 volume
ld a, [Volume]
and $7
and VOLUME_SO1_LEVEL
; which way are we fading?
bit 7, d
bit MUSIC_FADE_IN_F, d
jr nz, .fadein
; fading out
and a
@ -648,7 +648,7 @@ FadeMusic: ; e8358
ld [Volume], a
; did we just get on a bike?
ld a, [PlayerState]
cp $1 ; bicycle
cp PLAYER_BIKE
jr z, .bicycle
push bc
; restart sound
@ -688,7 +688,7 @@ FadeMusic: ; e8358
pop bc
; fade in
ld hl, MusicFade
set 7, [hl]
set MUSIC_FADE_IN_F, [hl]
ret
.fadein
@ -2882,9 +2882,9 @@ LoadMusicByte:: ; e8d76
; e8d80
INCLUDE "data/audio/notes.asm"
INCLUDE "audio/notes.asm"
INCLUDE "data/audio/wave_samples.asm"
INCLUDE "audio/wave_samples.asm"
INCLUDE "audio/drumkits.asm"
@ -2976,7 +2976,7 @@ PlayTrainerEncounterMusic:: ; e900a
ld [MusicFade], a
; play nothing for one frame
push de
ld de, 0 ; id: Music_Nothing
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
; play new song

View File

@ -820,41 +820,7 @@ TryEnemyFlee: ; 3c543
ret
; 3c59a
FleeMons:
SometimesFleeMons: ; 3c59a
db MAGNEMITE
db GRIMER
db TANGELA
db MR__MIME
db EEVEE
db PORYGON
db DRATINI
db DRAGONAIR
db TOGETIC
db UMBREON
db UNOWN
db SNUBBULL
db HERACROSS
db -1
OftenFleeMons: ; 3c5a8
db CUBONE
db ARTICUNO
db ZAPDOS
db MOLTRES
db QUAGSIRE
db DELIBIRD
db PHANPY
db TEDDIURSA
db -1
AlwaysFleeMons: ; 3c5b1
db RAIKOU
db ENTEI
; db SUICUNE
db -1
; 3c5b4
INCLUDE "data/battle/flee_mons.asm"
CompareMovePriority: ; 3c5b4
; Compare the priority of the player and enemy's moves.
@ -876,7 +842,7 @@ GetMovePriority: ; 3c5c5
ld b, a
; Vital throw goes last.
; Vital Throw goes last.
cp VITAL_THROW
ld a, 0
ret z
@ -4454,7 +4420,7 @@ HandleHealingItems: ; 3dcf9
HandleHPHealingItem: ; 3dd2f
callab GetOpponentItem
ld a, b
cp $1
cp HELD_BERRY
ret nz
ld de, EnemyMonHP + 1
ld hl, EnemyMonMaxHP
@ -4856,12 +4822,12 @@ CheckDanger: ; 3df9e
.no_danger
ld hl, Danger
res 7, [hl]
res DANGER_ON_F, [hl]
jr .done
.danger
ld hl, Danger
set 7, [hl]
set DANGER_ON_F, [hl]
.done
ret

View File

@ -1,7 +1,7 @@
dw 0 ; padding
BattleCommandPointers: ; 3fd28
; entries correspond to constants/effect_command_constants.asm
; entries correspond to macros/scripts/effect_commands.asm
dw BattleCommand_CheckTurn ; 34084
dw BattleCommand_CheckObedience ; 343db
dw BattleCommand_UsedMoveText ; 34541

View File

@ -3191,6 +3191,8 @@ BattleCommand_BeatUp: ; 35461
ld a, [wd002]
ld c, a
ld a, [CurBattleMon]
; BUG: this can desynchronize link battles
; Change "cp [hl]" to "cp c" to fix
cp [hl]
ld hl, BattleMonStatus
jr z, .active_mon
@ -9763,6 +9765,7 @@ BattleCommand_ThunderAccuracy: ; 37d94
CheckHiddenOpponent: ; 37daa
; BUG: This routine should account for Lock-On and Mind Reader.
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
@ -9806,7 +9809,7 @@ GetItemHeldEffect: ; 37dd0
ret z
push hl
ld hl, ItemAttributes + 2
ld hl, ItemAttributes + ITEMATTR_EFFECT
dec a
ld c, a
ld b, 0

View File

@ -1,214 +0,0 @@
CalcMagikarpLength: ; fbbfc
; Return Magikarp's length (in mm) at wMagikarpLength (big endian).
;
; input:
; de: EnemyMonDVs
; bc: PlayerID
; This function is poorly commented.
; In short, it generates a value between 190 and 1786 using
; a Magikarp's DVs and its trainer ID. This value is further
; filtered in LoadEnemyMon to make longer Magikarp even rarer.
; The value is generated from a lookup table.
; The index is determined by the dv xored with the player's trainer id.
; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id)
; if bc < 10: [wMagikarpLength] = c + 190
; if bc >= $ff00: [wMagikarpLength] = c + 1370
; else: [wMagikarpLength] = z * 100 + (bc - x) / y
; X, Y, and Z depend on the value of b as follows:
; if b = 0: x = 310, y = 2, z = 3
; if b = 1: x = 710, y = 4, z = 4
; if b = 2-9: x = 2710, y = 20, z = 5
; if b = 10-29: x = 7710, y = 50, z = 6
; if b = 30-68: x = 17710, y = 100, z = 7
; if b = 69-126: x = 32710, y = 150, z = 8
; if b = 127-185: x = 47710, y = 150, z = 9
; if b = 186-224: x = 57710, y = 100, z = 10
; if b = 225-243: x = 62710, y = 50, z = 11
; if b = 244-251: x = 64710, y = 20, z = 12
; if b = 252-253: x = 65210, y = 5, z = 13
; if b = 254: x = 65410, y = 2, z = 14
; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id)
; id
ld h, b
ld l, c
ld a, [hli]
ld b, a
ld c, [hl]
rrc b
rrc c
; dv
ld a, [de]
inc de
rrca
rrca
xor b
ld b, a
ld a, [de]
rrca
rrca
xor c
ld c, a
; if bc < 10:
; de = bc + 190
; break
ld a, b
and a
jr nz, .no
ld a, c
cp 10
jr nc, .no
ld hl, 190
add hl, bc
ld d, h
ld e, l
jr .done
.no
ld hl, .Lengths
ld a, 2
ld [wd265], a
.read
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
call .BCLessThanDE
jr nc, .next
; c = (bc - de) / [hl]
call .BCMinusDE
ld a, b
ld [hDividend + 0], a
ld a, c
ld [hDividend + 1], a
ld a, [hl]
ld [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 2]
ld c, a
; de = c + 100 * (2 + i)
xor a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
ld a, 100
ld [hMultiplicand + 2], a
ld a, [wd265]
ld [hMultiplier], a
call Multiply
ld b, 0
ld a, [hProduct + 3]
add c
ld e, a
ld a, [hProduct + 2]
adc b
ld d, a
jr .done
.next
inc hl ; align to next triplet
ld a, [wd265]
inc a
ld [wd265], a
cp 16
jr c, .read
call .BCMinusDE
ld hl, 1600
add hl, bc
ld d, h
ld e, l
.done
; hl = de * 10
ld h, d
ld l, e
add hl, hl
add hl, hl
add hl, de
add hl, hl
; hl = hl / 254
ld de, -254
ld a, -1
.div_254
inc a
add hl, de
jr c, .div_254
; d, e = hl / 12, hl % 12
ld d, 0
.mod_12
cp 12
jr c, .ok
sub 12
inc d
jr .mod_12
.ok
ld e, a
ld hl, wMagikarpLength
ld [hl], d
inc hl
ld [hl], e
ret
; fbc9a
.BCLessThanDE: ; fbc9a
; Intention: Return bc < de.
; Reality: Return b < d.
ld a, b
cp d
ret c
ret nc ; whoops
ld a, c
cp e
ret
; fbca1
.BCMinusDE: ; fbca1
; bc -= de
ld a, c
sub e
ld c, a
ld a, b
sbc d
ld b, a
ret
; fbca8
.Lengths: ; fbca8
; ????, divisor
dwb 110, 1
dwb 310, 2
dwb 710, 4
dwb 2710, 20
dwb 7710, 50
dwb 17710, 100
dwb 32710, 150
dwb 47710, 150
dwb 57710, 100
dwb 62710, 50
dwb 64710, 20
dwb 65210, 5
dwb 65410, 2
dwb 65510, 1 ; not used
; fbcd2

View File

@ -1,4 +1,5 @@
; MoveDescriptions: ; 2cb52
MoveDescriptions:: ; 2cb52
; entries correspond to move ids (see constants/move_constants.asm)
dw PoundDescription
dw KarateChopDescription
dw DoubleslapDescription

View File

@ -1,3 +1,5 @@
MoveEffects: ; 2732e
NormalHit:
checkobedience
usedmovetext
@ -571,7 +573,7 @@ DefenseDownHit:
supereffectivetext
checkdestinybond
buildopponentrage
effectchance
effectchance ; bug: duplicate effectchance shouldn't be here
defensedown
statdownmessage
endmove

View File

@ -1,3 +1,4 @@
MoveEffectsPointers: ; 271f4
; entries correspond to EFFECT_* constants
dw NormalHit
dw DoSleep

View File

@ -1,4 +1,3 @@
Moves: ; 41afb
; Characteristics of each move.
move: MACRO
@ -11,6 +10,8 @@ move: MACRO
db \7 percent ; effect chance
ENDM
Moves: ; 41afb
; entries correspond to constants/move_constants.asm
move POUND, EFFECT_NORMAL_HIT, 40, NORMAL, 100, 35, 0
move KARATE_CHOP, EFFECT_NORMAL_HIT, 50, FIGHTING, 100, 25, 0
move DOUBLESLAP, EFFECT_MULTI_HIT, 15, NORMAL, 85, 10, 0

File diff suppressed because it is too large Load Diff

View File

@ -450,7 +450,7 @@ GetBallAnimPal: ; cd249 (33:5249)
ret
; cd26c (33:526c)
INCLUDE "data/ball_colors.asm"
INCLUDE "data/battle/ball_colors.asm"
BattleAnimFunction_10: ; cd284 (33:5284)
call BattleAnim_AnonJumptable

View File

@ -1,12 +1,11 @@
AnimObjGFX: ; cfcf6
object_gfx: MACRO
; # tiles, label
db \1
dba \2
ENDM
AnimObjGFX: ; cfcf6
; entries correspond to ANIM_GFX_* constants
object_gfx 0, AnimObj00GFX
object_gfx 21, AnimObjHitGFX
object_gfx 6, AnimObjCutGFX

View File

@ -1,13 +1,12 @@
INCLUDE "macros.asm"
INCLUDE "gbhw.asm"
INCLUDE "hram.asm"
INCLUDE "constants/hardware_constants.asm"
INCLUDE "constants/wram_constants.asm"
INCLUDE "constants/pokemon_constants.asm"
INCLUDE "constants/type_constants.asm"
INCLUDE "constants/move_constants.asm"
INCLUDE "constants/effect_command_constants.asm"
INCLUDE "constants/battle_constants.asm"
INCLUDE "constants/map_dimension_constants.asm"
INCLUDE "constants/map_constants.asm"
@ -22,6 +21,7 @@ INCLUDE "constants/music_constants.asm"
INCLUDE "constants/sfx_constants.asm"
INCLUDE "constants/animation_constants.asm"
INCLUDE "constants/phone_constants.asm"
INCLUDE "constants/credits_constants.asm"
INCLUDE "constants/gfx_constants.asm"
INCLUDE "constants/input_constants.asm"
INCLUDE "constants/pokemon_data_constants.asm"

View File

@ -1,5 +1,5 @@
; pitch
; FrequencyTable indexes (see data/audio/notes.asm)
; FrequencyTable indexes (see audio/notes.asm)
const_def
const __ ; 0
const C_ ; 1
@ -67,4 +67,22 @@ NUM_CHANNELS EQU const_value
const NOTE_VIBRATO_OVERRIDE ; 6
; Volume:
VOLUME_SO1_F EQU 3
VOLUME_SO2_F EQU 7
VOLUME_SO1_LEVEL EQU %00000111
VOLUME_SO2_LEVEL EQU %01110000
MAX_VOLUME EQU $77
; SoundInput:
SOUND_INPUT_CH1_F EQU 0
SOUND_INPUT_CH2_F EQU 1
SOUND_INPUT_CH3_F EQU 2
SOUND_INPUT_CH4_F EQU 3
SOUND_INPUT_GLOBAL_F EQU 7
; Danger:
DANGER_PITCH_F EQU 4
DANGER_ON_F EQU 7
; MusicFade:
MUSIC_FADE_IN_F EQU 7

View File

@ -1,4 +1,4 @@
; BattleTowerAction arguments (see misc/battle_tower_5c.asm)
; BattleTowerAction arguments (see mobile/battle_tower_5c.asm)
const_def
const BATTLETOWERACTION_CHECK_EXPLANATION_READ
const BATTLETOWERACTION_SET_EXPLANATION_READ
@ -20,8 +20,8 @@
const BATTLETOWERACTION_11 ; store 0 in 5:aa8d
const BATTLETOWERACTION_12 ; store 1 in 5:aa8d
const BATTLETOWERACTION_13 ; check 5:aa8d
const BATTLETOWERACTION_14 ; if save file is yours: bit 0, [s1_be4f]
const BATTLETOWERACTION_15 ; set 0, [s1_be4f]
const BATTLETOWERACTION_14 ; if save file is yours: bit 0, [sBattleTowerSaveFileFlags]
const BATTLETOWERACTION_15 ; set 0, [sBattleTowerSaveFileFlags]
const BATTLETOWERACTION_16 ; update time in SRAM bank 5
const BATTLETOWERACTION_17 ; check time in SRAM bank 5
const BATTLETOWERACTION_LEVEL_CHECK

Some files were not shown because too many files have changed in this diff Show More