From: Holger Schemel Date: Sat, 31 Oct 2020 22:49:58 +0000 (+0100) Subject: moved setting overlay grid size and buttons to separate function X-Git-Tag: 4.2.0.4~3 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0ede483d20ce26c84087e9fe476debe277f4973a;p=rocksndiamonds.git moved setting overlay grid size and buttons to separate function --- diff --git a/src/events.c b/src/events.c index aade635e..e3632df0 100644 --- a/src/events.c +++ b/src/events.c @@ -673,19 +673,10 @@ void HandleWindowEvent(WindowEvent *event) // check if screen orientation has changed (should always be true here) if (nr != GRID_ACTIVE_NR()) { - int x, y; - if (game_status == GAME_MODE_SETUP) RedrawSetupScreenAfterScreenRotation(nr); - nr = GRID_ACTIVE_NR(); - - overlay.grid_xsize = setup.touch.grid_xsize[nr]; - overlay.grid_ysize = setup.touch.grid_ysize[nr]; - - for (x = 0; x < MAX_GRID_XSIZE; x++) - for (y = 0; y < MAX_GRID_YSIZE; y++) - overlay.grid_button[x][y] = setup.touch.grid_button[nr][x][y]; + SetOverlayGridSizeAndButtons(); } } } diff --git a/src/libgame/system.c b/src/libgame/system.c index 67995e3d..e750b78d 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -352,30 +352,35 @@ void InitTileCursorInfo(void) void InitOverlayInfo(void) { - int nr = GRID_ACTIVE_NR(); - int x, y; - overlay.enabled = FALSE; overlay.active = FALSE; overlay.show_grid = FALSE; - overlay.grid_xsize = setup.touch.grid_xsize[nr]; - overlay.grid_ysize = setup.touch.grid_ysize[nr]; - - for (x = 0; x < MAX_GRID_XSIZE; x++) - for (y = 0; y < MAX_GRID_YSIZE; y++) - overlay.grid_button[x][y] = setup.touch.grid_button[nr][x][y]; - overlay.grid_button_highlight = CHAR_GRID_BUTTON_NONE; overlay.grid_button_action = JOY_NO_ACTION; + SetOverlayGridSizeAndButtons(); + #if defined(USE_TOUCH_INPUT_OVERLAY) if (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS)) overlay.enabled = TRUE; #endif } +void SetOverlayGridSizeAndButtons(void) +{ + int nr = GRID_ACTIVE_NR(); + int x, y; + + overlay.grid_xsize = setup.touch.grid_xsize[nr]; + overlay.grid_ysize = setup.touch.grid_ysize[nr]; + + for (x = 0; x < MAX_GRID_XSIZE; x++) + for (y = 0; y < MAX_GRID_YSIZE; y++) + overlay.grid_button[x][y] = setup.touch.grid_button[nr][x][y]; +} + void SetTileCursorEnabled(boolean enabled) { tile_cursor.enabled = enabled; diff --git a/src/libgame/system.h b/src/libgame/system.h index 44f97e07..0d74426f 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1813,6 +1813,7 @@ void InitGfxCustomArtworkInfo(void); void InitGfxOtherSettings(void); void InitTileCursorInfo(void); void InitOverlayInfo(void); +void SetOverlayGridSizeAndButtons(void); void SetTileCursorEnabled(boolean); void SetTileCursorActive(boolean); void SetTileCursorTargetXY(int, int);