void FPSUnitController::SendStateUpdate() { if (!gu->fpsMode) return; const bool* camMoveState = camera->GetMovState(); const CMouseHandler::ButtonPressEvt* mouseButtons = mouse->buttons; unsigned char state = 0; state |= ((camMoveState[CCamera::MOVE_STATE_FWD]) * (1 << 0)); state |= ((camMoveState[CCamera::MOVE_STATE_BCK]) * (1 << 1)); state |= ((camMoveState[CCamera::MOVE_STATE_LFT]) * (1 << 2)); state |= ((camMoveState[CCamera::MOVE_STATE_RGT]) * (1 << 3)); state |= ((mouseButtons[SDL_BUTTON_LEFT ].pressed) * (1 << 4)); state |= ((mouseButtons[SDL_BUTTON_RIGHT].pressed) * (1 << 5)); shortint2 hp = GetHAndPFromVector(camera->forward); if (hp.x != oldHeading || hp.y != oldPitch || state != oldState) { oldHeading = hp.x; oldPitch = hp.y; oldState = state; net->Send(CBaseNetProtocol::Get().SendDirectControlUpdate(gu->myPlayerNum, state, hp.x, hp.y)); } }
inline void CScriptMoveType::CalcDirections() { CMatrix44f matrix; //matrix.Translate(-rotOffset); matrix.RotateY(-rot.y); matrix.RotateX(-rot.x); matrix.RotateZ(-rot.z); //matrix.Translate(rotOffset); owner->rightdir.x = -matrix[ 0]; owner->rightdir.y = -matrix[ 1]; owner->rightdir.z = -matrix[ 2]; owner->updir.x = matrix[ 4]; owner->updir.y = matrix[ 5]; owner->updir.z = matrix[ 6]; owner->frontdir.x = matrix[ 8]; owner->frontdir.y = matrix[ 9]; owner->frontdir.z = matrix[10]; const shortint2 HandP = GetHAndPFromVector(owner->frontdir); owner->heading = HandP.x; }
void FPSUnitController::SendStateUpdate(const bool* camMove) { if (!gu->fpsMode) { return; } unsigned char state = 0; if (camMove[0]) { state |= (1 << 0); } if (camMove[1]) { state |= (1 << 1); } if (camMove[2]) { state |= (1 << 2); } if (camMove[3]) { state |= (1 << 3); } if (mouse->buttons[SDL_BUTTON_LEFT].pressed) { state |= (1 << 4); } if (mouse->buttons[SDL_BUTTON_RIGHT].pressed) { state |= (1 << 5); } shortint2 hp = GetHAndPFromVector(camera->forward); if (hp.x != oldHeading || hp.y != oldPitch || state != oldState) { oldHeading = hp.x; oldPitch = hp.y; oldState = state; net->Send(CBaseNetProtocol::Get().SendDirectControlUpdate(gu->myPlayerNum, state, hp.x, hp.y)); } }