diff options
author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2018-07-29 19:56:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-29 19:56:54 -0400 |
commit | 98e670f3637b5f845a91423ee2d624d2f1e331a6 (patch) | |
tree | 20bacd2c3cd766eedddd636de59a99af1d662866 /docs | |
parent | 2ec900d96c3b6020be0816151b9ad606c04114b5 (diff) | |
parent | e346cc7b4152578106f7708363b41d076a3e8d52 (diff) |
Merge pull request #548 from Rangi42/master
Add meaningful aliases for wd265
Diffstat (limited to 'docs')
-rw-r--r-- | docs/bugs_and_glitches.md | 177 | ||||
-rw-r--r-- | docs/design_flaws.md | 86 |
2 files changed, 132 insertions, 131 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 757f16e7a..2f4f37600 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -306,7 +306,7 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider **Fix:** Edit `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): ```diff --CheckHiddenOpponent: + CheckHiddenOpponent: -; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly. - ld a, BATTLE_VARS_SUBSTATUS3_OPP - call GetBattleVar @@ -887,20 +887,20 @@ CopyPokemonName_Buffer1_Buffer3: ([Video](https://www.youtube.com/watch?v=eij_1060SMc)) -**Fix:** +There are three things wrong here: -There's three things wrong here. +- `wEnemyMonLevel` isn't initialized yet +- `wBattleMonLevel` gets overwritten after it's initialized by `FindFirstAliveMonAndStartBattle` +- `wBattleMonLevel` isn't initialized until much later when the battle is with a trainer -* `wEnemyMonLevel` doesn't have the value its name implies yet; it'll be populated later from `wCurPartyLevel`. -* `wBattleMonLevel` gets overwritten between when the value is written in `FindFirstAliveMonAndStartBattle` and when it's read. -* `wBattleMonLevel` isn't set until much later when the battle is with a trainer; extra code is needed to read a trainer's party and get the level of their lead Pokémon. +**Fix:** -First, in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm): +First, edit [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm): ```diff -StartTrainerBattle_DetermineWhichAnimation: -; The screen flashes a different number of times depending on the level of -; your lead Pokemon relative to the opponent's. + StartTrainerBattle_DetermineWhichAnimation: + ; The screen flashes a different number of times depending on the level of + ; your lead Pokemon relative to the opponent's. -; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever -; values happen to be there will determine the animation. + ld a, [wOtherTrainerClass] @@ -927,43 +927,43 @@ StartTrainerBattle_DetermineWhichAnimation: ld de, 0 - ld a, [wBattleMonLevel] + ld a, [hl] - add 3 + add 3 - ld hl, wEnemyMonLevel + ld hl, wCurPartyLevel - cp [hl] - jr nc, .not_stronger - set TRANS_STRONGER_F, e -.not_stronger - ld a, [wEnvironment] - cp CAVE - jr z, .cave - cp ENVIRONMENT_5 - jr z, .cave - cp DUNGEON - jr z, .cave - set TRANS_NO_CAVE_F, e -.cave - ld hl, .StartingPoints - add hl, de - ld a, [hl] - ld [wJumptableIndex], a - ret + cp [hl] + jr nc, .not_stronger + set TRANS_STRONGER_F, e + .not_stronger + ld a, [wEnvironment] + cp CAVE + jr z, .cave + cp ENVIRONMENT_5 + jr z, .cave + cp DUNGEON + jr z, .cave + set TRANS_NO_CAVE_F, e + .cave + ld hl, .StartingPoints + add hl, de + ld a, [hl] + ld [wJumptableIndex], a + ret -.StartingPoints: -; entries correspond to TRANS_* constants - db BATTLETRANSITION_CAVE - db BATTLETRANSITION_CAVE_STRONGER - db BATTLETRANSITION_NO_CAVE - db BATTLETRANSITION_NO_CAVE_STRONGER + .StartingPoints: + ; entries correspond to TRANS_* constants + db BATTLETRANSITION_CAVE + db BATTLETRANSITION_CAVE_STRONGER + db BATTLETRANSITION_NO_CAVE + db BATTLETRANSITION_NO_CAVE_STRONGER ``` -In [engine/battle/start_battle.asm](/engine/battle/start_battle.asm): +Then edit [engine/battle/start_battle.asm](/engine/battle/start_battle.asm): ```diff -FindFirstAliveMonAndStartBattle: - xor a - ld [hMapAnims], a - call DelayFrame + FindFirstAliveMonAndStartBattle: + xor a + ld [hMapAnims], a + call DelayFrame - ld b, 6 - ld hl, wPartyMon1HP - ld de, PARTYMON_STRUCT_LENGTH - 1 @@ -981,57 +981,58 @@ FindFirstAliveMonAndStartBattle: - add hl, de - ld a, [hl] - ld [wBattleMonLevel], a - predef DoBattleTransition + predef DoBattleTransition ``` -Finally, add this code to the end of [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer_party.asm): +Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer_party.asm): ```asm -SetTrainerBattleLevel: - ld a, 255 - ld [wCurPartyLevel], a - - ld a, [wInBattleTowerBattle] - bit 0, a - ret nz - - ld a, [wLinkMode] - and a - ret nz - - ld a, [wOtherTrainerClass] - dec a - ld c, a - ld b, 0 - ld hl, TrainerGroups -rept 2 - add hl, bc -endr - ld a, [hli] - ld h, [hl] - ld l, a - - ld a, [wOtherTrainerID] - ld b, a -.skip_trainer - dec b - jr z, .got_trainer -.loop1 - ld a, [hli] - cp $ff - jr nz, .loop1 - jr .skip_trainer -.got_trainer - -.skip_name - ld a, [hli] - cp "@" - jr nz, .skip_name - - inc hl - ld a, [hl] - ld [wCurPartyLevel], a - ret + INCLUDE "data/trainers/parties.asm" ++ ++SetTrainerBattleLevel: ++ ld a, 255 ++ ld [wCurPartyLevel], a ++ ++ ld a, [wInBattleTowerBattle] ++ bit 0, a ++ ret nz ++ ++ ld a, [wLinkMode] ++ and a ++ ret nz ++ ++ ld a, [wOtherTrainerClass] ++ dec a ++ ld c, a ++ ld b, 0 ++ ld hl, TrainerGroups ++ add hl, bc ++ add hl, bc ++ ld a, [hli] ++ ld h, [hl] ++ ld l, a ++ ++ ld a, [wOtherTrainerID] ++ ld b, a ++.skip_trainer ++ dec b ++ jr z, .got_trainer ++.loop1 ++ ld a, [hli] ++ cp $ff ++ jr nz, .loop1 ++ jr .skip_trainer ++.got_trainer ++ ++.skip_name ++ ld a, [hli] ++ cp "@" ++ jr nz, .skip_name ++ ++ inc hl ++ ld a, [hl] ++ ld [wCurPartyLevel], a ++ ret ``` @@ -1138,7 +1139,7 @@ The exact cause of this bug is unknown. ```diff .Cry: - call Pokedex_GetSelectedMon -- ld a, [wd265] +- ld a, [wTempSpecies] - call GetCryIndex - ld e, c - ld d, b diff --git a/docs/design_flaws.md b/docs/design_flaws.md index c7a032702..80c34dfdb 100644 --- a/docs/design_flaws.md +++ b/docs/design_flaws.md @@ -153,43 +153,43 @@ Don't enforce `org $4000` in pokecrystal.link. Modify `GetFrontpicPointer`: ```diff - ld a, [wCurPartySpecies] - cp UNOWN - jr z, .unown - ld a, [wCurPartySpecies] + ld a, [wCurPartySpecies] + cp UNOWN + jr z, .unown + ld a, [wCurPartySpecies] + ld hl, PokemonPicPointers - ld d, BANK(PokemonPicPointers) - jr .ok + ld d, BANK(PokemonPicPointers) + jr .ok -.unown - ld a, [wUnownLetter] + .unown + ld a, [wUnownLetter] + ld hl, UnownPicPointers - ld d, BANK(UnownPicPointers) + ld d, BANK(UnownPicPointers) -.ok + .ok - ld hl, PokemonPicPointers ; UnownPicPointers - dec a - ld bc, 6 - call AddNTimes + dec a + ld bc, 6 + call AddNTimes ``` And `GetMonBackpic`: -```asm +```diff - ; 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 d, BANK(PokemonPicPointers) - cp UNOWN - jr nz, .ok - ld a, c + ld d, BANK(PokemonPicPointers) + cp UNOWN + jr nz, .ok + ld a, c + ld hl, UnownPicPointers - ld d, BANK(UnownPicPointers) -.ok - dec a - ld bc, 6 - call AddNTimes + ld d, BANK(UnownPicPointers) + .ok + dec a + ld bc, 6 + call AddNTimes ``` @@ -273,12 +273,12 @@ Modify `Pokedex_LoadAnyFootprint`: ```diff - push hl - ld e, l - ld d, h - ld hl, vTiles2 tile $62 + ld e, l + ld d, h + ld hl, vTiles2 tile $62 - lb bc, BANK(Footprints), 2 + lb bc, BANK(Footprints), 4 - call Request1bpp + call Request1bpp - pop hl - - ; Whoever was editing footprints forgot to fix their @@ -359,9 +359,9 @@ Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data. Modify engine/items/items.asm: ```diff -GetTMHMNumber:: -; Return the number of a TM/HM by item id c. - ld a, c + GetTMHMNumber:: + ; Return the number of a TM/HM by item id c. + ld a, c -; Skip any dummy items. - cp ITEM_C3 ; TM04-05 - jr c, .done @@ -371,14 +371,14 @@ GetTMHMNumber:: -.skip - dec a -.done - sub TM01 - inc a - ld c, a - ret - -GetNumberedTMHM: -; Return the item id of a TM/HM by number c. - ld a, c + sub TM01 + inc a + ld c, a + ret + + GetNumberedTMHM: + ; Return the item id of a TM/HM by number c. + ld a, c -; Skip any gaps. - cp ITEM_C3 - (TM01 - 1) - jr c, .done @@ -389,10 +389,10 @@ GetNumberedTMHM: -.skip_one - inc a -.done - add TM01 - dec a - ld c, a - ret + add TM01 + dec a + ld c, a + ret ``` |