From 516cddcf974ad2d0eecaaa9b71236cb7c3b74cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 10 Nov 2015 23:52:27 +0100 Subject: [PATCH] Explicitly cast scaled values to avoid warnings --- src/config.c | 2 +- src/config.h | 2 +- src/platform/shared.c | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/config.c b/src/config.c index eafb2d0778..916466eb60 100644 --- a/src/config.c +++ b/src/config.c @@ -197,7 +197,7 @@ config_property_definition _generalDefinitions[] = { { offsetof(general_configuration, upper_case_banners), "upper_case_banners", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(general_configuration, allow_loading_with_incorrect_checksum),"allow_loading_with_incorrect_checksum", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(general_configuration, steam_overlay_pause), "steam_overlay_pause", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, - { offsetof(general_configuration, scale), "scale", CONFIG_VALUE_TYPE_FLOAT, 1.0f, NULL }, + { offsetof(general_configuration, window_scale), "window_scale", CONFIG_VALUE_TYPE_FLOAT, { .value_float = 1.0f }, NULL }, }; config_property_definition _interfaceDefinitions[] = { diff --git a/src/config.h b/src/config.h index 1aae60d227..951727ca21 100644 --- a/src/config.h +++ b/src/config.h @@ -167,7 +167,7 @@ typedef struct { uint8 upper_case_banners; uint8 allow_loading_with_incorrect_checksum; uint8 steam_overlay_pause; - float scale; + float window_scale; } general_configuration; typedef struct { diff --git a/src/platform/shared.c b/src/platform/shared.c index a98a4f98aa..466b911661 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -286,7 +286,7 @@ void platform_draw() SDL_UnlockSurface(_surface); // Copy the surface to the window - if (gConfigGeneral.scale == 1 || gConfigGeneral.scale <= 0) + if (gConfigGeneral.window_scale == 1 || gConfigGeneral.window_scale <= 0) { if (SDL_BlitSurface(_surface, NULL, SDL_GetWindowSurface(gWindow), NULL)) { log_fatal("SDL_BlitSurface %s", SDL_GetError()); @@ -316,8 +316,8 @@ void platform_draw() static void platform_resize(int width, int height) { uint32 flags; - int dst_w = width / gConfigGeneral.scale; - int dst_h = height / gConfigGeneral.scale; + int dst_w = (int)(width / gConfigGeneral.window_scale); + int dst_h = (int)(height / gConfigGeneral.window_scale); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) = dst_w; RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) = dst_h; @@ -439,11 +439,11 @@ void platform_process_messages() } break; case SDL_MOUSEMOTION: - RCT2_GLOBAL(0x0142406C, int) = e.motion.x / gConfigGeneral.scale; - RCT2_GLOBAL(0x01424070, int) = e.motion.y / gConfigGeneral.scale; + RCT2_GLOBAL(0x0142406C, int) = (int)(e.motion.x / gConfigGeneral.window_scale); + RCT2_GLOBAL(0x01424070, int) = (int)(e.motion.y / gConfigGeneral.window_scale); - gCursorState.x = e.motion.x / gConfigGeneral.scale; - gCursorState.y = e.motion.y / gConfigGeneral.scale; + gCursorState.x = (int)(e.motion.x / gConfigGeneral.window_scale); + gCursorState.y = (int)(e.motion.y / gConfigGeneral.window_scale); break; case SDL_MOUSEWHEEL: if (gConsoleOpen) { @@ -453,8 +453,8 @@ void platform_process_messages() gCursorState.wheel += e.wheel.y * 128; break; case SDL_MOUSEBUTTONDOWN: - RCT2_GLOBAL(0x01424318, int) = e.button.x / gConfigGeneral.scale; - RCT2_GLOBAL(0x0142431C, int) = e.button.y / gConfigGeneral.scale; + RCT2_GLOBAL(0x01424318, int) = (int)(e.button.x / gConfigGeneral.window_scale); + RCT2_GLOBAL(0x0142431C, int) = (int)(e.button.y / gConfigGeneral.window_scale); switch (e.button.button) { case SDL_BUTTON_LEFT: store_mouse_input(1); @@ -472,8 +472,8 @@ void platform_process_messages() } break; case SDL_MOUSEBUTTONUP: - RCT2_GLOBAL(0x01424318, int) = e.button.x / gConfigGeneral.scale; - RCT2_GLOBAL(0x0142431C, int) = e.button.y / gConfigGeneral.scale; + RCT2_GLOBAL(0x01424318, int) = (int)(e.button.x / gConfigGeneral.window_scale); + RCT2_GLOBAL(0x0142431C, int) = (int)(e.button.y / gConfigGeneral.window_scale); switch (e.button.button) { case SDL_BUTTON_LEFT: store_mouse_input(2);