Pop up "no mouse support" screen if main menu is clicked, from Nick and McM

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1724 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2005-05-10 07:21:42 +00:00
parent 5de0832110
commit 6cf6dd3b8a
5 changed files with 53 additions and 11 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.4:
- Attempting to click the screen pops up an error message, from
Nic, heavily modified (dodge on #533) -Michael
- Fixed potential crash with a truecolor oscilloscope image (thanks
jdorje) and made it generally more flexible (bug #729) -Alex
- Added missing Tanaka battle portrait images (new artwork; oldcap) and
+9 -8
View File
@@ -1,13 +1,14 @@
uqm_SUBDIRS="comm libs planets ships"
uqm_CFILES="battle.c border.c build.c cleanup.c clock.c collide.c comm.c
commglue.c confirm.c credits.c cyborg.c demo.c displist.c dummy.c
encount.c fmv.c galaxy.c gameev.c gameinp.c gameopt.c gendef.c
getchar.c globdata.c gravity.c gravwell.c grpinfo.c hyper.c init.c
intel.c intro.c ipdisp.c load.c loadship.c master.c melee.c menu.c
misc.c oscill.c outfit.c pickmele.c pickship.c plandata.c process.c
restart.c save.c settings.c setup.c setupmenu.c ship.c shipstat.c
shipyard.c sis.c sounds.c starbase.c starcon.c starmap.c state.c
status.c tactrans.c trans.c uqmdebug.c util.c velocity.c weapon.c"
commglue.c confirm.c credits.c cyborg.c demo.c displist.c
dummy.c encount.c fmv.c galaxy.c gameev.c gameinp.c gameopt.c
gendef.c getchar.c globdata.c gravity.c gravwell.c grpinfo.c
hyper.c init.c intel.c intro.c ipdisp.c load.c loadship.c
master.c melee.c menu.c misc.c mouse_err.c oscill.c outfit.c
pickmele.c pickship.c plandata.c process.c restart.c save.c
settings.c setup.c setupmenu.c ship.c shipstat.c shipyard.c
sis.c sounds.c starbase.c starcon.c starmap.c state.c status.c
tactrans.c trans.c uqmdebug.c util.c velocity.c weapon.c"
if [ "$DEBUG" = 1 ]; then
uqm_CFILES="$uqm_CFILES uqmdebug.c"
+2
View File
@@ -73,6 +73,8 @@ extern void MoveMouse (SWORD x, SWORD y);
extern BYTE LocateMouse (PSWORD px, PSWORD py);
*/
extern volatile int MouseButtonDown;
/* Functions for dealing with Character Mode */
void EnableCharacterMode (void);
+20
View File
@@ -237,6 +237,7 @@ ProcessInputEvent(const SDL_Event *Event)
{
if (!InputInitialized)
return;
ProcessMouseEvent (Event);
if (!_in_character_mode)
{
VControl_HandleEvent (Event);
@@ -263,6 +264,25 @@ ProcessInputEvent(const SDL_Event *Event)
}
}
volatile int MouseButtonDown = 0;
void
ProcessMouseEvent (SDL_Event *e)
{
switch (e->type)
{
case SDL_MOUSEBUTTONDOWN:
MouseButtonDown = 1;
break;
case SDL_MOUSEBUTTONUP:
MouseButtonDown = 0;
break;
default:
break;
}
}
void
TFB_ResetControls (void)
{
+20 -3
View File
@@ -36,7 +36,6 @@
#include "libs/graphics/gfx_common.h"
#include "libs/inplib.h"
//Added by Chris
void FreeHyperData (void);
@@ -121,6 +120,7 @@ DWORD InTime;
static BOOLEAN
DoRestart (PMENU_STATE pMS)
{
extern void MouseError (void);
static DWORD InactTimeOut;
/* Cancel any presses of the Pause key. */
@@ -161,7 +161,7 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
}
else if (!(PulsedInputState.key[KEY_MENU_UP] || PulsedInputState.key[KEY_MENU_DOWN] ||
PulsedInputState.key[KEY_MENU_LEFT] || PulsedInputState.key[KEY_MENU_RIGHT] ||
PulsedInputState.key[KEY_MENU_SELECT]))
PulsedInputState.key[KEY_MENU_SELECT] || MouseButtonDown))
{
if (GetTimeCounter () - InTime < InactTimeOut)
@@ -245,6 +245,23 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
}
}
if (MouseButtonDown)
{
LockMutex (GraphicsLock);
SetFlashRect (NULL_PTR, (FRAME)0);
UnlockMutex (GraphicsLock);
MouseError ();
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
InTime = GetTimeCounter ();
SetTransitionSource (NULL);
BatchGraphics ();
DrawRestartMenuGraphic (pMS);
DrawRestartMenu ((BYTE)~0, pMS->CurState, pMS->CurFrame);
ScreenTransition (3, NULL);
UnbatchGraphics ();
return TRUE;
}
InTime = GetTimeCounter ();
return (TRUE);
}
@@ -346,7 +363,7 @@ LastActivity = WON_LAST_BATTLE;
SetFlashRect ((PRECT)0, (FRAME)0);
UnlockMutex (GraphicsLock);
DestroyDrawable (ReleaseDrawable (MenuState.CurFrame));
if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
goto TimedOut;