to reiterate an earlier point: i still think it's a bad idea to drop the "JSR $0B36" for space savings. relying on Revert to always happen doesn't sit well with me, particularly in a version where you're not relaxing C2/4BB2. and conceptually, failure to revert shouldn't make your "fuel" depletion fail to stick. more generally, i've come to see this issue as fairly separate of the ongoing debate on $3EE2.
If your spidey senses are tingling, I'll definitely keep this in mind. However, from what I can understand, C2/1211 always gets called every (other) frame as long as $3EE2 is set, and if only C2/0AA8 clears it, Revert is forced to happen at the soonest possible moment as long as the Morph timer is zero. The function to update Morph-related stuff (C2/0AA8) is called every turn and both clears $3EE2 and calls C2/0B36. C2/0B36 updates the Morph supply from the Morph timer ($3F30-$3F31) and that variable never changes outside of C2/1211 (except for being initialized by Morph and cleared by Revert). I can't see how waiting for C2/0AA8 to update the Morph supply would be an issue, unless you think there's another way Revert could get thwarted. Sorry if I seem hard-headed about this, I just want to make sure I didn't miss anything. :)
Now that I think of it, I suppose the battle ending would thwart Revert. Not updating the supply immediately when the timer runs out actually kind of silently fixes the problem with the timer running out during end-of-battle messages, but certain special battle endings don't update the Morph supply, such as Gau Leaping or Returning, or Shadow leaving, and in those cases the supply wouldn't get updated even if the timer ran out just as the battle ended. That's a pretty good tradeoff though, in my opinion (but it's easy to fix).
I agree that it is a separate issue though, and I've largely settled on leaving it in, since the many different issues to fix with Morph requires gobbling up some free space anyway. However, do make note that by dropping this instruction, it is possible to make a bare-bones bugfix that doesn't require any free space, which I think is of some value.
;(Decrease Morph timer. If it's run out, queue the Revert command, unless it's already queued.)
org $C21211
REP #$20 ;(Set 16-bit Accumulator)
SEC ;
LDA $3F30 ;(Load the morph timer)
SBC $3F32 ;(Subtract morph decrement amount)
STA $3F30 ;(Save the new morph timer)
SEP #$20 ;(Set 8-bit Accumulator)
BCS gauge ;(Branch if it's greater than zero)
STZ $3F31 ;(zero top byte of Morph timer. i assume we're
; neglecting to zero $3F30 just to avoid adding a
; "REP" instruction.)
LDA $3A7A ;(Check current command)
CMP #$04 ;(Is it Revert?)
BEQ gauge ;(This prevents queueing multiple Reverts)
LDA #$04 ;(If it wasn't, make it Revert)
STA $3A7A ;(Store Revert as command)
JSR $4EB2 ;(queue it?)
NOP ;padding
gauge:
LDA $3F31 ;(Load the remaining amount of morph time DIV 256, if any)
STA $3B04,X ;(Store it to the character's Morph gauge?)
RTS
This only fixes the bug, it doesn't take care of the issues with the Morph timer being unaffected by time stoppage, the battle having ended, or even Terra not being present.
or something like Bit 4 of $3AA1,index for periodic damage/healing? is Bit 3 of that byte indeed unused, or am i overlooking something?
Could you elaborate on this? You mean periodically queuing up Revert via another function that doesn't depend on $3EE2 being set, like C2/5A83, conditional on bit 3 of $3AA1,index being set instead? Would you then be setting that bit in C2/1211 to allow Revert to be queued up, and then clear it when Revert is executed? Essentially offloading the responsibility for Revert onto an unused bit instead of $3EE2?
and how'd i go so long without commenting Function C2/0A41? :/
when i see another one of these damn toggles, my brain shuts down as a protective measure
I think you answered your own question.
