Esempio n. 1
0
MSGClient* MSGServer::getMSGClient(SockClient* cli){
    MSGClient* client = 0x0;
    
    LinkedList<MSGClient*> activeClients;
    
    refreshClients();
    
    // loop through clients
    LinkedListIterator<MSGClient*> msgcit = cclients.getIterator();
    while(msgcit.hasNext()){
        MSGClient* c = msgcit.next();
        if(c->hasBroadcastClient(cli)) // has a serverclient socket?
            client = c;
    }
    
    // found client? If not, add to list if it's alive.
    if(client == 0x0 && cli != 0x0){
        if(cli->alive){
            client = new MSGClient(cli);
            activeClients.add(client);
        }
    }
    
    cclients.clear(); // clear old one
    cclients = activeClients;
    
    return client;
}
Esempio n. 2
0
// get channel
MSGClientChannel* MSGServer::getMSGChannel(CharString channelname){
    // loop through channels
    LinkedListIterator<MSGClientChannel*> msgcit = channels.getIterator();
    while(msgcit.hasNext()){
        MSGClientChannel* channel = msgcit.next();
        if(channel->channelname.compare(channelname)){
            return channel;
        }
    }
    
    // no channel by that name
    return 0x0;
}
	VisualObjectModel *VisualObjectModelStorage::getVisualObjectModel(const char *filename)
	{
		// TODO: optimize? is it necessary?
		LinkedListIterator iter = LinkedListIterator(models);
		while (iter.iterateAvailable())
		{
			VisualObjectModel *vom = (VisualObjectModel *)iter.iterateNext();
			if (filename == NULL && vom->getFilename() == NULL)
				return vom;
			if (vom->getFilename() != NULL && filename != NULL 
				&& strcmp(vom->getFilename(), filename) == 0)
				return vom;				
		}
		VisualObjectModel *newvom = new VisualObjectModel(filename);
		models->append(newvom);
		return newvom;
	}
