| 125 | } |
| 126 | |
| 127 | void TwoPlayerModule::onPreUpdate(GlobedGJBGL* gjbgl, float dt) { |
| 128 | auto ghost = gjbgl->m_fields->m_ghost.get(); |
| 129 | PlayerObject* noclipFor = this->isPlayer2() ? gjbgl->m_player1 : gjbgl->m_player2; |
| 130 | PlayerObject* noclipForVP = this->isPlayer2() ? ghost->player1() : ghost->player2(); |
| 131 | auto pobj = this->getLinkedPlayerObject(!this->isPlayer2()); |
| 132 | if (!noclipFor || !pobj) return; |
| 133 | |
| 134 | auto& lerper = gjbgl->m_fields->m_interpolator; |
| 135 | lerper.setCameraCorrections(!this->isPlayer2()); |
| 136 | |
| 137 | this->updateFromLinkedPlayer(noclipFor, pobj); |
| 138 | if (!gjbgl->m_gameState.m_isDualMode && this->isPlayer2()) { |
| 139 | gjbgl->setCameraFollowPlayer(pobj); |
| 140 | gjbgl->setSpectating(true); |
| 141 | } else { |
| 142 | gjbgl->setCameraFollowPlayer(nullptr); |
| 143 | gjbgl->setSpectating(false); |
| 144 | } |
| 145 | |
| 146 | // hide player1 if we are player 2 |
| 147 | setPlayerHidden(gjbgl->m_player1, this->isPlayer2()); |
| 148 | |
| 149 | setPlayerHidden(noclipFor, true); |
| 150 | setPlayerHidden(noclipForVP, true); |
| 151 | } |
| 152 | |
| 153 | void TwoPlayerModule::updateFromLinkedPlayer(PlayerObject* local, VisualPlayer* linked) { |
| 154 | bool shouldUpdateArt = |
nothing calls this directly
no test coverage detected