mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-17 08:50:29 +02:00
Added left held mouse support.
This commit is contained in:
@@ -712,7 +712,9 @@ void __cdecl SetPalette(unsigned char *palette, long, unsigned long)
|
|||||||
|
|
||||||
|
|
||||||
void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
|
void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
|
||||||
|
static int numFramesLMouse = 0;
|
||||||
extern int mousex, mousey;
|
extern int mousex, mousey;
|
||||||
|
bool leftMouseProcessed = false;
|
||||||
SDL_GetMouseState(&mousex, &mousey);
|
SDL_GetMouseState(&mousex, &mousey);
|
||||||
|
|
||||||
Keyboard->MouseQX = mousex;
|
Keyboard->MouseQX = mousex;
|
||||||
@@ -728,9 +730,12 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
|
|||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||||
flags = GadgetClass::LEFTPRESS;
|
flags = GadgetClass::LEFTPRESS;
|
||||||
|
leftMouseProcessed = true;
|
||||||
|
numFramesLMouse++;
|
||||||
key = KN_LMOUSE;
|
key = KN_LMOUSE;
|
||||||
}
|
}
|
||||||
else if (event.button.button == SDL_BUTTON_RIGHT) {
|
else if (event.button.button == SDL_BUTTON_RIGHT) {
|
||||||
|
numFramesLMouse = 0;
|
||||||
flags = GadgetClass::RIGHTPRESS;
|
flags = GadgetClass::RIGHTPRESS;
|
||||||
key = KN_RMOUSE;
|
key = KN_RMOUSE;
|
||||||
}
|
}
|
||||||
@@ -739,9 +744,11 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
|
|||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||||
flags = GadgetClass::LEFTRELEASE;
|
flags = GadgetClass::LEFTRELEASE;
|
||||||
|
numFramesLMouse = 0;
|
||||||
}
|
}
|
||||||
else if (event.button.button == SDL_BUTTON_RIGHT) {
|
else if (event.button.button == SDL_BUTTON_RIGHT) {
|
||||||
flags = GadgetClass::RIGHTRELEASE;
|
flags = GadgetClass::RIGHTRELEASE;
|
||||||
|
numFramesLMouse = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
@@ -750,6 +757,9 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!leftMouseProcessed && numFramesLMouse != 0)
|
||||||
|
flags = GadgetClass::LEFTHELD;
|
||||||
|
|
||||||
Device_Present();
|
Device_Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user