From 99bc14cf3ac437c19791d6ea9b35b94fb7955e49 Mon Sep 17 00:00:00 2001 From: Vasilii Rogin Date: Fri, 14 Apr 2023 19:03:21 +0300 Subject: [PATCH] Add sFall movie timer options (#261) --- src/scripts.cc | 33 ++++++++++++++++++++++++++------- src/sfall_config.cc | 7 +++++++ src/sfall_config.h | 7 +++++++ 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/scripts.cc b/src/scripts.cc index 3ac7e4b..7a35d39 100644 --- a/src/scripts.cc +++ b/src/scripts.cc @@ -29,6 +29,7 @@ #include "proto.h" #include "proto_instance.h" #include "queue.h" +#include "sfall_config.h" #include "stat.h" #include "svga.h" #include "tile.h" @@ -265,6 +266,15 @@ static bool _set; // 0x667750 static char _tempStr1[20]; +static int gStartYear; +static int gStartMonth; +static int gStartDay; + +static int gMovieTimerArtimer1; +static int gMovieTimerArtimer2; +static int gMovieTimerArtimer3; +static int gMovieTimerArtimer4; + // TODO: Make unsigned. // // Returns game time in ticks (1/10 second). @@ -278,9 +288,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]; @@ -439,7 +449,7 @@ int _scriptsCheckGameEvents(int* moviePtr, int window) movieFlags = GAME_MOVIE_FADE_IN | GAME_MOVIE_STOP_MUSIC; endgame = true; } else { - if (day >= 360 || gameGetGlobalVar(GVAR_FALLOUT_2) >= 3) { + if (day >= gMovieTimerArtimer4 || gameGetGlobalVar(GVAR_FALLOUT_2) >= 3) { movie = MOVIE_ARTIMER4; if (!gameMovieIsSeen(MOVIE_ARTIMER4)) { adjustRep = true; @@ -447,13 +457,13 @@ int _scriptsCheckGameEvents(int* moviePtr, int window) wmAreaSetVisibleState(CITY_DESTROYED_ARROYO, 1, 1); wmAreaMarkVisitedState(CITY_DESTROYED_ARROYO, 2); } - } else if (day >= 270 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) { + } else if (day >= gMovieTimerArtimer3 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) { adjustRep = true; movie = MOVIE_ARTIMER3; - } else if (day >= 180 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) { + } else if (day >= gMovieTimerArtimer2 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) { adjustRep = true; movie = MOVIE_ARTIMER2; - } else if (day >= 90 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) { + } else if (day >= gMovieTimerArtimer1 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) { adjustRep = true; movie = MOVIE_ARTIMER1; } @@ -1522,6 +1532,15 @@ 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); + + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER1, &gMovieTimerArtimer1); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER2, &gMovieTimerArtimer2); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER3, &gMovieTimerArtimer3); + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER4, &gMovieTimerArtimer4); + return 0; } diff --git a/src/sfall_config.cc b/src/sfall_config.cc index c3c8f7e..c0f4b6c 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); @@ -50,6 +53,10 @@ bool sfallConfigInit(int argc, char** argv) configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_BURST_MOD_TARGET_MULTIPLIER_KEY, SFALL_CONFIG_BURST_MOD_DEFAULT_TARGET_MULTIPLIER); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_BURST_MOD_TARGET_DIVISOR_KEY, SFALL_CONFIG_BURST_MOD_DEFAULT_TARGET_DIVISOR); configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_EXTRA_MESSAGE_LISTS_KEY, ""); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER1, 90); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER2, 180); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER3, 270); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER4, 360); char path[COMPAT_MAX_PATH]; char* executable = argv[0]; diff --git a/src/sfall_config.h b/src/sfall_config.h index 26d85cc..86aa7a7 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" @@ -42,6 +45,10 @@ namespace fallout { #define SFALL_CONFIG_PLASTIC_EXPLOSIVE_MIN_DAMAGE_KEY "PlasticExplosive_DmgMin" #define SFALL_CONFIG_PLASTIC_EXPLOSIVE_MAX_DAMAGE_KEY "PlasticExplosive_DmgMax" #define SFALL_CONFIG_EXPLOSION_EMITS_LIGHT_KEY "ExplosionsEmitLight" +#define SFALL_CONFIG_MOVIE_TIMER_ARTIMER1 "MovieTimer_artimer1" +#define SFALL_CONFIG_MOVIE_TIMER_ARTIMER2 "MovieTimer_artimer2" +#define SFALL_CONFIG_MOVIE_TIMER_ARTIMER3 "MovieTimer_artimer3" +#define SFALL_CONFIG_MOVIE_TIMER_ARTIMER4 "MovieTimer_artimer4" #define SFALL_CONFIG_CITY_REPUTATION_LIST_KEY "CityRepsList" #define SFALL_CONFIG_UNARMED_FILE_KEY "UnarmedFile" #define SFALL_CONFIG_DAMAGE_MOD_FORMULA_KEY "DamageFormula"