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


C++ PlayerInfo::Ticker方法代码示例

本文整理汇总了C++中PlayerInfo::Ticker方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::Ticker方法的具体用法?C++ PlayerInfo::Ticker怎么用?C++ PlayerInfo::Ticker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerInfo的用法示例。


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

示例1: Ticker

// ticks the game forward in time
void GameInfo::Ticker()
{
  tic++;

  // TODO read/write demo ticcmd's here

  // do main actions
  switch (state)
    {
    case GS_INTRO:
      if (--pagetic <= 0)
	AdvanceIntro();
      break;

    case GS_LEVEL:
      if (!paused && currentcluster)
	currentcluster->Ticker();

      if (!dedicated)
	{
	  hud.Ticker();
	  automap.Ticker();
	}
      break;

    case GS_INTERMISSION:
      wi.Ticker();
      break;

    case GS_FINALE:
      F_Ticker();
      break;

    case GS_NULL:
    default:
      // do nothing
      break;
    }


  MapInfo *m;
  PlayerInfo *p;

  if (state != GS_LEVEL)
    return;

  // manage players
  for (player_iter_t t = Players.begin(); t != Players.end(); )
    {
      p = t->second;
      t++; // because "old t" may be invalidated

      if (p->playerstate == PST_REMOVE)
	{
	  // the player is removed from the game (invalidates "old t")
	  if (!p->mp)
	    RemovePlayer(p->number); // first the maps throw out the removed player, then the game proper.

	  // TODO purge the removed players from the frag maps of other players?
	}
      else
	p->Ticker();
    }

  if (!server)
    return;

  //
  for (player_iter_t t = Players.begin(); t != Players.end(); t++)
    {
      p = t->second;

      if (p->playerstate == PST_NEEDMAP)
	{
	  LConnection *conn = p->connection;
	  if (conn && !conn->isGhostAvailable(p))
	    {
	      // remote player, is it already being ghosted? if not, wait.
	      CONS_Printf(" server waiting for client ghost\n");
	      continue;
	    }

	  // assign the player to a map
	  CONS_Printf("Map request..");

	  if (p->requestmap == 0)
	    {
	      m = initial_map; // first map in game
	      p->entrypoint = initial_ep;
	    }
	  else
	    m = FindMapInfo(p->requestmap);

	  if (!m)
	    {
	      // game ends
	      currentcluster->Finish(p->requestmap, p->entrypoint);
	      StartFinale(NULL);
	      break;
//.........这里部分代码省略.........
开发者ID:meiavy,项目名称:doom-legacy,代码行数:101,代码来源:g_state.cpp


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