diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-07-20 22:06:49 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-07-20 22:06:49 -0400 |
commit | cb946b30fe3ba9c6d021831ef0ed898aa3092c0c (patch) | |
tree | 62e5803d4c105e6f5a5b2ada918fc8b68cf7fff4 | |
parent | b59e7c77cede555f77059fb619c51c1d68b19181 (diff) |
Fix + trim
-rw-r--r-- | Allow-more-trainer-parties,-with-individual-DVs,-stat-experience,-and-nicknames.md | 141 |
1 files changed, 8 insertions, 133 deletions
diff --git a/Allow-more-trainer-parties,-with-individual-DVs,-stat-experience,-and-nicknames.md b/Allow-more-trainer-parties,-with-individual-DVs,-stat-experience,-and-nicknames.md index cc4530b..e693d56 100644 --- a/Allow-more-trainer-parties,-with-individual-DVs,-stat-experience,-and-nicknames.md +++ b/Allow-more-trainer-parties,-with-individual-DVs,-stat-experience,-and-nicknames.md @@ -902,6 +902,8 @@ Again, since −1 ($FF) is the end-of-party marker, you can't use stat experienc ## 5. Allow trainer data to be stored in multiple banks +If you're adding more trainers, *and* more data for those trainers, you'll probably run out of room in the ROM bank. The solution is to split trainer party data across multiple banks. + Edit [wram.asm](../blob/master/wram.asm) again: ```diff @@ -927,7 +929,7 @@ Edit [data/trainers/party_pointers.asm](../blob/master/data/trainers/party_point + dba MysticalmanGroup ``` -Each table entry now has a third byte to declare which bank it's in, instead of expecting all the entries to be in `BANK(Trainers)`. +We're just replacing `dw` with `dba` everywhere. Each table entry now has a third byte to declare which bank it's in, instead of expecting all the entries to be in `BANK(Trainers)`. Edit [engine/battle/read_trainer_party.asm](../blob/master/engine/battle/read_trainer_party.asm) again: @@ -1145,7 +1147,8 @@ Edit [engine/battle/read_trainer_party.asm](../blob/master/engine/battle/read_tr ld e, l pop hl - call GetNextTrainerDataByte +- ld a, [hli] ++ call GetNextTrainerDataByte ld [de], a .no_item @@ -1172,85 +1175,7 @@ Edit [engine/battle/read_trainer_party.asm](../blob/master/engine/battle/read_tr dec b jr nz, .copy_moves - push hl - - ld a, [wOTPartyCount] - dec a - ld hl, wOTPartyMon1 - call GetPartyLocation - 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 - .no_moves - - ; Custom DVs affect stats, so recalculate them after TryAddMonToParty - ld a, [wOtherTrainerType] - and TRAINERTYPE_DVS | TRAINERTYPE_STAT_EXP - jr z, .no_stat_recalc - - push hl - - ld a, [wOTPartyCount] - dec a - ld hl, wOTPartyMon1MaxHP - call GetPartyLocation - ld d, h - ld e, l - - ld a, [wOTPartyCount] - dec a - ld hl, wOTPartyMon1StatExp - 1 - call GetPartyLocation - - ; recalculate stats - ld b, TRUE - push de - predef CalcMonStats - pop hl - - ; copy max HP to current HP - inc hl - ld c, [hl] - dec hl - ld b, [hl] - dec hl - ld [hl], c - dec hl - ld [hl], b - - pop hl - .no_stat_recalc + ... jp .loop @@ -1270,22 +1195,7 @@ Edit [engine/battle/read_trainer_party.asm](../blob/master/engine/battle/read_tr ld c, a GetTrainerName:: - 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 @@ -1377,42 +1287,7 @@ Edit [engine/overworld/wildmons.asm](../blob/master/engine/overworld/wildmons.as + ld a, [wTrainerGroupBank] call GetFarByte inc hl - ; b = trainer type - ld b, a - ; TRAINERTYPE_NICKNAME has uneven length, so always use the first mon - bit TRAINERTYPE_NICKNAME_F, b - jr nz, .got_mon - ; c = mon length - ; All trainers use 2 bytes for level and species - ld c, 2 - ; TRAINERTYPE_DVS uses 2 more bytes - bit TRAINERTYPE_DVS_F, b - jr z, .no_dvs - inc c - inc c - .no_dvs - ; TRAINERTYPE_STAT_EXP uses 10 more bytes - bit TRAINERTYPE_STAT_EXP_F, b - jr z, .no_stat_exp - ld a, 10 - add c - ld c, a - .no_stat_exp - ; TRAINERTYPE_ITEM uses 1 more byte - bit TRAINERTYPE_ITEM_F, b - jr z, .no_item - inc c - .no_item - ; TRAINERTYPE_MOVES uses 4 more bytes - bit TRAINERTYPE_MOVES_F, b - jr z, .no_moves - ld a, 4 - add c - ld c, a - .no_moves - ; bc = mon length - xor a - ld b, a + ... ld e, 0 push hl |