So last night, I was playing as Turbo Man for a bit, and right after I mowed down a Flash Man as I came out of a Time Bender trap, my opponent commented that the Crash Drive seemed to charge very quickly. I replied that it was random, as far as I knew; sometimes it's fast and sometimes it's normal. However, that got me wondering about
why such a thing would occur, so I decided to poke around in the code to figure out just what was going on. Well, as it turns out, the Crash Drive has been bugged since version 7b (the version in which its duration got cut in half).
This may be old news to some of you, but I figured that I ought to give an explanation to those who were unaware (and a reminder to those who had forgotten
please fix this).
Long explanation here:
So, first of all, here's the code pertaining to the Crash Drive:
Altfire:
TUCA C 0 A_JumpIfInventory("CarCount",10,"StopCar")
TUCA C 0 A_JumpIf(momz==0, "SlideSlide")
TNT1 A 0 SetPlayerProperty(0,0,0)
Goto Ready+1
SlideSlide:
TNT1 A 0 A_JumpIfInventory("Petrol",1,"Continue")
goto Ready+1
Continue:
TNT1 A 0 SetPlayerProperty(0,1,0)
TNT1 A 0 SetPlayerProperty(0,1,4)
TNT1 A 0 A_JumpIfNoAmmo("NoAmmo")
TNT1 A 0 A_GiveInventory("TurboCar",1)
TUCA XY 2 A_PlaySoundEx("classes/drilling","classes")
TNT1 A 0 A_GiveInventory("CarCount",1)
TNT1 A 0 A_JumpIfInventory("CarCount",8,"Go")
Goto Continue
Go:
TNT1 A 0A_PlaySoundEx("classes/drillout","classes")
CarMode:
TNT1 A 0 A_GiveInventory("TurboCar",1)
//TNT1 A 0 A_Recoil(-7)
//TNT1 A 0 A_ChangeVelocity(14,0,momz,CVF_RELATIVE|CVF_REPLACE)
TNT1 A 0 A_ChangeVelocity(28,0,momz,CVF_RELATIVE|CVF_REPLACE)
TNT1 A 0 A_SpawnItemEx("CarRadius",0,0,0)
TNT1 A 0 A_Ta SetPlayerProperty(0,0,4)
TNT1 A 0 keInventory("Petrol",1)
TUCA XY 1 A_WeaponReady(WRF_NOPRIMARY/WRF_NOSWITCH)
TNT1 A 0 A_JumpIfInventory("Petrol",1,"CarMode")
goto StopCar
StopCar:
TNT1 A 0 A_TakeInventory("TurboCar",999)
TNT1 A 0 A_TakeInventory("CarCount",999)
TNT1 A 0 A_GiveInventory("NoCar",1)
TNT1 A 0 SetPlayerProperty(0,0,0)
TUCA A 35
TNT1 A 0 A_TakeInventory("NoCar",1)
Goto Ready+1
The lines to pay attention to are the ones that pertain to the "CarCount" item, which is used to control the length of time it takes Turbo Man to charge up before unleashing the Crash Drive. When you start the Crash Drive, Turbo Man starts gaining "CarCount" until he has 8 of the item, at which point he goes into the actual Crash Drive. Then, once he runs out of ammo, the Crash Drive ends automatically and all the "CarCount" items are taken away from him. And indeed, if you always use up all the ammo and let the Crash Drive end naturally, you'll never see any unusual behavior.
However, things get weird when you try to hit Altfire again to cancel the Crash Drive early. As you can see right at the start of the Altfire code, Turbo Man needs at least 10 "CarCount" to trigger the normal cancellation that would happen if he ran out of ammo. However, since he stops gaining "CarCount" as soon as he has the 8 needed to begin the Crash Drive, he doesn't actually have enough to trigger the normal cancellation. What happens next depends on whether he's on the ground or in the air.
If Turbo Man is on the ground, instead of stopping the Crash Drive, he'll just start another one instantly; you'll hear the Crash Drive sounds play again, but he'll just continue doing the Crash Drive as if nothing happened. Since running through the charging cycle again will give Turbo Man a bit more "CarCount," if you try to cancel the Crash Drive at this point, regardless of his position relative to the ground, it will cancel normally. (I'm guessing the reason he reaches the 10 threshold might be related to DoubleAmmo, but I'm not sure.)
If Turbo Man is in the air when you try to cancel the Crash Drive, things get really weird. Since Turbo Man doesn't have enough "CarCount" to trigger the normal cancellation, the game continues on to the next line of code, which checks his vertical momentum. Now, what this is meant to do is ensure that Turbo Man can't start a Crash Drive in midair (though he can start one if he's just bumped his head on a ceiling). However, in this case, it ends up serving as a makeshift cancellation method instead. Since Turbo Man has vertical momentum, the game says, "Hey, you can't Crash Drive in the air!" and puts him back into his normal ready state, ending the Crash Drive. This bugged cancellation differs from a normal one in two ways:
1. Turbo Man returns to his Ready state almost instantly, much sooner than he would after a normal Crash Drive cancellation.
2. The "CarCount" items are not taken away from Turbo Man.
The second of those is the reason for the insta-Crash Drive phenomenon. Since Turbo Man still has 8 "CarCount" items, the next time he attempts to start a Crash Drive, he won't need to charge it up; the game will run through the charging cycle once, see that he already has enough "CarCount" items, and immediately put him into his Crash Drive state. At this point, he will have enough "CarCount" items to cancel the Crash Drive normally whether he's on the ground or in the air.
Also of note is this little snippet of code for Turbo Man's mainfire:
Fire:
TUCA A 0 A_JumpIfInventory("CarCount",14,"StopCar")
Apparently, at some point in the past, it was possible to cancel the Crash Drive by hitting mainfire instead of altfire. However, this has been impossible at least since version 6f (the oldest version I have access to), due to it requiring more "CarCount" than Turbo Man can actually acquire.
tl;dr version here:
If you try to cancel the Crash Drive on the ground, it doesn't work; instead, a new Crash Drive is started instantly, which is effectively the same as not canceling it, apart from playing the sound again. If you try to cancel the Crash Drive in the air, it does stop, and you ready yourself much faster than normal. After this air cancellation, the next time you attempt a Crash Drive, it will launch almost immediately; this insta-Crash Drive can be cancelled normally regardless of whether you're in the ground or in the air, and the next Crash Drive after it will have the normal charging time.