From 47cd734276eade428671f720e8d01a45c4fd2bc2 Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 17 Nov 2020 16:27:44 -0500 Subject: Use assert to ensure correct base data size --- wram.asm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wram.asm') diff --git a/wram.asm b/wram.asm index 9444084e..c005a3a3 100644 --- a/wram.asm +++ b/wram.asm @@ -1996,8 +1996,9 @@ wMonHGrowthRate:: wMonHLearnset:: ; bit field - flag_array 50 + 5 + flag_array NUM_TMS + NUM_HMS ds 1 +wMonHeaderEnd:: wSavedTilesetType:: ; saved at the start of a battle and then written back at the end of the battle -- cgit v1.3.1-sl0p From 6adbaefde14f5e9039aa42a6c96ce476a4107925 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 28 Nov 2020 17:11:12 -0500 Subject: Keep wGrassMons and wWaterMons together with a UNION --- engine/battle/core.asm | 17 +++++++++-------- wram.asm | 30 ++++++++++++++++-------------- 2 files changed, 25 insertions(+), 22 deletions(-) (limited to 'wram.asm') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index d944424e..5ea60cb4 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2013,18 +2013,19 @@ DisplayBattleMenu:: .menuselected ld [wTextBoxID], a call DisplayTextBoxID + ; handle menu input if it's not the old man tutorial ld a, [wBattleType] dec a - jp nz, .handleBattleMenuInput ; handle menu input if it's not the old man tutorial + jp nz, .handleBattleMenuInput ; the following happens for the old man tutorial - ; Temporarily save the player name in wGrassRate, - ; which is supposed to get overwritten when entering a - ; map with wild Pokémon. - ; Due to an oversight, the data may not get - ; overwritten (on Cinnabar and Route 21) and the infamous - ; Missingno. glitch can show up. + ; Temporarily save the player name in wLinkEnemyTrainerName. + ; Since wLinkEnemyTrainerName == wGrassRate, this affects wild encounters. + ; The wGrassRate byte and following wGrassMons buffer are supposed + ; to get overwritten when entering a map with wild Pokémon, + ; but an oversight prevents this in Cinnabar and Route 21, + ; so the infamous MissingNo. glitch can show up. ld hl, wPlayerName - ld de, wGrassRate + ld de, wLinkEnemyTrainerName ld bc, NAME_LENGTH call CopyData ld hl, .oldManName diff --git a/wram.asm b/wram.asm index c005a3a3..3aca2431 100644 --- a/wram.asm +++ b/wram.asm @@ -3035,31 +3035,33 @@ wSecondLockTrashCanIndex:: wEventFlags:: flag_array NUM_EVENTS + +UNION +wGrassRate:: db +wGrassMons:: + ds 10 * 2 + + ds 8 + +wWaterRate:: db +wWaterMons:: + ds 10 * 2 + +NEXTU wLinkEnemyTrainerName:: ; linked game's trainer name + ds NAME_LENGTH -wGrassRate:: ds 1 -wGrassMons:: -; ds 20 - - ds 11 -; Overload wGrassMons wSerialEnemyDataBlock:: +; ds $1a8 + ds 9 wEnemyPartyCount:: ds 1 wEnemyPartyMons:: ds PARTY_LENGTH + 1 -; Overload enemy party data -UNION - -wWaterRate:: db -wWaterMons:: db - -NEXTU - wEnemyMons:: wEnemyMon1:: party_struct wEnemyMon1 wEnemyMon2:: party_struct wEnemyMon2 -- cgit v1.3.1-sl0p From 083cb38e33891d58158762ac2580bd3b62fcdaec Mon Sep 17 00:00:00 2001 From: SatoMew Date: Sun, 29 Nov 2020 21:28:38 +0000 Subject: Update related tile animation constants --- constants/map_data_constants.asm | 8 +++--- data/tilesets/tileset_headers.asm | 48 ++++++++++++++++----------------- engine/battle/core.asm | 2 +- engine/battle/init_battle_variables.asm | 2 +- engine/menus/save.asm | 4 +-- sram.asm | 2 +- wram.asm | 2 +- 7 files changed, 34 insertions(+), 34 deletions(-) (limited to 'wram.asm') diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 5efd9928..bd55f753 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -9,8 +9,8 @@ MAP_BORDER EQU 3 shift_const SOUTH ; 4 shift_const NORTH ; 8 -; tileset environments +; flower and water tile animations const_def - const INDOOR ; 0 - const CAVE ; 1 - const OUTDOOR ; 2 + const STATIC_FLOWERS_WATER ; 0 + const STATIC_FLOWERS_ANIMATED_WATER ; 1 + const ANIMATED_FLOWERS_WATER ; 2 diff --git a/data/tilesets/tileset_headers.asm b/data/tilesets/tileset_headers.asm index 998c6cb1..5c60a55d 100644 --- a/data/tilesets/tileset_headers.asm +++ b/data/tilesets/tileset_headers.asm @@ -8,27 +8,27 @@ ENDM Tilesets: ; block, gfx, coll, 3 counter tiles, grass tile, permission - tileset Overworld_Block, Overworld_GFX, Overworld_Coll, $FF,$FF,$FF, $52, OUTDOOR - tileset RedsHouse1_Block, RedsHouse1_GFX, RedsHouse1_Coll, $FF,$FF,$FF, $FF, INDOOR - tileset Mart_Block, Mart_GFX, Mart_Coll, $18,$19,$1E, $FF, INDOOR - tileset Forest_Block, Forest_GFX, Forest_Coll, $FF,$FF,$FF, $20, CAVE - tileset RedsHouse2_Block, RedsHouse2_GFX, RedsHouse2_Coll, $FF,$FF,$FF, $FF, INDOOR - tileset Dojo_Block, Dojo_GFX, Dojo_Coll, $3A,$FF,$FF, $FF, OUTDOOR - tileset Pokecenter_Block, Pokecenter_GFX, Pokecenter_Coll, $18,$19,$1E, $FF, INDOOR - tileset Gym_Block, Gym_GFX, Gym_Coll, $3A,$FF,$FF, $FF, OUTDOOR - tileset House_Block, House_GFX, House_Coll, $FF,$FF,$FF, $FF, INDOOR - tileset ForestGate_Block, ForestGate_GFX, ForestGate_Coll, $17,$32,$FF, $FF, INDOOR - tileset Museum_Block, Museum_GFX, Museum_Coll, $17,$32,$FF, $FF, INDOOR - tileset Underground_Block, Underground_GFX, Underground_Coll, $FF,$FF,$FF, $FF, INDOOR - tileset Gate_Block, Gate_GFX, Gate_Coll, $17,$32,$FF, $FF, INDOOR - tileset Ship_Block, Ship_GFX, Ship_Coll, $FF,$FF,$FF, $FF, CAVE - tileset ShipPort_Block, ShipPort_GFX, ShipPort_Coll, $FF,$FF,$FF, $FF, CAVE - tileset Cemetery_Block, Cemetery_GFX, Cemetery_Coll, $12,$FF,$FF, $FF, INDOOR - tileset Interior_Block, Interior_GFX, Interior_Coll, $FF,$FF,$FF, $FF, INDOOR - tileset Cavern_Block, Cavern_GFX, Cavern_Coll, $FF,$FF,$FF, $FF, CAVE - tileset Lobby_Block, Lobby_GFX, Lobby_Coll, $15,$36,$FF, $FF, INDOOR - tileset Mansion_Block, Mansion_GFX, Mansion_Coll, $FF,$FF,$FF, $FF, INDOOR - tileset Lab_Block, Lab_GFX, Lab_Coll, $FF,$FF,$FF, $FF, INDOOR - tileset Club_Block, Club_GFX, Club_Coll, $07,$17,$FF, $FF, INDOOR - tileset Facility_Block, Facility_GFX, Facility_Coll, $12,$FF,$FF, $FF, CAVE - tileset Plateau_Block, Plateau_GFX, Plateau_Coll, $FF,$FF,$FF, $45, CAVE + tileset Overworld_Block, Overworld_GFX, Overworld_Coll, $FF,$FF,$FF, $52, ANIMATED_FLOWERS_WATER + tileset RedsHouse1_Block, RedsHouse1_GFX, RedsHouse1_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset Mart_Block, Mart_GFX, Mart_Coll, $18,$19,$1E, $FF, STATIC_FLOWERS_WATER + tileset Forest_Block, Forest_GFX, Forest_Coll, $FF,$FF,$FF, $20, STATIC_FLOWERS_ANIMATED_WATER + tileset RedsHouse2_Block, RedsHouse2_GFX, RedsHouse2_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset Dojo_Block, Dojo_GFX, Dojo_Coll, $3A,$FF,$FF, $FF, ANIMATED_FLOWERS_WATER + tileset Pokecenter_Block, Pokecenter_GFX, Pokecenter_Coll, $18,$19,$1E, $FF, STATIC_FLOWERS_WATER + tileset Gym_Block, Gym_GFX, Gym_Coll, $3A,$FF,$FF, $FF, ANIMATED_FLOWERS_WATER + tileset House_Block, House_GFX, House_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset ForestGate_Block, ForestGate_GFX, ForestGate_Coll, $17,$32,$FF, $FF, STATIC_FLOWERS_WATER + tileset Museum_Block, Museum_GFX, Museum_Coll, $17,$32,$FF, $FF, STATIC_FLOWERS_WATER + tileset Underground_Block, Underground_GFX, Underground_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset Gate_Block, Gate_GFX, Gate_Coll, $17,$32,$FF, $FF, STATIC_FLOWERS_WATER + tileset Ship_Block, Ship_GFX, Ship_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_ANIMATED_WATER + tileset ShipPort_Block, ShipPort_GFX, ShipPort_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_ANIMATED_WATER + tileset Cemetery_Block, Cemetery_GFX, Cemetery_Coll, $12,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset Interior_Block, Interior_GFX, Interior_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset Cavern_Block, Cavern_GFX, Cavern_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_ANIMATED_WATER + tileset Lobby_Block, Lobby_GFX, Lobby_Coll, $15,$36,$FF, $FF, STATIC_FLOWERS_WATER + tileset Mansion_Block, Mansion_GFX, Mansion_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset Lab_Block, Lab_GFX, Lab_Coll, $FF,$FF,$FF, $FF, STATIC_FLOWERS_WATER + tileset Club_Block, Club_GFX, Club_Coll, $07,$17,$FF, $FF, STATIC_FLOWERS_WATER + tileset Facility_Block, Facility_GFX, Facility_Coll, $12,$FF,$FF, $FF, STATIC_FLOWERS_ANIMATED_WATER + tileset Plateau_Block, Plateau_GFX, Plateau_Coll, $FF,$FF,$FF, $45, STATIC_FLOWERS_ANIMATED_WATER diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 7957c552..417516ae 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6865,7 +6865,7 @@ _InitBattleCommon: ld [wLetterPrintingDelayFlags], a pop af ld [wMapPalOffset], a - ld a, [wSavedTilesetType] + ld a, [wSavedTileAnimations] ldh [hTileAnimations], a scf ret diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 703f5f07..dd9f9714 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -1,6 +1,6 @@ InitBattleVariables: ldh a, [hTileAnimations] - ld [wSavedTilesetType], a + ld [wSavedTileAnimations], a xor a ld [wActionResultOrTookBattleTurn], a ld [wBattleResult], a diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 72c33d8e..194fb810 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -69,7 +69,7 @@ LoadSAV0: ld de, wSpriteDataStart ld bc, wSpriteDataEnd - wSpriteDataStart call CopyData - ld a, [sTilesetType] + ld a, [sTileAnimations] ldh [hTileAnimations], a ld hl, sCurBoxData ld de, wBoxDataStart @@ -218,7 +218,7 @@ SaveSAVtoSRAM0: ld bc, wBoxDataEnd - wBoxDataStart call CopyData ldh a, [hTileAnimations] - ld [sTilesetType], a + ld [sTileAnimations], a ld hl, sPlayerName ld bc, sMainDataCheckSum - sPlayerName call SAVCheckSum diff --git a/sram.asm b/sram.asm index 07cfdfba..48542dc7 100644 --- a/sram.asm +++ b/sram.asm @@ -17,7 +17,7 @@ sMainData:: ds wMainDataEnd - wMainDataStart sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart sPartyData:: ds wPartyDataEnd - wPartyDataStart sCurBoxData:: ds wBoxDataEnd - wBoxDataStart -sTilesetType:: ds 1 +sTileAnimations:: ds 1 sMainDataCheckSum:: ds 1 diff --git a/wram.asm b/wram.asm index 3aca2431..3b1052d9 100644 --- a/wram.asm +++ b/wram.asm @@ -2000,7 +2000,7 @@ wMonHLearnset:: ds 1 wMonHeaderEnd:: -wSavedTilesetType:: +wSavedTileAnimations:: ; saved at the start of a battle and then written back at the end of the battle ds 1 -- cgit v1.3.1-sl0p