A noob programming question
by Ronald J Nelson · in Torque Game Engine · 12/16/2005 (2:15 pm) · 10 replies
OK I know that I should know this, but I have forgotten since my college classes. I want to check to see if the public: variables mBackwardAction and mForwardAction in moveManager.h for class MoveManager have a value in wheeledVehicle.cc. The following is where I want it to check for a value. It would also help if some one could tell me if these values are positive or negative when going forward or reverse.
if( EngineRPM > mEngine->shiftUpRPM && MoveManager.mForwardAction() ) {
// Up Shift.
nGear++;
}
if( EngineRPM < mEngine->shiftDownRPM && MoveManager.mBackwardAction() ) {
nGear = -1;
}
Thank you in advance.
if( EngineRPM > mEngine->shiftUpRPM && MoveManager.mForwardAction() ) {
// Up Shift.
nGear++;
}
if( EngineRPM < mEngine->shiftDownRPM && MoveManager.mBackwardAction() ) {
nGear = -1;
}
Thank you in advance.
#2
In default.bind.cs we have this:
Then that is directly related to this in gameConnectionMoves.cc as far as I can tell:
now the last thing I can trace it to is this in moveManager.h:
So with all of that being said, I am trying to set up a condition that recognizes whether or not forward aaction or reverse action are being used.
Thank you again for any help you can give.
@Badguy- thanks for the effort, but been there and quite frankly the problem here is that I probably just need to break out my old C++ books and start reading again. I'm just hoping someone would cut me a break here.
12/16/2005 (11:22 pm)
Well here is a bit more to explain further.In default.bind.cs we have this:
function accelerate(%val)
{
$mvForwardAction = %val * $movementSpeed;
}
function brake(%val)
{
$mvBackwardAction = %val * $movementSpeed;
}Then that is directly related to this in gameConnectionMoves.cc as far as I can tell:
void MoveManager::init()
{
Con::addVariable("mvForwardAction", TypeF32, &mForwardAction);
Con::addVariable("mvBackwardAction", TypeF32, &mBackwardAction);now the last thing I can trace it to is this in moveManager.h:
class MoveManager
{
public:
static F32 mForwardAction;
static F32 mBackwardAction;So with all of that being said, I am trying to set up a condition that recognizes whether or not forward aaction or reverse action are being used.
Thank you again for any help you can give.
@Badguy- thanks for the effort, but been there and quite frankly the problem here is that I probably just need to break out my old C++ books and start reading again. I'm just hoping someone would cut me a break here.
#3
Now if someone could tell me how I could use this in my code?
12/16/2005 (11:43 pm)
Additionally I have figured out that the values provided by the functions in the default.bid.cs are boolean. It equals 1 whe going forward and switches back to 0 when you release the button.Now if someone could tell me how I could use this in my code?
#4
12/16/2005 (11:55 pm)
Good lord - why not just check what values you're getting in your move structure in processTick?
#5
12/16/2005 (11:57 pm)
Thank you very much Ben that Is probably the most helpful suggestion I have had.
#6
12/17/2005 (12:02 am)
Aw cripes I really suck at this. I just made my game crash with my attempt. Ben you wouldn't have any suggestions there would you?
#7
12/17/2005 (1:38 am)
ProcessTick gets passed a Move*. Check if it's null, if it isn't, then read values out of it. If it's the current control object you should be getting moves in your processTick calls, with the values from that client's MoveManager.
#8
move->trigger[0]
and
move->trigger[1]
?
12/17/2005 (5:23 am)
OK well I think I have a solution but I need to know what is the difference betweenmove->trigger[0]
and
move->trigger[1]
?
#9
12/17/2005 (7:46 am)
I guess I need to be more specific. In terms of player or vehicle movement what do these 2 triggers do? I know move->trigger[2] is the handbrake.
#10
12/17/2005 (11:51 am)
They correspond to the triggers on the MoveManager. So the question is, what do you have bound to those inputs? :)
Torque Owner Badguy
But I didnt bring any fish, so instead I'll give you a rod and some bait! :)
Visual Studio I presume?
use the debugger to check so press F9 to place a break point (dont forget to select the line of code first)
and F5 to begin debugging, it will stop at the break point once execution gets there.
now you can press the key of choice and watch the value
(to watch the value either mouse over it or drag the variable into the watch window)
then press F5 to bring the debugger around for another pass to read your pressed key.
(I dont happen to know the answer I would assume that it would be 0 if no move and 1 for move.)
and I didnt really understand this question:
...variables mBackwardAction and mForwardAction in moveManager.h for class MoveManager have a value in wheeledVehicle.cc