Version 2020-05-10:
https://filebin.net/7spaiz2xfys6b2i1/SoM_Turbo.200510.zipChanges:
- fixed Bug_Fixes\Gather_Party_Fix buggy camera behavior in very small rooms
Technical Changes:
- more prep work for the Script Augmentation Project
hmsong, let's see if I can explain some of what info you'd need to make an event that dispels stuff.
First off, actor data (actor = players, enemies, NPCs, chests) is 512 (0x200) bytes in RAM, starting at $7EE000. So the boy's data is at $7EE000 because he's always the first actor, the girl's data is at $7EE200 since she's second, $7EE400 is the sprite since he's third, the first enemy is at $7EE600, etc.
Events can access the top 256 (0x100) bytes of actor data for any given actor.
Now go look at SSE.Func.Detrimental.Dispel_Magic. You'll notice lots of STZ+X $E1?? and STA+X $E1?? instructions. X is the current actor offset. So if dispel is being cast on the boy, X = #0000, if cast on the girl, X = #0200, and so on. The $E1?? is referring to $7EE1?? which is the top 256 bytes of actor data, and X is added to the address based on the current dispel spell target.
So, let's analyze the first STZ+X $E1??:
STZ+X $E19B ' CURRENT_CHARGE_LEVEL
STZ means STore Zero (which means write #00 or #0000 to the target address).
+X is because the actor offset is added to the target address.
$E??? is because it's working on $7EE??? which is actor data.
$?1?? is because it's the top 256 (0x100) bytes of actor data.
$?19B is an actor's CURRENT_CHARGE_LEVEL (as noted by the comment).
So, let's say we want to do this same thing (setting CURRENT_CHARGE_LEVEL to 0 for the boy) using an event. The event command \stats1_boy== lets you write a byte to the top 256 bytes of the boy's actor data. The 1 in \stats1_* is the same as $?1?? in $E19B. And so, \stats1_boy== 9B 00 would do the same as STZ+X $E19B (when X = #0000 = boy).
Not everything in SSE.Func.Detrimental.Dispel_Magic is a STZ (STore Zero); many are STA, which means STore the value in the A register (to the target address). So before the STA+X instructions, you have to note what value A has. For example, look at this chunk of code:
LDA #01
STA+X $E1B7 ' TIMER_ATTACK_BUFF_DURATION
STA+X $E1BA ' TIMER_ACCURACY_BUFF_DURATION
STA+X $E1BB ' TIMER_EVADE_BUFF_DURATION
STA+X $E1BC ' TIMER_DEFENSE_BUFF_DURATION
STZ+X $E19D ' SABER_SPELL_USES
STZ+X $E1B8 ' WALL_USE_COUNTER
A is being set to #01 (LDA = LoaD A), and then some actor data is being set to 1 via STA+X, while some is being set to 0 via STZ+X.
All of that actor data is in the top 256 bytes ($E1??), so all of that can be replicated using event command \stats1_*. For example, \stats1_boy== B7 01 would do the same as STA+X $E1B7.
Things get more complicated when it comes to some of the other parts of dispel, namely altering:
$E1FA ' UPDATE_FLAGS
$E1B1 ' MISC_FLAGS
...because the dispel magic spell doesn't simply set them to specific values, it does some math on those values which the event system cannot do. It would require some analysis to determine if it's safe to set them to fixed values (or some trial and error).
---
Hot damn, did you say "automation script"? Holy crap.
I'm not positive what you think this means, but it's a script (code) that takes reconstructingmana's newly translated game script (text) and formats it into ZPS syntax, then puts it in place of the vanilla script (text) while leaving the non-text event commands, which I then can run through the ZPS Patcher to modify the ROM.
Annoyingly, "script" means multiple relevant things. In the context of the game's text, it's used like "movie script" where it's talking about the text (and in theory actor commands, but in this case only text). In the context of programming, a script is code read by an interpreter as-is (as opposed to being compiled into machine code or bytecode).
---
The camera issue was related to very small rooms: player screen coordinates never go negative if the current map is small enough and my new offscreen camera code (in Gather_Party_Fix) didn't account for that. I think I got it fixed correctly. Thanks for noticing it so soon; I had only been testing in large outdoor areas (especially using whip posts when offscreen in the Lofty Mountains).
reconstructingmana (and anyone interested in the retranslation), to clarify on that picture, I just wanted to show off some of the text in-game finally; you can ignore any of the other non-vanilla aspects of the image. The Script Augmentation Project won't be tethered to the rest of this Turbo project and will work as and be provided as a stand-alone patch (probably in IPS format), it will just also be one of the text options included in the Turbo patcher as well. At the moment, testing within the Turbo project framework gives me lots of diagnostic capability (e.g. debug controls to teleport around).