shithub: pokered

Download patch

ref: 242b2e05cf30bc47a53167baf6bd3134d1f47d18
parent: 6adbaefde14f5e9039aa42a6c96ce476a4107925
author: SatoMew <SatoMew@users.noreply.github.com>
date: Sun Nov 29 15:17:29 EST 2020

Label and document hFFD7 more accurately

--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -51,7 +51,7 @@
 	ldh [hWY], a
 	ldh [rWY], a
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ldh [hSCY], a
 	dec a
 	ld [wUpdateSpritesEnabled], a
@@ -6275,7 +6275,7 @@
 	ldh [hAutoBGTransferEnabled], a
 	ldh [hWY], a
 	ldh [rWY], a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld hl, wPlayerStatsToDouble
 	ld [hli], a
 	ld [hli], a
@@ -6866,7 +6866,7 @@
 	pop af
 	ld [wMapPalOffset], a
 	ld a, [wSavedTilesetType]
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	scf
 	ret
 .emptyString
--- a/engine/battle/init_battle_variables.asm
+++ b/engine/battle/init_battle_variables.asm
@@ -1,5 +1,5 @@
 InitBattleVariables:
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	ld [wSavedTilesetType], a
 	xor a
 	ld [wActionResultOrTookBattleTurn], a
--- a/engine/menus/league_pc.asm
+++ b/engine/menus/league_pc.asm
@@ -6,10 +6,10 @@
 	push hl
 	ld a, [wUpdateSpritesEnabled]
 	push af
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld [wSpriteFlipped], a
 	ld [wUpdateSpritesEnabled], a
 	ld [wHoFTeamIndex2], a
@@ -40,7 +40,7 @@
 	jr nz, .loop
 .doneShowingTeams
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	pop af
 	ld [wUpdateSpritesEnabled], a
 	pop hl
--- a/engine/menus/pokedex.asm
+++ b/engine/menus/pokedex.asm
@@ -410,10 +410,10 @@
 	call RunPaletteCommand
 	pop af
 	ld [wd11e], a
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 
 	hlcoord 0, 0
 	ld de, 1
@@ -577,7 +577,7 @@
 	and A_BUTTON | B_BUTTON
 	jr z, .waitForButtonPress
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	call GBPalWhiteOut
 	call ClearScreen
 	call RunDefaultPaletteCommand
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -70,7 +70,7 @@
 	ld bc, wSpriteDataEnd - wSpriteDataStart
 	call CopyData
 	ld a, [sTilesetType]
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld hl, sCurBoxData
 	ld de, wBoxDataStart
 	ld bc, wBoxDataEnd - wBoxDataStart
@@ -217,7 +217,7 @@
 	ld de, sCurBoxData
 	ld bc, wBoxDataEnd - wBoxDataStart
 	call CopyData
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	ld [sTilesetType], a
 	ld hl, sPlayerName
 	ld bc, sMainDataCheckSum - sPlayerName
--- a/engine/menus/start_sub_menus.asm
+++ b/engine/menus/start_sub_menus.asm
@@ -454,10 +454,10 @@
 	call GBPalWhiteOut
 	call ClearScreen
 	call UpdateSprites
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	call DrawTrainerInfo
 	predef DrawBadges ; draw badges
 	ld b, SET_PAL_TRAINER_CARD
@@ -471,7 +471,7 @@
 	call ReloadMapData
 	call LoadGBPal
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	jp RedisplayStartMenu
 
 ; loads tile patterns and draws everything except for gym leader faces / badges
--- a/engine/movie/evolution.asm
+++ b/engine/movie/evolution.asm
@@ -19,7 +19,7 @@
 	call Delay3
 	xor a
 	ldh [hAutoBGTransferEnabled], a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld a, [wEvoOldSpecies]
 	ld [wWholeScreenPaletteMonSpecies], a
 	ld c, 0
--- a/engine/movie/hall_of_fame.asm
+++ b/engine/movie/hall_of_fame.asm
@@ -19,7 +19,7 @@
 	call FillMemory
 	xor a
 	ld [wUpdateSpritesEnabled], a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld [wSpriteFlipped], a
 	ld [wLetterPrintingDelayFlags], a ; no delay
 	ld [wHoFMonOrPlayer], a ; mon
--- a/engine/movie/oak_speech/oak_speech.asm
+++ b/engine/movie/oak_speech/oak_speech.asm
@@ -52,7 +52,7 @@
 	ld [wDestinationMap], a
 	call SpecialWarpIn
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld a, [wd732]
 	bit 1, a ; possibly a debug mode bit
 	jp nz, .skipChoosingNames
--- a/engine/movie/title.asm
+++ b/engine/movie/title.asm
@@ -26,7 +26,7 @@
 	ld a, $1
 	ldh [hAutoBGTransferEnabled], a
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ldh [hSCX], a
 	ld a, $40
 	ldh [hSCY], a
