mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Move key.Poll() calls to just before input funcs
In order to re-remove the 1-frame input delay, we will have to poll input right after rendering a frame - in other words, just before an input function gets called. To do this, I've added a new function enum type - Func_input - that is the same as a fixed function, but before its function gets called, key.Poll() gets called. And all input functions have been updated to use this enum accordingly.
This commit is contained in:
parent
ab26985fde
commit
f1f434accc
1 changed files with 15 additions and 11 deletions
|
@ -78,6 +78,7 @@ enum FuncType
|
||||||
{
|
{
|
||||||
Func_null,
|
Func_null,
|
||||||
Func_fixed,
|
Func_fixed,
|
||||||
|
Func_input,
|
||||||
Func_delta
|
Func_delta
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -138,14 +139,14 @@ static const inline struct ImplFunc* get_gamestate_funcs(
|
||||||
|
|
||||||
FUNC_LIST_BEGIN(GAMEMODE)
|
FUNC_LIST_BEGIN(GAMEMODE)
|
||||||
{Func_fixed, runscript},
|
{Func_fixed, runscript},
|
||||||
{Func_fixed, gameinput},
|
{Func_input, gameinput},
|
||||||
{Func_fixed, gamerenderfixed},
|
{Func_fixed, gamerenderfixed},
|
||||||
{Func_delta, gamerender},
|
{Func_delta, gamerender},
|
||||||
{Func_fixed, gamelogic},
|
{Func_fixed, gamelogic},
|
||||||
FUNC_LIST_END
|
FUNC_LIST_END
|
||||||
|
|
||||||
FUNC_LIST_BEGIN(TITLEMODE)
|
FUNC_LIST_BEGIN(TITLEMODE)
|
||||||
{Func_fixed, titleinput},
|
{Func_input, titleinput},
|
||||||
{Func_fixed, titlerenderfixed},
|
{Func_fixed, titlerenderfixed},
|
||||||
{Func_delta, titlerender},
|
{Func_delta, titlerender},
|
||||||
{Func_fixed, titlelogic},
|
{Func_fixed, titlelogic},
|
||||||
|
@ -154,34 +155,34 @@ static const inline struct ImplFunc* get_gamestate_funcs(
|
||||||
FUNC_LIST_BEGIN(MAPMODE)
|
FUNC_LIST_BEGIN(MAPMODE)
|
||||||
{Func_fixed, maprenderfixed},
|
{Func_fixed, maprenderfixed},
|
||||||
{Func_delta, maprender},
|
{Func_delta, maprender},
|
||||||
{Func_fixed, mapinput},
|
{Func_input, mapinput},
|
||||||
{Func_fixed, maplogic},
|
{Func_fixed, maplogic},
|
||||||
FUNC_LIST_END
|
FUNC_LIST_END
|
||||||
|
|
||||||
FUNC_LIST_BEGIN(TELEPORTERMODE)
|
FUNC_LIST_BEGIN(TELEPORTERMODE)
|
||||||
{Func_fixed, maprenderfixed},
|
{Func_fixed, maprenderfixed},
|
||||||
{Func_delta, teleporterrender},
|
{Func_delta, teleporterrender},
|
||||||
{Func_fixed, teleportermodeinput},
|
{Func_input, teleportermodeinput},
|
||||||
{Func_fixed, maplogic},
|
{Func_fixed, maplogic},
|
||||||
FUNC_LIST_END
|
FUNC_LIST_END
|
||||||
|
|
||||||
FUNC_LIST_BEGIN(GAMECOMPLETE)
|
FUNC_LIST_BEGIN(GAMECOMPLETE)
|
||||||
{Func_fixed, gamecompleterenderfixed},
|
{Func_fixed, gamecompleterenderfixed},
|
||||||
{Func_delta, gamecompleterender},
|
{Func_delta, gamecompleterender},
|
||||||
{Func_fixed, gamecompleteinput},
|
{Func_input, gamecompleteinput},
|
||||||
{Func_fixed, gamecompletelogic},
|
{Func_fixed, gamecompletelogic},
|
||||||
FUNC_LIST_END
|
FUNC_LIST_END
|
||||||
|
|
||||||
FUNC_LIST_BEGIN(GAMECOMPLETE2)
|
FUNC_LIST_BEGIN(GAMECOMPLETE2)
|
||||||
{Func_delta, gamecompleterender2},
|
{Func_delta, gamecompleterender2},
|
||||||
{Func_fixed, gamecompleteinput2},
|
{Func_input, gamecompleteinput2},
|
||||||
{Func_fixed, gamecompletelogic2},
|
{Func_fixed, gamecompletelogic2},
|
||||||
FUNC_LIST_END
|
FUNC_LIST_END
|
||||||
|
|
||||||
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
|
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
|
||||||
FUNC_LIST_BEGIN(EDITORMODE)
|
FUNC_LIST_BEGIN(EDITORMODE)
|
||||||
{Func_fixed, flipmodeoff},
|
{Func_fixed, flipmodeoff},
|
||||||
{Func_fixed, editorinput},
|
{Func_input, editorinput},
|
||||||
{Func_fixed, editorrenderfixed},
|
{Func_fixed, editorrenderfixed},
|
||||||
{Func_delta, editorrender},
|
{Func_delta, editorrender},
|
||||||
{Func_fixed, editorlogic},
|
{Func_fixed, editorlogic},
|
||||||
|
@ -189,7 +190,7 @@ static const inline struct ImplFunc* get_gamestate_funcs(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUNC_LIST_BEGIN(PRELOADER)
|
FUNC_LIST_BEGIN(PRELOADER)
|
||||||
{Func_fixed, preloaderinput},
|
{Func_input, preloaderinput},
|
||||||
{Func_fixed, preloaderrenderfixed},
|
{Func_fixed, preloaderrenderfixed},
|
||||||
{Func_delta, preloaderrender},
|
{Func_delta, preloaderrender},
|
||||||
FUNC_LIST_END
|
FUNC_LIST_END
|
||||||
|
@ -241,7 +242,7 @@ static enum IndexCode increment_gamestate_func_index(void)
|
||||||
static void unfocused_run(void);
|
static void unfocused_run(void);
|
||||||
|
|
||||||
static const struct ImplFunc unfocused_func_list[] = {
|
static const struct ImplFunc unfocused_func_list[] = {
|
||||||
Func_fixed,
|
Func_input, /* we still need polling when unfocused */
|
||||||
unfocused_run
|
unfocused_run
|
||||||
};
|
};
|
||||||
static const struct ImplFunc* unfocused_funcs = unfocused_func_list;
|
static const struct ImplFunc* unfocused_funcs = unfocused_func_list;
|
||||||
|
@ -299,6 +300,11 @@ static enum LoopCode loop_run_active_funcs(void)
|
||||||
const struct ImplFunc* implfunc = &(*active_funcs)[*active_func_index];
|
const struct ImplFunc* implfunc = &(*active_funcs)[*active_func_index];
|
||||||
enum IndexCode index_code;
|
enum IndexCode index_code;
|
||||||
|
|
||||||
|
if (implfunc->type == Func_input)
|
||||||
|
{
|
||||||
|
key.Poll();
|
||||||
|
}
|
||||||
|
|
||||||
if (implfunc->type != Func_null && implfunc->func != NULL)
|
if (implfunc->type != Func_null && implfunc->func != NULL)
|
||||||
{
|
{
|
||||||
implfunc->func();
|
implfunc->func();
|
||||||
|
@ -707,8 +713,6 @@ static enum LoopCode loop_begin(void)
|
||||||
// Update network per frame.
|
// Update network per frame.
|
||||||
NETWORK_update();
|
NETWORK_update();
|
||||||
|
|
||||||
key.Poll();
|
|
||||||
|
|
||||||
return Loop_continue;
|
return Loop_continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue