当前位置: 首页>>代码示例>>C++>>正文


C++ M_GetText函数代码示例

本文整理汇总了C++中M_GetText函数的典型用法代码示例。如果您正苦于以下问题:C++ M_GetText函数的具体用法?C++ M_GetText怎么用?C++ M_GetText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了M_GetText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UnregisterServer

void UnregisterServer(void)
{
	if (con_state != MSCS_REGISTERED)
	{
		con_state = MSCS_NONE;
		CloseConnection();
		return;
	}

	con_state = MSCS_NONE;

	CONS_Printf("%s", M_GetText("Unregistering this server to the master server...\n"));

	if (MS_Connect(registered_server.ip, registered_server.port, 0))
	{
		CONS_Printf("%s", M_GetText("cannot connect to the master server\n"));
		return;
	}

	if (RemoveFromMasterSever() < 0)
		CONS_Printf("%s", M_GetText("cannot remove this server from the master server\n"));

	CloseConnection();
	MSCloseUDPSocket();
	MSLastPing = 0;
}
开发者ID:Logan-A,项目名称:SRB2-Public,代码行数:26,代码来源:mserv.c

示例2: CONS_Printf

const char *GetMODVersion(void)
{
	static msg_t msg;


	// we must be connected to the master server before writing to it
	if (MS_Connect(GetMasterServerIP(), GetMasterServerPort(), 0))
	{
		CONS_Printf("%s", M_GetText("cannot connect to the master server\n"));
		M_StartMessage(M_GetText("There was a problem connecting to\nthe Master Server"), NULL, MM_NOTHING);
		return NULL;
	}

	msg.type = GET_VERSION_MSG;
	msg.length = sizeof MODVERSION;
	msg.room = MODID; // Might as well use it for something.
	sprintf(msg.buffer,"%d",MODVERSION);
	if (MS_Write(&msg) < 0)
		return NULL;

	MS_Read(&msg);
	CloseConnection();

	if(strcmp(msg.buffer,"NULL") != 0)
	{
		return msg.buffer;
	}
	else
		return NULL;
}
开发者ID:Logan-A,项目名称:SRB2-Public,代码行数:30,代码来源:mserv.c

示例3: SCR_CheckDefaultMode

void SCR_CheckDefaultMode(void)
{
	INT32 scr_forcex, scr_forcey; // resolution asked from the cmd-line

	if (dedicated)
		return;

	// 0 means not set at the cmd-line
	scr_forcex = scr_forcey = 0;

	if (M_CheckParm("-width") && M_IsNextParm())
		scr_forcex = atoi(M_GetNextParm());

	if (M_CheckParm("-height") && M_IsNextParm())
		scr_forcey = atoi(M_GetNextParm());

	if (scr_forcex && scr_forcey)
	{
		CONS_Printf(M_GetText("Using resolution: %d x %d\n"), scr_forcex, scr_forcey);
		// returns -1 if not found, thus will be 0 (no mode change) if not found
		setmodeneeded = VID_GetModeForSize(scr_forcex, scr_forcey) + 1;
	}
	else
	{
		CONS_Printf(M_GetText("Default resolution: %d x %d (%d bits)\n"), cv_scr_width.value,
			cv_scr_height.value, cv_scr_depth.value);
		// see note above
		setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1;
	}
}
开发者ID:TehRealSalt,项目名称:SRB2,代码行数:30,代码来源:screen.c

示例4: COM_Exec_f

/** Executes a script file.
  */
static void COM_Exec_f(void)
{
	UINT8 *buf = NULL;

	if (COM_Argc() < 2 || COM_Argc() > 3)
	{
		CONS_Printf(M_GetText("exec <filename>: run a script file\n"));
		return;
	}

	// load file
	FIL_ReadFile(COM_Argv(1), &buf);

	if (!buf)
	{
		if (!COM_CheckParm("-noerror"))
			CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1));
		return;
	}

	if (!COM_CheckParm("-silent"))
		CONS_Printf(M_GetText("executing %s\n"), COM_Argv(1));

	// insert text file into the command buffer
	COM_BufAddText((char *)buf);
	COM_BufAddText("\n");

	// free buffer
	Z_Free(buf);
}
开发者ID:RedEnchilada,项目名称:SRB2,代码行数:32,代码来源:command.c

示例5: COM_Toggle_f

/** Toggles a console variable. Useful for on/off values.
  *
  * This works on on/off, yes/no values only
  */
