UQM: activate emergency escape unit with Back key (it's necessary for gameplay), Menu key now can be used for something else

This commit is contained in:
pelya
2010-10-29 18:27:31 +03:00
parent 0cf99ca3ba
commit fb93bd9468
5 changed files with 50 additions and 17 deletions

View File

@@ -15,12 +15,12 @@ AppUsesJoystick=y
AppHandlesJoystickSensitivity=n AppHandlesJoystickSensitivity=n
AppUsesMultitouch=n AppUsesMultitouch=n
NonBlockingSwapBuffers=n NonBlockingSwapBuffers=n
RedefinedKeys="RETURN RSHIFT KP_PLUS KP_MINUS ESCAPE F10" RedefinedKeys="RETURN RSHIFT KP_PLUS KP_MINUS RCTRL F10"
AppTouchscreenKeyboardKeysAmount=2 AppTouchscreenKeyboardKeysAmount=2
AppTouchscreenKeyboardKeysAmountAutoFire=0 AppTouchscreenKeyboardKeysAmountAutoFire=0
MultiABI=n MultiABI=n
AppVersionCode=06914 AppVersionCode=06915
AppVersionName="0.6.9.14 - better controls for accelerometer and on-screen keyboard input" AppVersionName="0.6.9.15 - Emergency warp escape unit can now be activated by pressing Back key, so Menu key can be re-bound to game action"
CompiledLibraries="sdl_image tremor ogg" CompiledLibraries="sdl_image tremor ogg"
CustomBuildScript=n CustomBuildScript=n
AppCflags='-O2 -finline-functions -DTHREADLIB_SDL=1 -DTIMELIB=SDL -DOVCODEC_TREMOR=1 -DNETPLAY=1 -DHAVE_REGEX=1 -DHAVE_GETOPT_LONG=1 -DHAVE_ZIP=1 -DHAVE_JOYSTICK=1 -DDIRECTIONAL_JOYSTICK_MELEE=1' AppCflags='-O2 -finline-functions -DTHREADLIB_SDL=1 -DTIMELIB=SDL -DOVCODEC_TREMOR=1 -DNETPLAY=1 -DHAVE_REGEX=1 -DHAVE_GETOPT_LONG=1 -DHAVE_ZIP=1 -DHAVE_JOYSTICK=1 -DDIRECTIONAL_JOYSTICK_MELEE=1'

View File

@@ -214,8 +214,11 @@ ProcessInput (void)
StarShipPtr->ship_input_state |= SPECIAL; StarShipPtr->ship_input_state |= SPECIAL;
if (CanRunAway && cur_player == 0 && if (CanRunAway && cur_player == 0 &&
(InputState & BATTLE_ESCAPE)) ((InputState & BATTLE_ESCAPE) || EmergencyEscapeWarpUnitActivatedFromMenu))
{
EmergencyEscapeWarpUnitActivatedFromMenu = FALSE;
DoRunAway (StarShipPtr); DoRunAway (StarShipPtr);
}
} }
} }

View File

