ref: d9300a9becc9aa699b7191f87d8b493a93139ba2
parent: bef792f2d21ccac0127aeffd9e0838aba81f44b6
author: PikalaxALT <PikalaxALT@gmail.com>
date: Mon Jul 20 07:28:05 EDT 2015
Fix unnecessary white space and retire add_n_times
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -6202,26 +6202,26 @@
ld hl, EnemyMonSpecies
ld bc, EnemyMonEnd - EnemyMon
call ByteFill
-
+
; We don't need to be here if we're in a link battle
ld a, [InLinkBattle]
and a
jp nz, Function3dabd
-
+
ld a, [wcfc0] ; ????
bit 0, a
jp nz, Function3dabd
-
+
; Make sure everything knows what species we're working with
ld a, [TempEnemyMonSpecies]
ld [EnemyMonSpecies], a
ld [CurSpecies], a
ld [CurPartySpecies], a
-
+
; Grab the BaseData for this species
call GetBaseData
-
+
; Let's get the item:
; Is the item predetermined?
@@ -6228,7 +6228,7 @@
ld a, [IsInBattle]
dec a
jr z, .WildItem
-
+
; If we're in a trainer battle, the item is in the party struct
ld a, [CurPartyMon]
ld hl, OTPartyMon1Item
@@ -6235,8 +6235,8 @@
call GetPartyLocation ; bc = PartyMon[CurPartyMon] - PartyMons
ld a, [hl]
jr .UpdateItem
-
-
+
+
.WildItem
; In a wild battle, we pull from the item slots in BaseData
@@ -6246,7 +6246,7 @@
cp BATTLETYPE_FORCEITEM
ld a, [BaseItems]
jr z, .UpdateItem
-
+
; Failing that, it's all up to chance
; Effective chances:
; 75% None
@@ -6258,7 +6258,7 @@
cp a, 1 + (75 percent)
ld a, NO_ITEM
jr c, .UpdateItem
-
+
; From there, an 8% chance for Item2
call BattleRandom
cp a, 8 percent ; 8% of 25% = 2% Item2
@@ -6265,23 +6265,23 @@
ld a, [BaseItems]
jr nc, .UpdateItem
ld a, [BaseItems+1]
-
-
+
+
.UpdateItem
ld [EnemyMonItem], a
-
-
+
+
; Initialize DVs
-
+
; If we're in a trainer battle, DVs are predetermined
ld a, [IsInBattle]
and a
jr z, .InitDVs
-
+
ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr z, .InitDVs
-
+
; Unknown
ld hl, wc6f2
ld de, EnemyMonDVs
@@ -6291,12 +6291,12 @@
ld a, [hl]
ld [de], a
jp .Happiness
-
-
+
+
.InitDVs
-
+
; Trainer DVs
-
+
; All trainers have preset DVs, determined by class
; See GetTrainerDVs for more on that
callba GetTrainerDVs
@@ -6304,8 +6304,8 @@
ld a, [IsInBattle]
dec a
jr nz, .UpdateDVs
-
-
+
+
; Wild DVs
; Here's where the fun starts
@@ -6314,7 +6314,7 @@
ld a, [BattleType]
cp a, BATTLETYPE_ROAMING
jr nz, .NotRoaming
-
+
; Grab HP
call GetRoamMonHP
ld a, [hl]
@@ -6322,7 +6322,7 @@
and a
; We'll do something with the result in a minute
push af
-
+
; Grab DVs
call GetRoamMonDVs
inc hl
@@ -6334,7 +6334,7 @@
pop af
; If the RoamMon struct has already been initialized, we're done
jr nz, .UpdateDVs
-
+
; If it hasn't, we need to initialize the DVs
; (HP is initialized at the end of the battle)
call GetRoamMonDVs
@@ -6348,7 +6348,7 @@
; We're done with DVs
jr .UpdateDVs
-
+
.NotRoaming
; Register a contains BattleType
@@ -6360,7 +6360,7 @@
ld b, ATKDEFDV_SHINY ; $ea
ld c, SPDSPCDV_SHINY ; $aa
jr .UpdateDVs
-
+
.GenerateDVs
; Generate new random DVs
call BattleRandom
@@ -6367,7 +6367,7 @@
ld b, a
call BattleRandom
ld c, a
-
+
.UpdateDVs
; Input DVs in register bc
ld hl, EnemyMonDVs
@@ -6374,22 +6374,22 @@
ld a, b
ld [hli], a
ld [hl], c
-
-
+
+
; We've still got more to do if we're dealing with a wild monster
ld a, [IsInBattle]
dec a
jr nz, .Happiness
-
-
+
+
; Species-specfic:
-
-
+
+
; Unown
ld a, [TempEnemyMonSpecies]
cp a, UNOWN
jr nz, .Magikarp
-
+
; Get letter based on DVs
ld hl, EnemyMonDVs
predef GetUnownLetter
@@ -6397,25 +6397,25 @@
; If combined with forced shiny battletype, causes an infinite loop
call CheckUnownLetter
jr c, .GenerateDVs ; try again
-
-
+
+
.Magikarp
; Skimming this part recommended
-
+
ld a, [TempEnemyMonSpecies]
cp a, MAGIKARP
jr nz, .Happiness
-
+
; Get Magikarp's length
ld de, EnemyMonDVs
ld bc, PlayerID
callab CalcMagikarpLength
-
+
; We're clear if the length is < 1536
ld a, [MagikarpLength]
cp a, $06 ; $600 = 1536
jr nz, .CheckMagikarpArea
-
+
; 5% chance of skipping size checks
call Random
cp a, $0c ; / $100
@@ -6424,7 +6424,7 @@
ld a, [MagikarpLength + 1]
cp a, $50
jr nc, .GenerateDVs
-
+
; 20% chance of skipping this check
call Random
cp a, $32 ; / $100
@@ -6433,15 +6433,15 @@
ld a, [MagikarpLength + 1]
cp a, $40
jr nc, .GenerateDVs
-
+
.CheckMagikarpArea
; The z checks are supposed to be nz
; Instead, all maps in GROUP_LAKE_OF_RAGE (mahogany area)
; and routes 20 and 44 are treated as Lake of Rage
-
+
; This also means Lake of Rage Magikarp can be smaller than ones
; caught elsewhere rather than the other way around
-
+
; Intended behavior enforces a minimum size at Lake of Rage
; The real behavior prevents size flooring in the Lake of Rage area
ld a, [MapGroup]
@@ -6458,10 +6458,10 @@
ld a, [MagikarpLength]
cp a, 1024 >> 8
jr c, .GenerateDVs ; try again
-
-
+
+
; Finally done with DVs
-
+
.Happiness
; Set happiness
ld a, BASE_HAPPINESS
@@ -6474,21 +6474,21 @@
ld b, $00
ld hl, LinkBattleRNs + 7 ; ?
predef Functione167
-
+
; If we're in a trainer battle,
; get the rest of the parameters from the party struct
ld a, [IsInBattle]
cp a, TRAINER_BATTLE
jr z, .OpponentParty
-
+
; If we're in a wild battle, check wild-specific stuff
and a
jr z, .TreeMon
-
+
ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jp nz, .Moves
-
+
.TreeMon
; If we're headbutting trees, some monsters enter battle asleep
call CheckSleepingTreeMon
@@ -6496,26 +6496,26 @@
jr c, .UpdateStatus
; Otherwise, no status
xor a
-
+
.UpdateStatus
ld hl, EnemyMonStatus
ld [hli], a
-
+
; Unused byte
xor a
ld [hli], a
-
+
; Full HP...
ld a, [EnemyMonMaxHP]
ld [hli], a
ld a, [EnemyMonMaxHP + 1]
ld [hl], a
-
+
; ...unless it's a RoamMon
ld a, [BattleType]
cp a, BATTLETYPE_ROAMING
jr nz, .Moves
-
+
; Grab HP
call GetRoamMonHP
ld a, [hl]
@@ -6526,7 +6526,7 @@
ld a, [hl]
ld [EnemyMonHP + 1], a
jr .Moves
-
+
.InitRoamHP
; HP only uses the lo byte in the RoamMon struct since
; Raikou/Entei/Suicune will have < 256 hp at level 40
@@ -6533,8 +6533,8 @@
ld a, [EnemyMonHP + 1]
ld [hl], a
jr .Moves
-
-
+
+
.OpponentParty
; Get HP from the party struct
ld hl, (OTPartyMon1HP + 1)
@@ -6544,17 +6544,17 @@
ld [EnemyMonHP + 1], a
ld a, [hld]
ld [EnemyMonHP], a
-
+
; Make sure everything knows which monster the opponent is using
ld a, [CurPartyMon]
ld [CurOTMon], a
-
+
; Get status from the party struct
dec hl
ld a, [hl] ; OTPartyMonStatus
ld [EnemyMonStatus], a
-
-
+
+
.Moves
ld hl, BaseType1
ld de, EnemyMonType1
@@ -6563,7 +6563,7 @@
inc de
ld a, [hl]
ld [de], a
-
+
; Get moves
ld de, EnemyMonMoves
; Are we in a trainer battle?
@@ -6577,7 +6577,7 @@
ld bc, NUM_MOVES
call CopyBytes
jr .PP
-
+
.WildMoves
; Clear EnemyMonMoves
xor a
@@ -6591,19 +6591,19 @@
ld [MagikarpLength], a
; Fill moves based on level
predef FillMoves
-
+
.PP
; Trainer battle?
ld a, [IsInBattle]
cp a, TRAINER_BATTLE
jr z, .TrainerPP
-
+
; Fill wild PP
ld hl, EnemyMonMoves
ld de, EnemyMonPP
predef FillPP
jr .Finish
-
+
.TrainerPP
; Copy PP from the party struct
ld hl, OTPartyMon1PP
@@ -6612,7 +6612,7 @@
ld de, EnemyMonPP
ld bc, NUM_MOVES
call CopyBytes
-
+
.Finish
; Only the first five base stats are copied...
ld hl, BaseStats
@@ -6673,7 +6673,7 @@
ld a, [BattleType]
cp a, BATTLETYPE_TREE
jr nz, .NotSleeping
-
+
; Get list for the time of day
ld hl, .Morn
ld a, [TimeOfDay]
@@ -6682,7 +6682,7 @@
ld hl, .Day
jr z, .Check
ld hl, .Nite
-
+
.Check
ld a, [TempEnemyMonSpecies]
ld de, 1 ; length of species id
@@ -6689,7 +6689,7 @@
call IsInArray
; If it's a match, the opponent is asleep
ret c
-
+
.NotSleeping
and a
ret
@@ -6728,17 +6728,17 @@
CheckUnownLetter: ; 3eb75
; Return carry if the Unown letter hasn't been unlocked yet
-
+
ld a, [UnlockedUnowns]
ld c, a
ld de, 0
-
+
.loop
-
+
; Don't check this set unless it's been unlocked
srl c
jr nc, .next
-
+
; Is our letter in the set?
ld hl, .LetterSets
add hl, de
@@ -6745,7 +6745,7 @@
ld a, [hli]
ld h, [hl]
ld l, a
-
+
push de
ld a, [UnownLetter]
ld de, 1
@@ -6753,9 +6753,9 @@
call IsInArray
pop bc
pop de
-
+
jr c, .match
-
+
.next
; Make sure we haven't gone past the end of the table
inc e
@@ -6763,22 +6763,22 @@
ld a, e
cp a, .Set1 - .LetterSets
jr c, .loop
-
+
; Hasn't been unlocked, or the letter is invalid
scf
ret
-
+
.match
; Valid letter
and a
ret
-
+
.LetterSets
dw .Set1
dw .Set2
dw .Set3
dw .Set4
-
+
.Set1
; A B C D E F G H I J K
db 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, $ff
@@ -6791,7 +6791,7 @@
.Set4
; X Y Z
db 24, 25, 26, $ff
-
+
; 3ebc7
--- a/data/wild/fish.asm
+++ b/data/wild/fish.asm
@@ -6,16 +6,18 @@
push af
push bc
push hl
-
+
; Get the fishing group for this map.
ld b, e
call GetFishGroupHeader
-
+
ld hl, FishGroupHeaders
- add_n_times hl, de, 7
-
+rept 7
+ add hl, de
+endr
+
call Fish
-
+
pop hl
pop bc
pop af
@@ -42,29 +44,31 @@
inc hl
ld e, b
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
-
+
; Encounter chance for this monster:
call Random
-
+
.CheckEncounter
cp [hl]
jr z, .ReadMon
jr c, .ReadMon
-
+
; Next monster...
inc hl
inc hl
inc hl
jr .CheckEncounter
-
+
.ReadMon
; We're done with the encounter chance
inc hl
-
+
; Species 0 triggers a read from a time-based encounter table.
ld a, [hli]
ld d, a
@@ -74,11 +78,11 @@
; Level
ld e, [hl]
ret
-
+
.NoBite
ld de, 0
ret
-
+
.TimeEncounter
; The level byte is repurposed as the index for the new table.
@@ -85,10 +89,9 @@
ld e, [hl]
ld d, 0
ld hl, TimeFishGroups
+rept 4
add hl, de
- add hl, de
- add hl, de
- add hl, de
+endr
; One nightmon, then one daymon
ld a, [TimeOfDay]
@@ -97,7 +100,7 @@
jr c, .TimeSpecies
inc hl
inc hl
-
+
.TimeSpecies
ld d, [hl]
inc hl
@@ -115,7 +118,7 @@
bit 2, [hl]
pop hl
jr z, .end
-
+
; Groups 11 and 12 have special attributes.
ld a, d
cp 11
@@ -122,13 +125,13 @@
jr z, .group11
cp 12
jr z, .group12
-
+
.end
dec d
ld e, d
ld d, 0
ret
-
+
.group11
ld a, [wdfce]
cp 1
@@ -135,7 +138,7 @@
jr nz, .end
ld d, 6
jr .end
-
+
.group12
ld a, [wdfce]
cp 2
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -806,7 +806,9 @@
Function976b: ; 976b
ld l, a
ld h, 0
- add_n_times hl, hl, 2
+rept 2
+ add hl,hl
+endr
ld bc, TrainerPalettes
add hl, bc
ret
@@ -1974,7 +1976,9 @@
push hl
ld l, a
ld h, 0
- add_n_times hl, hl, 3
+rept 3
+ add hl,hl
+endr
ld de, TilesetBGPalette
add hl, de
ld e, l
@@ -2014,7 +2018,9 @@
ld a, [MapGroup]
ld l, a
ld h, 0
- add_n_times hl, hl, 3
+rept 3
+ add hl,hl
+endr
ld de, RoofPals
add hl, de
ld a, [TimeOfDayPal]
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -472,7 +472,9 @@
ld a, [hli]
ld h, [hl]
ld l, a
- add_n_times hl, de, 4
+rept 4
+ add hl,de
+endr
call GetMapScriptHeaderBank
call GetFarHalfword
@@ -1043,7 +1045,9 @@
ld c, a
ld b, 0
ld hl, ScriptPointers96c0c
- add_n_times hl, bc, 3
+rept 3
+ add hl,bc
+endr
ld a, [hli]
ld [ScriptBank], a
ld a, [hli]
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -226,7 +226,9 @@
ld a, [hl]
ld l, a
ld h, 0
- add_n_times hl, hl, 2
+rept 2
+ add hl,hl
+endr
add hl, de
ld a, [hli]
ld h, [hl]
@@ -1385,7 +1387,9 @@
ld e, a
ld d, 0
ld hl, .data_4a81
- add_n_times hl, de, 2
+rept 2
+ add hl,de
+endr
ld d, [hl]
inc hl
ld e, [hl]
@@ -3655,7 +3659,9 @@
ld c, a
ld b, 0
ld hl, .Addresses
- add_n_times hl, bc, 2
+rept 2
+ add hl,bc
+endr
ld c, [hl]
inc hl
ld b, [hl]
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -1,106 +1,108 @@
-GetPredefPointer:: ; 854b
-; Return the bank and address of PredefID in a and PredefAddress.
-
-; Save hl for later (back in Predef)
- ld a, h
- ld [PredefTemp], a
- ld a, l
- ld [PredefTemp + 1], a
-
- push de
- ld a, [PredefID]
- ld e, a
- ld d, 0
- ld hl, PredefPointers
- add_n_times hl, de, 3
- pop de
-
- ld a, [hli]
- ld [PredefAddress + 1], a
- ld a, [hli]
- ld [PredefAddress], a
- ld a, [hl]
-
- ret
-; 856b
-
-PredefPointers:: ; 856b
-; $4b Predef pointers
-; address, bank
-
- add_predef LearnMove ; $0
- add_predef Predef1
- add_predef HealParty
- add_predef FlagPredef
- add_predef Functionc699
- add_predef FillPP
- add_predef Functiond88c
- add_predef Functionda96
- add_predef Functiondb3f ; $8
- add_predef Functionde6e
- add_predef GiveEgg
- add_predef Functionc6e0
- add_predef Functione167
- add_predef Functione17b
- add_predef CanLearnTMHMMove
- add_predef GetTMHMMove
- add_predef Function28eef ; $ 10
- add_predef PrintMoveDesc
- add_predef UpdatePlayerHUD
- add_predef FillBox
- add_predef Function3d873
- add_predef UpdateEnemyHUD
- add_predef StartBattle
- add_predef FillInExpBar
- add_predef Function3f43d ; $18
- add_predef Function3f47c
- add_predef LearnLevelMoves
- add_predef FillMoves
- add_predef Function421e6
- add_predef Function28f63
- add_predef Function28f24
- add_predef Function5084a
- add_predef ListMoves ; $20
- add_predef Function50d2e
- add_predef Function50cdb
- add_predef Function50c50
- add_predef GetGender
- add_predef StatsScreenInit
- add_predef DrawPlayerHP
- add_predef DrawEnemyHP
- add_predef PrintTempMonStats ; $28
- add_predef GetTypeName
- add_predef PrintMoveType
- add_predef PrintType
- add_predef PrintMonTypes
- add_predef GetUnownLetter
- add_predef Functioncbcdd
- add_predef Predef2F
- add_predef Function9853 ; $30
- add_predef Function864c
- add_predef Function91d11
- add_predef CheckContestMon
- add_predef Function8c20f
- add_predef Function8c000
- add_predef Function8c000_2
- add_predef PlayBattleAnim
- add_predef Predef38 ; $38
- add_predef Predef39
- add_predef Functionfd1d0
- add_predef PartyMonItemName
- add_predef GetFrontpic
- add_predef GetBackpic
- add_predef Function5108b
- add_predef GetTrainerPic
- add_predef DecompressPredef ; $40
- add_predef Function347d3
- add_predef ConvertMon_1to2
- add_predef Functionfb877
- add_predef Functiond0000
- add_predef Function50d0a
- add_predef Functiond00a3
- add_predef Functiond008e
- add_predef Functiond0669 ; $48
- add_predef Functiond066e
- dbw $ff, Function2d43 ; ????
+GetPredefPointer:: ; 854b
+; Return the bank and address of PredefID in a and PredefAddress.
+
+; Save hl for later (back in Predef)
+ ld a, h
+ ld [PredefTemp], a
+ ld a, l
+ ld [PredefTemp + 1], a
+
+ push de
+ ld a, [PredefID]
+ ld e, a
+ ld d, 0
+ ld hl, PredefPointers
+rept 3
+ add hl,de
+endr
+ pop de
+
+ ld a, [hli]
+ ld [PredefAddress + 1], a
+ ld a, [hli]
+ ld [PredefAddress], a
+ ld a, [hl]
+
+ ret
+; 856b
+
+PredefPointers:: ; 856b
+; $4b Predef pointers
+; address, bank
+
+ add_predef LearnMove ; $0
+ add_predef Predef1
+ add_predef HealParty
+ add_predef FlagPredef
+ add_predef Functionc699
+ add_predef FillPP
+ add_predef Functiond88c
+ add_predef Functionda96
+ add_predef Functiondb3f ; $8
+ add_predef Functionde6e
+ add_predef GiveEgg
+ add_predef Functionc6e0
+ add_predef Functione167
+ add_predef Functione17b
+ add_predef CanLearnTMHMMove
+ add_predef GetTMHMMove
+ add_predef Function28eef ; $ 10
+ add_predef PrintMoveDesc
+ add_predef UpdatePlayerHUD
+ add_predef FillBox
+ add_predef Function3d873
+ add_predef UpdateEnemyHUD
+ add_predef StartBattle
+ add_predef FillInExpBar
+ add_predef Function3f43d ; $18
+ add_predef Function3f47c
+ add_predef LearnLevelMoves
+ add_predef FillMoves
+ add_predef Function421e6
+ add_predef Function28f63
+ add_predef Function28f24
+ add_predef Function5084a
+ add_predef ListMoves ; $20
+ add_predef Function50d2e
+ add_predef Function50cdb
+ add_predef Function50c50
+ add_predef GetGender
+ add_predef StatsScreenInit
+ add_predef DrawPlayerHP
+ add_predef DrawEnemyHP
+ add_predef PrintTempMonStats ; $28
+ add_predef GetTypeName
+ add_predef PrintMoveType
+ add_predef PrintType
+ add_predef PrintMonTypes
+ add_predef GetUnownLetter
+ add_predef Functioncbcdd
+ add_predef Predef2F
+ add_predef Function9853 ; $30
+ add_predef Function864c
+ add_predef Function91d11
+ add_predef CheckContestMon
+ add_predef Function8c20f
+ add_predef Function8c000
+ add_predef Function8c000_2
+ add_predef PlayBattleAnim
+ add_predef Predef38 ; $38
+ add_predef Predef39
+ add_predef Functionfd1d0
+ add_predef PartyMonItemName
+ add_predef GetFrontpic
+ add_predef GetBackpic
+ add_predef Function5108b
+ add_predef GetTrainerPic
+ add_predef DecompressPredef ; $40
+ add_predef Function347d3
+ add_predef ConvertMon_1to2
+ add_predef Functionfb877
+ add_predef Functiond0000
+ add_predef Function50d0a
+ add_predef Functiond00a3
+ add_predef Functiond008e
+ add_predef Functiond0669 ; $48
+ add_predef Functiond066e
+ dbw $ff, Function2d43 ; ????
; 864c
\ No newline at end of file
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -3144,7 +3144,9 @@
ld e, [hl]
ld d, $0
ld hl, wd43d
- add_n_times hl, de, 3
+rept 3
+ add hl,de
+endr
ld a, [hli]
ld b, a
and " "
--- a/engine/spawn_points.asm
+++ b/engine/spawn_points.asm
@@ -56,7 +56,9 @@
jr z, .spawn_n_a
ld l, a
ld h, 0
- add_n_times hl, hl, 2 ; multiply hl by 4
+rept 2 ; multiply hl by 4
+ add hl,hl
+endr
ld de, SpawnPoints
add hl, de
ld a, [hli]
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -2,7 +2,9 @@
Special:: ; c01b
; Run script special de.
ld hl, SpecialsPointers
- add_n_times hl, de, 3
+rept 3
+ add hl,de
+endr
ld b, [hl]
inc hl
ld a, [hli]
--- a/home.asm
+++ b/home.asm
@@ -715,7 +715,7 @@
ld a, [hCGB]
and a
jr nz, .cgb
-
+
; DMG: just change palettes to 0 (white)
xor a
ld [rBGP], a
@@ -722,7 +722,7 @@
ld [rOBP0], a
ld [rOBP1], a
ret
-
+
.cgb
ld a, [rSVBK]
push af
@@ -755,11 +755,11 @@
ld a, [hCGB]
and a
jr nz, .sgb
-
+
ld a, [hSGB]
and a
ret z
-
+
.sgb
predef_jump Function864c ; LoadSGBLayout
; 334e
@@ -872,7 +872,9 @@
ld e, a
ld d, 0
ld hl, NamesPointers
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ld a, [hli]
rst Bankswitch
ld a, [hli]
@@ -1788,7 +1790,7 @@
push af
ld a, BANK(BaseData)
rst Bankswitch
-
+
; Egg doesn't have BaseData
ld a, [CurSpecies]
cp EGG
@@ -1803,16 +1805,16 @@
ld bc, BaseData1 - BaseData0
call CopyBytes
jr .end
-
+
.egg
; ????
ld de, UnknownEggPic
-
+
; Sprite dimensions
ld b, $55 ; 5x5
ld hl, BasePicSize
ld [hl], b
-
+
; ????
ld hl, BasePadding
ld [hl], e
@@ -1823,12 +1825,12 @@
inc hl
ld [hl], d
jr .end
-
+
.end
; Replace Pokedex # with species
ld a, [CurSpecies]
ld [BaseDexNo], a
-
+
pop af
rst Bankswitch
pop hl
--- a/home/map.asm
+++ b/home/map.asm
@@ -150,7 +150,9 @@
add a
ld l, a
ld h, 0
- add_n_times hl, hl, 3
+rept 3
+ add hl,hl
+endr
ld a, [TilesetBlocksAddress]
add l
ld l, a
@@ -1703,7 +1705,9 @@
srl a
ld l, a
ld h, 0
- add_n_times hl, hl, 2
+rept 2
+ add hl,hl
+endr
ld de, .Directions
add hl, de
@@ -1745,7 +1749,9 @@
jr z, .nope
ld l, a
ld h, $0
- add_n_times hl, hl, 2
+rept 2
+ add hl,hl
+endr
ld a, [TilesetCollisionAddress]
ld c, a
ld a, [TilesetCollisionAddress + 1]
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -493,7 +493,9 @@
ld hl, ObjectStruct3_Data
ld e, a
ld d, 0
- add_n_times hl, de, OBJECT_STRUCT_3_DATA_WIDTH
+rept OBJECT_STRUCT_3_DATA_WIDTH
+ add hl,de
+endr
ld a, [hl]
ret
; 1a47
@@ -504,7 +506,9 @@
ld e, a
ld d, 0
ld hl, ObjectStruct3_Data + 1
- add_n_times hl, de, OBJECT_STRUCT_3_DATA_WIDTH
+rept OBJECT_STRUCT_3_DATA_WIDTH
+ add hl,de
+endr
ld a, BANK(ObjectStruct3_Data)
call GetFarByte
add a
@@ -542,7 +546,9 @@
ld e, a
ld d, 0
ld hl, ObjectStruct3_Data + 1
- add_n_times hl, de, OBJECT_STRUCT_3_DATA_WIDTH
+rept OBJECT_STRUCT_3_DATA_WIDTH
+ add hl,de
+endr
ld b, h
ld c, l
pop de
--- a/macros.asm
+++ b/macros.asm
@@ -142,9 +142,3 @@
shift
endr
ENDM
-
-add_n_times: MACRO
- rept \3
- add \1, \2
- endr
-ENDM
--- a/main.asm
+++ b/main.asm
@@ -214,7 +214,7 @@
ld hl, sBoxCount
call Function5ca1
call CloseSRAM
-
+
ld hl, NumItems
call Function5ca1
@@ -1108,7 +1108,9 @@
ld e, a
ld d, 0
ld hl, .jumptable_626a
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1160,7 +1162,9 @@
ld e, a
ld d, 0
ld hl, .scenes
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1220,7 +1224,7 @@
inc [hl]
xor a
ld [hLCDStatCustom], a
-
+
; Play the title screen music.
ld de, MUSIC_TITLE
call PlayMusic
@@ -1387,7 +1391,9 @@
add hl, bc
ld l, [hl]
ld h, 0
- add_n_times hl, hl, 2
+rept 2
+ add hl, hl
+endr
ld de, Data63ca
add hl, de
ld a, [wcf65]
@@ -1396,7 +1402,9 @@
srl a
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
and a
ret z
@@ -2735,7 +2743,9 @@
dec c
ld b, 0
ld hl, .Actions
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld d, 0
add hl, de
ld a, [hl]
@@ -4026,7 +4036,9 @@
ld a, d
ld d, 0
ld hl, SineWave
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -6832,7 +6844,9 @@
jr nc, .ok
ld c, a
ld b, $0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [CurItem]
cp [hl]
inc hl
@@ -10898,7 +10912,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_1172e
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -11218,7 +11234,9 @@
ld e, a
ld d, $0
ld hl, Jumptable_11977
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -11943,7 +11961,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_12017
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -12369,7 +12389,9 @@
ld e, a
ld d, 0
ld hl, Unknown_12365
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -12872,12 +12894,14 @@
ld hl, .MenuReturns
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
-
+
.MenuReturns
dw .Reopen
dw .Exit
@@ -13094,7 +13118,9 @@
ld a, [hli]
ld h, [hl]
ld l, a
- add_n_times hl, de, 6
+rept 6
+ add hl, de
+endr
ret
; 12829
@@ -14819,7 +14845,9 @@
inc hl
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
call .IsSameItem
jr c, .NoRegisteredItem
and a
@@ -14843,7 +14871,9 @@
inc hl
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
call .IsSameItem
jr c, .NoRegisteredItem
ret
@@ -15186,7 +15216,9 @@
ld e, a
ld d, 0
ld hl, .floors
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -15495,7 +15527,9 @@
ld c, a
ld b, 0
ld hl, BugContestantPointers
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -15738,7 +15772,9 @@
ld c, a
ld b, 0
ld hl, BugContestantPointers
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -15751,7 +15787,9 @@
jr z, .loop2
ld c, a
ld b, 0
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld a, [hli]
ld [wd00f], a
ld a, [hli]
@@ -15938,7 +15976,9 @@
ld e, b
ld d, 0
ld hl, BugCatchingContestantEventFlagTable
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -15968,7 +16008,9 @@
ld hl, BugCatchingContestantEventFlagTable
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -16329,7 +16371,7 @@
; get time of day based on the current hour
ld a, [hHours] ; hour
ld hl, TimesOfDay
-
+
.check
; if we're within the given time period,
; get the corresponding time of day
@@ -16340,7 +16382,7 @@
inc hl
; try again
jr .check
-
+
.match
; get time of day
inc hl
@@ -16660,7 +16702,9 @@
ld c, a
ld b, 0
ld hl, OutdoorSprites
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -17129,7 +17173,9 @@
pop bc
ld l, c
ld h, $0
- add_n_times hl, hl, 4
+rept 4
+ add hl, hl
+endr
pop de
add hl, de
ld d, h
@@ -17156,7 +17202,9 @@
and $7f
ld l, a
ld h, $0
- add_n_times hl, hl, 4
+rept 4
+ add hl, hl
+endr
ld a, l
add $0
ld l, a
@@ -17300,8 +17348,8 @@
db LUGIA
db HO_OH
; 144b8
-
+
OutdoorSprites: ; 144b8
; Valid sprite IDs for each map group.
@@ -19026,7 +19074,9 @@
ld e, a
ld d, 0
ld hl, Unknown_1522d
- add_n_times hl, de, 5
+rept 5
+ add hl, de
+endr
ld a, [hli]
push af
ld a, [hli]
@@ -19356,7 +19406,7 @@
db 3 ; items
db 1, 0, 4 ; bill's, player's, turn off
db -1
-
+
; before Hall Of Fame
db 4 ; items
db 1, 0, 2, 4 ; bill's, player's, oak's, turn off
@@ -20136,7 +20186,9 @@
.IsAMart
ld hl, Marts
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -20372,7 +20424,9 @@
pop af
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -20397,7 +20451,9 @@
ld e, a
ld d, 0
ld hl, .data_15cb0
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ret
; 15cb0
@@ -20553,7 +20609,9 @@
ld h, [hl]
ld l, a
inc hl
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
inc hl
ld a, [hli]
ld [$ffc5], a
@@ -20592,7 +20650,9 @@
ld h, [hl]
ld l, a
inc hl
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
inc hl
ld e, [hl]
inc hl
@@ -20636,7 +20696,9 @@
ld c, a
ld b, 0
ld hl, DefaultFlypoint
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
push de
ld d, h
ld e, l
@@ -21206,7 +21268,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_16242
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -21769,7 +21833,9 @@
push de
ld e, a
ld d, 0
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
pop de
ret
; 16613
@@ -22180,7 +22246,9 @@
ld e, a
ld d, 0
ld hl, TextTable_168aa
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -23422,7 +23490,9 @@
ld c, a
ld b, 0
ld hl, EggMovePointers
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, BANK(EggMovePointers)
call GetFarHalfword
.loop
@@ -23455,7 +23525,9 @@
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
.loop3
@@ -23987,7 +24059,9 @@
ld e, a
ld d, 0
ld hl, Unknown_20015
- add_n_times hl, de, 4
+rept 4
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -25981,7 +26055,9 @@
ld c, a
ld b, 0
ld hl, Unknown_24a91
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld c, [hl]
inc hl
ld b, [hl]
@@ -27077,7 +27153,9 @@
ld e, a
ld d, $0
ld hl, Jumptable_2519d
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -31704,7 +31782,9 @@
ld e, a
ld d, 0
ld hl, JumpTable290af
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -31992,7 +32072,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_2928f
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -32576,7 +32658,9 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_29686
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -34252,7 +34336,9 @@
inc hl
ld c, a
ld b, $0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [wdfe7]
cp [hl]
jr nz, .asm_2a390
@@ -34412,7 +34498,9 @@
dec a
ld c, a
ld b, $0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
inc hl
ld c, [hl]
pop hl
@@ -34484,7 +34572,9 @@
and $3
ld c, a
ld b, $0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
inc hl
ld a, [hl]
ld [wd265], a
@@ -34503,7 +34593,9 @@
dec a
ld c, a
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, BANK(TrainerGroups)
call GetFarHalfword
@@ -36075,7 +36167,9 @@
dec a
ld c, a
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld e, a
ld d, [hl]
@@ -36626,7 +36720,9 @@
ld c, a
ld b, 0
ld hl, TrainerGroups
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -36654,7 +36750,9 @@
ld d, h
ld e, l
ld hl, TrainerTypes
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -36954,7 +37052,9 @@
push bc
ld b, 0
ld hl, TrainerGroups
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -37123,7 +37223,9 @@
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -37513,7 +37615,9 @@
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -37712,7 +37816,9 @@
.asm_42583
ld hl, EvosAttacksPointers
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -37864,7 +37970,9 @@
ld hl, AIScoringPointers
dec c
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -37878,7 +37986,7 @@
ld hl, Buffer1
ld de, EnemyMonMoves
ld c, EnemyMonMovesEnd - EnemyMonMoves
-
+
.DecrementNextScore
; If the enemy has no moves, this will infinite.
ld a, [de]
@@ -37902,7 +38010,7 @@
; This means that the minimum score will be 1.
.PickLowestScoreMoves
ld a, c
-
+
.asm_44175
inc [hl]
dec hl
@@ -37913,7 +38021,7 @@
ld hl, Buffer1
ld de, EnemyMonMoves
ld c, NUM_MOVES
-
+
; Give a score of 0 to a blank move
.asm_44184
ld a, [de]
@@ -37929,7 +38037,7 @@
xor a
ld [hli], a
jr .asm_44193
-
+
.asm_44191
ld a, [de]
ld [hli], a
@@ -38198,7 +38306,9 @@
dec a
ld d, 0
ld e, a
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -38228,7 +38338,7 @@
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
; 44355
-
+
Function44355: ; 44355
call Function44333
push hl
@@ -40794,7 +40904,9 @@
Function48e81: ; 48e81
ld hl, PackFGFXPointers
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld e, a
ld d, [hl]
@@ -41797,7 +41909,9 @@
ld a, d
ld d, $0
ld hl, Unknown_49b6e
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -43265,7 +43379,9 @@
; Load the box.
ld hl, BoxAddressTable1
ld b, 0
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld a, [hli]
call GetSRAMBank
ld a, [hli]
@@ -43478,7 +43594,9 @@
jr z, .asm_4a8d1
ld hl, BoxAddressTable2
ld b, 0
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld a, [hli]
call GetSRAMBank
ld a, [hli]
@@ -45579,7 +45697,9 @@
jr z, .asm_4d90b
ld hl, Unknown_4d99f
ld b, 0
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld a, [hli]
call GetSRAMBank
ld a, [hli]
@@ -47302,7 +47422,9 @@
ld c, a
ld hl, Jumptable_4e564
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -48511,7 +48633,9 @@
ld e, a
ld d, 0
ld hl, EvosAttacksPointers
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
call Function50268
pop hl
call PlaceString
@@ -48729,7 +48853,9 @@
ld e, a
ld d, 0
ld hl, Unknown_503b2
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -48902,7 +49028,9 @@
ld hl, PartyMenuStrings
ld e, a
ld d, $0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld d, [hl]
ld e, a
@@ -49038,7 +49166,9 @@
Function505c1: ; 505c1
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -49625,7 +49755,9 @@
dec a
ld c, a
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -49863,44 +49995,44 @@
ld a, [MonType]
and a
jr z, .PartyMon
-
+
; 1: OTPartyMon
ld hl, OTPartyMon1DVs
dec a
jr z, .PartyMon
-
+
; 2: sBoxMon
ld hl, sBoxMon1DVs
ld bc, sBoxMon2 - sBoxMon1
dec a
jr z, .sBoxMon
-
+
; 3: Unknown
ld hl, TempMonDVs
dec a
jr z, .DVs
-
+
; else: WildMon
ld hl, EnemyMonDVs
jr .DVs
-
-
+
+
; Get our place in the party/box.
-
+
.PartyMon
.sBoxMon
ld a, [CurPartyMon]
call AddNTimes
-
-
+
+
.DVs
-
+
; sBoxMon data is read directly from SRAM.
ld a, [MonType]
cp BOXMON
ld a, 1
call z, GetSRAMBank
-
+
; Attack DV
ld a, [hli]
and $f0
@@ -49909,7 +50041,7 @@
ld a, [hl]
and $f0
swap a
-
+
; Put our DVs together.
or b
ld b, a
@@ -49918,8 +50050,8 @@
ld a, [MonType]
cp BOXMON
call z, CloseSRAM
-
-
+
+
; We need the gender ratio to do anything with this.
push bc
ld a, [CurPartySpecies]
@@ -49928,35 +50060,35 @@
ld bc, BaseData1 - BaseData
call AddNTimes
pop bc
-
+
ld a, BANK(BaseData)
call GetFarByte
-
-
+
+
; The higher the ratio, the more likely the monster is to be female.
-
+
cp $ff
jr z, .Genderless
-
+
and a
jr z, .Male
-
+
cp $fe
jr z, .Female
-
+
; Values below the ratio are male, and vice versa.
cp b
jr c, .Male
-
+
.Female
xor a
ret
-
+
.Male
ld a, 1
and a
ret
-
+
.Genderless
scf
ret
@@ -50629,7 +50761,7 @@
srl a
or b
ld b, a
-
+
; spd
ld a, [hl]
and %01100000
@@ -51759,7 +51891,9 @@
ld e, a
ld d, 0
ld hl, .Steps
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -52157,31 +52291,33 @@
jr z, .ceiling
jr c, .read ; cp 0 can't set carry!
jr .invalid
-
+
; There are only $a2 engine flags, so
; anything beyond that is invalid too.
-
+
.ceiling
ld a, e
cp $a2
jr c, .read
-
+
; Invalid flags are treated as flag 00.
-
+
.invalid
xor a
ld e, a
ld d, a
-
+
; Get this flag's location.
-
+
.read
ld hl, EngineFlags
; location
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
; bit
add hl, de
-
+
; location
ld e, [hl]
inc hl
@@ -52189,14 +52325,14 @@
inc hl
; bit
ld c, [hl]
-
+
; What are we doing with this flag?
-
+
ld a, b
cp 1
jr c, .reset ; b = 0
jr z, .set ; b = 1
-
+
; Return the given flag in c.
.check
ld a, [de]
@@ -52203,7 +52339,7 @@
and c
ld c, a
ret
-
+
; Set the given flag.
.set
ld a, [de]
@@ -52210,7 +52346,7 @@
or c
ld [de], a
ret
-
+
; Reset the given flag.
.reset
ld a, c
@@ -52238,7 +52374,9 @@
ld c, a
ld b, 0
ld hl, VarActionTable
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -52684,7 +52822,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_81acf
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -52864,7 +53004,9 @@
inc a
ld l, a
ld h, $0
- add_n_times hl, hl, 2
+rept 2
+ add hl, hl
+endr
ld de, OverworldMap
add hl, de
ld de, wc608
@@ -52988,7 +53130,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_81d02
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -53314,7 +53458,9 @@
inc a
ld l, a
ld h, $0
- add_n_times hl, hl, 2
+rept 2
+ add hl, hl
+endr
ld de, OverworldMap
add hl, de
ld e, l
@@ -53615,7 +53761,9 @@
ld a, [wcf64]
ld l, a
ld h, $0
- add_n_times hl, hl, 3
+rept 3
+ add hl, hl
+endr
ld de, Unkn1Pals
add hl, de
ld de, wc608
@@ -53728,7 +53876,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_82301
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -53770,7 +53920,9 @@
ld e, a
ld d, $0
ld hl, wc608
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, l
ld d, h
call Function81ea5
@@ -53868,7 +54020,9 @@
ld c, a
ld b, $0
ld hl, wc608
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, e
ld [hli], a
ld [hl], d
@@ -53908,7 +54062,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_84031
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -55013,7 +55169,9 @@
ld e, a
ld d, 0
ld hl, Unknown_84807
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -55044,7 +55202,9 @@
ld e, a
ld d, 0
ld hl, Unknown_84807
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -56344,7 +56504,9 @@
inc hl
ld c, a
ld b, $0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
inc hl
ld a, [hl]
pop bc
@@ -56359,7 +56521,9 @@
ld c, a
ld b, $0
inc hl
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [CurItem]
ld c, a
ld a, [hli]
@@ -56531,15 +56695,15 @@
; Male
ld de, ChrisSpriteGFX
ld b, BANK(ChrisSpriteGFX)
-
+
ld a, [PlayerGender]
bit 0, a
jr z, .done
-
+
; Female
ld de, KrisSpriteGFX
ld b, BANK(KrisSpriteGFX)
-
+
.done
ret
; 8833e
@@ -57355,7 +57519,9 @@
ld c, d
ld b, 0
ld hl, Unknown_89509
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -57470,7 +57636,9 @@
ld a, [TrainerClass]
ld h, 0
ld l, a
- add_n_times hl, hl, 2
+rept 2
+ add hl, hl
+endr
ld de, TrainerPalettes
add hl, de
ld a, [rSVBK]
@@ -61242,7 +61410,9 @@
inc hl
ld d, $0
ld e, $14
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [ScriptVar]
ld c, a
ld de, Unknown_8aebc
@@ -61730,7 +61900,9 @@
ld hl, BuenaPrizes
ld b, 0
ld c, a
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ret
; 8b15e
@@ -61955,7 +62127,9 @@
inc hl
inc hl
ld b, $0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
call Function8b28a
call PrintText
pop bc
@@ -63064,7 +63238,9 @@
ld b, 0
ld c, a
ld hl, Unknown_8b903
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -63264,32 +63440,32 @@
ld hl, wd846
bit 7, [hl]
jr nz, .dontchange
-
+
; do we need to bother updating?
ld a, [TimeOfDay]
ld hl, CurTimeOfDay
cp [hl]
jr z, .dontchange
-
+
; if so, the time of day has changed
ld a, [TimeOfDay]
ld [CurTimeOfDay], a
-
+
; get palette id
call GetTimePalette
-
+
; same palette as before?
ld hl, TimeOfDayPal
cp [hl]
jr z, .dontchange
-
+
; update palette id
ld [TimeOfDayPal], a
-
-
+
+
; save bg palette 8
ld hl, Unkn1Pals + 8 * 7 ; Unkn1Pals + 7 pals
-
+
; save wram bank
ld a, [rSVBK]
ld b, a
@@ -63296,7 +63472,7 @@
; wram bank 5
ld a, 5
ld [rSVBK], a
-
+
; push palette
ld c, 4 ; NUM_PAL_COLORS
.push
@@ -63307,20 +63483,20 @@
push de
dec c
jr nz, .push
-
+
; restore wram bank
ld a, b
ld [rSVBK], a
-
-
+
+
; update sgb pals
ld b, $9
call GetSGBLayout
-
-
+
+
; restore bg palette 8
ld hl, wd03f ; last byte in Unkn1Pals
-
+
; save wram bank
ld a, [rSVBK]
ld d, a
@@ -63327,7 +63503,7 @@
; wram bank 5
ld a, 5
ld [rSVBK], a
-
+
; pop palette
ld e, 4 ; NUM_PAL_COLORS
.pop
@@ -63338,19 +63514,19 @@
dec hl
dec e
jr nz, .pop
-
+
; restore wram bank
ld a, d
ld [rSVBK], a
-
+
; update palettes
call _UpdateTimePals
call DelayFrame
-
+
; successful change
scf
ret
-
+
.dontchange
; no change occurred
and a
@@ -63489,7 +63665,9 @@
ld e, a
ld d, 0
ld hl, .TimePalettes
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -63576,29 +63754,31 @@
ld a, [hCGB]
and a
jr nz, .cgb
-
+
; else: dmg
; index
ld a, [TimeOfDayPal]
and %11
-
+
; get fade table
push bc
ld c, a
ld b, $0
ld hl, .dmgfades
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
pop bc
-
+
; get place in fade table
ld b, $0
add hl, bc
ret
-
+
.cgb
ld hl, .cgbfade
ld b, $0
@@ -63797,7 +63977,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_8c323
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -64006,7 +64188,9 @@
ld e, a
ld d, 0
ld hl, Unknown_8c490
- add_n_times hl, de, 5
+rept 5
+ add hl, de
+endr
ld a, [hli]
cp -1
jr z, .asm_8c47a
@@ -64380,7 +64564,9 @@
ld a, d
ld d, 0
ld hl, Unknown_8c728
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -64636,7 +64822,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_8ca1b
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -64734,7 +64922,9 @@
add e
ld e, a
ld hl, Unknown_8cab3
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -65138,7 +65328,9 @@
ld e, a
ld d, 0
ld hl, MagnetTrainBGTiles
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -65221,7 +65413,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_8ce06
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -65534,7 +65728,9 @@
ld e, a
ld d, 0
ld hl, Unknown_8d1c4
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ld e, l
ld d, h
ld hl, $0000
@@ -65850,7 +66046,9 @@
ld e, [hl]
ld d, 0
ld hl, Unknown_8d6e6
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -65867,7 +66065,9 @@
ld e, a
ld d, 0
ld hl, Unknown_8d94d
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ret
; 8d1ac
@@ -65875,7 +66075,9 @@
push hl
ld l, a
ld h, 0
- add_n_times hl, hl, 2
+rept 2
+ add hl, hl
+endr
ld de, Unknown_8e706
add hl, de
ld c, [hl]
@@ -65947,7 +66149,9 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_8d25b
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -68141,7 +68345,9 @@
ld a, d
ld d, 0
ld hl, Unknown_8e75d
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -68280,7 +68486,9 @@
Function8e849: ; 8e849
ld d, 0
ld hl, Jumptable_8e854
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -68549,7 +68757,7 @@
add 10
ld [wc3b7], a
ret
-
+
HeldItemIcons:
INCBIN "gfx/icon/mail.2bpp"
INCBIN "gfx/icon/item.2bpp"
@@ -68560,18 +68768,20 @@
ld l, e
ld h, d
jr GetIcon
-
+
GetIcon_a: ; 8ea1b
; Load icon graphics into VRAM starting from tile a.
ld l, a
ld h, 0
-
+
GetIcon: ; 8ea1e
; Load icon graphics into VRAM starting from tile hl.
; One tile is 16 bytes long.
- add_n_times hl, hl, 4
-
+rept 4
+ add hl, hl
+endr
+
ld de, VTiles0
add hl, de
push hl
@@ -68589,7 +68799,7 @@
ld e, a
ld d, [hl]
pop hl
-
+
lb bc, BANK(Icons), 8
call GetGFXUnlessMobile
@@ -69377,7 +69587,9 @@
ld c, b
ld b, 0
ld hl, Unknown_903d6
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld e, a
ld d, [hl]
@@ -70069,7 +70281,9 @@
ld e, a
ld d, 0
ld hl, Unknown_909f2
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld d, [hl]
ld e, a
@@ -70750,7 +70964,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_90f13
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -71536,7 +71752,9 @@
ld a, [wc6d4]
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -72352,7 +72570,9 @@
ld [EnemyTurnsTaken], a
ld hl, .StationPointers
ld d, $0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -72536,57 +72756,57 @@
TownMapBubble: ; 91bb5
; Draw the bubble containing the location text in the town map HUD
-
+
; Top-left corner
hlcoord 1, 0
ld a, $30
ld [hli], a
-
+
; Top row
ld bc, 16
ld a, " "
call ByteFill
-
+
; Top-right corner
ld a, $31
ld [hl], a
hlcoord 1, 1
-
-
+
+
; Middle row
ld bc, 18
ld a, " "
call ByteFill
-
-
+
+
; Bottom-left corner
hlcoord 1, 2
ld a, $32
ld [hli], a
-
+
; Bottom row
ld bc, 16
ld a, " "
call ByteFill
-
+
; Bottom-right corner
ld a, $33
ld [hl], a
-
-
+
+
; Print "Where?"
hlcoord 2, 0
ld de, .Where
call PlaceString
-
+
; Print the name of the default flypoint
call .Name
-
+
; Up/down arrows
hlcoord 18, 1
ld [hl], $34
ret
-
+
.Where
db "Where?@"
@@ -72599,9 +72819,9 @@
ld de, Flypoints
add hl, de
ld e, [hl]
-
+
callba GetLandmarkName
-
+
hlcoord 2, 1
ld de, StringBuffer1
call PlaceString
@@ -72708,45 +72928,45 @@
; 91c90
FlyMap: ; 91c90
-
+
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
-
+
; If we're not in a valid location, i.e. Pokecenter floor 2F,
; the backup map information is used
-
+
cp SPECIAL_MAP
jr nz, .CheckRegion
-
+
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
-
+
.CheckRegion
; The first 46 locations are part of Johto. The rest are in Kanto
cp KANTO_LANDMARK
jr nc, .KantoFlyMap
-
+
.JohtoFlyMap
; Note that .NoKanto should be modified in tandem with this branch
-
+
push af
-
+
; Start from New Bark Town
ld a, FLY_NEW_BARK
ld [DefaultFlypoint], a
-
+
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
; ..and end at Silver Cave
ld a, FLY_MT_SILVER
ld [EndFlypoint], a
-
+
; Fill out the map
call FillJohtoMap
call .MapHud
@@ -72753,27 +72973,27 @@
pop af
call TownMapPlayerIcon
ret
-
+
.KantoFlyMap
-
+
; The event that there are no flypoints enabled in a map is not
; accounted for. As a result, if you attempt to select a flypoint
; when there are none enabled, the game will crash. Additionally,
; the flypoint selection has a default starting point that
; can be flown to even if none are enabled
-
+
; To prevent both of these things from happening when the player
; enters Kanto, fly access is restricted until Indigo Plateau is
; visited and its flypoint enabled
-
+
push af
ld c, SPAWN_INDIGO
call HasVisitedSpawn
and a
jr z, .NoKanto
-
+
; Kanto's map is only loaded if we've visited Indigo Plateau
-
+
; Flypoints begin at Pallet Town...
ld a, FLY_PALLET
ld [StartFlypoint], a
@@ -72780,11 +73000,11 @@
; ...and end at Indigo Plateau
ld a, FLY_INDIGO
ld [EndFlypoint], a
-
+
; Because Indigo Plateau is the first flypoint the player
; visits, it's made the default flypoint
ld [DefaultFlypoint], a
-
+
; Fill out the map
call FillKantoMap
call .MapHud
@@ -72791,31 +73011,31 @@
pop af
call TownMapPlayerIcon
ret
-
+
.NoKanto
; If Indigo Plateau hasn't been visited, we use Johto's map instead
-
+
; Start from New Bark Town
ld a, FLY_NEW_BARK
ld [DefaultFlypoint], a
-
+
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
; ..and end at Silver Cave
ld a, FLY_MT_SILVER
ld [EndFlypoint], a
-
+
call FillJohtoMap
-
+
pop af
-
+
.MapHud
call TownMapBubble
call TownMapPals
-
+
ld hl, VBGMap0 ; BG Map 0
call TownMapBGUpdate
-
+
call TownMapMon
ld a, c
ld [wd003], a
@@ -73119,25 +73339,25 @@
ld [hBGMapAddress], a
ld a, h
ld [$ffd7], a
-
+
; Only update palettes on CGB
ld a, [hCGB]
and a
jr z, .tiles
-
+
; BG Map mode 2 (palettes)
ld a, 2
ld [hBGMapMode], a
-
+
; The BG Map is updated in thirds, so we wait
; 3 frames to update the whole screen's palettes.
ld c, 3
call DelayFrames
-
+
.tiles
; Update BG Map tiles
call WaitBGMap
-
+
; Turn off BG Map update
xor a
ld [hBGMapMode], a
@@ -73147,10 +73367,10 @@
FillJohtoMap: ; 91eff
ld de, JohtoMap
jr FillTownMap
-
+
FillKantoMap: ; 91f04
ld de, KantoMap
-
+
FillTownMap: ; 91f07
hlcoord 0, 0
.loop
@@ -73173,17 +73393,17 @@
; Current tile
ld a, [hli]
push hl
-
+
; HP/borders use palette 0
cp $60
jr nc, .pal0
-
+
; The palette data is condensed to nybbles,
; least-significant first.
ld hl, TownMapPalMap
srl a
jr c, .odd
-
+
; Even-numbered tile ids take the bottom nybble...
add l
ld l, a
@@ -73193,7 +73413,7 @@
ld a, [hl]
and %111
jr .update
-
+
.odd
; ...and odd ids take the top.
add l
@@ -73205,10 +73425,10 @@
swap a
and %111
jr .update
-
+
.pal0
xor a
-
+
.update
pop hl
ld [de], a
@@ -73237,16 +73457,16 @@
add hl, de
ld a, [hl]
ld [wd265], a
-
+
; Get FlyMon icon
ld e, 8 ; starting tile in VRAM
callba GetSpeciesIcon
-
+
; Animation/palette
ld de, $0000
ld a, $0
call Function3b2a
-
+
ld hl, 3
add hl, bc
ld [hl], 8
@@ -73259,14 +73479,14 @@
TownMapPlayerIcon: ; 91fa6
; Draw the player icon at town map location in a
push af
-
+
callba GetPlayerIcon
-
+
; Standing icon
ld hl, $8100
ld c, 4 ; # tiles
call Request2bpp
-
+
; Walking icon
ld hl, $00c0
add hl, de
@@ -73276,7 +73496,7 @@
ld c, 4 ; # tiles
ld a, BANK(ChrisSpriteGFX) ; does nothing
call Request2bpp
-
+
; Animation/palette
ld de, $0000
ld b, $0a ; Male
@@ -73287,17 +73507,17 @@
.asm_91fd3
ld a, b
call Function3b2a
-
+
ld hl, $0003
add hl, bc
ld [hl], $10
-
+
pop af
ld e, a
push bc
callba GetLandmarkCoords
pop bc
-
+
ld hl, 4
add hl, bc
ld [hl], e
@@ -73667,7 +73887,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_92853
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -74244,7 +74466,9 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_92be4
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -74743,7 +74967,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_92ebd
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -74844,7 +75070,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_92f48
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -75251,7 +75479,9 @@
ld e, a
ld d, 0
ld hl, Unknown_93195
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ld de, StringBuffer2
ld bc, $4
call CopyBytes
@@ -75362,7 +75592,9 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_9322d
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -75458,7 +75690,9 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_932bc
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -76094,7 +76328,9 @@
ld e, a
ld d, 0
ld hl, TreeMons
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
@@ -76451,7 +76687,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_b863a
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -76631,7 +76869,9 @@
ld hl, Unknown_b87f2
ld c, a
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld b, [hl]
inc hl
ld c, [hl]
@@ -76679,7 +76919,9 @@
jr nc, .loop2
ld e, a
ld d, 0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
inc hl
ld a, BANK(WildMons1)
call GetFarByte
@@ -76792,7 +77034,9 @@
ld e, a
ld d, 0
ld hl, Unknown_b8869
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -76921,7 +77165,9 @@
ld e, a
ld d, 0
ld hl, Unknown_b88fe
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -77215,7 +77461,9 @@
ld hl, PokedexDataPointerTable
ld c, a
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, BANK(PokedexDataPointerTable)
call GetFarHalfword
call Functionb8a2d
@@ -77727,7 +77975,9 @@
ld e, a
ld d, 0
ld hl, Unknown_b8d7d
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -77866,7 +78116,9 @@
ld hl, Unknown_b8e11
ld c, a
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld b, [hl]
inc hl
ld c, [hl]
@@ -77902,7 +78154,9 @@
ld e, a
ld d, 0
ld hl, Unknown_b8e52
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -78141,7 +78395,9 @@
ld hl, Unknown_b8ff9
ld d, 0
ld e, a
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -78155,7 +78411,9 @@
push hl
ld hl, Jumptable_b8fb8
ld e, b
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -78499,7 +78757,9 @@
ld a, [wd002]
ld c, a
ld b, 0
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -79895,7 +80155,9 @@
call Functione0057
ld hl, Unknown_e008b
pop bc
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld e, a
ld d, [hl]
@@ -80063,7 +80325,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_e01a0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -80265,7 +80529,9 @@
ld e, a
ld d, $0
ld hl, wc6d0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [wcf66]
ld e, a
add hl, de
@@ -80426,7 +80692,9 @@
ld e, a
ld d, 0
ld hl, Unknown_e0459
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld e, a
ld d, [hl]
@@ -80643,7 +80911,9 @@
and a
jr nz, .asm_e0575
hlcoord 13, 3
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80652,7 +80922,9 @@
.asm_e0575
hlcoord 13, 3
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80667,7 +80939,9 @@
and a
jr nz, .asm_e0599
hlcoord 13, 4
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $3b
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80676,7 +80950,9 @@
.asm_e0599
hlcoord 13, 4
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80691,7 +80967,9 @@
and a
jr nz, .asm_e05bd
hlcoord 13, 6
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80700,7 +80978,9 @@
.asm_e05bd
hlcoord 13, 6
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80715,7 +80995,9 @@
and a
jr nz, .asm_e05e1
hlcoord 13, 7
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80724,7 +81006,9 @@
.asm_e05e1
hlcoord 13, 7
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80739,7 +81023,9 @@
and a
jr nz, .asm_e0605
hlcoord 13, 9
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80748,7 +81034,9 @@
.asm_e0605
hlcoord 13, 9
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80763,7 +81051,9 @@
and a
jr nz, .asm_e0629
hlcoord 13, 10
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@@ -80772,7 +81062,9 @@
.asm_e0629
hlcoord 13, 10
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -81335,7 +81627,9 @@
.asm_e096d
call Functione0398
- add_n_times hl, hl, 2
+rept 2
+ add hl, hl
+endr
ld de, Unknown_e0981
add hl, de
ld a, [hli]
@@ -81836,7 +82130,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_e12d9
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -82118,8 +82414,12 @@
add hl, de
ld a, [wcf65]
ld e, a
- add_n_times hl, de, 4
- add_n_times hl, de, 2
+rept 4
+ add hl, de
+endr
+rept 2
+ add hl, de
+endr
ret
; e1475
@@ -82479,7 +82779,9 @@
ld e, a
ld d, 0
ld hl, Unknown_e17bd
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -82576,7 +82878,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_e1ee1
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -82934,7 +83238,9 @@
dec a
ld l, a
ld h, 0
- add_n_times hl, hl, 3
+rept 3
+ add hl, hl
+endr
ld de, Unknown_e2110
add hl, de
ret
@@ -83262,7 +83568,9 @@
ld e, a
ld d, 0
ld hl, BillsPCDepositJumptable
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -83525,7 +83833,9 @@
ld e, a
ld d, 0
ld hl, BillsPCWithdrawJumptable
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -83785,7 +84095,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_e2881
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -84272,7 +84584,9 @@
ld e, a
ld d, $0
ld hl, wc801
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ld a, [hl]
and a
jr z, .asm_e2bc6
@@ -84379,7 +84693,9 @@
ld e, a
ld d, 0
ld hl, OverworldMap
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ld e, l
ld d, h
hlcoord 9, 4
@@ -84634,7 +84950,9 @@
ld e, a
ld d, $0
ld hl, OverworldMap
- add_n_times hl, de, 3
+rept 3
+ add hl, de
+endr
ld a, [hl]
ret
@@ -85141,7 +85459,9 @@
.asm_e321d
ld hl, Jumptable_e3245
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -85343,7 +85663,9 @@
ld c, b
ld b, 0
ld hl, Unknown_e33a6
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld a, [hli]
ld b, a
ld a, [hli]
@@ -85382,7 +85704,9 @@
Functione33df: ; e33df (38:73df)
ld e, a
ld d, $0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -85552,7 +85876,9 @@
ld c, a
ld b, 0
ld hl, Unknown_e36a5
- add_n_times hl, bc, 3
+rept 3
+ add hl, bc
+endr
ld a, [hli]
ld b, a
call GetSRAMBank
@@ -85841,7 +86167,9 @@
ld e, a ;copy it to de
ld d, 0
ld hl, .Pointers
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -85897,7 +86225,9 @@
.NonePressed
ld b, 0
ld hl, .Strings
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -86115,7 +86445,9 @@
.NonePressed
ld b, $0
ld hl, .Strings
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -86451,7 +86783,9 @@
ld e, a
ld d, 0
ld hl, Jumptable_e467f
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -86548,7 +86882,9 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_e46fd
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -86644,7 +86980,9 @@
ld e, a
ld d, $0
ld hl, Unknown_e47ac
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
@@ -86758,7 +87096,9 @@
ld e, a
ld d, 0
ld hl, IntroScenes
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -87989,7 +88329,9 @@
pop hl
push hl
ld hl, Unknown_e5288
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld d, [hl]
ld e, a
@@ -88000,7 +88342,9 @@
ld [hli], a
push hl
ld hl, Unknown_e52c8
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld d, [hl]
ld e, a
@@ -88011,7 +88355,9 @@
ld [hli], a
push hl
ld hl, Unknown_e5308
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld d, [hl]
ld e, a
@@ -89113,7 +89459,9 @@
ld [CurSpecies], a
call GetBaseData
ld hl, wcbea
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [BaseType1]
cp [hl]
jr nz, .asm_fb5db
@@ -89785,7 +90133,9 @@
ld e, a
ld d, 0
ld hl, UnownWords
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [hli]
ld e, a
ld d, [hl]
@@ -90557,7 +90907,9 @@
ld e, a
ld d, 0
ld hl, NPCTrades
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
pop de
add hl, de
ret
@@ -90690,7 +91042,9 @@
call AddNTimes
ld a, [wcf64]
ld c, a
- add_n_times hl, bc, 2
+rept 2
+ add hl, bc
+endr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -91070,7 +91424,9 @@
.incave
ld l, a
ld h, 0
- add_n_times hl, hl, 3 ; multiply hl by 8
+rept 3 ; multiply hl by 8
+ add hl, hl
+endr
add hl, de
ret
; fd136
@@ -91587,7 +91943,9 @@
ld a, b
ld l, c
ld h, $0
- add_n_times hl, hl, 4
+rept 4
+ add hl, hl
+endr
ld b, h
ld c, l
ld h, d
@@ -91644,7 +92002,9 @@
ld a, b
ld l, c
ld h, $0
- add_n_times hl, hl, 3
+rept 3
+ add hl, hl
+endr
ld c, l
ld b, h
ld h, d
@@ -92369,7 +92729,9 @@
ld hl, $abe6
ld e, a
ld d, $0
- add_n_times hl, de, 2
+rept 2
+ add hl, de
+endr
ld a, [wc901]
ld [hli], a
ld a, [wc902]
@@ -93882,38 +94244,38 @@
ld a, [hBattleTurn]
and a
jr nz, .start
-
+
ld a, [wPlayerMoveStruct + MOVE_ANIM]
call UpdateUsedMoves
-
+
.start
ld a, BATTLE_VARS_LAST_MOVE
call GetBattleVarAddr
ld d, h
ld e, l
-
+
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
call GetBattleVarAddr
-
+
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld [wd265], a
-
+
push hl
callba Function34548
pop hl
jr nz, .grammar
-
+
; update last move
ld a, [wd265]
ld [hl], a
ld [de], a
-
+
.grammar
call GetMoveGrammar
; wd265 now contains MoveGrammar
-
-
+
+
; everything except 'instead' made redundant in localization
; check obedience
@@ -93921,7 +94283,7 @@
and a
ld hl, UsedMove2Text
ret nz
-
+
; check move grammar
ld a, [wd265]
cp $3
@@ -93970,13 +94332,13 @@
GetUsedMoveTextEnder: ; 105e28
; get start address
ld hl, .endusedmovetexts
-
+
; get move id
ld a, [wd265]
-
+
; 2-byte pointer
add a
-
+
; seek
push bc
ld b, $0
@@ -93983,7 +94345,7 @@
ld c, a
add hl, bc
pop bc
-
+
; get pointer to usedmovetext ender
ld a, [hli]
ld h, [hl]
@@ -94029,7 +94391,7 @@
ld a, [wd265]
ld c, a
ld b, $0
-
+
; read grammar table
ld hl, MoveGrammar
.loop
@@ -94046,12 +94408,12 @@
; next grammar type
inc b
jr .loop
-
+
.end
; wd265 now contains move grammar
ld a, b
ld [wd265], a
-
+
; we're done
pop bc
ret
@@ -94092,7 +94454,7 @@
db PSYCH_UP
db EXTREMESPEED
db 0 ; end set
-
+
; 1
db RECOVER
db TELEPORT
@@ -94101,7 +94463,7 @@
db AMNESIA
db FLAIL
db 0 ; end set
-
+
; 2
db MEDITATE
db AGILITY
@@ -94112,7 +94474,7 @@
db STRUGGLE
db SCARY_FACE
db 0 ; end set
-
+
; 3
db POUND
db SCRATCH
@@ -94153,7 +94515,7 @@
db ATTRACT
db ROCK_SMASH
db 0 ; end set
-
+
; all other moves = 4
db $ff ; end
; 105ed0
@@ -94169,7 +94531,7 @@
ld b, a
; next count
ld c, NUM_MOVES
-
+
.loop
; get move from the list
ld a, [hli]
@@ -94182,7 +94544,7 @@
; next byte
dec c
jr nz, .loop
-
+
; if the list is full and the move hasn't already been used
; shift the list back one byte, deleting the first move used
; this can occur with struggle or a new learned move
@@ -94202,13 +94564,13 @@
ld a, b
ld [PlayerUsedMoves + 3], a
jr .quit
-
+
.add
; go back to the byte we just inced from
dec hl
; add the new move
ld [hl], b
-
+
.quit
; list updated
pop bc
@@ -96050,7 +96412,7 @@
db A_BUTTON, $00
db NO_INPUT, $ff ; end
; 1de2a5
-
+
DudeAutoInput_RightA: ; 1de2a5
db NO_INPUT, $08
db D_RIGHT, $00
@@ -96058,7 +96420,7 @@
db A_BUTTON, $00
db NO_INPUT, $ff ; end
; 1de2af
-
+
DudeAutoInput_DownA: ; 1de2af
db NO_INPUT, $fe
db NO_INPUT, $fe