| 1542 | |
| 1543 | |
| 1544 | void handleAliveMessage(void* msg) { |
| 1545 | PlayerId id; |
| 1546 | fvec3 pos; |
| 1547 | float forward; |
| 1548 | |
| 1549 | msg = nboUnpackUInt8(msg, id); |
| 1550 | msg = nboUnpackFVec3(msg, pos); |
| 1551 | msg = nboUnpackFloat(msg, forward); |
| 1552 | int playerIndex = lookupPlayerIndex(id); |
| 1553 | |
| 1554 | if ((playerIndex < 0) && (playerIndex != -2)) { |
| 1555 | return; |
| 1556 | } |
| 1557 | Player* tank = getPlayerByIndex(playerIndex); |
| 1558 | if (tank == NULL) { |
| 1559 | return; |
| 1560 | } |
| 1561 | |
| 1562 | if (tank == myTank) { |
| 1563 | wasRabbit = tank->getTeam() == RabbitTeam; |
| 1564 | myTank->restart(pos, forward); |
| 1565 | myTank->setShotType(StandardShot); |
| 1566 | firstLife = false; |
| 1567 | justJoined = false; |
| 1568 | |
| 1569 | if (!myTank->isAutoPilot()) { |
| 1570 | mainWindow->warpMouse(); |
| 1571 | } |
| 1572 | |
| 1573 | hud->setAltitudeTape(myTank->canJump()); |
| 1574 | } |
| 1575 | #ifdef ROBOT |
| 1576 | else if (tank->getPlayerType() == ComputerPlayer) { |
| 1577 | for (int r = 0; r < numRobots; r++) { |
| 1578 | if (robots[r] && robots[r]->getId() == playerIndex) { |
| 1579 | robots[r]->restart(pos, forward); |
| 1580 | setRobotTarget(robots[r]); |
| 1581 | break; |
| 1582 | } |
| 1583 | } |
| 1584 | } |
| 1585 | #endif |
| 1586 | |
| 1587 | if (SceneRenderer::instance().useQuality() >= _MEDIUM_QUALITY) { |
| 1588 | if (((tank != myTank) && ((ROAM.getMode() != Roaming::roamViewFP) || |
| 1589 | (tank != ROAM.getTargetTank()))) |
| 1590 | || BZDB.isTrue("enableLocalSpawnEffect")) { |
| 1591 | if (myTank->getFlagType() != Flags::Colorblindness) { |
| 1592 | static fvec4 cbColor(1.0f, 1.0f, 1.0f, 1.0f); |
| 1593 | EFFECTS.addSpawnEffect(cbColor, pos); |
| 1594 | } |
| 1595 | else { |
| 1596 | EFFECTS.addSpawnEffect(tank->getColor(), pos); |
| 1597 | } |
| 1598 | } |
| 1599 | } |
| 1600 | |
| 1601 | static const fvec3 zero(0.0f, 0.0f, 0.0f); |
no test coverage detected