| 598 | } |
| 599 | |
| 600 | void GameConnection::setCameraObject(GameBase *obj) |
| 601 | { |
| 602 | if(mCameraObject == obj) |
| 603 | return; |
| 604 | |
| 605 | if(mCameraObject && mCameraObject != mControlObject) |
| 606 | mCameraObject->setControllingClient(0); |
| 607 | |
| 608 | if(obj) |
| 609 | { |
| 610 | // nothing else is permitted to control this object |
| 611 | if(GameBase *coo = obj->getControllingObject()) |
| 612 | coo->setControlObject(0); |
| 613 | |
| 614 | if(GameConnection *con = obj->getControllingClient()) |
| 615 | { |
| 616 | if(this != con) |
| 617 | { |
| 618 | // was it controlled via camera or control |
| 619 | if(con->getControlObject() == obj) |
| 620 | con->setControlObject(0); |
| 621 | else |
| 622 | con->setCameraObject(0); |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | // we are now the controlling client of this object |
| 627 | obj->setControllingClient(this); |
| 628 | } |
| 629 | |
| 630 | // Okay, set our camera object. |
| 631 | mCameraObject = obj; |
| 632 | |
| 633 | if(mCameraObject.isNull()) |
| 634 | setScopeObject(mControlObject); |
| 635 | else |
| 636 | { |
| 637 | setScopeObject(mCameraObject); |
| 638 | |
| 639 | // if this is a client then set the fov and active image |
| 640 | if(isConnectionToServer()) |
| 641 | { |
| 642 | F32 fov = mCameraObject->getDefaultCameraFov(); |
| 643 | //GameSetCameraFov(fov); |
| 644 | smFovUpdate.trigger(fov); |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | } |
| 649 | |
| 650 | GameBase* GameConnection::getCameraObject() |
| 651 | { |
no test coverage detected