diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 83183c5bf..177438bad 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -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 diff --git a/sc2/src/sc2code/Makeinfo b/sc2/src/sc2code/Makeinfo index f4418a12c..497ee2f6a 100644 --- a/sc2/src/sc2code/Makeinfo +++ b/sc2/src/sc2code/Makeinfo @@ -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" diff --git a/sc2/src/sc2code/libs/inplib.h b/sc2/src/sc2code/libs/inplib.h index 70c660f89..813de3edb 100644 --- a/sc2/src/sc2code/libs/inplib.h +++ b/sc2/src/sc2code/libs/inplib.h @@ -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); diff --git a/sc2/src/sc2code/libs/input/sdl/input.c b/sc2/src/sc2code/libs/input/sdl/input.c index 434e1550b..5f74e6bb9 100644 --- a/sc2/src/sc2code/libs/input/sdl/input.c +++ b/sc2/src/sc2code/libs/input/sdl/input.c @@ -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) { diff --git a/sc2/src/sc2code/restart.c b/sc2/src/sc2code/restart.c index 1c1e02aa5..48a8f7cd1 100644 --- a/sc2/src/sc2code/restart.c +++ b/sc2/src/sc2code/restart.c @@ -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;