static void COM_Toggle_f(void)
{
	consvar_t *cvar;

	if (COM_Argc() != 2)
	{
		CONS_Printf(M_GetText("Toggle <cvar_name>: Toggle the value of a cvar\n"));
		return;
	}
	cvar = CV_FindVar(COM_Argv(1));
	if (!cvar)
	{
		CONS_Alert(CONS_NOTICE, M_GetText("%s is not a cvar\n"), COM_Argv(1));
		return;
	}

	if (!(cvar->PossibleValue == CV_YesNo || cvar->PossibleValue == CV_OnOff))
	{
		CONS_Alert(CONS_NOTICE, M_GetText("%s is not a boolean value\n"), COM_Argv(1));
		return;
	}

	// netcvar don't change imediately
	cvar->flags |= CV_SHOWMODIFONETIME;
	CV_AddValue(cvar, +1);
}
开发者ID:RedEnchilada,项目名称:SRB2,代码行数:30,代码来源:command.c

示例6: CDAudio_GetAudioDiskInfo

/**************************************************************************
 *
 * function: CDAudio_GetAudioDiskInfo
 *
 * description:
 * set number of tracks if CD is available
 *
 **************************************************************************/
static INT32 CDAudio_GetAudioDiskInfo(void)
{
	cdValid = SDL_FALSE;
	maxTrack = 0;

	if (!cdrom)
		return 0;//Alam: Lies!

	cdStatus = SDL_CDStatus(cdrom);

	if (!CD_INDRIVE(cdStatus))
	{
		CONS_Printf("%s", M_GetText("No CD in drive\n"));
		return -1;
	}

	if (cdStatus == CD_ERROR)
	{
		CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError());
		return -1;
	}

	cdValid = SDL_TRUE;
	maxTrack = (Uint8)cdrom->numtracks;

	return 0;
}
开发者ID:ZilverXZX,项目名称:SRB2,代码行数:35,代码来源:i_cdmus.c

示例7: Command_Ping_f

void Command_Ping_f(void)
{
#ifndef NEWPING
	if(server)
	{
#endif
		INT32 i;
		for (i = 0; i < MAXPLAYERS;i++)
		{
#ifndef NEWPING
			const INT32 node = playernode[i];
			if (playeringame[i] && node != 0)
				CONS_Printf(M_GetText("%.2d : %s\n %d tics, %d ms.\n"), i, player_names[i],
				GetLag(node), G_TicsToMilliseconds(GetLag(node)));
#else
			if (playeringame[i] && i != 0)
				CONS_Printf(M_GetText("%.2d : %s\n %d ms\n"), i, player_names[i], playerpingtable[i]);
#endif
		}
#ifndef NEWPING
	}
	else
		CONS_Printf(M_GetText("Only the server can use this.\n"));
#endif
}
开发者ID:HipsterLion,项目名称:SRB2,代码行数:25,代码来源:d_net.c

示例8: Command_CountMobjs_f

void Command_CountMobjs_f(void)
{
	thinker_t *th;
	mobjtype_t i;
	INT32 count;

	if (gamestate != GS_LEVEL)
	{
		CONS_Printf(M_GetText("You must be in a level to use this.\n"));
		return;
	}

	if (COM_Argc() >= 2)
	{
		size_t j;
		for (j = 1; j < COM_Argc(); j++)
		{
			i = atoi(COM_Argv(j));
			if (i >= NUMMOBJTYPES)
			{
				CONS_Printf(M_GetText("Object number %d out of range (max %d).\n"), i, NUMMOBJTYPES-1);
				continue;
			}

			count = 0;

			for (th = thinkercap.next; th != &thinkercap; th = th->next)
			{
				if (th->function.acp1 != (actionf_p1)P_MobjThinker)
					continue;

				if (((mobj_t *)th)->type == i)
					count++;
			}

			CONS_Printf(M_GetText("There are %d objects of type %d currently in the level.\n"), count, i);
		}
		return;
	}

	CONS_Printf(M_GetText("Count of active objects in level:\n"));

	for (i = 0; i < NUMMOBJTYPES; i++)
	{
		count = 0;

		for (th = thinkercap.next; th != &thinkercap; th = th->next)
		{
			if (th->function.acp1 != (actionf_p1)P_MobjThinker)
				continue;

			if (((mobj_t *)th)->type == i)
				count++;
		}

		CONS_Printf(" * %d: %d\n", i, count);
	}
}
开发者ID:ZilverXZX,项目名称:SRB2,代码行数:58,代码来源:p_tick.c

示例9: I_InitCD

