⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 console.cpp

📁 this keik game source
💻 CPP
📖 第 1 页 / 共 3 页
字号:
      newlayout[ 0 ] = 0;

  		token = strtok( layout, seps );
      while ( token )
         {
         // Skip over "fc" console commands in coop
         if ( !strcmp( token, "fc" ) )
            {
            strtok ( NULL, seps );
            strtok ( NULL, seps );
            strtok ( NULL, seps );
            strtok ( NULL, seps );
            }
         else if ( strstr( token, "---" ) )
            {
            strcat( newlayout, "\"\"" );
            // Skip over extraneous lines of characters
            }
         else
            {
            strcat( newlayout, " " );
            strcat( newlayout, token );
            }
     		token = strtok( NULL, seps );
         }
      }

   free( layout );
   strcat(svcon->s.layout, " ");
   strcat(svcon->s.layout, newlayout);
   svcon->s.layout_update_time = level.time;
   }

//==================
//ConsoleClearLayout - Clear the layout string
//==================
void ConsoleManager::ConsoleClearLayout
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.layout[0] = 0;
   svcon->s.layout_update_time = level.time;
   }

//===========
//ConsoleRows - Set the number of rows in the console
//===========
void ConsoleManager::ConsoleRows
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.rows = ev->GetInteger( 2 );
   }

//==============
//ConsoleColumns - Set the number of columns in the console
//==============
void ConsoleManager::ConsoleColumns
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.cols = ev->GetInteger( 2 );
   }

//===================
//ConsoleVirtualWidth - Set the virtual width of the console
//===================
void ConsoleManager::ConsoleVirtualWidth
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.virtual_width = ev->GetFloat( 2 );
   }

//====================
//ConsoleVirtualHeight - Set the virtual height of the console
//====================
void ConsoleManager::ConsoleVirtualHeight
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.virtual_height = ev->GetFloat( 2 );
   }

//===============
//ConsoleFraction - Set the fraction of the console that the scrolling
//part of the console covers.
//===============
void ConsoleManager::ConsoleFraction
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.fraction = ev->GetFloat( 2 );
   }

//=================
//ConsoleDeactivate - Deactivate the console.
//=================
void ConsoleManager::ConsoleDeactivate
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.consoleactive = false;
   }

//=================
//ConsoleActivate - Activate the console
//=================
void ConsoleManager::ConsoleActivate
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.consoleactive = true;
   }

//============
//ConsoleClear - Clears the buffer of the scrolling part of the console
//============
void ConsoleManager::ConsoleClear
   (
   Event *ev
   )
   {
   const char			*bufptr;
   netconbuffer_t    *svbuff;
   netconsole_t      *svcon;

   int num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }
   
   svcon  = &g_consoles[num];
   svbuff = &g_conbuffers[num];
   bufptr = &svbuff->s.buffer[0];
   svbuff->s.start = 0;
   svbuff->s.end = 0;
   svbuff->s.end_index = 0;
   svbuff->s.start_index = 0;
   svcon->s.cleared_console_time = level.time;
   }

//==============
//ConsoleManager - Load a client side menu file
//==============
void ConsoleManager::ConsoleLoadMenuFile
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;
   const char		*path;
   str            mfile;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   path = ev->GetString(2);
   mfile = G_FixSlashes( path );
   strcpy(svcon->s.menu_file, mfile.c_str() );
   svcon->s.menufile_update_time = level.time;
   }

//============
//ConsoleFocus - Change the focus of console to the scrolling part or 
//the menu part.
//============
void ConsoleManager::ConsoleFocus
   (
   Event *ev
   )
   {
   const char		*focus;
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }
   
   svcon  = &g_consoles[num];
   focus  = ev->GetString( 2 );

   if (!stricmp(focus,"menu"))
      {
      svcon->s.focus = MENU3D;
      }
   else if (!strcmp(focus,"console"))
      {
      svcon->s.focus = CONSOLE3D;
      }
   else 
      {
      error("ConsoleManager::ConsoleFocus", "invalid focus type\n" );
      }
   }

//=================
//ConsoleForeground - Set the foreground color of the console
//=================
void ConsoleManager::ConsoleForeground
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;
   num = ConsoleExists(ev->GetString( 1 ));
   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }
   svcon          = &g_consoles[num];
   svcon->s.red   = ev->GetFloat( 2 );
   svcon->s.green = ev->GetFloat( 3 );
   svcon->s.blue  = ev->GetFloat( 4 );
   svcon->s.alpha = ev->GetFloat( 5 );
   }

//===================
//ConsoleMenuActivate - Activates the menu (i.e. draw it)
//===================
void ConsoleManager::ConsoleMenuActive
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.menuactive = true;
   }

//===================
//ConsoleMenuInactive - Deactivates the menu (i.e. don't draw it)
//===================
void ConsoleManager::ConsoleMenuInactive
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;

   num = ConsoleExists(ev->GetString( 1 ));

   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   svcon  = &g_consoles[num];
   svcon->s.menuactive = false;   
   }

//================
//ConsoleStatusBar - Create a status bar on the console.
//================
void ConsoleManager::ConsoleStatusBar
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;
   int            sbar_num;

   num = ConsoleExists(ev->GetString( 1 ));
   
   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   sbar_num = ev->GetInteger(2);
   svcon  = &g_consoles[num];

   svcon->s.sbar[sbar_num].width       = ev->GetFloat(3);
   svcon->s.sbar[sbar_num].height      = ev->GetFloat(4);
   svcon->s.sbar[sbar_num].min         = ev->GetFloat(5);
   svcon->s.sbar[sbar_num].max         = ev->GetFloat(6);
   svcon->s.sbar[sbar_num].value       = ev->GetFloat(7);
   svcon->s.sbar[sbar_num].red         = ev->GetFloat(8);
   svcon->s.sbar[sbar_num].green       = ev->GetFloat(9);
   svcon->s.sbar[sbar_num].blue        = ev->GetFloat(10);
   svcon->s.sbar[sbar_num].alpha       = ev->GetFloat(11);
   svcon->s.sbar[sbar_num].update_time = level.time;
   }

//=====================
//ConsoleStatusBarValue
//=====================
void ConsoleManager::ConsoleStatusBarValue
   (
   Event *ev
   )
   {
   netconsole_t   *svcon;
   int            num;
   int            sbar_num;

   num = ConsoleExists(ev->GetString( 1 ));
   
   if (!num)
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }

   sbar_num = ev->GetInteger(2);
   svcon  = &g_consoles[num];
   svcon->s.sbar[sbar_num].value = ev->GetFloat(3);
   }

//================
//ConsoleKickUsers
//================
void ConsoleManager::ConsoleKickUsers
   (
   Event *ev
   )
   {
   char msg[ MAX_MSGLEN ];

   if (!ConsoleExists(ev->GetString( 1 )))
      {
      // ConsoleExists will give a warning about this console not existing
      return;
      }
   sprintf(msg,"sku %s", ev->GetString(1));
   gi.WriteByte (svc_console_command);
   gi.WriteString (msg);
	gi.multicast (NULL, MULTICAST_ALL);
   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -