Merge pull request #548 from Rangi42/master

Add meaningful aliases for wd265
This commit is contained in:
Rangi 2018-07-29 19:56:54 -04:00 committed by GitHub
commit 98e670f363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
92 changed files with 636 additions and 604 deletions

View File

@ -2422,7 +2422,7 @@ _PlayCry::
add hl, bc
ld a, [wCryLength]
ld [hli], a
ld a, [wCryLength+1]
ld a, [wCryLength + 1]
ld [hl], a
.start
call StartChannel

View File

@ -63,8 +63,8 @@ MOVE_LENGTH EQU const_value
const STAT_SATK
NUM_EXP_STATS EQU const_value + -1
const STAT_SDEF
NUM_STATS EQU const_value +- 1
STAT_SPC EQU STAT_SATK
NUM_STATS EQU const_value + -1
NUM_BATTLE_STATS EQU NUM_STATS + -1 ; don't count HP
; stat formula constants
STAT_MIN_NORMAL EQU 5
@ -244,6 +244,12 @@ SUBSTATUS_CURLED EQU 0
const BATTLEACTION_E
const BATTLEACTION_FORFEIT
; wBattlePlayerAction
const_def
const BATTLEPLAYERACTION_USEMOVE
const BATTLEPLAYERACTION_USEITEM
const BATTLEPLAYERACTION_SWITCH
; wBattleResult
const_def
const WIN

View File

@ -39,3 +39,13 @@
const ICON_SLOWPOKE
const ICON_SUDOWOODO
const ICON_BIGMON
; LoadMenuMonIcon.Jumptable indexes (see engine/gfx/mon_icons.asm)
const_def
const MONICON_PARTYMENU
const MONICON_NAMINGSCREEN
const MONICON_MOVES
const MONICON_TRADE
const MONICON_MOBILE1
const MONICON_MOBILE2
const MONICON_UNUSED

View File

@ -87,7 +87,7 @@ SandstormHitsText:
PerishCountText:
text "<USER>'s"
line "PERISH count is @"
deciram wd265, 1, 1
deciram wDeciramBuffer, 1, 1
text "!"
prompt
@ -669,7 +669,7 @@ SpiteEffectText:
text_from_ram wStringBuffer1
text " was"
cont "reduced by @"
deciram wd265, 1, 1
deciram wDeciramBuffer, 1, 1
text "!"
prompt
@ -1029,7 +1029,7 @@ SafeguardProtectText:
MagnitudeText:
text "Magnitude @"
deciram wd265, 1, 1
deciram wDeciramBuffer, 1, 1
text "!"
prompt

View File

@ -41,7 +41,7 @@ UnknownText_0x1bc0a2::
text_from_ram wStringBuffer1
text_start
line "recovered @"
deciram wd1f3, 2, 3
deciram wCurHPAnimDeltaHP, 2, 3
text "HP!"
done
@ -1155,7 +1155,7 @@ Text_BreedingIsNotPossible::
UnknownText_0x1bd0d8::
text "The compatibility"
line "is @"
deciram wd265, 1, 3
deciram wBreedingCompatibility, 1, 3
text "."
cont "Should they breed?"
done

View File

@ -262,7 +262,7 @@ UnknownText_0x1c0531::
text_from_ram wc850
text "'s CARD was"
line "listed as no.@"
deciram wd265, 1, 2
deciram wDeciramBuffer, 1, 2
text "."
prompt

View File

@ -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))
There are 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
**Fix:**
There's three things wrong here.
* `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.
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

View File

@ -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
sub TM01
inc a
ld c, a
ret
GetNumberedTMHM:
; Return the item id of a TM/HM by number c.
ld a, c
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
```

View File

@ -818,7 +818,7 @@ PrintText_UsedItemOn_AND_AIUpdateHUD:
PrintText_UsedItemOn:
ld a, [wCurEnemyItem]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer

View File

