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


C++ CONS_Printf函数代码示例

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


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

示例1: Command_Charability_f

void Command_Charability_f(void)
{
	if (gamestate != GS_LEVEL || demoplayback)
	{
		CONS_Printf("%s", text[MUSTBEINLEVEL]);
		return;
	}

	G_ModifyGame();

	if (COM_Argc() < 3)
	{
		CONS_Printf("charability <1/2> <value>\n");
		return;
	}

	if (netgame || multiplayer)
	{
		CONS_Printf("%s", text[CANTUSEMULTIPLAYER]);
		return;
	}

	if (atoi(COM_Argv(1)) == 1)
		players[consoleplayer].charability = atoi(COM_Argv(2));
	else if (atoi(COM_Argv(1)) == 2)
		players[consoleplayer].charability2 = atoi(COM_Argv(2));
	else
		CONS_Printf("charability <1/2> <value>\n");
}
开发者ID:yellowtd,项目名称:SRB2CB-2.0.4,代码行数:29,代码来源:m_cheat.c

示例2: 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

示例3: Command_Hurtme_f

void Command_Hurtme_f(void)
{
	if (gamestate != GS_LEVEL || demoplayback)
	{
		CONS_Printf("%s", text[MUSTBEINLEVEL]);
		return;
	}

	if (!cv_debug)
	{
		CONS_Printf("%s", text[NEED_DEVMODE]);
		return;
	}

	if (netgame || multiplayer)
	{
		CONS_Printf("%s", text[CANTUSEMULTIPLAYER]);
		return;
	}

	if (COM_Argc() < 2)
	{
		CONS_Printf("hurtme <damage>\n");
		return;
	}

	P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1)));
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:28,代码来源:m_cheat.c

示例4: Command_Gravflip_f

