From 459bd3268ac6d234d957583a67bfd24740c9e4d9 Mon Sep 17 00:00:00 2001 From: Vasilii Rogin Date: Sun, 9 Apr 2023 21:26:26 +0300 Subject: [PATCH] Add starting days for ddraw.ini --- src/scripts.cc | 15 ++++++++++++--- src/sfall_config.cc | 3 +++ src/sfall_config.h | 3 +++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/scripts.cc b/src/scripts.cc index 3ac7e4b..e6f992e 100644 --- a/src/scripts.cc +++ b/src/scripts.cc @@ -36,6 +36,7 @@ #include "window_manager.h" #include "window_manager_private.h" #include "worldmap.h" +#include "sfall_config.h" namespace fallout { @@ -265,6 +266,10 @@ static bool _set; // 0x667750 static char _tempStr1[20]; +static int gStartYear; +static int gStartMonth; +static int gStartDay; + // TODO: Make unsigned. // // Returns game time in ticks (1/10 second). @@ -278,9 +283,9 @@ int gameTimeGetTime() // 0x4A3338 void gameTimeGetDate(int* monthPtr, int* dayPtr, int* yearPtr) { - int year = (gGameTime / GAME_TIME_TICKS_PER_DAY + 24) / 365 + 2241; - int month = 6; - int day = (gGameTime / GAME_TIME_TICKS_PER_DAY + 24) % 365; + int year = (gGameTime / GAME_TIME_TICKS_PER_DAY + gStartDay) / 365 + gStartYear; + int month = gStartMonth; + int day = (gGameTime / GAME_TIME_TICKS_PER_DAY + gStartDay) % 365; while (1) { int daysInMonth = gGameTimeDaysPerMonth[month]; @@ -1522,6 +1527,10 @@ int scriptsInit() messageListRepositorySetStandardMessageList(STANDARD_MESSAGE_LIST_SCRIPT, &gScrMessageList); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_START_YEAR, &gStartYear); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_START_MONTH, &gStartMonth); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_START_DAY, &gStartDay); + return 0; } diff --git a/src/sfall_config.cc b/src/sfall_config.cc index c3c8f7e..c7c4508 100644 --- a/src/sfall_config.cc +++ b/src/sfall_config.cc @@ -27,6 +27,9 @@ bool sfallConfigInit(int argc, char** argv) configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_FEMALE_KEY, ""); 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_START_YEAR, 2241); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_START_MONTH, 6); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_START_DAY, 24); 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); diff --git a/src/sfall_config.h b/src/sfall_config.h index 26d85cc..9c0149a 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -13,6 +13,9 @@ namespace fallout { #define SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_FEMALE_KEY "FemaleDefaultModel" #define SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_MALE_KEY "MaleStartModel" #define SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_FEMALE_KEY "FemaleStartModel" +#define SFALL_CONFIG_START_YEAR "StartYear" +#define SFALL_CONFIG_START_MONTH "StartMonth" +#define SFALL_CONFIG_START_DAY "StartDay" #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"