@ -171,10 +171,10 @@ AI_Types:
pop bc
pop hl
ld a, [wd265]
ld a, [wTypeMatchup]
and a
jr z, .immune
cp 10 ; 1.0
cp EFFECTIVE
jr z, .checkmove
jr c, .noteffective
@ -415,8 +415,8 @@ AI_Smart_LeechHit:
pop hl
; 60% chance to discourage this move if not very effective.
ld a, [wd265]
cp 10 ; 1.0
ld a, [wTypeMatchup]
cp EFFECTIVE
jr c, .asm_38815
; Do nothing if effectiveness is neutral.
@ -491,8 +491,8 @@ AI_Smart_LockOn:
push hl
push bc
farcall BattleCheckTypeMatchup
ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
pop bc
pop hl
jr c, .asm_3884f
@ -1292,8 +1292,8 @@ AI_Smart_Mimic:
ld [hBattleTurn], a
callfar BattleCheckTypeMatchup
ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
pop hl
jr c, .asm_38bef
jr z, .asm_38bd4
@ -1408,8 +1408,8 @@ AI_Smart_Encore:
predef CheckTypeMatchup
pop hl
ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
jr nc, .asm_38c68
and a
@ -1679,8 +1679,8 @@ AI_Smart_Conversion2:
callfar BattleCheckTypeMatchup
ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
pop hl
jr c, .asm_38dc9
ret z
@ -2293,8 +2293,8 @@ AI_Smart_HiddenPower:
pop hl
; Discourage Hidden Power if not very effective.
ld a, [wd265]
cp 10
ld a, [wTypeMatchup]
cp EFFECTIVE
jr c, .bad
; Discourage Hidden Power if its base power is lower than 50.
@ -2303,8 +2303,8 @@ AI_Smart_HiddenPower:
jr c, .bad
; Encourage Hidden Power if super-effective.
ld a, [wd265]
cp 11
ld a, [wTypeMatchup]
cp EFFECTIVE + 1
jr nc, .good
; Encourage Hidden Power if its base power is 70.
@ -3125,7 +3125,7 @@ AI_Status:
pop bc
pop hl
ld a, [wd265]
ld a, [wTypeMatchup]
and a
jr nz, .checkmove

View File

