Example #1
0
void runLimitScreen(void)
{
	UDWORD i, id, statid;

	frontendMultiMessages();							// network stuff.

	id = widgRunScreen(psWScreen);						// Run the current set of widgets

	// sliders
	if((id > IDLIMITS_ENTRIES_START)  && (id< IDLIMITS_ENTRIES_END))
	{
		statid = widgGetFromID(psWScreen,id-1)->UserData ;
		if(statid)
		{
			asStructLimits[0][statid].limit = (UBYTE) ((W_SLIDER*)(widgGetFromID(psWScreen,id)))->pos;
		}
	}
	else
	{
		// icons that are always about.
		switch(id)
		{
		case IDLIMITS_RETURN:
			// reset the sliders..
			for (i = 0; i < numStructureStats ; ++i)
			{
				asStructLimits[0][i].limit = asStructLimits[0][i].globalLimit;
			}
			// free limiter structure
			freeLimitSet();
			//inform others
			sendOptions();

			eventReset();
			changeTitleMode(MULTIOPTION);

			// make some noize.
			if(!ingame.localOptionsReceived)
			{
				addConsoleMessage(_("Limits reset to default values"),DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
			}
			else
			{
				sendTextMessage("Limits Reset To Default Values",true);
			}

			break;
		case IDLIMITS_OK:
			resetReadyStatus(false);
			createLimitSet();
			changeTitleMode(MULTIOPTION);
			break;
		default:
			break;
		}
	}

	widgDisplayScreen(psWScreen);						// show the widgets currently running
}
Example #2
0
void HttpMessageHandler::handle(struct ns_connection *nc, struct http_message *hm)	{
    std::string requestMethod = getMethod(hm);
    if (requestMethod.compare("GET") == 0)  {
        handleGet(nc, hm);
    }else if (requestMethod.compare("OPTIONS") == 0)  {
        sendOptions(nc);
    }
}
/* Reset ready status for all players */
void resetReadyStatus(bool bSendOptions)
{
	// notify all clients if needed
	if(bSendOptions)
	{
		sendOptions();
	}
	netPlayersUpdated = true;
}
Example #4
0
// ////////////////////////////////////////////////////////////////////////////
void createLimitSet(void)
{
	UDWORD			i, numchanges = 0, bufSize, idx = 0;
	MULTISTRUCTLIMITS	*pEntry;

	debug(LOG_NET, "LimitSet created");
	// free old limiter structure
	freeLimitSet();

	// don't bother creating if a challenge mode is active
	// there are no settings loaded from the .ini file for now...
	if (challengeActive)
	{
		return;
	}
	
	// Count the number of changes
	for (i = 0; i < numStructureStats; i++)
	{
		// If the limit differs from the default
		if (asStructLimits[0][i].limit != LOTS_OF)
		{
			numchanges++;
		}
	}

	// Allocate some memory for the changes
	bufSize = numchanges * sizeof(MULTISTRUCTLIMITS);
	pEntry = (MULTISTRUCTLIMITS *)malloc(bufSize);
	memset(pEntry, 255, bufSize);

	// Prepare chunk
	ASSERT(numStructureStats < UBYTE_MAX, "Too many structure stats");
	for (i = 0; i < numStructureStats; i++)
	{
		if (asStructLimits[0][i].limit != LOTS_OF)
		{
			ASSERT(idx < numchanges, "Bad number of changed limits");
			pEntry[idx].id		= i;
			pEntry[idx].limit	= asStructLimits[0][i].limit;
			idx++;
		}
	}

	ingame.numStructureLimits	= numchanges;
	ingame.pStructureLimits		= pEntry;

	if (bHosted)
	{
		sendOptions();
	}
}
Example #5
0
// ////////////////////////////////////////////////////////////////////////////
// A Remote Player has joined the game.
bool MultiPlayerJoin(UDWORD playerIndex)
{
	if(widgGetFromID(psWScreen,IDRET_FORM))	// if ingame.
	{
		audio_QueueTrack( ID_CLAN_ENTER );
	}

	if(widgGetFromID(psWScreen,MULTIOP_PLAYERS))	// if in multimenu.
	{
		if (!multiRequestUp && (bHosted || ingame.localJoiningInProgress))
		{
			addPlayerBox(true);	// update the player box.
		}
	}

	if(NetPlay.isHost)		// host responsible for welcoming this player.
	{
		// if we've already received a request from this player don't reallocate.
		if (ingame.JoiningInProgress[playerIndex])
		{
			return true;
		}
		ASSERT(NetPlay.playercount <= MAX_PLAYERS, "Too many players!");

		// setup data for this player, then broadcast it to the other players.
		setupNewPlayer(playerIndex);						// setup all the guff for that player.
		if (bHosted)
		{
			sendOptions();
		}
		// if skirmish and game full, then kick...
		if (NetPlay.playercount > game.maxPlayers)
		{
			kickPlayer(playerIndex, "the game is already full.", ERROR_FULL);
		}
		// send everyone's stats to the new guy
		{
			int i;

			for (i = 0; i < MAX_PLAYERS; i++)
			{
				if (NetPlay.players[i].allocated)
				{
					setMultiStats(i, getMultiStats(i), false);
				}
			}
		}
	}
	return true;
}
int cBoblight::open()
{
  //init boblight
  m_boblight = boblight_init();
  tell(1, "Successfully loaded and initalized libboblight");

   if (!boblight_connect(m_boblight, cfg.host, cfg.port, 1000000) || !boblight_setpriority(m_boblight, cfg.priority))
    {
      tell(0, "Error connecting to boblight %s", boblight_geterror(m_boblight));
      close();
      return fail;
    }
   tell(0, "Connected to boblight");
   sendOptions();
   return success;
}
Example #7
0
void RagePics::run (JulieSu::Irc::Message message)
{
	// Respond to their message
	std::string arguments = message.privmsg_msg;
	arguments = arguments.substr(arguments.find(" ")+1);
	std::string verb = arguments.substr(0,arguments.find(" "));
	
	std::string target = (message.privmsg_target == bot->getName()) ? message.nick : message.privmsg_target;
	std::map<std::string,std::string>::iterator it = this->responses.find(verb);
	if(it == this->responses.end()) {
	  sendOptions(target);
	  return; 
	}

	std::string response = std::string("[ragepic] ") + (*it).second;
	bot->getConnection()->sendPrivMsg (target, response);
}
Example #8
0
void runLimitScreen(void)
{
	frontendMultiMessages();							// network stuff.

	WidgetTriggers const &triggers = widgRunScreen(psWScreen);
	unsigned id = triggers.empty()? 0 : triggers.front().widget->id;  // Just use first click here, since the next click could be on another menu.

	// sliders
	if((id > IDLIMITS_ENTRIES_START)  && (id< IDLIMITS_ENTRIES_END))
	{
		unsigned statid = widgGetFromID(psWScreen,id-1)->UserData;
		if(statid)
		{
			asStructLimits[0][statid].limit = (UBYTE) ((W_SLIDER*)(widgGetFromID(psWScreen,id)))->pos;
		}
	}
	else
	{
		// icons that are always about.
		switch(id)
		{
		case IDLIMITS_RETURN:
			// reset the sliders..
			for (unsigned i = 0; i < numStructureStats; ++i)
			{
				asStructLimits[0][i].limit = asStructLimits[0][i].globalLimit;
			}
			// free limiter structure
			freeLimitSet();
			//inform others
			if (bHosted)
			{
				sendOptions();
			}

			eventReset();
			changeTitleMode(MULTIOPTION);

			// make some noize.
			if(!ingame.localOptionsReceived)
			{
				addConsoleMessage(_("Limits reset to default values"),DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
			}
			else
			{
				sendTextMessage("Limits Reset To Default Values",true);
			}

			break;
		case IDLIMITS_OK:
			resetReadyStatus(false);
			createLimitSet();
			changeTitleMode(MULTIOPTION);
			break;
		default:
			break;
		}
	}

	widgDisplayScreen(psWScreen);						// show the widgets currently running
}
Mat Puppets(){		//this is where the magic happens! Sort of. 



	if(!clmModel._clm._plocal.empty()){		//Just in case there's nothing there...

		Mat localShape;
		Mat newshape;
		Mat globalShape;

		double mouth = 100.0;
		double eyebrows = 100.0;
		double smile = 100.0;                 //weight of expression parameters

		double headmovement = 1.0;

		Mat oldshape;
		clmModel._clm._plocal.copyTo(localShape);
		clmModel._clm._pglobl.copyTo(globalShape);
		globalShape.db(1,0) *= headmovement;
		globalShape.db(2,0) *= headmovement;
		globalShape.db(3,0) *= headmovement;
		clmModel._clm._pdm.CalcShape2D(oldshape, localShape, globalShape);		//calculate old shape
		localShape.db(0,0) *= (mouth/100.0);
		localShape.db(1,0) *= (eyebrows/100.0);
		localShape.db(2,0) *= (smile/100.0);
		clmModel._clm._pdm.CalcShape2D(newshape, localShape, globalShape); //calculate new shape

		ParseToPAW(newshape, localShape, globalShape);
		Mat teethimg;
		cvtColor(faceimg, teethimg, CV_RGB2BGR);
		cv::Mat neutralshape(newshape.rows, 1, CV_64FC1);

		Vec3d orientation;
		orientation(0) = globalShape.at<double>(1);
		orientation(1) = globalShape.at<double>(2);
		orientation(2) = globalShape.at<double>(3);

		int viewid = clmModel._det_valid.GetViewId(orientation);

		bool toggleERI = ERIon;

		if(viewid != 0){
			toggleERI = 1;
		}


		sendOptions(writeToFile,toggleERI, choiceavatar);	//send writeto and usesave to avatar

		clmModel._det_valid._fcheck[viewid]._paw.WarpToNeutral(faceimg, newshape, neutralshape);		//warp to neutral (in CLM/PAW.cc)



		//***************//	
		if(avatarWarpedHead2.empty()){


			string imagefileloc, filelocleft, filelocright;

			if(avatarfile2.empty()){
				avatarfile2 = "../images/shape_central.yml";
			}

			cout << "avatar file " << avatarfile2 << endl;
			FileStorage fs(avatarfile2, FileStorage::READ);	
			fs["shape"] >> avatarS2;
			fs["filename"] >> imagefileloc;
			fs["fileleft"] >> filelocleft;
			fs["fileright"] >> filelocright;
			fs.release();

			avatarWarpedHead2 = imread( imagefileloc);


			cvtColor(avatarWarpedHead2, avatarWarpedHead2, CV_RGB2BGR);

			//warp to neutral on read of a new face, not every loop: so you only have to do it once
			clmModel._det_valid._fcheck[0]._paw.WarpToNeutral(avatarWarpedHead2, avatarS2, neutralshape);

		}