void CQuitBox::MouseMove(int x, int y, int dx,int dy, int button) { float mx=MouseX(x); float my=MouseY(y); if(scrolling) { float scr = (box+scrollbarBox).y2 - (my + scrollGrab); float sz = scrollbarBox.y2 - scrollbarBox.y1; float tsz = sz / (float)MAX_QUIT_TEAMS; *(volatile int *)&startTeam = std::max(0, std::min((int)(scr / tsz + 0.5), MAX_QUIT_TEAMS - numTeamsDisp)); return; } if(moveBox) { box.x1+=MouseMoveX(dx); box.x2+=MouseMoveX(dx); box.y1+=MouseMoveY(dy); box.y2+=MouseMoveY(dy); } if(!(hasScroll && (InBox(mx, my, box + scrollBox) || InBox(mx, my, box + scrollbarBox))) && InBox(mx,my,box+teamBox)) { int team = startTeam + (int)((box.y1 + teamBox.y2 - my) / 0.025f); if(team>=gu->myTeam) team++; if(teamHandler->IsValidTeam(team) && !teamHandler->Team(team)->isDead) { // we don't want to give everything to the enemy if there are allies left if(noAlliesLeft || (!noAlliesLeft && teamHandler->Ally(gu->myAllyTeam, teamHandler->AllyTeam(team)))) { shareTeam=team; } } } }
void CEndGameBox::MouseMove(int x, int y, int dx,int dy, int button) { if (disabled) { return; } if(moveBox){ box.x1+=MouseMoveX(dx); box.x2+=MouseMoveX(dx); box.y1+=MouseMoveY(dy); box.y2+=MouseMoveY(dy); } }
void CQuitBox::MouseMove(int x, int y, int dx,int dy, int button) { float mx=MouseX(x); float my=MouseY(y); if(moveBox){ box.x1+=MouseMoveX(dx); box.x2+=MouseMoveX(dx); box.y1+=MouseMoveY(dy); box.y2+=MouseMoveY(dy); } if(InBox(mx,my,box+teamBox)){ int team=(int)((box.y1+teamBox.y2-my)/0.025f); if(team>=gu->myTeam) team++; if(team<gs->activeTeams && !gs->Team(team)->isDead){ // we don't want to give everything to the enemy if there are allies left if(noAlliesLeft || (!noAlliesLeft && gs->Ally(gu->myAllyTeam, gs->AllyTeam(team)))){ shareTeam=team; } } } }
void CShareBox::MouseMove(int x, int y, int dx, int dy, int button) { float mx=MouseX(x); float my=MouseY(y); if(moveBox){ box.x1+=MouseMoveX(dx); box.x2+=MouseMoveX(dx); box.y1+=MouseMoveY(dy); box.y2+=MouseMoveY(dy); } if(metalMove){ metalShare = std::max(0.f, std::min(1.f,(mx-box.x1-metalBox.x1)/(metalBox.x2-metalBox.x1))); } if(energyMove){ energyShare = std::max(0.f, std::min(1.f,(mx-box.x1-energyBox.x1)/(energyBox.x2-energyBox.x1))); } if(InBox(mx,my,box+teamBox)){ int team=(int)((box.y1+teamBox.y2-my)/0.025f); if(team>=gu->myTeam) team++; if(team<teamHandler->ActiveTeams() && !teamHandler->Team(team)->isDead) shareTeam=team; } }
void CShareBox::MouseMove(int x, int y, int dx, int dy, int button) { const float mx = MouseX(x); const float my = MouseY(y); if(scrolling) { float scr = (box+scrollbarBox).y2 - (my + scrollGrab); float sz = scrollbarBox.y2 - scrollbarBox.y1; float tsz = sz / (float)MAX_SHARE_TEAMS; *(volatile int *)&startTeam = std::max(0, std::min((int)(scr / tsz + 0.5), MAX_SHARE_TEAMS - numTeamsDisp)); return; } if (moveBox) { box.x1 += MouseMoveX(dx); box.x2 += MouseMoveX(dx); box.y1 += MouseMoveY(dy); box.y2 += MouseMoveY(dy); } if (metalMove) { metalShare = std::max(0.0f, std::min(1.0f, (mx - box.x1 - metalBox.x1) / (metalBox.x2 - metalBox.x1))); } if (energyMove) { energyShare = std::max(0.0f, std::min(1.0f, (mx - box.x1 - energyBox.x1) / (energyBox.x2 - energyBox.x1))); } if (!(hasScroll && (InBox(mx, my, box + scrollBox) || InBox(mx, my, box + scrollbarBox))) && InBox(mx, my, box + teamBox)) { int team = startTeam + (int) ((box.y1 + teamBox.y2 - my) / 0.025f); if (team >= gu->myTeam) { team++; } if (team < teamHandler->ActiveTeams() && !teamHandler->Team(team)->isDead) { shareTeam = team; } } }
Vector3 DirectInputController::MouseMoveXYZ() const { return Vector3(MouseMoveX(), MouseMoveY(), MouseMoveZ()); }
Vector2 DirectInputController::MouseMoveXY() const { return Vector2(MouseMoveX(), MouseMoveY()); }