@ -373,7 +373,7 @@ HandleBerserkGene:
push bc
callfar GetUserItem
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
sub BERSERK_GENE
pop bc
pop de
@ -447,7 +447,7 @@ DetermineMoveOrder:
sub BATTLEACTION_SWITCH1
jr c, .use_move
ld a, [wBattlePlayerAction]
cp $2
cp BATTLEPLAYERACTION_SWITCH
jr nz, .switch
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
@ -472,7 +472,7 @@ DetermineMoveOrder:
.use_move
ld a, [wBattlePlayerAction]
and a
and a ; BATTLEPLAYERACTION_USEMOVE?
jp nz, .player_first
call CompareMovePriority
jr z, .equal_priority
@ -611,7 +611,7 @@ ParsePlayerAction:
.not_encored
ld a, [wBattlePlayerAction]
cp $2
cp BATTLEPLAYERACTION_SWITCH
jr z, .reset_rage
and a
jr nz, .reset_bide
@ -900,7 +900,7 @@ Battle_EnemyFirst:
call ResidualDamage
jp z, HandlePlayerMonFaint
call RefreshBattleHuds
xor a
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@ -949,7 +949,7 @@ Battle_PlayerFirst:
call ResidualDamage
jp z, HandleEnemyMonFaint
call RefreshBattleHuds
xor a
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@ -1161,7 +1161,7 @@ HandlePerishSong:
ret z
dec [hl]
ld a, [hl]
ld [wd265], a
ld [wDeciramBuffer], a
push af
ld hl, PerishCountText
call StdBattleTextBox
@ -1235,7 +1235,7 @@ HandleWrap:
ret nz
ld a, [de]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
ld [wFXAnimID], a
call GetMoveName
dec [hl]
@ -1288,7 +1288,7 @@ HandleLeftovers:
callfar GetUserItem
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld a, b
cp HELD_LEFTOVERS
@ -1397,7 +1397,7 @@ HandleMysteryberry:
push bc
push bc
ld a, [hl]
ld [wd265], a
ld [wTempByteValue], a
ld de, wBattleMonMoves - 1
ld hl, wBattleMonPP
ld a, [hBattleTurn]
@ -1417,7 +1417,7 @@ HandleMysteryberry:
pop de
pop bc
ld a, [wd265]
ld a, [wTempByteValue]
cp [hl]
jr nz, .skip_checks
ld a, [hBattleTurn]
@ -1434,7 +1434,7 @@ HandleMysteryberry:
.skip_checks
callfar GetUserItem
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
xor a
ld [hl], a
call GetPartymonItem
@ -2048,18 +2048,18 @@ HandleEnemyMonFaint:
call CheckMobileBattleError
jp c, WildFled_EnemyFled_LinkBattleCanceled
ld a, $1
ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
jr DoubleSwitch
.player_mon_not_fainted
ld a, $1
ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
xor a
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@ -2088,7 +2088,7 @@ DoubleSwitch:
call PlayerPartyMonEntrance
.done
xor a
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@ -2636,7 +2636,7 @@ HandlePlayerMonFaint:
ld a, c
and a
ret nz
ld a, $1
ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
@ -2716,12 +2716,12 @@ ForcePlayerMonChoice:
ld a, [wLinkMode]
and a
jr z, .skip_link
ld a, $1
ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call LinkBattleSendReceiveAction
.skip_link
xor a
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
call CheckMobileBattleError
jr c, .enemy_fainted_mobile_error
@ -3287,8 +3287,8 @@ LookUpTheEffectivenessOfEveryMove:
pop bc
pop de
pop hl
ld a, [wd265] ; Get The Effectiveness Modifier
cp 10 + 1 ; 1.0 + 0.1
ld a, [wTypeMatchup]
cp EFFECTIVE + 1
jr c, .loop
ld hl, wBuffer1
set 0, [hl]
@ -3319,14 +3319,14 @@ IsThePlayerMonTypesEffectiveAgainstOTMon:
ld [wPlayerMoveStruct + MOVE_TYPE], a
call SetPlayerTurn
callfar BattleCheckTypeMatchup
ld a, [wd265]
cp 10 + 1 ; 1.0 + 0.1
ld a, [wTypeMatchup]
cp EFFECTIVE + 1
jr nc, .super_effective
ld a, [wBattleMonType2]
ld [wPlayerMoveStruct + MOVE_TYPE], a
callfar BattleCheckTypeMatchup
ld a, [wd265]
cp 10 + 1 ; 1.0 + 0.1
ld a, [wTypeMatchup]
cp EFFECTIVE + 1
jr nc, .super_effective
pop bc
ret
@ -3695,7 +3695,7 @@ TryToRunAwayFromBattle:
push hl
push de
ld a, [wBattleMonItem]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
ld b, a
callfar GetItemHeldEffect
ld a, b
@ -3732,7 +3732,7 @@ TryToRunAwayFromBattle:
xor a
ld [hMultiplicand], a
ld a, $20
ld a, 32
ld [hMultiplier], a
call Multiply
ld a, [hProduct + 2]
@ -3772,7 +3772,7 @@ TryToRunAwayFromBattle:
ld a, [hQuotient + 2]
cp b
jr nc, .can_escape
ld a, $1
ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
ld hl, BattleText_CantEscape2
jr .print_inescapable_text
@ -3786,7 +3786,7 @@ TryToRunAwayFromBattle:
.print_inescapable_text
call StdBattleTextBox
ld a, $1
ld a, TRUE
ld [wFailedToFlee], a
call LoadTileMapToTempTileMap
and a
@ -3798,7 +3798,7 @@ TryToRunAwayFromBattle:
ld a, DRAW
jr z, .fled
call LoadTileMapToTempTileMap
xor a
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ld a, $f
ld [wCurMoveNum], a
@ -4429,7 +4429,7 @@ UseConfusionHealingItem:
.heal_status
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr
res SUBSTATUS_CONFUSED, [hl]
@ -4496,7 +4496,7 @@ HandleStatBoostingHeldItems:
jr nz, .loop
pop bc
ld a, [bc]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
push bc
dec hl
dec hl
@ -4952,7 +4952,7 @@ BattleMenu_Pack:
farcall BattlePack
ld a, [wBattlePlayerAction]
and a
and a ; BATTLEPLAYERACTION_USEMOVE?
jr z, .didnt_use_item
jr .got_item
@ -5157,7 +5157,7 @@ TryPlayerSwitch:
jp z, BattleMenuPKMN_Loop
ld a, [wCurBattleMon]
ld [wLastPlayerMon], a
ld a, $2
ld a, BATTLEPLAYERACTION_SWITCH
ld [wBattlePlayerAction], a
call ClearPalettes
call DelayFrame
@ -5270,8 +5270,8 @@ PassedBattleMonEntrance:
ld [wCurBattleMon], a
call AddBattleParticipant
call InitBattleMon
xor a
ld [wd265], a
xor a ; FALSE
ld [wApplyStatLevelMultipliersToEnemy], a
call ApplyStatLevelMultiplierOnAllStats
call SendOutPlayerMon
call EmptyBattleTextBox
@ -5286,11 +5286,11 @@ BattleMenu_Run:
ld hl, wBattleMonSpeed
ld de, wEnemyMonSpeed
call TryToRunAwayFromBattle
ld a, $0
ld a, FALSE
ld [wFailedToFlee], a
ret c
ld a, [wBattlePlayerAction]
and a
and a ; BATTLEPLAYERACTION_USEMOVE?
ret nz
jp BattleMenu
@ -5770,7 +5770,7 @@ ParseEnemyAction:
call EmptyBattleTextBox
call LoadTileMapToTempTileMap
ld a, [wBattlePlayerAction]
and a
and a ; BATTLEPLAYERACTION_USEMOVE?
call z, LinkBattleSendReceiveAction
call Call_LoadTempTileMapToTileMap
ld a, [wBattleAction]
@ -5989,7 +5989,7 @@ LoadEnemyMon:
; Used for Ho-Oh, Lugia and Snorlax encounters
ld a, [wBattleType]
cp BATTLETYPE_FORCEITEM
ld a, [wBaseItems]
ld a, [wBaseItem1]
jr z, .UpdateItem
; Failing that, it's all up to chance
@ -6007,9 +6007,9 @@ LoadEnemyMon:
; From there, an 8% chance for Item2
call BattleRandom
cp 8 percent ; 8% of 25% = 2% Item2
ld a, [wBaseItems]
ld a, [wBaseItem1]
jr nc, .UpdateItem
ld a, [wBaseItems+1]
ld a, [wBaseItem2]
.UpdateItem:
ld [wEnemyMonItem], a
@ -6375,7 +6375,7 @@ LoadEnemyMon:
ld [de], a
ld a, [wTempEnemyMonSpecies]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
@ -6661,14 +6661,14 @@ ApplyStatLevelMultiplierOnAllStats:
call ApplyStatLevelMultiplier
inc c
ld a, c
cp 5
cp NUM_BATTLE_STATS
jr nz, .stat_loop
ret
ApplyStatLevelMultiplier:
push bc
push bc
ld a, [wd265]
ld a, [wApplyStatLevelMultipliersToEnemy]
and a
ld a, c
ld hl, wBattleMonAttack
@ -6718,7 +6718,7 @@ ApplyStatLevelMultiplier:
call Multiply
ld a, [hl]
ld [hDivisor], a
ld b, $4
ld b, 4
call Divide
pop hl
@ -7192,7 +7192,7 @@ GiveExperiencePoints:
add hl, bc
ld a, [hl]
ld [wCurSpecies], a
ld [wd265], a
ld [wTempSpecies], a ; unused?
call GetBaseData
ld hl, MON_MAXHP + 1
add hl, bc
@ -7256,8 +7256,8 @@ GiveExperiencePoints:
call CopyBytes
.transformed
xor a
ld [wd265], a
xor a ; FALSE
ld [wApplyStatLevelMultipliersToEnemy], a
call ApplyStatLevelMultiplierOnAllStats
callfar ApplyStatusEffectOnPlayerStats
callfar BadgeStatBoosts
@ -7299,7 +7299,7 @@ GiveExperiencePoints:
xor a ; PARTYMON
ld [wMonType], a
ld a, [wCurSpecies]
ld [wd265], a
ld [wTempSpecies], a ; unused?
ld a, [wCurPartyLevel]
push af
ld c, a
@ -7359,7 +7359,7 @@ GiveExperiencePoints:
cp 2
ret c
ld [wd265], a
ld [wTempByteValue], a
ld hl, wEnemyMonBaseStats
ld c, wEnemyMonEnd - wEnemyMonBaseStats
.count_loop2
@ -7367,7 +7367,7 @@ GiveExperiencePoints:
ld [hDividend + 0], a
ld a, [hl]
ld [hDividend + 1], a
ld a, [wd265]
ld a, [wTempByteValue]
ld [hDivisor], a
ld b, 2
call Divide

