Changed the Mouse Error to use DoPopupWindow()

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2566 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2006-11-30 08:29:05 +00:00
parent 358053d189
commit f85afdb480
4 changed files with 11 additions and 108 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
Changes towards version 0.6:
- Generic DoPopupWindow() command for status messages of all sorts
- Shifted the Mouse Error to a Popup Window, moved the message to
starcon.txt for translators - Michael
- Generic DoPopupWindow() command for status messages - Michael
- Update the 'current selection' icon after deleting or inserting ships
in a fleet in SuperMelee - SvdB
- Correct some background pixels in melebkgd.{25,26}.png - SvdB
+5
View File
@@ -2245,6 +2245,11 @@ dispatch
#(exit menu)
exit menu
#(mouse_err)
Mouse input is not supported in UQM.
Use the keyboard or joystick instead.
Please press ENTER or SPACE to return.
#(Unconnected. Press LEFT to connect.)
Unconnected. Press LEFT to connect.
+1 -1
View File
@@ -45,7 +45,7 @@
#define STATUS_STRING_COUNT 6
#define FLAGSHIP_STRING_COUNT 13
#define ORBITSCAN_STRING_COUNT 19
#define MAINMENU_STRING_COUNT 56
#define MAINMENU_STRING_COUNT 57
#define NETMELEE_STRING_COUNT 18
enum {
+2 -106
View File
@@ -15,114 +15,10 @@
*/
#include "controls.h"
#include "options.h"
#include "setup.h"
#include "sounds.h"
#include "libs/gfxlib.h"
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/widgets.h"
#include "libs/graphics/tfb_draw.h"
#include "util.h"
typedef struct mouse_error_state {
BOOLEAN (*InputFunc) (struct mouse_error_state *pInputState);
COUNT MenuRepeatDelay;
BOOLEAN initialized;
int anim_frame_count;
DWORD NextTime;
} MOUSE_ERROR_STATE;
typedef MOUSE_ERROR_STATE *PMOUSE_ERROR_STATE;
#define NUM_STEPS 20
#define X_STEP (SCREEN_WIDTH / NUM_STEPS)
#define Y_STEP (SCREEN_HEIGHT / NUM_STEPS)
#define MENU_FRAME_RATE (ONE_SECOND / 60)
static BOOLEAN
DoMouseError (PMOUSE_ERROR_STATE pInputState)
{
if (!pInputState->initialized)
{
SetDefaultMenuRepeatDelay ();
pInputState->anim_frame_count = NUM_STEPS;
pInputState->initialized = TRUE;
pInputState->NextTime = GetTimeCounter ();
}
BatchGraphics ();
if (pInputState->anim_frame_count)
{
RECT r;
COLOR bg, dark, medium;
int frame = --pInputState->anim_frame_count;
r.corner.x = ((frame * X_STEP) >> 1) + 2;
r.corner.y = ((frame * Y_STEP) >> 1) + 2;
r.extent.width = X_STEP * (NUM_STEPS - frame) - 4;
r.extent.height = Y_STEP * (NUM_STEPS - frame) - 4;
dark = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x08), 0x00);
medium = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x00);
bg = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x1A), 0x00);
DrawShadowedBox(&r, bg, dark, medium);
}
else
{
RECT r;
COLOR bg, dark, medium, text, oldtext;
FONT oldfont = SetContextFont (StarConFont);
FRAME oldFontEffect = SetContextFontEffect (NULL);
TEXT t;
r.corner.x = 2;
r.corner.y = 2;
r.extent.width = SCREEN_WIDTH - 4;
r.extent.height = SCREEN_HEIGHT - 4;
dark = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x08), 0x00);
medium = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x00);
bg = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x1A), 0x00);
text = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x00), 0x0E);
DrawShadowedBox(&r, bg, dark, medium);
oldtext = SetContextForeGroundColor (text);
t.baseline.x = r.extent.width >> 1;
t.baseline.y = r.extent.height >> 1;
t.align = ALIGN_CENTER;
t.pStr = "Mouse input is not supported at this time.";
t.CharCount = ~0;
font_DrawText (&t);
t.pStr = "Use the keyboard or joystick to navigate the menus.";
t.baseline.y += 8;
font_DrawText (&t);
t.pStr = "Please press Select or Cancel to return.";
t.baseline.y += 16;
font_DrawText (&t);
SetContextFontEffect (oldFontEffect);
SetContextFont (oldfont);
SetContextForeGroundColor (oldtext);
}
UnbatchGraphics ();
SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE);
pInputState->NextTime = GetTimeCounter ();
return !(PulsedInputState.menu[KEY_MENU_CANCEL] ||
PulsedInputState.menu[KEY_MENU_SELECT]);
}
#include "gamestr.h"
void
MouseError (void)
{
MOUSE_ERROR_STATE s;
s.InputFunc = DoMouseError;
s.initialized = FALSE;
SetMenuSounds (0, 0);
DoInput ((PVOID)&s, TRUE);
DoPopupWindow (GAME_STRING (MAINMENU_STRING_BASE + 56));
}