void C4Effect::AssignCallbackFunctions() { C4PropList *p = GetCallbackScript(); // compose function names and search them char fn[C4AUL_MAX_Identifier+1]; sprintf(fn, PSF_FxStart, GetName()); pFnStart = p->GetFunc(fn); sprintf(fn, PSF_FxStop, GetName()); pFnStop = p->GetFunc(fn); sprintf(fn, PSF_FxTimer, GetName()); pFnTimer = p->GetFunc(fn); sprintf(fn, PSF_FxEffect, GetName()); pFnEffect = p->GetFunc(fn); sprintf(fn, PSF_FxDamage, GetName()); pFnDamage = p->GetFunc(fn); }
C4Value C4Effect::DoCall(C4PropList *pObj, const char *szFn, const C4Value &rVal1, const C4Value &rVal2, const C4Value &rVal3, const C4Value &rVal4, const C4Value &rVal5, const C4Value &rVal6, const C4Value &rVal7) { C4PropList * p = GetCallbackScript(); if (!p) { C4AulFunc * fn = GetFunc(szFn); if (fn) return fn->Exec(this, &C4AulParSet(rVal1, rVal2, rVal3, rVal4, rVal5, rVal6, rVal7)); } else { // old variant // compose function name C4AulFunc * fn = p->GetFunc(FormatString(PSF_FxCustom, GetName(), szFn).getData()); if (fn) return fn->Exec(p, &C4AulParSet(Obj(pObj), this, rVal1, rVal2, rVal3, rVal4, rVal5, rVal6, rVal7)); } return C4Value(); }