void Command_Gravflip_f(void)
{
	if (gamestate != GS_LEVEL || demoplayback)
	{
		CONS_Printf("%s", text[MUSTBEINLEVEL]);
		return;
	}

	if (!cv_debug)
	{
		CONS_Printf("%s", text[NEED_DEVMODE]);
		return;
	}

	if (netgame || multiplayer)
	{
		CONS_Printf("%s", text[SINGLEPLAYERONLY]);
		return;
	}

	if (players[consoleplayer].powers[pw_gravityboots])
		players[consoleplayer].powers[pw_gravityboots] = 0;
	else
		players[consoleplayer].powers[pw_gravityboots] += 3600 * TICRATE;
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:25,代码来源:m_cheat.c

示例5: Command_Scale_f

void Command_Scale_f(void)
{
	INT32 scale = atoi(COM_Argv(1));

	if (!cv_debug)
	{
		CONS_Printf("%s", text[NEED_DEVMODE]);
		return;
	}

	if (netgame || multiplayer)
	{
		CONS_Printf("%s", text[SINGLEPLAYERONLY]);
		return;
	}

	if (!(scale >= 5 && scale <= 400)) //COM_Argv(1) will return a null string if they did not give a paramater, so...
	{
		CONS_Printf("SCALE <value> (5-400): Set player scale size.\n");
		return;
	}

	if (!players[consoleplayer].mo)
		return;

	players[consoleplayer].mo->destscale = (UINT16)scale;

	CONS_Printf("Scale set to %d\n", players[consoleplayer].mo->destscale);
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:29,代码来源:m_cheat.c

示例6: ACS_FindScript

/// Start (or unpause) an ACS script in this map. Returns the script instance if succesful.
acs_t *Map::ACS_StartScript(unsigned scriptnum, byte *args, Actor *triggerer, line_t *line, int side)
{
  acs_script_t *s = ACS_FindScript(scriptnum);
  if (!s)
    {
      CONS_Printf("Map::StartACS: Unknown script number %d\n", scriptnum);
      return NULL; // not found
    }

  CONS_Printf("Starting ACS script %d\n", scriptnum);

  if (s->state == ACS_suspended)
    {
      s->state = ACS_running; // resume execution
      return s->instance; // FIXME problem?
    }

  if (s->state != ACS_stopped)
    return NULL; // already running or waiting for an event

  acs_t *script = new acs_t(s);
  script->triggerer = triggerer;
  script->line = line;
  script->side = side;

  for (unsigned i = 0; i < s->num_args; i++)
    script->vars[i] = args[i];

  s->state = ACS_running;
  AddThinker(script);
  return script;
}
开发者ID:meiavy,项目名称:doom-legacy,代码行数:33,代码来源:acs.cpp

示例7: 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

示例8: UnregisterServer

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

	con_state = MSCS_NONE;

	CONS_Printf("Unregistering this server to the master server...\n");

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

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

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

示例9: COM_Exec_f

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

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

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

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

	if (!COM_CheckParm("-silent"))
		CONS_Printf("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:Pupswoof117,项目名称:SRB2-Public,代码行数:33,代码来源:command.c

示例10: NET_OpenSocket

static boolean NET_OpenSocket(void)
{
	memset(clientaddress, 0, sizeof (clientaddress));

	//CONS_Printf("SDL_Net Code starting up\n");

	I_NetSend = NET_Send;
	I_NetGet = NET_Get;
	I_NetCloseSocket = NET_CloseSocket;
	I_NetFreeNodenum = NET_FreeNodenum;
	I_NetMakeNode = NET_NetMakeNode;

	//I_NetCanSend = NET_CanSend;

	// build the socket but close it first
	NET_CloseSocket();
	mysocket = NET_Socket();

	if (!mysocket)
		return false;

	// for select
	myset = SDLNet_AllocSocketSet(1);
	if (!myset)
	{
		CONS_Printf("SDL_Net: %s",SDLNet_GetError());
		return false;
	}
	if (SDLNet_UDP_AddSocket(myset,mysocket) == -1)
	{
		CONS_Printf("SDL_Net: %s",SDLNet_GetError());
		return false;
	}
	return true;
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:35,代码来源:i_net.c

示例11: 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("Toggle <cvar_name>\n"
			"Toggle the value of a cvar\n");
		return;
	}
	cvar = CV_FindVar(COM_Argv(1));
	if (!cvar)
	{
		CONS_Printf("%s is not a cvar\n",COM_Argv(1));
		return;
	}

	if (!(cvar->PossibleValue == CV_YesNo || cvar->PossibleValue == CV_OnOff))
	{
		CONS_Printf("%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:Pupswoof117,项目名称:SRB2-Public,代码行数:31,代码来源:command.c

示例12: NET_NetMakeNode

static SINT8 NET_NetMakeNode(const char *hostname)
{
	INT32 newnode;
	char *portchar;
	UINT16 portnum = sock_port;
	IPaddress hostnameIP;

	// retrieve portnum from address!
	{
		char *localhostname = strdup(hostname);
		strtok(localhostname, ":");
		portchar = strtok(NULL, ":");
		if (portchar)
			portnum = atoi(portchar);
		free(localhostname);
	}

	if (SDLNet_ResolveHost(&hostnameIP,hostname,portnum) == -1)
	{
		CONS_Printf("SDL_Net: %s",SDLNet_GetError());
		return -1;
	}
	newnode = SDLNet_UDP_Bind(mysocket,-1,&hostnameIP);
	if (newnode == -1)
	{
		CONS_Printf("SDL_Net: %s",SDLNet_GetError());
		return newnode;
	}
	newnode++;
	M_Memcpy(&clientaddress[newnode],&hostnameIP,sizeof (IPaddress));
	return (SINT8)newnode;
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:32,代码来源:i_net.c

示例13: CONS_Printf

// Pass a null terminated list of files to use.
// All files are optional, but at least one file must be found.
// The name searcher looks backwards, so a later file does override all earlier ones.
// Also adds GWA files if they exist.
bool FileCache::InitMultipleFiles(const char *const*filenames)
{
  CONS_Printf("Loading resource files...\n");
  bool result = true;

  for ( ; *filenames != NULL; filenames++)
    {
      const char *curfile = *filenames;
      if (AddFile(curfile) == -1)
	result = false;

      // try finding corresponding GWA file (GL-nodes data)
      string gwafile(curfile);
      // Try lower case.
      gwafile.replace(gwafile.length()-3, 3, "gwa");
      if (AddFile(gwafile.c_str(), true) == -1)
	{
	  // not found, try upper case
	  gwafile.replace(gwafile.length()-3, 3, "GWA");
	  if (AddFile(gwafile.c_str(), true) == -1)
	    {
	      // CONS_Printf(" No GL information for file %s.\n", curfile);
	      continue; // not found
	    }
	}

      CONS_Printf(" Added GL information from file %s.\n", gwafile.c_str());
    }

  if (vfiles.size() == 0)
    I_Error("FileCache::InitMultipleFiles: no files found");

  // result = false : at least one file was missing
  return result;
}
开发者ID:meiavy,项目名称:doom-legacy,代码行数:39,代码来源:w_wad.cpp

示例14: 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

示例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("No servers currently running.\n");
			return MS_NO_ERROR;
		}
		count++;
		CONS_Printf("%s",msg.buffer);
	}

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


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