View File

@ -2,7 +2,7 @@ DoPlayerTurn:
call SetPlayerTurn
ld a, [wBattlePlayerAction]
and a
and a ; BATTLEPLAYERACTION_USEMOVE?
ret nz
jr DoTurn
@ -1248,7 +1248,7 @@ BattleCommand_Stab:
.go
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVarAddr
ld [wTypeMatchup], a
ld [wCurType], a
push hl
push de
@ -1264,7 +1264,7 @@ BattleCommand_Stab:
pop bc
pop de
ld a, [wTypeMatchup]
ld a, [wCurType]
cp b
jr z, .stab
cp c
@ -3583,7 +3583,7 @@ UpdateMoveData:
ld a, BATTLE_VARS_MOVE
call GetBattleVar
ld [wCurMove], a
ld [wCurSpecies], a
ld [wNamedObjectIndexBuffer], a
dec a

View File

@ -53,13 +53,13 @@ DoWeatherModifiers:
ld de, WeatherTypeModifiers
ld a, [wBattleWeather]
ld b, a
ld a, [wd265] ; move type
ld a, [wCurType]
ld c, a
.CheckWeatherType:
ld a, [de]
inc de
cp $ff
cp -1
jr z, .done_weather_types
cp b
@ -84,7 +84,7 @@ DoWeatherModifiers:
.CheckWeatherMove:
ld a, [de]
inc de
cp $ff
cp -1
jr z, .done
cp b
@ -116,7 +116,7 @@ DoWeatherModifiers:
ld a, 10
ld [hDivisor], a
ld b, $4
ld b, 4
call Divide
ld a, [hQuotient + 0]
@ -176,7 +176,7 @@ DoBadgeTypeBoosts:
rr c
jr nc, .NextBadge
ld a, [wd265] ; move type
ld a, [wCurType]
cp [hl]
jr z, .ApplyBoost

