From 5bd0e3c505275e054aafc78b10339a849a28c67c Mon Sep 17 00:00:00 2001 From: Wipe Date: Sat, 18 Jun 2022 10:06:00 +0200 Subject: [PATCH] Add SFall Misc->MainMenu*OffsetX/Y (#41) --- src/main.cc | 17 ++++++++++++++--- src/sfall_config.cc | 4 ++++ src/sfall_config.h | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main.cc b/src/main.cc index c4f1417..14fb1e4 100644 --- a/src/main.cc +++ b/src/main.cc @@ -654,16 +654,22 @@ int mainMenuWindowInit() if (fontSettingsSFall && !(fontSettingsSFall & 0x010000)) fontSettings = fontSettingsSFall & 0xFF; + // SFALL: Allow to move copyright text + int offsetX = 0, offsetY = 0; + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_CREDITS_OFFSET_X_KEY, &offsetX); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_CREDITS_OFFSET_Y_KEY, &offsetY); + // Copyright. msg.num = 20; if (messageListGetItem(&gMiscMessageList, &msg)) { - windowDrawText(gMainMenuWindow, msg.text, 0, 15, 460, fontSettings | 0x06000000); + windowDrawText(gMainMenuWindow, msg.text, 0, offsetX + 15, offsetY + 460, fontSettings | 0x06000000); } // SFALL: Make sure font settings are applied when using 0x010000 flag if (fontSettingsSFall) fontSettings = fontSettingsSFall; + // TODO: Allow to move version text // Version. char version[VERSION_MAX]; versionGetVersion(version); @@ -690,8 +696,13 @@ int mainMenuWindowInit() gMainMenuButtons[index] = -1; } + // SFALL: Allow to move menu buttons + offsetX = offsetY = 0; + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_X_KEY, &offsetX); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_Y_KEY, &offsetY); + for (int index = 0; index < MAIN_MENU_BUTTON_COUNT; index++) { - gMainMenuButtons[index] = buttonCreate(gMainMenuWindow, 30, 19 + index * 42 - index, 26, 26, -1, -1, 1111, gMainMenuButtonKeyBindings[index], gMainMenuButtonUpFrmData, gMainMenuButtonDownFrmData, 0, 32); + gMainMenuButtons[index] = buttonCreate(gMainMenuWindow, offsetX + 30, offsetY + 19 + index * 42 - index, 26, 26, -1, -1, 1111, gMainMenuButtonKeyBindings[index], gMainMenuButtonUpFrmData, gMainMenuButtonDownFrmData, 0, 32); if (gMainMenuButtons[index] == -1) { mainMenuWindowFree(); return -1; @@ -713,7 +724,7 @@ int mainMenuWindowInit() msg.num = 9 + index; if (messageListGetItem(&gMiscMessageList, &msg)) { len = fontGetStringWidth(msg.text); - fontDrawText(gMainMenuWindowBuffer + 640 * (42 * index - index + 20) + 126 - (len / 2), msg.text, 640 - (126 - (len / 2)) - 1, 640, fontSettings); + fontDrawText(gMainMenuWindowBuffer + offsetX + 640 * (offsetY + 42 * index - index + 20) + 126 - (len / 2), msg.text, 640 - (126 - (len / 2)) - 1, 640, fontSettings); } } diff --git a/src/sfall_config.cc b/src/sfall_config.cc index 46f3c8e..660e591 100644 --- a/src/sfall_config.cc +++ b/src/sfall_config.cc @@ -26,7 +26,11 @@ bool sfallConfigInit(int argc, char** argv) configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_MALE_KEY, ""); configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_FEMALE_KEY, ""); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_BIG_FONT_COLOR_KEY, 0); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_CREDITS_OFFSET_X_KEY, 0); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_CREDITS_OFFSET_Y_KEY, 0); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_FONT_COLOR_KEY, 0); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_X_KEY, 0); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_OFFSET_Y_KEY, 0); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_SKIP_OPENING_MOVIES_KEY, 0); configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_STARTING_MAP_KEY, ""); configSetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DISPLAY_KARMA_CHANGES_KEY, false); diff --git a/src/sfall_config.h b/src/sfall_config.h index a1d423f..9a21c53 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -12,7 +12,11 @@ #define SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_MALE_KEY "MaleStartModel" #define SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_FEMALE_KEY "FemaleStartModel" #define SFALL_CONFIG_MAIN_MENU_BIG_FONT_COLOR_KEY "MainMenuBigFontColour" +#define SFALL_CONFIG_MAIN_MENU_CREDITS_OFFSET_X_KEY "MainMenuCreditsOffsetX" +#define SFALL_CONFIG_MAIN_MENU_CREDITS_OFFSET_Y_KEY "MainMenuCreditsOffsetY" #define SFALL_CONFIG_MAIN_MENU_FONT_COLOR_KEY "MainMenuFontColour" +#define SFALL_CONFIG_MAIN_MENU_OFFSET_X_KEY "MainMenuOffsetX" +#define SFALL_CONFIG_MAIN_MENU_OFFSET_Y_KEY "MainMenuOffsetY" #define SFALL_CONFIG_SKIP_OPENING_MOVIES_KEY "SkipOpeningMovies" #define SFALL_CONFIG_STARTING_MAP_KEY "StartingMap" #define SFALL_CONFIG_KARMA_FRMS_KEY "KarmaFRMs"