more bug fixes

This commit is contained in:
May Evans 2022-08-31 15:28:36 +01:00
parent 648289d4a9
commit a216a0f2e7
7 changed files with 30 additions and 6 deletions

View file

@ -24,6 +24,10 @@ May non-multiplayer, non-battle related bugs have been fixed. The aforementioned
- 2 invisible stars that show on the title screen are cut off; also, the "presents" logo from RG is re-used! - 2 invisible stars that show on the title screen are cut off; also, the "presents" logo from RG is re-used!
- The healing machine animates correctly! - The healing machine animates correctly!
- Using Minimize or Substitute, looking at the Pokedex, and then battling won't cause sprite corruption. - Using Minimize or Substitute, looking at the Pokedex, and then battling won't cause sprite corruption.
- OAM Updates can no longer be interrupted by V-Blank, avoiding some sprite corruption.
- Trainer Card transition no longer shows weird garbage on DMGs; this was due to not having enough time to load properly.
- Battle victory music plays at the right time; there were some situations where it would happen when you lost.
- Music in Oak's Lab is delayed a frame so it always plays with the correct channels; V-Blank could otherwise interrupt it.
and more! and more!
Credits Credits

View file

@ -780,6 +780,10 @@ FaintEnemyPokemon:
hlcoord 0, 0 hlcoord 0, 0
lb bc, 4, 11 lb bc, 4, 11
call ClearScreenArea call ClearScreenArea
call AnyPartyAlive ; this fixes victory music playing at the wrong time ; PvK
ld a, d
and a
push af
ld a, [wIsInBattle] ld a, [wIsInBattle]
dec a dec a
jr z, .wild_win jr z, .wild_win
@ -798,11 +802,14 @@ FaintEnemyPokemon:
jr .sfxplayed jr .sfxplayed
.wild_win .wild_win
call EndLowHealthAlarm call EndLowHealthAlarm
pop af
push af
ld a, MUSIC_DEFEATED_WILD_MON ld a, MUSIC_DEFEATED_WILD_MON
call PlayBattleVictoryMusic call nz, PlayBattleVictoryMusic
.sfxplayed .sfxplayed
; bug: win sfx is played for wild battles before checking for player mon HP ; bug: win sfx is played for wild battles before checking for player mon HP
; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle ; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle
; kep fixes this - PvK
ld hl, wBattleMonHP ld hl, wBattleMonHP
ld a, [hli] ld a, [hli]
or [hl] or [hl]
@ -812,9 +819,7 @@ FaintEnemyPokemon:
jr nz, .playermonnotfaint ; if so, don't call RemoveFaintedPlayerMon twice jr nz, .playermonnotfaint ; if so, don't call RemoveFaintedPlayerMon twice
call RemoveFaintedPlayerMon call RemoveFaintedPlayerMon
.playermonnotfaint .playermonnotfaint
call AnyPartyAlive pop af
ld a, d
and a
ret z ret z
ld hl, EnemyMonFaintedText ld hl, EnemyMonFaintedText
call PrintText call PrintText

View file

@ -462,6 +462,9 @@ StartMenu_TrainerInfo::
predef DrawBadges ; draw badges predef DrawBadges ; draw badges
ld b, SET_PAL_TRAINER_CARD ld b, SET_PAL_TRAINER_CARD
call RunPaletteCommand call RunPaletteCommand
ld a, [wOnSGB] ; this fixes garbage on dmgs
and a
call z, Delay3
call GBPalNormal call GBPalNormal
call WaitForTextScrollButtonPress ; wait for button press call WaitForTextScrollButtonPress ; wait for button press
call GBPalWhiteOut call GBPalWhiteOut
@ -469,6 +472,9 @@ StartMenu_TrainerInfo::
call LoadScreenTilesFromBuffer2 ; restore saved screen call LoadScreenTilesFromBuffer2 ; restore saved screen
call RunDefaultPaletteCommand call RunDefaultPaletteCommand
call ReloadMapData call ReloadMapData
ld a, [wOnSGB] ; this fixes garbage on dmgs
and a
call z, Delay3
call LoadGBPal call LoadGBPal
pop af pop af
ldh [hTileAnimations], a ldh [hTileAnimations], a

View file

@ -2,5 +2,9 @@ UpdateSprites::
ld a, [wUpdateSpritesEnabled] ld a, [wUpdateSpritesEnabled]
dec a dec a
ret nz ret nz
ld hl, hSkipOAMUpdates
set 0, [hl]
homecall _UpdateSprites homecall _UpdateSprites
ld hl, hSkipOAMUpdates
res 0, [hl] ; this prevents v-blank interference - PvK
ret ret

View file

@ -26,11 +26,15 @@ VBlank::
call VBlankCopy call VBlankCopy
call VBlankCopyDouble call VBlankCopyDouble
call UpdateMovingBgTiles call UpdateMovingBgTiles
call hDMARoutine ld a, [hSkipOAMUpdates]
bit 0, a
jr nz, .skipOAM
call hDMARoutine ; this prevents v-blank interference - PvK
ld a, BANK(PrepareOAMData) ld a, BANK(PrepareOAMData)
ldh [hLoadedROMBank], a ldh [hLoadedROMBank], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call PrepareOAMData call PrepareOAMData
.skipOAM
; VBlank-sensitive operations end. ; VBlank-sensitive operations end.

View file

@ -387,7 +387,7 @@ hWhoseTurn:: db ; 0 on player's turn, 1 on enemy's turn
hClearLetterPrintingDelayFlags:: db hClearLetterPrintingDelayFlags:: db
ds 1 hSkipOAMUpdates:: db ; this prevents v-blank interference - PvK
; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 0: draw HP fraction to the right of bar instead of below (for party menu)
; bit 1: menu is double spaced ; bit 1: menu is double spaced

View file

@ -118,6 +118,7 @@ OaksLabScript4:
call UpdateSprites call UpdateSprites
ld hl, wFlags_D733 ld hl, wFlags_D733
res 1, [hl] res 1, [hl]
call DelayFrame
call PlayDefaultMusic call PlayDefaultMusic
ld a, $5 ld a, $5