Added support for SPLASH_SCRN_TIME option to sfall HRP

This commit is contained in:
NovaRain
2022-05-24 22:49:40 +08:00
parent a51bd676e0
commit fddb71e88a
3 changed files with 29 additions and 2 deletions
+6 -2
View File
@@ -252,7 +252,7 @@ void Setting::init(const char* exeFileName, std::string &cmdline) {
MainMenuScreen::MAIN_MENU_SIZE = sf::IniReader::GetInt("MAINMENU", "MAIN_MENU_SIZE", 1, f2ResIni); MainMenuScreen::MAIN_MENU_SIZE = sf::IniReader::GetInt("MAINMENU", "MAIN_MENU_SIZE", 1, f2ResIni);
SplashScreen::SPLASH_SCRN_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "SPLASH_SCRN_SIZE", 1, f2ResIni); SplashScreen::SPLASH_SCRN_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "SPLASH_SCRN_SIZE", 1, f2ResIni);
HelpScreen::HELP_SCRN_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "HELP_SCRN_SIZE", 0, f2ResIni); HelpScreen::HELP_SCRN_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "HELP_SCRN_SIZE", 1, f2ResIni);
DeathScreen::DEATH_SCRN_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "DEATH_SCRN_SIZE", 1, f2ResIni); DeathScreen::DEATH_SCRN_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "DEATH_SCRN_SIZE", 1, f2ResIni);
SlidesScreen::END_SLIDE_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "END_SLIDE_SIZE", 1, f2ResIni); SlidesScreen::END_SLIDE_SIZE = sf::IniReader::GetInt("STATIC_SCREENS", "END_SLIDE_SIZE", 1, f2ResIni);
MoviesScreen::MOVIE_SIZE = sf::IniReader::GetInt("MOVIES", "MOVIE_SIZE", 1, f2ResIni); MoviesScreen::MOVIE_SIZE = sf::IniReader::GetInt("MOVIES", "MOVIE_SIZE", 1, f2ResIni);
@@ -267,7 +267,7 @@ void Setting::init(const char* exeFileName, std::string &cmdline) {
ViewMap::EDGE_CLIPPING_ON = (sf::IniReader::GetInt("MAPS", "EDGE_CLIPPING_ON", 1, f2ResIni) != 0); ViewMap::EDGE_CLIPPING_ON = (sf::IniReader::GetInt("MAPS", "EDGE_CLIPPING_ON", 1, f2ResIni) != 0);
IFaceBar::IFACE_BAR_MODE = sf::IniReader::GetInt("IFACE", "IFACE_BAR_MODE", 0, f2ResIni); IFaceBar::IFACE_BAR_MODE = sf::IniReader::GetInt("IFACE", "IFACE_BAR_MODE", 0, f2ResIni);
IFaceBar::IFACE_BAR_SIDE_ART = sf::IniReader::GetInt("IFACE", "IFACE_BAR_SIDE_ART", 2, f2ResIni); IFaceBar::IFACE_BAR_SIDE_ART = sf::IniReader::GetInt("IFACE", "IFACE_BAR_SIDE_ART", 1, f2ResIni);
IFaceBar::IFACE_BAR_WIDTH = sf::IniReader::GetInt("IFACE", "IFACE_BAR_WIDTH", (!sf::versionCHI && SCR_WIDTH >= 800) ? 800 : 640, f2ResIni); IFaceBar::IFACE_BAR_WIDTH = sf::IniReader::GetInt("IFACE", "IFACE_BAR_WIDTH", (!sf::versionCHI && SCR_WIDTH >= 800) ? 800 : 640, f2ResIni);
IFaceBar::IFACE_BAR_SIDES_ORI = (sf::IniReader::GetInt("IFACE", "IFACE_BAR_SIDES_ORI", 0, f2ResIni) != 0); IFaceBar::IFACE_BAR_SIDES_ORI = (sf::IniReader::GetInt("IFACE", "IFACE_BAR_SIDES_ORI", 0, f2ResIni) != 0);
@@ -282,6 +282,10 @@ void Setting::init(const char* exeFileName, std::string &cmdline) {
sf::WindowRender::EnableRecalculateFadeSteps(); sf::WindowRender::EnableRecalculateFadeSteps();
} }
int splashTime = sf::IniReader::GetInt("OTHER_SETTINGS", "SPLASH_SCRN_TIME", 0, f2ResIni);
if (splashTime > 10) splashTime = 10;
SplashScreen::SPLASH_SCRN_TIME = splashTime;
int nodes = sf::IniReader::GetInt("MAPS", "NumPathNodes", 1, f2ResIni); int nodes = sf::IniReader::GetInt("MAPS", "NumPathNodes", 1, f2ResIni);
if (nodes > 1) game::Tilemap::SetPathMaxNodes((nodes < 20) ? nodes * 2000 : 40000); if (nodes > 1) game::Tilemap::SetPathMaxNodes((nodes < 20) ? nodes * 2000 : 40000);
+22
View File
@@ -23,15 +23,20 @@ namespace sf = sfall;
// 2 - image will stretch to fill the screen // 2 - image will stretch to fill the screen
long SplashScreen::SPLASH_SCRN_SIZE; long SplashScreen::SPLASH_SCRN_SIZE;
long SplashScreen::SPLASH_SCRN_TIME;
static WORD rixWidth; static WORD rixWidth;
static WORD rixHeight; static WORD rixHeight;
static BYTE* rixBuffer; static BYTE* rixBuffer;
static DWORD splashStartTime;
static void __cdecl game_splash_screen_hack_scr_blit(BYTE* srcPixels, long srcWidth, long srcHeight, long srcX, long srcY, long width, long height, long x, long y) { static void __cdecl game_splash_screen_hack_scr_blit(BYTE* srcPixels, long srcWidth, long srcHeight, long srcX, long srcY, long width, long height, long x, long y) {
RECT rect; RECT rect;
long w = Setting::ScreenWidth(); long w = Setting::ScreenWidth();
long h = Setting::ScreenHeight(); long h = Setting::ScreenHeight();
splashStartTime = GetTickCount();
// TODO: Load an alternative 32-bit BMP image or DirectX texture // TODO: Load an alternative 32-bit BMP image or DirectX texture
// stretch texture for DirectX // stretch texture for DirectX
@@ -114,9 +119,26 @@ static void __declspec(naked) game_splash_screen_hook() {
} }
} }
static void SplashScreenTime() {
if (SplashScreen::SPLASH_SCRN_TIME >= 1) {
DWORD time = 1000 * SplashScreen::SPLASH_SCRN_TIME;
for (DWORD ticks = GetTickCount() - splashStartTime; ticks < time; ticks = GetTickCount() - splashStartTime) {
Sleep(500);
}
}
}
static void __declspec(naked) game_init_hook_init_options_menu() {
__asm {
call SplashScreenTime;
jmp fo::funcoffs::init_options_menu_;
}
}
void SplashScreen::init() { void SplashScreen::init() {
sf::HookCall(0x4444FC, game_splash_screen_hook); sf::HookCall(0x4444FC, game_splash_screen_hook);
sf::MakeCall(0x44451E, game_splash_screen_hack_scr_blit, 1); sf::MakeCall(0x44451E, game_splash_screen_hack_scr_blit, 1);
sf::HookCall(0x442B0B, game_init_hook_init_options_menu);
} }
} }
+1
View File
@@ -14,6 +14,7 @@ public:
static void init(); static void init();
static long SPLASH_SCRN_SIZE; static long SPLASH_SCRN_SIZE;
static long SPLASH_SCRN_TIME;
}; };
} }