View File

@ -68,8 +68,8 @@ BattleCommand_BatonPass:
call CallBattleCore
ld hl, ResetBattleParticipants
call CallBattleCore
ld a, 1
ld [wTypeMatchup], a
ld a, TRUE
ld [wApplyStatLevelMultipliersToEnemy], a
ld hl, ApplyStatLevelMultiplierOnAllStats
call CallBattleCore
@ -83,7 +83,7 @@ BatonPass_LinkPlayerSwitch:
and a
ret z
ld a, 1
ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call LoadStandardMenuHeader
@ -91,7 +91,7 @@ BatonPass_LinkPlayerSwitch:
call CallBattleCore
call CloseWindow
xor a
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret

View File

@ -18,7 +18,7 @@ BattleCommand_GetMagnitude:
push de
inc hl
ld a, [hl]
ld [wTypeMatchup], a
ld [wDeciramBuffer], a
call BattleCommand_MoveDelay
ld hl, MagnitudeText
call StdBattleTextBox

View File

@ -24,7 +24,7 @@ BattleCommand_MirrorMove:
.use
ld a, b
ld [hl], a
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
push af
ld a, BATTLE_VARS_MOVE_ANIM

View File

@ -34,7 +34,7 @@ BattleCommand_Sketch:
.get_last_move
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
call GetBattleVar
ld [wTypeMatchup], a
ld [wNamedObjectIndexBuffer], a
ld b, a
; Fail if move is invalid or is Struggle.
and a