Esempio n. 4
0
// only in-between broadcast servers
void MSGServer::shareClientIPID(MSGClient* client){
    LinkedListIterator<MSGClient*> bit = bservers.getIterator();
    SockClient* sc = client->getFirstBroadcastServer();
    CharString msgpack = "newid:";
    msgpack += sc->getAddr();
    msgpack += ":";
    msgpack += client->identity;
    
    while(bit.hasNext()){
        MSGClient* bserver = bit.next();
        if(!bserver->isbserver) continue;
        
        SockClient* bsc = bserver->getFirstBroadcastServer();
        if(bsc != 0x0){
            bsc->sendc(msgpack);
        }
    }
}
Esempio n. 5
0
MSGClient* MSGServer::getMSGClient(CharString identity){ // get from id
    refreshClients();
    
    // loop through clients
    LinkedListIterator<MSGClient*> msgcit = cclients.getIterator();
    while(msgcit.hasNext()){
        MSGClient* c = msgcit.next();
        
        // is an actual client?
        if(c != 0x0){
            if(c->identity.compare(identity)){
                return c;
            }
        }
    }
    
    // none!
    return 0x0;
}
Esempio n. 6
0
void MSGServer::refreshClients(){
    MSGClient* client = 0x0;
    
    LinkedList<MSGClient*> activeClients;
    
    // loop through clients
    LinkedListIterator<MSGClient*> msgcit = cclients.getIterator();
    while(msgcit.hasNext()){
        MSGClient* c = msgcit.next();
        
        // is an actual client?
        if(c != 0x0){
            if(c->checkBroadcastAlive()){ // quick check
                activeClients.add(c);
            }
        }
    }
    
    cclients.clear(); // clear old one
    cclients = activeClients;
}
Esempio n. 7
0
// return a list of dependencies with name:version string for missing/different version mods.
LinkedList<CharString> APIMod::getMissingDependencies(LinkedList<APIMod*> othermods){
    LinkedList<CharString> strs;
    LinkedListIterator<CharString> depstrs = dependencyversions.getIterator();
    
    while(depstrs.hasNext()){
        CharString depstr = depstrs.next();
        if(depstr.contains(":")){
            LinkedListIterator<APIMod*> modit = othermods.getIterator();
            bool identified = false;
            while(modit.hasNext()){
                APIMod *mod = modit.next();
                // compare direct
                if(unixname.compare(mod->unixname) && version.compareVersion(mod->versionstr)){
                    // not the same or and older version
                    identified = true; // same
                    break;
                }
            }
            
            if(!identified){
                strs.add(depstr); // "mod:version"
            }
            
        } // else invalid!
    }
    
    return strs;
}
Esempio n. 8
0
// LinkedList<LinkedList<CharString>> lines = SimpleParseFile(file, '\n');
void APIMod::loadProperties(){ // , CharString name, CharString language, CharString version
    if(propertiesloaded) return;

    LinkedList<LinkedList<CharString>> lines = SimpleParseString(getModFileData("mod.properties"), '=');

    CharString depvers = "";
    LinkedListIterator<LinkedList<CharString>> lineit = lines.getIterator();
    while(lineit.hasNext()){
        LinkedList<CharString> p = lineit.next();
        CharString pname = p[0];
        if(pname.compare(CharString("name")))
            this->name = p[1];
        else if(pname.compare(CharString("unixname")))
            this->unixname = p[1];
        else if(pname.compare(CharString("language"))) // c++, java, etc.
            this->language = p[1];
        else if(pname.compare(CharString("version"))){
            this->versionstr = p[1];
            this->version = APIModVersion(p[1]);
        }else if(pname.compare(CharString("dependency_versions")))
            depvers = p[1];
    }

    this->modcwdloc = unixname; // relative folder location for mod
    
    // load dependency versioning information
    //      this->dependencyversions.add("mod1:v12938");
    if(depvers.getSize() > 3){
        if(depvers.contains(", ")){
            depvers.replace(" ", "");
            LinkedList<CharString> v = depvers.split(",");
            this->dependencyversions.addAll(v);
        }else{
            this->dependencyversions.add(depvers);
        }
    }


    propertiesloaded=true;
}
Esempio n. 9
0
// figure out what mods have good dependencies
bool APIMod::compareModDependencies(LinkedList<APIMod*> othermods){
    LinkedListIterator<CharString> depstrs = dependencyversions.getIterator();
    
    while(depstrs.hasNext()){
        CharString depstr = depstrs.next();
        if(depstr.contains(":")){
            LinkedListIterator<APIMod*> modit = othermods.getIterator();
            while(modit.hasNext()){
                APIMod *mod = modit.next();
                // compare direct
                if(! version.compareVersion(mod->version)){
                    // not the same or and older version
                    return false;
                }
            }
            
        } // else invalid!
    }
}
Esempio n. 10
0
	bool ReconChecker::isReconAvailableAtPosition(Game *game, int player, const VC3 &position)
	{
		LinkedList *ulist = game->units->getAllUnits();
		LinkedListIterator iter = LinkedListIterator(ulist);

		while (iter.iterateAvailable())		
		{
			Unit *u = (Unit *)iter.iterateNext();
			
			// unit is friendly towards player?
			// (but player does not need to be friendly towards the unit ;)
			if (u->isActive() && !u->isDestroyed()				
				&& !game->isHostile(u->getOwner(), player)
				&& u->getReconValue() > 0
				&& u->getMoveState() != Unit::UNIT_MOVE_STATE_UNCONSCIOUS)
			{
				VC3 rayStartPosition = u->getPosition() + VC3(0, 2.0f, 0);
				VC3 target = position;
				float terrainHeight = game->gameMap->getScaledHeightAt(target.x, target.z);
				if (target.y < terrainHeight + 2.0f) target.y = terrainHeight + 2.0f;
				VC3 dir = target - rayStartPosition;
				float dirLen = dir.GetLength();
				dir.Normalize();

				if (dirLen > u->getUnitType()->getVisionRange() + 2.0f)
				{
					continue;
				}

				// TEMP!
				// ignore all small own units (1.5m)...
				// except the one we're trying to hit
				LinkedList *oul = game->units->getOwnedUnits(u->getOwner());
				LinkedListIterator iter = LinkedListIterator(oul);
				while (iter.iterateAvailable())
				{
					Unit *ou = (Unit *)iter.iterateNext();
					if (ou != u && ou->getUnitType()->getSize() <= 1.5f)
						ou->getVisualObject()->setCollidable(false);
				}

				// disable collision check for this unit
				u->getVisualObject()->setCollidable(false);

				GameCollisionInfo cinfo;
				game->getGameScene()->rayTrace(rayStartPosition, dir, (float)dirLen, cinfo, false, true);

				// collision check back
				u->getVisualObject()->setCollidable(true);				

				// TEMP!
				// restore them all...
				oul = game->units->getOwnedUnits(u->getOwner());
				iter = LinkedListIterator(oul);
				while (iter.iterateAvailable())
				{
					Unit *ou = (Unit *)iter.iterateNext();
					if (ou != u && ou->getUnitType()->getSize() <= 1.5f)
						ou->getVisualObject()->setCollidable(true);
				}

				if (cinfo.hit)
				{
					// 4 meters max dist.
					if (cinfo.range >= dirLen - 4.0f)
					{
						return true;
					}
				} else {
					return true;
				}
			}
		}
		return false;
	}