// --------
// I_InitCD
// Init CD Audio subsystem
// --------
void I_InitCD(void)
{
	MCI_SET_PARMS   mciSet;
	MCIERROR    iErr;
	int         i;

	// We don't have an open device yet
	m_MCIOpen.wDeviceID = 0;
	m_nTracksCount = 0;

	cdaudio_started = false;

	m_MCIOpen.lpstrDeviceType = (LPCTSTR)MCI_DEVTYPE_CD_AUDIO;
	iErr = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID, (DWORD_PTR)&m_MCIOpen);
	if (iErr)
	{
		MCIErrorMessageBox (iErr);
		return;
	}

	// Set the time format to track/minute/second/frame (TMSF).
	mciSet.dwTimeFormat = MCI_FORMAT_TMSF;
	iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)&mciSet);
	if (iErr)
	{
		MCIErrorMessageBox (iErr);
		mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0);
		return;
	}

	I_AddExitFunc (I_ShutdownCD);
	cdaudio_started = true;

	CONS_Printf (M_GetText("CD audio Initialized\n"));

	// last saved in config.cfg
	i = cd_volume.value;
	//I_SetVolumeCD (0);   // initialize to 0 for some odd cd drivers
	I_SetVolumeCD (i);   // now set the last saved volume

	for (i = 0; i < MAX_CD_TRACKS; i++)
		cdRemap[i] = (UINT8)i;

	if (!CD_ReadTrackInfo())
	{
		CONS_Printf(M_GetText("No CD in drive\n"));
		cdEnabled = FALSE;
		cdValid = FALSE;
	}
	else
	{
		cdEnabled = TRUE;
		cdValid = TRUE;
	}

	COM_AddCommand ("cd", Command_Cd_f);
}
开发者ID:HipsterLion,项目名称:SRB2,代码行数:61,代码来源:win_cd.c

示例10: LUA_DumpFile

// Compile a script by name and dump it back to disk.
void LUA_DumpFile(const char *filename)
{
	FILE *handle;
	char filenamebuf[MAX_WADPATH];

	if (!gL) // Lua needs to be initialized
		LUA_ClearState(false);

	// find the file the SRB2 way
	strncpy(filenamebuf, filename, MAX_WADPATH);
	filenamebuf[MAX_WADPATH - 1] = '\0';
	filename = filenamebuf;
	if ((handle = fopen(filename, "rb")) == NULL)
	{
		// If we failed to load the file with the path as specified by
		// the user, strip the directories and search for the file.
		nameonly(filenamebuf);

		// If findfile finds the file, the full path will be returned
		// in filenamebuf == filename.
		if (findfile(filenamebuf, NULL, true))
		{
			if ((handle = fopen(filename, "rb")) == NULL)
			{
				CONS_Alert(CONS_ERROR, M_GetText("Can't open %s\n"), filename);
				return;
			}
		}
		else
		{
			CONS_Alert(CONS_ERROR, M_GetText("File %s not found.\n"), filename);
			return;
		}
	}
	fclose(handle);

	// pass the path we found to Lua
	// luaL_loadfile will open and read the file in as a Lua function
	if (luaL_loadfile(gL, filename)) {
		CONS_Alert(CONS_ERROR,"%s\n",lua_tostring(gL,-1));
		lua_pop(gL, 1);
		return;
	}

	// dump it back to disk
	if ((handle = fopen(filename, "wb")) == NULL)
		CONS_Alert(CONS_ERROR, M_GetText("Can't write to %s\n"), filename);
	if (lua_dump(gL, dumpWriter, handle))
		CONS_Printf("Failed while writing %s to disk... Sorry!\n", filename);
	else
		CONS_Printf("Successfully compiled %s into bytecode.\n", filename);
	fclose(handle);
	lua_pop(gL, 1); // function is still on stack after lua_dump
	lua_gc(gL, LUA_GCCOLLECT, 0);
	return;
}
开发者ID:HipsterLion,项目名称:SRB2,代码行数:57,代码来源:lua_script.c

示例11: CV_RegisterVar

/** Registers a variable for later use from the console.
  *
  * \param variable The variable to register.
  */
void CV_RegisterVar(consvar_t *variable)
{
	// first check to see if it has already been defined
	if (CV_FindVar(variable->name))
	{
		CONS_Printf(M_GetText("Variable %s is already defined\n"), variable->name);
		return;
	}

	// check for overlap with a command
	if (COM_Exists(variable->name))
	{
		CONS_Printf(M_GetText("%s is a command name\n"), variable->name);
		return;
	}

	// check net variables
	if (variable->flags & CV_NETVAR)
	{
		const consvar_t *netvar;
		variable->netid = CV_ComputeNetid(variable->name);
		netvar = CV_FindNetVar(variable->netid);
		if (netvar)
			I_Error("Variables %s and %s have same netid\n", variable->name, netvar->name);
	}

	// link the variable in
	if (!(variable->flags & CV_HIDEN))
	{
		variable->next = consvar_vars;
		consvar_vars = variable;
	}
	variable->string = variable->zstring = NULL;
	variable->changed = 0; // new variable has not been modified by the user

#ifdef PARANOIA
	if ((variable->flags & CV_NOINIT) && !(variable->flags & CV_CALL))
		I_Error("variable %s has CV_NOINIT without CV_CALL\n", variable->name);
	if ((variable->flags & CV_CALL) && !variable->func)
		I_Error("variable %s has CV_CALL without a function\n", variable->name);
#endif

	if (variable->flags & CV_NOINIT)
		variable->flags &= ~CV_CALL;

	Setvalue(variable, variable->defaultvalue, false);

	if (variable->flags & CV_NOINIT)
		variable->flags |= CV_CALL;

	// the SetValue will set this bit
	variable->flags &= ~CV_MODIFIED;
}
开发者ID:ilag11111,项目名称:SRB2,代码行数:57,代码来源:command.c

