Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
another improvement for poor keyboard players
07-15-2005, 11:19 AM,
#1
another improvement for poor keyboard players
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 ?
Reply


Messages In This Thread
another improvement for poor keyboard players - by [The_Real_Neo] - 07-15-2005, 11:19 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)