From 96d397060cfcc2cbd507f500324952a49a5547b7 Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 20 Dec 2020 15:19:22 -0800 Subject: [PATCH] Allow pressing ACTION to skip fake loading screen While there already exists an option to skip the fake loading screen entirely (without requiring an ACTION press), there are several reasons for including this option as well: * So people upgrading from 2.2 won't have to sit through the fake loading screen the first time they open 2.3. * So if people are too lazy to use the existing option, they can use this one instead. * So tool-assisted speedruns (TASes) of this game can skip the fake loading screen without requiring an existing settings.vvv beforehand. This last one is the biggest reason for me, since I'm not sure what TASVideos.org rules are regarding existing save files, but with this change nobody has to worry about their rules and can safely just press ACTION to skip the fake loading screen automatically. --- desktop_version/src/main.cpp | 1 + desktop_version/src/preloader.cpp | 16 ++++++++++++++++ desktop_version/src/preloader.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index ee31d0cc..664d9abe 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -527,6 +527,7 @@ void inline fixedloop() switch(game.gamestate) { case PRELOADER: + preloaderinput(); preloaderrenderfixed(); break; #if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR) diff --git a/desktop_version/src/preloader.cpp b/desktop_version/src/preloader.cpp index 840808f5..5f4e22d0 100644 --- a/desktop_version/src/preloader.cpp +++ b/desktop_version/src/preloader.cpp @@ -1,6 +1,7 @@ #include "Enums.h" #include "Game.h" #include "Graphics.h" +#include "KeyPoll.h" #include "UtilityClass.h" int pre_fakepercent=0, pre_transition=30; @@ -10,6 +11,21 @@ int pre_darkcol=0, pre_lightcol=0, pre_curcol=0, pre_coltimer=0, pre_offset=0; int pre_frontrectx=30, pre_frontrecty=20, pre_frontrectw=260, pre_frontrecth=200; int pre_temprectx=0, pre_temprecty=0, pre_temprectw=320, pre_temprecth=240; +void preloaderinput() +{ + game.press_action = false; + + if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip)) { + game.press_action = true; + } + + if (game.press_action) { + //Skip to TITLEMODE immediately + game.gamestate = TITLEMODE; + game.jumpheld = true; + } +} + void preloaderrenderfixed() { if (pre_transition < 30) pre_transition--; diff --git a/desktop_version/src/preloader.h b/desktop_version/src/preloader.h index 5f273b1f..138ec174 100644 --- a/desktop_version/src/preloader.h +++ b/desktop_version/src/preloader.h @@ -1,6 +1,8 @@ #ifndef PRELOADER_H #define PRELOADER_H +void preloaderinput(); + void preloaderrender(); void preloaderrenderfixed();