Yujirou is now marginally less of a twat

He now gives you a Bottle Cap when you win, but still crashes the game when you lose for some reason...
This commit is contained in:
Martha Schilling 2023-12-29 19:11:11 +00:00
parent 2a714f3dff
commit 9b4a9d5839
5 changed files with 127 additions and 67 deletions

View file

@ -128,8 +128,6 @@ FightingDojoText1: ; gym scaling can be removed to make space
ld [wTrainerNo], a
ld a, 1
ld [wIsTrainerBattle], a
ld a, $1
ld [wGymLeaderNo], a
jr .asm_9dba4
.normalProcessing
CheckEvent EVENT_DEFEATED_FIGHTING_DOJO
@ -164,8 +162,6 @@ FightingDojoText1: ; gym scaling can be removed to make space
ld [wTrainerNo], a
ld a, 1
ld [wIsTrainerBattle], a
ld a, $1
ld [wGymLeaderNo], a ; play gym music
;ends here

View file

@ -26,12 +26,24 @@ ViridianGymYujirouPostBattle:
jp z, ViridianGymResetScripts
ld a, $f0
ld [wJoyIgnore], a
; SetEvents EVENT_BEAT_YUJIROU, EVENT_BEAT_VIRIDIAN_PREGYM_TRAINER_0, EVENT_BEAT_VIRIDIAN_PREGYM_TRAINER_1 ; Needs to be set here for the correct text to pop up.
; ld a, $3
; ld [hSpriteIndex], a
; call DisplayTextID
; xor a
; ld [wViridianPreGymCurScript], a
ViridianPreGymScriptReceiveBottleCap:
ld a, $b
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_YUJIROU
lb bc, BOTTLE_CAP, 1
call GiveItem
jr nc, .BagFull
ld a, $c
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_YUJIROU_BOTTLE_CAP
jp ViridianPreGymResetScripts
.BagFull
ld a, $d
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
jp ViridianPreGymResetScripts
ViridianPreGym_TextPointers:
dw ViridianPreGymText1
@ -44,6 +56,9 @@ ViridianPreGym_TextPointers:
dw ViridianPreGymSign4
dw ViridianPreGymStatue1
dw ViridianPreGymStatue2
dw BeforeReceivedBottleCapText
dw ReceivedBottleCapText
dw BottleCapNoRoomText
ViridianPreGymTrainerHeaders:
def_trainers
@ -58,41 +73,12 @@ YujirouText:
CheckEvent EVENT_POST_GAME_ATTAINED ; No need to view previous stuff
jr nz, .rematchMode
CheckEvent EVENT_BEAT_YUJIROU
jp 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]
ld hl, YujirouLoseText
ld de, YujirouWinText
call SaveEndBattleTextPointers
ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
; gym scaling spaghetti code begins here - remove initial parameters as we're making our own
ld a, OPP_YUJIROU
ld [wCurOpponent], a
ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help.
ld b, 1
call CountSetBits
ld a, [wNumSetBits]
inc a
ld [wTrainerNo], a
ld a, 1
ld [wIsTrainerBattle], a
ld a, $3
ld [wViridianPreGymCurScript], a
ld [wCurMapScript], a
jr .done
jp z, .yujirouNotBeaten
CheckEventReuseA EVENT_GOT_YUJIROU_BOTTLE_CAP
jr nz, .yujirouBeaten
call z, PewterGymScriptReceiveTM34
call DisableWaitingAfterTextDisplay
jp .done ; needed due to the rematch script length.
.rematchMode ; Rematch functionality. Just loads pre-battle text and his trainer.
ld hl, YujirouIntro2
call PrintText
@ -105,7 +91,7 @@ YujirouText:
ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
ld hl, YujirouLoseText2
ld de, YujirouWinText
ld de, YujirouLoseText2
call SaveEndBattleTextPointers
call EngageMapTrainer
ld a, OPP_YUJIROU
@ -114,12 +100,46 @@ YujirouText:
ld [wTrainerNo], a
ld a, 1
ld [wIsTrainerBattle], a
ld a, $1
ld [wGymLeaderNo], a
jr .done
.YujirouBeaten
.yujirouBeaten
ld hl, YujirouAfterBattleText
call PrintText
jr .done
.yujirouNotBeaten
ld hl, YujirouIntro
call PrintText
ld hl, wd72d
set 6, [hl]
set 7, [hl]
ld hl, YujirouLoseText
ld de, YujirouLoseText
call SaveEndBattleTextPointers
ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
; gym scaling spaghetti code begins here - remove initial parameters as we're making our own
ld a, OPP_YUJIROU
ld [wCurOpponent], a
ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help.
ld b, 1
call CountSetBits
ld a, [wNumSetBits]
inc a
ld [wTrainerNo], a
ld a, 1
ld [wIsTrainerBattle], a
;ends here
xor a
ldh [hJoyHeld], a
ld a, $3
ld [wViridianPreGymCurScript], a
ld [wCurMapScript], a
.done
jp TextScriptEnd
@ -131,14 +151,24 @@ YujirouLoseText::
text_far _YujirouLoseText
text_end
YujirouWinText::
text_far _YujirouWinText
text_end
YujirouAfterBattleText::
text_far _YujirouAfterBattleText
text_end
BeforeReceivedBottleCapText:
text_far _BeforeReceivedBottleCapText
text_end
ReceivedBottleCapText:
text_far _ReceivedBottleCapText
sound_get_item_1
text_far _BottleCapExplanationText
text_end
BottleCapNoRoomText:
text_far _BottleCapNoRoomText
text_end
YujirouIntro2::
text_far _YujirouIntro2
text_end