Huichelaar's Assembly Adventures

Here I’ll be uploading some ASM I wrote. I’m pretty new to thumb assembly and have not shared ASM before, so expect issues when trying to use this stuff. I’d really appreciate it if you could tell me of any issues you run into!

Also, massive thanks to the people who helped me understand asm over at the spell-academy channel in FEU’s discord. You’ve been a great help! Teq’s guide has also been incredibly helpful:

Custom Chapter Intro

Download
The one with the crystals.
The one without the crystals. Used in Pokémblem.
Latest update: 9 November 2020.

How to install
The following two options exist:

1. If you have a buildfile, just add an #include "ChapterScreen/ChapterScreen.event" or #include "ChapterScreenPokémblem/ChapterScreen.event" to the buildfile. Make sure that the ChapterScreen or ChapterScreenPokémblem folder is in the same directory. Alternatively, apply ChapterScreen.event directly to a clean FE8U ROM using Event Assembler.

2. If you’re using FEBuilder, go to Advanced Editors -> Insert EA -> Open. Pick ChapterScreen.event and press Load Script. If I’m not mistaken FEBuilder will just ignore the defined FreeSpace in ChapterScreen and use its own generated value instead.

What it do?
This patch replaces the standard chapter opening with something I made. There’s a segment that shows off some crystals doing some funky rotations followed by a segment displaying the chapter title while all living recruited units run from left to right, presumably to this chapter’s destination.

Customization
Which crystals will display is determined by a table that takes chapterID as an index. If you wish to change which crystals will appear per chapter (maybe for plot reasons?), you can change the values in this table. Details on how to do this can be found in the README. The combination of displayed crystals will affect the colour of the background once the gems are ‘slotted’.

I can understand that having the crystal combination be determined by something as rigid as ROM may not be desirable, therefore there’s a GetGemMask function which is used to get the combination of crystals to be displayed during the chapter opening. All you have to do is change this function to maybe grab some reserved byte in RAM instead and everything should be good. The mask can be stored in a single byte, even just 6 bits (one for each gem) will be enough.

There’s more details on customization in the README.

Pokémblem version
I made a variant without gems/crystals. This one uses a 256-colour background. Mind, only 224 colours are available, as the last two palettes are reserved. Vesley’s Pokémblem uses this variant as of 8 November 2020, but it should be compatible with vanilla FE8U as well.

Concluding
I had wanted to do this for a while, but had to first finish my previous project. Now that it’s finally here, seeing it all come together, it’s all very rewarding. The only frustration I had was coming up with ideas for this whilst having to wait a decent while before I could see them come to fruition due to the time it takes to implement the ideas. Not to mention the stuff I still want to implement, but I guess I’ll save that for another custom chapter opening someday in the future.

Credits

  • Agro/Brendor for the 16 Tracks/12 Sounds Fix.

  • Alusq for the amazing music installer template they made.

  • 7743 for FEBuilder. Amazing multipurpose tool, great for documentation too!

  • Square Enix for the Gems/Crystals and Ryan914 for ripping them from Final Fantasy (Dawn of Souls).

  • Konami for the Mist and SMITHYGCN for ripping it from Castlevania Harmony of Dissonance.

  • Konami for the Relief and Urathros for submitting it to Spriters Resource. Idk who ripped it, but it’s used in Yu-Gi-Oh!: Reshef of Destruction.

  • Game Freak for the VersusBG and DRAGOON for ripping it from Pokémon Platinum Version.

  • Game Freak for the AreaBGs and Latias Tamer for ripping them from Pokémon HeartGold/SoulSilver Version.

  • Huichelaar, that’s me. Idk if it’s rude putting yourself on a credit list, but I did make the thing.

Also a massive thank you to the people over at the FEU’s discord #spell-academy channel who have:

  • helped me understand how thumb works.
  • made tutorials regarding inserting assembly, creating processes, using Lyn, reducing buildtime, etc.
  • referred me to great resources such as GBATek and tonc.