@@ -36,22 +36,29 @@
#define CONFIRM_WIN_HEIGHT 22 #define CONFIRM_WIN_HEIGHT 22
static void static void
DrawConfirmationWindow (BOOLEAN answer) DrawConfirmationWindow (int answer)
{ {
Color oldfg = SetContextForeGroundColor (MENU_TEXT_COLOR); Color oldfg = SetContextForeGroundColor (MENU_TEXT_COLOR);
FONT oldfont = SetContextFont (StarConFont); FONT oldfont = SetContextFont (StarConFont);
FRAME oldFontEffect = SetContextFontEffect (NULL); FRAME oldFontEffect = SetContextFontEffect (NULL);
RECT r; RECT r;
TEXT t; TEXT t;
int textOffset;
BatchGraphics (); BatchGraphics ();
r.corner.x = (SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1; r.corner.x = (SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1;
r.corner.y = (SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1; r.corner.y = (SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1;
r.extent.width = CONFIRM_WIN_WIDTH; r.extent.width = CONFIRM_WIN_WIDTH;
r.extent.height = CONFIRM_WIN_HEIGHT; r.extent.height = CONFIRM_WIN_HEIGHT;
textOffset = r.extent.width >> 1;
if (GLOBAL (CurrentActivity) & IN_BATTLE)
{
r.corner.x -= CONFIRM_WIN_WIDTH;
r.extent.width += CONFIRM_WIN_WIDTH * 2;
textOffset = r.extent.width / 3;
}
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR, DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR); SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
t.baseline.x = r.corner.x + (r.extent.width >> 1); t.baseline.x = r.corner.x + (r.extent.width >> 1);
t.baseline.y = r.corner.y + 8; t.baseline.y = r.corner.y + 8;
t.pStr = GAME_STRING (QUITMENU_STRING_BASE); // "Really Quit?" t.pStr = GAME_STRING (QUITMENU_STRING_BASE); // "Really Quit?"
@@ -59,14 +66,21 @@ DrawConfirmationWindow (BOOLEAN answer)
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += 10; t.baseline.y += 10;
t.baseline.x = r.corner.x + (r.extent.width >> 2); t.baseline.x = r.corner.x + (textOffset >> 1);
t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 1); // "Yes" t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 1); // "Yes"
SetContextForeGroundColor (answer ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR); SetContextForeGroundColor (answer == 1 ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR);
font_DrawText (&t); font_DrawText (&t);
t.baseline.x += (r.extent.width >> 1); t.baseline.x += textOffset;
t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No" t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No"
SetContextForeGroundColor (answer ? MENU_TEXT_COLOR : MENU_HIGHLIGHT_COLOR); SetContextForeGroundColor (answer == 0 ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR);
font_DrawText (&t); font_DrawText (&t);
if (GLOBAL (CurrentActivity) & IN_BATTLE)
{
t.baseline.x += textOffset;
t.pStr = "Escape unit"; // GAME_STRING (QUITMENU_STRING_BASE + 3); // TODO: modify gamestrings.txt
SetContextForeGroundColor (answer == 2 ? MENU_HIGHLIGHT_COLOR : MENU_TEXT_COLOR);
font_DrawText (&t);
}
UnbatchGraphics (); UnbatchGraphics ();
@@ -75,6 +89,8 @@ DrawConfirmationWindow (BOOLEAN answer)
SetContextForeGroundColor (oldfg); SetContextForeGroundColor (oldfg);
} }
BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu = FALSE;
BOOLEAN BOOLEAN
DoConfirmExit (void) DoConfirmExit (void)
{ {
@@ -90,7 +106,11 @@ DoConfirmExit (void)
RECT ctxRect; RECT ctxRect;
CONTEXT oldContext; CONTEXT oldContext;
RECT oldRect; RECT oldRect;
BOOLEAN response = FALSE, done; int response = 0;
BOOLEAN done;
int responseMax = 1;
if (GLOBAL (CurrentActivity) & IN_BATTLE)
responseMax = 2;
oldContext = SetContext (ScreenContext); oldContext = SetContext (ScreenContext);
GetContextClipRect (&oldRect); GetContextClipRect (&oldRect);
@@ -118,7 +138,7 @@ DoConfirmExit (void)
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{ // something else triggered an exit { // something else triggered an exit
done = TRUE; done = TRUE;
response = TRUE; response = 1;
} }
else if (PulsedInputState.menu[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
@@ -128,11 +148,16 @@ DoConfirmExit (void)
else if (PulsedInputState.menu[KEY_MENU_CANCEL]) else if (PulsedInputState.menu[KEY_MENU_CANCEL])
{ {
done = TRUE; done = TRUE;
response = FALSE; response = 0;
} }
else if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT]) else if (PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT])
{ {
response = !response;
response += PulsedInputState.menu[KEY_MENU_LEFT] ? 1 : -1;
if(response < 0)
response = responseMax;
if( response > responseMax )
response = 0;
DrawConfirmationWindow (response); DrawConfirmationWindow (response);
PlayMenuSound (MENU_SOUND_MOVE); PlayMenuSound (MENU_SOUND_MOVE);
} }
@@ -143,15 +168,19 @@ DoConfirmExit (void)
DrawStamp (&s); DrawStamp (&s);
DestroyDrawable (ReleaseDrawable (s.frame)); DestroyDrawable (ReleaseDrawable (s.frame));
ClearSystemRect (); ClearSystemRect ();
if (response || (GLOBAL (CurrentActivity) & CHECK_ABORT)) if (response == 1 || (GLOBAL (CurrentActivity) & CHECK_ABORT))
{ {
result = TRUE; result = TRUE;
GLOBAL (CurrentActivity) |= CHECK_ABORT; GLOBAL (CurrentActivity) |= CHECK_ABORT;
} }
else else
{ {
result = FALSE; result = FALSE;
} }
if( response == 2 )
{
EmergencyEscapeWarpUnitActivatedFromMenu = TRUE;
}
ExitRequested = FALSE; ExitRequested = FALSE;
GamePaused = FALSE; GamePaused = FALSE;
FlushInput (); FlushInput ();

View File

@@ -93,6 +93,7 @@ extern CONTROLLER_INPUT_STATE CurrentInputState;
extern CONTROLLER_INPUT_STATE PulsedInputState; extern CONTROLLER_INPUT_STATE PulsedInputState;
extern volatile CONTROLLER_INPUT_STATE ImmediateInputState; extern volatile CONTROLLER_INPUT_STATE ImmediateInputState;
extern CONTROL_TEMPLATE PlayerControls[]; extern CONTROL_TEMPLATE PlayerControls[];
extern BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu;
void UpdateInputState (void); void UpdateInputState (void);
extern void FlushInput (void); extern void FlushInput (void);

View File

@@ -1 +1 @@
pachi sc2