Clean up some Odd Egg and Battle Tower code and data

Fixes #589
This commit is contained in:
Rangi 2019-01-02 19:04:50 -05:00
parent 583838a39d
commit b975f3e068
7 changed files with 37 additions and 35 deletions

View File

@ -5,7 +5,7 @@ BATTLETOWER_NUM_UNIQUE_MON EQU 21
BATTLETOWER_NUM_UNIQUE_TRAINERS EQU 70
BATTLETOWER_TRAINERDATALENGTH EQU $24
BATTLE_TOWER_STRUCT_LENGTH EQU $e0 ; NAME_LENGTH + BATTLETOWER_PARTY_LENGTH * (PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
BATTLE_TOWER_STRUCT_LENGTH EQUS "(NAME_LENGTH + BATTLETOWER_PARTY_LENGTH * NICKNAMED_MON_STRUCT_LENGTH + BATTLETOWER_TRAINERDATALENGTH)"
; BattleTowerAction writebyte arguments (see engine/events/battle_tower/battle_tower.asm)
const_def

View File

@ -97,6 +97,8 @@ MON_SAT EQUS "(wPartyMon1SpclAtk - wPartyMon1)"
MON_SDF EQUS "(wPartyMon1SpclDef - wPartyMon1)"
BOXMON_STRUCT_LENGTH EQUS "(wPartyMon1End - wPartyMon1)"
PARTYMON_STRUCT_LENGTH EQUS "(wPartyMon1StatsEnd - wPartyMon1)"
NICKNAMED_MON_STRUCT_LENGTH EQUS "(PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH)"
REDMON_STRUCT_LENGTH EQU 44
; caught data
@ -121,9 +123,9 @@ MONS_PER_BOX EQU 20
NUM_BOXES EQU 14
; hall of fame
HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (MON_NAME_LENGTH + -1) ; species, id, dvs, level, nick
HOF_LENGTH = 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator
NUM_HOF_TEAMS = 30
HOF_MON_LENGTH EQU 1 + 2 + 2 + 1 + (MON_NAME_LENGTH + -1) ; species, id, dvs, level, nick
HOF_LENGTH EQU 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator
NUM_HOF_TEAMS EQU 30
; evolution types (used in data/pokemon/evos_attacks.asm)
const_def 1
@ -150,8 +152,8 @@ NUM_HOF_TEAMS = 30
NUM_GRASSMON EQU 7 ; data/wild/*_grass.asm table size
NUM_WATERMON EQU 3 ; data/wild/*_water.asm table size
GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
GRASS_WILDDATA_LENGTH EQU 2 + (1 + NUM_GRASSMON * 2) * 3
WATER_WILDDATA_LENGTH EQU 2 + (1 + NUM_WATERMON * 2) * 1
FISHGROUP_DATA_LENGTH EQU 1 + 2 * 3
NUM_ROAMMON_MAPS EQU 16 ; RoamMaps table size (see data/wild/roammon_maps.asm)

View File

@ -29,7 +29,6 @@ prob_total = 0
OddEggs:
OddEgg1:
db PICHU
db NO_ITEM
db THUNDERSHOCK, CHARM, DIZZY_PUNCH, 0
@ -43,7 +42,7 @@ OddEgg1:
bigdw 0
dn 0, 0, 0, 0 ; DVs
db 30, 20, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -55,7 +54,6 @@ OddEgg1:
bigdw 8 ; SAtk
bigdw 8 ; SDef
db "EGG@@@@@@@@"
OddEgg1End:
db PICHU
db NO_ITEM
@ -70,7 +68,7 @@ OddEgg1End:
bigdw 0
dn 2, 10, 10, 10 ; DVs
db 30, 20, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -96,7 +94,7 @@ OddEgg1End:
bigdw 0
dn 0, 0, 0, 0 ; DVs
db 35, 20, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -122,7 +120,7 @@ OddEgg1End:
bigdw 0
dn 2, 10, 10, 10 ; DVs
db 35, 20, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -148,7 +146,7 @@ OddEgg1End:
bigdw 0
dn 0, 0, 0, 0 ; DVs
db 15, 20, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -174,7 +172,7 @@ OddEgg1End:
bigdw 0
dn 2, 10, 10, 10 ; DVs
db 15, 20, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -200,7 +198,7 @@ OddEgg1End:
bigdw 0
dn 0, 0, 0, 0 ; DVs
db 35, 30, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -226,7 +224,7 @@ OddEgg1End:
bigdw 0
dn 2, 10, 10, 10 ; DVs
db 35, 30, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -252,7 +250,7 @@ OddEgg1End:
bigdw 0
dn 0, 0, 0, 0 ; DVs
db 25, 10, 0, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -278,7 +276,7 @@ OddEgg1End:
bigdw 0
dn 2, 10, 10, 10 ; DVs
db 25, 10, 0, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -304,7 +302,7 @@ OddEgg1End:
bigdw 0
dn 0, 0, 0, 0 ; DVs
db 30, 30, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -330,7 +328,7 @@ OddEgg1End:
bigdw 0
dn 2, 10, 10, 10 ; DVs
db 30, 30, 10, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -356,7 +354,7 @@ OddEgg1End:
bigdw 0
dn 0, 0, 0, 0 ; DVs
db 35, 10, 0, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status
@ -382,7 +380,7 @@ OddEgg1End:
bigdw 0
dn 2, 10, 10, 10 ; DVs
db 35, 10, 0, 0 ; PP
db 20 ; Happiness
db 20 ; Step cycles to hatch
db 0, 0, 0 ; Pokerus, Caught data
db 5 ; Level
db 0, 0 ; Status

View File

@ -480,7 +480,7 @@ endr
ld a, [hl]
ld [de], a
pop hl
ld bc, PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH
ld bc, NICKNAMED_MON_STRUCT_LENGTH
add hl, bc
pop de
dec d

View File

@ -7,7 +7,7 @@ Function_LoadOpponentTrainerAndPokemons:
; Fill wBT_OTTrainer with zeros
xor a
ld hl, wBT_OTTrainer
ld bc, wBT_OTTrainerEnd - wBT_OTTrainer
ld bc, BATTLE_TOWER_STRUCT_LENGTH
call ByteFill
; Write $ff into the Item-Slots
@ -104,7 +104,7 @@ Function_LoadRandomBattleTowerMon:
ld a, [wBTChoiceOfLvlGroup]
dec a
ld hl, BattleTowerMons
ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group
ld bc, BATTLETOWER_NUM_UNIQUE_MON * NICKNAMED_MON_STRUCT_LENGTH
call AddNTimes
ldh a, [hRandomAdd]
@ -122,7 +122,7 @@ Function_LoadRandomBattleTowerMon:
; Check if mon was already loaded before
; Check current and the 2 previous teams
; includes check if item is double at the current team
ld bc, PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH
ld bc, NICKNAMED_MON_STRUCT_LENGTH
call AddNTimes
ld a, [hli]
ld b, a
@ -165,13 +165,13 @@ Function_LoadRandomBattleTowerMon:
cp b
jr z, .FindARandomBattleTowerMon
ld bc, PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH
ld bc, NICKNAMED_MON_STRUCT_LENGTH
call CopyBytes
ld a, [wNamedObjectIndexBuffer]
push af
push de
ld hl, - (PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH)
ld hl, -NICKNAMED_MON_STRUCT_LENGTH
add hl, de
ld a, [hl]
ld [wNamedObjectIndexBuffer], a

View File

@ -39,11 +39,13 @@ _GiveOddEgg:
.done
ld hl, OddEggs
ld a, OddEgg1End - OddEgg1
ld a, NICKNAMED_MON_STRUCT_LENGTH
call AddNTimes
ld de, wOddEggSpecies
ld bc, PARTYMON_STRUCT_LENGTH + 2 * MON_NAME_LENGTH
; Writes to wOddEgg, wOddEggName, and wOddEggOTName,
; even though OddEggs does not have data for wOddEggOTName
ld de, wOddEgg
ld bc, NICKNAMED_MON_STRUCT_LENGTH + MON_NAME_LENGTH
call CopyBytes
ld a, EGG_TICKET
@ -64,10 +66,10 @@ _GiveOddEgg:
ld [wMobileMonSpeciesPointerBuffer], a
ld a, HIGH(wMobileMonSpeciesBuffer - 1)
ld [wMobileMonSpeciesPointerBuffer + 1], a
; load pointer to wOddEggSpecies in wMobileMonStructurePointerBuffer
ld a, LOW(wOddEggSpecies)
; load pointer to wOddEgg in wMobileMonStructurePointerBuffer
ld a, LOW(wOddEgg)
ld [wMobileMonStructurePointerBuffer], a
ld a, HIGH(wOddEggSpecies)
ld a, HIGH(wOddEgg)
ld [wMobileMonStructurePointerBuffer + 1], a
; load Odd Egg Name in wTempOddEggNickname

View File

@ -242,7 +242,7 @@ CheckBTMonMovesForErrors:
.done
pop hl
ld de, PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH
ld de, NICKNAMED_MON_STRUCT_LENGTH
add hl, de
dec c
jr nz, .loop