Adaptive BGM

Dropbox containing the patch.

What it do?
Basically, Adaptive BGM mutes/unmutes certain tracks/channels of a midi during battle and unmutes/mutes those tracks outside of battle. In the example I provided in dropbox, I’m using a modifed version of Desire Below (arranged by Libera over at ninsheetmusic, modifed by me). Outside of battle, only tracks 1, 2 and 3 are playing (0, 1, 2 depending on your mood). When battle starts, tracks 4 and up are unmuted. When battle ends tracks 4 and up are muted again.

Prerequisites
To take full advantage of Adaptive BGM, you should assemble the Change Battle BGM By Chapter (credit: 7743) patch.

You should probably also assemble the 16 Tracks/12 Sounds Fix (credit: Agro/Brendor) patch. It’s part of the Essential Fixes of the skillsystem.

Make sure NOT to assemble the Continue Battle BGM Between Map and Combat (credit: 7743) patch. Adaptive BGM actually uses a modifed version of Continue Battle BGM.

How to install
There’s 2 options:

1. If you have a buildfile, just add an #include "FE8-CalmFlow/CalmFlow.txt" to the buildfile. Make sure that the FE8-CalmFlow folder is in the same directory. Alternatively download the Dependencies folder and buildfile.event, and assemble buildfile.event using a clean FE8U ROM.

2. Apply the FE8U-ABGM.ups patch to a clean ROM. This patch also sets the Prologue’s Player Phase BGM, Player Phase Battle BGM, Enemy Phase BGM and Enemy Phase Battle BGM to Desire Below. Please let me know if the patch doesn’t adapt successfully, or if something goes wrong.

How to use
I’ll be using FEBuilder a lot in this section. I find it more easy to work with for this part.

There’s no need to keep the .midi, .s or .mp4 files in the FE8-CalmFlow folder, but to replicate what’s happening in the .mp4 sample, import Fire Emblem Fates - Desire Below.s in FEBuilder’s Song Track editor to track 3DD.

Make sure to also set 3DD's priority type to High (Map Music) in FEBuilder’s Song Table. Finally, in the chapter editor, set the Player Phase BGM and the Player Battle BGM and/or the Enemy Phase BGM and Enemy Battle BGM to 3DD. That should be all.

Customization
Right-o, that’s all neat for this one (poorly adapted) soundtrack, but what about other soundtracks? Well, there’s some room for customization!

  • Simply importing a different MIDI to location 3DD will have the same effect of channels 4 and up being unmuted during battle and muted outside of battle.
  • This effect can also be applied to a different location, X, if you replace all instances of 3DD in InitCalm.asm, ReturnCalm.asm, FadeoutCalm.asm, EndBattleCalm and ContinueBattleBGM.asm with X and re-assemble these files.
  • What if you want to mute different (from the top 3) channels outside of battle? Not very hard, but requires a little knowledge of asm. I’ll provide some details below.
  • Maybe there are certain channels you wish to mute during battle. This one will also require some asm knowledge. More details below.
  • You may want to have multiple soundtracks that can adapt. Maybe for one of these soundtracks channels 3 and up should be muted outside of battle, yet for another soundtrack it’s channels 5 and up. This requires more asm stuff. this time too, it’s not particularly hard, but rather than me painstakingly explaining every step for this one I’d rather you take a look at the asm (I commented it) and ask me if anything isn’t clear, so I can clarify it.
Muting channels outside of battle

There’s a cmp rX, #0xD command (where X can be some number between 0 and 7) in InitCalm.asm, ReturnCalm.asm and FadeoutCalm.asm, followed by a conditional branch (either ble or bgt). 0xD ensures that channels 3 (0xE), 2 (0xF) and 1 (0x10) remain unmuted outside of battle. increment 0xD to 0xE, and only channel 1 and 2 will be unmuted outside of battle. Decrement 0xD to 0xC and channel 1, 2, 3 and 4 will remain unmuted outside of battle. You will also have to increase or decrease the immediate in line 36 of ContinueBattleBGM.asm accordingly, to indicate which tracks should be unmuted during battle. Also, the immediate in line 38 of EndBattleBGM.asm needs to be adapted appropriately as well. As long as the channels that are to be muted outside of battle are at the top (not interwoven with the other tracks), this will work. If they aren’t, you’ll have add a few more conditional and unconditional branches and labels. Teq’s guide should be very helpful for this: GBAFE Assembly for Dummies, by Dummies