Esempio n. 11
0
void Data::changeDataFromFile(string inputFileName, char type)
{
	cout << "Loading";

	ostringstream rslt;
	ifstream inputData;
	inputData.open(inputFileName);

	if (!inputData)
	{
		throw exception("File could not be read.");
	}

	if (type != 'M' && type != 'P' && type != 'A')
	{
		throw exception("Invalid type: " + type);
	}

	string line;
	//Read the header line, but do nothing with it
	getline(inputData, line);

	//Declare necessary data
	Exosystem* currentSystem;
	Exoplanet* currentPlanet = nullptr;
	string starName;
	char planetName;
	int numberOfPlanets;
	double msini, a, per, ecc, om, t0, k;
	bool hasSingleStar;
	string message;
	bool hasAllInfo;

	//Step through each line in the data file until there are no more lines
	int lineNumber = 1;
	while (getline(inputData, line))
	{
		if (lineNumber % 25 == 0) cout << ".";
		lineNumber++;

		//Break line up into an array on commas
		int startIndex = 0;
		int endIndex = 0;
		int count = 0;
		string info[10];
		for (unsigned int i = 0; i < line.length(); i++)
		{
			if (line[i] == ',')
			{
				endIndex = i;
				info[count] = line.substr(startIndex, endIndex - startIndex);
				count++;
				//skip comma
				startIndex = i + 1;
			}
		}
		//Get the section from the last comma to the end
		info[count] = line.substr(startIndex, line.length() - startIndex);

		//Data validation
		hasAllInfo = true;
		if (count < 9)
		{
			hasAllInfo = false;
		}
		if (info[0].at(info[0].length() - 2) != ' ')
		{
			hasAllInfo = false;
		}
		for (int i = 0; i <= count; i++)
		{
			if (info[i].length() < 1)
			{
				//A field is blank
				hasAllInfo = false;
			}
		}

		starName = info[0].substr(0, info[0].length() - 2);

		//Exosystem info
		if (type == 'P')
		{
			currentSystem = new Exosystem(starName, 0, true);
		}
		else if (hasAllInfo)
		{
			hasSingleStar = info[9] == "0";
			numberOfPlanets = stoi(info[1]);
			currentSystem = new Exosystem(starName, numberOfPlanets, hasSingleStar);
		}
		else
		{
			rslt << "Line " << lineNumber << ": planet did not have all the data and was excluded.\n";
			continue;
		}

		if (starName == "Kepler-98")
		{
			int x = 4;
		}

		ExosystemP* match = exosystems->search(ExosystemP(currentSystem));
		if (match == nullptr)
		{//No match in system
			if (type == 'P')
			{
				rslt << "Line " << lineNumber << ": no such system named " + starName + " in data\n";
				continue;
			}
			else
			{
				currentSystem = (*exosystems->add(ExosystemP(currentSystem))).ptr;
			}
		}
		else
		{
			currentSystem = (*match).ptr;
		}

		//Exoplanet info
		if (hasAllInfo)
		{
			msini = stod(info[2]);
			a = stod(info[3]);
			per = stod(info[4]);
			ecc = stod(info[5]);
			om = stod(info[6]);
			t0 = stod(info[7]);
			k = stod(info[8]);
		}

		planetName = info[0].at(info[0].length() - 1);

		currentPlanet = new Exoplanet(planetName, msini, a, per, ecc, om, t0, k, currentSystem, starName);

		if (type == 'P')
		{
			numberOfReadPlanets -= currentSystem->getPlanets().size();
			exosystems->remove(ExosystemP(currentSystem));
		}
		else
		{
			dbg "Adding planet "; dbg currentPlanet->getName(); dbg " to system "; dbg currentSystem->getStarName(); dbg "\n";
			try
			{
				merge(currentSystem, currentPlanet);
				numberOfReadPlanets++;
			}
			catch (ExosystemPlanetNameNotUniqueException e)
			{
				rslt << "Planet name " << currentPlanet->getName() << " not unique within " << currentSystem->getStarName() << "\n";
			}
			catch (ExosystemTooManyPlanetsException e)
			{
				rslt << "Too many planets in exosystem " << currentSystem->getStarName() << "\n";
			}
		}
	}
	
	inputData.close();

	//output any information messages
	cout << "\n" << rslt.str();
	
	if (planets != nullptr)
		delete planets;
	planets = new Array<Exoplanet*>(numberOfReadPlanets);
	if (hashTable != nullptr)
		delete hashTable;
	dbg "Creating new hash table of size "; dbg numberOfReadPlanets; dbg "\n";
	hashTable = new ExoplanetLHT(numberOfReadPlanets);
	
	AVLTreeIterator<ExosystemP> sysIt(exosystems);
	LinkedListIterator<Exoplanet> planIt;
	LinkedList<Exoplanet>* systemPlanets;
	Exoplanet* curr;
	while (sysIt.hasNext())
	{
		dbg "Adding planets to hash table and array: ";
		systemPlanets = new LinkedList<Exoplanet>(sysIt.getNext().ptr->getPlanets());
		planIt = LinkedListIterator<Exoplanet>(systemPlanets);
		while (planIt.hasNext())
		{
			curr = planIt.getNext();
			dbg curr->getFullName(); dbg ", ";
			planets->add(curr);
			hashTable->add(curr);
		}
		dbg "\n";
	}
}
Esempio n. 12
0
  void CommandWindow::startMission()
  {
    // WARNING: COPY & PASTE PROGRAMMING AHEAD (SEE Game.cpp)

    bool noArmor = false;
    bool notPaid = false;
    bool incompleteArmor = false;
    bool notAnyArmor = true;
    LinkedList *ulist = game->units->getOwnedUnits(player);
    LinkedListIterator iter = LinkedListIterator(ulist);
    while (iter.iterateAvailable())
    {
      Unit *u = (Unit *)iter.iterateNext();
      if (u->getRootPart() == NULL && u->getCharacter() != NULL)
      {
        noArmor = true;
      } else {
        bool wasOk = true;
        if (u->getCharacter() == NULL)
        {
          wasOk = false;
        } else {
          if (game->calculatePurchasePrice(u->getRootPart()) > 0)
          {
            notPaid = true;
            wasOk = false;
          }
          int slotAmount = u->getRootPart()->getType()->getSlotAmount();
          for (int i = 0; i < slotAmount; i++) 
          {
            if (u->getRootPart()->getSubPart(i) == NULL)
            {
              if (
                u->getRootPart()->getType()->getSlotType(i)->getPartTypeId() 
                == PARTTYPE_ID_STRING_TO_INT("Head")
                || u->getRootPart()->getType()->getSlotType(i)->getPartTypeId() 
                == PARTTYPE_ID_STRING_TO_INT("Arm")
                || u->getRootPart()->getType()->getSlotType(i)->getPartTypeId() 
                == PARTTYPE_ID_STRING_TO_INT("Leg")
                || u->getRootPart()->getType()->getSlotType(i)->getPartTypeId() 
                == PARTTYPE_ID_STRING_TO_INT("Reac")
                )
              {
                incompleteArmor = true;
                wasOk = false;
              }
            }
          }
        }
        if (wasOk) 
        {
          // at least one armor is complete and purchased!
          notAnyArmor = false;
        }
      }
    }
    if (noArmor || notPaid || incompleteArmor || notAnyArmor)
    {
      game->gameUI->openArmorIncompleteConfirm(player, notAnyArmor,
        incompleteArmor, noArmor, notPaid); 
    } else {
      // TODO: open loading window for players on this client in netgame...
      game->gameUI->openLoadingWindow(game->singlePlayerNumber); 
      hide();
    }
	}
