Ok, so I'm looking into the timers a little too much. Well, that's what happens when you are working on an FF7 TAS.
Again, looking at the Countdown Timer in the first reactor, it appears there is a flag that can cause the Countdown to reverse. If this flag is set, the Countdown will become a regular timer, counting up:
; CDFraction = Countdown Timer Fraction
; TimerDirection = Countdown Timer Direction Flag?
; CDSeconds = Countdown Timer Seconds
.text:0040AC0F mov edx, dw_CDFraction
.text:0040AC15 add edx, 444h
.text:0040AC1B mov dw_CDFraction, edx ; increase Fraction by 1092
.text:0040AC21 mov eax, dw_CDFraction
.text:0040AC26 shr eax, 10h
.text:0040AC29 test eax, eax ; check if Fraction is > 65535 (need to increment seconds)
.text:0040AC2B jz short loc_40AC75 ; exit if < 65536 (no need to increment seconds)
.text:0040AC2D xor ecx, ecx
.text:0040AC2F mov cl, b_TimerDirection ; Check timer direction (up or down)
.text:0040AC35 and ecx, 2
.text:0040AC38 test ecx, ecx ; TimerDirection AND 2
.text:0040AC3A jnz short loc_40AC56
.text:0040AC3C cmp dw_CDSeconds, 0
.text:0040AC43 jz short loc
.text:0040AC45 mov edx, dw_CDSeconds
.text:0040AC4B sub edx, 1
.text:0040AC4E mov dw_CDSecond ; Count down seconds value
...
.text:0040AC56 loc_40AC56:
.text:0040AC56 mov eax, dw_CDSeconds
.text:0040AC5B add eax, 1
.text:0040AC5E mov dw_CDSecond ; Count up seconds value
dw_CDFraction += 1092;
if ( dw_CDFraction >> 16 )
{
if ( b_TimerDirection & 2 )
{
++dw_CDSeconds;
}
else
{
if ( dw_CDSeconds )
--dw_CDSeconds;
}
dw_CDFraction & 0xFFFF;
The problem is, the timer direction flag thing is never set to >1. At least I couldn't find any code that writes to it...
I found 2 instructions that write to it and all they do is change it to 1.
A value of 1 should have no effect here though?
1 AND 2 = 0
0 AND 2 = 0
2 AND 2 = 1
if ( b_TimerDirection & 2 )
{
++dw_CDSeconds;
}
Seems to always be false.
So it would need to be set to 2 (at least) to make the timer increment instead of decrement.
Off the top of my head, I can only think of the snowboard game using a separate incrementing timer. But then I don't see the flag being set to anything >1 in the code.
The Flag address is only read/written in 3 places. It is read only once (here). It is written to in 2 other places; written to 1 and 0.
Does anyone have any insight on this? Or is this just useless code that they left in?