muting channels during battle

I won’t go into too much detail this time, but to mute channels when battle starts you’ll have to put some conditional branches around line 52 in ContinueBattleBGM.asm. If the immediate in line 52 is 0x40, the track (which should be 0x10-r5) at that iteration of the loop will be unmuted when battle starts. If the immediate is 0x0 the track will be muted when battle starts. r5 contains the counter which counts down for every iteration of the loop, and we know which track we’re dealing with by subtracting it from 0x10.

Concluding
In retrospect, after writing all these paragraphs, I do see how user-unfriendly this patch really is. I still believe it’s more helpful than nothing, but I understand it’s not very attractive to have to do assembly-coding to ‘properly’ take advantage of this patch. I’ll see if I can make the patch more user-friendly in the future!

Danger Radius

Latest update: 13 November 2020.
Dropbox containing the patch. Compatible with vanilla FE8U.

Dropbox containing the patch. Compatible with the SkillSystem (as of August 5th 2020)

PLEASE NOTE: Regarding the SkillSystem version, a hook in the Capture skill is overwritten. Either make sure that Capture is #included BEFORE FogDR or comment out/delete the jump to Should_Dead_Unit_Be_Cleared in the Capture.event file.

How to install
There are two versions. For the vanilla FE8U version the following three options exist:

1. If you have a buildfile, just add an #include "FE8-FogDR/FE8-FogDR.event" to the buildfile. Make sure that the FE8-FogDR folder is in the same directory.

2. There’s a UPS patch named FE8_FogDR.ups in the dropbox. Apply that patch to a clean FE8U ROM.

3. If you’re using FEBuilder, use the Insert EA option and open FE8-FogDR/FogDR.event. Press Load Script. Best to make sure you’re writing to free memory.

For the SkillSystem-compatible version, the following three options exist:

1. If you have a buildfile, just add an #include "FE8-FogDR/FE8-FogDR.event" to the buildfile. Make sure that the FE8-FogDR folder is in the same directory. I repeat, a hook in the Capture skill is overwritten. Either make sure that Capture is #included BEFORE FogDR or comment out/delete the jump to Should_Dead_Unit_Be_Cleared in the Capture.event file.

2. There’s a UPS patch named SkillsTest.ups in the dropbox. Apply that patch to a clean FE8U ROM.

3. If you’re using FEBuilder, use the Insert EA option and open FE8-FogDR/FogDR.event. Press Load Script. Best to make sure you’re writing to free memory. Insert this EA, after implementing the SkillSystem patch.

Extra functionality
If you replace all instances of DangerRadius in FogDR.event with DangerRadius2 The following additional functionalities will be disabled:

  • Pressing select on a tile not containing an enemy unit will disable all enemy unit DR’s if at least one enemy unit’s DR is set.
  • Pressing select on a tile not containing an enemy unit will enable all enemy unit DR’s if no enemy unit’s DR is set.

Because DR can slow down the game when many are active, the alternative DangerRadius2 exists. Accidentally setting all enemy units’ DR is a mistake quite easily undone, but only if you know how (by pressing select again).

What it do?
This patch implements Danger Radius. Unlike Danger Zone, the danger radius of individual enemy units can be viewed by pressing the select button when hovering over their map sprite. Pressing select again will disable their danger radius.

