proton
proton copied to clipboard
Issue with scroll wheel
I am working with the scroll wheel in proton and I've noticed a really weird issue and I tracked it down to FocusInputComponent::OnInput stupidly calling stuff with UpdatedVar. No, I don't need you to modify my precious scroll delta, it's not a position.
The original code:
void FocusInputComponent::OnInput(VariantList *pVList)
{
//the 1 is because the pt we need modified is index 1 of the VariantList
#ifdef RT_FORCE_LEGACY_INPUT_HANDLING
GetParent()->CallFunctionRecursivelyWithUpdatedVar("OnInput", pVList, string("pos2d"), 1, Entity::RECURSIVE_VAR_OP_SUBTRACTION_PLUS_ALIGNMENT_OFFSET);
#else
//new way, which calls things in reverse order
GetParent()->CallFunctionRecursivelyWithUpdatedVarBackwards("OnInput", pVList, string("pos2d"), 1, Entity::RECURSIVE_VAR_OP_SUBTRACTION_PLUS_ALIGNMENT_OFFSET);
#endif
}
My fixed(?) code (actually a hack, but you know):
void FocusInputComponent::OnInput(VariantList *pVList)
{
//the 1 is because the pt we need modified is index 1 of the VariantList
#ifdef RT_FORCE_LEGACY_INPUT_HANDLING
GetParent()->CallFunctionRecursivelyWithUpdatedVar("OnInput", pVList, string("pos2d"), 1, Entity::RECURSIVE_VAR_OP_SUBTRACTION_PLUS_ALIGNMENT_OFFSET);
#else
//new way, which calls things in reverse order
//HACK!!!!!!!!!!!!!!!!!!!!!!!!!
if (int(pVList->Get(0).GetFloat()) == MESSAGE_TYPE_GUI_MOUSEWHEEL)
{
//TODO: just don't update the var.
pVList->Get(5).Set(CL_Vec2f());
GetParent()->CallFunctionRecursivelyWithUpdatedVarBackwards("OnInput", pVList, string("pos2d"), 5, Entity::RECURSIVE_VAR_OP_SUBTRACTION_PLUS_ALIGNMENT_OFFSET);
}
else
{
GetParent()->CallFunctionRecursivelyWithUpdatedVarBackwards("OnInput", pVList, string("pos2d"), 1, Entity::RECURSIVE_VAR_OP_SUBTRACTION_PLUS_ALIGNMENT_OFFSET);
}
#endif
}
Really, there should be a CallFunctionRecursivelyBackwards instead.
This was no issue in Growtopia, because the thing that handles input isn't affected by alignment/position changes. My game was, though.