You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Split items/ and trainers/ into their data/ and engine/ components
Move some data into a pokemon/ subdirectory
This commit is contained in:
3313
engine/item_effects.asm
Normal file
3313
engine/item_effects.asm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -47,7 +47,7 @@ GetLandmarkName:: ; 0x1ca8a5
|
||||
; 0x1ca8c3
|
||||
|
||||
|
||||
INCLUDE "data/landmarks.asm"
|
||||
INCLUDE "data/maps/landmarks.asm"
|
||||
|
||||
|
||||
RegionCheck: ; 0x1caea1
|
||||
|
||||
@@ -466,7 +466,7 @@ ReadMonMenuIcon: ; 8eab3
|
||||
; 8eac4
|
||||
|
||||
|
||||
INCLUDE "data/mon_menu_icons.asm"
|
||||
INCLUDE "data/pokemon/menu_icons.asm"
|
||||
|
||||
INCLUDE "gfx/icon_pointers.asm"
|
||||
|
||||
|
||||
@@ -721,6 +721,6 @@ INCLUDE "data/emote_headers.asm"
|
||||
|
||||
INCLUDE "data/sprite_mons.asm"
|
||||
|
||||
INCLUDE "data/outdoor_sprites.asm"
|
||||
INCLUDE "data/maps/outdoor_sprites.asm"
|
||||
|
||||
INCLUDE "gfx/sprite_headers.asm"
|
||||
|
||||
88
engine/pokeball_wobble.asm
Executable file
88
engine/pokeball_wobble.asm
Executable file
@@ -0,0 +1,88 @@
|
||||
GetPokeBallWobble: ; f971 (3:7971)
|
||||
; Returns whether a Poke Ball will wobble in the catch animation.
|
||||
; Whether a Pokemon is caught is determined beforehand.
|
||||
|
||||
push de
|
||||
|
||||
ld a, [rSVBK]
|
||||
ld d, a
|
||||
push de
|
||||
|
||||
ld a, 1 ; BANK(Buffer2)
|
||||
ld [rSVBK], a
|
||||
|
||||
ld a, [Buffer2]
|
||||
inc a
|
||||
ld [Buffer2], a
|
||||
|
||||
; Wobble up to 3 times.
|
||||
cp 3 + 1
|
||||
jr z, .finished
|
||||
|
||||
ld a, [wWildMon]
|
||||
and a
|
||||
ld c, 0 ; next
|
||||
jr nz, .done
|
||||
|
||||
ld hl, .WobbleProbabilities
|
||||
ld a, [Buffer1]
|
||||
ld b, a
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr nc, .checkwobble
|
||||
inc hl
|
||||
jr .loop
|
||||
|
||||
.checkwobble
|
||||
ld b, [hl]
|
||||
call Random
|
||||
cp b
|
||||
ld c, 0 ; next
|
||||
jr c, .done
|
||||
ld c, 2 ; escaped
|
||||
jr .done
|
||||
|
||||
.finished
|
||||
ld a, [wWildMon]
|
||||
and a
|
||||
ld c, 1 ; caught
|
||||
jr nz, .done
|
||||
ld c, 2 ; escaped
|
||||
|
||||
.done
|
||||
pop de
|
||||
ld e, a
|
||||
ld a, d
|
||||
ld [rSVBK], a
|
||||
ld a, e
|
||||
pop de
|
||||
ret
|
||||
|
||||
.WobbleProbabilities: ; f9ba
|
||||
; catch rate, chance of wobbling / 255
|
||||
; nLeft/255 = (nRight/255) ** 4
|
||||
db 1, 63
|
||||
db 2, 75
|
||||
db 3, 84
|
||||
db 4, 90
|
||||
db 5, 95
|
||||
db 7, 103
|
||||
db 10, 113
|
||||
db 15, 126
|
||||
db 20, 134
|
||||
db 30, 149
|
||||
db 40, 160
|
||||
db 50, 169
|
||||
db 60, 177
|
||||
db 80, 191
|
||||
db 100, 201
|
||||
db 120, 211
|
||||
db 140, 220
|
||||
db 160, 227
|
||||
db 180, 234
|
||||
db 200, 240
|
||||
db 220, 246
|
||||
db 240, 251
|
||||
db 254, 253
|
||||
db 255, 255
|
||||
@@ -1709,9 +1709,9 @@ Pokedex_ABCMode: ; 40c30
|
||||
ret
|
||||
|
||||
|
||||
INCLUDE "data/pokedex/order_alpha.asm"
|
||||
INCLUDE "data/pokemon/dex_order_alpha.asm"
|
||||
|
||||
INCLUDE "data/pokedex/order_new.asm"
|
||||
INCLUDE "data/pokemon/dex_order_new.asm"
|
||||
|
||||
|
||||
Pokedex_DisplayModeDescription: ; 40e5b
|
||||
|
||||
64
engine/read_trainer_attributes.asm
Normal file
64
engine/read_trainer_attributes.asm
Normal file
@@ -0,0 +1,64 @@
|
||||
GetTrainerClassName: ; 3952d
|
||||
ld hl, RivalName
|
||||
ld a, c
|
||||
cp RIVAL1
|
||||
jr z, .rival
|
||||
|
||||
ld [CurSpecies], a
|
||||
ld a, TRAINER_NAME
|
||||
ld [wNamedObjectTypeBuffer], a
|
||||
call GetName
|
||||
ld de, StringBuffer1
|
||||
ret
|
||||
|
||||
.rival
|
||||
ld de, StringBuffer1
|
||||
push de
|
||||
ld bc, NAME_LENGTH
|
||||
call CopyBytes
|
||||
pop de
|
||||
ret
|
||||
|
||||
GetOTName: ; 39550
|
||||
ld hl, OTPlayerName
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
jr nz, .ok
|
||||
|
||||
ld hl, RivalName
|
||||
ld a, c
|
||||
cp RIVAL1
|
||||
jr z, .ok
|
||||
|
||||
ld [CurSpecies], a
|
||||
ld a, TRAINER_NAME
|
||||
ld [wNamedObjectTypeBuffer], a
|
||||
call GetName
|
||||
ld hl, StringBuffer1
|
||||
|
||||
.ok
|
||||
ld bc, TRAINER_CLASS_NAME_LENGTH
|
||||
ld de, OTClassName
|
||||
push de
|
||||
call CopyBytes
|
||||
pop de
|
||||
ret
|
||||
|
||||
GetTrainerAttributes: ; 3957b
|
||||
ld a, [TrainerClass]
|
||||
ld c, a
|
||||
call GetOTName
|
||||
ld a, [TrainerClass]
|
||||
dec a
|
||||
ld hl, TrainerClassAttributes + TRNATTR_ITEM1
|
||||
ld bc, NUM_TRAINER_ATTRIBUTES
|
||||
call AddNTimes
|
||||
ld de, wEnemyTrainerItem1
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
ld a, [hl]
|
||||
ld [wEnemyTrainerBaseReward], a
|
||||
ret
|
||||
398
engine/read_trainer_party.asm
Executable file
398
engine/read_trainer_party.asm
Executable file
@@ -0,0 +1,398 @@
|
||||
|
||||
ReadTrainerParty: ; 39771
|
||||
ld a, [InBattleTowerBattle]
|
||||
bit 0, a
|
||||
ret nz
|
||||
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
ld hl, OTPartyCount
|
||||
xor a
|
||||
ld [hli], a
|
||||
dec a
|
||||
ld [hl], a
|
||||
|
||||
ld hl, OTPartyMons
|
||||
ld bc, OTPartyMonsEnd - OTPartyMons
|
||||
xor a
|
||||
call ByteFill
|
||||
|
||||
ld a, [OtherTrainerClass]
|
||||
cp CAL
|
||||
jr nz, .not_cal2
|
||||
ld a, [OtherTrainerID]
|
||||
cp CAL2
|
||||
jr z, .cal2
|
||||
ld a, [OtherTrainerClass]
|
||||
.not_cal2
|
||||
|
||||
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, [OtherTrainerID]
|
||||
ld b, a
|
||||
.skip_trainer
|
||||
dec b
|
||||
jr z, .got_trainer
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
jr nz, .loop
|
||||
jr .skip_trainer
|
||||
.got_trainer
|
||||
|
||||
.skip_name
|
||||
ld a, [hli]
|
||||
cp "@"
|
||||
jr nz, .skip_name
|
||||
|
||||
ld a, [hli]
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld hl, TrainerTypes
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld bc, .done
|
||||
push bc
|
||||
jp hl
|
||||
|
||||
.done
|
||||
jp ComputeTrainerReward
|
||||
|
||||
.cal2
|
||||
ld a, BANK(sMysteryGiftTrainer)
|
||||
call GetSRAMBank
|
||||
ld de, sMysteryGiftTrainer
|
||||
call TrainerType2
|
||||
call CloseSRAM
|
||||
jr .done
|
||||
; 397e3
|
||||
|
||||
TrainerTypes: ; 397e3
|
||||
dw TrainerType1 ; level, species
|
||||
dw TrainerType2 ; level, species, moves
|
||||
dw TrainerType3 ; level, species, item
|
||||
dw TrainerType4 ; level, species, item, moves
|
||||
; 397eb
|
||||
|
||||
TrainerType1: ; 397eb
|
||||
; normal (level, species)
|
||||
ld h, d
|
||||
ld l, e
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
ret z
|
||||
|
||||
ld [CurPartyLevel], a
|
||||
ld a, [hli]
|
||||
ld [CurPartySpecies], a
|
||||
ld a, OTPARTYMON
|
||||
ld [MonType], a
|
||||
push hl
|
||||
predef TryAddMonToParty
|
||||
pop hl
|
||||
jr .loop
|
||||
; 39806
|
||||
|
||||
TrainerType2: ; 39806
|
||||
; moves
|
||||
ld h, d
|
||||
ld l, e
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
ret z
|
||||
|
||||
ld [CurPartyLevel], a
|
||||
ld a, [hli]
|
||||
ld [CurPartySpecies], a
|
||||
ld a, OTPARTYMON
|
||||
ld [MonType], a
|
||||
|
||||
push hl
|
||||
predef TryAddMonToParty
|
||||
ld a, [OTPartyCount]
|
||||
dec a
|
||||
ld hl, OTPartyMon1Moves
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
|
||||
ld b, NUM_MOVES
|
||||
.copy_moves
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .copy_moves
|
||||
|
||||
push hl
|
||||
|
||||
ld a, [OTPartyCount]
|
||||
dec a
|
||||
ld hl, OTPartyMon1Species
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld hl, MON_PP
|
||||
add hl, de
|
||||
push hl
|
||||
ld hl, MON_MOVES
|
||||
add hl, de
|
||||
pop de
|
||||
|
||||
ld b, NUM_MOVES
|
||||
.copy_pp
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr z, .copied_pp
|
||||
|
||||
push hl
|
||||
push bc
|
||||
dec a
|
||||
ld hl, Moves + MOVE_PP
|
||||
ld bc, MOVE_LENGTH
|
||||
call AddNTimes
|
||||
ld a, BANK(Moves)
|
||||
call GetFarByte
|
||||
pop bc
|
||||
pop hl
|
||||
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .copy_pp
|
||||
.copied_pp
|
||||
|
||||
pop hl
|
||||
jr .loop
|
||||
; 39871
|
||||
|
||||
TrainerType3: ; 39871
|
||||
; item
|
||||
ld h, d
|
||||
ld l, e
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
ret z
|
||||
|
||||
ld [CurPartyLevel], a
|
||||
ld a, [hli]
|
||||
ld [CurPartySpecies], a
|
||||
ld a, OTPARTYMON
|
||||
ld [MonType], a
|
||||
push hl
|
||||
predef TryAddMonToParty
|
||||
ld a, [OTPartyCount]
|
||||
dec a
|
||||
ld hl, OTPartyMon1Item
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
jr .loop
|
||||
; 3989d (e:589d)
|
||||
|
||||
TrainerType4: ; 3989d
|
||||
; item + moves
|
||||
ld h, d
|
||||
ld l, e
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
ret z
|
||||
|
||||
ld [CurPartyLevel], a
|
||||
ld a, [hli]
|
||||
ld [CurPartySpecies], a
|
||||
|
||||
ld a, OTPARTYMON
|
||||
ld [MonType], a
|
||||
|
||||
push hl
|
||||
predef TryAddMonToParty
|
||||
ld a, [OTPartyCount]
|
||||
dec a
|
||||
ld hl, OTPartyMon1Item
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
|
||||
push hl
|
||||
ld a, [OTPartyCount]
|
||||
dec a
|
||||
ld hl, OTPartyMon1Moves
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
|
||||
ld b, NUM_MOVES
|
||||
.copy_moves
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .copy_moves
|
||||
|
||||
push hl
|
||||
|
||||
ld a, [OTPartyCount]
|
||||
dec a
|
||||
ld hl, OTPartyMon1
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld hl, MON_PP
|
||||
add hl, de
|
||||
|
||||
push hl
|
||||
ld hl, MON_MOVES
|
||||
add hl, de
|
||||
pop de
|
||||
|
||||
ld b, NUM_MOVES
|
||||
.copy_pp
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr z, .copied_pp
|
||||
|
||||
push hl
|
||||
push bc
|
||||
dec a
|
||||
ld hl, Moves + MOVE_PP
|
||||
ld bc, MOVE_LENGTH
|
||||
call AddNTimes
|
||||
ld a, BANK(Moves)
|
||||
call GetFarByte
|
||||
pop bc
|
||||
pop hl
|
||||
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .copy_pp
|
||||
.copied_pp
|
||||
|
||||
pop hl
|
||||
jr .loop
|
||||
; 3991b
|
||||
|
||||
ComputeTrainerReward: ; 3991b (e:591b)
|
||||
ld hl, hProduct
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld a, [wEnemyTrainerBaseReward]
|
||||
ld [hli], a
|
||||
ld a, [CurPartyLevel]
|
||||
ld [hl], a
|
||||
call Multiply
|
||||
ld hl, wBattleReward
|
||||
xor a
|
||||
ld [hli], a
|
||||
ld a, [hProduct + 2]
|
||||
ld [hli], a
|
||||
ld a, [hProduct + 3]
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
|
||||
Battle_GetTrainerName:: ; 39939
|
||||
ld a, [InBattleTowerBattle]
|
||||
bit 0, a
|
||||
ld hl, OTPlayerName
|
||||
jp nz, CopyTrainerName
|
||||
|
||||
ld a, [OtherTrainerID]
|
||||
ld b, a
|
||||
ld a, [OtherTrainerClass]
|
||||
ld c, a
|
||||
|
||||
GetTrainerName:: ; 3994c
|
||||
ld a, c
|
||||
cp CAL
|
||||
jr nz, .not_cal2
|
||||
|
||||
ld a, BANK(sMysteryGiftTrainerHouseFlag)
|
||||
call GetSRAMBank
|
||||
ld a, [sMysteryGiftTrainerHouseFlag]
|
||||
and a
|
||||
call CloseSRAM
|
||||
jr z, .not_cal2
|
||||
|
||||
ld a, BANK(sMysteryGiftPartnerName)
|
||||
call GetSRAMBank
|
||||
ld hl, sMysteryGiftPartnerName
|
||||
call CopyTrainerName
|
||||
jp CloseSRAM
|
||||
|
||||
.not_cal2
|
||||
dec c
|
||||
push bc
|
||||
ld b, 0
|
||||
ld hl, TrainerGroups
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
pop bc
|
||||
|
||||
.loop
|
||||
dec b
|
||||
jr z, CopyTrainerName
|
||||
|
||||
.skip
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
jr nz, .skip
|
||||
jr .loop
|
||||
|
||||
CopyTrainerName: ; 39984
|
||||
ld de, StringBuffer1
|
||||
push de
|
||||
ld bc, NAME_LENGTH
|
||||
call CopyBytes
|
||||
pop de
|
||||
ret
|
||||
; 39990
|
||||
|
||||
Function39990: ; 39990
|
||||
; This function is useless.
|
||||
ld de, StringBuffer1
|
||||
push de
|
||||
ld bc, NAME_LENGTH
|
||||
pop de
|
||||
ret
|
||||
; 39999
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
INCLUDE "data/spawn_points.asm"
|
||||
INCLUDE "data/maps/spawn_points.asm"
|
||||
|
||||
|
||||
LoadSpawnPoint: ; 1531f
|
||||
|
||||
Reference in New Issue
Block a user