示例12: I_PlayCD

void I_PlayCD (UINT8 track, UINT8 looping)
{
#ifdef NOSDLCD
	(void)track;
	(void)looping;
#else
	if (!cdrom || !cdEnabled)
		return;

	if (!cdValid)
	{
		CDAudio_GetAudioDiskInfo();
		if (!cdValid)
			return;
	}

	track = cdRemap[track];

	if (track < 1 || track > maxTrack)
	{
		CONS_Printf(M_GetText("Bad track number %u.\n"), track);
		return;
	}

	// don't try to play a non-audio track
	if (cdrom->track[track].type == SDL_DATA_TRACK)
	{
		CONS_Printf(M_GetText("Track %u is not audio\n"), track);
		return;
	}

	if (cdPlaying)
	{
		if (playTrack == track)
			return;
		I_StopCD();
	}

	if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0))
	{
		CONS_Printf(M_GetText("Error playing track %d: %s\n"), track, SDL_GetError());
		return;
	}

	playLooping = looping;
	playTrack = (Uint8)track;
	cdPlaying = SDL_TRUE;

	if (cd_volume.value == 0)
		I_PauseCD();
#endif
}
开发者ID:ZilverXZX,项目名称:SRB2,代码行数:52,代码来源:i_cdmus.c

示例13: COM_ExecuteString

/** Parses a single line of text into arguments and tries to execute it.
  * The text can come from the command buffer, a remote client, or stdin.
  *
  * \param ptext A single line of text.
  */
static void COM_ExecuteString(char *ptext)
{
	xcommand_t *cmd;
	cmdalias_t *a;
	static INT32 recursion = 0; // detects recursion and stops it if it goes too far

	COM_TokenizeString(ptext);

	// execute the command line
	if (COM_Argc() == 0)
		return; // no tokens

	// check functions
	for (cmd = com_commands; cmd; cmd = cmd->next)
	{
		if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
		{
			recursion = 0;
			cmd->function();
			return;
		}
	}

	// check aliases
	for (a = com_alias; a; a = a->next)
	{
		if (!stricmp(com_argv[0], a->name))
		{
			if (recursion > MAX_ALIAS_RECURSION)
			{
				CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
				recursion = 0;
				return;
			}
			recursion++;
			COM_BufInsertText(a->value);
			return;
		}
	}

	recursion = 0;

	// check cvars
	// Hurdler: added at Ebola's request ;)
	// (don't flood the console in software mode with bad gr_xxx command)
	if (!CV_Command() && con_destlines)
		CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
}
开发者ID:TehRealSalt,项目名称:SRB2,代码行数:53,代码来源:command.c

示例14: ConnectionFailed

static INT32 ConnectionFailed(void)
{
	con_state = MSCS_FAILED;
	CONS_Printf("%s", M_GetText("Connection to master server failed\n"));
	CloseConnection();
	return MS_CONNECT_ERROR;
}
开发者ID:Logan-A,项目名称:SRB2-Public,代码行数:7,代码来源:mserv.c

示例15: GetServersList

/** Gets a list of game servers from the master server.
  */
static INT32 GetServersList(void)
{
	msg_t msg;
	INT32 count = 0;

	msg.type = GET_SERVER_MSG;
	msg.length = 0;
	msg.room = 0;
	if (MS_Write(&msg) < 0)
		return MS_WRITE_ERROR;

	while (MS_Read(&msg) >= 0)
	{
		if (!msg.length)
		{
			if (!count)
				CONS_Printf("%s", M_GetText("No servers currently running.\n"));
			return MS_NO_ERROR;
		}
		count++;
		CONS_Printf("%s",msg.buffer);
	}

	return MS_READ_ERROR;
}
开发者ID:Logan-A,项目名称:SRB2-Public,代码行数:27,代码来源:mserv.c


注:本文中的M_GetText函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。