Esempio n. 13
0
 // add items from another list
 void addAll(LinkedList<T> cc) {
     LinkedListIterator<T> it = cc.getIterator();
     while(it.hasNext())
         add(it.next());
 }
Esempio n. 14
0
  void SelectionBox::doBoxSelection(SelectionBox::BoxSelectionType type)
//		                                VC2& a, VC2& b, VC2& c, VC2& d) 
	{
    //int now = Timer::getTime();
		IStorm3D_Scene *scene = game->getGameScene()->getStormScene();
		IStorm3D_Camera *cam = scene->GetCamera();

		float minX;
		float maxX;
		float minY;
		float maxY;
		if (boxStartX < currentX)
		{
			minX = (float)boxStartX;
			maxX = (float)currentX;
		} else {
			minX = (float)currentX;
			maxX = (float)boxStartX;
		}
		if (boxStartY < currentY)
		{
			minY = (float)boxStartY;
			maxY = (float)currentY;
		} else {
			minY = (float)currentY;
			maxY = (float)boxStartY;
		}
		minX /= 1024.0f;
		maxX /= 1024.0f;
		minY /= 768.0f;
		maxY /= 768.0f;

    LinkedListIterator iter = LinkedListIterator(
      game->units->getOwnedUnits(player));

		switch(type) {
		case SelectionBox::BOX_SELECT:

			//unitsSelected=0;
 			//for (i = 0; i < COMBATW_UNITS; i++) {
			//	Unit *u = solveUnitForNumber(i);

      game->unitSelections[player]->selectAllUnits(false);

      while (iter.iterateAvailable())
      {
        Unit *u = (Unit *)iter.iterateNext();

				VC3 position=u->getPosition();

				if(!u->isDestroyed() && u->isActive()) 
				{
					//bool isInside1=util::isPointInsideTriangle(VC2(position.x,position.z),a,b,c);
					//bool isInside2=util::isPointInsideTriangle(VC2(position.x,position.z),b,c,d);
					//if( isInside1 || isInside2 ) {

					bool unitInsideBox = false;
					VC3 result = VC3(0,0,0);
					float rhw = 0;
					float real_z = 0;
					bool infront = cam->GetTransformedToScreen(position, result, rhw, real_z);
					if (infront)
					{
						if (result.x >= minX && result.x <= maxX
							&& result.y >= minY && result.y <= maxY
							&& real_z < 200)
						{
							unitInsideBox = true;
						}
					}

					if (unitInsideBox)
					{
            game->unitSelections[player]->selectUnit(u, true);
            //u->setSelected(true);
						//unitButs[i]->SetImage(unitBackSelectedImage);
						//unitsSelected++;
						//unitSelectTime[i]=now;
					//} else { // Outside
            //game->unitSelections[player]->selectUnit(u, false);
						//u->setSelected(false);
						//unitButs[i]->SetImage(unitBackImage);
					}
				}
			}
			break;

		case SelectionBox::BOX_ADD_SELECTION:
      while (iter.iterateAvailable())
      {
        Unit *u = (Unit *)iter.iterateNext();
 			//for (i = 0; i < COMBATW_UNITS; i++) {
			//	Unit *u = solveUnitForNumber(i);
				VC3 position=u->getPosition();

				bool unitInsideBox = false;
				VC3 result = VC3(0,0,0);
				float rhw = 0;
				float real_z = 0;
				bool infront = cam->GetTransformedToScreen(position, result, rhw, real_z);
				if (infront)
				{
					if (result.x >= minX && result.x <= maxX
						&& result.y >= minY && result.y <= maxY
						&& real_z < 200)
					{
						unitInsideBox = true;
					}
				}

				if(!u->isSelected() && !u->isDestroyed() && u->isActive()) 
				{
					//bool isInside1=util::isPointInsideTriangle(VC2(position.x,position.z),a,b,c);
					//bool isInside2=util::isPointInsideTriangle(VC2(position.x,position.z),b,c,d);
					//if( isInside1 || isInside2 ) {
					if (unitInsideBox)
					{
            game->unitSelections[player]->selectUnit(u, true);
						//u->setSelected(true);
						//unitButs[i]->SetImage(unitBackSelectedImage);
						//unitsSelected++;
						//unitSelectTime[i]=now;
					} 
				}
			}
			break;

		case SelectionBox::BOX_SUB_SELECTION:
			// TODO: do we need this?
			break;
		default:
			/* euh, shouldn't happen */
      // thus, assert ;)
      assert(0);
			break;
		}
	}
