patch: add random option for transition animation

This commit is contained in:
Ramen2X 2023-01-12 11:36:47 -05:00
parent 375b8cbd4a
commit b8ee9b0ece
2 changed files with 10 additions and 2 deletions

View file

@ -740,6 +740,8 @@ _CRTIMP size_t __cdecl InterceptFread(void *buffer, size_t size, size_t count, F
startTransitionFunction startTransitionOriginal = NULL;
MxResult MxTransitionManager::InterceptStartTransition(TransitionType animationType, int speed, byte unk, bool playMusicInTransition)
{
speed = config.GetInt("TransitionSpeed");
std::string animation_type = config.GetString("TransitionType");
if (animation_type == "No Animation") {
@ -752,9 +754,14 @@ MxResult MxTransitionManager::InterceptStartTransition(TransitionType animationT
animationType = VERTICAL_WIPE;
} else if (animation_type == "Window") {
animationType = WINDOW;
} else if (animation_type == "Random") {
animationType = (TransitionType)(rand() % 4 + 2);
// The Pixelation animation runs much faster by nature than the other animations,
// this magic is to make the speed inconsistency feel less jarring
if (animationType == PIXELATION && speed < 30) {
speed += 25;
}
}
speed = config.GetInt(_T("TransitionSpeed"));
return (this->*startTransitionOriginal)(animationType, speed, unk, playMusicInTransition);
}

View file

@ -188,6 +188,7 @@ PatchGrid::PatchGrid()
animationList.push_back("Pixelation");
animationList.push_back("Vertical Wipe");
animationList.push_back("Window");
animationList.push_back("Random");
AddPatch("TransitionType",
"Change LEGO Island's transition animation.",
AddComboItem(sectionGraphics, "Transition Type", animationList, 2));