There’s also the following ASMC macros in here. These can be used for chapter events:

  • CheckDangerRadius(charID): Returns 1 if true - currently displaying the Danger Radius for charID.

  • CheckDangerRadius(X, Y): Returns 1 if true - currently displaying the Danger Radius for unit at coordinates X, Y.

  • SetDangerRadius(charID): Sets the Danger Radius for charID.

  • SetDangerRadius(X, Y): Sets the Danger Radius for unit at coordinates X, Y.

  • UnsetDangerRadius(charID): Unsets the Danger Radius for charID.

  • UnsetDangerRadius(X, Y): Unsets the Danger Radius for unit at coordinates X, Y.

  • SetAllDangerRadius: Sets every enemy’s Danger Radius.

  • UnsetAllDangerRadius: Unsets every enemy’s Danger Radius.

Limitations

  • The Fog of War palette is used to display danger radius. To avoid conflicts, If Fog of War is active during a map, Danger Radius is replaced by the more standard Danger Zone as was originally implemented (but not available) in vanilla FE8U. I’d recommend not using the custom ASMC’s during a chapter that has FOW.
  • Depending on the size of a map, calculation of multiple units’ danger radii could slow down the game considerably. Make sure not to have too many units’ danger radii active, if you want to avoid lag. Fewer than a dozen should be safe.
  • Danger Area automatically disables itself when the current phase is not player phase. It can, of course, be re-enabled during player phase.
  • Both versions use byte 0x6 in IRAM (0x0300 0006) and the seventh lsb from byte 0x32 of enemy unit character structs (supports). If these are used by any other installed patches, issues may arise. However, note that only the enemy unit structs are repurposed, not the players’ or allies’.

Danger Area Colour

How to change the DR colour

If you want the danger area to display as a purple ‘layer’ instead of it using the default FOW palette, you’ll have to replace the FOW palette. This can be done quite easily in FEBuilder:

The palette I’m using in the Danger Zone sample gif can be obtained by following these steps:

  • Ensure the Tileset Palette is “Fields(01 02 03 05 00)” and Palette Type is “1=fog.” Both are marked in red in the image above.
  • Set Palette No. to “0000=0 palette.” Go to the Digitize Palette menu by pressing the Clipboard button and enter
    1900934D9149D741185A9530D4553339123D9645D74D5441F03CD861B65D173D
    before pressing Change.
  • Set Palette No. to “1000=1 palette.” Go to the Digitize Palette menu by pressing the Clipboard button and enter
    0038B541113D14668D556C552D550F51EF4CD655B255D255D44DB349724D5345
    before pressing Change.
  • Set Palette No. to “2000=2 palette.” Go to the Digitize Palette menu by pressing the Clipboard button and enter
    0038F1510F49165EF359F255B151D451914DD559B05592557349514D1045F555
    before pressing Change.
  • Set Palette No. to “3000=3 palette.” Go to the Digitize Palette menu by pressing the Clipboard button and enter
    00387341394EF35139621962184E1556B64DF459AF596E594E5931551051534D
    before pressing Change.
  • Set Palette No. to “4000=4 palette.” Go to the Digitize Palette menu by pressing the Clipboard button and enter
    00385A66576A345EF255F255B2597249524D19621952D84D764D54493245F165
    before pressing Change.

Do note that this only changes the FOW palette for the “Fields(01 02 03 05 00)” tileset palette. To get the purplish Danger Area for any other tileset, you’ll still have to change their palettes. Of course, feel free to go for a completely different palette (negative, sepia, black-and-white, go wild).

Concluding
So, Danger Area got a lot of feedback, and it seems that for a number of people, not being able to use Fog of War as a result of the Danger Area patch was a dealbreaker. Allowing both Danger Area/Radius and FOW on a map wouldn’t be possible due to certain limitations, but giving people the choice between either on a map-by-map basis was certainly doable. Personally, and I’m sure others would have this issue too, I couldn’t stand the lag that came with Danger Zone as soon as not even two-dozen enemies were present on a semi-big map.

Danger Radius aims to fix these two issues. Unlike Danger Area, Danger Radius is implementable on vanilla FE8U. I’ve made a version for the SkillSystems as well. Hopefully it won’t get deprecated any time soon.

I’m also planning, somewhere further in the future, probably within the next year, to come back to this and add and rework a few more things; I’d like to remove a certain piece of hard-coding and I intend to implement some option in the in-game options menu to let the player limit the max amount of active DR.

2020-08-02_18-13-42

Again, please tell me if you run into any issues adapting these patches. I’m also new to these forums, so Hi!

SkillSystem Credits

Circleseverywhere
Colorz for debuffs, freeze, and dragon veins
Monkeybard & Black Mage for most of the skill icons; Blaze for Stances skill icons; vlak for Drive skill icons; Pikmin1211 for miscellaneous icons; Zaim for Indoor March icon
Tequila, Rossendale, StanH, Leonarth, 2WB, Teraspark, Darrman, SD9k, Kao, blademaster, Snakey1, Zeta, Kirb, Sme, Ganzap for skills, 7743 for various bugfixes
Primefusion for the test map
Str/Mag Split based off of Kirb’s FE8 version which is based off of Tequila’s FE7 version. RobertFPY, Pikmin1211, and Snakey1 for finalization)

39 Likes

really gonna post a screenshot of ManBat! rennac with no context huh

for this adaptive bgm, is this similar to like what fe13/14/16 do with the rain/thunder versions? I’m trying to understand the functionality

1 Like

I’m not quite sure quite what those games exactly do to transition between the rain/thunder versions, but that is the effect I’m trying to replicate, yes.

I’d upload Rennac’s class to the animation directory, but I’m still planning on tweaking it a little.

3 Likes

basically they have one track with two versions of the same song and the versions switch in real time during battle

so this wouldn’t restart the song but continue it on then? that is a very neat thing to add

Well, this doesn’t switch any soundtracks. It mutes certain parts of the song, instruments (sorta), outside of battle, and unmutes them during battle.

The main limiting factor here is that the two versions of the song share the same 12-note limit.

is it possible to upload a video showing it off?

There’s an .mp4 in the dropbox I linked. I’ll upload it to youtube and see if I can embed it.

EDIT: the youtube video is up and embedded.

1 Like

Oh shit this is actually really cool

i really like the dangerzone range display

oh yeah is exactly what i was thinking
aka sicko mode

Sicko mode… in a good sense?

1 Like

I see danger zone display, I like

1 Like

yuh, this is insane.
For some reason I swear danger zones already existed, but I wouldn’t use them anyway because I’m sadistic. Still, I know that this is a big, sudden contribution from a newcomer, and people with actually good design philosophies are gonna love it. I hope you get the “new member of the month” award.

2 Likes

iirc the danger zone that already exists doesnt continue to show like this one - if you click away on the existing danger zone hack it gets rid of the danger zone thing while this one appears to stay in place

Yes, the original Danger Zone is a bit flighty. I tried to go for a more permanent solution.

UPDATE: I added the Danger Zone patch and instructions.

EDIT: And now the dropbox link is correct, woops, sorry.

4 Likes

This is actually poggers, I’m definitely keeping an eye out for this if you’re continuing to work on it

So, there’s no way to keep this Danger Zone and the FoW?
Maybe using a palette that isn’t tied to the tilesets?
Like a table in which you can set which palette is used for a tileset.

Edit: I found a Bug.
With the Danger Zone active, the skill Elbow Room gives a massive boost of 127 might.
SkillsTest_02 SkillsTest_03
I guess the same happens with Natural Cover.

Thanks! I’ll look into that bug!

The way I understood it, is that there’s a limited amount of palettes that can be displayed at any time for a layer. Which is why there’s no room to let the maptile-layer display more palettes. On second read-through, I’m not quite sure if that actually answers your question.

In all fairness, when you know you’re in danger your fight-or-flight response kicks into overgear. Our buddy over here injected a heap of elephant steroids just so he can delete the enemies.

5 Likes

Yoooooo, that adaptive music thing is epic ngl