• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CONS_Printf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: COM_Echo_f

/** Prints a line of text to the console.
  */
static void COM_Echo_f(void)
{
	size_t i;

	for (i = 1; i < COM_Argc(); i++)
		CONS_Printf("%s ", COM_Argv(i));
	CONS_Printf("\n");
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:10,代码来源:command.c


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


示例18: CONS_Printf

void GameInfo::LoadGame(int slot)
{
  CONS_Printf("Loading a game...\n");
  char  savename[255];
  byte *savebuffer;

  sprintf(savename, savegamename, slot);

  int length = FIL_ReadFile(savename, &savebuffer);
  if (!length)
    {
      CONS_Printf("Couldn't open save file %s\n", savename);
      return;
    }

  LArchive a;
  if (!a.Open(savebuffer, length))
    return;

  Z_Free(savebuffer); // the compressed buffer is no longer needed

  Downgrade(LEGACY_VERSION); // reset the game version
  SV_Reset();
  ReadResourceLumps();

  // dearchive all the modifications
  if (Unserialize(a))
    {
      CONS_Printf("\aSavegame file corrupted!\n\n");
      SV_Reset();
      return;
    }

  SetState(GS_LEVEL);

  if (netgame)
    net->SV_Open(true); // let the remote players in

  paused = false;

  // view the local human players by default
  for (int i=0; i < NUM_LOCALHUMANS; i++)
    if (LocalPlayers[i].info)
      ViewPlayers.push_back(LocalPlayers[i].info);

  // TODO have other playerinfos waiting for clients to rejoin
  if (ViewPlayers.size())
    hud.ST_Start();
  // done
  /*
  if (setsizeneeded)
    R_ExecuteSetViewSize();

  R_FillBackScreen();  // draw the pattern into the back screen
  */
  con.Toggle(true);
  CONS_Printf("...done.\n");
}
开发者ID:meiavy,项目名称:doom-legacy,代码行数:58,代码来源:p_saveg.cpp


示例19: 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 ("I_InitCD: CD Audio started\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("\2I_InitCD: no CD in player.\n");
		cdEnabled = false;
		cdValid = false;
	}
	else
	{
		cdEnabled = true;
		cdValid = true;
	}

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


示例20: wattcp_outch

static void wattcp_outch(char s)
{
	static char old = '\0';
	char pr[2] = {s,0};
	if (s == old && old == ' ') return;
	else old = s;
	if (s == '\r') CONS_Printf("\n");
	else if (s != '\n') CONS_Printf(pr);
}
开发者ID:RedEnchilada,项目名称:SRB2,代码行数:9,代码来源:i_tcp.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CONTAINER_FIND函数代码示例发布时间:2022-05-30
下一篇:
C++ CONST_STR_LEN函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap