You are not logged in.
In this commit for Polished Crystal, I added a map for another gatehouse. I believe I added everything in the right place, with the order of the map constants corresponding to their headers.
Somehow, this one change breaks trainer battles. The names are the same as the trainer classes, e.g. "Camper Camper", the first Pokémon is always Venomoth, and the battle itself is very glitchy—it might quit as soon as I click Fight, or it might act weird. See the screenshots below.
Maybe I added one map too many? Is that even possible? Is the map data overflowing into the trainer data? I figured I'd check with you guys before spending possibly hours debugging something in BGB that's actually simple once you know the trick.
Edit: I think it has something to do with maps.asm. I added a SECTION "Map Scripts 28", ROMX and moved some maps to it, and started a new game, and then when I walk into Prof. Elm's lab the screen goes white and freezes. Maybe shuffling the maps around the sections would happen upon a working configuration, but I wouldn't understand why it works or trust it to always work.
Update: Okay, I tried moving all the maps' .asm files back into their previous sections in maps.asm, and just added Route12Gate.asm to the end of SECTION "Map Scripts 27". Now it works. But I don't understand why. Any ideas? It's not the save file; I encountered this glitch with a completely new game.
Last edited by Rangi (2016-08-25 00:28:08)
I'm running into a similar problem with this commit. Here I did two things: included and used a new music file by Mmmmmm, mountcoronet.asm, without changing the audio data sections; and added a new SECTION "Map Scripts 28", ROMX since one map script got a bit too big from some new text. After these changes, some music does not play or plays incorrectly, including the title screen theme )which is in the same section as the MtCoronet theme). What is causing this?
Edit: Actually, the problem is with this commit, I just only noticed it after a later one. Here again, the problem is caused by slightly reorganizing the sections in maps.asm, except now the problem is that some music doesn't play or plays wrong, including the title screen. What's going on?
And once again, getting rid of the new map section fixed the problem. I really want to know what the root cause is, because I'm going to keep adding more map scripts and will need another section, and I don't want some random glitch to be hiding away because of it. I was lucky this affected the title screen, the most obvious piece of music, instead of some late-game thing.
Last edited by Rangi (2016-08-25 00:25:38)
Okay, this is getting to be a serious problem. In this commit I add a couple of new trainer classes. This ends up breaking the rival battle after getting your starter: when the screen turns black, before the trainer sprites appear, it just stays black and the music turns off.
It has something to do with the sections that don't have an explicit bank. I've had to use pretty many of them as things like map data and sprite data expanded beyond their original banks. I thought that not indicating a bank would make the data fit wherever it could, but apparently it's overwriting other data.
What I'd like is a way to see how much space is used in each bank, so I can more easily shuffle blocks of code around until they fit. Or a way to make the assembler do that without making mistakes. Right now the best I can do is move things around blindly an test to see if the original problem goes away, without knowing if there's still another one. (I can make the rival battle work, but how do I know some other rarely-accessed bit of data isn't overwritten?)
If I had to guess, I'd say something (or some things) must still have a hardcoded bank ID or a bank constant instead of something like BANK(RoutineNameHere) so when data ends up in another bank, one or two routines might be looking for it in the wrong bank still. That's just a guess based on your description of the problem, can't check it out in too much detail until after work.
Check them out on Github
I hadn't thought of that! Thanks. This particular problem fixed itself after I started deleting the code for Mystery Gift (I'm going to get rid of as much obsolete code as possible to make room, liek the Mobile Adapter and Stadium features). However, it might have been caused by this part of battle/core.asm:
BattleIntro: ; 3f4dd call LoadTrainerOrWildMonPic xor a ld [TempBattleMonSpecies], a ld [wd0d2], a xor a ld [hMapAnims], a callba PlayBattleMusic callba ShowLinkBattleParticipants callba FindFirstAliveMonAndStartBattle call DisableSpriteUpdates callba ClearBattleRAM call InitEnemy call BackUpVBGMap2 [...] BackUpVBGMap2: ; 3f568 ld a, [rSVBK] push af ld a, $6 ; BANK(wDecompressScratch) [...]
I'll keep that in mind if something like it happens again.