slaver0110
Member
- Joined
- Mar 21, 2011
- Messages
- 72
- Reaction score
- 2
- Points
- 6
I'm coding a vessel which has a separate set of special RCS thrusters in the aft of the ship, which are triggered individually fromthe RCS thrusters in the front.
The aft-thrusters are only activated when the 'L' key is pressed, which toggles the enable/disable of the rear thrusters.
Problem is, when I set up a 'clbkConsumeBufferedKey' definition for more than one of the rear thrusters, both of the aft thrusters end up firing ('up' and 'down'). If I only define one, it works as it should.
Thruster definitions:
Keyboard implementation:
This seems to be one of those times that the problem is right in front of me, but I just can't see it...:embarrassed:
I've just started coding DLL's less than a week ago, so please bear with me if I'm throwing dumb questions at the forum for the next little while.
Cheers, and happy Labour Day Weekend!!
The aft-thrusters are only activated when the 'L' key is pressed, which toggles the enable/disable of the rear thrusters.
Problem is, when I set up a 'clbkConsumeBufferedKey' definition for more than one of the rear thrusters, both of the aft thrusters end up firing ('up' and 'down'). If I only define one, it works as it should.
Thruster definitions:
Code:
th_pod_up = CreateThruster(_V(0.0, 0.0, -7.5), _V(0, -1, 0), T1_PODRCSTH, hpr, T1_ISP); AddExhaust(th_pod_up, 4.0, 0.2, exhaust);
th_pod_down = CreateThruster(_V(0.0, 0.0, -7.5), _V(0, 1, 0), T1_PODRCSTH, hpr, T1_ISP); AddExhaust(th_pod_down, 4.0, 0.2, exhaust);
th_pod_left = CreateThruster(_V(0.0, 0.0, -7.5), _V(1,0,0), T1_PODRCSTH, hpr, T1_ISP); AddExhaust(th_pod_left, 4.0, 0.2, exhaust);
th_pod_right = CreateThruster(_V(0.0, 0.0, -7.5), _V(-1,0,0), T1_PODRCSTH, hpr, T1_ISP); AddExhaust(th_pod_right, 4.0, 0.2, exhaust);
Keyboard implementation:
Code:
int Tug1::clbkConsumeBufferedKey(DWORD key, bool down, char *kstate)
{
if (!down) // only process keydown events
{
SetThrusterLevel(th_pod_down, 0);
SetThrusterLevel(th_pod_up, 0);
SetThrusterLevel(th_pod_left, 0);
SetThrusterLevel(th_pod_right, 0);
return 0;
}
if (KEYMOD_SHIFT(kstate)) {}
else
{
switch (key)
{
case OAPI_KEY_L: // toggle Pod activation status (on / off)
if (PodFlag == 0) {PodFlag = 1;}
else if (PodFlag == 1) {PodFlag = 0;}
return 1;
case OAPI_KEY_NUMPAD8:
if (PodFlag == 1) {SetThrusterLevel(th_pod_down, 1);}
case OAPI_KEY_NUMPAD2:
if (PodFlag == 1) { SetThrusterLevel(th_pod_up, 1);}
}
}
return 0;
}
I've just started coding DLL's less than a week ago, so please bear with me if I'm throwing dumb questions at the forum for the next little while.
Cheers, and happy Labour Day Weekend!!