From bbdf13fc8f9dddfba7d4837d95c7d6a619e83112 Mon Sep 17 00:00:00 2001 From: SoupPotato Date: Wed, 11 Dec 2024 07:50:06 +0000 Subject: [PATCH] Partial Fix for Battle Tower OW Bug --- constants/sprite_constants.asm | 27 ++++++++++---------- engine/events/battle_tower/battle_tower.asm | 28 ++++++++------------- maps/BattleTowerBattleRoom.asm | 17 +++++++------ 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index 02270dbc3..15202e36f 100644 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -189,16 +189,17 @@ DEF NUM_POKEMON_SPRITES EQU const_value - SPRITE_POKEMON ; wVariableSprites indexes (see wram.asm) const_next $f0 DEF SPRITE_VARS EQU const_value - const SPRITE_CONSOLE ; f0 - const SPRITE_DOLL_1 ; f1 - const SPRITE_DOLL_2 ; f2 - const SPRITE_BIG_DOLL ; f3 - const SPRITE_MUSHROOM_1 ; f4 - const SPRITE_FUCHSIA_GYM_1 ; f5 - const SPRITE_FUCHSIA_GYM_2 ; f6 - const SPRITE_FUCHSIA_GYM_3 ; f7 - const SPRITE_FUCHSIA_GYM_4 ; f8 - const SPRITE_COPYCAT ; f9 - const SPRITE_JANINE_IMPERSONATOR ; fa - const SPRITE_MUSHROOM_2 ; fb - const SPRITE_MUSHROOM_3 ; fc + const SPRITE_CONSOLE ; f0 + const SPRITE_DOLL_1 ; f1 + const SPRITE_DOLL_2 ; f2 + const SPRITE_BIG_DOLL ; f3 + const SPRITE_MUSHROOM_1 ; f4 + const SPRITE_FUCHSIA_GYM_1 ; f5 + const SPRITE_FUCHSIA_GYM_2 ; f6 + const SPRITE_FUCHSIA_GYM_3 ; f7 + const SPRITE_FUCHSIA_GYM_4 ; f8 + const SPRITE_COPYCAT ; f9 + const SPRITE_JANINE_IMPERSONATOR ; fa + const SPRITE_MUSHROOM_2 ; fb + const SPRITE_MUSHROOM_3 ; fc + const SPRITE_BATTLE_TOWER_OPPONENT ; fd diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index a1a8eeeef..221c7cd93 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -1550,27 +1550,21 @@ LoadOpponentTrainerAndPokemonWithOTSprite: ; Load sprite of the opponent trainer ; because s/he is chosen randomly and appears out of nowhere ld a, [wScriptVar] - dec a - sla a ld e, a - sla a - sla a - sla a - ld c, a - ld b, 0 ld d, 0 - ld hl, wMapObjects - add hl, bc - inc hl + ld [hUsedSpriteIndex], a + ld hl, wVariableSprites + add hl, de + ld de, -SPRITE_VARS + add hl, de ld a, [wBTTempOTSprite] ld [hl], a - ld hl, wUsedSprites - add hl, de - ld [hli], a - ldh [hUsedSpriteIndex], a - ld a, [hl] - ldh [hUsedSpriteTile], a - farcall GetUsedSprite + farcall ReloadSpriteIndex + ld a, [wBTTempOTSprite] + call GetSpritePalette + ld [wNeededPalIndex], a + ld de, wOBPals1 palette 1 + farcall CopySpritePal ret INCLUDE "data/trainers/sprites.asm" diff --git a/maps/BattleTowerBattleRoom.asm b/maps/BattleTowerBattleRoom.asm index a65a1707b..2e599db45 100644 --- a/maps/BattleTowerBattleRoom.asm +++ b/maps/BattleTowerBattleRoom.asm @@ -1,5 +1,5 @@ object_const_def - const BATTLETOWERBATTLEROOM_YOUNGSTER + const BATTLETOWERBATTLEROOM_OPPONENT const BATTLETOWERBATTLEROOM_RECEPTIONIST BattleTowerBattleRoom_MapScripts: @@ -10,7 +10,7 @@ BattleTowerBattleRoom_MapScripts: def_callbacks BattleTowerBattleRoomEnterScene: - disappear BATTLETOWERBATTLEROOM_YOUNGSTER + disappear BATTLETOWERBATTLEROOM_OPPONENT sdefer Script_BattleRoom setscene SCENE_BATTLETOWERBATTLEROOM_NOOP ; fallthrough @@ -21,12 +21,13 @@ Script_BattleRoom: applymovement PLAYER, MovementData_BattleTowerBattleRoomPlayerWalksIn ; beat all 7 opponents in a row Script_BattleRoomLoop: - setval BATTLETOWERBATTLEROOM_YOUNGSTER + setval BATTLETOWERBATTLEROOM_OPPONENT special LoadOpponentTrainerAndPokemonWithOTSprite - appear BATTLETOWERBATTLEROOM_YOUNGSTER + appear BATTLETOWERBATTLEROOM_OPPONENT + loadmem wObject1Palette, 1 warpsound waitsfx - applymovement BATTLETOWERBATTLEROOM_YOUNGSTER, MovementData_BattleTowerBattleRoomOpponentWalksIn + applymovement BATTLETOWERBATTLEROOM_OPPONENT, MovementData_BattleTowerBattleRoomOpponentWalksIn opentext battletowertext BATTLETOWERTEXT_INTRO promptbutton @@ -37,9 +38,9 @@ Script_BattleRoomLoop: ifnotequal $0, Script_FailedBattleTowerChallenge readmem wNrOfBeatenBattleTowerTrainers ifequal BATTLETOWER_STREAK_LENGTH, Script_BeatenAllTrainers - applymovement BATTLETOWERBATTLEROOM_YOUNGSTER, MovementData_BattleTowerBattleRoomOpponentWalksOut + applymovement BATTLETOWERBATTLEROOM_OPPONENT, MovementData_BattleTowerBattleRoomOpponentWalksOut warpsound - disappear BATTLETOWERBATTLEROOM_YOUNGSTER + disappear BATTLETOWERBATTLEROOM_OPPONENT applymovement BATTLETOWERBATTLEROOM_RECEPTIONIST, MovementData_BattleTowerBattleRoomReceptionistWalksToPlayer applymovement PLAYER, MovementData_BattleTowerBattleRoomPlayerTurnsToFaceReceptionist opentext @@ -149,5 +150,5 @@ BattleTowerBattleRoom_MapEvents: def_bg_events def_object_events - object_event 4, 0, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, EVENT_BATTLE_TOWER_BATTLE_ROOM_YOUNGSTER + object_event 4, 0, SPRITE_BATTLE_TOWER_OPPONENT, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, EVENT_BATTLE_TOWER_BATTLE_ROOM_YOUNGSTER object_event 1, 6, SPRITE_RECEPTIONIST, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, -1