Forums

Full Version: another improvement for poor keyboard players
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there, I'm back with another little function very usefull for keyboard players : THE AUTO CLUTCH...The problem is that with a keyboard, you can't brake, control the car, engage a lower gear and engage the clutch in the same time so, these little adds can simulate an auto clutch which simply reengage the clutch after a gear change...so first, we create a variable which will be true when the auto clutch system is activated.in vamosworld.h :<pre>private bool auto_clutch;</pre>we deactivate it by default : (in vamosworld.cc at the begining of the constructor)<pre>auto_clutch = false;</pre>ok now the main part of this function, we got to reengage the clutch after having changing the gear. Go in vamosworld.cc in DoOp and change the code like this :<pre> ... else if (dofunction == "disengage_shift_up") { world-&gt;focused_car ()-&gt;car-&gt;disengage_clutch (0.2); world-&gt;focused_car ()-&gt;car-&gt;shift_up (); if (auto_clutch) { DoOp("engage", 0, 0, false, 0, 0); } } else if (dofunction == "disengage_shift_down") { world-&gt;focused_car ()-&gt;car-&gt;disengage_clutch (0.2); world-&gt;focused_car ()-&gt;car-&gt;shift_down (); if (auto_clutch) { DoOp("engage", 0, 0, false, 0, 0); } } ...</pre>ok now it can be usefull to be able to activate it thru the Option menu. First we will create the function called by the menu item like this (in vamosworld.cc : end of file)<pre>void VAMOSWORLD::ToggleAutoClutch(){ auto_clutch = !auto_clutch;}</pre>we got to declare the function, so in vamosworld.h :<pre>public ToggleAutoClutch();</pre>Now we got to link the menu item and the function, it can be done like this (in menu.cc : Go) :<pre> ... else if (curmenu == "HUDToggle") { //ToggleFPSDisplay(); world.ToggleHUD(); Go("Options"); } else if (curmenu == "ClutchToggle") { world.ToggleAutoClutch(); Go("Options"); } else { ...</pre>and we can now create the menu item, to do it, simply go to runtime/list/menu and in the Option file, add (before the "back to main menu" button) :<pre>Toggle Auto-clutchClutchToglle !</pre>ehe there we are ! there's a last problem, the player has to know when the auto clutch is activated, let's go in vamosworld.cc : DrawHud and we add this at the end of th function :<pre>if (world-&gt;auto_clutch) { cy += 0.01; sprintf(tempchar, "auto clutch engaged"); font.Print(cx, cy, tempchar, 1, 5, 1, 0, 0, 0); cy += 0.02;}</pre>now, rebuild with make, copy src/vdrift in runtime/ and enjoy it poor keyboard player SmileI don't know if this little add respect the game spirit but it really really helps the keyboard players so why not this in the next release ?
Yeah, I'll put it (or something very similar) into the next release. Keyboard improvements are top priority.I'm also planning to add speed-sensitive turning as well as intelligent acceleration and braking that attempts to avoid excessive wheelspin or locking the brakes.
Okay, keyboard controls can now be set up to trigger when the key goes down or up. For the next VDrift release, disengage shift up is PAGEDOWN and disengage shift down is DELETE, like it is now. The difference is that PAGEDOWN and DELETE are also bound to engage (on key up). So when you want to shift up, you press PAGEDOWN which shifts the gear up and disengages the clutch, then when you release the PAGEDOWN key the clutch re-engages.
joevenzon Wrote:So when you want to shift up, you press PAGEDOWN which shifts the gear up and disengages the clutch, then when you release the PAGEDOWN key the clutch re-engages.
So is clutch engage assigned as 2 key up entries in the control options, or is it hard-coded to re-engage on the up event of the shifter keys? Sorry if my workding is confusing...
assigned as 2 key entries
great solution, nice work