--- a/engine/overworld/tilesets.asm
+++ b/engine/overworld/tilesets.asm
@@ -23,7 +23,7 @@
 	dec c
 	jr nz, .copyTilesetHeaderLoop
 	ld a, [hl]
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	xor a
 	ldh [hMovingBGTilesCounter1], a
 	pop hl
--- a/engine/overworld/update_map.asm
+++ b/engine/overworld/update_map.asm
@@ -52,11 +52,11 @@
 	ret z
 	ldh a, [hAutoBGTransferEnabled]
 	push af
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
 	ldh [hAutoBGTransferEnabled], a
-	ldh [hTilesetType], a ; no flower/water BG tile animations
+	ldh [hTileAnimations], a ; no flower/water BG tile animations
 	call LoadCurrentMapView
 	call RunDefaultPaletteCommand
 	ld hl, wMapViewVRAMPointer
@@ -112,7 +112,7 @@
 	dec c
 	jr nz, .redrawRowLoop
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	pop af
 	ldh [hAutoBGTransferEnabled], a
 	ret
--- a/engine/pokemon/evos_moves.asm
+++ b/engine/pokemon/evos_moves.asm
@@ -11,7 +11,7 @@
 ; this is only called after battle
 ; it is supposed to do level up evolutions, though there is a bug that allows item evolutions to occur
 EvolutionAfterBattle:
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
 	ld [wEvolutionOccurred], a
@@ -245,7 +245,7 @@
 	pop bc
 	pop hl
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld a, [wLinkState]
 	cp LINK_STATE_TRADING
 	ret z
--- a/engine/pokemon/status_screen.asm
+++ b/engine/pokemon/status_screen.asm
@@ -101,10 +101,10 @@
 	ld hl, vChars2 tile $72
 	lb bc, BANK(PTile), 1
 	call CopyVideoDataDouble ; bold P (for PP)
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	hlcoord 19, 1
 	lb bc, 6, 10
 	call DrawLineBox ; Draws the box around name, HP and status
@@ -174,7 +174,7 @@
 	call PlayCry ; play Pokémon cry
 	call WaitForTextScrollButtonPress ; wait for button
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ret
 
 .GetStringPointer
@@ -296,10 +296,10 @@
 	next "SPECIAL@"
 
 StatusScreen2:
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ldh [hAutoBGTransferEnabled], a
 	ld bc, NUM_MOVES + 1
 	ld hl, wMoves
@@ -429,7 +429,7 @@
 	call Delay3
 	call WaitForTextScrollButtonPress ; wait for button
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ld hl, wd72c
 	res 1, [hl]
 	ld a, $77
--- a/home/init.asm
+++ b/home/init.asm
@@ -65,7 +65,7 @@
 	call WriteDMACodeToHRAM
 
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	ldh [rSTAT], a
 	ldh [hSCX], a
 	ldh [hSCY], a
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -813,7 +813,7 @@
 	dec a
 	jr z, .ridingBike
 
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	and a
 	jr nz, .determineGraphics
 	jr .startWalking
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -175,10 +175,10 @@
 	ret
 
 DisplayPartyMenu::
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	call GBPalWhiteOutWithDelay3
 	call ClearSprites
 	call PartyMenuInit
@@ -186,10 +186,10 @@
 	jp HandlePartyMenuInput
 
 GoBackToPartyMenu::
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	push af
 	xor a
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	call PartyMenuInit
 	call RedrawPartyMenu
 	jp HandlePartyMenuInput
@@ -251,7 +251,7 @@
 	and a
 	jp nz, .swappingPokemon
 	pop af
-	ldh [hTilesetType], a
+	ldh [hTileAnimations], a
 	bit 1, b
 	jr nz, .noPokemonChosen
 	ld a, [wPartyCount]
--- a/home/vcopy.asm
+++ b/home/vcopy.asm
@@ -379,7 +379,7 @@
 ; Animate water and flower
 ; tiles in the overworld.
 
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	and a
 	ret z ; no animations if indoors (or if a menu set this to 0)
 
@@ -417,7 +417,7 @@
 	dec c
 	jr nz, .left
 .done
-	ldh a, [hTilesetType]
+	ldh a, [hTileAnimations]
 	rrca
 	ret nc
 ; if in a cave, no flower animations
--- a/hram.asm
+++ b/hram.asm
@@ -277,11 +277,11 @@
 ; you can detect that the V-blank handler has run since then.
 hVBlankOccurred:: db
 
-; 00 = indoor
-; 01 = cave
-; 02 = outdoor
-; this is often set to 00 in order to turn off water and flower BG tile animations
-hTilesetType:: db
+; Controls whether flower and water tiles are animated.
+; 00 = flowers and water are static (breaks Surf)
+; 01 = flowers are static, water is animated 
+; 02 = flowers and water are animated
+hTileAnimations:: db
 
 hMovingBGTilesCounter1:: db