Example #1
0
bool CShareBox::IsAbove(int x, int y)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	return InBox(mx, my, box);
}
Example #2
0
std::string CShareBox::GetTooltip(int x, int y)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	if (InBox(mx, my, box + okBox)) {
		return "Shares the selected stuff and close dialog";
	} else if (InBox(mx, my, box + applyBox)) {
		return "Shares the selected stuff";
	} else if (InBox(mx, my, box + cancelBox)) {
		return "Close this dialog without sharing";
	} else if (InBox(mx, my, box + unitBox)) {
		return "Toggles if you want to share your\ncurrently selected units";
	} else if (InBox(mx, my, box + metalBox)) {
		return "Click here to select how much metal to share";
	} else if (InBox(mx, my, box + energyBox)) {
		return "Click here to select how much energy to share";
	} else if (hasScroll && InBox(mx, my, box + scrollBox)) {
		return "Scroll the team list here";
	} else if (hasScroll && InBox(mx, my, box + scrollbarBox)) {
		return "Scroll the team list here";
	} else if (InBox(mx, my, box + teamBox)) {
		return "Select which team to share to";
	} else if (InBox(mx, my, box)) {
		return " ";
	} else {
		return "";
	}
}
Example #3
0
bool ProfileDrawer::MousePress(int x, int y, int button)
{
	GML_STDMUTEX_LOCK_NOPROF(time); // MousePress

	const float mx = MouseX(x);
	const float my = MouseY(y);

	// check if a Timer selection box was hit
	if (mx<start_x || mx>end_x || my<end_y-profiler.profile.size()*0.024f-0.01f || my>end_y) {
		return false;
	}

	const int selIndex = (int) ((end_y - my) / 0.024f);

	// switch the selected Timers showGraph value
	if ((selIndex >= 0) && (selIndex < profiler.profile.size())) {
		std::map<std::string, CTimeProfiler::TimeRecord>::iterator pi = profiler.profile.begin();
		for (int i = 0; i < selIndex; i++) {
			++pi;
		}
		pi->second.showGraph = !pi->second.showGraph;
	}

	return false;
}
Example #4
0
std::string CQuitBox::GetTooltip(int x, int y)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	const ContainerBox boxes[] = {
		resignBox, saveBox, giveAwayBox, scrollBox, scrollbarBox, teamBox, cancelBox, menuBox, quitBox
	};
	const char* toolTips[] = {
		"Resign the match; remain in the game",
		"Save the current game state to a file \nfor later reload",
		"Give away all units and resources \nto the team specified below",
		"Scroll the team list here",
		"Scroll the team list here",
		"Select which team receives everything",
		"Return to the game",
		"Return to menu; quit the game",
		"Return to system; quit the game",
	};

	const char* toolTip = "";

	for (unsigned int n = 0; n < (sizeof(boxes) / sizeof(boxes[0])); n++) {
		if (!InBox(mx, my, box + boxes[n]))
			continue;

		toolTip = toolTips[n];
		break;
	}

	return toolTip;
}
Example #5
0
bool CglList::MouseUpdate(int x, int y)
{
	float mx = MouseX(x);
	float my = MouseY(y);

	int nCurIndex = 0; // The item we're on
	int nDrawOffset = 0; // The offset to the first draw item
	ContainerBox b = box;

	// Get list started up here
	std::vector<std::string>::iterator ii = filteredItems->begin();
	// Skip to current selection - 3; ie: scroll
	while ((nCurIndex + 7) <= place && nCurIndex+13 <= filteredItems->size()) { ii++; nCurIndex++; }

	for (/*ii = items.begin()*/; ii != filteredItems->end() && nDrawOffset < 12; ii++)
	{
		b.y2 = box.y2 - 0.06f - (nDrawOffset * 0.06f);
		b.y1 = b.y2 - 0.05f;

		if (InBox(mx, my, b)) {
			place = nCurIndex;
			return true;
		}

		// Up our index's
		nCurIndex++; nDrawOffset++;
	}
	return false;
}
Example #6
0
bool CStartPosSelecter::MousePress(int x, int y, int button)
{
	float mx = MouseX(x);
	float my = MouseY(y);
	if ((showReady && InBox(mx, my, readyBox)) || gs->frameNum > 0) {
		return !Ready();
	}

	float dist=ground->LineGroundCol(camera->pos,camera->pos+mouse->dir*globalRendering->viewRange*1.4f);
	if(dist<0)
		return true;

	startPosSet = true;
	inMapDrawer->SendErase(startPos);
	startPos = camera->pos + mouse->dir * dist;

	if(startPos.z<gameSetup->allyStartingData[gu->myAllyTeam].startRectTop *gs->mapy*8)
		startPos.z=gameSetup->allyStartingData[gu->myAllyTeam].startRectTop*gs->mapy*8;

	if(startPos.z>gameSetup->allyStartingData[gu->myAllyTeam].startRectBottom*gs->mapy*8)
		startPos.z=gameSetup->allyStartingData[gu->myAllyTeam].startRectBottom*gs->mapy*8;

	if(startPos.x<gameSetup->allyStartingData[gu->myAllyTeam].startRectLeft*gs->mapx*8)
		startPos.x=gameSetup->allyStartingData[gu->myAllyTeam].startRectLeft*gs->mapx*8;

	if(startPos.x>gameSetup->allyStartingData[gu->myAllyTeam].startRectRight*gs->mapx*8)
		startPos.x=gameSetup->allyStartingData[gu->myAllyTeam].startRectRight*gs->mapx*8;

	net->Send(CBaseNetProtocol::Get().SendStartPos(gu->myPlayerNum, gu->myTeam, 0, startPos.x, startPos.y, startPos.z));

	return true;
}
Example #7
0
bool CResourceBar::MousePress(int x, int y, int button)
{
    if (!enabled) {
        return false;
    }

    const float mx = MouseX(x);
    const float my = MouseY(y);

    if (InBox(mx, my, box)) {
        moveBox = true;
        if (!gu->spectating) {
            if (InBox(mx, my, box + metalBox)) {
                moveBox = false;
                const float metalShare = std::max(0.f, std::min(1.f, (mx - (box.x1 + metalBox.x1)) / (metalBox.x2 - metalBox.x1)));
                net->Send(CBaseNetProtocol::Get().SendSetShare(gu->myPlayerNum, gu->myTeam, metalShare, teamHandler->Team(gu->myTeam)->energyShare));
            }
            if (InBox(mx, my, box + energyBox)) {
                moveBox = false;
                const float energyShare = std::max(0.f, std::min(1.f, (mx - (box.x1 + energyBox.x1)) / (energyBox.x2 - energyBox.x1)));
                net->Send(CBaseNetProtocol::Get().SendSetShare(gu->myPlayerNum, gu->myTeam, teamHandler->Team(gu->myTeam)->metalShare, energyShare));
            }
        }
        return true;
    }
    return false;
}
Example #8
0
void CShareBox::MouseRelease(int x, int y, int button)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);
	scrolling = false;
	scrollGrab = 0.0f;

	if (InBox(mx, my, box + unitBox)) {
		shareUnits = !shareUnits;
	}
	if ((InBox(mx, my, box + okBox) || InBox(mx, my, box + applyBox)) &&
			 shareTeam != -1 && !teamHandler->Team(shareTeam)->isDead && !teamHandler->Team(gu->myTeam)->isDead) {
		if (shareUnits) {
			Command c(CMD_STOP);
			// make sure the units are stopped and that the selection is transmitted
			selectedUnits.GiveCommand(c, false);
		}
		net->Send(CBaseNetProtocol::Get().SendShare(gu->myPlayerNum, shareTeam, shareUnits, metalShare * teamHandler->Team(gu->myTeam)->metal, energyShare * teamHandler->Team(gu->myTeam)->energy));
		if (shareUnits) {
			selectedUnits.ClearSelected();
		}
		lastShareTeam = shareTeam;
	}
	if (InBox(mx, my, box + okBox) || InBox(mx, my, box + cancelBox)) {
		delete this;
		return;
	}
	moveBox    = false;
	metalMove  = false;
	energyMove = false;
}
bool CShareBox::MousePress(int x, int y, int button)
{
	float mx=MouseX(x);
	float my=MouseY(y);
	if(InBox(mx,my,box)){
		moveBox=true;
		if(InBox(mx,my,box+okBox) || InBox(mx,my,box+applyBox) || InBox(mx,my,box+cancelBox) || InBox(mx,my,box+unitBox) || InBox(mx,my,box+metalBox) || InBox(mx,my,box+energyBox) || InBox(mx,my,box+teamBox))
			moveBox=false;
		if(InBox(mx,my,box+metalBox)){
			metalMove = true;
			metalShare = std::max(0.f, std::min(1.f,(mx-box.x1-metalBox.x1)/(metalBox.x2-metalBox.x1)));
		}
		if(InBox(mx,my,box+energyBox)){
			energyMove = true;
			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<gs->activeTeams && !gs->Team(team)->isDead)
				shareTeam=team;
		}
		return true;
	}
	return false;
}
Example #10
0
bool CQuitBox::IsAbove(int x, int y)
{
    float mx=MouseX(x);
    float my=MouseY(y);
    if(InBox(mx,my,box))
        return true;
    return false;
}
bool CTimeProfiler::IsAbove(int x, int y)
{
	float mx=MouseX(x);
	float my=MouseY(y);

	if(!gu->drawdebug || mx<0.65f || mx>0.99f || my<0.99f-profile.size()*0.024f-0.01f || my>0.99f)
		return false;

	return true;
}
Example #12
0
bool CResourceBar::IsAbove(int x, int y)
{
    if (!enabled) {
        return false;
    }

    const float mx = MouseX(x);
    const float my = MouseY(y);
    return InBox(mx, my, box);
}
Example #13
0
bool ProfileDrawer::IsAbove(int x, int y)
{
	GML_STDMUTEX_LOCK_NOPROF(time); // IsAbove

	const float mx=MouseX(x);
	const float my=MouseY(y);

	if(mx<0.65f || mx>0.99f || my<0.99f - profiler.profile.size()*0.024f-0.01f || my>0.99f)
		return false;

	return true;
}
Example #14
0
bool CTooltipConsole::IsAbove(int x,int y)
{
	if (disabled) {
		return false;
	}

	const float mx = MouseX(x);
	const float my = MouseY(y);

	return ((mx > (x + 0.01f)) && (mx < (x + w)) &&
	        (my > (y + 0.01f)) && (my < (y + h)));
}
bool CResourceBar::IsAbove(int x, int y)
{
	if (disabled) {
		return false;
	}

	const float mx=MouseX(x);
	const float my=MouseY(y);
	if(InBox(mx,my,box))
		return true;
	return false;
}
bool CEndGameBox::IsAbove(int x, int y)
{
	if (disabled) {
		return false;
	}

	float mx=MouseX(x);
	float my=MouseY(y);
	if(InBox(mx,my,box))
		return true;
	return false;
}
Example #17
0
void CQuitBox::MouseRelease(int x,int y,int button)
{
	float mx=MouseX(x);
	float my=MouseY(y);

	if(InBox(mx,my,box+resignQuitBox) || InBox(mx,my,box+resignBox) || InBox(mx,my,box+giveAwayBox) && !gs->Team(shareTeam)->isDead && !gs->Team(gu->myTeam)->isDead){
		set<CUnit*>* tu=&gs->Team(gu->myTeam)->units;
		//select all units
		selectedUnits.ClearSelected();
		for(set<CUnit*>::iterator ui=tu->begin();ui!=tu->end();++ui){
			selectedUnits.AddUnit(*ui);
		}
		Command c;
		// give away all units (and resources)
		if(InBox(mx,my,box+giveAwayBox)){
			//make sure the units are stopped and that the selection is transmitted
			c.id=CMD_STOP;
			selectedUnits.GiveCommand(c,false);
			net->SendData<unsigned char, unsigned char, unsigned char, float, float>(
				NETMSG_SHARE, gu->myPlayerNum, shareTeam, true,
				gs->Team(gu->myTeam)->metal, gs->Team(gu->myTeam)->energy);
			selectedUnits.ClearSelected();
			// inform other users of the giving away of units
			char givenAwayMsg[200];
			sprintf(givenAwayMsg,"%s gave everything to %s.",
				gs->players[gu->myPlayerNum]->playerName.c_str(),
				gs->players[gs->Team(shareTeam)->leader]->playerName.c_str());
			net->SendSTLData<unsigned char, std::string>(NETMSG_CHAT, gu->myPlayerNum, givenAwayMsg);
		}
		// resign, so self-d all units
		if(InBox(mx,my,box+resignQuitBox) || InBox(mx,my,box+resignBox)) {
			c.id=CMD_SELFD;
			selectedUnits.GiveCommand(c,false);
		}
		// (resign and) quit, so leave the game
		if(InBox(mx,my,box+resignQuitBox)){
			logOutput.Print("User exited");
			globalQuit=true;
		}
	}
	else if(InBox(mx,my,box+quitBox))
	{
		logOutput.Print("User exited");
		globalQuit=true;
	}
	// if we're still in the game, remove the resign box
	if(InBox(mx,my,box+resignQuitBox) || InBox(mx,my,box+resignBox) || InBox(mx,my,box+giveAwayBox) || InBox(mx,my,box+cancelBox)){
		delete this;
		return;
	}
	moveBox=false;
}
Example #18
0
bool ProfileDrawer::IsAbove(int x, int y)
{
	GML_STDMUTEX_LOCK_NOPROF(time); // IsAbove

	const float mx = MouseX(x);
	const float my = MouseY(y);

	// check if a Timer selection box was hit
	if (mx<start_x || mx>end_x || my<end_y - profiler.profile.size()*0.024f-0.01f || my>end_y) {
		return false;
	}

	return true;
}
Example #19
0
void CQuitBox::MouseRelease(int x,int y,int button)
{
	float mx=MouseX(x);
	float my=MouseY(y);

	scrolling = false;
	scrollGrab = 0.0f;

	if(InBox(mx,my,box+resignBox)
	   || (InBox(mx,my,box+saveBox) && !teamHandler->Team(gu->myTeam)->isDead)
	   || (InBox(mx,my,box+giveAwayBox) && !teamHandler->Team(shareTeam)->isDead && !teamHandler->Team(gu->myTeam)->isDead)) {
		// give away all units (and resources)
		if(InBox(mx,my,box+giveAwayBox) && !playerHandler->Player(gu->myPlayerNum)->spectator) {
			net->Send(CBaseNetProtocol::Get().SendGiveAwayEverything(gu->myPlayerNum, shareTeam, playerHandler->Player(gu->myPlayerNum)->team));
		}
		// resign, so self-d all units
		if (InBox(mx,my,box+resignBox) && !playerHandler->Player(gu->myPlayerNum)->spectator) {
			net->Send(CBaseNetProtocol::Get().SendResign(gu->myPlayerNum));
		}
		// save current game state
		if (InBox(mx,my,box+saveBox)) {
			if (FileSystem::CreateDirectory("Saves")) {
				std::string timeStr = CTimeUtil::GetCurrentTimeStr();
				std::string saveFileName(timeStr + "_" + modInfo.filename + "_" + gameSetup->mapName);
				saveFileName = "Saves/" + saveFileName + ".ssf";
				if (!FileSystem::FileExists(saveFileName)) {
					LOG("Saving game to %s", saveFileName.c_str());
					ILoadSaveHandler* ls = ILoadSaveHandler::Create();
					ls->mapName = gameSetup->mapName;
					ls->modName = modInfo.filename;
					ls->SaveGame(saveFileName);
					delete ls;
				} else {
					LOG_L(L_ERROR, "File %s already exists, game NOT saved!",
							saveFileName.c_str());
				}
			}
		}
	}
	else if (InBox(mx, my, box + quitBox)) {
		LOG("User exited");
		gu->globalQuit = true;
	}
	// if we're still in the game, remove the resign box
	if(InBox(mx,my,box+resignBox) || InBox(mx,my,box+saveBox) || InBox(mx,my,box+giveAwayBox) || InBox(mx,my,box+cancelBox) || InBox(mx,my,box+quitBox)){
		delete this;
		return;
	}
	moveBox=false;
}
Example #20
0
bool CShareBox::MousePress(int x, int y, int button)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	if (InBox(mx, my, box)) {
		moveBox = true;
		if (InBox(mx, my, box + okBox) ||
				InBox(mx, my, box + applyBox) ||
				InBox(mx, my, box + cancelBox) ||
				InBox(mx, my, box + unitBox) ||
				InBox(mx, my, box + metalBox) ||
				InBox(mx, my, box + energyBox) ||
				InBox(mx, my, box + teamBox) ||
				InBox(mx, my, box + scrollbarBox) ||
				InBox(mx, my, box + scrollBox)) {
			moveBox = false;
		}
		if (InBox(mx, my, box + metalBox)) {
			metalMove = true;
			metalShare = std::max(0.f, std::min(1.f, (mx-box.x1-metalBox.x1)/(metalBox.x2-metalBox.x1)));
		}
		if (InBox(mx, my, box + energyBox)) {
			energyMove = true;
			energyShare = std::max(0.f, std::min(1.f, (mx-box.x1-energyBox.x1)/(energyBox.x2-energyBox.x1)));
		}
		if (hasScroll && InBox(mx, my, box + scrollBox)) {
			scrolling = true;
			scrollGrab = (box + scrollBox).y2 - my;
		}
		else if (hasScroll && InBox(mx, my, box + scrollbarBox)) {
			if(my < (box + scrollBox).y1)
				*(volatile int *)&startTeam = startTeam + std::min(MAX_SHARE_TEAMS - numTeamsDisp - startTeam, numTeamsDisp);
			if(my > (box + scrollBox).y2)
				*(volatile int *)&startTeam = startTeam - std::min(startTeam, numTeamsDisp);
		}
		else if (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;
			}
		}
		return true;
	}
	return false;
}
std::string CResourceBar::GetTooltip(int x, int y)
{
	const float mx=MouseX(x);

	if (mx < (box.x1 + 0.36f)) {
		return "Shows your stored metal as well as\n"
		       "income(green) and expenditures (red)\n"
		       "Click in the bar to select your\n"
		       "auto share level";
	}
	return "Shows your stored energy as well as\n"
	       "income(green) and expenditures (red)\n"
	       "Click in the bar to select your\n"
	       "auto share level";
}
Example #22
0
std::string CResourceBar::GetTooltip(int x, int y)
{
    const float mx = MouseX(x);

    std::string resourceName;
    if (mx < (box.x1 + 0.36f)) {
        resourceName = "metal";
    } else {
        resourceName = "energy";
    }

    return "Shows your stored " + resourceName + " as well as\n"
           "income(\xff\x40\xff\x40green\xff\xff\xff\xff) and expenditures (\xff\xff\x20\x20red\xff\xff\xff\xff).\n"
           "Click in the bar to select your\n"
           "AutoShareLevel.";
}
Example #23
0
bool CQuitBox::MousePress(int x, int y, int button)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	const ContainerBox boxes[] = {resignBox, saveBox, giveAwayBox, teamBox, cancelBox, menuBox, quitBox, scrollbarBox, scrollBox};

	if (!InBox(mx, my, box))
		return false;

	moveBox = true;

	for (unsigned int n = 0; n < (sizeof(boxes) / sizeof(boxes[0])); n++) {
		if (!InBox(mx, my, box + boxes[n]))
			continue;

		moveBox = false;
		break;
	}

	if (hasScroll && InBox(mx, my, box + scrollBox)) {
		scrolling = true;
		scrollGrab = (box + scrollBox).y2 - my;
	}
	else if (hasScroll && InBox(mx, my, box + scrollbarBox)) {
		if (my < (box + scrollBox).y1)
			*(volatile int *)&startTeam = startTeam + std::min(MAX_QUIT_TEAMS - numTeamsDisp - startTeam, numTeamsDisp);
		if (my > (box + scrollBox).y2)
			*(volatile int *)&startTeam = startTeam - std::min(startTeam, numTeamsDisp);
	}
	else if (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;
			}
		}
	}

	return true;
}
bool CTimeProfiler::MousePress(int x, int y, int button)
{
	float mx=MouseX(x);
	float my=MouseY(y);

	if(!gu->drawdebug || mx<0.65f || mx>0.99f || my<0.99f-profile.size()*0.024f-0.01f || my>0.99f)
		return false;

	int num=(int) ((0.99f-my)/0.024f);

	int a=0;
	map<string,TimeRecord>::iterator pi;
	for(pi=profile.begin();pi!=profile.end() && a!=num;++pi,a++){
	}
	if(pi!=profile.end())
		pi->second.showGraph=!pi->second.showGraph;
	return false;
}
std::string CEndGameBox::GetTooltip(int x, int y)
{
	if (disabled) {
		return "";
	}

	float mx=MouseX(x);

	if(dispMode==0){
		if(mx>box.x1+0.02f && mx<box.x1+0.1f*6){
			string tips[]={"Player Name","Mouse clicks per minute","Mouse movement in pixels per minute","Keyboard presses per minute","Unit commands per minute","Average command size (units affected per command)"};

			return tips[int((mx-box.x1-0.01f)*10)];
		}
	}

	return "No tooltip defined";
}
bool CStartPosSelecter::MousePress(int x, int y, int button)
{
	float mx=MouseX(x);
	float my=MouseY(y);
	if(InBox(mx,my,readyBox) && gs->Team(gu->myTeam)->startPos.y!=-500){
		gameSetup->readyTeams[gu->myTeam]=true;
		net->SendData<unsigned char, unsigned char, float, float, float>(
				NETMSG_STARTPOS, gu->myTeam, 1,
				gs->Team(gu->myTeam)->startPos.x, /* why not a float3? */
				gs->Team(gu->myTeam)->startPos.y,
				gs->Team(gu->myTeam)->startPos.z);
		delete this;
		return false;
	}
	float dist=ground->LineGroundCol(camera->pos,camera->pos+mouse->dir*gu->viewRange*1.4f);
	if(dist<0)
		return true;
	float3 pos=camera->pos+mouse->dir*dist;
	
	if(pos.z<gameSetup->startRectTop[gu->myAllyTeam]*gs->mapy*8)
		pos.z=gameSetup->startRectTop[gu->myAllyTeam]*gs->mapy*8;

	if(pos.z>gameSetup->startRectBottom[gu->myAllyTeam]*gs->mapy*8)
		pos.z=gameSetup->startRectBottom[gu->myAllyTeam]*gs->mapy*8;

	if(pos.x<gameSetup->startRectLeft[gu->myAllyTeam]*gs->mapx*8)
		pos.x=gameSetup->startRectLeft[gu->myAllyTeam]*gs->mapx*8;

	if(pos.x>gameSetup->startRectRight[gu->myAllyTeam]*gs->mapx*8)
		pos.x=gameSetup->startRectRight[gu->myAllyTeam]*gs->mapx*8;

	inMapDrawer->ErasePos(gs->Team(gu->myTeam)->startPos);

	net->SendData<unsigned char, unsigned char, float, float, float>(
			NETMSG_STARTPOS, gu->myTeam, 0, pos.x, pos.y, pos.z);

	char t[500];
	sprintf(t,"Start %i",gu->myTeam);
	inMapDrawer->CreatePoint(pos,t);

	return true;
}
bool CStartPosSelecter::MousePress(int x, int y, int button)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	if ((showReadyBox && InBox(mx, my, readyBox)) || gs->frameNum > 0)
		return (!Ready(false));

	const float dist = CGround::LineGroundCol(camera->GetPos(), camera->GetPos() + mouse->dir * globalRendering->viewRange * 1.4f, false);

	if (dist < 0.0f)
		return true;

	inMapDrawer->SendErase(setStartPos);
	startPosSet = true;
	setStartPos = camera->GetPos() + mouse->dir * dist;
	clientNet->Send(CBaseNetProtocol::Get().SendStartPos(gu->myPlayerNum, gu->myTeam, CPlayer::PLAYER_RDYSTATE_UPDATED, setStartPos.x, setStartPos.y, setStartPos.z));

	return true;
}
Example #28
0
bool ProfileDrawer::MousePress(int x, int y, int button)
{
	GML_STDMUTEX_LOCK_NOPROF(time); // MousePress

	float mx=MouseX(x);
	float my=MouseY(y);

	if(mx<0.65f || mx>0.99f || my<0.99f-profiler.profile.size()*0.024f-0.01f || my>0.99f)
		return false;

	int num=(int) ((0.99f-my)/0.024f);

	int a=0;
	std::map<std::string, CTimeProfiler::TimeRecord>::iterator pi;
	for(pi=profiler.profile.begin();pi!=profiler.profile.end() && a!=num;++pi,a++){
	}
	if(pi!=profiler.profile.end())
		pi->second.showGraph=!pi->second.showGraph;
	return false;
}
Example #29
0
std::string CQuitBox::GetTooltip(int x, int y)
{
	float mx=MouseX(x);
	float my=MouseY(y);

	if(InBox(mx,my,box+resignBox))
		return "Resign the match, remain in the game";
	if(InBox(mx,my,box+saveBox))
		return "Save the current game state to a file \nfor later reload";
	if(InBox(mx,my,box+giveAwayBox))
		return "Give away all units and resources \nto the team specified below";
	if(InBox(mx,my,box+teamBox))
		return "Select which team recieves everything";
	if(InBox(mx,my,box+cancelBox))
		return "Return to the game";
	if(InBox(mx,my,box+quitBox))
		return "Forget about the other players and quit";
	if(InBox(mx,my,box))
		return " ";
	return "";
}
Example #30
0
std::string CQuitBox::GetTooltip(int x, int y)
{
	float mx=MouseX(x);
	float my=MouseY(y);

	if(InBox(mx,my,box+resignQuitBox))
		return "Resign the match, and quit the game. Units will self-destruct";
	if(InBox(mx,my,box+resignBox))
		return "Resign the match, remain in the game. Units will self-destruct";
	if(InBox(mx,my,box+giveAwayBox))
		return "Give away all units and resources \nto the team specified below";
	if(InBox(mx,my,box+teamBox))
		return "Select which team recieves everything";
	if(InBox(mx,my,box+cancelBox))
		return "Return to the game";
	if(InBox(mx,my,box+quitBox))
		return "Forget about the other players and quit";
	if(InBox(mx,my,box))
		return " ";
	return "";
}