Esempio n. 15
0
  void CombatRadar::update()
  {
		if (game->isPaused())
			return;

    int oldAmount = radarUnitsAmount;
    radarUnitsAmount = 0;

		LinkedList *ulist;

		if (SimpleOptions::getBool(DH_OPT_B_GUI_RADAR_SHOW_ALL))
		{
			ulist = game->units->getAllUnits();
		} else {
			ulist = game->units->getOwnedUnits(1);
		}

    LinkedListIterator iter = LinkedListIterator(ulist);

    while (iter.iterateAvailable())
    {
      Unit *u = (Unit *)iter.iterateNext();
      if (u->isActive() && !u->isDestroyed()
        && u->visibility.isInRadarByPlayer(player)
//        && u->visibility.isSeenByPlayer(player)
        && u->getUnitType()->getSize() >= RADAR_MIN_SIZE)
      {
        VC3 pos = u->getPosition();
        pos.x -= radarX;
        pos.z -= radarY;
        float distSq = pos.x * pos.x + pos.z * pos.z;
        if (distSq < RADAR_RANGE * RADAR_RANGE)
        {
          float dist = sqrtf(distSq);
          radarUnitDist[radarUnitsAmount] = dist * (RADAR_SIZE/2-RADAR_EDGE) / RADAR_RANGE;
					float angle;
					if (dist == 0)
						angle = 0;
					else
            angle = (float)acos(pos.x / dist);
          if (pos.z < 0) angle = -angle;
          radarUnitAngle[radarUnitsAmount] = angle;
          radarUnits[radarUnitsAmount] = u;

          OguiButton *b;
          if (radarUnitButs[radarUnitsAmount] == NULL)
          {
            b = ogui->CreateSimpleImageButton(win, 
              RADAR_SIZE/2-5, RADAR_SIZE/2-5, 9, 9, 
              NULL, NULL, NULL, COMBATW_RADARUNIT_START + radarUnitsAmount);
#ifdef PROJECT_SURVIVOR
						OguiAligner::align(b, OguiAligner::WIDESCREEN_FIX_RIGHT, ogui);
#endif
            radarUnitButs[radarUnitsAmount] = b;
          } else {
            b = radarUnitButs[radarUnitsAmount];
          }
          b->SetListener(this);
          b->SetReactMask(0);
          b->SetEventMask(OGUI_EMASK_CLICK);
					b->SetDisabled(true);
          if (game->isHostile(player, u->getOwner()))
          {
            if (u->getUnitType()->getSize() >= RADAR_BIG_SIZE)
            {
              b->SetDisabledImage(hostile2Image);
              radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_HOSTILE_BIG;
            } else {
              b->SetDisabledImage(hostile1Image);
              radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_HOSTILE_SMALL;
            }
          } else {
						if (u->getOwner() == player)
						{
							b->SetDisabledImage(NULL);
							radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_FRIENDLY_SMALL;
						} else {
							if (u->getUnitType()->getSize() >= RADAR_BIG_SIZE)
							{
								b->SetDisabledImage(friendly2Image);
								radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_FRIENDLY_BIG;
							} else {
								b->SetDisabledImage(friendly1Image);
								radarUnitType[radarUnitsAmount] = RADAR_UNITTYPE_FRIENDLY_SMALL;
							}
						}
          }

          radarUnitsAmount++;
          if (radarUnitsAmount >= COMBAT_RADAR_MAX_UNITS) break;
        }
      }
    }

    for (int i = radarUnitsAmount; i < oldAmount; i++)
    {
      delete radarUnitButs[i];
      radarUnitButs[i] = NULL;
    }

		if (radarScanBut != NULL)
		{
			int gt = (game->gameTimer % RADAR_SWEEP_TICK_INTERVAL);
			float ratio = (float)gt / RADAR_SWEEP_TICK_DURATION;

			if (ratio > 1.0f) ratio = 1.0f;
			int perc = (int)(ratio * 100.0f);

			int curSweep = game->gameTimer / RADAR_SWEEP_TICK_INTERVAL;
			if (curSweep > radarSweepNumber
				|| curSweep < radarSweepNumber - 5)
			{
				radarSweepNumber = curSweep;
				radarBeeped = false;

				if (win->IsVisible())
				{
#ifdef LEGACY_FILES
#ifndef PROJECT_SURVIVOR
					game->gameUI->playGUISound("Data/Sounds/Defaultfx/Radar/radar_sweep.wav");
#endif
#else
					game->gameUI->playGUISound("data/audio/sound/gui/hud/radar/radar_sweep.wav");
#endif
				}
			}

			int x = 1024 - (int)(RADAR_SIZE * (0.5f + ratio * 0.5f));
			int y = (int)(RADAR_SIZE * (0.5f - ratio * 0.5f));
			int sizeX = (int)(RADAR_SIZE * ratio);
			int sizeY = (int)(RADAR_SIZE * ratio);
			radarScanBut->Move(x, y);
			radarScanBut->Resize(sizeX, sizeY);
			radarScanBut->SetTransparency(perc);
#ifdef PROJECT_SURVIVOR
			OguiAligner::align(radarScanBut, OguiAligner::WIDESCREEN_FIX_RIGHT, ogui);
#endif
		}

    drawImpl();

		updateDirectionPointer();
  }