[Companion] Fixes #3858 (#3958)

This commit is contained in:
Bertrand Songis
2016-10-27 20:12:45 +02:00
committed by Damjan Adamic
parent 0b0059908c
commit 8626c0728c
4 changed files with 21 additions and 8 deletions
@@ -2115,12 +2115,17 @@ class ArmCustomFunctionField: public TransformedField {
}
}
static bool hasRepeatParam(const CustomFunctionData & fn)
{
return (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic);
}
virtual void beforeExport()
{
if (fn.swtch.type != SWITCH_TYPE_NONE) {
_func = fn.func;
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
if (hasRepeatParam(fn))
_active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5));
else
_active = (fn.enabled ? 1 : 0);
@@ -2216,7 +2221,7 @@ class ArmCustomFunctionField: public TransformedField {
{
fn.func = (AssignFunc)_func;
if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue || fn.func == FuncPlayHaptic || (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast))
if (hasRepeatParam(fn))
fn.repeatParam = (version >= 216 ? _active : (_active*5));
else
fn.enabled = (_active & 0x01);