| 1423 | } |
| 1424 | |
| 1425 | static cell_t EmitSentence(IPluginContext *pContext, const cell_t *params) |
| 1426 | { |
| 1427 | cell_t *addr; |
| 1428 | CellRecipientFilter crf; |
| 1429 | unsigned int numClients; |
| 1430 | int client; |
| 1431 | IGamePlayer *pPlayer = NULL; |
| 1432 | |
| 1433 | pContext->LocalToPhysAddr(params[1], &addr); |
| 1434 | numClients = params[2]; |
| 1435 | |
| 1436 | /* Client validation */ |
| 1437 | for (unsigned int i = 0; i < numClients; i++) |
| 1438 | { |
| 1439 | client = addr[i]; |
| 1440 | pPlayer = playerhelpers->GetGamePlayer(client); |
| 1441 | |
| 1442 | if (!pPlayer) |
| 1443 | { |
| 1444 | return pContext->ThrowNativeError("Client index %d is invalid", client); |
| 1445 | } else if (!pPlayer->IsInGame()) { |
| 1446 | return pContext->ThrowNativeError("Client %d is not in game", client); |
| 1447 | } |
| 1448 | } |
| 1449 | |
| 1450 | crf.Initialize(addr, numClients); |
| 1451 | |
| 1452 | int sentence = params[3]; |
| 1453 | int entity = SoundReferenceToIndex(params[4]); |
| 1454 | int channel = params[5]; |
| 1455 | int level = params[6]; |
| 1456 | int flags = params[7]; |
| 1457 | float vol = sp_ctof(params[8]); |
| 1458 | int pitch = params[9]; |
| 1459 | int speakerentity = params[10]; |
| 1460 | |
| 1461 | Vector *pOrigin = NULL, origin; |
| 1462 | Vector *pDir = NULL, dir; |
| 1463 | |
| 1464 | pContext->LocalToPhysAddr(params[11], &addr); |
| 1465 | if (addr != pContext->GetNullRef(SP_NULL_VECTOR)) |
| 1466 | { |
| 1467 | pOrigin = &origin; |
| 1468 | origin.x = sp_ctof(addr[0]); |
| 1469 | origin.y = sp_ctof(addr[1]); |
| 1470 | origin.z = sp_ctof(addr[2]); |
| 1471 | } |
| 1472 | |
| 1473 | pContext->LocalToPhysAddr(params[12], &addr); |
| 1474 | if (addr != pContext->GetNullRef(SP_NULL_VECTOR)) |
| 1475 | { |
| 1476 | pDir = &dir; |
| 1477 | dir.x = sp_ctof(addr[0]); |
| 1478 | dir.y = sp_ctof(addr[1]); |
| 1479 | dir.z = sp_ctof(addr[2]); |
| 1480 | } |
| 1481 | |
| 1482 | bool updatePos = params[13] ? true : false; |
nothing calls this directly
no test coverage detected