mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
WWKeyboardClass::Down now goes through the SDL system for mouse up and down, needs work for other keys.
This commit is contained in:
@@ -499,10 +499,9 @@ KeyNumType GadgetClass::Input(void)
|
||||
** know the position of the mouse at the exact instant when the click occurred
|
||||
** rather the the mouse position at the time we get around to this function.
|
||||
*/
|
||||
// jmarshall
|
||||
// jmarshall
|
||||
UserInput.Process_Input( g_globalKeyNumType, g_globalKeyFlags);
|
||||
int flags = g_globalKeyFlags;
|
||||
UserInput.Process_Input( g_globalKeyNumType, flags );
|
||||
|
||||
// jmarshall end
|
||||
|
||||
/*
|
||||
|
||||
@@ -65,7 +65,7 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
|
||||
|
||||
Keyboard->Put_Element(KN_RMOUSE);
|
||||
|
||||
key = KN_RMOUSE;
|
||||
key = KN_RMOUSE;
|
||||
flags |= GadgetClass::RIGHTPRESS;
|
||||
|
||||
numFramesLMouse = 0;
|
||||
@@ -75,13 +75,14 @@ void UserInputClass::Process_Input(KeyNumType& key, int& flags)
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||
Mouse.Button_Left == MouseButtonState::MOUSE_BUTTON_RELEASE;
|
||||
|
||||
flags &= GadgetClass::LEFTPRESS;
|
||||
flags |= GadgetClass::LEFTRELEASE;
|
||||
numFramesLMouse = 0;
|
||||
}
|
||||
else if (event.button.button == SDL_BUTTON_RIGHT) {
|
||||
Mouse.Button_Right == MouseButtonState::MOUSE_BUTTON_RELEASE;
|
||||
|
||||
flags &= GadgetClass::RIGHTPRESS;
|
||||
flags |= GadgetClass::RIGHTRELEASE;
|
||||
numFramesLMouse = 0;
|
||||
}
|
||||
|
||||
@@ -364,6 +364,14 @@ char WWKeyboardClass::To_ASCII(unsigned short key)
|
||||
*=============================================================================================*/
|
||||
bool WWKeyboardClass::Down(unsigned short key)
|
||||
{
|
||||
if (key == KN_LMOUSE) {
|
||||
return g_globalKeyFlags & GadgetClass::LEFTPRESS;
|
||||
}
|
||||
|
||||
if (key == KN_RMOUSE) {
|
||||
return g_globalKeyFlags & GadgetClass::RIGHTPRESS;
|
||||
}
|
||||
|
||||
return(GetAsyncKeyState(key & 0xFF) == 0 ? false : true);
|
||||
}
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ void MapEditClass::AI(KeyNumType & input, int x, int y)
|
||||
** Check for mouse motion while left button is down.
|
||||
*/
|
||||
rc = Mouse_Moved();
|
||||
if (LMouseDown && rc) {
|
||||
if (Keyboard->Down(KN_LMOUSE) && rc) {
|
||||
|
||||
/*
|
||||
** "Paint" mode: place current object, and restart placement
|
||||
|
||||
Reference in New Issue
Block a user