mirror of https://github.com/OpenTTD/OpenTTD
(svn r7156) -Codechange: Remove obsolete variable, localize global variable, use GB and change logic
of the win32: TAB speeds up, but ALT+TAB doesn't code.release/0.5
parent
d33605ff21
commit
b713974cd8
|
@ -423,7 +423,6 @@ static void SdlVideoMainLoop(void)
|
||||||
uint32 next_tick = SDL_CALL SDL_GetTicks() + 30;
|
uint32 next_tick = SDL_CALL SDL_GetTicks() + 30;
|
||||||
uint32 cur_ticks;
|
uint32 cur_ticks;
|
||||||
uint32 pal_tick = 0;
|
uint32 pal_tick = 0;
|
||||||
int i;
|
|
||||||
uint32 mod;
|
uint32 mod;
|
||||||
int numkeys;
|
int numkeys;
|
||||||
Uint8 *keys;
|
Uint8 *keys;
|
||||||
|
@ -431,7 +430,7 @@ static void SdlVideoMainLoop(void)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
InteractiveRandom(); // randomness
|
InteractiveRandom(); // randomness
|
||||||
|
|
||||||
while ((i = PollEvent()) == -1) {}
|
while (PollEvent() == -1) {}
|
||||||
if (_exit_game) return;
|
if (_exit_game) return;
|
||||||
|
|
||||||
mod = SDL_CALL SDL_GetModState();
|
mod = SDL_CALL SDL_GetModState();
|
||||||
|
|
|
@ -358,7 +358,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
scancode = GB(lParam, 16, 8);
|
scancode = GB(lParam, 16, 8);
|
||||||
if (scancode == 41) pressed_key = w | WKC_BACKQUOTE << 16;
|
if (scancode == 41) pressed_key = w | WKC_BACKQUOTE << 16;
|
||||||
|
|
||||||
if ((pressed_key >> 16) == ('D' | WKC_CTRL) && !_wnd.fullscreen) {
|
if (GB(pressed_key, 16, 16) == ('D' | WKC_CTRL) && !_wnd.fullscreen) {
|
||||||
_double_size ^= 1;
|
_double_size ^= 1;
|
||||||
_wnd.double_size = _double_size;
|
_wnd.double_size = _double_size;
|
||||||
ClientSizeChanged(_wnd.width, _wnd.height);
|
ClientSizeChanged(_wnd.width, _wnd.height);
|
||||||
|
@ -785,16 +785,13 @@ static void Win32GdiMainLoop(void)
|
||||||
if (_exit_game) return;
|
if (_exit_game) return;
|
||||||
|
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
if (_wnd.has_focus && GetAsyncKeyState(VK_SHIFT) < 0) {
|
if (_wnd.has_focus && GetAsyncKeyState(VK_SHIFT) < 0 &&
|
||||||
if (
|
|
||||||
#else
|
#else
|
||||||
if (_wnd.has_focus && GetAsyncKeyState(VK_TAB) < 0) {
|
/* Speed up using TAB, but disable for ALT+TAB of course */
|
||||||
/* Disable speeding up game with ALT+TAB (if syskey is pressed, the
|
if (_wnd.has_focus && GetAsyncKeyState(VK_TAB) < 0 && GetAsyncKeyState(VK_MENU) >= 0 &&
|
||||||
* real key is in the upper 16 bits (see WM_SYSKEYDOWN in WndProcGdi()) */
|
|
||||||
if (GetAsyncKeyState(VK_MENU) >= 0 &&
|
|
||||||
#endif
|
#endif
|
||||||
!_networking && _game_mode != GM_MENU)
|
!_networking && _game_mode != GM_MENU) {
|
||||||
_fast_forward |= 2;
|
_fast_forward |= 2;
|
||||||
} else if (_fast_forward & 2) {
|
} else if (_fast_forward & 2) {
|
||||||
_fast_forward = 0;
|
_fast_forward = 0;
|
||||||
}
|
}
|
||||||
|
|
13
window.c
13
window.c
|
@ -1422,8 +1422,8 @@ void HandleKeypress(uint32 key)
|
||||||
|
|
||||||
// Setup event
|
// Setup event
|
||||||
e.event = WE_KEYPRESS;
|
e.event = WE_KEYPRESS;
|
||||||
e.we.keypress.ascii = key & 0xFF;
|
e.we.keypress.ascii = GB(key, 0, 8);
|
||||||
e.we.keypress.keycode = key >> 16;
|
e.we.keypress.keycode = GB(key, 16, 16);
|
||||||
e.we.keypress.cont = true;
|
e.we.keypress.cont = true;
|
||||||
|
|
||||||
// check if we have a query string window open before allowing hotkeys
|
// check if we have a query string window open before allowing hotkeys
|
||||||
|
@ -1597,15 +1597,12 @@ void InputLoop(void)
|
||||||
MouseLoop(click, mousewheel);
|
MouseLoop(click, mousewheel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int _we4_timer;
|
|
||||||
|
|
||||||
void UpdateWindows(void)
|
void UpdateWindows(void)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
int t;
|
static int we4_timer = 0;
|
||||||
|
int t = we4_timer + 1;
|
||||||
|
|
||||||
t = _we4_timer + 1;
|
|
||||||
if (t >= 100) {
|
if (t >= 100) {
|
||||||
for (w = _last_window; w != _windows;) {
|
for (w = _last_window; w != _windows;) {
|
||||||
w--;
|
w--;
|
||||||
|
@ -1613,7 +1610,7 @@ void UpdateWindows(void)
|
||||||
}
|
}
|
||||||
t = 0;
|
t = 0;
|
||||||
}
|
}
|
||||||
_we4_timer = t;
|
we4_timer = t;
|
||||||
|
|
||||||
for (w = _last_window; w != _windows;) {
|
for (w = _last_window; w != _windows;) {
|
||||||
w--;
|
w--;
|
||||||
|
|
Loading…
Reference in New Issue