View File

@ -24,7 +24,7 @@ BattleCommand_Spite:
ld a, [hli]
cp b
jr nz, .loop
ld [wTypeMatchup], a
ld [wNamedObjectIndexBuffer], a
dec hl
ld b, 0
push bc
@ -78,7 +78,7 @@ BattleCommand_Spite:
call AnimateCurrentMove
pop de
ld a, d
ld [wTypeMatchup], a
ld [wDeciramBuffer], a
ld hl, SpiteEffectText
jp StdBattleTextBox

View File

@ -21,7 +21,7 @@ BattleCommand_Thief:
; Can't steal mail.
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
ld d, a
farcall ItemIsMail
ret c
@ -45,7 +45,7 @@ BattleCommand_Thief:
ld [de], a
call .playeritem
ld a, [wd265]
ld a, [wNamedObjectIndexBuffer]
ld [hl], a
ld [de], a
jr .stole
@ -68,7 +68,7 @@ BattleCommand_Thief:
; Can't steal mail!
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
ld d, a
farcall ItemIsMail
ret c
@ -86,7 +86,7 @@ BattleCommand_Thief:
ld [de], a
call .enemyitem
ld a, [wd265]
ld a, [wNamedObjectIndexBuffer]
ld [hl], a
ld [de], a

View File

@ -101,7 +101,7 @@ StageBallTilesData:
DrawPlayerHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
ld bc, 4
ld bc, .tiles_end - .tiles
call CopyBytes
hlcoord 18, 10
ld de, -1 ; start on right
@ -112,11 +112,12 @@ DrawPlayerHUDBorder:
db $77 ; bottom right
db $6f ; bottom left
db $76 ; bottom side
.tiles_end
DrawPlayerPartyIconHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
ld bc, 4
ld bc, .tiles_end - .tiles
call CopyBytes
hlcoord 18, 10
ld de, -1 ; start on right
@ -127,11 +128,12 @@ DrawPlayerPartyIconHUDBorder:
db $5c ; bottom right
db $6f ; bottom left
db $76 ; bottom side
.tiles_end
DrawEnemyHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
ld bc, 4
ld bc, .tiles_end - .tiles
call CopyBytes
hlcoord 1, 2
ld de, 1 ; start on left
@ -152,23 +154,24 @@ DrawEnemyHUDBorder:
db $74 ; bottom left
db $78 ; bottom right
db $76 ; bottom side
.tiles_end
PlaceHUDBorderTiles:
ld a, [wTrainerHUDTiles]
ld a, [wTrainerHUDTiles + 0]
ld [hl], a
ld bc, SCREEN_WIDTH
add hl, bc
ld a, [wStartFlypoint]
ld a, [wTrainerHUDTiles + 1]
ld [hl], a
ld b, $8
ld b, 8
.loop
add hl, de
ld a, [wMovementBuffer]
ld a, [wTrainerHUDTiles + 3]
ld [hl], a
dec b
jr nz, .loop
add hl, de
ld a, [wEndFlypoint]
ld a, [wTrainerHUDTiles + 2]
ld [hl], a
ret
@ -181,7 +184,7 @@ LinkBattle_TrainerHuds:
ld a, 10 * 8
ld [hli], a
ld [hl], 8 * 8
ld a, $8
ld a, 8
ld [wPlaceBallsDirection], a
ld hl, wVirtualOAMSprite00
call LoadTrainerHudOAM

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