mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Fix unnecessary white space and retire add_n_times
This commit is contained in:
parent
bef792f2d2
commit
d9300a9bec
172
battle/core.asm
172
battle/core.asm
@ -6202,25 +6202,25 @@ LoadEnemyMon: ; 3e8eb
|
||||
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:
|
||||
|
||||
@ -6228,15 +6228,15 @@ LoadEnemyMon: ; 3e8eb
|
||||
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
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
cp BATTLETYPE_FORCEITEM
|
||||
ld a, [BaseItems]
|
||||
jr z, .UpdateItem
|
||||
|
||||
|
||||
; Failing that, it's all up to chance
|
||||
; Effective chances:
|
||||
; 75% None
|
||||
@ -6258,30 +6258,30 @@ LoadEnemyMon: ; 3e8eb
|
||||
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
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
ld a, [IsInBattle]
|
||||
dec a
|
||||
jr nz, .UpdateDVs
|
||||
|
||||
|
||||
|
||||
|
||||
; Wild DVs
|
||||
; Here's where the fun starts
|
||||
|
||||
@ -6314,7 +6314,7 @@ LoadEnemyMon: ; 3e8eb
|
||||
ld a, [BattleType]
|
||||
cp a, BATTLETYPE_ROAMING
|
||||
jr nz, .NotRoaming
|
||||
|
||||
|
||||
; Grab HP
|
||||
call GetRoamMonHP
|
||||
ld a, [hl]
|
||||
@ -6322,7 +6322,7 @@ LoadEnemyMon: ; 3e8eb
|
||||
and a
|
||||
; We'll do something with the result in a minute
|
||||
push af
|
||||
|
||||
|
||||
; Grab DVs
|
||||
call GetRoamMonDVs
|
||||
inc hl
|
||||
@ -6334,7 +6334,7 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
; We're done with DVs
|
||||
jr .UpdateDVs
|
||||
|
||||
|
||||
|
||||
.NotRoaming
|
||||
; Register a contains BattleType
|
||||
|
||||
@ -6360,36 +6360,36 @@ LoadEnemyMon: ; 3e8eb
|
||||
ld b, ATKDEFDV_SHINY ; $ea
|
||||
ld c, SPDSPCDV_SHINY ; $aa
|
||||
jr .UpdateDVs
|
||||
|
||||
|
||||
.GenerateDVs
|
||||
; Generate new random DVs
|
||||
call BattleRandom
|
||||
ld b, a
|
||||
call BattleRandom
|
||||
ld c, a
|
||||
|
||||
|
||||
.UpdateDVs
|
||||
; Input DVs in register bc
|
||||
ld hl, EnemyMonDVs
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
; 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 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
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,15 +6526,15 @@ LoadEnemyMon: ; 3e8eb
|
||||
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
|
||||
ld a, [EnemyMonHP + 1]
|
||||
ld [hl], a
|
||||
jr .Moves
|
||||
|
||||
|
||||
|
||||
|
||||
.OpponentParty
|
||||
; Get HP from the party struct
|
||||
ld hl, (OTPartyMon1HP + 1)
|
||||
@ -6544,17 +6544,17 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
inc de
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
|
||||
|
||||
; Get moves
|
||||
ld de, EnemyMonMoves
|
||||
; Are we in a trainer battle?
|
||||
@ -6577,7 +6577,7 @@ LoadEnemyMon: ; 3e8eb
|
||||
ld bc, NUM_MOVES
|
||||
call CopyBytes
|
||||
jr .PP
|
||||
|
||||
|
||||
.WildMoves
|
||||
; Clear EnemyMonMoves
|
||||
xor a
|
||||
@ -6591,19 +6591,19 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ LoadEnemyMon: ; 3e8eb
|
||||
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 @@ CheckSleepingTreeMon: ; 3eb38
|
||||
ld a, [BattleType]
|
||||
cp a, BATTLETYPE_TREE
|
||||
jr nz, .NotSleeping
|
||||
|
||||
|
||||
; Get list for the time of day
|
||||
ld hl, .Morn
|
||||
ld a, [TimeOfDay]
|
||||
@ -6682,14 +6682,14 @@ CheckSleepingTreeMon: ; 3eb38
|
||||
ld hl, .Day
|
||||
jr z, .Check
|
||||
ld hl, .Nite
|
||||
|
||||
|
||||
.Check
|
||||
ld a, [TempEnemyMonSpecies]
|
||||
ld de, 1 ; length of species id
|
||||
call IsInArray
|
||||
; If it's a match, the opponent is asleep
|
||||
ret c
|
||||
|
||||
|
||||
.NotSleeping
|
||||
and a
|
||||
ret
|
||||
@ -6728,24 +6728,24 @@ CheckSleepingTreeMon: ; 3eb38
|
||||
|
||||
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
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
|
||||
|
||||
push de
|
||||
ld a, [UnownLetter]
|
||||
ld de, 1
|
||||
@ -6753,9 +6753,9 @@ CheckUnownLetter: ; 3eb75
|
||||
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 @@ CheckUnownLetter: ; 3eb75
|
||||
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 @@ CheckUnownLetter: ; 3eb75
|
||||
.Set4
|
||||
; X Y Z
|
||||
db 24, 25, 26, $ff
|
||||
|
||||
|
||||
; 3ebc7
|
||||
|
||||
|
||||
|
@ -6,16 +6,18 @@ FishAction: ; 92402
|
||||
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 @@ Fish: ; 9241a
|
||||
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,21 +78,20 @@ Fish: ; 9241a
|
||||
; Level
|
||||
ld e, [hl]
|
||||
ret
|
||||
|
||||
|
||||
.NoBite
|
||||
ld de, 0
|
||||
ret
|
||||
|
||||
|
||||
.TimeEncounter
|
||||
|
||||
; The level byte is repurposed as the index for the new table.
|
||||
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 @@ Fish: ; 9241a
|
||||
jr c, .TimeSpecies
|
||||
inc hl
|
||||
inc hl
|
||||
|
||||
|
||||
.TimeSpecies
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
@ -115,27 +118,27 @@ GetFishGroupHeader: ; 9245b
|
||||
bit 2, [hl]
|
||||
pop hl
|
||||
jr z, .end
|
||||
|
||||
|
||||
; Groups 11 and 12 have special attributes.
|
||||
ld a, d
|
||||
cp 11
|
||||
jr z, .group11
|
||||
cp 12
|
||||
jr z, .group12
|
||||
|
||||
|
||||
.end
|
||||
dec d
|
||||
ld e, d
|
||||
ld d, 0
|
||||
ret
|
||||
|
||||
|
||||
.group11
|
||||
ld a, [wdfce]
|
||||
cp 1
|
||||
jr nz, .end
|
||||
ld d, 6
|
||||
jr .end
|
||||
|
||||
|
||||
.group12
|
||||
ld a, [wdfce]
|
||||
cp 2
|
||||
|
@ -806,7 +806,9 @@ Function9764: ; 9764
|
||||
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 @@ Functionb1de: ; b1de
|
||||
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 @@ Functionb1de: ; b1de
|
||||
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]
|
||||
|
@ -472,7 +472,9 @@ Function968ec: ; 968ec
|
||||
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 @@ Function96beb: ; 96beb
|
||||
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]
|
||||
|
@ -226,7 +226,9 @@ Function444d: ; 444d
|
||||
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 @@ Function4a46: ; 4a46
|
||||
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 @@ Function5ac2: ; 5ac2
|
||||
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]
|
||||
|
@ -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
|
@ -3144,7 +3144,9 @@ ExitScriptSubroutine: ; 0x97b9a
|
||||
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 " "
|
||||
|
@ -56,7 +56,9 @@ LoadSpawnPoint: ; 1531f
|
||||
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]
|
||||
|
@ -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]
|
||||
|
24
home.asm
24
home.asm
@ -715,14 +715,14 @@ ClearPalettes:: ; 3317
|
||||
ld a, [hCGB]
|
||||
and a
|
||||
jr nz, .cgb
|
||||
|
||||
|
||||
; DMG: just change palettes to 0 (white)
|
||||
xor a
|
||||
ld [rBGP], a
|
||||
ld [rOBP0], a
|
||||
ld [rOBP1], a
|
||||
ret
|
||||
|
||||
|
||||
.cgb
|
||||
ld a, [rSVBK]
|
||||
push af
|
||||
@ -755,11 +755,11 @@ GetSGBLayout:: ; 3340
|
||||
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 @@ GetName:: ; 33c3
|
||||
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 @@ GetBaseData:: ; 3856
|
||||
push af
|
||||
ld a, BANK(BaseData)
|
||||
rst Bankswitch
|
||||
|
||||
|
||||
; Egg doesn't have BaseData
|
||||
ld a, [CurSpecies]
|
||||
cp EGG
|
||||
@ -1803,16 +1805,16 @@ GetBaseData:: ; 3856
|
||||
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 @@ GetBaseData:: ; 3856
|
||||
inc hl
|
||||
ld [hl], d
|
||||
jr .end
|
||||
|
||||
|
||||
.end
|
||||
; Replace Pokedex # with species
|
||||
ld a, [CurSpecies]
|
||||
ld [BaseDexNo], a
|
||||
|
||||
|
||||
pop af
|
||||
rst Bankswitch
|
||||
pop hl
|
||||
|
12
home/map.asm
12
home/map.asm
@ -150,7 +150,9 @@ Function2198:: ; 2198
|
||||
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 @@ GetFacingTileCoord:: ; 2a07
|
||||
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 @@ Function2a3c:: ; 2a3c
|
||||
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]
|
||||
|
@ -493,7 +493,9 @@ Function1a2f:: ; 1a2f
|
||||
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 @@ Function1a47:: ; 1a47
|
||||
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 @@ Function1a71:: ; 1a71
|
||||
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
|
||||
|
@ -142,9 +142,3 @@ bcd: MACRO
|
||||
shift
|
||||
endr
|
||||
ENDM
|
||||
|
||||
add_n_times: MACRO
|
||||
rept \3
|
||||
add \1, \2
|
||||
endr
|
||||
ENDM
|
||||
|
Loading…
Reference in New Issue
Block a user