/////////////////////////////////////////////////////////////////////
| 6233 | |
| 6234 | ////////////////////////////////////////////////////////////////////////// |
| 6235 | int CScriptBind_Entity::MaterialFlashInvoke(IFunctionHandler* pH) |
| 6236 | { |
| 6237 | SFlashVarValue res(SFlashVarValue::CreateUndefined()); |
| 6238 | |
| 6239 | ////////////////////////////////////////////////////////////////////////// |
| 6240 | // prepare invocation |
| 6241 | |
| 6242 | if (pH->GetParamCount() < 4) |
| 6243 | return pH->EndFunction(); |
| 6244 | |
| 6245 | // get parameters |
| 6246 | int slot(0); |
| 6247 | pH->GetParam(1, slot); |
| 6248 | |
| 6249 | int subMtlId(0); |
| 6250 | pH->GetParam(2, subMtlId); |
| 6251 | |
| 6252 | int texSlot(0); |
| 6253 | pH->GetParam(3, texSlot); |
| 6254 | |
| 6255 | const char* pMethodName(0); // AS method name to be called |
| 6256 | pH->GetParam(4, pMethodName); |
| 6257 | |
| 6258 | int numArgs(pH->GetParamCount() - 4); // number of arguments to AS script call |
| 6259 | assert(numArgs >= 0); |
| 6260 | |
| 6261 | // build variable argument list |
| 6262 | PREFAST_SUPPRESS_WARNING(6255) SFlashVarValue * pArgList = numArgs != 0 ? (SFlashVarValue*) alloca(sizeof(SFlashVarValue) * numArgs) : 0; |
| 6263 | if (!pArgList && numArgs) |
| 6264 | return pH->EndFunction(); |
| 6265 | |
| 6266 | if (numArgs) |
| 6267 | { |
| 6268 | for (int i(0); i < numArgs; ++i) |
| 6269 | { |
| 6270 | ScriptAnyValue param; |
| 6271 | pH->GetParamAny(5 + i, param); |
| 6272 | switch (param.GetVarType()) |
| 6273 | { |
| 6274 | case svtNumber: |
| 6275 | { |
| 6276 | float arg(0); |
| 6277 | param.CopyTo(arg); |
| 6278 | pArgList[i] = arg; |
| 6279 | break; |
| 6280 | } |
| 6281 | case svtString: |
| 6282 | { |
| 6283 | const char* arg(0); |
| 6284 | param.CopyTo(arg); |
| 6285 | pArgList[i] = arg; |
| 6286 | break; |
| 6287 | } |
| 6288 | default: |
| 6289 | { |
| 6290 | assert(0); // unsupported type |
| 6291 | pArgList[i] = SFlashVarValue::CreateUndefined(); |
| 6292 | } |
nothing calls this directly
no test coverage detected