kep-hack/scripts/ViridianPreGym.asm
Llinos Evans 83483f035b The Great Constant Compression of June 2023
This is a large-scale compression of KEP's current hide/show constants. RBY's works extremely oddly and is limited to 256 entries.

The problem with how RBY's hide/show stuff works, is that even though there are tons of unused constants, you...can't actually remove them. The constant list is tied to the hide/show data entries, so if you replace it with something else, well, now you just have two objects tied to the same constant. If you made the Route 2 item a boss, and someone picked up the item on Route 2, the boss would also disappear, and vice versa. So, we have to get creative.

I have reduced what we have to 248, but I think I miscounted when doing the funny list somewhere in the actual list when making sure the hex stuff is ok. Either that, or there's an error somewhere that Martha will, by some obscene miracle of humanity, discover. Anyway, this was achieved by turning multiple current overworld items into hidden ones, keeping them in the game whilst keeping to that all-important limit.

I also removed the items in Pokemon Tower 4F for this, just needed a little boost. Well, as you can see by the number, I technically didn't, I just miscounted like 20 times. Look, it's 10:11 PM, my stomach is in pain from an insane injection, and I don't even know if that map will come back, cut me some slack. Or add it back. You definitely can.
2023-06-27 22:17:07 +01:00

210 lines
4.2 KiB
NASM

ViridianPreGym_Script:
call EnableAutoTextBoxDrawing
ld hl, ViridianPreGymTrainerHeaders
ld de, ViridianPreGym_ScriptPointers
ld a, [wViridianPreGymCurScript]
call ExecuteCurMapScriptInTable
ld [wViridianPreGymCurScript], a
ret
ViridianPreGymResetScripts:
xor a
ld [wJoyIgnore], a
ld [wViridianPreGymCurScript], a
ld [wCurMapScript], a
ret
ViridianPreGym_ScriptPointers:
dw CheckFightingMapTrainers
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle
dw ViridianGymYujirouPostBattle
ViridianGymYujirouPostBattle:
ld a, [wIsInBattle]
cp $ff
jp z, ViridianGymResetScripts
ld a, $f0
ld [wJoyIgnore], a
YujirouHasBeenBeaten:
SetEvent EVENT_BEAT_YUJIROU, EVENT_BEAT_VIRIDIAN_PREGYM_TRAINER_0, EVENT_BEAT_VIRIDIAN_PREGYM_TRAINER_1
jp ViridianPreGymResetScripts
ViridianPreGym_TextPointers:
dw YujirouText
dw YujirouHasBeenBeaten
dw ViridianPreGymText1
dw ViridianPreGymText2
dw ViridianPreGymGuide
dw ViridianPreGymSign1
dw ViridianPreGymSign2
dw ViridianPreGymSign3
dw ViridianPreGymSign4
dw ViridianPreGymStatue1
dw ViridianPreGymStatue2
ViridianPreGymTrainerHeaders:
def_trainers 3
ViridianPreGymTrainerHeader0:
trainer EVENT_BEAT_VIRIDIAN_PREGYM_TRAINER_0, 3, ViridianPreGymBattleText1, ViridianPreGymEndBattleText1, ViridianPreGymAfterBattleText1
ViridianPreGymTrainerHeader1:
trainer EVENT_BEAT_VIRIDIAN_PREGYM_TRAINER_1, 3, ViridianPreGymBattleText2, ViridianPreGymEndBattleText2, ViridianPreGymAfterBattleText2
db -1 ;end
YujirouText:
text_asm
CheckEvent EVENT_POST_GAME_ATTAINED ; No need to view previous stuff
jr nz, .rematchMode
CheckEvent EVENT_BEAT_YUJIROU
jr nz, .YujirouBeaten
ld hl, YujirouIntro
call PrintText
ld c, BANK(Music_MeetMaleTrainer)
ld a, MUSIC_MEET_MALE_TRAINER
call PlayMusic
ld hl, wd72d
set 6, [hl]
set 7, [hl]
call Delay3
ld a, OPP_YUJIROU
ld [wCurOpponent], a
ld a, 1
ld [wTrainerNo], a
ld [wIsTrainerBattle], a
ld hl, YujirouLoseText
ld de, YujirouWinText
call SaveEndBattleTextPointers
ld a, $3
ld [wViridianPreGymCurScript], a
ld [wCurMapScript], a
jr .done
.rematchMode ; Rematch functionality. Just loads pre-battle text and his trainer.
ld hl, YujirouIntro2
call PrintText
ld c, BANK(Music_MeetMaleTrainer)
ld a, MUSIC_MEET_MALE_TRAINER
call PlayMusic
set 6, [hl]
set 7, [hl]
ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
ld hl, YujirouLoseText2
ld de, YujirouWinText
call SaveEndBattleTextPointers
call EngageMapTrainer
ld a, OPP_BROCK
ld [wCurOpponent], a
ld a, 9
ld [wTrainerNo], a
ld a, 1
ld [wIsTrainerBattle], a
ld a, $1
ld [wGymLeaderNo], a
jr .done
.YujirouBeaten
ld hl, YujirouAfterBattleText
call PrintText
jr .done
.done
jp TextScriptEnd
YujirouIntro::
text_far _YujirouIntro
text_end
YujirouLoseText::
text_far _YujirouLoseText
text_end
YujirouWinText::
text_far _YujirouWinText
text_end
YujirouAfterBattleText::
text_far _YujirouAfterBattleText
text_end
YujirouIntro2::
text_far _YujirouIntro2
text_end
YujirouLoseText2::
text_far _YujirouLoseText2
text_end
YujirouAfterBattleText2::
text_far _YujirouAfterBattleText2
text_end
ViridianPreGymText1:
text_asm
ld hl, ViridianPreGymTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
ViridianPreGymBattleText1:
text_far _ViridianPreGymBattleText1
text_end
ViridianPreGymEndBattleText1:
text_far _ViridianPreGymEndBattleText1
text_end
ViridianPreGymAfterBattleText1:
text_far _ViridianPreGymAfterBattleText1
text_end
ViridianPreGymText2:
text_asm
ld hl, ViridianPreGymTrainerHeader1
call TalkToTrainer
jp TextScriptEnd
ViridianPreGymBattleText2:
text_far _ViridianPreGymBattleText2
text_end
ViridianPreGymEndBattleText2:
text_far _ViridianPreGymEndBattleText2
text_end
ViridianPreGymAfterBattleText2:
text_far _ViridianPreGymAfterBattleText2
text_end
ViridianPreGymGuide:
text_far _ViridianPreGymGuide
text_end
ViridianPreGymSign1:
text_far _ViridianPreGymSign1
text_end
ViridianPreGymSign2:
text_far _ViridianPreGymSign2
text_end
ViridianPreGymSign3:
text_far _ViridianPreGymSign3
text_end
ViridianPreGymSign4:
text_far _ViridianPreGymSign4
text_end
ViridianPreGymStatue1:
text_far _PreGymStatueText
text_end
ViridianPreGymStatue2:
text_far _PreGymStatueText
text_end
text_end ; unused