feat(colorlcd): Special Function to set main screen (#2160)
* Special Function to set main screen (#2135) * chore: Add new SF to LUA constants list * Companion support * Formatting * get rid of magic number * Add function to get the number of custom screens * Change screen numbering from 0-based to 1-based. * Allow SetScreen custom function for Color LCD only * add range protection * cleanup * yet, range protection once again * fix: paintSpecialFunctionLine can't alter SF param data * Fix screen initialization in companion * move screen switching to the UI * Trigger view change from guiMain() * chore: Change "SET" to "Set" for consistency * fix: Somehow missed extra comma in `TW` Co-authored-by: Peter Feerick <peter.feerick@gmail.com> Co-authored-by: elecpower <neilh713@tpg.com.au> Co-authored-by: Raphael Coeffic <raphael.coeffic@frafos.com>
This commit is contained in:
co-authored by
Peter Feerick
elecpower
Raphael Coeffic
parent
b0c1315f61
commit
4e49ac68be
@@ -36,7 +36,8 @@ static bool fnHasRepeat(AssignFunc fn)
|
||||
return (fn == FuncPlayPrompt)
|
||||
|| (fn == FuncPlayValue)
|
||||
|| (fn == FuncPlayHaptic)
|
||||
|| (fn == FuncPlaySound);
|
||||
|| (fn == FuncPlaySound)
|
||||
|| (fn == FuncSetScreen);
|
||||
}
|
||||
|
||||
static const YamlLookupTable customFnLut = {
|
||||
@@ -63,6 +64,7 @@ static const YamlLookupTable customFnLut = {
|
||||
{ FuncScreenshot, "SCREENSHOT" },
|
||||
{ FuncRacingMode, "RACING_MODE" },
|
||||
{ FuncDisableTouch, "DISABLE_TOUCH" },
|
||||
{ FuncSetScreen, "SET_SCREEN"},
|
||||
};
|
||||
|
||||
static const YamlLookupTable trainerLut = {
|
||||
@@ -206,6 +208,9 @@ Node convert<CustomFunctionData>::encode(const CustomFunctionData& rhs)
|
||||
case FuncLogs:
|
||||
def += std::to_string(rhs.param);
|
||||
break;
|
||||
case FuncSetScreen:
|
||||
def += std::to_string(rhs.param);
|
||||
break;
|
||||
default:
|
||||
add_comma = false;
|
||||
break;
|
||||
@@ -349,6 +354,11 @@ bool convert<CustomFunctionData>::decode(const Node& node,
|
||||
def >> param;
|
||||
rhs.param = param;
|
||||
} break;
|
||||
case FuncSetScreen: {
|
||||
int param = 0;
|
||||
def >> param;
|
||||
rhs.param = param;
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user