Exemplo n.º 1
0
void MapList_LoadMap(entity btn, entity me)
{
	string m;
	float i;

	i = me.selectedItem;

	if(btn.parent.instanceOfNexuizMapInfoDialog)
	{
		i = btn.parent.currentMapIndex;
		Dialog_Close(btn, btn.parent);
	}

	if(i >= me.nItems || i < 0)
		return;

	m = MapInfo_BSPName_ByID(i);
	if not(m)
	{
		print("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n");
		return;
	}
	if(MapInfo_CheckMap(m, gametype_ID_to_MapID(gametype_GetMenu())))
	{
		localcmd("\nmenu_loadmap_prepare\n");
		if(CVAR(menu_use_default_hostname))
			localcmd("hostname \"", strdecolorize(CVAR_STR(_cl_name)), "'s Nexuiz server\"\n");
		MapInfo_LoadMap(m);
	}
	else
	{
		print("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n");
		me.refilter(me);
	}
}
Exemplo n.º 2
0
void Config::ReadCVARS(Path& path)
{
	CSVParser p = CSVParser(path);

	p.GetLine('\n'); // skip comment line

	while (!p.FileEnd())
	{
		CVAR cvar = CVAR();

		cvar.SetName(p.GetLine(';'));
		cvar.SetID($hash(cvar.GetName().c_str()));

		cvar.SetDefault(p.GetLine(';'));
		cvar.SetValue(cvar.GetDefault());

		cvar.SetMin( atoi ( ( p.GetLine(';') ).c_str() ) );

		cvar.SetMax( atoi ( ( p.GetLine(';') ).c_str() ) );

		cvar.SetProtected( atoi ( ( p.GetLine(';') ).c_str() ) != 0 );

		cvar.SetDescription(p.GetLine(';'));

		p.GetLine('\n');

		cvarMap[cvar.GetID()] = cvar;
	}

	p.Close();
}
Exemplo n.º 3
0
		void PrintInfo()
		{
			std::cout << "system information" << std::endl;
			log::Indenter indenter;
			if (*CVAR(logHost))
			{
				try
				{
					std::string
						user(GetUsername()),
						host(GetHostname());
					std::cout << "host is " << user << " on " << host << std::endl;
				}
				catch (...) {}
			}
			try
			{
				std::string platform(GetOs());
				std::cout << "platform is " << platform << std::endl;
			}
			catch (...) {}
			try
			{
				std::string machine(GetCpu());
				std::cout << "machine is " << machine << std::endl;
			}
			catch (...) {}
		}
Exemplo n.º 4
0
				// function binding initialization
				void InitExt(Display *display, int screen)
				{
					// check for GLX_ARB_get_proc_address
					// FIXME: implement using glXQueryExtensionsString
					glXGetProcAddressARB = glXGetProcAddress;
					haveArbGetProcAddress = true;
					std::cout << "loading X11 OpenGL extensions" << std::endl;
					log::Indenter indenter;

					// build supported extension set
					std::string extString(glXQueryExtensionsString(display, screen));
					std::unordered_set<std::string> supportedExts;
					util::Deserialize(extString, std::inserter(supportedExts, supportedExts.end()));

					// calculate extension alignment width
					std::streamsize width = 0;
					for (Exts::const_iterator ext(exts.begin()); ext != exts.end(); ++ext)
						width = std::max(static_cast<std::streamsize>(ext->name.size()), width);

					// set flags for trailing alignment
					boost::io::ios_all_saver iosFormatSaver(std::cout);
					std::cout.setf(std::ios_base::left, std::ios_base::adjustfield);
					std::cout.fill(' ');

					// check relevant extensions
					for (Exts::iterator ext(exts.begin()); ext != exts.end(); ++ext)
					{
						std::cout << std::setw(width) << ext->name << " = ";
						bool broken = false;
						if (ext->have = supportedExts.find(ext->name) != supportedExts.end())
						{
							// initialize function pointers
							for (Ext::Procs::const_iterator proc(ext->procs.begin()); proc != ext->procs.end(); ++proc)
							{
								if (!(*proc->address = GetProcAddress(proc->name)))
								{
									if (!broken)
									{
										std::cout << "broken" << std::endl;
										broken = true;
										ext->have = false;
									}
									if (*CVAR(logVerbose))
									{
										log::Indenter indenter;
										std::cout << "missing function " << proc->name << std::endl;
									}
								}
							}
						}
						else
						{
							// reset function pointers
							for (Ext::Procs::const_iterator proc(ext->procs.begin()); proc != ext->procs.end(); ++proc)
								*proc->address = 0;
						}
						if (!broken) std::cout << (ext->have ? "good" : "missing") << std::endl;
					}
				}
Exemplo n.º 5
0
void loadCvarsNexuizResolutionSlider(entity me)
{
    me.setValueFromIdentifier(me, CVAR(vid_width) + "x" + CVAR(vid_height));
}
Exemplo n.º 6
0
Our software rendering basically works like this:

main thread builds command:
	command contains vertex data in the command block
	main thread runs the vertex programs (much like q3) and performs matrix transforms (much like d3d)

worker threads read each command sequentially:
	clip to viewport

division of labour between worker threads works by interlacing.
each thread gets a different set of scanlines to render.
we can also trivially implement interlacing with this method

*/

cvar_t sw_interlace = CVAR("sw_interlace", "0");
cvar_t sw_vthread = CVAR("sw_vthread", "0");
cvar_t sw_fthreads = CVAR("sw_fthreads", "0");

struct workqueue_s commandqueue;
struct workqueue_s spanqueue;

static void WT_Triangle(swthread_t *th, swimage_t *img, swvert_t *v1, swvert_t *v2, swvert_t *v3)
{
	//affine vs correct:
	//to correct perspective, divide interpolants by z.
	//per pixel, divide by interpolated 1 (actually 1/z)

	unsigned int tpix;
#if 1
	#define PERSPECTIVE(v) (v>>16)