mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Merge pull request #522 from ketsuban/the-diffening
Convert code samples to diffs
This commit is contained in:
commit
dc1d0217a1
@ -76,21 +76,21 @@ This is a bug with `SpeciesItemBoost` in [engine/battle/effect_commands.asm](/en
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
; Double the stat
|
; Double the stat
|
||||||
sla l
|
sla l
|
||||||
rl h
|
rl h
|
||||||
|
+
|
||||||
ld a, HIGH(MAX_STAT_VALUE)
|
+ ld a, HIGH(MAX_STAT_VALUE)
|
||||||
cp h
|
+ cp h
|
||||||
jr c, .cap
|
+ jr c, .cap
|
||||||
ld a, LOW(MAX_STAT_VALUE)
|
+ ld a, LOW(MAX_STAT_VALUE)
|
||||||
cp l
|
+ cp l
|
||||||
ret nc
|
+ ret nc
|
||||||
|
+
|
||||||
.cap
|
+.cap
|
||||||
ld h, HIGH(MAX_STAT_VALUE)
|
+ ld h, HIGH(MAX_STAT_VALUE)
|
||||||
ld l, LOW(MAX_STAT_VALUE)
|
+ ld l, LOW(MAX_STAT_VALUE)
|
||||||
ret
|
ret
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ This is a bug with `DittoMetalPowder` in [engine/battle/effect_commands.asm](/en
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
ld a, c
|
ld a, c
|
||||||
srl a
|
srl a
|
||||||
add c
|
add c
|
||||||
@ -138,17 +138,17 @@ This is a bug with `DittoMetalPowder` in [engine/battle/effect_commands.asm](/en
|
|||||||
.done
|
.done
|
||||||
scf
|
scf
|
||||||
rr c
|
rr c
|
||||||
|
+
|
||||||
ld a, HIGH(MAX_STAT_VALUE)
|
+ ld a, HIGH(MAX_STAT_VALUE)
|
||||||
cp b
|
+ cp b
|
||||||
jr c, .cap
|
+ jr c, .cap
|
||||||
ld a, LOW(MAX_STAT_VALUE)
|
+ ld a, LOW(MAX_STAT_VALUE)
|
||||||
cp c
|
+ cp c
|
||||||
ret nc
|
+ ret nc
|
||||||
|
+
|
||||||
.cap
|
+.cap
|
||||||
ld b, HIGH(MAX_STAT_VALUE)
|
+ ld b, HIGH(MAX_STAT_VALUE)
|
||||||
ld c, LOW(MAX_STAT_VALUE)
|
+ ld c, LOW(MAX_STAT_VALUE)
|
||||||
ret
|
ret
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -430,16 +430,16 @@ BattleCommand_BeatUpFailText:
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
BattleCommand_BeatUpFailText:
|
BattleCommand_BeatUpFailText:
|
||||||
; beatupfailtext
|
; beatupfailtext
|
||||||
|
|
||||||
ld a, [wBeatUpHitAtLeastOnce]
|
ld a, [wBeatUpHitAtLeastOnce]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
|
+
|
||||||
inc a
|
+ inc a
|
||||||
ld [wAttackMissed], a
|
+ ld [wAttackMissed], a
|
||||||
|
|
||||||
jp PrintButItFailed
|
jp PrintButItFailed
|
||||||
```
|
```
|
||||||
@ -640,22 +640,22 @@ CalcExpAtLevel:
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
CalcExpAtLevel:
|
CalcExpAtLevel:
|
||||||
; (a/b)*n**3 + c*n**2 + d*n - e
|
; (a/b)*n**3 + c*n**2 + d*n - e
|
||||||
ld a, d
|
+ ld a, d
|
||||||
cp 1
|
+ cp 1
|
||||||
jr nz, .UseExpFormula
|
+ jr nz, .UseExpFormula
|
||||||
; Pokémon have 0 experience at level 1
|
+; Pokémon have 0 experience at level 1
|
||||||
xor a
|
+ xor a
|
||||||
ld hl, hProduct
|
+ ld hl, hProduct
|
||||||
ld [hli], a
|
+ ld [hli], a
|
||||||
ld [hli], a
|
+ ld [hli], a
|
||||||
ld [hli], a
|
+ ld [hli], a
|
||||||
ld [hl], a
|
+ ld [hl], a
|
||||||
ret
|
+ ret
|
||||||
|
+
|
||||||
.UseExpFormula
|
+.UseExpFormula
|
||||||
ld a, [wBaseGrowthRate]
|
ld a, [wBaseGrowthRate]
|
||||||
add a
|
add a
|
||||||
add a
|
add a
|
||||||
@ -864,10 +864,11 @@ HappinessData_DaisysGrooming:
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
HappinessData_DaisysGrooming:
|
HappinessData_DaisysGrooming:
|
||||||
db $80, 2, HAPPINESS_GROOMING ; 50% chance
|
- db $ff, 2, HAPPINESS_GROOMING ; 99.6% chance
|
||||||
db $ff, 2, HAPPINESS_GROOMING ; 50% chance
|
+ db $80, 2, HAPPINESS_GROOMING ; 50% chance
|
||||||
|
+ db $ff, 2, HAPPINESS_GROOMING ; 50% chance
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -1061,18 +1062,18 @@ This is a bug with `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
ld de, MUSIC_ROCKET_BATTLE
|
ld de, MUSIC_ROCKET_BATTLE
|
||||||
cp GRUNTM
|
cp GRUNTM
|
||||||
jr z, .done
|
jr z, .done
|
||||||
cp GRUNTF
|
cp GRUNTF
|
||||||
jr z, .done
|
jr z, .done
|
||||||
cp EXECUTIVEM
|
+ cp EXECUTIVEM
|
||||||
jr z, .done
|
+ jr z, .done
|
||||||
cp EXECUTIVEF
|
+ cp EXECUTIVEF
|
||||||
jr z, .done
|
+ jr z, .done
|
||||||
cp SCIENTIST
|
+ cp SCIENTIST
|
||||||
jr z, .done
|
+ jr z, .done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -1107,10 +1108,12 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_move
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
ld a, [wWalkingDirection]
|
ld a, [wWalkingDirection]
|
||||||
cp STANDING
|
- ; cp STANDING
|
||||||
jr z, .not_warp
|
- ; jr z, .not_warp
|
||||||
|
+ cp STANDING
|
||||||
|
+ jr z, .not_warp
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .EdgeWarps
|
ld hl, .EdgeWarps
|
||||||
@ -1122,6 +1125,9 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_move
|
|||||||
ld a, 1
|
ld a, 1
|
||||||
ld [wd041], a
|
ld [wd041], a
|
||||||
ld a, [wWalkingDirection]
|
ld a, [wWalkingDirection]
|
||||||
|
- ; This is in the wrong place.
|
||||||
|
- cp STANDING
|
||||||
|
- jr z, .not_warp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -1303,15 +1309,27 @@ This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/i
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
ld hl, wEnemySubStatus5
|
ld hl, wEnemySubStatus5
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
push af
|
push af
|
||||||
set SUBSTATUS_TRANSFORMED, [hl]
|
set SUBSTATUS_TRANSFORMED, [hl]
|
||||||
|
|
||||||
|
-; This code is buggy. Any wild Pokémon that has Transformed will be
|
||||||
|
-; caught as a Ditto, even if it was something else like Mew.
|
||||||
|
-; To fix, do not set [wTempEnemyMonSpecies] to DITTO.
|
||||||
bit SUBSTATUS_TRANSFORMED, a
|
bit SUBSTATUS_TRANSFORMED, a
|
||||||
jr nz, .load_data
|
- jr nz, .ditto
|
||||||
|
- jr .not_ditto
|
||||||
|
+ jr nz, .load_data
|
||||||
|
|
||||||
|
-.ditto
|
||||||
|
- ld a, DITTO
|
||||||
|
- ld [wTempEnemyMonSpecies], a
|
||||||
|
- jr .load_data
|
||||||
|
-
|
||||||
|
-.not_ditto
|
||||||
|
- set SUBSTATUS_TRANSFORMED, [hl]
|
||||||
ld hl, wEnemyBackupDVs
|
ld hl, wEnemyBackupDVs
|
||||||
ld a, [wEnemyMonDVs]
|
ld a, [wEnemyMonDVs]
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
@ -1347,12 +1365,14 @@ This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/i
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
.room_in_party
|
.room_in_party
|
||||||
xor a
|
xor a
|
||||||
ld [wWildMon], a
|
ld [wWildMon], a
|
||||||
ld a, [wBattleType]
|
- ld a, [wCurItem]
|
||||||
cp BATTLETYPE_CONTEST
|
- cp PARK_BALL
|
||||||
|
+ ld a, [wBattleType]
|
||||||
|
+ cp BATTLETYPE_CONTEST
|
||||||
call nz, ReturnToBattle_UseBall
|
call nz, ReturnToBattle_UseBall
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -1429,10 +1449,10 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i
|
|||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
and a
|
and a
|
||||||
jr z, .nope
|
jr z, .nope
|
||||||
cp EVOLVE_STAT
|
+ cp EVOLVE_STAT
|
||||||
jr nz, .not_four_bytes
|
+ jr nz, .not_four_bytes
|
||||||
inc hl
|
+ inc hl
|
||||||
.not_four_bytes
|
+.not_four_bytes
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
cp EVOLVE_ITEM
|
cp EVOLVE_ITEM
|
||||||
@ -1542,11 +1562,12 @@ ValidateTempWildMonSpecies:
|
|||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [wCurPartyLevel], a
|
ld [wCurPartyLevel], a
|
||||||
ld b, [hl]
|
ld b, [hl]
|
||||||
ld a, b
|
- ; ld a, b
|
||||||
|
+ ld a, b
|
||||||
call ValidateTempWildMonSpecies
|
call ValidateTempWildMonSpecies
|
||||||
jr c, .nowildbattle
|
jr c, .nowildbattle
|
||||||
|
|
||||||
|
@ -152,21 +152,22 @@ Don't enforce `org $4000` in pokecrystal.link.
|
|||||||
|
|
||||||
Modify `GetFrontpicPointer`:
|
Modify `GetFrontpicPointer`:
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
ld a, [wCurPartySpecies]
|
ld a, [wCurPartySpecies]
|
||||||
cp UNOWN
|
cp UNOWN
|
||||||
jr z, .unown
|
jr z, .unown
|
||||||
ld a, [wCurPartySpecies]
|
ld a, [wCurPartySpecies]
|
||||||
ld hl, PokemonPicPointers
|
+ ld hl, PokemonPicPointers
|
||||||
ld d, BANK(PokemonPicPointers)
|
ld d, BANK(PokemonPicPointers)
|
||||||
jr .ok
|
jr .ok
|
||||||
|
|
||||||
.unown
|
.unown
|
||||||
ld a, [wUnownLetter]
|
ld a, [wUnownLetter]
|
||||||
ld hl, UnownPicPointers
|
+ ld hl, UnownPicPointers
|
||||||
ld d, BANK(UnownPicPointers)
|
ld d, BANK(UnownPicPointers)
|
||||||
|
|
||||||
.ok
|
.ok
|
||||||
|
- ld hl, PokemonPicPointers ; UnownPicPointers
|
||||||
dec a
|
dec a
|
||||||
ld bc, 6
|
ld bc, 6
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
@ -175,13 +176,15 @@ Modify `GetFrontpicPointer`:
|
|||||||
And `GetMonBackpic`:
|
And `GetMonBackpic`:
|
||||||
|
|
||||||
```asm
|
```asm
|
||||||
|
- ; These are assumed to be at the same address in their respective banks.
|
||||||
|
- ld hl, PokemonPicPointers ; UnownPicPointers
|
||||||
ld a, b
|
ld a, b
|
||||||
ld hl, PokemonPicPointers
|
+ ld hl, PokemonPicPointers
|
||||||
ld d, BANK(PokemonPicPointers)
|
ld d, BANK(PokemonPicPointers)
|
||||||
cp UNOWN
|
cp UNOWN
|
||||||
jr nz, .ok
|
jr nz, .ok
|
||||||
ld a, c
|
ld a, c
|
||||||
ld hl, UnownPicPointers
|
+ ld hl, UnownPicPointers
|
||||||
ld d, BANK(UnownPicPointers)
|
ld d, BANK(UnownPicPointers)
|
||||||
.ok
|
.ok
|
||||||
dec a
|
dec a
|
||||||
@ -268,12 +271,26 @@ INCBIN "gfx/footprints/wartortle.1bpp"
|
|||||||
|
|
||||||
Modify `Pokedex_LoadAnyFootprint`:
|
Modify `Pokedex_LoadAnyFootprint`:
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
|
- push hl
|
||||||
ld e, l
|
ld e, l
|
||||||
ld d, h
|
ld d, h
|
||||||
ld hl, vTiles2 tile $62
|
ld hl, vTiles2 tile $62
|
||||||
lb bc, BANK(Footprints), 4
|
- lb bc, BANK(Footprints), 2
|
||||||
|
+ lb bc, BANK(Footprints), 4
|
||||||
call Request1bpp
|
call Request1bpp
|
||||||
|
- pop hl
|
||||||
|
-
|
||||||
|
- ; Whoever was editing footprints forgot to fix their
|
||||||
|
- ; tile editor. Now each bottom half is 8 tiles off.
|
||||||
|
- ld de, 8 tiles
|
||||||
|
- add hl, de
|
||||||
|
-
|
||||||
|
- ld e, l
|
||||||
|
- ld d, h
|
||||||
|
- ld hl, vTiles2 tile $64
|
||||||
|
- lb bc, BANK(Footprints), 2
|
||||||
|
- call Request1bpp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -341,10 +358,19 @@ Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data.
|
|||||||
|
|
||||||
Modify engine/items/items.asm:
|
Modify engine/items/items.asm:
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
GetTMHMNumber::
|
GetTMHMNumber::
|
||||||
; Return the number of a TM/HM by item id c.
|
; Return the number of a TM/HM by item id c.
|
||||||
ld a, c
|
ld a, c
|
||||||
|
-; Skip any dummy items.
|
||||||
|
- cp ITEM_C3 ; TM04-05
|
||||||
|
- jr c, .done
|
||||||
|
- cp ITEM_DC ; TM28-29
|
||||||
|
- jr c, .skip
|
||||||
|
- dec a
|
||||||
|
-.skip
|
||||||
|
- dec a
|
||||||
|
-.done
|
||||||
sub TM01
|
sub TM01
|
||||||
inc a
|
inc a
|
||||||
ld c, a
|
ld c, a
|
||||||
@ -353,6 +379,16 @@ GetTMHMNumber::
|
|||||||
GetNumberedTMHM:
|
GetNumberedTMHM:
|
||||||
; Return the item id of a TM/HM by number c.
|
; Return the item id of a TM/HM by number c.
|
||||||
ld a, c
|
ld a, c
|
||||||
|
-; Skip any gaps.
|
||||||
|
- cp ITEM_C3 - (TM01 - 1)
|
||||||
|
- jr c, .done
|
||||||
|
- cp ITEM_DC - (TM01 - 1) - 1
|
||||||
|
- jr c, .skip_one
|
||||||
|
-.skip_two
|
||||||
|
- inc a
|
||||||
|
-.skip_one
|
||||||
|
- inc a
|
||||||
|
-.done
|
||||||
add TM01
|
add TM01
|
||||||
dec a
|
dec a
|
||||||
ld c, a
|
ld c, a
|
||||||
|
Loading…
Reference in New Issue
Block a user